svarness 0.0.0-stage → 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.
@@ -0,0 +1,247 @@
1
+ var K=!0;var qn=Array.isArray,Zp=Array.prototype.indexOf,Ms=Array.prototype.includes,po=Array.from,{keys:yu,defineProperty:Vt,getOwnPropertyDescriptor:zr,getOwnPropertyDescriptors:wu,prototype:fc}=Object,Jp=Array.prototype,{getPrototypeOf:Is,isExtensible:xu}=Object;var Rt=()=>{};function dc(e){for(var t=0;t<e.length;t++)e[t]()}function pc(){var e,t,r=new Promise((n,s)=>{e=n,t=s});return{promise:r,resolve:e,reject:t}}var Ge=2,Wn=4,li=8,Ii=16777216,Or=16,Qt=32,Kr=64,Xn=128,mc=256,Wt=512,Mt=1024,vt=2048,It=4096,Xt=8192,at=16384,Zr=32768,fs=33554432,fr=65536,ds=131072,$u=262144,Kn=524288,Eu=1048576,dr=33554432,Ds=2097152,pr=4194304,mr=8388608,Di=134217728,Ur=67108864,Jr=Symbol("$state"),gc=Symbol("component"),Da=Symbol("legacy props"),vc=Symbol("proxy path"),bc=Symbol("attributes"),Pa=Symbol("class"),qa=Symbol("style"),La=Symbol("text"),ci=Symbol("form reset"),Au=Symbol("hmr anchor"),mo=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},go=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml"),Fa=1,Pi=3,un=8;var Qp={fragment:11,element:1,text:3,comment:8};var em=1,tm=2,Tu=4,rm=8,nm=16,sm=1,im=2,om=4,am=8,lm=16;var Cu=1;var vo="[",qi="[!",ja="[?",Li="]",yn={};var xt=Symbol("uninitialized"),wn=Symbol("filename"),cm=Symbol("hmr"),Fi="http://www.w3.org/1999/xhtml",bo="http://www.w3.org/2000/svg";var Su="@attach";var ps="font-weight: bold",ms="font-weight: normal";function _m(e){if(K)console.warn(`%c[svelte] await_reactivity_loss
2
+ %cDetected reactivity loss when reading \`${e}\`. This happens when state is read in an async function after an earlier \`await\`
3
+ https://svelte.dev/e/await_reactivity_loss`,ps,ms);else console.warn("https://svelte.dev/e/await_reactivity_loss")}function um(e,t){if(K)console.warn(`%c[svelte] await_waterfall
4
+ %cAn async derived, \`${e}\` (${t}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app
5
+ https://svelte.dev/e/await_waterfall`,ps,ms);else console.warn("https://svelte.dev/e/await_waterfall")}function hm(){if(K)console.warn(`%c[svelte] derived_inert
6
+ %cReading a derived belonging to a now-destroyed effect may result in stale values
7
+ https://svelte.dev/e/derived_inert`,ps,ms);else console.warn("https://svelte.dev/e/derived_inert")}function fm(e,t,r){if(K)console.warn(`%c[svelte] hydration_attribute_changed
8
+ %cThe \`${e}\` attribute on \`${t}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value
9
+ https://svelte.dev/e/hydration_attribute_changed`,ps,ms);else console.warn("https://svelte.dev/e/hydration_attribute_changed")}function ji(e){if(K)console.warn(`%c[svelte] hydration_mismatch
10
+ %c${e?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${e}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
11
+ https://svelte.dev/e/hydration_mismatch`,ps,ms);else console.warn("https://svelte.dev/e/hydration_mismatch")}function dm(){if(K)console.warn(`%c[svelte] lifecycle_double_unmount
12
+ %cTried to unmount a component that was not mounted
13
+ https://svelte.dev/e/lifecycle_double_unmount`,ps,ms);else console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function pm(){if(K)console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\nhttps://svelte.dev/e/select_multiple_invalid_value",ps,ms);else console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function kc(e){if(K)console.warn(`%c[svelte] state_proxy_equality_mismatch
14
+ %cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${e}\` will produce unexpected results
15
+ https://svelte.dev/e/state_proxy_equality_mismatch`,ps,ms);else console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function mm(){if(K)console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",ps,ms);else console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function gm(e){if(K)console.warn(`%c[svelte] svelte_element_invalid_namespace
16
+ %c\`<svelte:element this={'${e}'}>\` will be created without the SVG namespace. Add an \`xmlns="http://www.w3.org/2000/svg"\` attribute to this element or an ancestor \`<svelte:element>\`
17
+ https://svelte.dev/e/svelte_element_invalid_namespace`,ps,ms);else console.warn("https://svelte.dev/e/svelte_element_invalid_namespace")}var pe=!1;function $t(e){pe=e}var Pe;function _t(e){if(e===null)throw ji(),yn;return Pe=e}function vr(){return _t(tr(Pe))}function ue(e){if(!pe)return;if(tr(Pe)!==null)throw ji(),yn;Pe=e}function or(e=1){if(pe){var t=e,r=Pe;while(t--)r=tr(r);Pe=r}}function gs(e=!0){var t=0,r=Pe;while(!0){if(Kt(r)===un){var n=Qr(r)??"";if(n===Li){if(t===0)return r;t-=1}else if(n===vo||n===qi||n.startsWith(ja)||n[0]==="["&&!isNaN(Number(n.slice(1))))t+=1}var s=tr(r);if(e)Ps(r);r=s}}function zi(e){if(!e||Kt(e)!==un)throw ji(),yn;return Qr(e)??""}function yc(e){return e===this.v}function Ou(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e==="object"||typeof e==="function"}function wc(e){return!Ou(e,this.v)}function vm(){if(K){let e=Error("invalid_snippet\nCould not `{@render}` a non-snippet value\nhttps://svelte.dev/e/invalid_snippet");throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/invalid_snippet")}function bm(){if(K){let e=Error("invalid_snippet_nullish\nCould not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\nhttps://svelte.dev/e/invalid_snippet_nullish");throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/invalid_snippet_nullish")}function km(e){if(K){let t=Error(`invariant_violation
18
+ An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${e}"
19
+ https://svelte.dev/e/invariant_violation`);throw t.name="Svelte error",t}else throw Error("https://svelte.dev/e/invariant_violation")}function za(e){if(K){let t=Error(`lifecycle_outside_component
20
+ \`${e}(...)\` can only be used during component initialisation
21
+ https://svelte.dev/e/lifecycle_outside_component`);throw t.name="Svelte error",t}else throw Error("https://svelte.dev/e/lifecycle_outside_component")}function ym(){if(K){let e=Error("set_context_after_init\n`setContext` must be called when a component first initializes, not in a subsequent effect or after an `await` expression\nhttps://svelte.dev/e/set_context_after_init");throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/set_context_after_init")}function Nu(){if(K){let e=Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function xc(e){if(K){let t=Error(`custom_renderer_unsupported_operation
22
+ \`${e}\` is not supported when rendering with a custom renderer
23
+ https://svelte.dev/e/custom_renderer_unsupported_operation`);throw t.name="Svelte error",t}else throw Error("https://svelte.dev/e/custom_renderer_unsupported_operation")}function xm(){if(K){let e=Error(`derived_references_self
24
+ A derived value cannot reference itself recursively
25
+ https://svelte.dev/e/derived_references_self`);throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/derived_references_self")}function Ru(e,t,r){if(K){let n=Error(`each_key_duplicate
26
+ ${r?`Keyed each block has duplicate key \`${r}\` at indexes ${e} and ${t}`:`Keyed each block has duplicate key at indexes ${e} and ${t}`}
27
+ https://svelte.dev/e/each_key_duplicate`);throw n.name="Svelte error",n}else throw Error("https://svelte.dev/e/each_key_duplicate")}function $m(e,t,r){if(K){let n=Error(`each_key_volatile
28
+ Keyed each block has key that is not idempotent — the key for item at index ${e} was \`${t}\` but is now \`${r}\`. Keys must be the same each time for a given item
29
+ https://svelte.dev/e/each_key_volatile`);throw n.name="Svelte error",n}else throw Error("https://svelte.dev/e/each_key_volatile")}function Em(e){if(K){let t=Error(`effect_in_teardown
30
+ \`${e}\` cannot be used inside an effect cleanup function
31
+ https://svelte.dev/e/effect_in_teardown`);throw t.name="Svelte error",t}else throw Error("https://svelte.dev/e/effect_in_teardown")}function Am(){if(K){let e=Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/effect_in_unowned_derived")}function Tm(e){if(K){let t=Error(`effect_orphan
32
+ \`${e}\` can only be used inside an effect (e.g. during component initialisation)
33
+ https://svelte.dev/e/effect_orphan`);throw t.name="Svelte error",t}else throw Error("https://svelte.dev/e/effect_orphan")}function Cm(){if(K){let e=Error(`effect_update_depth_exceeded
34
+ Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
35
+ https://svelte.dev/e/effect_update_depth_exceeded`);throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Sm(){if(K){let e=Error(`hydration_failed
36
+ Failed to hydrate the application
37
+ https://svelte.dev/e/hydration_failed`);throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/hydration_failed")}function Mu(){if(K){let e=Error("invalid_bundler_config\nSvelte's DOM operations have not been initialized. This can happen if a bundler incorrectly removes side-effect-only imports. Check the `sideEffects` setting in your package.json\nhttps://svelte.dev/e/invalid_bundler_config");throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/invalid_bundler_config")}function Om(e){if(K){let t=Error(`props_invalid_value
38
+ Cannot do \`bind:${e}={undefined}\` when \`${e}\` has a fallback value
39
+ https://svelte.dev/e/props_invalid_value`);throw t.name="Svelte error",t}else throw Error("https://svelte.dev/e/props_invalid_value")}function Nm(e){if(K){let t=Error(`props_rest_readonly
40
+ Rest element properties of \`$props()\` such as \`${e}\` are readonly
41
+ https://svelte.dev/e/props_rest_readonly`);throw t.name="Svelte error",t}else throw Error("https://svelte.dev/e/props_rest_readonly")}function Rm(e){if(K){let t=Error(`rune_outside_svelte
42
+ The \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
43
+ https://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}else throw Error("https://svelte.dev/e/rune_outside_svelte")}function Mm(){if(K){let e=Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/state_descriptors_fixed")}function Im(){if(K){let e=Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/state_prototype_fixed")}function Dm(){if(K){let e=Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/state_unsafe_mutation")}function Pm(){if(K){let e=Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw e.name="Svelte error",e}else throw Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var We=!1,qs=!1,Zn=!1,lt=!1;var vk="font-weight: bold",bk="font-weight: normal";function Iu(e){if(K)console.warn(`%c[svelte] state_snapshot_uncloneable
44
+ %c${e?`The following properties cannot be cloned with \`$state.snapshot\` — the return value contains the originals:
45
+
46
+ ${e}`:"Value cannot be cloned with `$state.snapshot` — the original value was returned"}
47
+ https://svelte.dev/e/state_snapshot_uncloneable`,vk,bk);else console.warn("https://svelte.dev/e/state_snapshot_uncloneable")}var kk=[];function _i(e,t=!1,r=!1){if(K&&!t){let n=[],s=Ua(e,new Map,"",n,null,r);if(n.length===1&&n[0]==="")Iu();else if(n.length>0){let i=n.length>10?n.slice(0,7):n.slice(0,10),o=n.length-i.length,a=i.map((l)=>`- <value>${l}`).join(`
48
+ `);if(o>0)a+=`
49
+ - ...and ${o} more`;Iu(a)}return s}return Ua(e,new Map,"",kk,null,r)}function Ua(e,t,r,n,s=null,i=!1){if(typeof e==="object"&&e!==null){var o=t.get(e);if(o!==void 0)return o;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(qn(e)){var a=Array(e.length);if(t.set(e,a),s!==null)t.set(s,a);for(var l=0;l<e.length;l+=1){var _=e[l];if(l in e)a[l]=Ua(_,t,K?`${r}[${l}]`:r,n,null,i)}return a}if(Is(e)===fc){if(a={},t.set(e,a),s!==null)t.set(s,a);for(var c of Object.keys(e))a[c]=Ua(e[c],t,K?`${r}.${c}`:r,n,null,i);return a}if(e instanceof Date)return e.getTime(),structuredClone(e);if(typeof e.toJSON==="function"&&!i)return Ua(e.toJSON(),t,K?`${r}.toJSON()`:r,n,e)}if(e instanceof EventTarget)return e;try{return structuredClone(e)}catch(h){if(K)n.push(r);return e}}var Ui=[];function Lm(){var e=Ui;Ui=[],dc(e)}function ar(e){if(Ui.length===0&&!Bi){var t=Ui;queueMicrotask(()=>{if(t===Ui)Lm()})}Ui.push(e)}function Fm(){while(Ui.length>0)Lm()}var yk=~(vt|It|Mt);function Zt(e,t){e.f=e.f&yk|t}function ui(e){if((e.f&Wt)!==0||e.edges===null)Zt(e,Mt);else Zt(e,It)}function Jn(e){let t=Error(),r=wk();if(r.length===0)return null;return r.unshift(`
50
+ `),Vt(t,"stack",{value:r.join(`
51
+ `)}),Vt(t,"name",{value:e}),t}function wk(){let e=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let t=Error().stack;if(Error.stackTraceLimit=e,!t)return[];let r=t.split(`
52
+ `),n=[];for(let s=0;s<r.length;s++){let i=r[s],o=i.replaceAll("\\","/");if(i.trim()==="Error")continue;if(i.includes("validate_each_keys"))return[];if(o.includes("svelte/src/internal")||o.includes("node_modules/.vite"))continue;n.push(i)}return n}function $c(e,t){if(!K)throw Error("invariant(...) was not guarded by if (DEV)");if(!e)km(t)}function xk(e){let t=e.p;while(t!==null&&t.c===null)t=t.p;return t?.c??null}function Du(e,t){if(e===null)za(t);return e.c??=new Map(xk(e)||void 0)}var He=null;function Ls(e){He=e}var xn=null;function ko(e){xn=e}var Qn=null;function Ec(e){Qn=e}function Fs(e){return Du(He,"getContext").get(e)}function js(e,t){let r=Du(He,"setContext");if(We){var n=Ae.f,s=!qe&&(n&Qt)!==0&&!He.i;if(!s)ym()}return r.set(e,t),t}function Oe(e,t=!1,r){if(He={p:He,i:!1,c:null,e:null,s:e,x:null,r:Ae,l:qs&&!t?{s:null,u:null,$:[]}:null},K)He.function=r,Qn=r}function Ne(e){var t=He,r=t.e;if(r!==null){t.e=null;for(var n of r)Pu(n)}if(e!==void 0)t.x=e;if(t.i=!0,He=t.p,K)Qn=He?.function??null;return Ba(e)}function Ba(e={}){return Vt(e,gc,{value:!0}),e}function es(){return!qs||He!==null&&He.l===null}var ee=null;function qu(e){ee=e}var Tc=0,Ac=[];function br(e){var t=ee;if(ee=e,Tc+=1,pe&&e!==null)$t(!1),Ac.push(Tc);return t}function kr(e){if(Ac[Ac.length-1]===Tc)Ac.pop(),$t(!0);Tc-=1,ee=e}function Ha(e,t,r,n){var s=Ae,i=t.map(es()?hi:Hi);if(K)i.forEach((h,d)=>{h.label=t[d].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(f,p)=>p)});if(!We){n(i);return}var o=e.filter((h)=>!h.settled);if(o.length>0){var a=jm(),l=Lu(),_=o.length===1?o[0].promise:Promise.all(o.map((h)=>h.promise));_.then(()=>{if((s.f&at)!==0)return;a(o[0].run.get_batch());try{c()}catch(h){en(h,s)}Va()}).finally(l)}else c();function c(){if(e.some((f)=>f.failed))return;if(r.length===0){n(i);return}var h=r.map((f)=>Um(f)),d=null;Nr(()=>{for(var f of h)if(Bm(f)){y(f);return}if(d!==null)Re.revalidate_branch(d);else d=zt(()=>{try{n([...i,...h])}catch(p){en(p,s)}})},fr)}}function jm(){var e=Ae,t=qe,r=He,n=Re,s=lt?ee:null;if(K)var i=xn;return function(a=n){if(yr(e),lr(t),Ls(r),lt)qu(s);if(a!==null&&(e.f&at)===0)Br(a).activate();if(K)Fu(null),ko(i)}}var $k=!1;function Va(e=!0){if($k=!1,yr(null),lr(null),Ls(null),lt)qu(null);if(e)Re?.deactivate();if(K)Fu(null),ko(null)}var zm=null;function Lu(){var e=Ae,t=e.b,r=Br(Re);return r.increment(e),t?.update_effect_pending(1),()=>{t?.update_effect_pending(-1),Br(r).decrement(e)}}function Br(e){while(e.merged!==null)e=e.merged;return e}function Hm(e){return`{${e.toString().replace(/^async \(\) => /,"").replace(/^\(/,"").replace(/\$\.get\((.+?)\)/g,(t,r)=>r).replace(/\$\.track_reactivity_loss\((.+?)\)\(\)/g,(t,r)=>r).replace(/\)$/,"")}}`}var hn=null;function Fu(e){hn=e}var Ya=new Set;function hi(e){var t=Ge|vt;if(Ae!==null)Ae.f|=Kn;let r={ctx:He,deps:null,dv:null,edges:null,effects:null,equals:yc,f:t,fn:e,reactions:null,rv:0,v:xt,wv:0,parent:Ae,ac:null};if(K&&Zn)r.created=Jn("created at");return r}var ts=Symbol("obsolete");function Um(e,t,r,n){var s=fn(xt);if(s.f|=pr,K)s.label=t??Hm(e);var i=new Set,o=zm,a=o&&Re,l=o&&[];function _(c=!1){var h=l;if(h===null)return;if(l=c?null:[],c)a=null;for(let d of h)d()}return ju(()=>{var c=Ae;if(K)hn={effect:c,effect_deps:new Set,warned:!1};var h=pc();try{var d=e();if(d===xt)return;var f=Promise.resolve(d),p=nn?.signal;f.then((k)=>{if(Va(),!p?.aborted)h.resolve(k)},(k)=>{if(Va(),p?.aborted||k===mo&&o===null)return;h.reject(k===mo?ts:k)})}catch(k){h.reject(k)}if(K){if(hn){if(c.deps!==null)for(let k=0;k<rn;k+=1)hn.effect_deps.add(c.deps[k]);if(Dt!==null)for(let k=0;k<Dt.length;k+=1)hn.effect_deps.add(Dt[k])}hn=null}var m=Re,g=Lu();m.async_deriveds.get(c)?.reject(ts),i.add(h),m.async_deriveds.set(c,h);let b=(k,x=void 0)=>{if(K)$c(Et===null,"Batch is currently active"),hn=null;if(l!==null&&x!==ts){if(a??=m,Br(m)!==Br(a)){l.push(()=>{var O=(c.f&at)!==0||(m.linked?m.async_deriveds.get(c)!==h:!Br(m).linked);b(k,O?ts:x)});return}}if(g(),i.delete(h),x){if(l!==null&&a!==null&&(i.size>0||x===ts)&&Br(a)===Br(m)&&Br(m).async_deriveds.get(c)===h){a=null,_();return}else if(x===ts)return}var w=s.equals(k)&&!x&&(s.f&mr)===0;if(Br(m).capture(s,x??k,w,!!x),o!==null)o.switch(m),o.continued.push(()=>_(!0)),o=null;if(n?.(x),n=void 0,K&&r!==void 0&&!s.equals(k))Ya.add(s),setTimeout(()=>{if(Ya.has(s)&&(c.f&at)===0)um(s.label,r),Ya.delete(s)})};h.promise.then(b,(k)=>b(null,k||"unknown"))}),nr(()=>{n?.(ts),n=void 0;for(let c of i)c.reject(ts);if(l!==null)queueMicrotask(()=>_(!0))}),s}function Bm(e){return(Je?.get(e)??e).v===xt}function ne(e){let t=hi(e);if(!We)Cc(t);return t}function Hi(e){let t=hi(e);return t.equals=wc,t}function Ek(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)Pt(t[r])}}var zu=[];function yo(e){var t=Ae,r=e.parent;if(!Rr&&r!==null&&e.v!==xt&&(r.f&(at|Xt))!==0)return hm(),ui(e),e.v;if(K&&Ms.call(zu,e))xm();yr(r);var n=zs;if(K)Uu(new Set),zu.push(e);try{return Ek(e),Hu(e)}finally{if(yr(t),K)Uu(n),zu.pop()}}function wo(e){var t=e;if(!fi(t))return;var r=Et?.records,n=r?.get(t);if(n!==void 0&&Ga(n.deps,n.dv))r.delete(t),Oc(t,n);else yo(t)}function xo(e){var t=tn,r=t.get(e);if(r!==void 0)return r;if($n!==null&&(e.f&Wt)===0){if(r=Ym(e),r!==void 0)return r}var n=$o,s=Et,i=Je.get(e),o=i??e,a=i===void 0?(e.f&Ur)!==0:i.assigned,l=s.get_record(e);if(a&&!Sc((l??e).deps,o.wv))r=o;else if(l!==void 0&&Ga(l.deps,l.dv))r=l;else if(i===void 0&&!a&&e.dv!==null&&Ga(e.deps,e.dv))r=e;else yo(e),r=s.records?.get(e)??e;if((e.f&Wt)!==0)t.set(e,r);else if($n!==null)Gm(e,r,n);return r}function Vm(e){if(e.effects===null)return;for(let t of e.effects)if(t.teardown||(t.f&Di)!==0){if(t.teardown?.(),Xa(t),t.fn!==null)t.teardown=Rt;Ka(t),Wa(t)}}function Bu(e){if(e.effects===null)return;for(let t of e.effects)if(t.teardown&&t.fn!==null)vs(t)}var wr=null,Vi=null,Re=null,Nc=null,Ut=null;function Pc(e){Ut=e}function Ja(e){var t=Ut={reverted_values:new Map(Ut?.reverted_values),derived_cache:new Map,parent:Ut};for(let[r,n]of e??[])t.reverted_values.set(r,n);return t}function Xu(e){for(var t=Ut;t!==null;t=t.parent)t.reverted_values.delete(e),t.derived_cache.clear()}var Je=null,tn=null,Et=null,Yu=null,Rc=new Set,di=new Set,Bi=!1,Eo=null,Ao=null,Wm=0,Za=new Set,Yi=null,Vu=0,Tk=1,Mc=null;class Hr{id=Tk++;started=!1;linked=!0;prev=null;next=null;async_deriveds=new Map;current=new Map;previous=new Map;records=null;folded=[];#r=new Map;#t=new Map;#e=new Map;#o=[];#n=null;#s=new Map;#a=[];#i=new Set;#l=new Set;is_fork=!1;merged=null;merge_requests=new Set;#u=!1;#_=!1;constructor(){if(Vi===null)wr=Vi=this;else Vi.next=this,this.prev=Vi;Vi=this}#d(){if(!We)return!1;if(this.is_fork)return!0;for(let e of this.#e.keys())if(this.is_blocked_by(e))return!0;return!1}#h(e){return this.#i.has(e)||(e.f&dr)!==0&&!this.#l.has(e)}is_skipped(e){for(var t=e;t!==null;t=t.parent)if(this.#h(t))return!0;return!1}is_blocked_by(e,t=null){if(!We)return!1;for(var r=e;r!==null&&r!==t;r=r.parent){if(this.#h(r))return!1;if((r.f&(Xn|at))===Xn&&r.b.is_pending)return!1}return r===t}is_boundary_ready(e){if(!We)return!0;for(var t=e;t!==null;t=t.parent)if((t.f&(Xt|at))!==0||this.#h(t))return!1;for(var r=wr;r!==null;r=r.next){if(r!==this&&!r.#u)continue;for(let n of r.#e.keys())if(this.is_blocked_by(n,e))return!1}return!0}skip_effect(e){this.#i.add(e),this.#l.delete(e)}unskip_effect(e){if(this.#i.delete(e)||!this.#l.has(e)&&((e.f&dr)!==0||this.folded.some((t)=>t.#i.has(e))))this.revalidate_branch(e);this.#l.add(e)}unskip_new_effect(e){this.#l.add(e)}revalidate_branch(e){for(var t=e.first;t!==null;t=t.next){var r=t.f;if((r&(at|Xt))===0&&!this.#h(t)){if((r&(Qt|Kr|ds))===0&&t.fn!==null)this.schedule(t,It);this.revalidate_branch(t)}}}#m(){var e=[];for(let s of this.#a){if((s.f&at)!==0||(s.f&(vt|It))===0)continue;var t=s,r=!1;while(t.parent!==null){t=t.parent;var n=t.f;if((n&(Kr|Qt))!==0){if((n&Mt)===0){r=!0;break}t.f^=Mt}}if(!r)e.push(t)}return this.#a=[],e}#c(){var e=this;while(e!==null)e=e.#f()}#f(){if(Re=Nc=this,this.#o.length>0){for(let f of this.#o){var e=this.#e.get(f)??0;if(e<=1)this.#e.delete(f);else this.#e.set(f,e-1)}this.#o.length=0}if(Ut?.derived_cache.clear(),We&&this.started&&Mc!==this.id)this.#p(this.current.keys());if(this.started=!0,Mc=this.id,this.#s.size>0){for(let[f,p]of this.#s)this.#E(f,p);this.#s.clear()}if(K)for(let f of this.current.keys())Za.add(f);this.activate();var t=Eo=[],r=[],n=Ao=[];while(this.#a.length>0){if(Wm++>1000)this.#y(),Ck();for(let f of this.#m())try{this.#g(f,t,r)}catch(p){if(Gu(f,!0),!this.#d())this.discard();throw p}if(this.#a.length>0){for(let f of r)this.#a.push(f);for(let f of t)this.#a.push(f);r.length=0,t.length=0}}if(Re=null,n.length>0){var s=Hr.ensure();for(let f of n)if((f.f&Mt)===0)s.schedule(f,It)}if(Eo=null,Ao=null,this.merge_requests.size>0){let f=Array.from(this.merge_requests,Br).filter((p)=>p!==this&&p.linked&&!p.is_fork).sort((p,m)=>p.id-m.id);if(this.merge_requests.clear(),f.length>0){this.#v(r),this.#v(t);var i=this,o=f.length;while(o--){var a=f[o];if(a===i)continue;a.#x(i),i=a}return i}}if(this.#d()){this.#v(r),this.#v(t);for(let f of this.#i)Gu(f);if(n.length>0)return Re;return null}let l=this.#b();if(l)return this.#v(r),this.#v(t),l.#x(this),l;if(We&&di.size>0){for(let f of di)if(f.is_ready(this))f.reveal(),f.queue_effects(t)}this.#A(!0),this.#$(this.#r);var _=Ic,c=To;try{Ic=!0;var h=Km(r);if(lt&&Xm!==null)Xm();Km(t,h)}finally{Ic=_,To=c}this.#n?.resolve();var d=Re;if(this.#e.size===0&&(this.#a.length===0||d!==null))this.#y();if(We)this.commit_writes();if(d!==null){if(Ut!==null){for(let[f,p]of Ut.reverted_values)if(d.previous.get(f)?.wv!==p.wv)Ut.reverted_values.delete(f)}}return d}#p(e){if(!We)return;var t=new Set(e),r=new Set;for(let o of t){var n=o.reactions;if(n===null)continue;for(let a of n){var s=a.f;if((s&Ge)!==0){if((s&Mt)!==0)Zt(a,It);t.add(a);continue}var i=a;if(r.has(i))continue;if(r.add(i),(s&(ds|Xt|at))===0&&!this.is_skipped(i))this.schedule(i,It)}}}#g(e,t,r){e.f^=Mt;var n=e.first;while(n!==null){var s=n.f,i=(s&(Qt|Kr))!==0,o=i&&(s&Mt)!==0,a=o||(s&(Xt|ds))!==0||this.#h(n);if(!a&&n.fn!==null){if(i)n.f^=Mt;else if((s&Wn)!==0)t.push(n);else if(We&&(s&(li|Ii))!==0)r.push(n);else if(fi(n))vs(n);var l=n.first;if(l!==null){n=l;continue}}while(n!==null){var _=n.next;if(_!==null){n=_;break}n=n.parent}}}#b(){for(var e=this.prev;e!==null;e=e.prev)if(!e.is_fork&&this.#w(e))return e;return null}#w(e){for(let t of this.current.keys())if(e.current.has(t))return!0;return!1}#x(e){for(let n of e.merge_requests)this.merge_requests.add(n);e.merge_requests.clear();for(let[n,s]of e.current){if(!this.previous.has(n)){let i=e.previous.get(n);if(i)this.previous.set(n,i)}this.current.set(n,s)}for(let[n,s]of e.async_deriveds){let i=this.async_deriveds.get(n);if(i&&i!==s)s.promise.then(i.resolve,i.reject);this.async_deriveds.set(n,s)}for(let[n,s]of e.records??[])if((n.f&Or)===0){var t=this.records?.get(n);(this.records??=new Map).set(n,s),e.records?.delete(n),Qa(n,t)}if(e.async_deriveds.clear(),e.#e.size>0){for(let[n,s]of e.#e)this.#e.set(n,(this.#e.get(n)??0)+s);e.#e.clear()}if(e.#o.length>0){for(let n of e.#o)this.#o.push(n);e.#o.length=0}if(e.#s.size>0){for(let[n,s]of e.#s)this.#k(n,s);e.#s.clear()}let r=()=>e.discard();this.oncommit(r),this.ondiscard(r),e.merged=this,e.#y()}#k(e,t){if(t===vt||this.#s.get(e)!==vt)this.#s.set(e,t)}#v(e){for(var t=0;t<e.length;t+=1){var r=e[t],n=r.f&(vt|It);if(n!==0)this.#k(r,r.dv===null?It:n),Zt(r,Mt)}}capture(e,t,r,n=!1,s=null){var i=this.previous.get(e),o=Ok(this,e);if(i===void 0){if(i=o?.previous.get(e),i===void 0&&(e.v!==xt||(e.f&(Ge|pr))===0))i={v:e.v,wv:e.wv,e:(e.f&mr)!==0,assigned:(e.f&Ur)!==0};if(i!==void 0)this.previous.set(e,i)}if(Rr)Xu(e);else if(i!==void 0)Ut?.reverted_values.set(e,i),Ut?.derived_cache.clear();var a={v:t,wv:r?e.wv:rl(),e:n,assigned:(e.f&Ge)!==0,async:(e.f&pr)!==0};if(this.current.set(e,a),Ic)(To??=new Set).add(e);if(Je?.set(e,a),r)tl();if(tn?.delete(e),!this.is_fork&&o!==null)o.previous.set(e,a);if(!this.is_fork&&!r&&o===null)Nk(e,a);if(!r){if(Yi=null,Vu=0,this.mark(e,vt,s),Yi=null,Wu&&zs.size>0&&qc===0)Ku()}}deactivate(){Re=Nc=Je=tn=Et=null}flush(){var e=Ja(this.previous);try{if(this.#c(),Rc.size>0){for(let t of Rc)if(Rc.delete(t),t.linked&&!t.#_)t.#c()}}finally{if(Wm=0,Yu=null,Eo=null,Ao=null,Ut=e.parent,this.deactivate(),K){for(let t of Za)t.updated=null;Za.clear()}}}discard(){this.#$(this.#t);for(let e of this.async_deriveds.values())e.reject(ts);this.#y(),this.#n?.resolve()}#T(){if(!We)return;for(let s=wr;s!==null;s=s.next){if(s===this)continue;var e=s.id<this.id,t=[];for(let[i,o]of this.current){var r=s.current.get(i);if(r!==void 0)if(e&&o.v!==r.v&&!r.async)s.current.set(i,o);else continue;t.push(i)}if(!s.started||s.current.size===0)continue;var n=!0;for(let i of s.current.keys())if(!this.current.has(i)){n=!1;break}if(n&&e)s.discard();else if(t.length>0){if(K&&!s.#_)$c(s.#a.length===0,"Batch has scheduled effects");s.#p(t),Rc.add(s)}}this.current.clear(),this.previous.clear()}commit_writes(){if(!We)return;if(this.#u=!0,this.#T(),this.linked&&this.prev!==null)this.#C()}increment(e){if(!We)return;var t=this.#e.get(e)??0;this.#e.set(e,t+1)}decrement(e){if(!We)return;if(this.#o.push(e),this.#_)return;this.#_=!0,ar(()=>{if(this.#_=!1,this.linked)this.flush()})}oncommit(e){this.#r.set(e,Bs?.size?Bs:null)}ondiscard(e){this.#t.set(e,Bs?.size?Bs:null)}#$(e){pt(()=>{for(let[r,n]of e){if(n===null){r(this);continue}var t=Ja();for(let[s,i]of n)if(t.reverted_values.has(s))t.reverted_values.set(s,i);try{r(this)}finally{Ut=t.parent}}}),e.clear()}settled(){return(this.#n??=pc()).promise}static ensure(){if(Re===null){let e=Re=new Hr;if(Nc===null&&!Bi)ar(()=>{if(!e.started)e.flush()})}return Re}activate(){if(Re=this,Et=this,Mc!==this.id)Mc=null;if(!We){Je=tn=null;return}if(this.folded=[],!this.is_fork&&this.prev===null&&this.next===null){Je=tn=null;return}Je=new Map(this.current),tn=new Map;for(let e=wr;e!==null;e=e.next){if(e===this||e.is_fork)continue;if(e.id<this.id&&e.#w(this))this.folded.push(e);else for(let[t,r]of e.previous)if(!Je.has(t)&&((t.f&Ge)!==0||!t.equals(r.v)))Je.set(t,r)}}get_record(e){var t=this.records?.get(e),r=this.folded.length;while(t===void 0&&r--)t=this.folded[r].records?.get(e);return t}mark(e,t,r=null){var n=e.reactions;if(n===null)return;var s=es(),i=n.length;if(Vu+=i,Vu>1e5&&Yi===null)Yi=new Set;if(Yi!==null){if(Yi.has(e))return;Yi.add(e)}for(var o=0;o<i;o++){var a=n[o],l=a.f;if(!s&&a===Ae)continue;var _=(l&vt)===0;if(Wu&&(l&ds)!==0){if(!this.is_fork){if(_)Zt(a,t);zs.add(a)}}else if((l&Ge)!==0){if(_)Zt(a,t);var c=a;tn?.delete(c),this.mark(c,It,r)}else if(_){var h=a;if((l&Or)!==0&&Us!==null)Zt(h,t),Us.add(h);if(r!==null)Zt(h,t),r.push(h);else this.schedule(h,t)}}}schedule(e,t){if(Yu=e,Et!==null&&Et!==this&&e!==qe){this.#k(e,(e.f&Ds)!==0?t:It);return}if(Nc!==this&&qe===null){if(this.prev!==null||this.next!==null||this.is_fork){this.#k(e,It);return}t=It}this.#E(e,t)}#E(e,t){if((e.f&vt)===0)Zt(e,t);this.#a.push(e)}#A(e=!1){var t=this.records;if(t===null)return;this.records=null;for(let[n,s]of t){if((n.f&(Ge|at))===0){var r=(n.f&pr)!==0&&Dc(s)&&!Dc(n);if(e&&!r){if(Oc(n,s),(n.f&pr)!==0){for(let i=wr;i!==null;i=i.next)if(i!==this&&!i.records?.has(n))i.async_deriveds.get(n)?.reject(ts)}}Jm(n)}Qa(n,s)}}#C(){if(!We)return;var e=this.prev,t=wr;if(e.next=this.next,this.next===null)Vi=e;else this.next.prev=e;this.prev=null,this.next=t,t.prev=wr=this,this.id=t.id-1}#y(){if(!this.linked)return;var e=this.prev,t=this.next;if(e===null)wr=t;else e.next=t;if(t===null)Vi=e;else t.prev=e;this.linked=!1,this.#A()}}var Xm=null;function pi(e){var t=Bi,r=Et!==Re?Et:null;Bi=!0;try{var n;if(e)pi(),n=e();while(!0){if(Fm(),Re===null)return n;Re.flush()}}finally{Bi=t,Et=r}}function Ck(){if(K){var e=new Map;for(let r of Re.current.keys())for(let[n,s]of r.updated??[]){var t=e.get(n);if(!t)t={error:s.error,count:0},e.set(n,t);t.count+=s.count}for(let r of e.values())if(r.error)console.error(r.error)}try{Cm()}catch(r){if(K)Vt(r,"stack",{value:""});en(r,Yu)}}var Ic=!1,To=null,Us=null,Bs=null;function Sk(e){if((e.f&(Wn|Zr))!==Wn)return!1;for(var t=e.b;t!==null;t=t.parent)if(t.is_pending)return t.defer_effect(e),!0;return!1}function Km(e,t=null){var r=e.length;if(r===0)return t;var n=0;while(n<r){var s=e[n++];if((s.f&(at|Xt))===0&&!Re?.is_skipped(s)&&!Sk(s)&&fi(s)){Us=new Set;var i=Co;if(vs(s),s.edges===null&&s.first===null&&s.nodes===null&&s.teardown===null&&s.ac===null)Zu(s);if(Us?.size>0){var o=Ut;if(t!==null)Ja(t);var a=Bs;Bs=new Map(t);try{for(let _ of Us){if((_.f&(at|Xt))!==0||Re?.is_skipped(_))continue;let c=[_],h=_.parent;while(h!==null){if(Us.has(h))Us.delete(h),c.push(h);h=h.parent}for(let d=c.length-1;d>=0;d--){let f=c[d];if((f.f&(at|Xt))!==0||Re?.is_skipped(f))continue;vs(f)}}}finally{Bs=a,Us?.clear(),Ut=o}}if(Co!==i&&Re!==null&&To!==null)for(let _ of To){var l=Re.current.get(_);if(l!==void 0&&l.wv>i)(t??=new Map).set(_,l)}}To?.clear()}return Us=null,t}function Ok(e,t){var r=e.next;while(r!==null&&(r.is_fork||!r.current.has(t)))r=r.next;return r}function Nk(e,t){if(tl(),e.v=t.v,e.wv=t.wv,e.f=t.e?e.f|mr:e.f&~mr,(e.f&Ge)!==0)e.f|=Ur,ui(e)}function Zm(e){var t=Je,r=tn,n=Et;Je=tn=Et=null;try{e()}finally{Je=t,tn=r,Et=n}}function Gu(e,t=!1){if(!t&&(e.f&Qt)!==0&&(e.f&Mt)!==0)return;Zt(e,Mt);var r=e.first;while(r!==null)Gu(r,t),r=r.next}var nl=null;function Ln(e,t){return e.label=t,Lc(e.v,t),e}function Lc(e,t){var r;try{r=e?.[vc]}catch{return e}return r?.call(e,t),e}var zs=new Set;function Uu(e){zs=e}var qc=0;function Qm(){qc++}function eg(){if(--qc===0&&zs.size>0)Ku()}function fn(e,t){var r={f:0,v:e,reactions:null,equals:yc,rv:0,wv:0};if(K&&Zn)r.created=t??Jn("created at"),r.updated=null,r.set_during_effect=!1,r.trace=null;return r}function Le(e,t){let r=fn(e,t);return Cc(r),r}function Gi(e,t=!1,r=!0){let n=fn(e);if(!t)n.equals=wc;if(qs&&r&&He!==null&&He.l!==null)(He.l.s??=[]).push(n);return n}function So(e){if(qe!==null&&(!sn||(qe.f&ds)!==0)&&es()&&(qe.f&(Ge|Or|pr|ds))!==0&&(rs===null||!rs.has(e)))Dm()}function Me(e,t,r=!1){return So(e),Hs(e,t,r)}function Hs(e,t,r=!1){let n=r?cr(t):t;if(K)Lc(n,e.label);return Vs(e,n,Ao)}function Mk(e,t){return So(e),Vs(e,t,Ao)}function Vs(e,t,r=null){var n=e.equals(t)&&(e.f&mr)===0,s=Je?.get(e);if(!n||s!==void 0&&(s.e||!e.equals.call(s,t))){var i=Hr.ensure();if((e.f&(Ge|vt|Ur))===(Ge|vt))yo(e);if(i.capture(e,t,n,!1,r),K){if(Zn||Ae!==null){e.updated??=new Map,Za.add(e);let o=(e.updated.get("")?.count??0)+1;if(e.updated.set("",{error:null,count:o}),Zn||o>5){let a=Jn("updated at");if(a!==null){let l=e.updated.get(a.stack);if(!l)l={error:a,count:0},e.updated.set(a.stack,l);l.count++}}}if(Ae!==null)e.set_during_effect=!0}if(es()&&Ae!==null&&(Ae.f&Mt)!==0&&(Ae.f&(Qt|Kr))===0)if(En===null)tg([e]);else En.push(e)}else if(Rr)Xu(e);return t}function Ku(){Zm(Ik)}function Ik(){for(let e of zs){if((e.f&Mt)!==0)Zt(e,It);let t;try{t=fi(e)}catch{t=!0}if(t)vs(e)}zs.clear()}function el(e,t=1){var r=y(e),n=t===1?r++:r--;return Mk(e,r),n}function eh(e){Hs(e,e.v+1)}var Dk=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function th(e){return(Je?.get(e)??e).v}function rg(e){var t=Rr&&e.wv<=No?Ut?.reverted_values.get(e):void 0;return(t??Je?.get(e)??e).v}function cr(e){if(typeof e!=="object"||e===null||Jr in e||gc in e)return e;let t=Is(e);if(t!==fc&&t!==Jp)return e;var r=new Map,n=qn(e),s=Le(0),i=K&&Zn?Jn("created at"):null,o=mi,a=(d)=>{if(mi===o)return d();var f=qe,p=mi;lr(null),rh(o);var m=d();return lr(f),rh(p),m};if(n){if(r.set("length",Le(e.length,i)),K)e=qk(e)}var l="";let _=!1;function c(d){if(_)return;_=!0,l=d,Ln(s,`${l} version`);for(let[f,p]of r)Ln(p,il(l,f));_=!1}var h=(d,f)=>a(()=>{var p=f?.writable?f.value:xt,m=Le(p,i);try{m.v=cr(p)}catch{}if(K)Ln(m,il(l,d));return m});return new Proxy(e,{defineProperty(d,f,p){if(!("value"in p)||p.configurable===!1||p.enumerable===!1||p.writable===!1)Mm();So(s);var m=r.get(f);if(m===void 0)a(()=>{var g=Le(p.value,i);if(r.set(f,g),K&&typeof f==="string")Ln(g,il(l,f));return g});else Hs(m,p.value,!0);return!0},deleteProperty(d,f){So(s);var p=r.get(f);if(p===void 0&&f in d)p=h(f,zr(d,f)),r.set(f,p);if(p!==void 0)Hs(p,xt),eh(s);return!0},get(d,f,p){if(f===Jr)return e;if(K&&f===vc)return c;var m=r.get(f),g=f in d;if(m===void 0&&(!g||zr(d,f)?.writable))m=a(()=>{var k=cr(g?d[f]:xt),x=Le(k,i);if(K)Ln(x,il(l,f));return x}),r.set(f,m);if(m!==void 0){var b=y(m);return b===xt?void 0:b}return Reflect.get(d,f,p)},getOwnPropertyDescriptor(d,f){this.has?.(d,f);var p=Reflect.getOwnPropertyDescriptor(d,f),m=r.get(f);if(m!==void 0){var g=y(m);if(g===xt)return;if(p&&"value"in p)p.value=g;else return{enumerable:!0,configurable:!0,value:g,writable:!0}}return p},has(d,f){if(f===Jr)return!0;var p=r.get(f),m=p===void 0&&Reflect.has(d,f);if(p!==void 0||(Ae!==null||qe!==null)&&(!m||zr(d,f)?.writable)){if(p===void 0)p=a(()=>{var b=m?cr(d[f]):xt,k=Le(b,i);if(K)Ln(k,il(l,f));return k}),r.set(f,p);var g=y(p);return g!==xt}return m},set(d,f,p,m){So(s);var g=r.get(f),b=f in d;if(n&&f==="length")for(var k=p;k<th(g);k+=1){var x=r.get(k+"");if(x===void 0&&k in d)x=h(k+"",zr(d,k)),r.set(k+"",x);if(x!==void 0)Hs(x,xt)}var w=zr(d,f);if(g===void 0){if(!b||w?.writable)g=h(f,w),Hs(g,cr(p)),r.set(f,g)}else{b=th(g)!==xt;var O=a(()=>cr(p));Hs(g,O)}if(w?.set)w.set.call(m,p);if(!b){if(n&&typeof f==="string"){var N=r.get("length"),S=Number(f);if(Number.isInteger(S)&&S>=th(N))Hs(N,S+1)}eh(s)}return!0},ownKeys(d){y(s);var f=Reflect.ownKeys(d).filter((g)=>{var b=r.get(g);return b===void 0||rg(b)!==xt});for(var[p,m]of r)if(rg(m)!==xt&&!(p in d))f.push(p);return f},setPrototypeOf(){Im()}})}function il(e,t){if(typeof t==="symbol")return`${e}[Symbol(${t.description??""})]`;if(Dk.test(t))return`${e}.${t}`;return/^\d+$/.test(t)?`${e}[${t}]`:`${e}['${t}']`}function Oo(e){try{if(e!==null&&typeof e==="object"&&Jr in e)return e[Jr]}catch{}return e}function Fc(e,t){return Object.is(Oo(e),Oo(t))}var Pk=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function qk(e){return new Proxy(e,{get(t,r,n){var s=Reflect.get(t,r,n);if(!Pk.has(r))return s;return function(...i){Qm();try{return s.apply(this,i)}finally{eg()}}}})}function ng(){let{prototype:e,__svelte_cleanup:t}=Array;if(t)t();let{indexOf:r,lastIndexOf:n,includes:s}=e;e.indexOf=function(i,o){let a=r.call(this,i,o);if(a===-1){for(let l=o??0;l<this.length;l+=1)if(Oo(this[l])===i){kc("array.indexOf(...)");break}}return a},e.lastIndexOf=function(i,o){let a=n.call(this,i,o??this.length-1);if(a===-1){for(let l=0;l<=(o??this.length-1);l+=1)if(Oo(this[l])===i){kc("array.lastIndexOf(...)");break}}return a},e.includes=function(i,o){let a=s.call(this,i,o);if(!a){for(let l=0;l<this.length;l+=1)if(Oo(this[l])===i){kc("array.includes(...)");break}}return a},Array.__svelte_cleanup=()=>{e.indexOf=r,e.lastIndexOf=n,e.includes=s}}var Wi,sg,nh,ig=Mu,og=Mu;function ag(){if(Wi!==void 0)return;Wi=window,sg=document;var e=Element.prototype,t=Node.prototype,r=Text.prototype;if(ig=zr(t,"firstChild").get,og=zr(t,"nextSibling").get,xu(e))e[Pa]=void 0,e[bc]=null,e[qa]=void 0,e.__e=void 0;if(xu(r))r[La]=void 0;if(K)nh=/Firefox/.test(navigator.userAgent),Vt(e,"__svelte_meta",{value:null,enumerable:!1,writable:!0,configurable:!0}),ng()}function lg(e){if(ee)return ee.createText(e);return document.createTextNode(e)}function Ro(){if(ee)return ee.createText("");return document.createTextNode("")}function Mr(){if(ee)return ee.createComment("");return document.createTextNode("")}function qt(e){if(ee)return ee.getFirstChild(e);return ig.call(e)}function tr(e){if(ee)return ee.getNextSibling(e);return og.call(e)}function ke(e,t){if(!pe)return qt(e);var r=qt(Pe);if(r===null)r=Lt(Pe,Ro());else if(t&&Kt(r)!==Pi){var n=Ro();return xr(r,n),_t(n),n}if(t)ll(r);return _t(r),r}function $e(e,t=!1){if(!pe){var r=qt(e);if(Lk(r)&&Qr(r)==="")return tr(r);return r}if(t){if(Kt(Pe)!==Pi){var n=Ro();if(Pe)xr(Pe,n);return _t(n),n}ll(Pe)}return Pe}function Te(e,t=!1){if(!pe)return qt(e);var r=ke(e,t);return ue(e),r}function se(e,t=1,r=!1){let n=pe?Pe:e;var s;while(t--)s=n,n=tr(n);if(!pe)return n;if(r){if(Kt(n)!==Pi){var i=Ro();if(n===null){if(s)Fk(s,i)}else xr(n,i);return _t(i),i}ll(n)}return _t(n),n}function Mo(e){if(ee){var t=ee.getFirstChild(e);while(t!==null){var r=ee.getNextSibling(t);ee.remove(t),t=r}return}e.textContent=""}function ol(){if(!We&&Bs===null)return!1;var e=Ae.f;return(e&Zr)!==0}function An(e,t,r){if(ee)return ee.createElement(e);if(t==null||t===Fi)return r?document.createElement(e,{is:r}):document.createElement(e);return r?document.createElementNS(t,e,{is:r}):document.createElementNS(t,e)}function Fn(){if(ee)return ee.createFragment();return document.createDocumentFragment()}function al(e=""){if(ee)return ee.createComment(e);return document.createComment(e)}function Ys(e,t,r=""){if(ee){ee.setAttribute(e,t,r);return}if(t.startsWith("xlink:")){e.setAttributeNS("http://www.w3.org/1999/xlink",t,r);return}return e.setAttribute(t,r)}function ll(e){if(ee)return;if(e.nodeValue.length<65536)return;let t=e.nextSibling;while(t!==null&&Kt(t)===Pi)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Lk(e){if(ee)return!!e&&Kt(e)===un;return e instanceof Comment}function Kt(e){if(e==null)return;if(ee){let t=ee.getNodeType(e);return Qp[t]}return e.nodeType}function bs(e){if(ee)return"";return e.nodeName}function gi(e){if(ee)return ee.getLastChild(e);return e.lastChild}function Io(e){if(ee)return ee.getParent(e);return e.parentNode}function Lt(e,t){if(ee)return ee.insert(e,t,null),t;return e.appendChild(t)}function xr(e,t){if(ee){var r=ee.getParent(e);ee.insert(r,t,e);return}e.before(t)}function Fk(e,t){if(ee){var r=ee.getParent(e),n=ee.getNextSibling(e);ee.insert(r,t,n);return}e.after(t)}function Ps(e){if(ee){ee.remove(e);return}e.remove()}function jc(e,t){if(ee)return ee.remove(t),t;return e.removeChild(t)}function cg(e,t){if(ee){ee.setText(e,t);return}e.nodeValue=t}function Qr(e){if(ee)return ee.getText(e);return e.nodeValue}function Do(e,t,r,n){if(n==null)e.removeAttribute(t,r);else e.setAttribute(t,r,n)}function sh(e,t){if(ee){Do(ee,e,"value",t);return}e.value=t??""}function ih(e,t){if(ee){Do(ee,e,"checked",t);return}e.checked=t}function oh(e,t){if(ee){Do(ee,e,"defaultValue",t);return}let r=e.value;e.defaultValue=t,e.value=r}function ah(e,t){if(ee){Do(ee,e,"defaultChecked",t);return}let r=e.checked;e.defaultChecked=t,e.checked=r}function Gs(e,t){if(ee)return ee.getAttribute(e,t);return e.getAttribute(t)}function Vr(e,t){if(ee){ee.removeAttribute(e,t);return}e.removeAttribute(t)}function Po(e,t){if(ee)return ee.hasAttribute(e,t);return e.hasAttribute(t)}function lh(e,t){if(ee)xc("innerHTML");e.innerHTML=t}function ch(e,t){if(ee)xc("importNode");return document.importNode(e,t)}function zc(e,t,r,n){if(ee){ee.addEventListener(e,t,r,n);return}e.addEventListener(t,r,n)}function Uc(e,t,r,n){if(ee){ee.removeEventListener(e,t,r,n);return}e.removeEventListener(t,r,n)}function _g(e,t){if(ee)xc("dispatchEvent");return e.dispatchEvent(t)}function _h(e,t,r,n){e.style.setProperty(t,r,n)}function uh(e,t){e.style.removeProperty(t)}function hh(e,t){if(ee){ee.setAttribute(e,"style",t);return}e.style.cssText=t}function ug(e,t,r){e.classList.toggle(t,r)}var fh=new WeakMap;function hg(e){var t=Ae;if(t===null)return e;if(K&&e instanceof Error&&!fh.has(e))fh.set(e,jk(e,t));if((t.f&Zr)===0&&(t.f&Wn)===0){if(K&&!t.parent&&e instanceof Error)fg(e);throw e}en(e,t)}function en(e,t){if(e===yn)throw e;if(t!==null&&(t.f&at)!==0)return;while(t!==null){if((t.f&Xn)!==0&&(t.f&(at|fs))===0){if((t.f&Zr)===0)throw e;try{t.b.error(e);return}catch(r){e=r}}t=t.parent}if(K&&e instanceof Error)fg(e);throw e}function jk(e,t){let r=zr(e,"message");if(r&&!r.configurable)return;var n=nh?" ":"\t",s=`
53
+ ${n}in ${t.fn?.name||"<unknown>"}`,i=t.ctx;while(i!==null)s+=`
54
+ ${n}in ${i.function?.[wn].split("/").pop()}`,i=i.p;return{message:e.message+`
55
+ ${s}
56
+ `,stack:e.stack?.split(`
57
+ `).filter((o)=>!o.includes("svelte/src/internal")).join(`
58
+ `)}}function fg(e){let t=fh.get(e);if(t)Vt(e,"message",{value:t.message}),Vt(e,"stack",{value:t.stack})}function ph(e){if(Ae===null){if(qe===null)Tm(e);Am()}if(Rr)Em(e)}function zk(e,t){var r=t.last;if(r===null)t.last=t.first=e;else r.next=e,e.prev=r,t.last=e}function jn(e,t){var r=Ae;if(K)while(r!==null&&(r.f&ds)!==0)r=r.parent;if(r!==null&&(r.f&Xt)!==0)e|=Xt;var n={ctx:He,deps:null,dv:null,edges:null,nodes:null,f:e|vt|Wt,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null,r:ee};if(K)n.component_function=Qn;var s=n;if((e&Wn)!==0)if(Eo!==null)Eo.push(n);else Hr.ensure().schedule(n,vt);else if(t!==null){try{vs(n)}catch(o){throw Pt(n),o}if(s.edges===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&Kn)===0){if(s=s.first,(e&Or)!==0&&(e&fr)!==0&&s!==null)s.f|=fr}}if(s!==null){if(s.parent=r,r!==null)zk(s,r);if(qe!==null&&(qe.f&Ge)!==0&&(e&Kr)===0){var i=qe;(i.effects??=[]).push(s)}}return n}function sl(){return qe!==null&&!sn}function nr(e){let t=jn(li,null);return Zt(t,Mt),t.teardown=e,t}function Ir(e){if(ph("$effect"),K)Vt(e,"name",{value:"$effect"});var t=Ae.f,r=!qe&&(t&Qt)!==0&&He!==null&&!He.i;if(r){var n=He;(n.e??=[]).push(e)}else return Pu(e)}function Pu(e){return jn(Wn|Eu,e)}function qo(e){if(ph("$effect.pre"),K)Vt(e,"name",{value:"$effect.pre"});return jn(li|Eu,e)}var Wu=!1;function mh(e){Hr.ensure();let t=jn(Kr|Kn,e);return()=>{Pt(t)}}function dg(e){Hr.ensure();let t=jn(Kr|Kn,e);return(r={})=>new Promise((n)=>{if(r.outro)Ws(t,()=>{Pt(t),n(void 0)});else Pt(t),n(void 0)})}function dn(e){return jn(Wn,e)}function ju(e){return jn(pr|Kn,e)}function Yr(e,t=0){return jn(li|t,e)}function le(e,t=[],r=[],n=[]){Ha(n,t,r,(s)=>{jn(li,()=>{e(...s.map(y))})})}function Nr(e,t=0){var r=jn(Or|t,e);if(K)r.dev_stack=xn;return r}function Bc(e,t=0){var r=jn(Ii|t,e);if(K)r.dev_stack=xn;return r}function zt(e){return jn(Qt|Kn,e)}function gh(e){var t=e.teardown;if(t!==null){let r=Rr,n=No,s=Ut,i=qe;dh(!0),lr(null);try{t.call(null)}catch(o){en(o,e.parent)}finally{dh(r,n),Pc(s),lr(i)}}}function Wa(e,t=!1){var r=e.first;e.first=e.last=null;while(r!==null){Xa(r);var n=r.next;if((r.f&Kr)!==0)r.parent=null;else Pt(r,t);r=n}}function pg(e){var t=e.first;while(t!==null){var r=t.next;if((t.f&Qt)===0)Pt(t);t=r}}function Pt(e,t=!0){var r=!1,n=lt?br(e.r):null;try{if((t||(e.f&$u)!==0)&&e.nodes!==null&&e.nodes.end!==null)mg(e.nodes.start,e.nodes.end),r=!0;e.f|=fs,Wa(e,t&&!r),Ka(e);var s=e.nodes&&e.nodes.t;if(s!==null)for(let o of s)o.stop();gh(e)}finally{if(lt)kr(n)}e.f^=fs,e.f|=at;var i=e.parent;if(i!==null&&i.first!==null)Zu(e);if(K)e.component_function=null;e.next=e.prev=e.teardown=e.ctx=e.deps=e.dv=e.edges=e.fn=e.nodes=e.ac=e.b=e.r=null}function mg(e,t){while(e!==null){var r=e===t?null:tr(e);Ps(e),e=r}}function Zu(e){var{parent:t,prev:r,next:n}=e;if(r!==null)r.next=n;if(n!==null)n.prev=r;if(t!==null){if(t.first===e)t.first=n;if(t.last===e)t.last=r}}function Ws(e,t,r=!0){var n=[];e.f|=mc,gg(e,n,!0);var s=()=>{if(r)Pt(e);if(t)t()},i=n.length;if(i>0){var o=Ut,a=()=>{if(!--i){var _=Ut;try{if(o)o.derived_cache.clear(),Pc(o);s()}finally{if(o)Pc(_)}}};for(var l of n)l.out(a)}else s()}function gg(e,t,r){if((e.f&Xt)!==0)return;e.f^=Xt;var n=e.nodes&&e.nodes.t;if(n!==null){for(let a of n)if(a.is_global||r)t.push(a)}var s=e.first;while(s!==null){var i=s.next;if((s.f&Kr)===0){var o=(s.f&fr)!==0||(s.f&Qt)!==0&&(e.f&Or)!==0;gg(s,t,o?r:!1)}s=i}}function Lo(e){e.f&=~mc,vg(e,!0)}function vg(e,t){if((e.f&mc)!==0)return;if((e.f&Xt)===0)return;e.f^=Xt;var r=We&&(e.f&Xn)!==0&&e.b?.is_pending;if((e.f&Mt)===0||r)Hr.ensure().schedule(e,It);var n=e.first;while(n!==null){var s=n.next,i=(n.f&fr)!==0||(n.f&Qt)!==0;vg(n,i?t:!1),n=s}var o=e.nodes&&e.nodes.t;if(o!==null){for(let a of o)if(a.is_global||t)a.in()}}function Fo(e,t){if(!e.nodes)return;var r=lt?br(e.r):null;try{var n=e.nodes.start,s=e.nodes.end;while(n!==null){var i=n===s?null:tr(n);Lt(t,n),n=i}}finally{if(lt)kr(r)}}var bg=null;function vh(e,t){if(t){let r=document.body;e.autofocus=!0,ar(()=>{if(document.activeElement===r)e.focus()})}}function cl(e){if(pe&&qt(e)!==null)Mo(e)}var kg=!1;function Hc(){if(!kg)kg=!0,zc(document,"reset",(e)=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[ci]?.()})},{capture:!0})}function Xs(e){var t=qe,r=Ae;lr(null),yr(null);try{return e()}finally{lr(t),yr(r)}}function bh(e,t,r,n=r){e.addEventListener(t,()=>Xs(r));let s=e[ci];if(s)e[ci]=()=>{s(),n(!0)};else e[ci]=()=>n(!0);Hc()}var Rr=!1,No=0;function dh(e,t=Co){Rr=e,No=t}var wg={v:void 0,wv:0,e:!1,assigned:!1},qe=null,sn=!1;function lr(e){qe=e}var Ae=null;function yr(e){Ae=e}var rs=null;function Cc(e){if(qe!==null&&(!We&&(qe.f&Ds)!==0||(qe.f&Ge)!==0))(rs??=new Set).add(e)}var Dt=null,rn=0,jo=null,En=null;function tg(e){En=e}var Co=1,Xi=0,mi=Xi;function rh(e){mi=e}var ks=0,$n=null,$o=0;function tl(){if(ks!==0)$n?.clear(),$o++}function Uk(){ks=0,$n=null}function Ym(e){if($n===null)return;var t=$n.get(e);if(t&&t.entry.wv===t.wv)return t.entry}function Gm(e,t,r){if($n!==null&&r===$o)$n.set(e,{entry:t,wv:t.wv})}function rl(e=!1){if(!e)tl();return++Co}function Ju(e){if(Je===null)return wo(e),e.wv;if((e.f&Ge)!==0)return xo(e).wv;return(Je.get(e)??e).wv}function Ga(e,t){if(e!==null){if(ks!==0&&Je!==null){if(ks+=t.length,ks>1e5)$n??=new Map}for(var r=0;r<t.length;r++)if(Ju(e[r])!==t[r])return!1}return!0}function Sc(e,t,r=null){if(e!==null)for(var n=0;n<e.length;n++){var s=e[n];if((s.f&Ge)===0){if(Ju(s)>t)return!0;continue}var i=s;if(Je===null)wo(s);else i=xo(s);if(i.wv>t){var o=i===s?(s.f&Ur)!==0:!("dv"in i);if(o)return!0;if(r===null)r=new Set;else if(r.has(i))continue;if(Sc(i.deps,t,r))return!0;r.add(i)}}return!1}function Qu(e){return(e.f&(Or|pr))!==0&&Et?.get_record(e)||e}function fi(e){var t=e.f;if((t&(vt|It))===0)return!1;if((t&Ur)!==0){if(Sc(e.deps,e.wv))return!0}else if((t&vt)!==0)return!0;else{var r=Qu(e),{deps:n,dv:s}=r;if(s===null)return!0;if(Je===null){var i=ks!==0,o=$o;if(i){if(ks+=s.length,ks>1e5){if($n??=new Map,(t&Wt)===0&&$n.get(e)===null)return!1}}for(var a=0,l=s.length;a<l;a++){var _=n[a];if(wo(_),_.wv!==s[a])return!0}if(i&&(t&(Wt|Ge))===Ge&&o===$o)$n?.set(e,null)}else if(!Ga(n,s))return!0}if((t&Wt)!==0)Zt(e,Mt);return!1}function xg(e,t,r){var n=e.reactions;if(n===null)return;if(!We&&rs!==null&&rs.has(e))return;for(var s=0;s<n.length;s++){var i=n[s];if((i.f&Ge)!==0){var o=i;if(r??=new Set,r.has(o))continue;r.add(o),xg(o,t,r)}else if(t===i){var a=Re;a.schedule(t,r===void 0?vt:It)}}}var nn=null,ns=!1;function vi(e){if(ns&&e)Xs(()=>e.abort(mo))}function Qa(e,t,r=!1){if(!ns||!t?.ac)return;for(var n=wr;n!==null;n=n.next)if(n.records?.get(e)===t&&!(r&&(n===Et||kh(Re,n))))return;vi(t.ac),t.ac=null}function Bk(e,t){var r=Re,n=(t&Ge)!==0;if(n&&Rr)return;var s=r===null||!r.is_fork;if(Qa(e,Et?.records?.get(e),!0),n?Je===null||s&&Dc(e):s)vi(e.ac);for(var i=wr;i!==null;i=i.next)if(kh(r,i))Qa(e,i.records?.get(e),!0)}function $g(e){vi(e.ac),e.ac=nn}function Dc({deps:e,dv:t}){return t===null||t.some((r,n)=>e[n].wv!==r)}function kh(e,t){return e!==null&&!e.is_fork&&!t.is_fork&&t.id<e.id&&(Je===null||t.previous.size===0||e.folded.includes(t))}function Xa(e){if(!ns||(e.f&Di)===0)return!1;e.f^=Di,vi(e.ac),e.ac=null;for(var t=wr;t!==null;t=t.next){var r=t.records?.get(e);if(r?.ac)vi(r.ac),r.ac=null}return!0}function Hk(e){if((e&pr)===0&&(e&(Or|Zr))!==(Or|Zr))return!1;return Et!==null&&Et===Re}function Hu(e){let t=Re;var r=Dt,n=rn,s=jo,i=En,o=qe,a=rs,l=He,_=sn,c=mi,h=e.f;Dt=null,rn=0,jo=null,En=null,qe=(h&(Qt|Kr))===0?e:null,rs=null,Ls(e.ctx),sn=!1,mi=++Xi;var d=nn;if(nn=null,ns&&(h&Di)!==0)Bk(e,h);try{e.f|=Ds;var f=e.fn,p=f();if(e.f|=Zr,yg(e,h,p,!1),es()&&En!==null&&!sn&&(Dt!==null||rn>0)&&(e.f&(Ge|It|vt))===0)for(var m=0;m<En.length;m++)xg(En[m],e);if(o!==null&&o!==e){if(Xi++,o.deps!==null)for(let k=0;k<n;k+=1)o.deps[k].rv=Xi;if(r!==null)for(let k of r)k.rv=Xi;if(En!==null)if(i===null)i=En;else i.push(...En)}return p}catch(k){var g=k;try{g=hg(k)}finally{yg(e,h,g,g===k)}return g}finally{var b=nn?.signal;if(ns&&t!==null&&b!==void 0)b.addEventListener("abort",()=>{if(Re!==null){let k=Br(t);if(k!==Re&&k.linked&&!k.is_fork)Re.merge_requests.add(k)}});e.f^=Ds,Dt=r,rn=n,jo=s,En=i,qe=o,rs=a,Ls(l),sn=_,mi=c,nn=d}}function yg(e,t,r,n){var s=e.deps,i=rn+(Dt===null?0:Dt.length),o=e.dv;if((e.f&at)!==0){vi(nn);return}if(ns&&nn!==null&&(e.f&Di)===0)vi(nn),nn=null;if((t&Ge)!==0&&Rr){var a=0;for(var l=0;l<i;l++){var _=l<rn?s[l]:Dt[l-rn];a=Math.max(a,Ng(_))}wg={v:r,wv:a,e:n,assigned:(t&Ur)!==0};return}if((t&Ge)!==0&&Je===null&&wr!==null&&wr.next!==null)Ag(e,t);if(Dt===null&&Je===null&&o!==null&&i===s?.length&&e.edges===s&&(t&(Or|pr))===0){for(var c=0;c<i;c++)o[c]=s[c].wv;if(o.length!==i)o.length=i;if((t&Ge)!==0)Eg(e,r,n);if(ns&&(e.ac||nn))$g(e);return}Vk(e,t,i,r,n)}function Eg(e,t,r){var n=e.f&~Ur;if(r||(n&mr)!==0||!e.equals(t))e.v=t,e.wv=rl(!0),n=r?n|mr:n&~mr;e.f=n,ui(e)}function Vk(e,t,r,n,s){var i=Hk(t);if(Je!==null&&(t&Ge)!==0){var o=Je.get(e);if(o!==void 0&&o.wv!==e.wv)i=!0}var a=e.deps,l=a;if(Dt!==null||rn!==a?.length)l=rn===0?Dt:a.slice(0,rn).concat(Dt??[]);var _=!i&&Je===null&&e.dv!==null?e.dv:[];for(var c=0;c<r;c++){var h=l[c];if(_[c]=Yk(h),Je!==null&&(t&Ge)!==0&&(_[c]!==h.wv||(h.f&(Ge|Mt))===Ge))i=!0}if(_.length!==r)_.length=r;if(!i&&Je!==null&&(t&Ge)!==0)Ag(e,t);var d=i||Tg(e),f=sl()&&(e.f&Wt)!==0,p=e.edges;if(i&&p!==null){if(Dt!==null){e.edges=p=p.slice();for(h of Dt)if(!Ms.call(p,h)){if(p.push(h),f)(h.reactions??=[]).push(e)}}}else if(!d&&p===a){if(p!==null)for(c=rn;c<p.length;c++)Vc(e,p[c]);if(f&&Dt!==null)for(h of Dt)(h.reactions??=[]).push(e);e.edges=l}else{var m=new Set(l);if(d)for(var g=wr;g!==null;g=g.next)for(h of g.records?.get(e)?.deps??[])m.add(h);var b=d?Array.from(m):l;for(h of p??[])if(!m.delete(h))Vc(e,h);if(f)for(h of m)(h.reactions??=[]).push(e);e.edges=b}if(i){var k=Et;(k.records??=new Map).set(e,(t&Ge)!==0?{deps:l,dv:_,v:n,e:s,wv:Gk(e,k,n,s),ac:nn}:{deps:l,dv:_,ac:nn})}else{if(e.deps=l,e.dv=_,ns&&(e.ac||nn))$g(e);if((t&Ge)!==0)Eg(e,n,s),Et?.records?.delete(e)}}function Ag(e,t){var r=e.dv;if(r===null||r.length===0||(t&Ur)!==0)return;var n,s=ns?e.ac:null,i=s!==null&&Re!==null&&Re.is_fork&&!s.signal.aborted;for(var o=wr;o!==null;o=o.next)if(o!==Et&&!o.records?.has(e)){if(s===null||i||kh(Re,o))n??={deps:e.deps,dv:r.slice(),v:e.v,wv:e.wv,e:(t&mr)!==0},(o.records??=new Map).set(e,n)}if(i&&n!==void 0)n.ac=s,e.ac=null}function Yk(e){if(Je===null)return e.wv;if((e.f&Ge)!==0){var t=tn,r=t.get(e);if(r!==void 0)return r.wv;return jo?.get(e)??-1}return(Je.get(e)??e).wv}function Gk(e,t,r,n){if(!n){var s=t.get_record(e);if(s!==void 0&&!s.e&&e.equals.call(s,r))return s.wv;if((e.f&mr)===0&&e.equals(r))return e.wv}return rl(!0)}function Oc(e,t){if(e.deps=t.deps,e.dv=(e.f&Ge)!==0?t.dv.slice():t.dv,(e.f&Ge)!==0){var r=e;r.v=t.v,r.wv=t.wv,r.f=(t.e?r.f|mr:r.f&~mr)&~Ur,ui(r)}if(ns)vi(e.ac);e.ac=t.ac??null,t.ac=null}function Tg(e){for(var t=wr;t!==null;t=t.next)if(t.records?.has(e))return!0;return!1}function Jm(e){var{edges:t,deps:r}=e;if(t===r||Tg(e))return;for(var n of t)if(r===null||!Ms.call(r,n))Vc(e,n);e.edges=r}function Cg(e,t){var r=e.reactions??=[];if(!Ms.call(r,t))r.push(t)}function Vc(e,t){let r=t.reactions;if(r!==null){var n=Zp.call(r,e);if(n!==-1){var s=r.length-1;if(s===0)r=t.reactions=null;else r[n]=r[s],r.pop()}}if(r===null&&(t.f&Ge)!==0&&(Dt===null||!Ms.call(Dt,t))){var i=t;if((i.f&Wt)!==0)i.f^=Wt,tn?.delete(i);if(i.v!==xt)ui(i);if(ns&&Xa(i)){tl(),Zt(i,vt),i.dv=null;for(var o=wr;o!==null;o=o.next)o.records?.delete(i);tn?.delete(i)}Vm(i),Ka(i)}}function Ka(e){var t=e.edges;if(t===null)return;for(var r=0;r<t.length;r++)Vc(e,t[r])}function vs(e){var t=e.f;if((t&at)!==0)return;Zt(e,Mt);var r=Ae;Ae=e;var n=lt?br(e.r):null;if(K){var s=Qn;Ec(e.component_function);var i=xn;ko(e.dev_stack??xn)}try{if((t&(Or|Ii))!==0)pg(e);else Wa(e);gh(e);var o=Hu(e);if(e.teardown=typeof o==="function"?o:null,e.wv=Co,K&&Zn&&(e.f&vt)!==0&&e.edges!==null){for(var a of e.edges)if(a.set_during_effect)a.wv=rl(),a.set_during_effect=!1}}finally{if(Ae=r,lt)kr(n);if(K)Ec(s),ko(i)}}async function Yc(){if(We)return new Promise((e)=>{if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>e());setTimeout(()=>e())});await Promise.resolve(),pi()}function y(e){var t=e.f,r=(t&Ge)!==0,n=!1;bg?.add(e);var s=null;if(qe!==null&&!sn){var i=Ae!==null&&(Ae.f&at)!==0;if(!i&&(rs===null||!rs.has(e))){n=r&&(e.f&Wt)===0&&(qe.f&Wt)!==0;var o=qe.deps;if((qe.f&Ds)!==0){if(e.rv<Xi)if(e.rv=Xi,Dt===null&&o!==null&&o[rn]===e)rn++;else if(Dt===null)Dt=[e];else Dt.push(e)}else{s=qe;var a=qe.edges;if(a===null||!Ms.call(a,e))qe.edges=a===null?[e]:[...a,e];Cg(e,qe)}}}if(K){if(!sn&&Et===null&&hn&&!hn.warned&&(hn.effect.f&Ds)===0&&!hn.effect_deps.has(e)){hn.warned=!0,_m(e.label);var l=Jn("traced at");if(l)console.warn(l)}if(Ya.delete(e),Zn&&!sn&&nl!==null&&qe!==null&&nl.reaction===qe){if(e.trace)e.trace();else if(l=Jn("traced at"),l){var _=nl.entries.get(e);if(_===void 0)_={traces:[]},nl.entries.set(e,_);var c=_.traces[_.traces.length-1];if(l.stack!==c?.stack)_.traces.push(l)}}}if(Rr){var h=Og(e);if(h!==void 0){if(h.e)throw h.v;return h.v}}var d;if(r){var f=e,p=(f.f&Zr)===0;if(n)f.f|=Wt;if((t&Wt)===0&&!p&&ks===0){ks=1;try{if(Je===null)wo(f);else d=xo(f)}finally{Uk()}}else if(Je===null)wo(f);else d=xo(f);if(d!==void 0&&(f.f&Wt)===0&&qe!==null&&!sn&&(qe.f&Ds)!==0){var m=(jo??=new Map).get(f);jo.set(f,m===void 0||m===d.wv?d.wv:-1)}if(n&&!p)Bu(f),Sg(f)}else if(Je!==null)d=Je.get(e);if(s!==null)Wk(s,e,d===void 0?e.wv:d.wv);if(d!==void 0&&d!==e){if(d.e)throw d.v;return d.v}if((e.f&mr)!==0)throw e.v;return e.v}function Wk(e,t,r){var n=Qu(e),s=n.deps;if(n.dv!==null&&(s===null||!Ms.call(s,t)))n.deps=s===null?[t]:[...s,t],n.dv.push(r)}function Sg(e){if(e.f|=Wt,e.edges===null)return;for(let t of e.edges)if(Cg(t,e),(t.f&Ge)!==0&&(t.f&Wt)===0)Bu(t),Sg(t)}function Og(e){var t=e.wv>No?void 0:Ut?.reverted_values.get(e);if((e.f&Ge)===0)return t;var r=e,n=(Ut??Ja()).derived_cache,s=n.get(r);if(s!==void 0)return s;var i=t??Je?.get(r),o=i===void 0?(r.f&Ur)!==0:i.assigned,a=i===void 0&&!o?r.dv:null,l=r.deps??[],_=o||a!==null,c=a?.length??l.length;i??={v:r.v,wv:r.wv,e:(r.f&mr)!==0,assigned:(r.f&Ur)!==0};for(var h=0;_&&h<c;h++){var d=Ng(l[h]);_=a===null?d<=i.wv:d===a[h]}if(_)s=i;else if(yo(r),s=wg,i.wv<s.wv&&!i.e&&!s.e&&r.equals.call(i,s.v))s.wv=i.wv;return n.set(r,s),s}function Ng(e){return(Og(e)??Je?.get(e)??e).wv}function pt(e){var t=sn;try{return sn=!0,e()}finally{sn=t}}function Rg(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}var Xk=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Mg(e){return Xk.includes(e)}var Kk=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var Zk={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function Ig(e){return e=e.toLowerCase(),Zk[e]??e}var yS=[...Kk,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var Jk=["touchstart","touchmove"];function Dg(e){return Jk.includes(e)}var Qk=["$state","$state.raw","$derived","$derived.by"],wS=[...Qk,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];var ey=["textarea","script","style","title"];function Pg(e){return ey.includes(e)}function _l(e,t,r=xn){Vt(e,"__svelte_meta",{value:{parent:r,loc:t,component:He},enumerable:!1,writable:!0,configurable:!0})}var ul=Symbol("events"),Wc=Symbol("propagation stopped at"),Fg=new Set,xh=new Set;function Eh(e){if(!pe)return;Vr(e,"onload"),Vr(e,"onerror");let t=e.__e;if(t!==void 0)e.__e=void 0,queueMicrotask(()=>{if(e.isConnected)_g(e,t)})}function Ah(e,t,r,n={}){var s=ee!=null;function i(...o){if(s)return Xs(()=>r?.apply(this,o));var a=o[0];if(!n.capture)$h.call(t,a);if(n.capture||a[Wc]!==t)return Xs(()=>r?.call(this,a))}return zc(t,e,i,n),i}function ys(e,t,r,n,s){var i={capture:n,passive:s},o=Ah(e,t,r,i);if(ee==null&&(t===document.body||t===window||t===document||t instanceof HTMLMediaElement))nr(()=>{Uc(t,e,o,i)})}function $r(e,t,r){(t[ul]??={})[e]=r}function ss(e){for(var t=0;t<e.length;t++)Fg.add(e[t]);for(var r of xh)r(e)}var Gc=new Map;function Th(e){var t=new Set,r=(n)=>{for(var s=0;s<n.length;s++){var i=n[s];if(t.has(i))continue;t.add(i);var o=Dg(i);for(let _ of[e,document]){var a=Gc.get(_);if(a===void 0)a=new Map,Gc.set(_,a);var l=a.get(i);if(l===void 0)_.addEventListener(i,$h,{passive:o}),a.set(i,1);else a.set(i,l+1)}}};return r(po(Fg)),xh.add(r),()=>{for(var n of t)for(let o of[e,document]){var s=Gc.get(o),i=s.get(n);if(--i==0){if(o.removeEventListener(n,$h),s.delete(n),s.size===0)Gc.delete(o)}else s.set(n,i)}xh.delete(r)}}var yh=null,wh=!1;function $h(e){var t=this,r=e.cancelBubble;if(r&&e[Wc]===t)return;if(!r)delete e[Wc];var n=t.ownerDocument,s=e.type,i=e.composedPath?.()||[],o=i[0]||e.target;if(yh=e,!wh)wh=!0,setTimeout(()=>{wh=!1,yh=null});var a=0,l=yh===e&&e[ul];if(l){var _=i.indexOf(l);if(_!==-1&&(t===document||t===window)){e[ul]=t;return}var c=i.indexOf(t);if(c===-1)return;if(_<=c)a=_}if(o=i[a]||e.target,o===t)return;Vt(e,"currentTarget",{configurable:!0,get(){return o||n}});var h=qe,d=Ae;lr(null),yr(null);try{var f,p=[];while(o!==null){if(o===t)break;try{var m=o[ul]?.[s];if(m!=null&&(!o.disabled||e.target===o))m.call(o,e)}catch(g){if(f)p.push(g);else f=g}if(e.cancelBubble){if(!r)e[Wc]=t;break}a++,o=a<i.length?i[a]:null}if(f){for(let g of p)queueMicrotask(()=>{throw g});throw f}}finally{o=null,e[ul]=t,delete e.currentTarget,lr(h),yr(d)}}var ty=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:(e)=>e});function jg(e){return ty?.createHTML(e)??e}function Xc(e){var t=An("template");return lh(t,jg(e.replaceAll("<!>","<!---->"))),t.content}function Er(e,t){var r=Ae;if(r.nodes===null)r.nodes={start:e,end:t,a:null,t:null}}function te(e,t){var r=(t&Cu)!==0,n,s=!e.startsWith("<!>");return()=>{if(pe)return Er(Pe,null),Pe;if(n===void 0){if(n=Xc(s?e:"<!>"+e),!r)n=qt(n)}var i=ch(n,!0);if(r){var o=qt(i),a=gi(i);Er(o,a)}else Er(i,i);return i}}function sy(e,t,r="svg"){var n=!e.startsWith("<!>"),s=(t&Cu)!==0,i=`<${r}>${n?e:"<!>"+e}</${r}>`,o;return()=>{if(pe)return Er(Pe,null),Pe;if(!o){var a=Xc(i),l=qt(a);if(s){o=Fn();while(qt(l))Lt(o,qt(l))}else o=qt(l)}var _=ch(o,!0);if(s){var c=qt(_),h=gi(_);Er(c,h)}else Er(_,_);return _}}function Kc(e,t){return sy(e,t,"svg")}function Bt(e=""){if(!pe){var t=lg(e+"");return Er(t,t),t}var r=Pe;if(Kt(r)!==Pi)xr(r,r=Ro()),_t(r);else ll(r);return Er(r,r),r}function Ve(){if(pe)return Er(Pe,null),Pe;var e=Fn(),t=al(""),r=Mr();return Lt(e,t),Lt(e,r),Er(t,r),e}function z(e,t){if(pe){var r=Ae;if((r.f&Zr)===0||r.nodes.end===null)r.nodes.end=Pe;vr();return}if(e===null)return;xr(e,t)}var iy=fr|Kn,zg=!1;class Ch{parent;is_pending=!1;transform_error;#r;#t=pe?Pe:null;#e;#o;#n;#s=null;#a=null;#i=null;#l=null;local_pending_count=0;#u=!1;#_=[];effect_pending=null;effect_pending_subscriber=null;constructor(e,t,r,n){if(this.#r=e,this.#e=t,this.#o=(s)=>{var i=Ae;i.b=this,i.f|=Xn,r(s)},this.parent=Ae.b,this.transform_error=n??this.parent?.transform_error??((s)=>s),this.#n=Nr(()=>{if(pe){let s=zi(this.#t);vr();let i=We&&s===qi;if(s.startsWith(ja)){let a=JSON.parse(s.slice(ja.length));this.#h(a)}else if(i)this.#f();else this.#d()}else this.#p();if(We&&t.pending)return()=>{di.delete(this)}},iy),pe)this.#r=Pe}#d(){var e=pe;try{this.#s=zt(()=>this.#o(this.#r))}catch(t){if(e)$t(!0);this.error(t)}}#h(e){let t=this.#e.failed,{reset:r,invoke_onerror:n}=this.#m(e);if(ar(n),!t)return;this.#i=zt(()=>{t(this.#r,()=>e,()=>r)})}#m(e){var t=!1,r=!1;let n=()=>{if(this.#c())return;if(t){mm();return}if(t=!0,r)Pm();if(this.#i!==null)Ws(this.#i,()=>{this.#i=null});this.#g(()=>{this.#p()})};return{reset:n,invoke_onerror:()=>{if(this.#c())return;try{r=!0,this.#e.onerror?.(e,n),r=!1}catch(i){en(i,this.#n&&this.#n.parent)}}}}#c(){return(this.#n.f&(at|fs))!==0}#f(){let e=this.#e.pending;if(!We||!e)return;this.is_pending=!0,this.#a=zt(()=>e(this.#r)),ar(()=>{if(this.#c())return;var t=lt?br(this.#n.r):null,r=this.#l=Fn(),n=Mr();Lt(r,n);try{this.#s=this.#g(()=>zt(()=>this.#o(n)));var s=Hr.ensure();if(!We||this.is_ready(s))this.reveal();else di.add(this)}catch(i){try{this.error(i)}catch(o){en(o,this.#n.parent)}}finally{if(lt)kr(t)}})}#p(){try{this.local_pending_count=0,this.#s=zt(()=>{this.#o(this.#r)});let r=We?this.#e.pending:void 0;var e=Hr.ensure();if(r&&!this.is_ready(e)){this.is_pending=!0;var t=this.#l=Fn();Fo(this.#s,t),this.#a=zt(()=>r(this.#r)),di.add(this)}}catch(r){this.error(r)}}defer_effect(e){this.#_.push(e)}#g(e){var t=Ae,r=qe,n=He;yr(this.#n),lr(this.#n),Ls(this.#n.ctx);var s=lt?br(this.#n.r):null;try{return Hr.ensure(),e()}finally{if(yr(t),lr(r),Ls(n),lt)kr(s)}}is_ready(e){return e.is_boundary_ready(this.#s)}reveal(){if(this.is_pending=!1,We)di.delete(this);if(this.#a)Ws(this.#a,()=>{this.#a=null});if(this.#l){var e=lt?br(this.#n.r):null;try{xr(this.#r,this.#l),this.#l=null}finally{if(lt)kr(e)}}}queue_effects(e){for(let t of this.#_)Zt(t,vt),e.push(t);this.#_.length=0}update_effect_pending(e){if(!We)return;if(this.local_pending_count+=e,!this.effect_pending||this.#u)return;this.#u=!0,ar(()=>{if(this.#u=!1,this.effect_pending)Vs(this.effect_pending,this.local_pending_count)})}error(e){if(e===yn)throw e;if(!zg||!this.#e.onerror&&!this.#e.failed)throw e;if(We&&Re?.is_fork){if(this.#s)Re.skip_effect(this.#s);if(this.#a)Re.skip_effect(this.#a);if(this.#i)Re.skip_effect(this.#i);Re.oncommit(()=>{if(!this.#c())this.#b(e)})}else this.#b(e)}#b(e){if(!zg)return;if(We&&this.is_pending)this.is_pending=!1,di.delete(this);if(this.#s)Pt(this.#s),this.#s=null;if(this.#a)Pt(this.#a),this.#a=null;if(this.#i)Pt(this.#i),this.#i=null;if(pe)_t(this.#t),or(),_t(gs());let t=this.#e.failed,r=(n)=>{if(this.#c())return;let{reset:s,invoke_onerror:i}=this.#m(n);if(i(),t&&!this.#c())this.#i=this.#g(()=>{try{return zt(()=>{var o=Ae;o.b=this,o.f|=Xn,t(this.#r,()=>n,()=>s)})}catch(o){return en(o,this.#n.parent),null}})};ar(()=>{if(this.#c())return;var n;try{n=this.transform_error(e)}catch(s){en(s,this.#n&&this.#n.parent);return}if(n!==null&&typeof n==="object"&&typeof n.then==="function")n.then(r,(s)=>en(s,this.#n&&this.#n.parent));else r(n)})}}var Zc=!0;function zo(e){Zc=e}function ae(e,t){var r=t==null?"":typeof t==="object"?`${t}`:t;if(r!==(e[La]??=Qr(e)))e[La]=r,cg(e,`${r}`)}function Uo(e,t){return Bg(e,t)}function Oh(e,t){t.intro=t.intro??!1;let r=t.target,n=pe,s=Pe;try{var i=qt(r);while(i&&(Kt(i)!==un||Qr(i)!==vo))i=tr(i);if(!i)throw yn;$t(!0),_t(i);let o=Bg(e,{...t,anchor:i});if(We&&Re!==null)Re.commit_writes();return $t(!1),o}catch(o){if(o instanceof Error&&o.message.split(`
59
+ `).some((a)=>a.startsWith("https://svelte.dev/e/")))throw o;if(o!==yn)console.warn("Failed to hydrate: ",o);if(t.recover===!1)Sm();return Mo(r),$t(!1),Uo(e,t)}finally{$t(n),_t(s)}}function Bg(e,t){if(lt&&t.renderer){var r=br(t.renderer);try{return Ug(e,t)}finally{kr(r)}}return Ug(e,t)}function Ug(e,{target:t,anchor:r,props:n={},events:s,context:i,intro:o=!0,transformError:a,renderer:l}){var _=void 0,c=dg(()=>{var h=r??Lt(t,Mr());new Ch(h,{pending:()=>{}},(f)=>{Oe({});var p=He;if(i)p.c=i;if(s)n.$$events=s;if(pe)Er(f,null);if(Zc=o,_=e(f,n)||Ba(),Zc=!0,pe){if(Ae.nodes.end=Pe,Pe===null||Kt(Pe)!==un||Qr(Pe)!==Li)throw ji(),yn}Ne()},a);var d=l?null:Th(t);return()=>{if(d?.(),h!==r){var f=Io(h);if(f)jc(f,h)}}});return Sh.set(_,c),_}var Sh=new WeakMap;function Nh(e,t){let r=Sh.get(e);if(r)return Sh.delete(e),r(t);if(K)dm();return Promise.resolve()}class ws{anchor;#r=new Map;#t=new Map;#e=new Map;#o=new Set;#n=!0;#s=null;constructor(e,t=!0){this.anchor=e,this.#n=t,this.#s=ee}#a=(e)=>{if(!this.#r.has(e))return;var t=lt?br(this.#s):null;try{var r=this.#r.get(e),n=this.#t.get(r);if(n)Lo(n),this.#o.delete(r);else{var s=this.#e.get(r);if(s){if(Lo(s.effect),this.#t.set(r,s.effect),this.#e.delete(r),K)gi(s.fragment)[Au]=this.anchor;Ps(gi(s.fragment)),xr(this.anchor,s.fragment),n=s.effect,n.f&=~dr}}this.#i(e);for(let[i,o]of this.#t){if(i===r||this.#o.has(i))continue;let a=()=>{if(Array.from(this.#r.values()).includes(i)){var _=Fn();Fo(o,_),Lt(_,Mr()),this.#e.set(i,{effect:o,fragment:_})}else Pt(o);this.#o.delete(i),this.#t.delete(i)};if(this.#n||!n)this.#o.add(i),Ws(o,a,!1);else a()}}finally{if(lt)kr(t)}};#i=(e)=>{for(let r of this.#r.keys())if(r===e||!r.linked)this.#r.delete(r);let t=Array.from(this.#r.values());for(let[r,n]of this.#e)if(!t.includes(r))Pt(n.effect),this.#e.delete(r)};ensure(e,t){var r=Re,n=ol();if(t&&!this.#t.has(e)&&!this.#e.has(e))if(n){var s=Fn(),i=Mr();Lt(s,i);var o=zt(()=>t(i));o.f|=dr,r.unskip_new_effect(o),this.#e.set(e,{effect:o,fragment:s})}else this.#t.set(e,zt(()=>t(this.anchor)));if(this.#r.set(r,e),n){for(let[a,l]of this.#t)if(a===e)r.unskip_effect(l);else r.skip_effect(l);for(let[a,l]of this.#e)if(a===e)r.unskip_effect(l.effect);else r.skip_effect(l.effect);r.oncommit(this.#a),r.ondiscard(this.#i)}else{if(pe)this.anchor=Pe;this.#a(r)}}}function ge(e,t,r=!1){var n;if(pe)n=Pe,vr();var s=new ws(e),i=r?fr:0;function o(a,l){if(pe){var _=zi(n);if(a!==parseInt(_.substring(1))){var c=gs();_t(c),s.anchor=c,$t(!1),s.ensure(a,l),$t(!0);return}}s.ensure(a,l)}Nr(()=>{var a=!1;if(t((l,_=0)=>{a=!0,o(_,l)}),!a)o(-1,null)},i)}var d8=Symbol("NaN");function Hg(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Hg(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Vg(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Hg(e))&&(n&&(n+=" "),n+=t);return n}function Bo(e){if(typeof e==="object")return Vg(e);else return e??""}var Yg=[...`
60
+ \r\f \v\uFEFF`];function Wg(e,t,r){var n=e==null?"":""+e;if(t)n=n?n+" "+t:t;if(r){for(var s of Object.keys(r))if(r[s])n=n?n+" "+s:s;else if(n.length){var i=s.length,o=0;while((o=n.indexOf(s,o))>=0){var a=o+i;if((o===0||Yg.includes(n[o-1]))&&(a===n.length||Yg.includes(n[a])))n=(o===0?"":n.substring(0,o))+n.substring(a+1);else o=a}}}return n===""?null:n}function Gg(e,t=!1){var r=t?" !important;":";",n="";for(var s of Object.keys(e)){var i=e[s];if(i!=null&&i!=="")n+=" "+s+": "+i+r}return n}function Rh(e){if(e[0]!=="-"||e[1]!=="-")return e.toLowerCase();return e}function Mh(e,t){if(t){var r="",n,s;if(Array.isArray(t))n=t[0],s=t[1];else n=t;if(e){e=String(e).replaceAll(/\/\*.*?\*\//g,"").trim();var i=!1,o=0,a=!1,l=[];if(n)l.push(...Object.keys(n).map(Rh));if(s)l.push(...Object.keys(s).map(Rh));var _=0,c=-1;let m=e.length;for(var h=0;h<m;h++){var d=e[h];if(a){if(d==="/"&&e[h-1]==="*")a=!1}else if(i){if(i===d)i=!1}else if(d==="/"&&e[h+1]==="*")a=!0;else if(d==='"'||d==="'")i=d;else if(d==="(")o++;else if(d===")")o--;if(!a&&i===!1&&o===0){if(d===":"&&c===-1)c=h;else if(d===";"||h===m-1){if(c!==-1){var f=Rh(e.substring(_,c).trim());if(!l.includes(f)){if(d!==";")h++;var p=e.substring(_,h).trim();r+=" "+p+";"}}_=h+1,c=-1}}}}if(n)r+=Gg(n);if(s)r+=Gg(s,!0);return r=r.trim(),r===""?null:r}return e==null?null:String(e)}function _r(e,t){return t}function ay(e,t,r){var n=[],s=t.length,i;for(var o=0;o<s;o++){let c=t[o];Ws(c,()=>{if(i){if(i.pending.delete(c),i.done.add(c),i.pending.size===0){var h=e.outrogroups;if(Ih(e,po(i.done)),h.delete(i),h.size===0)e.outrogroups=null}}else n.push(c)},!1)}if(n.length===s){var a=r!==null&&e.pending.size===0;if(a){var l=r,_=Io(l);Mo(_),Lt(_,l),e.items.clear()}Ih(e,t,!a)}else{i={pending:new Set(t),done:new Set(n)};for(let c of n)i.pending.delete(c);(e.outrogroups??=new Set).add(i)}}function Jg(e){var t=new Set;for(let r of e.pending.values())for(let n of r)t.add(e.items.get(n).e);return t}function Ih(e,t,r=!0){var n=e.pending.size>0?Jg(e):void 0;for(var s=0;s<t.length;s++){var i=t[s];if(n?.has(i)){i.f|=dr;let o=Fn();if(Fo(i,o),i!==e.effect.last)is(e,i.prev,i.next),is(e,e.effect.last,i),is(e,i,null)}else Pt(t[s],r)}}function ly(e,t){if(e.outrogroups!==null){for(let r of e.outrogroups)if(r.pending.has(t)||r.done.has(t))return!0}return!1}var Xg=new WeakMap,Kg={};function Zg(){var e=Xg.get(ee??Kg);if(e)return e;var t=Mr();if(ee){var r=Fn();Lt(r,t)}return Xg.set(ee??Kg,t),t}function At(e,t,r,n,s,i=null){var o=e,a=new Map,l=(t&Tu)!==0,_=ee;if(l){var c=e;o=pe?_t(qt(c)):Lt(c,Mr())}if(pe)vr();var h=null,d=Hi(()=>{var w=r();return qn(w)?w:w==null?[]:po(w)});if(K)Ln(d,"{#each ...}");var f=new Map,p=!0;function m(w){if((x.effect.f&at)!==0)return;var O=lt?br(_):null;try{x.pending.delete(w);var N=y(d);if(x.fallback=h,cy(x,N,o,t,n),h!==null)if(N.length===0)if((h.f&dr)===0)Lo(h);else h.f^=dr,fl(h,null,o);else Ws(h,()=>{h=null})}finally{if(lt)kr(O)}b()}function g(w){if(x.pending.delete(w),(x.effect.f&at)===0)b()}function b(){var w,O=x.effect.last;while(O!==null){var N=O.prev;if((O.f&Qt)!==0&&O!==h){if((O.f&dr)===0)break;if(w??=Jg(x),!w.has(O)&&!ly(x,O))Pt(O)}O=N}}var k=Nr(()=>{var w=y(d),O=w.length;let N=!1;if(pe){var S=zi(o)===qi;if(S!==(O===0))o=gs(),_t(o),$t(!1),N=!0}var D=new Set,X=Re,G=ol();for(var H=0;H<O;H+=1){if(pe&&Kt(Pe)===un&&Qr(Pe)===Li)o=Pe,N=!0,$t(!1);var R=w[H],W=n(R,H);if(K){var j=n(R,H);if(W!==j)$m(String(H),String(W),String(j))}var P=p?null:a.get(W);if(P){if(P.v)Vs(P.v,R);if(P.i)Vs(P.i,H);if(G)X.unskip_effect(P.e)}else{if(P=_y(a,p?o:Zg(),R,W,H,s,t,r),!p){if(P.e.f|=dr,G)X.unskip_new_effect(P.e)}a.set(W,P)}D.add(W)}if(O===0&&i&&!h){if(p)h=zt(()=>i(o));else if(h=zt(()=>i(Zg())),h.f|=dr,G)X.unskip_new_effect(h)}if(G&&h!==null)if(O===0)X.unskip_effect(h);else X.skip_effect(h);if(O>D.size)if(K)uy(w,n);else Ru("","","");if(pe&&O>0)_t(gs());if(!p)if(f.set(X,D),G){for(let[M,F]of a)if(!D.has(M))X.skip_effect(F.e);X.oncommit(m),X.ondiscard(g)}else m(X);if(N)$t(!0);y(d)}),x={effect:k,flags:t,items:a,pending:f,outrogroups:null,fallback:h};if(p=!1,pe)o=Pe}function hl(e){while(e!==null&&(e.f&Qt)===0)e=e.next;return e}function cy(e,t,r,n,s){var i=(n&rm)!==0,o=t.length,a=e.items,l=hl(e.effect.first),_,c=null,h,d=[],f=[],p,m,g,b;if(i){for(b=0;b<o;b+=1)if(p=t[b],m=s(p,b),g=a.get(m).e,(g.f&dr)===0)g.nodes?.a?.measure(),(h??=new Set).add(g)}for(b=0;b<o;b+=1){if(p=t[b],m=s(p,b),g=a.get(m).e,e.outrogroups!==null)for(let H of e.outrogroups)H.pending.delete(g),H.done.delete(g);if((g.f&Xt)!==0){if(Lo(g),i)g.nodes?.a?.unfix(),(h??=new Set).delete(g)}if((g.f&dr)!==0)if(g.f^=dr,g===l)fl(g,null,r);else{var k=c?c.next:l;if(g===e.effect.last)e.effect.last=g.prev;if(g.prev)g.prev.next=g.next;if(g.next)g.next.prev=g.prev;is(e,c,g),is(e,g,k),fl(g,k,r),c=g,d=[],f=[],l=hl(c.next);continue}if(g!==l){if(_!==void 0&&_.has(g)){if(d.length<f.length){var x=f[0],w;c=x.prev;var O=d[0],N=d[d.length-1];for(w=0;w<d.length;w+=1)fl(d[w],x,r);for(w=0;w<f.length;w+=1)_.delete(f[w]);is(e,O.prev,N.next),is(e,c,O),is(e,N,x),l=x,c=N,b-=1,d=[],f=[]}else _.delete(g),fl(g,l,r),is(e,g.prev,g.next),is(e,g,c===null?e.effect.first:c.next),is(e,c,g),c=g;continue}d=[],f=[];while(l!==null&&l!==g)(_??=new Set).add(l),f.push(l),l=hl(l.next);if(l===null)continue}if((g.f&dr)===0)d.push(g);c=g,l=hl(g.next)}if(e.outrogroups!==null){for(let H of e.outrogroups)if(H.pending.size===0)Ih(e,po(H.done)),e.outrogroups?.delete(H);if(e.outrogroups.size===0)e.outrogroups=null}if(l!==null||_!==void 0){var S=[];if(_!==void 0){for(g of _)if((g.f&Xt)===0)S.push(g)}while(l!==null){if((l.f&Xt)===0&&l!==e.fallback)S.push(l);l=hl(l.next)}var D=S.length;if(D>0){var X=(n&Tu)!==0&&o===0?r:null;if(i){for(b=0;b<D;b+=1){var G=S[b].nodes?.a;G?.measure(),G?.capture_size()}for(b=0;b<D;b+=1)S[b].nodes?.a?.set_position();for(b=0;b<D;b+=1)S[b].nodes?.a?.set_transform()}ay(e,S,X)}}if(i)ar(()=>{if(h===void 0)return;for(g of h)g.nodes?.a?.apply()})}function _y(e,t,r,n,s,i,o,a){var l=(o&em)!==0?(o&nm)===0?Gi(r,!1,!1):fn(r):null,_=(o&tm)!==0?fn(s):null;if(K&&l)l.trace=()=>{a()[_?.v??s]};return{v:l,i:_,e:zt(()=>(i(t,l??r,_??s,a),()=>{e.delete(n)}))}}function fl(e,t,r){if(!e.nodes)return;var n=e.nodes.start,s=e.nodes.end,i=t&&(t.f&dr)===0?t.nodes.start:r;while(n!==null){var o=tr(n);if(xr(i,n),n===s)return;n=o}}function is(e,t,r){if(t===null)e.effect.first=r;else t.next=r;if(r===null)e.effect.last=t;else r.prev=t}function uy(e,t){let r=new Map,n=e.length;for(let s=0;s<n;s++){let i=t(e[s],s);if(r.has(i)){let o=String(r.get(i)),a=String(s),l=String(i);if(l.startsWith("[object "))l=null;Ru(o,a,l)}r.set(i,s)}}function Qg(e,t=!1){if(e==null){if(!t)bm()}else if(typeof e!=="function"||e===Function.prototype.call||e===Function.prototype.apply||e===Function.prototype.bind)vm();return e}function xs(e,t,...r){var n=new ws(e);Nr(()=>{let s=t()??null;if(K)Qg(s);n.ensure(s,s&&((i)=>s(i,...r)))},fr)}var vy=null;function Dh(e){vy=e}function Jc(e,t,r,n,s,i){let o=pe;if(pe)vr();var a=K&&i&&He?.function[wn],l=null;if(pe&&Kt(Pe)===Fa)l=Pe,vr();var _=pe?Pe:e,c=Ae,h=new ws(_,!1);if(Nr(()=>{let d=t()||null;var f=s?s():r||d==="svg"?bo:void 0;if(d===null){h.ensure(null,null),zo(!0);return}return h.ensure(d,(p)=>{if(d){var m=pe;if(l=pe?l:An(d,f),K&&i)_l(l,{file:a,line:i[0],column:i[1]});if(K&&!ee&&(f==null||f===Fi)&&by(d)&&An(d)instanceof HTMLUnknownElement)gm(d);if(Er(l,l),n){var g=null;if(pe&&Pg(d))Lt(l,g=al(""));var b=pe?qt(l):Lt(l,Mr());if(pe)if(b===null)$t(!1);else _t(b);if(Dh(c),n(l,b),g)jc(l,g);Dh(null)}if(Ae.nodes.end=l,!m)xr(p,l)}if(pe)_t(p)}),zo(!0),()=>{if(d)zo(!1)}},fr),nr(()=>{zo(!0)}),o)$t(!0),_t(_)}function by(e){try{return Is(An(e,bo))!==SVGElement.prototype}catch{return!1}}function Qc(e,t){var r=void 0,n;Bc(()=>{if(r!==(r=t())){if(n)Pt(n),n=null;if(r)n=zt(()=>{dn(()=>r(e))})}})}function sr(e,t,r,n,s,i){var o=e[Pa];if(pe||o!==r||o===void 0||lt&&ee!==null){var a=Wg(r,n,i);if(!pe||a!==Gs(e,"class"))if(a==null)Vr(e,"class");else if(t)e.className=a;else Ys(e,"class",a);e[Pa]=r}else if(i&&s!==i)for(var l in i){var _=!!i[l];if(s==null||_!==!!s[l])ug(e,l,_)}return i}function Ph(e,t={},r,n){for(var s in r){var i=r[s];if(t[s]!==i)if(r[s]==null)uh(e,s);else _h(e,s,i,n)}}function Dr(e,t,r,n){var s=e[qa];if(pe||s!==t||lt&&ee!==null){var i=Mh(t,n);if(!pe||i!==Gs(e,"style"))if(i==null)Vr(e,"style");else hh(e,i);e[qa]=t}else if(n)if(Array.isArray(n))Ph(e,r?.[0],n[0]),Ph(e,r?.[1],n[1],"important");else Ph(e,r,n);return n}function e_(e,t){if(ee){Do(ee,e,"selected",t);return}if(t){if(!Po(e,"selected"))Ys(e,"selected","")}else Vr(e,"selected")}function t_(e,t){var r=!("__defaultValue"in e);if(!r&&e.__defaultValue===t)return;e.__defaultValue=t,tv(e,!r||"__value"in e)}function tv(e,t){var{__defaultValue:r,multiple:n}=e,s=n?r??[]:null;if(n&&!qn(s))return;var i=e.selectedIndex,o=t&&n?new Set(e.selectedOptions):null;for(var a of e.options){var l=qh(a);e_(a,n?s.includes(l):Fc(l,r))}if(!t)return;if(o!==null)for(a of e.options){var _=o.has(a);if(a.selected!==_)a.selected=_}else if(e.selectedIndex!==i)e.selectedIndex=i}function dl(e,t,r=!1){if(e.multiple){if(t==null)return;if(!qn(t))return pm();for(var n of e.options)n.selected=t.includes(qh(n));return}for(n of e.options){var s=qh(n);if(Fc(s,t)){n.selected=!0;return}}if(!r||t!==void 0)e.selectedIndex=-1}function Lh(e){var t=new MutationObserver((r)=>{if(r.every(ky))return;if("__defaultValue"in e)tv(e,!1);if("__value"in e)dl(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),nr(()=>{t.disconnect()})}function qh(e){if("__value"in e)return e.__value;else return e.value}function ky(e){if(e.target.closest("selectedcontent")!==null)return!0;if(e.type==="childList"){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every((r)=>r.nodeName==="SELECTEDCONTENT")}return!1}var bi=Symbol("class"),Ho=Symbol("style"),iv=Symbol("is custom element"),ov=Symbol("is html"),yy=go?"link":"LINK",rv=go?"input":"INPUT",wy=go?"option":"OPTION",av=go?"select":"SELECT";function r_(e){if(!pe)return;var t=!1,r=()=>{if(t)return;if(t=!0,Po(e,"value")){var n=e.value;St(e,"value",null),e.value=n}if(Po(e,"checked")){var s=e.checked;St(e,"checked",null),e.checked=s}};e[ci]=r,ar(r),Hc()}function jh(e,t){var r=Uh(e);if(r.checked===(r.checked=t??void 0))return;ih(e,t)}function St(e,t,r,n){var s=Uh(e);if(pe){if(s[t]=Gs(e,t),t==="src"||t==="srcset"||t==="href"&&bs(e)===yy){if(!n)Ey(e,t,r??"");return}}var i=s[t];if(i===(s[t]=r))return;if(r==null)Vr(e,t);else if(typeof r!=="string"&&lv(e).has(t))e[t]=r;else if(!(pe&&(typeof r==="number"||typeof r==="boolean")&&i===String(r)))Ys(e,t,r)}function xy(e,t,r,n,s=!1,i=!1){if(pe&&s&&bs(e)===rv){if(!(("defaultValue"in r)||("defaultChecked"in r)))r_(e)}var o=Uh(e),a=o[iv],l=!o[ov];let _=pe&&a;if(_)$t(!1);var c=t||{},h=bs(e)===wy,d=bs(e)===av;try{for(var f in t)if(!(f in r)&&f[0]+f[1]!=="$$")r[f]=null;if(r.class)r.class=Bo(r.class);else if(n||r[bi])r.class=null;if(r[Ho])r.style??=null;var p=lv(e);if(ee==null&&bs(e)===rv&&"type"in r&&(("value"in r)||("__value"in r))){var m=r.type;if(m!==c.type||m===void 0&&e.hasAttribute("type"))c.type=m,St(e,"type",m,i)}for(let N in r){let S=r[N];if(h&&N==="value"&&S==null){e.value=e.__value="",c[N]=S;continue}if(N==="class"){var g=ee==null&&e.namespaceURI===Fi;sr(e,g,S,n,t?.[bi],r[bi]),c[N]=S,c[bi]=r[bi];continue}if(N==="style"){Dr(e,S,t?.[Ho],r[Ho]),c[N]=S,c[Ho]=r[Ho];continue}var b=c[N];if(S===b&&!(S===void 0&&Po(e,N)))continue;c[N]=S;var k=N[0]+N[1];if(k==="$$")continue;if(k!=="on"&&N.length>2&&k.toLowerCase()==="on")continue;if(k==="on"){let D={},X="$$"+N,G=N.slice(2);var x=ee==null&&Mg(G);if(Rg(G))G=G.slice(0,-7),D.capture=!0;if(!x&&b){if(S!=null)continue;Uc(e,G,c[X],D),c[X]=null}if(x)$r(G,e,S),ss([G]);else if(S!=null){let H=function(...R){c[N].apply(this,R)};c[X]=Ah(G,e,H,D)}}else if(N==="style")St(e,N,S);else if(N==="autofocus")if(ee==null)vh(e,Boolean(S));else if(S)Ys(e,N,S);else Vr(e,N);else if(!a&&(N==="__value"||N==="value"&&S!=null)){if(e.__value=S,b==null||ee!=null||typeof S!=="string"||e.value!==S)sh(e,S)}else if(N==="selected"&&h)e_(e,S);else{var w=N;if(!l)w=Ig(w);var O=w==="defaultValue"||w==="defaultChecked";if(d&&w==="defaultValue")continue;if(S==null&&!a&&!O){if(o[N]=null,(w==="value"||w==="checked")&&ee==null){let D=e,X=t===void 0;if(w==="value"){let G=D.defaultValue;Vr(D,w),oh(D,G),sh(D,D.__value=X?G:null)}else{let G=D.defaultChecked;Vr(D,w),ah(D,G),ih(D,X?G:!1)}}else if(Vr(e,N),w==="value")e.__value=null}else if(O&&ee!=null){if(w==="defaultValue")oh(e,S);else ah(e,S);if(w in o)o[w]=xt}else if(O||(a||typeof S!=="string")&&p.has(w)){if(e[w]=S,w in o)o[w]=xt}else if(ee!=null||typeof S!=="function")St(e,w,S,i)}}}finally{if(_)$t(!0)}return c}function zh(e,t,r=[],n=[],s=[],i,o=!1,a=!1){Ha(s,r,n,(l)=>{var _=void 0,c={},h=bs(e)===av,d=!1;if(Bc(()=>{var p=t(...l.map(y)),m=xy(e,_,p,i,o,a);if(d&&h){var g=e;if("defaultValue"in p)t_(g,p.defaultValue);if("value"in p)dl(g,p.value)}for(let k of Object.getOwnPropertySymbols(c))if(!p[k])Pt(c[k]);for(let k of Object.getOwnPropertySymbols(p)){var b=p[k];if(k.description===Su&&(!_||b!==_[k])){if(c[k])Pt(c[k]);c[k]=zt(()=>Qc(e,()=>b))}m[k]=b}_=m}),h){var f=e;dn(()=>{var p=_;if("defaultValue"in p)t_(f,p.defaultValue);dl(f,p.value,!0),Lh(f)})}d=!0})}function Uh(e){return e[bc]??={[iv]:bs(e).includes("-"),[ov]:ee==null&&e.namespaceURI===Fi}}var nv=new Map,$y=new Set;function lv(e){if(ee)return $y;var t=Gs(e,"is"),r=t||bs(e),n=nv.get(r);if(n)return n;if(n=new Set,!customElements||!(t||r.includes("-"))||customElements.get(t||r.toLowerCase()))nv.set(r,n);var s,i=e,o=Element.prototype;while(o!==i){s=wu(i);for(var a in s)if(s[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText")n.add(a);i=Is(i)}return n}function Ey(e,t,r){if(!K||ee!=null)return;if(t==="srcset"&&Ay(e,r))return;if(Fh(Gs(e,t)??"",r))return;fm(t,e.outerHTML.replace(e.innerHTML,e.innerHTML&&"..."),String(r))}function Fh(e,t){if(e===t||ee!=null)return!0;return new URL(e,document.baseURI).href===new URL(t,document.baseURI).href}function sv(e){return e.split(",").map((t)=>t.trim().split(" ").filter(Boolean))}function Ay(e,t){if(ee!=null)return!0;var r=sv(e.srcset),n=sv(t);return n.length===r.length&&n.every(([s,i],o)=>i===r[o][1]&&(Fh(r[o][0],s)||Fh(s,r[o][0])))}function pl(e,t,r=t){var n=new WeakSet;if(bh(e,"input",async(s)=>{if(K&&e.type==="checkbox")Nu();var i=s?e.defaultValue:e.value;if(i=Bh(e)?Hh(i):i,r(i),Re!==null)n.add(Re);if(await Yc(),i!==(i=t())){var{selectionStart:o,selectionEnd:a}=e,l=e.value.length;if(e.value=i??"",a!==null){var _=e.value.length;if(o===a&&a===l&&_>l)e.selectionStart=_,e.selectionEnd=_;else e.selectionStart=o,e.selectionEnd=Math.min(a,_)}}}),pe&&e.defaultValue!==e.value||pt(t)==null&&e.value){if(r(Bh(e)?Hh(e.value):e.value),Re!==null)n.add(Re)}Yr(()=>{if(K&&e.type==="checkbox")Nu();var s=t();if(e===document.activeElement){if(n.has(Et))return}if(Bh(e)&&s===Hh(e.value))return;if(e.type==="date"&&!s&&!e.value)return;if(s!==e.value)e.value=s??""})}function Bh(e){var t=e.type;return t==="number"||t==="range"}function Hh(e){return e===""?null:+e}function Vh(e,t){return e===t||e?.[Jr]===t}function ml(e=Ba(),t,r,n){var s=He.r,i=Ae;return dn(()=>{var o,a;return Yr(()=>{o=a,a=n?.()||[],pt(()=>{if(!Vh(r(...a),e)){if(t(e,...a),o&&Vh(r(...o),e))t(null,...o)}})}),()=>{let l=i;while(l!==s&&l.parent!==null&&l.parent.f&fs)l=l.parent;let _=()=>{if(a&&Vh(r(...a),e))t(null,...a)},c=l.teardown;l.teardown=()=>{_(),c?.()}}}),e}var s_=!1,uI=Symbol("unmounted");function Yh(e){var t=s_;try{return s_=!1,[e(),s_]}finally{s_=t}}var Cy={get(e,t){if(e.exclude.has(t))return;return e.props[t]},set(e,t){if(K)Nm(`${e.name}.${String(t)}`);return!1},getOwnPropertyDescriptor(e,t){if(e.exclude.has(t))return;if(t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){if(e.exclude.has(t))return!1;return t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter((t)=>!e.exclude.has(t))}};function Ks(e,t,r){return new Proxy(K?{props:e,exclude:t,name:r}:{props:e,exclude:t},Cy)}function on(e,t,r,n){var s=!qs||(r&im)!==0,i=(r&am)!==0,o=(r&lm)!==0,a=n,l=!0,_=void 0,c=()=>{if(o&&s)return _??=hi(n),y(_);if(l)l=!1,a=o?pt(n):n;return a};let h;if(i){var d=Jr in e||Da in e;h=zr(e,t)?.set??(d&&t in e?(w)=>e[t]=w:void 0)}var f,p=!1;if(i)[f,p]=Yh(()=>e[t]);else f=e[t];if(f===void 0&&n!==void 0){if(f=c(),h){if(s)Om(t);h(f)}}var m;if(s)m=()=>{var w=e[t];if(w===void 0)return c();return l=!0,w};else m=()=>{var w=e[t];if(w!==void 0)a=void 0;return w===void 0?a:w};if(s&&(r&om)===0)return m;if(h){var g=e.$$legacy;return function(w,O){if(arguments.length>0){if(!s||!O||g||p)h(O?m():w);return w}return m()}}var b=!1,k=((r&sm)!==0?hi:Hi)(()=>(b=!1,m()));if(K)k.label=t;if(i)y(k);var x=Ae;return function(w,O){if(arguments.length>0){let N=O?y(k):s&&i?cr(w):w;if(Me(k,N),b=!0,a!==void 0)a=N;return w}if(Rr&&b||(x.f&at)!==0)return k.v;return y(k)}}function cv(e){return new _v(e)}class _v{#r;#t;constructor(e){var t=new Map,r=(i,o)=>{var a=Gi(o,!1,!1);return t.set(i,a),a};let n=new Proxy({...e.props||{},$$events:{}},{get(i,o){return y(t.get(o)??r(o,Reflect.get(i,o)))},has(i,o){if(o===Da)return!0;return y(t.get(o)??r(o,Reflect.get(i,o))),Reflect.has(i,o)},set(i,o,a){return Me(t.get(o)??r(o,a),a),Reflect.set(i,o,a)}}),s={target:e.target,anchor:e.anchor,props:n,context:e.context,intro:e.intro??!1,recover:e.recover,transformError:e.transformError};if(this.#t=e.hydrate?Oh(e.component,s):Uo(e.component,s),!We&&(!e?.props?.$$host||e.sync===!1))pi();this.#r=n.$$events;for(let i of Object.keys(this.#t)){if(i==="$set"||i==="$destroy"||i==="$on")continue;Vt(this,i,{get(){return this.#t[i]},set(o){this.#t[i]=o},enumerable:!0})}this.#t.$set=(i)=>{Object.assign(n,i)},this.#t.$destroy=()=>{Nh(this.#t)}}$set(e){this.#t.$set(e)}$on(e,t){this.#r[e]=this.#r[e]||[];let r=(...n)=>t.call(this,...n);return this.#r[e].push(r),()=>{this.#r[e]=this.#r[e].filter((n)=>n!==r)}}$destroy(){this.#t.$destroy()}}var Py;if(typeof HTMLElement==="function")Py=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(e,t,r){super();if(this.$$ctor=e,this.$$s=t,r)this.$$shadowRoot=this.attachShadow(r)}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let n=this.$$c.$on(e,t);this.$$l_u.set(t,n)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){let n=this.$$l_u.get(t);if(n)n(),this.$$l_u.delete(t)}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(n){return(s)=>{let i=An("slot");if(n!=="default")i.name=n;z(s,i)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let t={},r=qy(this);for(let n of this.$$s)if(n in r)if(n==="default"&&!this.$$d.children)this.$$d.children=e(n),t.default=!0;else t[n]=e(n);for(let n of this.attributes){let s=this.$$g_p(n.name);if(!(s in this.$$d))this.$$d[s]=Gh(s,n.value,this.$$p_d,"toProp")}for(let n in this.$$p_d)if(!(n in this.$$d)&&this[n]!==void 0)this.$$d[n]=this[n],delete this[n];this.$$c=cv({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=mh(()=>{Yr(()=>{this.$$r=!0;for(let n of yu(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];let s=Gh(n,this.$$d[n],this.$$p_d,"toAttribute");if(s==null)this.removeAttribute(this.$$p_d[n].attribute||n);else this.setAttribute(this.$$p_d[n].attribute||n,s)}this.$$r=!1})});for(let n in this.$$l)for(let s of this.$$l[n]){let i=this.$$c.$on(n,s);this.$$l_u.set(s,i)}this.$$l={}}}attributeChangedCallback(e,t,r){if(this.$$r)return;e=this.$$g_p(e),this.$$d[e]=Gh(e,r,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]})}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{if(!this.$$cn&&this.$$c)this.$$c.$destroy(),this.$$me(),this.$$c=void 0})}$$g_p(e){return yu(this.$$p_d).find((t)=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}};function Gh(e,t,r,n){let s=r[e]?.type;if(t=s==="Boolean"&&typeof t!=="boolean"?t!=null:t,!n||!r[e])return t;else if(n==="toAttribute")switch(s){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t==null?null:t;default:return t}else switch(s){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function qy(e){let t={};return e.childNodes.forEach((r)=>{t[r.slot||"default"]=!0}),t}if(K){let e=function(t){if(!(t in globalThis)){let r;Object.defineProperty(globalThis,t,{configurable:!0,get:()=>{if(r!==void 0)return r;Rm(t)},set:(n)=>{r=n}})}};e("$state"),e("$effect"),e("$derived"),e("$inspect"),e("$props"),e("$bindable")}function uv(e){if(He===null)za("onMount");if(qs&&He.l!==null)Ly(He).m.push(e);else Ir(()=>{let t=pt(e);if(typeof t==="function")return t})}function Ly(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}ag();var hv="5";if(typeof window<"u")((globalThis.__svelte??={}).v??=new Set).add(hv);var fv=Symbol("directive-data"),dv=(e)=>js(fv,e),pv=()=>Fs(fv)??{};var fF=Symbol("view-theme");var mv=Symbol("primitives"),gv=(e)=>js(mv,e);function zn(){let e=Fs(mv);if(!e)throw Error("@svarness/ui: no primitives; call set_primitives in the app first.");return e}var Fy=te('<form class="composer"><textarea rows="2" placeholder="Message · Enter sends, Shift+Enter adds a line" aria-label="Message"></textarea> <button type="submit">Send</button></form>');function Wh(e,t){Oe(t,!0);let r=Le("");async function n(){let a=y(r).trim();if(!a||t.busy)return;if(await t.onsend(a))Me(r,"")}var s=Fy(),i=ke(s);cl(i);var o=se(i,2);ue(s),le((a)=>o.disabled=a,[()=>t.busy||!y(r).trim()]),ys("submit",s,(a)=>{a.preventDefault(),n()}),$r("keydown",i,(a)=>{if(a.key==="Enter"&&!a.shiftKey&&!a.isComposing)a.preventDefault(),n()}),pl(i,()=>y(r),(a)=>Me(r,a)),z(e,s),Ne()}ss(["keydown"]);var vv=Symbol("app-data"),bv=(e)=>js(vv,e),Vo=()=>Fs(vv)??{now:()=>Date.now(),usage:()=>Promise.reject(Error("unavailable")),revision:()=>0},kv=Symbol("reply-parts"),yv=(e)=>js(kv,e),ki=()=>Fs(kv);function gl(e,t){let r=Math.round(Math.min(1,Math.max(0,e))*t*8),n=Math.floor(r/8),s=r%8;return"█".repeat(n)+(s?" ▏▎▍▌▋▊▉█"[s]:"")+"░".repeat(Math.max(0,t-n-(s?1:0)))}var jy="▁▂▃▄▅▆▇█";function Xh(e){if(!e.length)return"";let t=Math.min(...e),r=Math.max(...e);return e.map((n)=>jy[r===t?3:Math.round((n-t)/(r-t)*7)]).join("")}function zy(e){let t=e.trim().replaceAll(",","");if(!t)return;let r=Number(t);return Number.isFinite(r)?r:void 0}function Kh(e,t=!1){let r=[],n=0;for(let[s,[i,o]]of e.entries()){if(t&&s===e.length-1&&!o.trim())continue;let a=zy(o);if(a===void 0||!i.trim())n++;else r.push({label:i.trim(),value:a})}return{bars:r,skipped:n}}function Zh(e){let t=e.lastIndexOf(":");return t<0?[e,""]:[e.slice(0,t),e.slice(t+1)]}var i_=[{name:"callout",kind:"container",description:"A highlighted note.",args:{kind:{type:"enum",values:["info","tip","warning","danger"],default:"info"}},body:"markdown",example:`:::callout(kind=tip)
61
+ Run the tests before you commit.
62
+ :::`},{name:"chart",kind:"container",description:"A bar chart or sparkline of labelled numbers.",args:{type:{type:"enum",values:["bar","sparkline"],default:"bar"},title:{type:"string"}},body:"a 2-column markdown table (label | number) or a list of `label: number`",example:`:::chart(type=bar, title="Tests per package")
63
+ - core: 24
64
+ - model: 18
65
+ :::`},{name:"tree",kind:"container",description:"A file tree. Names ending in / are folders.",args:{title:{type:"string"}},body:"a nested markdown list",example:`:::tree(title=src)
66
+ - lib/
67
+ - util.ts
68
+ - main.ts
69
+ :::`},{name:"progress",kind:"leaf",description:"A progress bar.",args:{value:{type:"number",required:!0},max:{type:"number",default:100},label:{type:"string"}},example:'::progress(value=3, max=5, label="Steps done")'},{name:"details",kind:"container",description:"Collapsed detail the reader can open. Use it for long output.",args:{summary:{type:"string",required:!0}},body:"markdown",example:`:::details(summary="Full log")
70
+ The long text goes here.
71
+ :::`},{name:"usage",kind:"leaf",description:"Live token, request and cost totals.",args:{scope:{type:"enum",values:["session","workspace"],default:"session"}},example:"::usage(scope=session)"},{name:"change",kind:"leaf",description:"The diff of the Nth file change of this reply.",args:{index:{type:"number",required:!0}},example:"::change(index=0)",internal:!0},{name:"check",kind:"leaf",description:"The result of the check run after the edits.",args:{},example:"::check",internal:!0},{name:"widget",kind:"leaf",description:"A live widget pinned in this reply.",args:{id:{type:"number",required:!0}},example:"::widget(id=1)",internal:!0},{name:"view",kind:"leaf",description:"A view the model built in this reply.",args:{index:{type:"number",required:!0}},example:"::view(index=0)",internal:!0}],vl=(e)=>typeof e==="string"?i_.find((t)=>t.name===e):void 0;function Uy(e){let t=Object.entries(e.args).map(([r,n])=>{let s=n.type==="enum"?n.values.join("|"):n.type==="number"?"number":"text";return n.required?`${r}=${s}`:`[${r}=${s}]`});return`- ${e.name} (${e.kind}${t.length?", "+t.join(" "):""}): ${e.description}`+(e.body?` Body: ${e.body}.`:"")+`
72
+ `+e.example.replace(/^/gm," ")}var By=`You can place small components in a reply with directives. A leaf is one line: ::name(key=value, ...). A container is :::name(key=value, ...) on its own line, the body, then ::: on its own line. Quote values that contain spaces. Arguments in [brackets] are optional. Components only show data: never put code or HTML in them. Use them when they make the answer clearer, not on every reply. Directives:
73
+ `+i_.filter((e)=>!e.internal).map(Uy).join(`
74
+ `)+`
75
+ Never write ::change, ::check, ::widget or ::view; the app inserts them where edits, checks, watched widgets and views happen.`;function o_(e,t=""){return e.flatMap((r,n)=>{let s=n===e.length-1;return[{prefix:t+(s?"└─ ":"├─ "),name:r.name,folder:r.name.endsWith("/")||r.children.length>0},...o_(r.children,t+(s?" ":"│ "))]})}function Hy(e,t,r){if(t.type==="number"){let n=r.trim()===""?NaN:Number(r);if(!Number.isFinite(n))throw[`${e} must be a number, got "${r}"`];return n}if(t.type==="enum"&&!t.values?.includes(r))throw[`${e} must be one of ${t.values?.join(", ")}, got "${r}"`];return r}function Jh(e,t){let r=vl(e);if(!r)return{ok:!1,error:`unknown directive "${String(e)}"`};let n=t??{};for(let i of Object.keys(n))if(!(i in r.args))return{ok:!1,error:`unknown argument "${i}"`};let s={};for(let[i,o]of Object.entries(r.args)){let a=n[i];if(a===void 0||a===""){if(o.default!==void 0)s[i]=o.default;else if(o.required)return{ok:!1,error:`missing required argument "${i}"`};continue}try{s[i]=Hy(i,o,typeof a==="string"?a:JSON.stringify(a))}catch(l){return{ok:!1,error:l[0]}}}return{ok:!0,args:s}}var Vy,jF=new Uint32Array(0),zF=Object.freeze([]);var wv=globalThis.Buffer,UF=wv!==void 0&&typeof wv.allocUnsafeSlow=="function";var BF=new ArrayBuffer(0);var Yy=32;function Gy(e){let t=1;for(;t<e;)t<<=1;return t}var ef=(e)=>{switch(e){case 0:return"root";case 1:return"text";case 2:return"html";case 3:return"heading";case 4:return"mustache";case 5:return"code_fence";case 6:return"line_break";case 7:return"paragraph";case 8:return"code_span";case 9:return"emphasis";case 10:return"strong_emphasis";case 11:return"thematic_break";case 12:return"link";case 13:return"image";case 14:return"block_quote";case 15:return"list";case 16:return"list_item";case 17:return"hard_break";case 18:return"soft_break";case 19:return"strikethrough";case 20:return"superscript";case 21:return"subscript";case 22:return"table";case 23:return"table_header";case 24:return"table_row";case 25:return"table_cell";case 26:return"html_comment";case 27:return"svelte_tag";case 28:return"svelte_block";case 29:return"svelte_branch";case 30:return"directive_inline";case 31:return"directive_leaf";case 32:return"directive_container";case 33:return"frontmatter";case 34:return"import_statement";case 35:return"directive_label";case 36:return"footnote_reference";case 37:return"footnote_definition";case 38:return"definition"}},$v=new Map;for(let e=0;e<=38;e++)$v.set(ef(e),e);var tf=(e)=>$v.get(e);var Ev=!1,xv=1;function Wy(){xv=xv+1|1}function l_(){Ev=!0,Wy()}var Xy=!1;function Av(){Xy=!0,Ev=!0}var Ky=!1;function Tv(){Ky=!0}var Zy=0,Jy=1,Qy=2;class c_{constructor(e,t,r,n,s,i,o,a,l,_){this.source=e,this.base=t,this.rec=r,this.at=n,this.n=s,this.name_start=i,this.attrs_end=o,this.open_end=a,this.attrs_start=l,this.canonical=_,this.text=void 0}}var Qh=new Int32Array(8192),a_=0,Cv=0;function Sv(e,t){a_+t>Qh.length&&(Qh=new Int32Array(t>8192?t:8192),a_=0);let r=Qh,n=Cv=a_;for(let s=0;s<t;s++)r[n+s]=e[s];return a_=n+t,r}function Ov(){return Cv}function Nv(e){let{source:t,base:r,rec:n}=e,s=e.at+e.n,i={};for(let o=e.at;o<s;o+=5){let a=n[o],l=t.slice(n[o+1]-r,n[o+2]-r);if(a===Zy)i[l]=!0;else if(a===Qy)i[l]={type:"expression",value:l};else{let _=t.slice(n[o+3]-r,n[o+4]-r);i[l]=a===Jy?_:{type:"expression",value:_}}}return i}var ew=Symbol("attributes");Vy=ew;function Yo(e){return e==="script"||e==="style"||e==="pre"||e==="textarea"}class rf{constructor(e=Yy){let t=Gy(e);this.capacity=t,this.indices=new Uint32Array(t),this._size=0}reset(){this._size=0}get size(){return this._size}push(e){let t=this._size;t>=this.capacity&&this.grow(),this.indices[t]=e>>>0,this._size=t+1}at(e){return this.indices[e]}slice(){return this.indices.subarray(0,this._size)}grow(){let e=this.capacity<<1,t=new Uint32Array(e);t.set(this.indices),this.capacity=e,this.indices=t}}var YF=new Int32Array(64);var Yt=4294967295,nf=Symbol("ATTR_DID_NOT_EXIST");function Mv(e,t,r){let n=e.prev_at(r),s=e.next_at(r);n!==Yt?e.set_next(n,s):e.first_child_at(t)===r&&e.set_first_child(t,s!==Yt&&e.parent_at(s)===t?s:Yt),s!==Yt&&e.parent_at(s)===t&&e.set_prev(s,n),e.last_child_at(t)===r&&e.set_last_child(t,n!==Yt?n:Yt),e.set_parent(r,Yt),e.set_next(r,Yt),e.set_prev(r,Yt)}var Rv=new Map;class sf{constructor(){this.logs=Rv,this.active_node=Yt,this.top=0,this.state_tails=null,this.kind_changes=null}log_kind(e,t){let r=this.kind_changes;r===null?this.kind_changes=[e,t]:r.push(e,t)}set_active_node(e){this.active_node=e}clear_active_node(){this.active_node=Yt}get recording(){return this.active_node!==Yt}record_attr_set(e,t,r){this.active_node!==Yt&&this._append({kind:0,target:e,key:t,prior_value:r})}record_attr_delete(e,t,r){this._append({kind:1,target:e,key:t,prior_value:r})}record_type_change(e,t){this.log_kind(e,t),this.active_node!==Yt&&this._append({kind:2,target:e,prior_kind:t})}record_wrap_inner(e,t,r,n){this._append({kind:3,parent:e,wrapper:t,prior_first_child:r,prior_last_child:n})}record_wrap_from(e){this._append({kind:6,wrapper:e})}record_close_wrapper(e){this._append({kind:7,links:e})}record_state(e,t,r){let n=this.state_tails;n===null&&(n=this.state_tails=new WeakMap);let s=n.get(e);s===void 0&&(s=new Map,n.set(e,s));let i=s.get(t)??null,o={kind:8,state:e,key:t,prior_value:r,prev:i,next:null};i!==null&&(i.next=o),s.set(t,o),this.active_node!==Yt&&this._append(o)}undo_state(e){var t;let{prev:r,next:n}=e;if(n!==null)n.prior_value=e.prior_value,n.prev=r;else{e.prior_value===nf?delete e.state[e.key]:e.state[e.key]=e.prior_value;let s=(t=this.state_tails)==null?void 0:t.get(e.state);s!==void 0&&(r!==null?s.set(e.key,r):s.delete(e.key))}r!==null&&(r.next=n)}record_count(e,t){this.active_node!==Yt&&this._append({kind:9,counts:e,slot:t})}record_warn(e,t){this.active_node!==Yt&&this._append({kind:10,list:e,warning:t})}record_data(e,t,r,n){this.active_node!==Yt&&this._append({kind:11,host:e,bag:t,key:r,owner:n})}record_prepend(e,t,r){this._append({kind:4,parent:e,created:t,prior_first_child:r})}record_append(e,t,r){this._append({kind:5,parent:e,created:t,prior_last_child:r})}_append(e){let t=this.active_node;if(t===Yt)return;let r=this.logs;r===Rv&&(r=this.logs=new Map);let n=r.get(t);n===void 0&&(n=[],(r.size===0||t>=this.top)&&(this.top=t+1),r.set(t,n)),n.push(e)}revoke(e,t,r){let n=this.logs.get(e);if(n!==void 0){for(let s=n.length-1;s>=0;s--){let i=n[s];switch(i.kind){case 0:{let o=t.metadata_at(i.target);o&&(i.prior_value===nf?delete o[i.key]:o[i.key]=i.prior_value,t.set_metadata(i.target,o));break}case 1:{let o=t.metadata_at(i.target);o&&(o[i.key]=i.prior_value,t.set_metadata(i.target,o));break}case 2:{t.set_kind(i.target,i.prior_kind);break}case 3:{let o=i.wrapper;r!==void 0&&r.unlink(t,o),t.unwrap_node(o),t.set_parent(o,Yt);break}case 6:{let o=i.wrapper;if(t.parent_at(o)===Yt)break;r!==void 0&&r.unlink(t,o),t.unwrap_node(o),t.set_parent(o,Yt);break}case 7:{r!==void 0&&r.reopen(t,i.links);break}case 8:{this.undo_state(i);break}case 9:{i.counts[i.slot]--;break}case 10:{let o=i.list.lastIndexOf(i.warning);o!==-1&&i.list.splice(o,1);break}case 11:{i.host.revoke_data(i.bag,i.key,i.owner);break}case 4:case 5:{let{parent:o,created:a}=i;Mv(t,o,a);break}}}this.logs.delete(e)}}commit(e){this.logs.size!==0&&this.logs.delete(e)}get empty(){return this.logs.size===0}has(e){return this.logs.has(e)}clear(){this.logs.clear(),this.kind_changes=null,this.active_node=Yt}}var ZF=Symbol("view"),JF=Symbol("idx"),QF=Symbol("undo");var Q=9,V=10,U=32,Tr=34,pn=35,k_=36,Un=39,Gr=45,__=46,kt=47,Jt=58,gn=60,Zo=61,er=62,Iv=64,Ot=123,vn=125,bt=92,be=96,Ar=126,On=94,Ye=124,Zi=33,gt=42,mn=40,Tn=41,Pr=91,as=93,qr=95,bl=43,Dv=44;var yj=Object.prototype;var ea=new Uint8Array(128);ea[32]=45;ea[45]=45;ea[95]=95;for(let e=48;e<=57;e++)ea[e]=e;for(let e=65;e<=90;e++)ea[e]=e+32;for(let e=97;e<=122;e++)ea[e]=e;var wj=new Uint8Array(256);var xj=Symbol("unset");var Jo=39;function Qv(e,t){let r=e.parse;return function(n,s){let i=r(n,s[t]);return i?[i]:null}}function iw(e,t,r,n){let s=e.parse,i=t.parse;return function(o,a){let l=s(o,a[r]),_=i(o,a[n]);return l?_?[l,_]:[l]:_?[_]:null}}function ow(e,t,r,n,s,i){let o=e.parse,a=t.parse,l=r.parse;return function(_,c){let h=o(_,c[n]),d=a(_,c[s]),f=l(_,c[i]),p=null;return h&&(p=[h]),d&&(p?p.push(d):p=[d]),f&&(p?p.push(f):p=[f]),p}}function aw(e,t){let r=e.map((s)=>s.parse),n=r.length;return function(s,i){let o=null;for(let a=0;a<n;a++){let l=r[a](s,i[t[a]]);l&&(o?o.push(l):o=[l])}return o}}function lw(e,t){switch(e.length){case 1:return Qv(e[0],t[0]);case 2:return iw(e[0],e[1],t[0],t[1]);case 3:return ow(e[0],e[1],e[2],t[0],t[1],t[2]);default:return aw(e,t)}}var cw=1073741823;function _w(e){let t=Array(Jo).fill(null),r=[];for(let c=0;c<Jo;c++)r.push([]);let n=[],s=[],i=[],o=null;for(let c=0;c<e.length;c++){let h=e[c];s.push(typeof h.name=="string"?h.name:void 0);let d=h.observe;if(d!==void 0){if(!hw(d))throw TypeError(`the observe of ${uw(s[c])} must be an object of entries by directive name`);(o??(o=[])).push({plugin:s[c],table:d})}let f=h.document;if(f!==void 0){if(typeof f!="function")throw TypeError("the document hook of a plugin must be a function that takes the root and the context");i.push({run:f,at:c})}let p=h.sequential?Array(Jo).fill(null):null,m=null;for(let g of Object.keys(h)){if(g==="sequential")continue;let b=tf(g);if(b===void 0)continue;let k=h[g];if(b===1){if(k===void 0)continue;let x=typeof h.name=="string"?`the ${h.name} plugin`:"a plugin";if(typeof k!="function")throw TypeError(`the text handler of ${x} must be a function that takes a run of text`);if(p===null)throw TypeError(`the text handler of ${x} needs the tree to be complete, set sequential: true on the plugin`);m={parse:k,all:h.all_text===!0,at:c};continue}if(!(!k||typeof k!="object"||!("parse"in k))){if(p!==null){p[b]=Qv(k,c);continue}t[b]||(t[b]=[]),t[b].push(k),r[b].push(c)}}p!==null&&n.push({plugin:h,handlers:p,text:m})}let a=Array(Jo).fill(null),l=new Uint32Array(2);for(let c=0;c<Jo;c++){let h=t[c];h&&h.length>0&&(a[c]=lw(h,r[c]),l[c>>5]|=1<<(c&31))}let _=new Int32Array(64);for(let c=0;c<64;c++)l[c>>5]&1<<(c&31)&&(_[c]=cw);return{fused:a,sequential:n.filter((c)=>c.text!==null||c.handlers.some((h)=>h!==null)),has_handler:l,open_wants:_,names:s,documents:i,observers:o}}var $j=Jo*2;function uw(e){return e===void 0?"a plugin without a name":`plugin "${e}"`}function hw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ej=Symbol("host"),Aj=Symbol("plugin"),Tj=Symbol("task");var Cj=_w([]);class eb{constructor(){this.store=null,this.live=0,this.top=0}has(e){return e<this.top&&this.store.has(e)}set(e,t){let r=this.store;r===null&&(r=this.store=new Map),r.set(e,t),this.live=r.size,e>=this.top&&(this.top=e+1)}take(e){if(e>=this.top)return;let t=this.store,r=t.get(e);if(r!==void 0){if(t.delete(e),(this.live=t.size)===0)this.top=0;else if(e+1===this.top){let n=0;for(let s of t.keys())s>=n&&(n=s+1);this.top=n}}return r}add_first(e,t){let r=e>=this.top?void 0:this.store.get(e);r!==void 0?r.unshift(t):this.set(e,[t])}add_last(e,t){let r=e>=this.top?void 0:this.store.get(e);r!==void 0?r.push(t):this.set(e,[t])}fire(e){let t=this.take(e);if(t!==void 0)for(let r=0;r<t.length;r++)t[r]()}discard(e){this.take(e)}reset(){this.store!==null&&this.store.size!==0&&this.store.clear(),this.live=0,this.top=0}}var Sj=new sf,Oj=new eb,Nj=new Uint32Array(0);var gf=new Uint16Array([161,169,171,172,174,177,180,180,182,184,187,187,191,191,215,215,247,247,706,709,722,735,741,747,749,749,751,767,885,885,894,894,900,901,903,903,1014,1014,1154,1154,1370,1375,1417,1418,1421,1423,1470,1470,1472,1472,1475,1475,1478,1478,1523,1524,1542,1551,1563,1563,1565,1567,1642,1645,1748,1748,1758,1758,1769,1769,1789,1790,1792,1805,2038,2041,2046,2047,2096,2110,2142,2142,2184,2184,2404,2405,2416,2416,2546,2547,2554,2555,2557,2557,2678,2678,2800,2801,2928,2928,3059,3066,3191,3191,3199,3199,3204,3204,3407,3407,3449,3449,3572,3572,3647,3647,3663,3663,3674,3675,3841,3863,3866,3871,3892,3892,3894,3894,3896,3896,3898,3901,3973,3973,4030,4037,4039,4044,4046,4058,4170,4175,4254,4255,4347,4347,4960,4968,5008,5017,5120,5120,5741,5742,5787,5788,5867,5869,5941,5942,6100,6102,6104,6107,6144,6154,6464,6464,6468,6469,6622,6655,6686,6687,6816,6822,6824,6829,6990,6991,7002,7018,7028,7039,7164,7167,7227,7231,7294,7295,7360,7367,7379,7379,8125,8125,8127,8129,8141,8143,8157,8159,8173,8175,8189,8190,8208,8231,8240,8286,8314,8318,8330,8334,8352,8385,8448,8449,8451,8454,8456,8457,8468,8468,8470,8472,8478,8483,8485,8485,8487,8487,8489,8489,8494,8494,8506,8507,8512,8516,8522,8525,8527,8527,8586,8587,8592,9257,9280,9290,9372,9449,9472,10101,10132,11123,11126,11263,11493,11498,11513,11516,11518,11519,11632,11632,11776,11822,11824,11869,11904,11929,11931,12019,12032,12245,12272,12287,12289,12292,12296,12320,12336,12336,12342,12343,12349,12351,12443,12444,12448,12448,12539,12539,12688,12689,12694,12703,12736,12773,12783,12783,12800,12830,12842,12871,12880,12880,12896,12927,12938,12976,12992,13311,19904,19967,42128,42182,42238,42239,42509,42511,42611,42611,42622,42622,42738,42743,42752,42774,42784,42785,42889,42890,43048,43051,43062,43065,43124,43127,43214,43215,43256,43258,43260,43260,43310,43311,43359,43359,43457,43469,43486,43487,43612,43615,43639,43641,43742,43743,43760,43761,43867,43867,43882,43883,44011,44011,64297,64297,64434,64466,64830,64847,64912,64913,64968,64975,65020,65023,65040,65049,65072,65106,65108,65126,65128,65131,65281,65295,65306,65312,65339,65344,65371,65381,65504,65510,65512,65518,65532,65533]),Pv=gf.length>>1,fw=(e)=>{let t=0,r=Pv;for(;t<r;){let n=t+r>>1;e>gf[(n<<1)+1]?t=n+1:r=n}return t<Pv&&e>=gf[t<<1]},dw=["root","text","html","heading","mustache","code_fence","line_break","paragraph","code_span","emphasis","strong_emphasis","thematic_break","link","image","block_quote","list","list_item","hard_break","soft_break","strikethrough","superscript","subscript","table","table_header","table_row","table_cell","html_comment","svelte_tag","svelte_block","svelte_branch","directive_inline","directive_leaf","directive_container","frontmatter","import_statement","directive_label","footnote_reference","footnote_definition","definition"];function pw(e){return e===5||e===8||e===26}class kf{constructor(){this.source="",this.batch=[],this.schema_emitted=!1,this.kinds=new Map,this.pending_starts=new Map,this.text_parents=new Map,this.text_state=new Map,this.info_starts=new Map,this.raw_html_ids=new Set,this.directive_names=new Map,this.parser_cursor=0}set_source(e){this.source=e}open(e,t,r,n,s,i){if(this.kinds.set(e,t),t===1){let o=this.kinds.get(n)===1?this.text_parents.get(n)??n:n;this.text_parents.set(e,o);return}i&&this.pending_starts.set(e,r),this.batch.push(["O",e,t,n,i?1:0,s])}close(e,t){this.kinds.get(e)!==1&&this.batch.push(["C",e])}close_pending(e,t){this.batch.push(["C",e,1])}text(e,t,r){if(r>t){let n=this.source.slice(t,r);n&&this.send(e,n,this.escaped_at(t))}}escaped_at(e){let t=this.source,r=e;for(;r>0&&t.charCodeAt(r-1)===92;)r--;return(e-r&1)===1}send(e,t,r){this.batch.push(r?["T",e,t,1]:["T",e,t])}attr(e,t,r){if(r instanceof c_&&(r=Nv(r)),t==="tag"&&this.kinds.get(e)===2&&Yo(r)&&this.raw_html_ids.add(e),t==="value_start"){let n=this.kinds.get(e),s=n===2&&this.raw_html_ids.has(e);if(n!==1&&!s&&(n===void 0||!pw(n)))return;let i=n===1?this.text_parents.get(e)??e:e,o=this.text_state.get(e);o&&o.sent>r&&this.batch.push(["X",o.target]),this.text_state.set(e,{start:r,sent:r,target:i,done:!1,is_fence:n===5,escaped:n===1&&this.escaped_at(r)});return}if(t==="text"){let n=this.kinds.get(e);if(n===4||n===27)return;let s=this.text_state.get(e);s&&s.sent>s.start&&this.batch.push(["X",s.target]),this.text_state.delete(e),this.batch.push(["T",e,r]);return}if(t==="value_end"){let n=this.text_state.get(e);if(n){if(r>n.sent){let s=this.source.slice(n.sent,r);s&&(this.send(n.target,s,n.escaped&&n.sent===n.start),n.sent=r)}else if(n.sent>r){this.batch.push(["X",n.target]);let s=this.source.slice(n.start,r);s&&this.send(n.target,s,n.escaped),n.sent=r}n.done=!0}return}if(t==="info_start"){this.info_starts.set(e,r);return}if(t==="info_end"){let n=this.info_starts.get(e);if(n!==void 0){let s=this.source.slice(n,r);s&&this.batch.push(["A",e,"info",s]),this.info_starts.delete(e)}return}this.kinds.get(e)!==1&&(t==="name"&&this.kinds.get(e)===30&&this.directive_names.set(e,r),this.batch.push(["A",e,t,r]))}set_value_start(e,t){this.attr(e,"value_start",t)}set_value_end(e,t){this.attr(e,"value_end",t)}cursor(e){this.parser_cursor=e}revoke(e,t){let r=this.kinds.get(e),n=t??(r===30?`:${this.directive_names.get(e)}[`:mw(r)),s=this.pending_starts.get(e);t===void 0&&s!==void 0&&this.source.charCodeAt(s)===124&&(n=`|${n}`),this.batch.push(["R",e,n]),this.text_state.delete(e),this.pending_starts.delete(e),this.raw_html_ids.delete(e),this.directive_names.delete(e)}commit(e){this.batch.push(["K",e]),this.pending_starts.delete(e)}flush(){let e=this.source.length;for(let[r,n]of this.text_state){if(n.done)continue;let s;if(n.is_fence){if(s=e,s>n.sent){let i=this.source.slice(n.sent,s),o=i.lastIndexOf(`
76
+ `);if(o!==-1){let a=i.slice(o+1),l=0;for(;l<a.length&&(a.charCodeAt(l)===32||a.charCodeAt(l)===9);)l++;l<a.length&&a.charCodeAt(l)===96&&(s=n.sent+o)}else{let a=0;for(;a<i.length&&(i.charCodeAt(a)===32||i.charCodeAt(a)===9);)a++;if(a<i.length&&i.charCodeAt(a)===96)continue}}}else if(s=this.parser_cursor,n.target!==r)for(;s>n.sent;){let i=this.source.charCodeAt(s-1);if(i!==32&&i!==9)break;s--}if(s>n.sent){let i=this.source.slice(n.sent,s);i&&(this.send(n.target,i,n.escaped&&n.sent===n.start),n.sent=s)}}let t=[];this.schema_emitted||(t.push(["S",dw]),this.schema_emitted=!0);for(let r=0;r<this.batch.length;r++)t.push(this.batch[r]);return this.batch.length=0,t}flush_json(){return JSON.stringify(this.flush())}reset(){this.source="",this.batch.length=0,this.schema_emitted=!1,this.kinds.clear(),this.text_parents.clear(),this.text_state.clear(),this.pending_starts.clear(),this.info_starts.clear(),this.raw_html_ids.clear(),this.directive_names.clear(),this.parser_cursor=0}}function mw(e){switch(e){case 9:return"_";case 10:return"*";case 19:return"~~";case 20:return"^";case 21:return"~";case 12:return"[";case 13:return"![";case 8:return"`";case 2:return"<";default:return""}}var v=String.prototype.charCodeAt,gw=Object.prototype.hasOwnProperty,je=String.prototype.slice,de=String.prototype.indexOf,qv=String.prototype.startsWith,Ki=String.prototype.lastIndexOf,vf=new Uint8Array(128);for(let e=0;e<vf.length;e+=1){let t=0;e<=32&&(t|=1),(e>=33&&e<=47||e>=58&&e<=64||e>=91&&e<=96||e>=123&&e<=126)&&(t|=2),t===0&&(t=4),vf[e]=t}var vw=(e)=>e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288,bw=(e)=>e>=4352&&e<=4607||e>=11904&&e<=42191||e>=43360&&e<=43391||e>=44032&&e<=55295||e>=63744&&e<=64255||e>=65280&&e<=65519,Cn=(e)=>e<128?vf[e]:e!==e?7:vw(e)?1:fw(e)?2:bw(e)?6:4,u_=new rf(1),Lv=new Map;function Fv(e){return v.call(e,0)===On?"":tb(e)}var jv=1,h_=2;function tb(e){let t=e.length,r=U;for(let n=0;n<t;n++){let s=v.call(e,n);if(s<=U?s!==U||r===U:s>=65&&(s<=90||s>=128))return zv(e);r=s}return r===U?zv(e):e}function zv(e){return e.trim().replace(/\s+/g," ").toLowerCase()}function of(e,t){for(;e.length>t;)e.pop();e.length<t&&(e.length=t)}var Zs=0,Uv=1,kw=2,af=3,Bv=4,Js=0,Hv=1,f_=2,lf=3,Go=4,Vv=5,Yv=6,cf=7,d_=8,yw=9,_f=127,Wo=128,p_=16,ww=65536,Ji=new Int32Array(0),ir=[],Xo=globalThis.__pfm_general__!==!0,xw=/\\\|/g,m_=null,uf=Ji,kl=["",""];function Gv(e,t){if(t.length===0)return e;if(e.length===0)return t;kl[0]=e,kl[1]=t;let r=kl.join("");return kl[0]="",kl[1]="",r}var $w=/\\([!-/:-@[-`{-~])/g;function Ew(e,t){return t==="{"?"&#123;":t==="}"?"&#125;":t==="&"?"&amp;":t}function g_(e){return de.call(e,"\\")===-1?e:e.replace($w,Ew)}var Aw=65533;function El(e){let t=de.call(e,"\r");if(t===-1)return e;let r=[],n=0,s=!1;for(;t!==-1;)r.push(je.call(e,n,t)),n=t+1,v.call(e,n)===10?n++:s=!0,t=de.call(e,"\r",n);return r.push(je.call(e,n)),Tw=s?null:e,Cw=s?null:r,r.join(`
77
+ `)}var Tw=null,Cw=null;var Qs=new Uint8Array(128);Qs[Ot]=1;Qs[vn]=1;Qs[Tr]=1;Qs[Un]=1;Qs[be]=1;Qs[kt]=1;var E_=new Uint8Array(128);E_[gt]=1;E_[qr]=1;E_[Ar]=1;var $l=new Uint8Array(128);for(let e of"|!")$l[e.charCodeAt(0)]=1;for(let e of"#`*-_<>{:+0123456789[")$l[e.charCodeAt(0)]=3;var Sw=4,Qe=new Uint8Array(128);Qe[V]=1;Qe[bt]=1;Qe[gt]=1;Qe[qr]=1;Qe[Ar]=1;Qe[On]=1;Qe[gn]=1;Qe[Pr]=1;Qe[as]=1;Qe[Zi]=1;Qe[be]=1;Qe[Ye]=1;Qe[Ot]=1;Qe[Jt]=1;Qe[k_]=1;var rb=new Uint8Array(128);for(let e of"*_~^<[]!`{")rb[e.charCodeAt(0)]=1;var hf=(()=>{let e="\\x00";for(let o=1;o<128;o++)Qe[o]===1&&o!==gt&&o!==qr&&(e+="\\x"+(o<16?"0":"")+o.toString(16));let t="[A-Za-z_][\\w.\\-]*",r="\\{[^{}<\\n\"'`/]*\\}",n=`"[^"<\\n]*"|'[^'<\\n]*'|${r}|[^\\s"'=<>\`{]+`,s=`${r}|[^\\s=<>/"'\`{]+(?:[ \\t]*=[ \\t]*(?:${n}))?`,i=`<(?!(?:script|style)[\\s/>])${t}(?:[ \\t]+(?:${s}))*[ \\t]*/?>`;return new RegExp(`(?:[^${e}]+|</${t}[ \\t]*>|${i})*`,"y")})(),ff=!1,Wv=1024;function Xv(e){return e===14||e===15||e===16||e===28||e===29||e===2}function os(e,t,r){return t>>>0<r?v.call(e,t):NaN}function w_(e){return(e|32)>=97&&(e|32)<=122}var Kv=[],bf=new Int32Array(80),x_=0,v_=0;function yl(e,t,r,n,s){let i=bf,o=x_;if(o+5>i.length){let a=new Int32Array(i.length*2);a.set(i),i=bf=a}i[o]=e,i[o+1]=t,i[o+2]=r,i[o+3]=n,i[o+4]=s,x_=o+5}var Zv=[],Sn=0,Jv=0,df=0,pf=0,wl=">",xl=!1,Ko=!1,mf=!1,b_=!1,$_=0,y_=1,Qo=2,yf=3,Ow=256;function Nw(e,t,r,n){for(let s=0;s<n;s+=5){let i=r[s+1],o=r[s+2]-i,a=r[s]===Qo?i-2:i-1,l=v.call(e,a-t);if(l!==U&&l!==Q&&l!==V)return!1;let _=v.call(e,i-t);if(_>=48&&_<=57||_===95&&o===9)return!1;for(let c=0;c<s;c+=5){let h=r[c+1];if(r[c+2]-h!==o)continue;let d=0;for(;d<o&&v.call(e,i+d-t)===v.call(e,h+d-t);)d++;if(d===o)return!1}}return!0}function Rw(e,t,r,n,s){let i=s;for(let o=0;o<n;o+=5){let a=r[o],l=r[o+2],_=r[o+1],c=l;if(a===Qo){let h=v.call(e,_-t);if(h===36||h===95||w_(h))return!1;_--,c++}else if(a!==$_){let h=r[o+3],d=v.call(e,h-1-t);if(h-2!==l||v.call(e,l-t)!==Zo||(a===y_?d!==Tr:d!==Ot))return!1;let f=v.call(e,_-t);if(a===yf&&!(f===36||f===95||w_(f)))return!1;c=r[o+4]+1}if(_-i!==1||v.call(e,i-t)!==U)return!1;i=c}return!0}function Mw(e,t,r,n){let s=n-5;switch(r[s]){case $_:return r[s+2];case Qo:return r[s+2]+1;case yf:return r[s+4]+1;default:{let i=v.call(e,r[s+3]-1-t);return i===Tr||i===Un?r[s+4]+1:r[s+4]}}}function Iw(e,t,r,n,s,i){let o=n-s>4096?s+4096:n;for(;s<o;){let a=v.call(t,s-r);if(a>=128||Qs[a]===0){s++;continue}switch(a){case Ot:i++,s++;break;case vn:if(i--,i===0)return s+1;s++;break;case Tr:case Un:{let l=a===Tr?'"':"'",_=s+1-r;for(s=n;;){let c=de.call(t,l,_);if(c===-1)break;let h=c;for(;h>_&&v.call(t,h-1)===bt;)h--;if((c-h&1)===0){s=c+1+r;break}_=c+1}break}case be:{for(s++;s<n&&v.call(t,s-r)!==be;){if(v.call(t,s-r)===bt)s++;else if(v.call(t,s-r)===36&&s+1<n&&v.call(t,s+1-r)===Ot){s+=2;let l=e.find_matching_brace(s);if(l===-1)return-2;s=l;continue}s++}s<n&&s++;break}case kt:{if(s+1<n&&v.call(t,s+1-r)===kt){for(s+=2;s<n&&v.call(t,s-r)!==V;)s++;break}if(s+1<n&&v.call(t,s+1-r)===gt){for(s+=2;s<n;){if(v.call(t,s-r)===gt&&s+1<n&&v.call(t,s+1-r)===kt){s+=2;break}s++}break}s++;break}default:s++}}return s<n?Dw(e,t,r,n,s,i):-1}function Dw(e,t,r,n,s,i){let o=n-r,a=-1,l=-1,_=-1,c=-1,h=-1,d=-1,f=-1,p=-1;for(;;){let m=s-r;a<m&&(a=de.call(t,"{",m),(a===-1||a>o)&&(a=o)),l<m&&(l=de.call(t,"}",m),(l===-1||l>o)&&(l=o)),_<m&&(_=de.call(t,'"',m),(_===-1||_>o)&&(_=o)),c<m&&(c=de.call(t,"'",m),(c===-1||c>o)&&(c=o)),h<m&&(h=de.call(t,"`",m),(h===-1||h>o)&&(h=o)),d<m&&(d=de.call(t,"/",m),(d===-1||d>o)&&(d=o));let g=a;if(l<g&&(g=l),_<g&&(g=_),c<g&&(g=c),h<g&&(g=h),d<g&&(g=d),g>=o)return-1;let b=v.call(t,g);switch(s=g+r,b){case Ot:i++,s++;break;case vn:if(i--,i===0)return s+1;s++;break;case Tr:case Un:{let k=b===Tr?'"':"'",x=s+1-r;for(s=n;;){let w=de.call(t,k,x);if(w===-1)break;let O=w;for(;O>x&&v.call(t,O-1)===bt;)O--;if((w-O&1)===0){s=w+1+r;break}x=w+1}break}case be:{for(s++;;){let k=s-r;h<k&&(h=de.call(t,"`",k),(h===-1||h>o)&&(h=o)),f<k&&(f=de.call(t,"\\",k),(f===-1||f>o)&&(f=o)),p<k&&(p=de.call(t,"$",k),(p===-1||p>o)&&(p=o));let x=h;if(f<x&&(x=f),p<x&&(x=p),x>=o){s=n;break}s=x+r;let w=v.call(t,x);if(w===be){s++;break}if(w===bt){s+=2;continue}if(s+1<n&&v.call(t,x+1)===Ot){s+=2;let O=e.find_matching_brace(s);if(O===-1)return-2;s=O;continue}s++}break}case kt:{if(s+1<n){let k=v.call(t,s+1-r);if(k===kt){let x=de.call(t,`
78
+ `,s+2-r);s=x===-1||x>=o?n:x+r;break}if(k===gt){let x=de.call(t,"*/",s+2-r);s=x===-1||x+1>=o?n:x+2+r;break}}s++;break}default:s++}}}class nb extends Error{constructor(e){super(`the parser stopped at offset ${e} without reading on, please report this with the document`),this.name="ParseStallError",this.offset=e}}class A_{constructor(e,t=2,r){this.source="",this.source_base=0,this.source_end=0,this.trim_point=0,this.fence_scan=0,this.interrupt_pos=-1,this.interrupt_frames=0,this.interrupt_marker_pos=-1,this.interrupt_marker=null,this.marker=null,this.interrupt_svelte_depth=0,this.wait_chunks=ir,this.cold={raw_node:0,raw_needle:"",raw_scan:0,raw_start:0,raw_line:0,bp_start:-1,bp_p:0,bp_mode:0,bp_quote:0,bp_end:-1,bp_frames:null,brace_memo:null,tag_memo:null,tag_memo_base:0,tag_ends:null,tick_from:0,tick_at:-2,tick_end:0,note_pos:-1,note_column:0,wait_needle:"",wait_cursor:-1,fence_text:"",fence_indent:0,kept_cut:-1,kept_base:0,kept_count:0,table_bounds:null,table_rowspans:null,pending_html:0,np_floor:0,stale_html:[],task_pos:-1,spec_pending:0,label_start:-1,label_to:-1,label_end:-1,label_colons:0,label_name:"",guess:null},this.wait_kind=0,this.cursor=0,this.finished=!1,this.one_shot=!1,this.pending_cr=!1,this.states=[0],this.node_stack=[0],this.next_id=1,this.pending_ids=[],this.id_info=Ji,this.id_slots=Ji,this.finalized_below=0,this.pending_starts=[],this.pending_count=0,this.pending_para_count=0,this.class_floor=0,this.range_next_class=0,this.block_quote_depth=0,this.frames=ir,this.line_pos=0,this.line_quote=0,this.line_at=-1,this.line_kept=0,this.emphasis_has_content=!1,this.tag_wait=!1,this.list_depth=0,this.list_marker=0,this.list_ordered=!1,this.list_start_num=0,this.list_node_id=0,this.list_is_loose=!1,this.list_content_offset=0,this.list_marker_indent=0,this.list_state_stack=ir,this.list_pending_paras=ir,this.table_col_count=0,this.table_node_id=0,this.table_row_id=0,this.table_cell_id=0,this.table_cell_col=0,this.table_bound_l=-1,this.table_bound_r=-1,this.table_cur=0,this.in_table=!1,this.in_heading=!1,this.inline_range_parse=!1,this.table_cell_has_content=!1,this.html_tag_stack=[],this.html_block_depth=0,this.spec_para=-1,this.spec_watch=-1,this.spec_text=!1,this.spec_block=-1,this.spec_gap=-1,this.spec_never=!1,this.spec_link=-1,this.spec_image=-1,this.spec_item=!1,this.svelte_block_depth=0,this.svelte_block_tag="",this.svelte_branch_id=0,this.svelte_block_id=0,this.svelte_block_stack=ir,this.frontmatter_failed=!1,this.imports_allowed=!0,this.ref_map=Lv,this.ref_waiting=null,this.link_text_start=0,this.link_dest_start=0,this.link_dest_end=0,this.link_title_start=-1,this.link_title_end=-1,this.link_label_start=0,this.link_label_end=0,this.link_end=0,this.directive_colon_counts=ir,this.directive_text_ids=[],this.directive_text_brackets=[],this.extra=0,this.info_start_pos=0,this.info_end_pos=0,this.checkpoint_cursor=0,this.code_span_open_pos=0,this.span_vs=0,this.lead_mark=-1,this.mark_closed=-1,this.prev_cursor=0,this.prev_depth=0,this.loop_without_progress=0,this.unwrap_images=!1,this.out=e,this.errors=u_,this.tab_size=t,r!==void 0&&this.set_options(r),e.follow!==void 0&&e.follow(this)}set_options(e){this.unwrap_images=e!==void 0&&e.unwrap_images===!0}parse(e){return{errors:this.parse_normalized(El(e))}}parse_normalized(e){let t=e.length;return this._init(t>>3),this.source=e,this.source_end=t,this.errors=u_,this.finished=!0,this.one_shot=!0,this._run(),this._finalize(),this.errors}init(){this.id_info===Ji&&this.finalized_below===0?(this.take_ids(p_),this.out.open(0,0,0,-1,0,!1)):this._init(p_),this.cold.kept_cut=-1,this.cold.fence_text="",this.cold.fence_indent=0,this.finished=!1,this.one_shot=!1}feed(e){let t=e.length;if(t===0)return;this.pending_cr&&(v.call(e,0)!==10&&(e=`
79
+ `+e,t++),this.pending_cr=!1),t>0&&v.call(e,t-1)===13&&(this.pending_cr=!0,e=je.call(e,0,-1),t--),de.call(e,"\r")!==-1&&(e=e.replace(/\r\n?/g,`
80
+ `),t=e.length);let r=this.wait_kind;if(r!==Zs&&this.skip_wait(e,t)){this.out.cursor(this.cursor);return}this.wait_kind=Zs;let n=this.source,s=this.wait_chunks;this.trim_point-1>this.source_base&&this.trim_before_indent(),this.trim_point-1>this.source_base&&(this.spec_gap!==-1&&this.spec_gap<this.trim_point-1&&this.spec_gap_cut(this.trim_point-1),this.pending_count!==this.pending_para_count&&this.cold.pending_html!==0?(s.length!==0&&(n=this.join_held(n)),n=this.trim_keeping_html(n)):(n=je.call(n,this.trim_point-1-this.source_base),this.source_base=this.trim_point-1));let i;s.length===0?i=Gv(n,e):(s.unshift(n),s.push(e),i=s.join(""),s.length=0),this.source=i,this.source_end+=t,r===7&&this.table_cell_resume(),this.cold.guess!==null&&this.guess_feed(),this.cold.guess===null&&this._run();let o=this.cold.guess;if(o!==null){this.out.cursor(o.label===-1?this.cursor:o.pos);return}this.cursor-this.trim_point>Wv?this.trim_at_stall():this.fence_scan-this.trim_point>Wv&&this.trim_fence(),this.out.cursor(this.cursor)}trim_at_stall(){let e=this.node_stack,t=e.length-1;if(t<1)return;if(this.states[this.states.length-1]===5){this.trim_fence();return}let r=this.source_base,n=this.source,s=this.cursor,i=this.kind_of(e[t]);for(i===1&&(i=this.kind_of(e[--t]));this.is_trim_delimiter(i);)i=this.kind_of(e[--t]);let o;if(i===7){if(s===this.source_end&&s>r&&this.states[this.states.length-1]===1&&this.kind_of(e[e.length-1])===1){let a=v.call(n,s-1-r);o=a===U||a===Q?-1:s}else o=-1;if(o===-1){let a=Ki.call(n,`
81
+ `,s-1-r);if(a===-1)return;o=a+1+r}}else if(i===25||i===22)if(i===25){if(this.kind_of(e[--t])!==22)return;let a=this.states,l=a.length-1;for(;l>1&&a[l]!==24;)l--;if(a[l]!==24||a[l-1]!==23)return;let _=Ki.call(n,`
82
+ `,s-2-r);if(_===-1)return;o=_+1+r}else{if(this.states[this.states.length-1]!==23||s<=r||v.call(n,s-1-r)!==V)return;o=s}else{if(i===8){this.wait_code_span();return}if(!Xv(i)||s<=r||v.call(n,s-1-r)!==V)return;o=s,t++}o<=this.trim_point||this.can_trim_to(o,t)&&(this.trim_point=o)}is_trim_delimiter(e){return e===10||e===9||e===19||e===20||e===21}trim_fence(){let e=this.states;if(e[e.length-1]!==5||this.wait_kind!==Zs||this.cold.fence_indent!==0&&this.frames.length===0)return;let t=this.fence_scan;t>this.trim_point&&this.can_trim_to(t,this.node_stack.length-1)&&(this.trim_point=t)}can_trim_to(e,t){let r=this.node_stack;for(let i=1;i<t;i++)if(!Xv(this.kind_of(r[i])))return!1;let n=this.source_base,s=this.source;for(let i=this.pending_floor();i<this.pending_count;i++){let o=this.pending_ids[i],a=this.kind_of(o);if(a===7||this.is_trim_delimiter(a))continue;if(a!==2){if((a===12||a===13)&&r.indexOf(o)===-1)continue;return!1}if(r.indexOf(o)===-1)return!1;let l=this.pending_starts[i];if(l<n)return!1;let _=de.call(s,`
83
+ `,this.html_open_tag_end(l)-n);if(_===-1||_+n>=e-1)return!1}return!0}wait_code_span(){this.in_table||this.wait_kind!==Zs||this.states[this.states.length-1]===13&&de.call(this.source,"`",this.cursor-this.source_base)===-1&&(this.wait_kind=5,this.cold.wait_cursor=this.cursor)}code_span_may_end(e,t){if(t===0||de.call(e,"`")!==-1)return!0;let r=this.wait_chunks,n=r.length!==0?r[r.length-1]:this.source,s=v.call(e,0);if(v.call(n,n.length-1)===V&&(s===U||s===Q||s===V))return!0;let i=de.call(e,`
84
+ `);for(;i!==-1&&i+1<t;){if(s=v.call(e,i+1),s===U||s===Q||s===V)return!0;i=de.call(e,`
85
+ `,i+1)}return!1}revoke_stale_pending(e){let t=this.cold,r=this.pending_count,n=t.np_floor;if(n>r)n=0;else if(n!==0){let i=0;for(let o=n;o<r;o++)this.kind_of(this.pending_ids[o])===7&&i++;this.pending_para_count-i!==n&&(n=0)}let s=-1;for(let i=n;i<this.pending_count;i++){let o=this.pending_ids[i],a=this.kind_of(o);if(a===7){this.pending_ids[n]=o,this.pending_starts[n]=this.pending_starts[i],this.id_slots[o]=n,n++;continue}if(e&&a===2||this.node_stack.indexOf(o)!==-1){s<0&&(s=n),this.pending_ids[n]=o,this.pending_starts[n]=this.pending_starts[i],this.id_slots[o]=n,n++;continue}a===2?(t.pending_html--,t.stale_html.push(o,this.pending_starts[i])):(this.out.revoke(o),a===30&&this.directive_text_pop(o))}this.pending_count=n,t.np_floor=s<0?n:s,t.stale_html.length!==0&&this.revoke_stale_html()}revoke_stale_html(){let e=this.cold.stale_html,t=e.length;for(let r=2;r<t;r+=2){let n=e[r],s=e[r+1],i=r;for(;i>0&&e[i-2]>n;)e[i]=e[i-2],e[i+1]=e[i-1],i-=2;e[i]=n,e[i+1]=s}for(let r=t-2;r>=0;r-=2){let n=e[r+1];this.out.revoke(e[r],this.html_open_tag_text(n),this.one_shot?n:void 0)}e.length=0}pending_floor(){let e=this.cold,t=this.pending_count,r=e.np_floor;for(r>t&&(r=0);;){let n=0,s=-1;for(let i=r;i<t;i++)this.kind_of(this.pending_ids[i])===7?n++:s<0&&(s=i);if(r!==0&&this.pending_para_count-n!==r){r=0;continue}return r=s<0?t:s,e.np_floor=r,r}}trim_before_indent(){let e=this.source,t=this.source_base,r=this.trim_point-1;for(;r>=t;){let n=v.call(e,r-t);if(n!==U&&n!==Q){this.trim_point=r+1;return}r--}r<0&&(this.trim_point=0)}trim_keeping_html(e){let t=this.source_base,r=this.trim_point-1,n=this.pending_floor();if(r===this.cold.kept_cut&&t===this.cold.kept_base){let l=0;for(let _=n;_<this.pending_count;_++)this.pending_starts[_]<r&&this.kind_of(this.pending_ids[_])===2&&l++;if(l===this.cold.kept_count)return e}let s="",i=[],o=[];for(let l=n;l<this.pending_count;l++){let _=this.pending_starts[l];if(_>=r||this.kind_of(this.pending_ids[l])!==2)continue;let c=de.call(e,`
86
+ `,this.html_open_tag_end(_)-t);i.push(s.length),o.push(l),s+=je.call(e,_-t,c+1)}let a=r-s.length;for(let l=0;l<o.length;l++)this.pending_starts[o[l]]=a+i[l];return this.source_base=a,this.cold.kept_cut=r,this.cold.kept_base=a,this.cold.kept_count=o.length,s+je.call(e,r-t)}join_held(e){let t=this.wait_chunks;t.unshift(e);let r=t.join("");return t.length=0,this.source=r,r}fence_close_may_start(e,t){for(let s=t-1;s>=0;s--){let i=v.call(e,s);if(i===V)return!0;if(i!==U&&i!==Q)return!1}let r=this.source,n=this.source_base;for(let s=this.fence_scan;s<this.source_end;s++){let i=v.call(r,s-n);if(i!==U&&i!==Q&&i!==be)return!1}return!0}skip_wait(e,t){let r=this.source_end,n=this.wait_kind;if(n===7)return!1;if(n>=af){let s=this.wait_chunks;return this.cursor===this.cold.wait_cursor&&(n===af?!this.brace_scan(e,r,r+t):n===Bv?!this.needle_in(e,t):!this.code_span_may_end(e,t))?(s===ir?this.wait_chunks=[e]:s.push(e),this.source_end=r+t,!0):!1}if(n===Uv){let s=de.call(e,"`");for(;s!==-1;){if(this.fence_close_may_start(e,s))return!1;let l=de.call(e,`
87
+ `,s);if(l===-1)break;s=de.call(e,"`",l+1)}let i=t-1,o=v.call(e,i);for(;i>0&&(o===U||o===Q||o===be);)o=v.call(e,--i);let a;if(o===V)a=r+i+1,this.source=je.call(e,i);else{if(i<=0)return!1;a=r+i,this.source=je.call(e,i-1)}this.fence_scan=a,this.trim_point=a,this.source_base=a-1}else{let s=this.cold.raw_needle.length;if(t<s||de.call(e,"<")!==-1||de.call(this.source,"<",this.cold.raw_scan-this.source_base)!==-1)return!1;let i=r+t-s+1;this.cold.raw_scan=i,this.trim_point=i,this.source=je.call(e,t-s),this.source_base=i-1}return this.source_end=r+t,!0}finish(){let e=this.wait_chunks;e.length!==0&&(e.unshift(this.source),this.source=e.join(""),e.length=0),this.pending_cr&&(this.source=Gv(this.source,`
88
+ `),this.source_end++,this.pending_cr=!1);let t=this.wait_kind;this.wait_kind=Zs,this.finished=!0,t===7&&this.table_cell_resume(),this.cold.guess!==null&&this.guess_feed(),this._run(),this._finalize();let r=this.out;return r.cursor(this.cursor),r.end!==void 0&&r.end(),{errors:this.errors}}bind(e,t=2){this.out=e,this.tab_size=t,e.follow!==void 0&&e.follow(this)}skip_ids(e,t){e===this.out&&t>this.next_id&&(this.next_id=t)}release(){this.source="",this.wait_chunks.length!==0&&(this.wait_chunks.length=0),this.ref_map.size!==0&&this.ref_map.clear(),this.ref_waiting=null,this.html_tag_stack.length!==0&&(this.html_tag_stack=[]),this.svelte_block_tag="",this.svelte_block_stack.length!==0&&(this.svelte_block_stack=ir),this.errors=u_}_init(e){this.source="",this.source_base=0,this.source_end=0,this.trim_point=0,this.fence_scan=0;let t=this.cold;t.bp_start=-1,t.brace_memo!==null&&(t.brace_memo=null),t.tag_memo!==null&&(t.tag_memo=null),t.tag_ends!==null&&(t.tag_ends=null),t.tick_at=-2,t.note_pos=-1,this.wait_chunks.length!==0&&(this.wait_chunks.length=0),t.raw_node=0,t.raw_needle="",t.raw_scan=0,t.task_pos=-1,this.wait_kind=Zs,this.cursor=0,this.finished=!1,this.pending_cr=!1;let r=this.states;for(;r.length>1;)r.pop();r.length===0?r.push(0):r[0]=0;let n=this.node_stack;for(;n.length>1;)n.pop();n.length===0?n.push(0):n[0]=0,this.next_id=1,this.pending_count=0,this.pending_para_count=0,this.cold.pending_html=0,this.cold.np_floor=0,this.cold.guess=null,this.take_ids(e),this.class_floor=0,this.range_next_class=0,this.block_quote_depth=0,this.frames.length!==0&&(this.frames=ir),this.line_at=-1,this.emphasis_has_content=!1,this.in_heading=!1,this.list_depth=0,this.list_marker=0,this.list_ordered=!1,this.list_start_num=0,this.list_node_id=0,this.list_is_loose=!1,this.list_content_offset=0,this.list_marker_indent=0,this.list_state_stack.length!==0&&(this.list_state_stack=ir),this.list_pending_paras.length!==0&&(this.list_pending_paras=ir),this.table_col_count=0,this.table_node_id=0,this.table_row_id=0,this.table_cell_id=0,this.table_cell_col=0,this.table_bound_l=-1,this.table_bound_r=-1,this.in_table=!1,this.inline_range_parse=!1,this.table_cell_has_content=!1,this.html_tag_stack.length!==0&&(this.html_tag_stack=[]),this.html_block_depth=0,this.spec_para=-1,this.spec_watch=-1,this.spec_link=-1,this.spec_image=-1,this.spec_block=-1,this.svelte_block_depth=0,this.svelte_block_tag="",this.svelte_branch_id=0,this.svelte_block_id=0,this.svelte_block_stack.length!==0&&(this.svelte_block_stack=ir),this.extra=0,this.info_start_pos=0,this.info_end_pos=0,this.checkpoint_cursor=0,this.code_span_open_pos=0,this.lead_mark=-1,this.mark_closed=-1,this.prev_cursor=0,this.prev_depth=0,this.loop_without_progress=0,this.frontmatter_failed=!1,this.imports_allowed=!0,this.ref_map.size!==0&&this.ref_map.clear(),this.ref_waiting=null,this.link_text_start=0,this.directive_colon_counts.length!==0&&(this.directive_colon_counts=ir),this.directive_text_ids.length!==0&&(this.directive_text_ids=[]),this.directive_text_brackets.length!==0&&(this.directive_text_brackets=[]),this.errors=u_,this.out.open(0,0,0,-1,0,!1)}emit_open(e,t,r,n=0,s){if(s===!0)return this.emit_open_pending(e,t,r,n);let i=this.next_id++;return i>=this.id_info.length&&this.grow_ids(i),r===this.spec_watch&&this.spec_child(e,t,-1),this.out.open(i,e,t,r,n,!1),this.id_info[i]=e,i}emit_leaf(e,t,r,n,s,i){let o=this.next_id++;o>=this.id_info.length&&this.grow_ids(o),r===this.spec_watch&&this.spec_child(e,t,-1);let a=this.out;a.leaf!==void 0?a.leaf(o,e,t,r,n,s,i):this.emit_leaf_ops(o,e,t,r,n,s,i),this.id_info[o]=e|Wo}emit_bare_leaf(e,t,r,n){let s=this.next_id++;s>=this.id_info.length&&this.grow_ids(s),r===this.spec_watch&&this.spec_child(e,t,-1);let i=this.out;i.leaf!==void 0?i.leaf(s,e,t,r,0,0,n):this.emit_bare_ops(s,e,t,r,n),this.id_info[s]=e|Wo}emit_bare_ops(e,t,r,n,s){let i=this.out;i.open(e,t,r,n,0,!1),i.close(e,s,t)}emit_leaf_ops(e,t,r,n,s,i,o){let a=this.out;a.open(e,t,r,n,0,!1),a.set_value_start(e,s),a.set_value_end(e,i),a.close(e,o,t)}emit_open_pending(e,t,r,n=0){let s=this.next_id++;s>=this.id_info.length&&this.grow_ids(s),r===this.spec_watch&&this.spec_child(e,t,s),t===this.lead_mark?(this.lead_mark=-1,this.out.open(s,e,t-1,r,n,!0)):this.out.open(s,e,t,r,n,!0);let i=this.pending_count;return this.pending_starts[i]=t,this.pending_ids[i]=s,this.pending_count=i+1,e===7?this.pending_para_count++:e===2&&this.cold.pending_html++,this.id_slots[s]=i,this.id_info[s]=e,s}emit_close(e,t){let r=this.id_info[e];this.out.close(e,t,r&_f),this.id_info[e]=r|Wo,e===this.spec_para&&this.end_spec_para(t)}emit_close_pending(e,t){let r=this.id_info[e],n=r&_f,s=this.out;s.close_pending!==void 0?s.close_pending(e,t,n):s.close(e,t,n),this.id_info[e]=r|Wo}take_ids(e){let t=m_;if(t!==null&&t.length>=e)m_=null,this.id_info=t,this.id_slots=uf,uf=Ji;else{let r=p_;for(;r<e;)r<<=1;this.id_info=new Int32Array(r),this.id_slots=new Int32Array(r)}this.id_info[0]=0,this.finalized_below=0}grow_ids(e){let t=this.id_info,r=t.length>0?t.length<<1:p_;for(;r<=e;)r<<=1;let n=new Int32Array(r);n.set(t);let s=t.undefined;s!==void 0&&t.length>0&&(n.undefined=s),this.id_info=n;let i=new Int32Array(r);i.set(this.id_slots),this.id_slots=i}give_back_ids(){let e=this.id_info,t=this.id_slots;if(this.id_info=Ji,this.id_slots=Ji,this.finalized_below=this.next_id,e.length===0||e.length>ww||e.undefined!==void 0)return;let r=m_;(r===null||r.length<e.length)&&(m_=e,uf=t)}kind_of(e){return this.id_info[e]&_f}is_closed(e){return(this.id_info[e]&Wo)!==0}pending_remove(e){if(!this.pending_has(e))return;(e===this.spec_link||e===this.spec_image)&&this.spec_media_end(e,!1);let t=this.pending_ids,r=this.id_slots,n=r[e],s=this.pending_count-1,i=t[s];t[n]=i,this.pending_starts[n]=this.pending_starts[s],r[i]=n,this.pending_count=s;let o=this.kind_of(e);o===7?this.pending_para_count--:o===2&&this.cold.pending_html--}open_inner_strong(e){let t=this.cursor+2;if(t>=this.source_end||Cn(v.call(this.source,t-this.source_base))!==4)return!1;this.states.push(8);let r=this.emit_open_pending(10,t-1,e);return this.out.set_value_start(r,t),this.node_stack.push(r),this.states.push(14),this.emphasis_has_content=!0,this.states.push(8),this.open_text_run(t,r),!0}open_inner_doubled(e,t,r){if(this.next_class()&1)return!1;this.states.push(8);let n=this.emit_open_pending(t,this.cursor,e);return this.out.set_value_start(n,this.cursor+1),this.node_stack.push(n),this.states.push(r),this.cursor++,!0}close_strong(e){let t=this.states,r=this.node_stack;for(;;){this.out.set_value_end(e,this.cursor),this.emit_close(e,this.cursor+1),this.pending_remove(e),t.pop(),r.pop();let n=++this.cursor;if(this.mark_closed=n,t[t.length-1]===8&&t.pop(),t[t.length-1]!==14||!this.emphasis_has_content||n+1>=this.source_end)return;let s=this.source_base;if(v.call(this.source,n-s)!==gt||(Cn(v.call(this.source,n+1-s))&3)===0)return;e=r[r.length-1]}}line_code_span(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.cursor+1;s<n&&v.call(t,s-r)===be&&s++;let i=s-this.cursor;if(s>=n)return!1;let o=v.call(t,s-r),a=this.in_table?Ye:V;if(o===be||o===U||o===pn||o===V||o===a)return!1;let l=s+1;for(;l<n;){let h=v.call(t,l-r);if(h===be||h===V||h===a)break;l++}if(l>=n||v.call(t,l-r)!==be)return!1;let _=l+1;for(;_<n&&v.call(t,_-r)===be;)_++;if(_-l!==i||_>=n)return!1;this.emit_leaf(8,this.cursor,e,s,l,_),this.extra=i,this.code_span_open_pos=this.cursor;let c=v.call(t,_-r);return c!==0&&(c>=128||Qe[c]===0)&&(c>U||a===V&&!this.in_heading)?this.open_text_run(_,e):this.cursor=_,!0}span_pad(){let e=this.source,t=this.source_base;for(let r=this.checkpoint_cursor;r<this.cursor;r++)if(v.call(e,r-t)!==U)return 1;return 0}span_start(e,t){this.span_vs=t,this.out.set_value_start(e,t)}span_padded_end(e){let t=this.source,r=this.source_base,n=this.span_vs,s=this.cursor;if(v.call(t,n-r)!==U)return s;let i=v.call(t,s-1-r)===U;if(i&&this.block_quote_depth>0){let o=Ki.call(t,`
89
+ `,s-1-r);this.line_start(o+1+r),i=this.line_quote<s}return this.span_start(e,i?n+1:n),i?s-1:s}span_close(e,t,r){this.in_table?this.cell_span_text(e,t):this.line_span_text(e,t),this.out.set_value_end(e,t),this.emit_close(e,r)}line_span_text(e,t){let r=this.source,n=this.source_base,s=t-n,i=this.span_vs-n,o=de.call(r,`
90
+ `,i);if(o===-1||o>=s)return;let a=this.block_quote_depth>0,l="",_=!1;for(;o!==-1&&o<s;){for(l+=je.call(r,i,o+1),i=o+1,a&&(this.line_start(i+n),this.line_quote-n<=s&&(i=this.line_quote-n));i<s&&v.call(r,i)===U;)i++;i!==o+1&&(_=!0),o=de.call(r,`
91
+ `,i)}_&&this.out.attr(e,"text",l+je.call(r,i,s))}cell_span_text(e,t){let r=this.source_base,n=this.span_vs-r,s=t-r,i=de.call(this.source,"\\|",n);i===-1||i>=s-1||this.out.attr(e,"text",je.call(this.source,n,s).replace(xw,"|"))}pipe_escaped(e){let t=this.source,r=this.source_base,n=this.code_span_open_pos+this.extra,s=e;for(;s>n&&v.call(t,s-1-r)===bt;)s--;return(e-s&1)===1}pipe_marker(e){if(e===this.mark_closed)return 1;let t=this.mark_opens(e+1);return t===1&&(this.lead_mark=e+1),t}mark_opens(e){let t=this.source,r=this.source_base,n=this.source_end,s=e<n?v.call(t,e-r):0,i=s===Ar;if(!i&&s!==gt&&s!==qr)return e<n||this.finished?0:-1;let o=v.call(t,e+1-r),a=i&&o===Ar;if(!this.finished&&e+(a?2:1)>=n)return-1;let l=Cn(e+1<n?o:NaN),_=this.states[this.states.length-2],c=3,h=6;if(!i)return!(_===(s===gt?14:15)&&(l&c)!==0)&&(l&h)!==0?1:0;if(!a)return _!==21&&(l&h)!==0?1:0;let d=e+2<n?v.call(t,e+2-r):NaN;return _===19&&(Cn(d)&c)!==0?0:d===d&&(Cn(d)&h)!==0?1:0}code_span_in_cell(e){if(e===Ye&&this.pipe_escaped(this.cursor)){this.cursor++;return}let t=this.code_span_open_pos,r=t+this.extra;this.chomp(r,!0),this.out.revoke(this.node_stack[this.node_stack.length-1],je.call(this.source,t-this.source_base,r-this.source_base),this.one_shot?t:void 0),this.node_stack.pop(),this.states.pop()}code_span_hint_revert(e){this.chomp(this.info_start_pos-2,!0),this.states.pop(),this.states.push(13);let t=this.emit_open(8,this.cursor-this.extra,e);this.node_stack.push(t),this.span_start(t,this.cursor)}math_scan(e){let t=this.source,r=this.source_base,n=this.source_end,s=e+1;if(s>=n)return this.finished?0:-1;if(v.call(t,s-r)!==be)return 0;let i=1;if(v.call(t,s+1-r)===be){if(v.call(t,s+2-r)===be)return 0;i=2}let o=s+i,a=this.in_table;for(s=o;;){if(s>=n)return this.finished?0:-1;let h=v.call(t,s-r);if(h===V)return 0;if(h===be){let d=1;for(;v.call(t,s+d-r)===be;)d++;if(s+d>=n&&!this.finished)return-1;if(d===i)break;s+=d;continue}if(h===Ye&&a){let d=s;for(;d>o&&v.call(t,d-1-r)===bt;)d--;if((s-d&1)===0)return 0}s++}let l=s+i;if(l>=n)return this.finished?0:-1;if(v.call(t,l-r)!==k_)return 0;let _=o,c=s;if(c-_>2&&v.call(t,_-r)===U&&v.call(t,c-1-r)===U){for(let h=_+1;h<c-1;h++)if(v.call(t,h-r)!==U){_++,c--;break}}return Jv=_,df=c,pf=l+1,1}math_emit(e){let t=this.emit_open(8,this.cursor,e,1);this.span_start(t,Jv),this.in_table&&this.cell_span_text(t,df),this.out.set_value_end(t,df),this.emit_close(t,pf),Tv(),this.chomp(pf,!0)}text_run(e){let t=this.source,r=this.source_base,n=this.source_end,s=n-3,i=e-r;for(;e<s;){let o=v.call(t,i);if(o<128&&Qe[o]!==0)return e;if(o=v.call(t,i+1),o<128&&Qe[o]!==0)return e+1;if(o=v.call(t,i+2),o<128&&Qe[o]!==0)return e+2;if(o=v.call(t,i+3),o<128&&Qe[o]!==0)return e+3;e+=4,i+=4}for(;e<n;){let o=v.call(t,e-r);if(o<128&&Qe[o]!==0)break;e++}return e}open_text_run(e,t){let r=this.source,n=this.source_base,s=this.text_run(e+1);if(this.cursor=s,Xo&&s<this.source_end){let o=v.call(r,s-n);if(o<128&&rb[o]===1){this.emit_leaf(1,e,t,e,s,s),this.states.pop();return}}let i=this.emit_open(1,e,t);this.out.set_value_start(i,e),this.node_stack.push(i),this.states.push(1)}pending_has(e){let t=this.id_slots[e];return t<this.pending_count&&this.pending_ids[t]===e}can_trim(e){if(this.pending_count!==this.pending_para_count)return!1;let t=this.node_stack;for(let r=1;r<e;r++){let n=this.kind_of(t[r]);if(n!==14&&n!==15&&n!==16)return!1}return!0}is_directive_name_char(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===qr||e===Gr}directive_text_pop(e){let t=this.directive_text_ids;for(let r=t.length-1;r>=0;r--)if(t[r]===e){r===t.length-1?(t.pop(),this.directive_text_brackets.pop()):(t.splice(r,1),this.directive_text_brackets.splice(r,1));return}}try_parse_directive_args(e){let t=this.source,r=this.source_base,n=this.source_end,s=e+1,i=null;for(;s<n&&(v.call(t,s-r)===U||v.call(t,s-r)===Q);)s++;if(s>=n)return this.finished?null:!1;if(v.call(t,s-r)===Tn)return{args:null,end:s+1};for(;;){let o=v.call(t,s-r);if(!(o>=97&&o<=122||o>=65&&o<=90||o===qr))return null;let a=s;for(;s<n&&this.is_directive_name_char(v.call(t,s-r));)s++;if(s>=n)return this.finished?null:!1;let l=je.call(t,a-r,s-r);for(;s<n&&(v.call(t,s-r)===U||v.call(t,s-r)===Q);)s++;if(s>=n)return this.finished?null:!1;if(v.call(t,s-r)!==Zo)return null;for(s++;s<n&&(v.call(t,s-r)===U||v.call(t,s-r)===Q);)s++;if(s>=n)return this.finished?null:!1;let _,c=v.call(t,s-r);if(c===Tr||c===Un){s++;let d=s;for(;s<n;){let f=v.call(t,s-r);if(f===bt&&s+1<n){s+=2;continue}if(f===c||f===V)break;s++}if(s>=n)return this.finished?null:!1;if(v.call(t,s-r)!==c)return null;_=je.call(t,d-r,s-r),s++}else{let d=s;for(;s<n;){let f=v.call(t,s-r);if(f===U||f===Q||f===V||f===Dv||f===mn||f===Tn||f===Tr||f===Un||f===bt)break;s++}if(s>=n&&!this.finished)return!1;if(s===d)return null;_=je.call(t,d-r,s-r)}if(i===null)i={};else if(Object.prototype.hasOwnProperty.call(i,l))return null;for(i[l]=_;s<n&&(v.call(t,s-r)===U||v.call(t,s-r)===Q);)s++;if(s>=n)return this.finished?null:!1;let h=v.call(t,s-r);if(h===Tn)return{args:i,end:s+1};if(h!==Dv)return null;for(s++;s<n&&(v.call(t,s-r)===U||v.call(t,s-r)===Q);)s++;if(s>=n)return this.finished?null:!1;if(v.call(t,s-r)===Tn)return null}}try_parse_import(e){let t=this.source,r=this.source_base,n=this.source_end;if(e+6>=n&&!this.finished)return!1;if(v.call(t,e+1-r)!==109||v.call(t,e+2-r)!==112||v.call(t,e+3-r)!==111||v.call(t,e+4-r)!==114||v.call(t,e+5-r)!==116)return null;let s=v.call(t,e+6-r);if(s!==U&&s!==Ot)return null;let i=e+6,o=0;for(;i<n;){let c=v.call(t,i-r);if(c===V){if(o===0)break;for(i++;i<n&&(v.call(t,i-r)===U||v.call(t,i-r)===Q);)i++;if(i>=n)return this.finished?null:!1;if(v.call(t,i-r)===V)return null;continue}if(c===Ot)o++;else if(c===vn)o>0&&o--;else if(c===Tr||c===Un){for(i++;i<n;){let h=v.call(t,i-r);if(h===c){i++;break}if(h===V)break;h===bt&&v.call(t,i+1-r)!==V&&i++,i++}continue}else if(c===kt){let h=v.call(t,i+1-r);if(h===kt||h===gt){for(i+=2;i<n;){let d=v.call(t,i-r);if(d===V)break;if(i++,h===gt&&d===gt&&v.call(t,i-r)===kt){i++;break}}continue}}i++}if(i>=n){if(!this.finished)return!1;if(o>0)return null}let a=e,l=i,_=i<n?i+1:i;return{value_start:a,value_end:l,end:_}}try_parse_block_directive(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.cold;s.label_start=-1;let i=e,o=0;for(;i<n&&v.call(t,i-r)===Jt;)o++,i++;if(i>=n&&!this.finished)return!1;if(o<2||i>=n)return null;let a=v.call(t,i-r);if(!(a>=97&&a<=122||a>=65&&a<=90))return null;let l=i;for(;i<n&&this.is_directive_name_char(v.call(t,i-r));)i++;if(i>=n&&!this.finished)return!1;let _=je.call(t,l-r,i-r),c=o>=3?"container":"leaf",h=-1,d=-1;if(i<n&&v.call(t,i-r)===Pr){i++,h=i;let p=1;for(;i<n&&p>0;){let m=v.call(t,i-r);if(m===Pr)p++;else if(m===as)p--;else if(m===bt&&i+1<n)i++;else if(m===be){let g=this.label_code_span_end(i);if(g===-2)return s.label_start=h,s.label_to=i,s.label_end=-1,s.label_colons=o,s.label_name=_,!1;i=g;continue}else if(m===V)break;p>0&&i++}if(p!==0)return i>=n&&!this.finished?(s.label_start=h,s.label_to=i,s.label_end=-1,s.label_colons=o,s.label_name=_,!1):null;if(d=i,this.frames.length!==0&&this.label_leaves_quote(h,d))return null;if(s.label_start=h,s.label_to=i,s.label_end=i,s.label_colons=o,s.label_name=_,i++,i>=n&&!this.finished)return!1}let f=null;if(i<n&&v.call(t,i-r)===mn){let p=this.try_parse_directive_args(i);if(p===!1)return!1;if(p===null)return null;f=p.args,i=p.end}for(;i<n&&(v.call(t,i-r)===U||v.call(t,i-r)===Q);)i++;if(i>=n&&!this.finished)return!1;if(i<n&&v.call(t,i-r)!==V)return null;if(i<n){if(c==="container"&&this.frames.length!==0&&!this.finished&&!this.can_decide_after_lf(i))return!1;i++}return{kind:c,colons:o,name:_,content_start:h,content_end:d,args:f,end:i}}label_code_span_end(e){let t=this.source,r=this.source_base,n=this.source_end,s=e+1;for(;s<n&&v.call(t,s-r)===be;)s++;let i=s-e,o=s;for(;s<n;){let a=v.call(t,s-r);if(a===V)return o;if(a===be){let l=s;for(s++;s<n&&v.call(t,s-r)===be;)s++;if(s-l===i)return s;continue}s++}return this.finished?o:-2}start_block_directive(e,t,r=-1){let n=r!==-1?r:this.emit_open(e.kind==="leaf"?31:32,this.cursor,t);if(e.args&&this.out.attr(n,"args",e.args),this.out.attr(n,"name",e.name),e.content_start>=0&&(this.out.set_value_start(n,e.content_start),this.out.set_value_end(n,e.content_end)),r===-1&&e.content_end>e.content_start&&this.directive_label(n,e.content_start,e.content_end),e.kind==="leaf"){if((this.block_quote_depth>0||this.list_depth>0)&&v.call(this.source,e.end-1-this.source_base)===V){this.emit_close(n,e.end-1),this.chomp(e.end-1,!0);return}this.emit_close(n,e.end)}else{this.node_stack.push(n),this.states.push(28);let s=this.directive_colon_counts;if(s===ir?this.directive_colon_counts=[e.colons]:s.push(e.colons),this.frames.length!==0&&v.call(this.source,e.end-1-this.source_base)===V){this.chomp(this.next_line(e.end),!0);return}}this.chomp(e.end,!0)}directive_label(e,t,r){let n=this.emit_open(35,t-1,e);this.out.set_value_start(n,t);let s=this.source,i=this.source_base,o=t;for(;o<r;){let a=v.call(s,o-i);if(a===0||a<128&&Qe[a]!==0)break;o++}if(o===r){this.emit_leaf(1,t,n,t,r,r),this.out.set_value_end(n,r),this.emit_close(n,r+1);return}this.node_stack.push(n),this.directive_text_ids.push(n),this.directive_text_brackets.push(0),this.parse_inline_range(t,r,28),this.directive_text_pop(n),this.node_stack.pop(),this.out.set_value_end(n,r),this.emit_close(n,r+1),this.pending_count>this.pending_para_count&&this.revoke_stale_pending(!1)}guess_label(e){let t=this.cold,r=t.label_start;if(t.guess!==null||t.label_to<=r||this.inline_range_parse||this.out.guesses!==!0)return;let n=this.emit_open(t.label_colons>=3?32:31,this.cursor,e);this.out.attr(n,"name",t.label_name);let s=this.emit_open(35,r-1,n);this.out.set_value_start(s,r),t.guess={dir:n,label:s,parent:e,start:r,pos:r,states:this.states.length,nodes:this.node_stack.length,texts:this.directive_text_ids.length,tags:this.html_tag_stack,tag_count:this.html_tag_stack.length},this.node_stack.push(s),this.directive_text_ids.push(s),this.directive_text_brackets.push(0),this.states.push(28),this.states.push(8),this.html_tag_stack.length!==0&&(this.html_tag_stack=[]),this.guess_run(t.label_to,!1)}guess_run(e,t){let r=this.cold.guess,n=this.cursor,s=this.class_floor,i=this.finished,o=this.source,a=this.source_end,l=r.start;this.cursor=r.pos,this.finished=t,this.class_floor=l,this.range_next_class=Cn(l+1<a?v.call(o,l+1-this.source_base):NaN),this.source=je.call(o,0,e-this.source_base),this.source_end=e,this.inline_range_parse=!0,this._run(),this.source=o,this.source_end=a,this.inline_range_parse=!1,this.wait_kind=Zs,r.pos=this.cursor,this.cursor=n,this.finished=i,this.class_floor=s,this.interrupt_pos=-1,this.interrupt_marker_pos=-1}guess_feed(){let e=this.cold,t=e.guess,r=this.try_parse_block_directive(this.cursor);if(r===null){this.guess_back();return}if(t.label!==-1){let n=e.label_end;if(n===-1)this.guess_run(e.label_to,!1);else{let s=t.label;this.guess_run(n,!0),this.unwind_range(t.states,n),this.html_tag_stack=t.tags,this.directive_text_pop(s),this.node_stack.pop(),this.out.set_value_end(s,n),this.emit_close(s,n+1),t.label=-1,this.pending_count>this.pending_para_count&&this.revoke_stale_pending(!1)}}r!==!1&&(e.guess=null,this.start_block_directive(r,t.parent,t.dir))}guess_back(){let e=this.cold.guess;this.cold.guess=null,e.label!==-1&&(this.states.length=e.states,this.node_stack.length=e.nodes,this.directive_text_ids.length=e.texts,this.directive_text_brackets.length=e.texts,this.html_tag_stack=e.tags),e.tags.length=e.tag_count;let t=e.dir;for(let r=this.pending_count-1;r>=0;r--){let n=this.pending_ids[r];n>t&&this.pending_remove(n)}this.out.revoke(t)}next_line(e){return this.line_start(e)<this.frames.length?e-1:this.line_pos}container_lf(e){let t=this.line_start(this.cursor+1);return t<0?-1:t<this.frames.length?0:(this.emit_bare_leaf(6,this.cursor,e,this.cursor+1),this.chomp(this.line_pos,!0),1)}try_parse_directive_close(e,t){let r=this.source,n=this.source_base,s=this.source_end,i=e,o=0;for(;i<s&&v.call(r,i-n)===Jt;)o++,i++;if(i>=s&&!this.finished)return-2;if(o<t)return-1;for(;i<s&&(v.call(r,i-n)===U||v.call(r,i-n)===Q);)i++;return i>=s&&!this.finished?-2:i<s&&v.call(r,i-n)!==V?-1:(i<s&&i++,i)}chomp(e,t=!1){t?(this.cursor=e,this.class_floor=-1):this.cursor+=e}prev_class(){let e=this.cursor;if(e===this.class_floor)return 1;let t=e-1-this.source_base;return Cn(t>>>0<this.source_end-this.source_base?v.call(this.source,t):NaN)}after_tildes_class(){let e=v.call(this.source,this.cursor+2-this.source_base);return e!==e||e===Ye&&this.in_table?1:Cn(e)}next_class(){let e=this.cursor;if(e===this.class_floor&&this.inline_range_parse)return this.range_next_class;let t=e+1-this.source_base;return Cn(t>>>0<this.source_end-this.source_base?v.call(this.source,t):NaN)}count_indent(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.tab_size,i=0;for(;e<n;){let o=v.call(t,e-r);if(o===U)i++,e++;else if(o===Q)i+=s,e++;else break}return{columns:i,end:e}}lead_columns(e){if(e===this.cold.note_pos)return this.cold.note_column;let t=this.source,r=this.source_base,n=e,s=0;for(;n>r;){let o=v.call(t,n-1-r);if(o===U)s++;else if(o===Q)s+=this.tab_size;else break;n--}if(s===0||n===0)return s;if(this.list_depth>0&&e===this.cold.task_pos){let o=v.call(t,n-r)===Q?this.tab_size:1;return this.list_content_offset+s-o}let i=v.call(t,n-1-r);return i===V?s:i===er&&this.block_quote_depth>0?v.call(t,n-r)===U?s-1:s:0}can_decide_after_lf(e){let t=this.source,r=this.source_base,n=this.source_end,s=e+1,i=this.block_quote_depth;if(i>0){let a=this.line_start(s);if(a<0)return!1;if(a<this.frames.length&&this.quote_ends(a))return!0;s=this.line_quote}for(;s<n;){let a=v.call(t,s-r);if(a!==U&&a!==Q)break;s++}if(s>=n)return this.finished;let o=v.call(t,s-r);if(o===V)return!0;switch(o){case pn:{let a=s+1;for(;a<n&&v.call(t,a-r)===pn;)a++;if(a<n||a-s>6)return!0;break}case er:return!0;case be:if(s+1<n&&(v.call(t,s+1-r)!==be||s+2<n))return!0;break;case Gr:case gt:case qr:for(let a=s+1;a<n;a++){let l=v.call(t,a-r);if(l===V||l!==o&&l!==U&&l!==Q)return!0}return!1;case bl:if(!this.plus_marker_pending(s))return!0;break;case Jt:if(s+1<n)return!0;break;case Pr:if(s+1<n&&v.call(t,s+1-r)!==On)return!0;break;case Ot:if(s+1<n){let a=v.call(t,s+1-r);if(a===pn){if(s+2<n)return!0}else if(this.svelte_block_depth===0||a!==Jt&&a!==kt)return!0}break;case gn:{let a=s+1;if(a<n&&v.call(t,a-r)===kt&&a++,a>=n)break;if(!this.is_tag_name_start(v.call(t,a-r)))return!0;for(;a<n&&this.is_tag_name_char(v.call(t,a-r));)a++;if(a<n)return!0;break}case Ye:break;default:if(o>=48&&o<=57){if(!this.plus_marker_pending(s))return!0;break}return!0}return s+1<n&&de.call(t,`
92
+ `,s+1-r)!==-1?!0:(i>0&&n-e>128&&this.wait_for(`
93
+ `),!1)}is_heading_start(e){let t=this.source,r=this.source_base,n=this.source_end;for(;e<n&&(v.call(t,e-r)===U||v.call(t,e-r)===Q);)e++;if(e>=n||v.call(t,e-r)!==pn)return!1;let s=0;for(;e<n&&v.call(t,e-r)===pn;)s++,e++;if(s>6)return!1;let i=v.call(t,e-r);return e>=n||i===U||i===Q||i===V}is_blank_line_after(e){let t=this.source,r=this.source_base,n=this.source_end,s=e+1;for(;s<n&&v.call(t,s-r)!==V;){let i=v.call(t,s-r);if(i!==U&&i!==Q)return!1;s++}return!(s>=n&&!this.finished)}could_be_thematic_break(e,t){if(this.finished)return!1;let r=this.source,n=this.source_base,s=this.source_end;for(let i=e+1;i<s;i++){let o=v.call(r,i-n);if(o!==t&&o!==U&&o!==Q)return!1}return!0}is_thematic_break_start(e){let t=this.source,r=this.source_base,n=this.source_end,s=0,i=0;for(;e<n&&(i=v.call(t,e-r),i===U);)s++,e++;if(s>3||e>=n||i!==gt&&i!==Gr&&i!==qr)return!1;let o=1;for(e++;e<n;){let a=v.call(t,e-r);if(a===V)break;if(a===i)o++;else if(a!==U&&a!==Q)return!1;e++}return e>=n&&!this.finished?!1:o>=3}is_ascii_punctuation(e){return e>=33&&e<=47||e>=58&&e<=64||e>=91&&e<=96||e>=123&&e<=126}skip_spaces(e){let t=this.source,r=this.source_base,n=this.source_end;for(;e<n&&v.call(t,e-r)===U;)e++;return e}push_frame(e){let t=this.frames;t===ir?this.frames=[e]:t.push(e),this.line_at=-1}pop_frame(){this.frames.pop(),this.line_at=-1}line_start(e){if(e===this.line_at)return this.line_kept;let t=this.source,r=this.source_base,n=this.source_end,s=n-r,i=this.frames,o=i.length,a=e,l=e,_=0;for(;_<o;_++){let c=i[_],h=c===0?l:a,d=os(t,h-r,s);if(c===0){for(;d===U||d===Q;)d=os(t,++h-r,s);if(h>=n){if(!this.finished)return-1;break}if(d!==er)break;if(++h>=n){if(!this.finished)return-1}else os(t,h-r,s)===U&&h++;a=l=h;continue}let f=0;for(;f<c;){if(d===U)f++;else if(d===Q)f+=this.tab_size;else break;d=os(t,++h-r,s)}if(f>=c){l=h;continue}for(;d===U||d===Q;)d=os(t,++h-r,s);if(h>=n){if(!this.finished)return-1}else if(d!==V)break}return this.line_pos=l,this.line_quote=a,this.line_at=e,this.line_kept=_,_}framed_value(e,t){let r=this.source,n=this.source_base,s=this.frames.length,i=de.call(r,`
94
+ `,e-n);if(i===-1||i+n>=t)return 0;for(;i!==-1&&i+n<t;){if(this.line_start(i+n+1)<s||this.line_pos>t)return-1;i=de.call(r,`
95
+ `,this.line_pos-n)}return 1}framed_text(e,t){let r=this.source,n=this.source_base,s=this.frames.length,i="",o=e;for(;;){let a=de.call(r,`
96
+ `,o-n);if(a===-1||a+n>=t)break;if(i+=je.call(r,o-n,a+1),this.line_start(a+n+1)<s||(o=this.line_pos,o>t))return null}return i+je.call(r,o-n,t-n)}label_leaves_quote(e,t){let r=this.source,n=this.source_base,s=this.frames.length,i=de.call(r,`
97
+ `,e-n);for(;i!==-1&&i+n<t;){let o=this.line_start(i+n+1);if(o<s&&this.quote_ends(o)||this.line_pos>t)return!0;i=de.call(r,`
98
+ `,i+1)}return!1}quote_ends(e){let t=this.frames;for(let r=e;r<t.length;r++)if(t[r]===0)return!0;return!1}is_blank_at_pos(e){let t=this.source,r=this.source_base,n=this.source_end;for(;e<n&&v.call(t,e-r)!==V;){let s=v.call(t,e-r);if(s!==U&&s!==Q)return!1;e++}return!(e>=n&&!this.finished)}line_interrupts(e){let t=this.source,r=this.source_base,n=this.source_end,s=e,i=0;for(;s<n&&(i=v.call(t,s-r),!(i!==U&&i!==Q));)s++;return s>=n?this.finished:i===V?!0:i>=128||($l[i]&2)===0?!1:this.block_start(i,0,e,s)===1}tag_interrupts(e){let t=this.source,r=this.source_base,n=this.source_end,s=e+1,i=s<n&&v.call(t,s-r)===kt;if(i&&s++,s>=n||!this.is_tag_name_start(v.call(t,s-r)))return!1;let o=s;for(;s<n&&this.is_tag_name_char(v.call(t,s-r));)s++;let a=je.call(t,o-r,s-r);return this.is_block_html_tag(a)?!0:i&&this.closes_container(a)}marker_line_has_content(e){let t=this.source,r=this.source_base,n=this.source_end,s=e;for(;s<n;){let i=v.call(t,s-r);if(i===V)return!1;if(i!==U&&i!==Q)return!0;s++}return!this.finished}plus_marker_pending(e){let t=this.source,r=this.source_base,n=this.source_end,s=e+1;if(v.call(t,e-r)!==bl){for(;s<n&&v.call(t,s-r)>=48&&v.call(t,s-r)<=57;)s++;if(s>=n)return!0;let o=v.call(t,s-r);if(o!==__&&o!==Tn)return!1;s++}if(s>=n)return!0;let i=v.call(t,s-r);if(i!==U&&i!==Q)return!1;do s++;while(s<n&&((i=v.call(t,s-r))===U||i===Q));return s>=n}marker_at(e,t,r,n,s,i){let o=this.marker;return o===null?o=this.marker={indent:e,marker_char:t,ordered:r,start_num:n,content_start:s,content_offset:i}:(o.indent=e,o.marker_char=t,o.ordered=r,o.start_num=n,o.content_start=s,o.content_offset=i),this.interrupt_marker_pos=-1,o}try_parse_list_marker(e){let t=this.source,r=this.source_base,n=this.source_end;if(e>=n)return null;let s=this.count_indent(e),i=this.lead_columns(e)+s.columns;if(e=s.end,e>=n)return null;let o=v.call(t,e-r);if(o===Gr||o===gt||o===bl){if(e+1>=n&&!this.finished)return null;let a=v.call(t,e+1-r);if(e+1>=n||a===U||a===Q||a===V){let l=e+1,_=i+1;return l<n&&(a===U||a===Q)&&(_+=a===Q?this.tab_size:1,l++),this.marker_line_has_content(l)?this.marker_at(i,o,!1,0,l,_):null}return null}if(o>=48&&o<=57){let a=e;for(;e<n&&v.call(t,e-r)>=48&&v.call(t,e-r)<=57;)e++;if(e-a>9||e>=n)return null;let l=v.call(t,e-r);if(l!==__&&l!==Tn||e+1>=n&&!this.finished)return null;let _=v.call(t,e+1-r);if(e+1>=n||_===U||_===Q||_===V){let c=e+1,h=i+(e-a)+1;if(c<n&&(_===U||_===Q)&&(h+=_===Q?this.tab_size:1,c++),!this.marker_line_has_content(c))return null;let d=parseInt(je.call(t,a-r,e-r),10);return this.marker_at(i,l,!0,d,c,h)}return null}return null}task_marker_end(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.finished?-1:-2,i=e+1;if(i>=n)return s;let o=v.call(t,i-r);if(o!==U&&o!==120&&o!==88)return-1;if(++i>=n)return s;if(v.call(t,i-r)!==as)return-1;if(++i>=n)return s;if(o=v.call(t,i-r),o!==U&&o!==Q)return-1;do{if(++i>=n)return s;o=v.call(t,i-r)}while(o===U||o===Q);return o===V?-1:i}is_list_item_start_interrupt(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.try_parse_list_marker(e);if(!s)return!1;if(this.interrupt_marker_pos=e,this.interrupt_marker=s,this.list_depth>0)return!0;if(s.ordered&&s.start_num!==1)return!1;let i=s.content_start;for(;i<n&&v.call(t,i-r)!==V;){if(v.call(t,i-r)!==U&&v.call(t,i-r)!==Q)return!0;i++}return!1}start_list(e,t){if(this.list_depth>0){let s=this.list_state_stack;s===ir&&(s=this.list_state_stack=[]),s.push({marker:this.list_marker,ordered:this.list_ordered,start_num:this.list_start_num,node_idx:this.list_node_id,is_loose:this.list_is_loose,content_offset:this.list_content_offset,marker_indent:this.list_marker_indent,pending_paras:this.list_pending_paras})}this.list_depth++,this.list_ordered=e.ordered,this.list_marker=e.marker_char,this.list_start_num=e.start_num,this.list_is_loose=!1,this.list_content_offset=e.content_offset,this.list_marker_indent=e.indent,this.push_frame(e.content_offset),this.list_pending_paras=ir;let r=this.emit_open(15,this.cursor,t);this.node_stack.push(r),this.list_node_id=r,this.out.attr(r,"ordered",e.ordered),this.out.attr(r,"start",e.start_num);let n=this.emit_open(16,this.cursor,r);this.node_stack.push(n),this.states.push(18),this.chomp(e.content_start,!0),this.cold.task_pos=e.content_start,this.item_para(n)}item_para(e){let t=v.call(this.source,this.cursor-this.source_base);if(!(t>=128||(t|32)>=97&&(t|32)<=122)){t===gt&&this.finished&&this.item_strong(e);return}if(!this.finished){if(this.pending_count!==this.pending_para_count)return;this.can_trim(this.node_stack.length)&&(this.trim_point=this.cursor)}this.states.push(7);let r=this.emit_open_pending(7,this.cursor,e);this.track_list_pending_para(r),this.node_stack.push(r),this.para_text(r)}item_strong(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.cursor+1;if(s+1>=n)return;let i=v.call(t,s-r),o=i===gt;if(o){if(s+2>=n)return;i=v.call(t,s+1-r)}if(Cn(i)!==4||!(this.prev_class()&3))return;this.states.push(7);let a=this.emit_open_pending(7,this.cursor,e);this.track_list_pending_para(a),this.node_stack.push(a),this.states.push(8);let l=this.emit_open_pending(10,this.cursor,a);if(this.out.set_value_start(l,s),this.node_stack.push(l),this.states.push(14),o){this.open_inner_strong(l);return}this.emphasis_has_content=!0,this.states.push(8),this.open_text_run(s,l)}track_list_pending_para(e){let t=this.list_pending_paras;t===ir?this.list_pending_paras=[e]:t.push(e)}commit_list_pending_paras(){let e=this.list_pending_paras;for(let t=0;t<e.length;t++){let r=e[t];this.out.commit(r),this.pending_remove(r)}for(;e.length>0;)e.pop()}finalize_list_pending_paras(){let e=this.list_is_loose,t=this.list_pending_paras;for(let r=0;r<t.length;r++){let n=t[r];e?this.out.commit(n):this.out.revoke(n),this.pending_remove(n)}for(;t.length>0;)t.pop()}end_list(){this.close_list_nodes(),this.states.pop()}close_list_nodes(){this.finalize_list_pending_paras();let e=this.node_stack[this.node_stack.length-1];this.emit_close(e,this.cursor),this.node_stack.pop();let t=this.node_stack[this.node_stack.length-1];if(this.out.attr(t,"tight",!this.list_is_loose),this.emit_close(t,this.cursor),this.node_stack.pop(),this.list_depth--,this.pop_frame(),this.list_depth>0&&this.list_state_stack.length>0){let r=this.list_state_stack.pop();this.list_marker=r.marker,this.list_ordered=r.ordered,this.list_start_num=r.start_num,this.list_node_id=r.node_idx,this.list_is_loose=r.is_loose,this.list_content_offset=r.content_offset,this.list_marker_indent=r.marker_indent,this.list_pending_paras=r.pending_paras}else this.list_pending_paras=ir}close_svelte_block(e){this.emit_close(this.svelte_branch_id,this.cursor),this.node_stack.pop(),this.emit_close(this.svelte_block_id,e),this.node_stack.pop(),this.states.pop(),this.leave_svelte_block()}closes_block(e){let t=this.source,r=this.svelte_block_tag,n=e+2-this.source_base;if(!qv.call(t,r,n))return!1;n+=r.length;let s=v.call(t,n);for(;s===U||s===Q;)s=v.call(t,++n);return s===vn}leave_svelte_block(){if(this.svelte_block_depth--,this.svelte_block_depth>0&&this.svelte_block_stack.length>0){let e=this.svelte_block_stack.pop();this.svelte_block_id=e.block_id,this.svelte_branch_id=e.branch_id,this.svelte_block_tag=e.tag}}start_svelte_block(e,t){if(this.svelte_block_depth>0){let s=this.svelte_block_stack;s===ir&&(s=this.svelte_block_stack=[]),s.push({block_id:this.svelte_block_id,branch_id:this.svelte_branch_id,tag:this.svelte_block_tag})}this.svelte_block_depth++,this.svelte_block_tag=e.tag;let r=this.emit_open(28,this.cursor,t);this.out.attr(r,"tag",e.tag),this.svelte_block_id=r,this.node_stack.push(r);let n=this.emit_open(29,this.cursor,r);this.out.attr(n,"tag",e.tag),(e.expr_start!==0||e.expr_end!==0)&&(this.out.set_value_start(n,e.expr_start),this.out.set_value_end(n,e.expr_end)),this.svelte_branch_id=n,this.node_stack.push(n),this.states.push(27),this.chomp(e.end,!0)}try_parse_uri_autolink(e){let t=this.source,r=this.source_base,n=this.source_end,s=e,i=v.call(t,s-r);if(!(i>=65&&i<=90||i>=97&&i<=122))return-1;s++;let o=1;for(;s<n&&o<=32&&(i=v.call(t,s-r),i>=65&&i<=90||i>=97&&i<=122||i>=48&&i<=57||i===43||i===45||i===46);)s++,o++;if(o<2||v.call(t,s-r)!==Jt||o===6&&je.call(t,e-r,s-r)==="svelte")return-1;for(s++;s<n;){if(i=v.call(t,s-r),i===er)return s+1;if(i<=32||i===gn)return-1;s++}return-1}is_tag_name_start(e){return e>=65&&e<=90||e>=97&&e<=122||e===qr}is_tag_name_char(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===Gr||e===__||e===Jt||e===qr}is_unquoted_attr_char(e){return e>32&&e!==Tr&&e!==Un&&e!==Zo&&e!==gn&&e!==er&&e!==be}is_void_tag(e){switch(e){case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"input":case"link":case"meta":case"source":case"track":case"wbr":return!0;default:return!1}}is_block_html_tag(e){switch(e){case"address":case"article":case"aside":case"base":case"basefont":case"blockquote":case"body":case"caption":case"center":case"col":case"colgroup":case"dd":case"details":case"dialog":case"dir":case"div":case"dl":case"dt":case"fieldset":case"figcaption":case"figure":case"footer":case"form":case"frame":case"frameset":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":case"head":case"header":case"hr":case"html":case"iframe":case"legend":case"li":case"link":case"main":case"menu":case"menuitem":case"nav":case"noframes":case"ol":case"optgroup":case"option":case"p":case"param":case"pre":case"section":case"source":case"summary":case"table":case"tbody":case"td":case"tfoot":case"th":case"thead":case"title":case"tr":case"track":case"ul":return!0;default:return!1}}open_raw_text(e,t){let r=this.emit_open(2,this.cursor,t);this.out.attr(r,"tag",e.tag),e.has_attrs&&this.tag_attributes(r,e),this.out.set_value_start(r,e.end),this.cold.raw_node=r,this.cold.raw_needle="</"+e.tag+">",this.cold.raw_scan=e.end,this.cold.raw_start=e.end,this.cold.raw_line=e.end,this.states.push(30),this.chomp(e.end,!0)}html_leaf_value(e,t){let r=this.out;r.set_value_start(e,t),r.set_value_end(e,t)}try_parse_html_open_tag(e){let t=this.source,r=this.source_base,n=this.source_end;if(this.tag_wait=!1,e>=n||!this.is_tag_name_start(v.call(t,e-r)))return null;let s=this.cold.tag_memo;s!==null&&(this.cold.tag_memo_base!==r||s.length!==n-r)&&(s=this.cold.tag_memo=null);let i=this.scan_open_tag(e,s);if(i<0)return!this.finished&&Sn>=n?(this.tag_wait=!0,this.wait_for(wl),null):(this.open_tag_failed(e),null);let o=bf,a=je.call(t,e-r,v_-r),l=x_;if(l!==0&&!b_&&(!Ko||this.frames.length===0)&&Nw(t,r,o,l)){let d=Sv(o,l);return{tag:a,attributes:new c_(t,r,d,Ov(),l,e,Mw(t,r,o,l),i,v_,Rw(t,r,o,l,v_)),repeated:null,self_closing:xl,end:i,has_attrs:!0,lines:Ko}}let _={},c=null,h=mf;for(let d=0;d<l;d+=5){let f=o[d],p=h&&f===Qo?this.framed_text(o[d+1],o[d+2]):je.call(t,o[d+1]-r,o[d+2]-r),m;if(f===$_)m=!0;else if(f===Qo)m={type:"expression",value:p};else{let g=h?this.framed_text(o[d+3],o[d+4]):je.call(t,o[d+3]-r,o[d+4]-r);m=f===y_?g:{type:"expression",value:g}}d!==0&&gw.call(_,p)?(c===null&&(c=[]),c.push([p,m])):_[p]=m}return{tag:a,attributes:_,repeated:c,self_closing:xl,end:i,has_attrs:l>0,lines:Ko}}tag_attributes(e,t){this.out.attr(e,"attributes",t.attributes),t.repeated!==null&&this.out.attr(e,"repeated",t.repeated)}open_tag_failed(e){let t=this.cold.tag_memo;if(t===null){if(!this.finished||this.inline_range_parse||Sn-e<Ow)return;let s=this.source_base;this.cold.tag_memo_base=s,t=this.cold.tag_memo=new Uint8Array(this.source_end-s),this.scan_open_tag(e,t)}let r=Zv,n=this.cold.tag_memo_base;for(let s=0;s<r.length;s++)t[r[s]-n]=1}scan_open_tag(e,t){let r=this.source,n=this.source_base,s=this.source_end,i=Zv;t!==null&&(i.length=0),x_=0,wl=">",Ko=mf=!1;let o=!b_&&this.frames.length!==0,a=e+1;for(;a<s&&this.is_tag_name_char(v.call(r,a-n));)a++;for(v_=a;a<s;){if(a=this.tag_space(a),a<0)return-1;if(a>=s)break;if(t!==null){if(t[a-n]===1)return-2;i.push(a)}if(v.call(r,a-n)===kt)return a+1<s&&v.call(r,a+1-n)===er?(xl=!0,a+2):(Sn=a+1>=s?s:a,-1);if(v.call(r,a-n)===er)return xl=!1,a+1;if(v.call(r,a-n)===Ot){let h=this.find_matching_brace(a+1);if(h===-1)return Sn=s,wl="}",-1;if(o&&!this.tag_value(a+1,h-1))return-1;yl(Qo,a+1,h-1,0,0),a=h;continue}let l=a,_=v.call(r,a-n);if(_===Zo||_===er||_===kt)return Sn=a,-1;for(;a<s;){let h=v.call(r,a-n);if(h<=er&&(h===U||h===Q||h===V||h===Zo||h===er||h===kt))break;a++}if(a===l)return Sn=a,-1;let c=a;if(a=this.tag_space(a),a<0)return-1;if(a<s&&v.call(r,a-n)===Zo){if(a++,a=this.tag_space(a),a<0)return-1;if(a>=s)break;let h=v.call(r,a-n);if(h===Ot){let d=this.find_matching_brace(a+1);if(d===-1)return Sn=s,wl="}",-1;if(o&&!this.tag_value(a+1,d-1))return-1;yl(yf,l,c,a+1,d-1),a=d}else if(h===Tr||h===Un){a++;let d=a;for(;a<s&&v.call(r,a-n)!==h;)a++;if(a>=s){wl=h===Tr?'"':"'";break}if(o&&!this.tag_value(d,a))return-1;yl(y_,l,c,d,a),a++}else{let d=a;for(;a<s&&this.is_unquoted_attr_char(v.call(r,a-n));)a++;if(a===d)return Sn=a,-1;yl(y_,l,c,d,a)}}else yl($_,l,c,0,0)}return Sn=s,-1}tag_value(e,t){let r=this.framed_value(e,t);return r===0?!0:r<0?(Sn=e,!1):(Ko=mf=!0,!0)}tag_space(e){let t=this.source,r=this.source_base,n=this.source_end;for(;;){let s=v.call(t,e-r);for(;s===U||s===Q;)s=v.call(t,++e-r);if(s!==V)return e;let i=e++;if(this.frames.length!==0){let o=this.line_start(e);if(o<0)return Sn=n,-1;if(o<this.frames.length)return Sn=i,-1;e=this.line_pos}for(s=v.call(t,e-r);s===U||s===Q;)s=v.call(t,++e-r);if(s===V)return Sn=i,-1;Ko=!0}}try_parse_html_close_tag(e){let t=this.source,r=this.source_base,n=this.source_end,s=e;if(this.tag_wait=!1,s>=n||v.call(t,s-r)!==kt)return null;for(s++;s<n&&(v.call(t,s-r)===U||v.call(t,s-r)===Q);)s++;if(s>=n||!this.is_tag_name_start(v.call(t,s-r)))return null;let i=s;for(s++;s<n&&this.is_tag_name_char(v.call(t,s-r));)s++;let o=je.call(t,i-r,s-r),a=v.call(t,s-r);for(;a===U||a===Q;)a=v.call(t,++s-r);if(a===V&&!this.in_table&&!this.in_heading){if(s++,this.frames.length!==0){let l=this.line_start(s);if(l<0)return this.tag_wait=!0,null;if(l<this.frames.length)return null;s=this.line_pos}for(a=v.call(t,s-r);a===U||a===Q;)a=v.call(t,++s-r);s>=n&&!this.finished&&(this.tag_wait=!0)}return s>=n||a!==er?null:{tag:o,end:s+1}}try_parse_html_comment(e){let t=this.source,r=this.source_base,n=this.source_end,s=e;if(v.call(t,s-r)!==Zi||v.call(t,s+1-r)!==Gr||v.call(t,s+2-r)!==Gr)return s+2>=n&&!this.finished?!1:null;s+=3;let i=s,o=de.call(t,"-->",s-r);if(o!==-1){let a=o+r,l=null;if(this.frames.length!==0){let _=de.call(t,`
99
+ `,s-r);if(_!==-1&&_<o&&(l=this.framed_text(i,a),l===null))return null}return{content_start:i,content_end:a,end:a+3,text:l}}return this.finished?null:!1}closes_container(e){if(this.html_block_depth===0)return!1;let t=this.find_html_opener(e);if(t===-1)return!1;let r=this.html_tag_stack[t].id,n=this.node_stack;for(let s=n.length-1;s>0;s--){let i=n[s];if(i===r){for(let o=s-1;o>0;o--)if(this.kind_of(n[o])===7)return!1;return!0}if(this.kind_of(i)===7)return n.lastIndexOf(r,s-1)!==-1}return!1}open_spec_para(e,t){let r=this.emit_open_pending(7,this.cursor,e);this.spec_para=r,this.spec_watch=t?-1:r,this.spec_text=!1,this.spec_block=-1,this.spec_gap=-1,this.spec_never=t,this.spec_link=-1,this.spec_image=-1;let n=this.states;this.spec_item=n[n.length-1]===18,this.cold.spec_pending=this.pending_count,n.push(7),this.node_stack.push(r)}spec_child(e,t,r){if(!this.spec_text){switch(this.spec_gap!==-1&&this.spec_gap_end(t),e){case 1:this.spec_gap=t;return;case 2:case 26:case 27:case 18:return;case 4:{let n=v.call(this.source,t+1-this.source_base);if(n===pn||n===Jt||n===kt)return;break}case 13:if(r!==-1&&this.unwrap_images){this.spec_image=r;return}break;case 12:if(r!==-1&&this.unwrap_images&&this.spec_link===-1){this.spec_link=r,this.spec_watch=r;return}break}this.spec_text=!0}}spec_gap_end(e){let t=this.source,r=this.source_base,n=this.spec_gap;this.spec_gap=-1;let s=v.call(t,n-r);for(;n<e&&(s===U||s===Q);)s=v.call(t,++n-r);n<e&&s!==V&&(this.spec_text=!0)}spec_gap_cut(e){let t=this.source,r=this.source_base,n=this.spec_gap,s=v.call(t,n-r);for(;n<e&&(s===U||s===Q);)s=v.call(t,++n-r);if(n===e){this.spec_gap=e;return}this.spec_gap=-1,s!==V&&(this.spec_text=!0)}spec_media_end(e,t){if(e===this.spec_image)this.spec_image=-1;else if(e===this.spec_link)this.spec_gap!==-1&&this.spec_gap_end(this.cursor),this.spec_link=-1,this.spec_watch=this.spec_para;else return;t||(this.spec_text=!0)}image_start(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.finished?0:-1,i=e;return v.call(t,i-r)===Pr&&i++,i>=n?s:v.call(t,i-r)!==Zi?0:i+1>=n?s:v.call(t,i+1-r)===Pr?1:0}open_image_para(e){let t=this.image_start(this.cursor);return t>0&&this.open_spec_para(e,this.in_phrasing(e)),t}open_spec_tag(e,t,r,n){let s=e.self_closing||this.is_void_tag(e.tag),i=this.line_ends_block(t),o=s||this.sure_to_close(e.end,t),a=!i&&!n&&this.is_block_html_tag(e.tag),l=o&&(i||a),_=r;if(l||(this.open_spec_para(r,n),_=this.spec_para,i&&!n&&(a=this.is_block_html_tag(e.tag))),s){let h=this.emit_open(2,this.cursor,_);this.out.attr(h,"tag",e.tag),e.has_attrs&&this.tag_attributes(h,e),this.out.attr(h,"self_closing",!0),this.html_leaf_value(h,e.end),this.emit_close(h,e.end),this.chomp(e.end,!0);return}let c=this.open_inline_tag(e,_);!l&&a&&(this.spec_block=c)}open_inline_tag(e,t){this.states.push(8);let r=this.emit_open_pending(2,this.cursor,t);return this.out.attr(r,"tag",e.tag),e.has_attrs&&this.tag_attributes(r,e),this.out.set_value_start(r,e.end),this.html_tag_stack.push({id:r,tag:e.tag}),e.lines&&this.note_tag_end(e.end),this.node_stack.push(r),this.states.push(25),this.chomp(e.end,!0),r}inline_past_line(e){let t=this.source,r=this.source_base,n=e.end,s=v.call(t,n-r);for(;s===U||s===Q;)s=v.call(t,++n-r);return n<this.source_end&&s!==V&&this.is_phrasing_tag(e.tag)&&!this.is_block_html_tag(e.tag)}end_block_para(e){let t=this.spec_para;this.spec_never=!0,this.emit_close(t,e),this.states.pop(),this.node_stack.pop()}sure_to_close(e,t){if(ff)return!1;let r=this.source_base;return hf.lastIndex=e-r,hf.test(this.source),hf.lastIndex+r>=t}line_ends_block(e){let t=this.source,r=this.source_base,n=this.source_end;if(e>=n)return this.finished;if(v.call(t,e-r)!==V)return!1;let s=e+1;return!this.finished&&(s>=n||de.call(t,`
100
+ `,s-r)===-1)?!1:this.para_line(e)===1}end_spec_para(e){let t=this.spec_para;this.spec_para=-1,this.spec_watch=-1,this.spec_link=-1,this.spec_image=-1,this.spec_block=-1;let r=this.spec_never;if(r||(this.spec_gap!==-1&&this.spec_gap_end(e),r=!this.spec_text&&this.pending_count<=this.cold.spec_pending),this.spec_item&&!r){this.track_list_pending_para(t);return}this.pending_remove(t),r?this.out.revoke(t):this.out.commit(t)}next_tick(e){let t=this.cold,r=e;if(t.tick_from<=e){let i=t.tick_at;if(i>=e)return i;if(i===-1){if(t.tick_end===this.source_end)return-1;t.tick_end>r&&(r=t.tick_end)}}let n=de.call(this.source,"`",r-this.source_base),s=n===-1?-1:n+this.source_base;return t.tick_from=e,t.tick_at=s,t.tick_end=this.source_end,s}closes_on_line(e,t){let r=this.source,n=this.source_base,s=de.call(r,`
101
+ `,t-n);if(s===-1&&!this.finished)return-1;let i=s===-1?this.source_end:s+n,o=e.length,a=1,l=t;ff=!1;let _=-2;for(;;){let c=de.call(r,"<",l-n);if(c===-1)return 0;let h=c+n;if(h>=i)return 0;if(_!==-1&&_<l&&(_=this.next_tick(l)),_!==-1&&_<h){l=this.code_span_past(_,i);continue}let d=v.call(r,h+1-n)===kt;if(!d){let p=this.try_parse_uri_autolink(h+1);if(p!==-1&&p<=i){l=p;continue}}let f=d?h+2:h+1;if(f+o<=i&&qv.call(r,e,f-n)){let p=v.call(r,f+o-n);if(p===er||p===U||p===Q||p===kt||p===V)if(d){if(--a===0){let m=de.call(r,">",f+o-n);return m===-1||m+n>=i?0:m+n+1}}else{let m=this.scan_open_tag(h+1,null);if(m>0&&m<=i&&xl){l=m;continue}a++,ff=!0}}l=h+1}}code_span_past(e,t){let r=this.source,n=this.source_base,s=e;for(;s>n&&v.call(r,s-1-n)===bt;)s--;if((e-s&1)===1)return e+1;let i=e+1;for(;i<t&&v.call(r,i-n)===be;)i++;let o=i-e;if(o>2)return i;let a=i;for(;;){let l=de.call(r,"`",a-n);if(l===-1||l+n>=t)return i;let _=l+n+1;for(;_<t&&v.call(r,_-n)===be;)_++;if(_-l-n===o)return _;a=_}}in_phrasing(e){let t=this.html_tag_stack;if(t.length===0)return!1;let r=t[t.length-1];return r.id===e&&this.is_phrasing_tag(r.tag)}at_svelte_tag(e){let t=this.source_base;return e===Ot&&v.call(this.source,this.cursor+1-t)===Iv&&w_(v.call(this.source,this.cursor+2-t))}is_phrasing_tag(e){switch(e){case"p":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":case"a":case"abbr":case"b":case"bdi":case"bdo":case"button":case"cite":case"code":case"data":case"dfn":case"em":case"i":case"kbd":case"label":case"legend":case"mark":case"output":case"q":case"s":case"samp":case"small":case"span":case"strong":case"sub":case"summary":case"sup":case"time":case"u":case"var":return!0;default:return!1}}find_html_opener(e){for(let t=this.html_tag_stack.length-1;t>=0;t--)if(this.html_tag_stack[t].tag===e)return t;return-1}html_open_tag_text(e){let t=this.source_base;return je.call(this.source,e-t,this.html_open_tag_end(e)-t)}note_tag_end(e){let t=this.cold;t.tag_ends===null&&(t.tag_ends=new Map),t.tag_ends.set(this.cursor,e)}html_open_tag_end(e){let t=this.cold.tag_ends;if(t!==null){let o=t.get(e);if(o!==void 0)return o}b_=!0;let r=this.try_parse_html_open_tag(e+1);if(b_=!1,r!==null)return r.end;let n=this.source,s=this.source_base,i=e+1;for(;i<this.source_end&&v.call(n,i-s)!==V;)i++;return i}close_html_inline(e,t){if(this.node_stack.lastIndexOf(e)<=0){for(;this.node_stack.length>1;){let r=this.node_stack[this.node_stack.length-1];this.is_closed(r)||(this.out.set_value_end(r,this.cursor),this.emit_close(r,this.cursor)),this.node_stack.pop(),this.states.pop()}return}for(;this.node_stack[this.node_stack.length-1]!==e;)this.close_node_inside_html();for(this.pending_remove(e),this.out.set_value_end(e,this.cursor),this.emit_close(e,t),this.node_stack.pop();this.states.length>0;){let r=this.states.pop();if(r===25)break;if(r===26){this.html_block_depth--;break}}this.states[this.states.length-1]===8&&this.states.pop()}close_node_inside_html(){let e=this.node_stack[this.node_stack.length-1];switch(this.kind_of(e)){case 16:this.close_list_nodes();return;case 25:this.emit_close(e,this.cursor),this.node_stack.pop(),this.table_cell_col++;return;case 22:this.table_row_id!==0&&!this.is_closed(this.table_row_id)&&this.pad_and_close_row(),this.close_table_node();return;case 14:case 37:this.emit_close(e,this.cursor),this.node_stack.pop(),this.block_quote_depth--,this.pop_frame();return;case 29:this.emit_close(e,this.cursor),this.node_stack.pop();return;case 28:this.emit_close(e,this.cursor),this.node_stack.pop(),this.leave_svelte_block();return;case 32:this.emit_close(e,this.cursor),this.node_stack.pop(),this.directive_colon_counts.pop();return;case 3:this.in_heading=!1;break;case 30:this.directive_text_pop(e);break}this.kind_of(e)!==7&&this.pending_has(e)?(this.out.revoke(e),this.pending_remove(e)):this.is_closed(e)||(this.out.set_value_end(e,this.cursor),this.emit_close(e,this.cursor)),this.node_stack.pop()}try_parse_svelte_block_token(e){let t=this.source,r=this.source_base,n=this.source_end;if(e>=n||v.call(t,e-r)!==Ot)return null;let s=e+1;if(s>=n)return null;let i=v.call(t,s-r);if(i!==pn&&i!==Jt&&i!==kt)return null;let o=i===pn?"#":i===Jt?":":"/";s++;let a=s;for(;s<n&&v.call(t,s-r)!==U&&v.call(t,s-r)!==Q&&v.call(t,s-r)!==vn;)s++;if(s===a)return null;let l=je.call(t,a-r,s-r);if(o===":"&&l==="else"){let h=s;for(;s<n&&(v.call(t,s-r)===U||v.call(t,s-r)===Q);)s++;s+1<n&&v.call(t,s-r)===105&&v.call(t,s+1-r)===102&&(s+2>=n||v.call(t,s+2-r)===U||v.call(t,s+2-r)===Q||v.call(t,s+2-r)===vn)?(l="else if",s+=2):s=h}if(o==="/"){for(;s<n&&(v.call(t,s-r)===U||v.call(t,s-r)===Q);)s++;return s>=n||v.call(t,s-r)!==vn?null:{kind:o,tag:l,expr_start:0,expr_end:0,end:s+1}}for(;s<n&&(v.call(t,s-r)===U||v.call(t,s-r)===Q);)s++;if(s<n&&v.call(t,s-r)===vn)return{kind:o,tag:l,expr_start:0,expr_end:0,end:s+1};let _=s,c=this.find_matching_brace(_);return c===-1?null:{kind:o,tag:l,expr_start:_,expr_end:c-1,end:c}}is_svelte_block_boundary(e){if(this.svelte_block_depth===0)return!1;let t=this.source,r=this.source_base;if(e>=this.source_end||v.call(t,e-r)!==Ot)return!1;let n=v.call(t,e+1-r);return n===Jt||n===kt}find_matching_brace(e){if(this.cold.brace_memo!==null)return this.find_matching_brace_memo(e);let t=this.source,r=this.source_base,n=this.source_end,s=1,i=e,o=n-e>256?e+256:n;for(;i<o;){let a=v.call(t,i-r);if(a===vn){if(--s===0)return i+1}else if(a===Ot)s++;else if(a<128&&Qs[a]!==0)break;i++}if(i<n){let a=Iw(this,t,r,n,i,s);return a>=0?a:a===-1?this.brace_failed(e):-1}return this.brace_failed(e)}brace_failed(e){return this.finished&&!this.inline_range_parse&&(this.cold.brace_memo=new Set).add(e),-1}find_matching_brace_memo(e){if(this.cold.brace_memo.has(e))return-1;let t=Kv,r=t.length,n=this.source,s=this.source_base,i=this.source_end,o=1,a=e;for(;a<i;){let l=v.call(n,a-s);if(l>=128||Qs[l]===0){a++;continue}switch(l){case Ot:o++,a++,t.push(a);break;case vn:if(o--,o===0)return a+1;t.pop(),a++;break;case Tr:case Un:{let _=l===Tr?'"':"'",c=a+1-s;for(a=i;;){let h=de.call(n,_,c);if(h===-1)break;let d=h;for(;d>c&&v.call(n,d-1)===bt;)d--;if((h-d&1)===0){a=h+1+s;break}c=h+1}break}case be:{for(a++;a<i&&v.call(n,a-s)!==be;){if(v.call(n,a-s)===bt)a++;else if(v.call(n,a-s)===36&&a+1<i&&v.call(n,a+1-s)===Ot){a+=2;let _=this.find_matching_brace_memo(a);if(_===-1)return this.brace_memo_failed(e,r);a=_;continue}a++}a<i&&a++;break}case kt:{if(a+1<i&&v.call(n,a+1-s)===kt){for(a+=2;a<i&&v.call(n,a-s)!==V;)a++;break}if(a+1<i&&v.call(n,a+1-s)===gt){for(a+=2;a<i;){if(v.call(n,a-s)===gt&&a+1<i&&v.call(n,a+1-s)===kt){a+=2;break}a++}break}a++;break}default:a++}}return this.brace_memo_failed(e,r)}brace_memo_failed(e,t){let r=Kv;if(!this.inline_range_parse){let n=this.cold.brace_memo;n.add(e);for(let s=t;s<r.length;s++)n.add(r[s])}return r.length=t,-1}probe_matching_brace(e){if(this.cold.bp_start!==e){let t=this.find_matching_brace(e);return t!==-1?t:(this.cold.bp_start=e,this.cold.bp_end=-1,this.cold.bp_p=-1,-1)}if(this.cold.bp_end!==-1)return this.cold.bp_end;if(this.cold.bp_p===-1){let t=this.cold.bp_frames;t===null?this.cold.bp_frames=[1]:(t.length=0,t.push(1)),this.cold.bp_p=e,this.cold.bp_mode=Js,this.cold.bp_quote=0}return this.brace_scan(this.source,this.source_base,this.source_end)?this.cold.bp_end:(this.wait_kind=af,this.cold.wait_cursor=this.cursor,-1)}wait_for(e){this.wait_kind=Bv,this.cold.wait_needle=e,this.cold.wait_cursor=this.cursor}needle_in(e,t){let r=this.cold.wait_needle;if(de.call(e,r)!==-1)return!0;let n=r.length-1;if(n===0)return!1;let s=this.wait_chunks,i=s.length!==0?s[s.length-1]:this.source,o=i.length;if(o<n||t<n)return!0;let a=je.call(i,o-n)+je.call(e,0,n);return de.call(a,r)!==-1}brace_scan(e,t,r){let n=this.cold.bp_frames,s=this.cold.bp_p,i=this.cold.bp_mode,o=this.cold.bp_quote,a=r-t,l=-1,_=-1,c=-1,h=-1,d=-1,f=-1,p=-1,m=-1;e:for(;s<r;){let g=v.call(e,s-t);if(i===Js){if(g!==Ot&&g!==vn&&g!==Tr&&g!==Un&&g!==be&&g!==kt){let b=s-t;l<b&&(l=de.call(e,"{",b),(l===-1||l>a)&&(l=a)),_<b&&(_=de.call(e,"}",b),(_===-1||_>a)&&(_=a)),c<b&&(c=de.call(e,'"',b),(c===-1||c>a)&&(c=a)),h<b&&(h=de.call(e,"'",b),(h===-1||h>a)&&(h=a)),d<b&&(d=de.call(e,"`",b),(d===-1||d>a)&&(d=a)),f<b&&(f=de.call(e,"/",b),(f===-1||f>a)&&(f=a));let k=l;if(_<k&&(k=_),c<k&&(k=c),h<k&&(k=h),d<k&&(k=d),f<k&&(k=f),k>=a){s=r;break e}s=k+t,g=v.call(e,k)}}else if(i===f_){if(g!==o&&g!==bt){let b=s-t,k=r-t,x=b;for(;;){let w=de.call(e,o===Tr?'"':"'",x);(w===-1||w>=k)&&(w=k);let O=w;for(;O>b&&v.call(e,O-1)===bt;)O--;if(w===k){s=r,(w-O&1)!==0&&(i=lf);break e}if((w-O&1)===0){s=w+t,g=o;break}x=w+1}}}else if(i===cf){let b=de.call(e,`
102
+ `,s-t);if(b===-1){s=r;break}s=b+t,g=V}else if(i===d_)for(;g!==gt;){if(++s>=r)break e;g=v.call(e,s-t)}else if(i===Go&&g!==be&&g!==bt&&g!==36){let b=s-t;d<b&&(d=de.call(e,"`",b),(d===-1||d>a)&&(d=a)),p<b&&(p=de.call(e,"\\",b),(p===-1||p>a)&&(p=a)),m<b&&(m=de.call(e,"$",b),(m===-1||m>a)&&(m=a));let k=d;if(p<k&&(k=p),m<k&&(k=m),k>=a){s=r;break e}s=k+t,g=v.call(e,k)}switch(i){case Js:if(g===Ot)n[n.length-1]++;else if(g===vn){let b=n.length-1;if(--n[b]===0){if(n.pop(),b===0)return this.cold.bp_end=s+1,!0;i=Go}}else g===Tr||g===Un?(o=g,i=f_):g===be?(n.push(0),i=Go):g===kt&&(i=Hv);s++;break;case Hv:g===kt?(i=cf,s++):g===gt?(i=d_,s++):i=Js;break;case f_:g===bt?i=lf:g===o&&(i=Js),s++;break;case lf:i=f_,s++;break;case Go:g===be?(n.pop(),i=Js):g===bt?i=Vv:g===36&&(i=Yv),s++;break;case Vv:i=Go,s++;break;case Yv:g===Ot?(n.push(1),i=Js,s++):i=Go;break;case cf:g===V&&(i=Js),s++;break;case d_:g===gt&&(i=yw),s++;break;default:g===kt?i=Js:g!==gt&&(i=d_),s++}}return this.cold.bp_p=s,this.cold.bp_mode=i,this.cold.bp_quote=o,!1}try_parse_link_ref_definition(e,t){let r=this.frames.length===0,n=this.source,s=this.source_base,i=this.source_end,o=e;for(;o<i&&(v.call(n,o-s)===U||v.call(n,o-s)===Q);)o++;if(o>=i)return this.finished?-1:-2;if(v.call(n,o-s)!==Pr)return-1;if(o++,o>=i)return this.finished?-1:-2;if(v.call(n,o-s)===On)return-1;let a=o;for(;o<i;){let N=v.call(n,o-s);if(N===as)break;if(N===V||N===Pr)return-1;if(N===bt&&o+1<i){o+=2;continue}o++}if(o>=i)return this.finished?-1:-2;if(o===a)return-1;let l=o;if(o++,o>=i)return this.finished?-1:-2;if(v.call(n,o-s)!==Jt)return-1;o++;let _=je.call(n,a-s,l-s);for(;o<i&&(v.call(n,o-s)===U||v.call(n,o-s)===Q);)o++;if(r&&o<i&&v.call(n,o-s)===V)for(o++;o<i&&(v.call(n,o-s)===U||v.call(n,o-s)===Q);)o++;if(o>=i)return this.finished?-1:-2;let c,h,d=v.call(n,o-s);if(d===gn){for(o++,c=o;o<i;){let N=v.call(n,o-s);if(N===er)break;if(N===V||N===gn)return-1;if(N===bt&&o+1<i&&v.call(n,o+1-s)!==V){o+=2;continue}o++}if(o>=i)return this.finished?-1:-2;h=o,o++}else{if(d===V)return-1;{c=o;let N=0;for(;o<i;){let S=v.call(n,o-s);if(S<=32)break;if(S===Tn){if(N===0)break;N--}if(S===mn&&N++,S===bt&&o+1<i&&v.call(n,o+1-s)>32){o+=2;continue}o++}if(N!==0||(h=o,c===h))return-1}}let f=je.call(n,c-s,h-s),p=o,m=o;for(;o<i&&(v.call(n,o-s)===U||v.call(n,o-s)===Q);)o++;let g=o>m,b="";if(o<i){let N=v.call(n,o-s);if(!(N===V&&!r)){if(N===V){let S=o;for(o++;o<i&&(v.call(n,o-s)===U||v.call(n,o-s)===Q);)o++;if(o<i){let D=v.call(n,o-s);if(D===34||D===39||D===mn){let X=this.parse_ref_title(o,r);if(X===-2)return-2;if(X){let G=X.end,H=v.call(n,G-s);for(;H===U||H===Q;)H=v.call(n,++G-s);if(G>=i){if(!this.finished)return-2}else H!==V&&(X=null)}X?(b=X.title,o=p=X.end):o=S}else o=S}else if(this.finished)o=S;else return-2}else if((N===34||N===39||N===mn)&&g){let S=this.parse_ref_title(o,r);if(S===-2)return-2;if(S)b=S.title,o=p=S.end;else return-1}}}else if(!this.finished)return-2;for(;o<i&&(v.call(n,o-s)===U||v.call(n,o-s)===Q);)o++;if(o>=i&&!this.finished)return-2;if(o<i&&v.call(n,o-s)!==V)return-1;o<i&&r&&o++;let k=g_(f),x=b===""?"":g_(b),w=tb(_);if(w){let N=this.ref_map;if(N===Lv&&(N=this.ref_map=new Map),!N.has(w)){N.set(w,{url:k,title:x});let S=this.ref_waiting;S!==null&&this.fill_references(S,w,k,x)}}let O=this.emit_open(38,a-1,t);return this.out.attr(O,"label",_),this.out.attr(O,"href",k),x&&this.out.attr(O,"title",x),this.out.set_value_start(O,a),this.out.set_value_end(O,l),this.emit_close(O,p),o}fill_references(e,t,r,n){let s=e.get(t);if(s!==void 0){e.delete(t),e.size===0&&(this.ref_waiting=null);for(let i=0;i<s.length;i++){let o=s[i];this.out.attr(o,this.kind_of(o)===13?"src":"href",r),n&&this.out.attr(o,"title",n)}}}parse_ref_title(e,t){let r=this.source,n=this.source_base,s=this.source_end,i=v.call(r,e-n);if(i!==34&&i!==39&&i!==mn)return null;let o=i===mn?Tn:i,a=e+1,l=a;for(;a<s;){let _=v.call(r,a-n);if(_===o)return{title:je.call(r,l-n,a-n),end:a+1};if(_===mn&&i===mn)return null;if(_===V){if(!t)return null;let c=a+1;for(;c<s&&(v.call(r,c-n)===U||v.call(r,c-n)===Q);)c++;if(c<s&&v.call(r,c-n)===V)return null;if(c>=s&&!this.finished)return-2}if(_===bt&&a+1<s){a+=2;continue}a++}return this.finished?null:-2}start_heading(e){let t=this.source,r=this.source_base,n=this.source_end,s=1,i=this.cursor+1;for(;i<n&&v.call(t,i-r)===pn;)s++,i++;if(s>6){this.states.push(7);let c=this.emit_open(7,this.cursor,e);return this.node_stack.push(c),!0}if(i>=n&&!this.finished)return!1;let o=v.call(t,i-r);if(i<n&&o!==U&&o!==Q&&o!==V){this.states.push(7);let c=this.emit_open(7,this.cursor,e);return this.node_stack.push(c),!0}let a=i;if(i<n&&(o===U||o===Q))for(a++;a<n&&(v.call(t,a-r)===U||v.call(t,a-r)===Q);)a++;if(a>=n&&!this.finished)return!1;let l=this.emit_open(3,this.cursor,e,s);this.out.set_value_start(l,a),this.chomp(a,!0);let _=a<n?v.call(t,a-r):0;if(!this.in_table&&(_>=128||_!==0&&Qe[_]===0)){let c=this.emit_open(1,a,l);this.out.set_value_start(c,a);let h=this.text_run(a+1);if(this.cursor=h,h<n&&v.call(t,h-r)===V){let d=h;for(;d>0&&(v.call(t,d-1-r)===U||v.call(t,d-1-r)===Q);)d--;return this.emit_close(c,d),this.out.set_value_end(c,d),this.out.set_value_end(l,d),this.emit_close(l,h),!0}return this.node_stack.push(l),this.in_heading=!0,this.states.push(2),this.states.push(8),this.node_stack.push(c),this.states.push(1),!0}return this.node_stack.push(l),this.in_heading=!0,this.states.push(2),!0}end_heading(e){let t=this.source,r=this.source_base,n=this.cursor;for(;n>0&&(v.call(t,n-1-r)===U||v.call(t,n-1-r)===Q);)n--;this.pending_count!==this.pending_para_count&&this.settle_heading(e),this.out.set_value_end(e,n),this.emit_close(e,this.cursor),this.in_heading=!1,this.node_stack.pop(),this.states.pop()}settle_heading(e){let t=this.cold.stale_html,r=0;for(;r<this.pending_count;){let n=this.pending_ids[r];if(n<=e){r++;continue}let s=this.kind_of(n);if(s===2){t.push(n,this.pending_starts[r]),r++;continue}this.out.revoke(n),s===30&&this.directive_text_pop(n),this.pending_remove(n)}if(t.length!==0){for(let n=0;n<t.length;n+=2)this.pending_remove(t[n]);this.revoke_stale_html()}}_unwind_unterminated_delimiter(){this.states.pop(),this.node_stack.pop(),this.states[this.states.length-1]===8&&this.states.pop()}para_line(e){let t=e+1;if(this.interrupt_pos===t&&this.interrupt_frames===this.frames.length&&this.interrupt_svelte_depth===this.svelte_block_depth||Xo&&this.frames.length===1&&this.list_depth>0&&this.margin_line(t))return 1;let r;if(this.frames.length!==0){let n=this.line_start(t);if(n<0)return-1;t=this.line_pos,r=this.line_interrupts(t)||n<this.frames.length&&(this.quote_ends(n)||!this.under_item())}else this.line_pos=t,r=this.line_interrupts(t);return r?(this.interrupt_pos=e+1,this.interrupt_frames=this.frames.length,this.interrupt_svelte_depth=this.svelte_block_depth,1):0}margin_marker(e){let t=this.source,r=this.source_base,n=this.source_end;if(e+2>=n||e===this.cold.note_pos)return!1;let s=v.call(t,e-r),i=e+1,o=!1,a=0;if(s!==Gr&&s!==gt&&s!==bl){if(s<48||s>57)return!1;for(a=s-48;;){if(i+2>=n)return!1;if(s=v.call(t,i-r),s<48||s>57)break;if(i-e>=9)return!1;a=a*10+s-48,i++}if(s!==__&&s!==Tn)return!1;o=!0,i++}if(v.call(t,i-r)!==U)return!1;let l=v.call(t,i+1-r);return l===U||l===Q||l===V||l===s&&!o?!1:(this.interrupt_marker=this.marker_at(0,s,o,a,i+1,i+1-e),this.interrupt_marker_pos=e,!0)}margin_line(e){return this.margin_marker(e)?(this.line_pos=e,this.line_quote=e,this.line_at=e,this.line_kept=0,this.interrupt_pos=e,this.interrupt_frames=1,this.interrupt_svelte_depth=this.svelte_block_depth,!0):!1}under_item(){let e=this.states;for(let t=e.length-1;t>0;t--){let r=e[t];if(r===18)return!0;if(r===17)return this.frames[this.frames.length-1]!==0;if(r>=26&&r<=28)return!1}return!1}soft_break(e){return this.para_line(this.cursor)!==0?!1:(this.emit_bare_leaf(18,this.cursor,e,this.cursor+1),this.chomp(this.skip_spaces(this.line_pos),!0),!0)}lf_continues(e){return this.inline_range_parse?(this.block_quote_depth>0&&this.line_start(e+1),!0):this.in_heading||this.in_table?!1:this.para_line(e)===0}_delimiter_lf_close(e){if(!this.in_heading){if(!this.finished&&!this.can_decide_after_lf(this.cursor))return!1;if(this.block_quote_depth>0){if(this.soft_break(e))return this.states.push(8),!0}else if(this.para_line(this.cursor)!==1)return!1}return this.states.pop(),this.emit_close_pending(e,this.cursor),this.out.set_value_end(e,this.cursor),this.node_stack.pop(),!0}inline_lf_end(){let e=this.states;if(e.pop(),e[e.length-1]!==7)return;let t=this.node_stack;this.emit_close(t[t.length-1],this.cursor),e.pop(),of(t,1+this.block_quote_depth+this.list_depth*2+this.html_block_depth+this.svelte_block_depth*2+this.directive_colon_counts.length)}_run(){let e=this.source,t=this.source_base,r=this.source_end,n=r-t;this.loop_without_progress=0,this.interrupt_pos=-1,this.interrupt_marker_pos=-1;let s=0;e:for(;this.cursor<=r&&!(!this.finished&&this.cursor>=r);){if(this.pending_count>this.pending_para_count){let c=this.states[this.states.length-1];c===0||c===17||c===18?this.revoke_stale_pending(!1):c>=26&&c<=28&&this.pending_count-this.pending_para_count>this.cold.pending_html&&this.revoke_stale_pending(!0)}let i=this.states[this.states.length-1],o=this.cursor-t,a=o>>>0<n?v.call(e,o):NaN,l=a===0?Aw:a,_=this.node_stack[this.node_stack.length-1];if((++s&63)===0&&this.stalled())throw new nb(this.cursor);switch(i){case 0:{if(this.node_stack.length===1&&this.pending_count===this.pending_para_count&&(this.trim_point=this.cursor),l!==l){this.cursor++;continue}if(this.cursor===0&&!this.frontmatter_failed&&l===Gr&&!this.finished&&r<4&&(r<2||v.call(e,1-t)===Gr)&&(r<3||v.call(e,2-t)===Gr))break e;if(this.cursor===0&&!this.frontmatter_failed&&l===Gr&&v.call(e,1-t)===Gr&&v.call(e,2-t)===Gr){let c=3,h=v.call(e,c-t);for(;h===U||h===Q;)h=v.call(e,++c-t);if(h===V||h!==h){if(!this.finished&&h!==V)break e;this.states.push(29);let d=this.emit_open(33,0,_);this.node_stack.push(d);let f=h===V?c+1:c;this.out.set_value_start(d,f),this.chomp(f,!0);continue}}if(this.imports_allowed&&l===105){let c=this.try_parse_import(this.cursor);if(c===!1)break e;if(c!==null){this.emit_leaf(34,this.cursor,_,c.value_start,c.value_end,c.end),this.chomp(c.end,!0);continue}}switch(this.imports_allowed&&l!==V&&l!==U&&l!==Q&&(this.imports_allowed=!1),l){case V:{this.emit_bare_leaf(6,this.cursor,_,this.cursor+1),this.cursor++;continue}case U:case Q:{let c=this.cursor;for(;c<r&&(v.call(e,c-t)===U||v.call(e,c-t)===Q);)c++;if(c>=r&&!this.finished)break e;if(c<r&&v.call(e,c-t)===V){this.emit_bare_leaf(6,this.cursor,_,c+1),this.chomp(c+1,!0);continue}this.cursor++;continue}default:{if(l<128&&$l[l]!==0){let h=this.block_start(l,_,-1,this.cursor);if(h===-1)break e;if(h===1)continue}this.states.push(7);let c=this.emit_open(7,this.cursor,_);this.node_stack.push(c),(l>=128||l!==0&&Qe[l]===0)&&this.para_text(c);continue}}}case 7:{let c=1+this.block_quote_depth+this.list_depth*2+this.html_block_depth+this.svelte_block_depth*2+this.directive_colon_counts.length;if(!l){if(!this.finished)break e;this.emit_close(_,this.cursor),this.states.pop(),of(this.node_stack,c);continue}if(l===V&&!this.finished&&!this.can_decide_after_lf(this.cursor))break e;if(l===V){let h=this.para_line(this.cursor);if(h<0)break e;if(h===1){this.emit_close(_,this.cursor),this.states.pop(),of(this.node_stack,c);continue}if(this.block_quote_depth>0){this.emit_bare_leaf(18,this.cursor,_,this.cursor+1),this.chomp(this.skip_spaces(this.line_pos),!0);let d=v.call(e,this.cursor-t);d>=128||d!==0&&Qe[d]===0?this.para_text(_):this.states.push(8);continue}for(this.emit_bare_leaf(18,this.cursor,_,this.cursor+1),this.cursor++;this.cursor<r&&v.call(e,this.cursor-t)===U;)this.cursor++;this.states.push(8);continue}else{this.states.push(8);continue}}case 3:{if(this._run_code_fence_start(l,_))break e;continue}case 4:{if(this._run_code_fence_info(l,_))break e;continue}case 5:{if(this._run_code_fence_content(_))break e;continue}case 6:{if(this._run_code_fence_text_end(l,_))break e;continue}case 2:{if(l===V||l!==l){if(!this.finished&&l!==l)break e;this.end_heading(_);continue}if(this.states.push(8),!this.in_table&&(l>=128||Qe[l]===0&&l>U)){let c=this.emit_open(1,this.cursor,_);this.out.set_value_start(c,this.cursor);let h=this.text_run(this.cursor+1);if(h<r&&v.call(e,h-t)===V){let d=h;for(;d>0&&(v.call(e,d-1-t)===U||v.call(e,d-1-t)===Q);)d--;this.emit_close(c,d),this.out.set_value_end(c,d),this.states.pop(),this.cursor=h;continue}this.node_stack.push(c),this.states.push(1),this.cursor=h}continue}case 14:{if(!l){this._unwind_unterminated_delimiter();continue}if(l===gt&&!this.finished&&this.cursor+1>=r)break e;if(l===gt&&this.prev_class()&6&&this.next_class()&3){let c=this.node_stack[this.node_stack.length-1];if(!this.emphasis_has_content){if(this.open_inner_doubled(c,10,14))continue;this.out.revoke(c),this.pending_remove(c),this.states.pop(),this.node_stack.pop(),this.states[this.states.length-1]===8&&this.states.pop();continue}this.close_strong(c)}else if(this.in_table&&(l===Ye||l===V))this.unwind_inline_for_table();else{if(l===V&&this._delimiter_lf_close(_))continue;this.emphasis_has_content=!0,this.states.push(8)}continue}case 15:{if(this._run_emphasis(l,_))break e;continue}case 19:{if(this._run_strikethrough(l,_))break e;continue}case 20:{if(this._run_superscript(l,_))break e;continue}case 21:{if(this._run_subscript(l,_))break e;continue}case 22:{if(this._run_link_text(l,_))break e;continue}case 25:{if(this._run_html_element(l,_))break e;continue}case 26:{if(this._run_html_block_element(l,_))break e;continue}case 27:{if(this._run_svelte_branch(l,_))break e;continue}case 17:{if(this._run_block_quote(l,_))break e;continue}case 18:{if(this._run_list_item(l,_))break e;continue}case 28:{if(this._run_directive_container(l,_))break e;continue}case 8:{if(this.in_table){if(l===Ye||l===V||!l){this.states.pop();continue}if(l===U||l===Q){let c=this.table_cell_padding();if(c===2)break e;if(c===1)continue}}if(this.in_heading&&(l===V||!l)){this.states.pop();continue}switch(l){case be:{if(this.line_code_span(_))continue;this.states.push(9),this.extra=0,this.code_span_open_pos=this.cursor;continue}case V:{if(!this.finished&&!this.can_decide_after_lf(this.cursor))break e;if(this.block_quote_depth>0){this.states.pop();continue}if(this.para_line(this.cursor)===1){this.inline_lf_end();continue}else{for(this.emit_bare_leaf(18,this.cursor,_,this.cursor+1),this.cursor++;this.cursor<r&&v.call(e,this.cursor-t)===U;)this.cursor++;if(this.list_depth>0){let c=v.call(e,this.cursor-t);(c>=128||c!==0&&Qe[c]===0)&&this.states[this.states.length-2]===7&&(this.states.pop(),this.para_text(_))}continue}}case gt:{if(!this.finished&&this.cursor+1>=r)break e;if(this.states[this.states.length-2]===14&&this.prev_class()&6&&this.next_class()&3){this.states.pop();continue}if(this.prev_class()&3&&this.next_class()&6){let c=this.emit_open_pending(10,this.cursor,_);this.out.set_value_start(c,this.cursor+1),this.node_stack.push(c),this.emphasis_has_content=!1,this.states.push(14);let h=this.cursor+1<r?v.call(e,this.cursor+1-t):0;if(h!==0&&(h>=128||Qe[h]===0)){this.emphasis_has_content=!0,this.states.push(8),this.open_text_run(this.cursor+1,c);continue}if(h===gt&&this.open_inner_strong(c))continue}else{let c=this.emit_open(1,this.cursor,_);this.out.set_value_start(c,this.cursor),this.node_stack.push(c),this.states.push(1)}this.cursor++;continue}case qr:{if(!this.finished&&this.cursor+1>=r)break e;if(this.states[this.states.length-2]===15&&this.prev_class()&6&&this.next_class()&3){this.states.pop();continue}if(this.prev_class()&3&&this.next_class()&6){let c=this.emit_open_pending(9,this.cursor,_);this.out.set_value_start(c,this.cursor+1),this.node_stack.push(c),this.emphasis_has_content=!1,this.states.push(15);let h=this.cursor+1<r?v.call(e,this.cursor+1-t):0;if(h!==0&&(h>=128||Qe[h]===0)){this.emphasis_has_content=!0,this.states.push(8),this.open_text_run(this.cursor+1,c);continue}}else{let c=this.emit_open(1,this.cursor,_);this.out.set_value_start(c,this.cursor),this.node_stack.push(c),this.states.push(1)}this.cursor++;continue}case Ar:{if(!this.finished&&(this.cursor+1>=r||this.cursor+2>=r&&v.call(e,this.cursor+1-t)===Ar))break e;let c=this.states[this.states.length-2];if(c===19&&v.call(e,this.cursor+1-t)===Ar&&this.prev_class()&6&&Cn(v.call(e,this.cursor+2-t))&3||c===21&&v.call(e,this.cursor+1-t)!==Ar&&this.prev_class()&6){this.states.pop();continue}if(v.call(e,this.cursor+1-t)===Ar&&this.prev_class()&3&&this.after_tildes_class()&6){let h=this.emit_open_pending(19,this.cursor,_);this.out.set_value_start(h,this.cursor+2),this.node_stack.push(h),this.states.push(19),this.chomp(2)}else if(v.call(e,this.cursor+1-t)!==Ar&&this.next_class()&6){let h=this.emit_open_pending(21,this.cursor,_);this.out.set_value_start(h,this.cursor+1),this.node_stack.push(h),this.states.push(21),this.cursor++}else{let h=this.emit_open(1,this.cursor,_);this.out.set_value_start(h,this.cursor),this.node_stack.push(h),this.states.push(1),this.cursor++}continue}case On:{if(!this.finished&&this.cursor+1>=r)break e;if(this.states[this.states.length-2]===20&&this.prev_class()&6){this.states.pop();continue}if(this.next_class()&6){let c=this.emit_open_pending(20,this.cursor,_);this.out.set_value_start(c,this.cursor+1),this.node_stack.push(c),this.states.push(20)}else{let c=this.emit_open(1,this.cursor,_);this.out.set_value_start(c,this.cursor),this.node_stack.push(c),this.states.push(1)}this.cursor++;continue}case as:{if(this.states.length>=2&&this.states[this.states.length-2]===22){let h=this.directive_text_ids.length-1;if(h>=0&&this.directive_text_ids[h]===_&&this.directive_text_brackets[h]>0)this.directive_text_brackets[h]--;else{this.states.pop();continue}}else if(this.states.length>=4){let h=this.close_marks_at_bracket();if(h>0)continue;if(h<0)break e}let c=this.emit_open(1,this.cursor,_);this.out.set_value_start(c,this.cursor),this.node_stack.push(c),this.states.push(1),this.cursor++;continue}case bt:{if(!this.finished&&this.cursor+1>=r)break e;let c=v.call(e,this.cursor+1-t);if(c===V){if(!this.finished&&!this.can_decide_after_lf(this.cursor+1))break e;if(this.lf_continues(this.cursor+1)){for(this.emit_bare_leaf(17,this.cursor,_,this.cursor+2),this.chomp(2),this.block_quote_depth>0&&this.chomp(this.line_pos,!0);this.cursor<r&&v.call(e,this.cursor-t)===U;)this.cursor++;continue}}if(this.is_ascii_punctuation(c)){let h=this.emit_open(1,this.cursor+1,_);this.out.set_value_start(h,this.cursor+1),this.node_stack.push(h),this.states.push(1),this.chomp(2)}else{let h=this.emit_open(1,this.cursor,_);this.out.set_value_start(h,this.cursor),this.node_stack.push(h),this.states.push(1),this.cursor++}continue}case Pr:{if(this.directive_text_ids.length>0){let h=this.directive_text_ids.length-1;this.directive_text_ids[h]===_&&this.directive_text_brackets[h]++;let d=this.emit_open(1,this.cursor,_);this.out.set_value_start(d,this.cursor),this.node_stack.push(d),this.states.push(1),this.cursor++;continue}{let h=v.call(e,this.cursor+1-t);if(h===On){let d=this.note_reference(_);if(d<0)break e;if(d!==0)continue}else if(h!==h&&!this.finished)break e}let c=this.emit_open_pending(12,this.cursor,_);this.out.set_value_start(c,this.cursor+1),this.node_stack.push(c),this.states.push(22),this.link_text_start=this.cursor+1;{let h=this.cursor+1<r?v.call(e,this.cursor+1-t):0;if(h>U&&(h>=128||Qe[h]===0)){this.states.push(8),this.open_text_run(this.cursor+1,c);continue}}this.cursor++;continue}case Zi:{if(!this.finished&&this.cursor+1>=r)break e;if(v.call(e,this.cursor+1-t)===Pr&&this.directive_text_ids.length===0){let h=this.emit_open_pending(13,this.cursor,_);this.out.set_value_start(h,this.cursor+2),this.node_stack.push(h),this.states.push(22),this.link_text_start=this.cursor+2,this.chomp(2);continue}let c=this.emit_open(1,this.cursor,_);this.node_stack.push(c),this.out.set_value_start(c,this.cursor),this.states.push(1),this.cursor++;continue}case gn:{let c=this.in_table||this.in_heading,h=c?this.row_end():-1;if(h===-1&&!this.finished&&de.call(e,">",this.cursor+1-t)===-1){this.wait_for(">");break e}let d=this.directive_text_ids.length>0?-1:this.try_parse_uri_autolink(this.cursor+1);if(d!==-1){let b=je.call(e,this.cursor+1-t,d-1-t),k=this.emit_open(12,this.cursor,_);this.out.set_value_start(k,this.cursor+1),this.out.attr(k,"href",b),this.emit_leaf(1,this.cursor+1,k,this.cursor+1,d-1,d-1),this.out.set_value_end(k,d-1),this.emit_close(k,d),this.chomp(d,!0),this.states.pop();continue}let f=this.try_parse_html_comment(this.cursor+1);if(f===!1&&h===-1){this.cursor+3<r&&this.wait_for("-->");break e}if(f&&(h===-1||f.end<=h)){let b=this.emit_open(26,this.cursor,_);this.out.text(b,f.content_start,f.content_end,26),f.text!==null&&this.out.attr(b,"text",f.text),this.emit_close(b,f.end),this.chomp(f.end,!0),this.states.pop();continue}let p=this.try_parse_html_close_tag(this.cursor+1);if(p===null&&this.tag_wait)break e;if(p){let b=this.find_html_opener(p.tag);if(b!==-1&&this.in_table&&this.html_tag_stack[b].id<this.table_node_id){let k=this.row_ends_at(p.end);if(k===-1)break e;k===0&&(b=-1)}if(b!==-1){for(;this.html_tag_stack.length>b+1;){let x=this.html_tag_stack.pop();this.close_html_inline(x.id,this.cursor)}let k=this.html_tag_stack.pop();this.close_html_inline(k.id,p.end),this.chomp(p.end,!0),k.id===this.spec_block&&this.end_block_para(p.end);continue}}let m=this.try_parse_html_open_tag(this.cursor+1);if(m===null&&this.tag_wait){if(h===-1)break e;this.wait_kind=Zs}if(m!==null&&c){let b=this.tag_fits_row(m,h);if(b===-1)break e;b===0&&(m=null)}if(m){if(m.self_closing||this.is_void_tag(m.tag)){let b=this.emit_open(2,this.cursor,_);this.out.attr(b,"tag",m.tag),m.has_attrs&&this.tag_attributes(b,m),this.out.attr(b,"self_closing",!0),this.html_leaf_value(b,m.end),this.emit_close(b,m.end),this.chomp(m.end,!0),this.states.pop()}else if(Yo(m.tag))this.states.pop(),this.open_raw_text(m,_);else{let b=this.emit_open_pending(2,this.cursor,_);this.out.attr(b,"tag",m.tag),m.has_attrs&&this.tag_attributes(b,m),this.out.set_value_start(b,m.end),this.html_tag_stack.push({id:b,tag:m.tag}),m.lines&&this.note_tag_end(m.end),this.node_stack.push(b),this.states.push(25),this.chomp(m.end,!0)}continue}let g=this.emit_open(1,this.cursor,_);this.node_stack.push(g),this.out.set_value_start(g,this.cursor),this.states.push(1),this.cursor++;continue}case Ot:{let c;if(this.finished)this.cold.bp_start===this.cursor+1&&this.cold.bp_p===this.source_end&&this.cold.bp_end===-1?c=-1:c=this.find_matching_brace(this.cursor+1);else if(c=this.probe_matching_brace(this.cursor+1),c===-1){if(!(this.in_table||this.in_heading)||this.row_end()===-1)break e;this.wait_kind=Zs}if(c!==-1&&(this.in_table||this.in_heading)){let f=this.row_end();f!==-1&&c>f&&(c=-1)}let h=c!==-1&&this.frames.length!==0?this.framed_value(this.cursor+1,c-1):0;if(h<0&&(c=-1),c!==-1){if(v.call(e,this.cursor+1-t)===Iv){let f=this.cursor+2;for(;f<c-1&&v.call(e,f-t)!==U&&v.call(e,f-t)!==Q&&v.call(e,f-t)!==V&&v.call(e,f-t)!==vn;)f++;let p=je.call(e,this.cursor+2-t,f-t);if(p.length>0){let m=this.emit_open(27,this.cursor,_);for(this.out.attr(m,"tag",p);f<c-1&&(v.call(e,f-t)===U||v.call(e,f-t)===Q);)f++;f<c-1&&(this.out.set_value_start(m,f),this.out.set_value_end(m,c-1),h>0&&this.out.attr(m,"text",this.framed_text(f,c-1))),this.emit_close(m,c),this.chomp(c,!0);continue}}if(h>0){let f=this.emit_open(4,this.cursor,_);this.out.set_value_start(f,this.cursor+1),this.out.set_value_end(f,c-1),this.out.attr(f,"text",this.framed_text(this.cursor+1,c-1)),this.emit_close(f,c)}else this.emit_leaf(4,this.cursor,_,this.cursor+1,c-1,c);this.chomp(c,!0);continue}let d=this.emit_open(1,this.cursor,_);this.out.set_value_start(d,this.cursor),this.node_stack.push(d),this.states.push(1),this.cursor++;continue}case Jt:{if(!this.finished&&this.cursor+2>=r)break e;let c=this.cursor+1,h=c<r?v.call(e,c-t):0;if(h>=97&&h<=122||h>=65&&h<=90){let f=c;for(;f<r&&this.is_directive_name_char(v.call(e,f-t));)f++;if(f>=r&&!this.finished)break e;if(f<r&&v.call(e,f-t)===Pr){let p=je.call(e,c-t,f-t),m=this.emit_open_pending(30,this.cursor,_);this.out.attr(m,"name",p),this.out.set_value_start(m,f+1),this.node_stack.push(m),this.states.push(22),this.directive_text_ids.push(m),this.directive_text_brackets.push(0),this.link_text_start=f+1,this.chomp(f+1,!0);continue}}let d=this.emit_open(1,this.cursor,_);this.out.set_value_start(d,this.cursor),this.node_stack.push(d),this.states.push(1),this.cursor++;continue}case Ye:if(!this.in_table){let c=this.pipe_marker(this.cursor);if(c===-1)break e;if(c===1){this.cursor++;continue}}default:{if(!l){this.states.pop();continue}if(this.in_heading&&(l===U||l===Q)){let c=this.cursor+1;for(;c<r;){let h=v.call(e,c-t);if(h!==U&&h!==Q)break;c++}if(c>=r&&!this.finished)break e;if(c>=r||v.call(e,c-t)===V){this.chomp(c,!0);continue}}if(l===k_){let c=this.math_scan(this.cursor);if(c<0)break e;if(c!==0){this.math_emit(_);continue}}this.open_text_run(this.cursor,_);continue}}}case 1:{if(this.in_table&&(l===Ye||l===V||!l)){this.unwind_inline_for_table();continue}if(this.in_heading&&(l===V||!l)){let c=this.cursor;for(;c>0&&(v.call(e,c-1-t)===U||v.call(e,c-1-t)===Q);)c--;this.states.pop(),this.emit_close(_,c),this.out.set_value_end(_,c),this.node_stack.pop();continue}if(l===Ye&&!this.in_table){if(this.cursor+1>=r){if(!this.finished)break e}else if(E_[v.call(e,this.cursor+1-t)]===1){this.states.pop(),this.emit_close(_,this.cursor),this.out.set_value_end(_,this.cursor),this.node_stack.pop();continue}}if(l===bt){if(!this.finished&&this.cursor+1>=r)break e;let c=v.call(e,this.cursor+1-t);if(c===V){if(!this.finished&&!this.can_decide_after_lf(this.cursor+1))break e;if(this.lf_continues(this.cursor+1)){this.emit_close(_,this.cursor),this.out.set_value_end(_,this.cursor),this.node_stack.pop(),this.states.pop();let h=this.node_stack[this.node_stack.length-1];for(this.emit_bare_leaf(17,this.cursor,h,this.cursor+2),this.chomp(2),this.block_quote_depth>0&&this.chomp(this.line_pos,!0);this.cursor<r&&v.call(e,this.cursor-t)===U;)this.cursor++;continue}this.cursor++;continue}if(this.is_ascii_punctuation(c)){this.emit_close(_,this.cursor),this.out.set_value_end(_,this.cursor),this.node_stack.pop();let h=this.node_stack[this.node_stack.length-1],d=this.emit_open(1,this.cursor+1,h);this.out.set_value_start(d,this.cursor+1),this.node_stack.push(d),this.chomp(2);continue}}if(l===V&&!this.finished&&!this.can_decide_after_lf(this.cursor)||!l&&!this.finished)break e;if(!l||l===V){this.states.pop(),this.emit_close(_,this.cursor),this.out.set_value_end(_,this.cursor),this.node_stack.pop();let c=this.states;if(l===V&&this.block_quote_depth===0&&this.list_depth===0&&c[c.length-1]===8&&(this.finished||this.can_decide_after_lf(this.cursor))){if(this.para_line(this.cursor)===1){this.inline_lf_end();continue}let h=this.node_stack[this.node_stack.length-1];this.emit_bare_leaf(18,this.cursor,h,this.cursor+1);let d=this.cursor+1;for(;d<r&&v.call(e,d-t)===U;)d++;if(d+1<r){let f=v.call(e,d-t),p=v.call(e,d+1-t);if(f!==0&&(f>=128||Qe[f]===0)&&p!==0&&(p>=128||Qe[p]===0)){let m=this.emit_open(1,d,h);this.out.set_value_start(m,d),this.node_stack.push(m),c.push(1),d=this.text_run(d+2)}}this.cursor=d}continue}else if(l===Jt){if(!this.finished&&this.cursor+1>=r)break e;let c=v.call(e,this.cursor+1-t);if(c>=97&&c<=122||c>=65&&c<=90){this.states.pop(),this.emit_close(_,this.cursor),this.out.set_value_end(_,this.cursor),this.node_stack.pop(),this.states.pop();continue}this.cursor++;continue}else if(l===gt||l===qr||l===Ar||l===On||l===gn||l===Pr||l===as||l===Zi||l===be||l===Ot){this.states.pop(),this.emit_close(_,this.cursor),this.out.set_value_end(_,this.cursor),this.node_stack.pop(),this.states.pop();continue}if(l===k_){let c=this.math_scan(this.cursor);if(c<0)break e;if(c!==0){this.states.pop(),this.emit_close(_,this.cursor),this.out.set_value_end(_,this.cursor),this.node_stack.pop(),this.math_emit(this.node_stack[this.node_stack.length-1]);continue}}this.cursor=this.text_run(this.cursor+1);continue}case 9:{if(this.extra>2){this.states.pop(),this.states.push(1);let c=this.emit_open(1,this.cursor-this.extra,_);this.node_stack.push(c),this.out.set_value_start(c,this.cursor-this.extra);continue}switch(l){case be:{this.extra+=1,this.cursor++;continue}case pn:{if(!this.finished&&this.cursor+1>=r)break e;if(v.call(e,this.cursor+1-t)===Zi){this.chomp(2),this.states.pop(),this.states.push(10),this.info_start_pos=this.cursor;continue}this.states.pop(),this.states.push(13);let c=this.emit_open(8,this.cursor-this.extra,_);this.node_stack.push(c),this.span_start(c,this.cursor);continue}case U:{if(!this.finished&&this.cursor+1>=r)break e;this.checkpoint_cursor=this.cursor,this.states.pop(),this.states.push(11);let c=this.emit_open(8,this.cursor-this.extra,_);this.node_stack.push(c);let h=this.cursor+1>=r?V:v.call(e,this.cursor+1-t);this.chomp(h===V||h===be||h===Ye&&this.in_table?1:2);continue}default:{this.states.pop(),this.states.push(13);let c=this.emit_open(8,this.cursor-this.extra,_);this.node_stack.push(c),this.span_start(c,this.cursor);continue}}}case 10:switch(l){case U:{let c=this.cursor+1;for(;c<r&&v.call(e,c-t)===U;)c++;let h=c;for(;h<r&&v.call(e,h-t)===be;)h++;if(!this.finished&&h>=r)break e;if(h-c===this.extra){this.code_span_hint_revert(_);continue}this.info_end_pos=this.cursor,this.checkpoint_cursor=this.cursor+1,this.states.pop(),v.call(e,this.cursor+1-t)===U?(this.states.push(11),this.chomp(2)):(this.states.push(13),this.cursor++);let d=this.emit_open(8,this.info_start_pos-2-this.extra,_);this.node_stack.push(d),this.out.attr(d,"info_start",this.info_start_pos),this.out.attr(d,"info_end",this.info_end_pos),v.call(e,this.cursor-2-t)!==U&&this.span_start(d,this.cursor);continue}case be:case V:{this.code_span_hint_revert(_);continue}default:{if(l!==l||l===Ye&&this.in_table&&!this.pipe_escaped(this.cursor)){this.code_span_hint_revert(_);continue}this.cursor++;continue}}case 11:{if(!this.finished&&(l===U||l===be)&&this.cursor+this.extra>=r)break e;if(l===U&&v.call(e,this.cursor+1-t)===be){this.cursor++,this.states.pop(),this.states.push(12);continue}else if(l===be&&v.call(e,this.cursor-1-t)!==be){if(this.extra===1&&v.call(e,this.cursor+1-t)!==be||this.extra===2&&v.call(e,this.cursor+1-t)===be&&v.call(e,this.cursor+2-t)!==be){this.span_start(_,this.checkpoint_cursor),this.span_close(_,this.cursor,this.cursor+this.extra),this.node_stack.pop(),this.states.pop(),this.chomp(this.extra);continue}this.cursor++;continue}else if(l===V||l!==l||l===Ye&&this.in_table&&!this.pipe_escaped(this.cursor)){this.span_vs=this.checkpoint_cursor,this.chomp(this.cursor,!0),this.states.pop(),this.states.push(13);continue}else{this.cursor++;continue}}case 12:{if(!this.finished&&l===be&&this.cursor+this.extra>=r)break e;if(this.extra===1&&l===be&&v.call(e,this.cursor+1-t)!==be){this.states.pop();let c=this.span_pad();this.span_start(_,this.checkpoint_cursor+c),this.span_close(_,this.cursor-c,this.cursor+this.extra),this.node_stack.pop()}else if(this.extra===2&&l===be&&v.call(e,this.cursor+1-t)===be&&v.call(e,this.cursor+2-t)!==be){this.states.pop();let c=this.span_pad();this.span_start(_,this.checkpoint_cursor+c),this.span_close(_,this.cursor-c,this.cursor+this.extra),this.node_stack.pop()}else{this.states.pop(),this.states.push(11),this.cursor++;continue}this.chomp(this.extra);continue}case 13:{if(this.in_table&&(l===Ye||l===V)){this.code_span_in_cell(l);continue}if(l===be){let c=1;for(;this.cursor+c<r&&v.call(e,this.cursor+c-t)===be;)c++;if(!this.finished&&this.cursor+c>=r)break e;if(c===this.extra){this.states.pop(),this.span_close(_,this.span_padded_end(_),this.cursor+this.extra),this.node_stack.pop(),this.chomp(this.extra);continue}this.cursor+=c;continue}if(l===V&&!this.finished&&!this.can_decide_after_lf(this.cursor))break e;if(l===V&&(this.is_blank_line_after(this.cursor)||!this.lf_continues(this.cursor))||l!==l){let c=this.code_span_open_pos+this.extra;this.chomp(c,!0),this.out.revoke(this.node_stack[this.node_stack.length-1],je.call(e,this.code_span_open_pos-t,c-t),this.one_shot?this.code_span_open_pos:void 0),this.node_stack.pop(),this.states.pop();continue}{let c=this.in_table,h=this.cursor+1;for(;h<r;){let d=v.call(e,h-t);if(d===be||d===V||c&&d===Ye)break;h++}this.cursor=h}continue}case 23:{if(!l){if(!this.finished)break e;this.end_table();continue}if(l===V){if(this.frames.length!==0){let c=this.table_next_line();if(c<0)break e;if(c===1)continue}this.end_table();continue}if(l!==Ye){let c=this.table_line_ends();if(c===-1)break e;if(c===1){this.end_table();continue}}this.table_row_id=this.emit_open(24,this.cursor,this.table_node_id),this.table_cell_col=0,l===Ye?this.cursor++:this.cursor=this.line_pos,this.table_cell_id=this.emit_open(25,this.cursor,this.table_row_id,this.table_cell_col),this.cold.table_bounds[this.table_cur]=this.table_cell_id,this.table_cell_has_content=!1,this.node_stack.push(this.table_cell_id),this.states.push(24),this.table_cells();continue}case 24:{if(this.inline_range_parse&&!l)break e;if(!l){if(!this.finished)break e;this.table_cell_col<this.table_col_count&&(this.close_table_cell(),this.table_cell_col++),this.pad_and_close_row(),this.states.pop();continue}if(l===Ye){if(!this.table_pipe())break e;this.table_cell_col<this.table_col_count&&this.table_cells();continue}if(l===V){this.table_cell_col<this.table_col_count&&(this.close_table_cell(),this.table_cell_col++),this.pad_and_close_row(),this.states.pop(),this.frames.length===0&&this.cursor++;continue}if(this.table_cell_col>=this.table_col_count){this.skip_extra_cells();continue}if(!this.table_cell_has_content&&(l===U||l===Q)){let c=this.cursor+1;for(;c<r;){let h=v.call(e,c-t);if(h!==U&&h!==Q)break;c++}this.cursor=c;continue}if(this.table_cell_has_content=!0,l>=128||Qe[l]===0){this.table_cell_text(_);continue}this.states.push(8);continue}case 29:{if(this._run_frontmatter(_))break e;continue}case 30:{if(this._run_raw_text())break e;continue}default:{this.cursor++;continue}}}}start_fence(e){let t=v.call(this.source,this.cursor-1-this.source_base);if(this.cold.fence_indent=t===U||t===Q?this.fence_indent():0,this.finished?this.frames.length!==0||!this.fence_whole(e):!this.fence_open(e)){if(this.finished&&this.span_para(e))return;this.states.push(3),this.extra=0}}fence_indent(){let e=this.source,t=this.source_base,r=this.cursor-1,n=v.call(e,r-t);for(;n===U||n===Q||n===er;)n=v.call(e,--r-t);if(n===n&&n!==V&&this.cursor!==this.cold.task_pos)return 0;let s=this.lead_columns(this.cursor),i=this.frames,o=i.length===0?0:i[i.length-1];return s>o?s-o:0}dedent_line(e,t,r){let n=this.source,s=this.source_base,i=0;for(;i<r&&e<t;){let o=v.call(n,e-s);if(o===U)i++;else if(o===Q){if(i+=this.tab_size,i>r)return" ".repeat(i-r)+je.call(n,e+1-s,t-s)}else break;e++}return je.call(n,e-s,t-s)}fence_code(e,t,r){let n=this.cold.fence_indent;if(n===0||r<=t)return;let s=this.source,i=this.source_base,o="",a=!1,l=t;for(;l<r;){let _=v.call(s,l-i);(_===U||_===Q)&&(a=!0);let c=de.call(s,`
103
+ `,l-i),h=c===-1||c+i>=r?r:c+i+1;o+=this.dedent_line(l,h,n),l=h}a&&this.out.attr(e,"text",o)}span_line_para(e,t){if(this.kind_of(t)!==16)return this.emit_open(7,e,t);let r=this.emit_open_pending(7,e,t);return this.track_list_pending_para(r),r}span_para(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.cursor,i=s+1;if(i<n&&v.call(t,i-r)===be&&i++,i>=n||v.call(t,i-r)===be)return!1;let o=this.span_line_para(s,e);return this.node_stack.push(o),this.states.push(7),this.class_floor=-1,this.states.push(8),this.line_code_span(o)||(this.states.push(9),this.extra=0,this.code_span_open_pos=s),!0}fence_open(e){if(this.frames.length!==0)return!1;let t=this.source,r=this.source_base,n=this.source_end,s=this.cursor,i=s+1;for(;i<n&&v.call(t,i-r)===be;)i++;let o=i-s;if(o<3)return!1;let a=de.call(t,`
104
+ `,i-r);if(a===-1)return!1;let l=a+r;if(l+1>=n)return!1;let _=this.out,c=this.emit_open(5,s,e);this.node_stack.push(c),this.extra=o,this.info_start_pos=i,this.info_end_pos=l,_.attr(c,"info_start",i),_.attr(c,"info_end",l);let h=l+1;for(_.set_value_start(c,h),this.class_floor=-1;;){let d=de.call(t,"`",h-r);if(d===-1)break;let f=d+r;if(f>h){let g=Ki.call(t,`
105
+ `,f-1-r);g!==-1&&g+r+1>h&&(h=g+r+1)}let p=h;for(;p<f;){let g=v.call(t,p-r);if(g!==U&&g!==Q)break;p++}if(p===f){for(;p<n&&v.call(t,p-r)===be;)p++;if(p-f>=o){if(p<n&&v.call(t,p-r)===V)return this.fence_code(c,l+1,h-1),_.set_value_end(c,h-1),this.emit_close(c,p),this.node_stack.pop(),this.cursor=p+1,!0;break}}let m=de.call(t,`
106
+ `,p-r);if(m===-1)break;h=m+r+1}return this.states.push(5),this.fence_scan=h,this.cursor=l+1,!0}fence_close_end(e){let t=this.source,r=this.source_base,n=this.source_end,s=v.call(t,e-r);for(;s===U||s===Q;)s=v.call(t,++e-r);return e>=n?this.finished?n:-2:s===V?e:-1}fence_whole(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.cursor,i=s+1;for(;i<n&&v.call(t,i-r)===be;)i++;let o=i-s;if(o<3)return!1;let a=de.call(t,`
107
+ `,i-r);if(a===-1)return!1;let l=a+r;if(l+1>=n)return!1;let _=this.out,c=this.emit_open(5,s,e);this.node_stack.push(c),this.extra=o,this.info_start_pos=i,this.info_end_pos=l,_.attr(c,"info_start",i),_.attr(c,"info_end",l);let h=l+1;_.set_value_start(c,h);let d=-1;for(;;){let g=de.call(t,"`",h-r);if(g===-1)break;let b=g+r;if(b>h){let w=Ki.call(t,`
108
+ `,b-1-r);w!==-1&&w+r+1>h&&(h=w+r+1)}let k=h;for(;k<b;){let w=v.call(t,k-r);if(w!==U&&w!==Q)break;k++}if(k===b){for(;k<n&&v.call(t,k-r)===be;)k++;if(k-b>=o&&this.fence_close_end(k)>=0){d=b;break}}let x=de.call(t,`
109
+ `,k-r);if(x===-1)break;h=x+r+1}if(this.class_floor=-1,d===-1)return this.fence_code(c,l+1,n),_.set_value_end(c,n),this.emit_close(c,n),this.node_stack.pop(),this.cursor=n,!0;this.fence_code(c,l+1,h-1),_.set_value_end(c,h-1);let f=d;for(;f<n&&v.call(t,f-r)===be;)f++;let p=f<n?v.call(t,f-r):-1;if(p===-1||p===V)return this.emit_close(c,f),this.node_stack.pop(),this.cursor=p===-1?f:f+1,!0;let m=f;for(;m<n&&v.call(t,m-r)!==V;)m++;return this.emit_close(c,f),this.node_stack.pop(),this.cursor=m,!0}_run_code_fence_start(e,t){if(this.source,this.source_base,this.source_end,e===be)return this.extra+=1,this.cursor++,!1;if(this.extra>=3){this.states.pop(),this.states.push(4);let r=this.emit_open(5,this.cursor-this.extra,t);return this.node_stack.push(r),this.info_start_pos=this.cursor,!1}else{this.states.pop();let r=this.span_line_para(this.cursor-this.extra,t);return this.node_stack.push(r),this.states.push(7),this.chomp(this.cursor-this.extra,!0),!1}}framed_fence_lines(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.cold,i=this.frames.length,o=this.extra,a=s.fence_indent,l=this.cursor,_=this.fence_scan,c=_===l?"":s.fence_text,h=n,d=n,f=n;for(;;){if(_>=n){if(this.finished)break;return this.fence_stall(_,c)}let m=this.line_start(_);if(m<i){if(m<0)return this.fence_stall(_,c);h=d=f=_-1;break}let g=this.line_pos,b=g,k=v.call(t,b-r);for(;k===U||k===Q;)k=v.call(t,++b-r);let x=b;for(;k===be;)k=v.call(t,++b-r);let w=de.call(t,`
110
+ `,b-r);if(w===-1&&!this.finished)return this.fence_stall(_,c);if(b-x>=o&&this.fence_close_end(b)>=0){h=_-1,d=b,f=w===-1?n:w+r;break}let O=w===-1?n:w+r+1;if(c+=a===0?je.call(t,g-r,O-r):this.dedent_line(g,O,a),w===-1)break;_=O}let p=this.out;return h>l&&((h<n||d<n)&&(c=je.call(c,0,c.length-1)),p.attr(e,"text",c)),s.fence_text="",p.set_value_end(e,h),this.emit_close(e,d),this.node_stack.pop(),this.states.pop(),this.chomp(f,!0),!1}fence_stall(e,t){return this.cold.fence_text=t,this.fence_scan=e,e-1>this.trim_point&&this.can_trim(this.node_stack.length-1)&&(this.trim_point=e-1),!0}_run_code_fence_info(e,t){let r=this.source,n=this.source_base,s=this.source_end;if(!e&&this.finished)return this.fence_info_eof(t,this.cursor),!1;if(e){if(this.cursor+1>=s&&this.finished)return this.fence_info_eof(t,e===V?this.cursor:s),!1;if(this.cursor+1>=s)return!0}else return!0;if(e!==V){let i=this.cursor+1;for(;i+1<s;){let o=v.call(r,i-n);if(o===0||o===V)break;i++}return this.cursor=i,!1}else return this.cursor>=s&&this.finished?(this.emit_close(t,s),this.out.set_value_end(t,s),this.states.pop(),!1):this.cursor>=s?!0:(this.info_end_pos=this.cursor,this.states.pop(),this.states.push(5),this.out.attr(t,"info_start",this.info_start_pos),this.out.attr(t,"info_end",this.cursor),this.cursor++,this.out.set_value_start(t,this.cursor),this.fence_scan=this.cursor,!1)}fence_info_eof(e,t){let r=this.source_end;this.out.attr(e,"info_start",this.info_start_pos),this.out.attr(e,"info_end",t),this.out.set_value_start(e,r),this.out.set_value_end(e,r),this.emit_close(e,r),this.node_stack.pop(),this.states.pop(),this.cursor=r}_run_code_fence_content(e){if(this.frames.length!==0)return this.framed_fence_lines(e);let t=this.source,r=this.source_base,n=this.source_end,s=this.extra,i=this.fence_scan,o=-1;for(;;){let _=de.call(t,"`",i-r);if(_===-1){let f=Ki.call(t,`
111
+ `,n-1-r);f!==-1&&f+r+1>i&&(i=f+r+1);break}let c=_+r;if(c>i){let f=Ki.call(t,`
112
+ `,c-1-r);f!==-1&&f+r+1>i&&(i=f+r+1)}let h=i;for(;h<c;){let f=v.call(t,h-r);if(f!==U&&f!==Q)break;h++}if(h===c){for(;h<n&&v.call(t,h-r)===be;)h++;if(h-c>=s){let f=this.fence_close_end(h);if(f>=0){o=c;break}if(f===-2)return this.fence_scan=i,!0}}let d=de.call(t,`
113
+ `,h-r);if(d===-1)break;i=d+r+1}if(o===-1)return this.finished?(this.fence_code(e,this.cursor,n),this.out.set_value_end(e,n),this.states.pop(),this.states.push(6),this.chomp(n,!0),!1):(this.fence_scan=i,this.cold.fence_indent===0&&this.can_trim(this.node_stack.length-1)?(this.trim_point=i,this.wait_kind=Uv):this.wait_for("`"),!0);let a=i-1,l=o;for(;l<n&&v.call(t,l-r)===be;)l++;return this.states.pop(),this.states.push(6),this.fence_code(e,this.cursor,a),this.out.set_value_end(e,a),this.chomp(l,!0),!1}framed_raw_text(){let e=this.source,t=this.source_base,r=this.source_end,n=this.cold,{raw_needle:s,raw_node:i}=n,o=r,a=r;for(;;){let _=n.raw_line,c=de.call(e,`
114
+ `,_-t),h=de.call(e,s,_-t);if(h!==-1&&(c===-1||h<c)){o=h+t,a=o+s.length;break}if(c===-1){if(this.finished)break;return!0}let d=this.line_start(c+t+1);if(d<0)return!0;if(d<this.frames.length){o=a=c+t;break}n.raw_line=this.line_pos}let l=this.framed_text(n.raw_start,o);return l!==null&&l.length!==o-n.raw_start&&this.out.attr(i,"text",l),this.out.set_value_end(i,o),this.emit_close(i,a),this.states.pop(),this.chomp(a,!0),!1}_run_raw_text(){if(this.frames.length!==0)return this.framed_raw_text();let e=this.source_base,t=this.source_end,r=this.cold.raw_needle,n=de.call(this.source,r,this.cold.raw_scan-e),s=this.cold.raw_node;if(n!==-1){let i=n+e,o=i+r.length;return this.out.set_value_end(s,i),this.emit_close(s,o),this.states.pop(),this.chomp(o,!0),!1}if(!this.finished){let i=t-r.length+1;return i>this.cold.raw_scan&&(this.cold.raw_scan=i),this.can_trim(this.node_stack.length)&&(this.trim_point=this.cold.raw_scan,this.wait_kind=kw),!0}return this.out.set_value_end(s,t),this.emit_close(s,t),this.states.pop(),this.chomp(t,!0),!1}_run_code_fence_text_end(e,t){let r=this.source,n=this.source_base,s=this.source_end;if(this.cursor>=s&&!this.finished)return!0;if(this.cursor>=s||e===V)return this.emit_close(t,this.cursor),this.node_stack.pop(),this.states.pop(),this.cursor<s&&this.frames.length===0&&this.cursor++,!1;if(e===be)return this.cursor++,!1;{let i=this.cursor;for(;i<s&&v.call(r,i-n)!==V;)i++;return i>=s&&!this.finished?!0:(this.emit_close(t,this.cursor),this.node_stack.pop(),this.states.pop(),this.chomp(i,!0),!1)}}_run_emphasis(e,t){this.source,this.source_base;let r=this.source_end;if(this.in_table&&(e===Ye||e===V))return this.unwind_inline_for_table(),!1;if(!e)return this._unwind_unterminated_delimiter(),!1;if(e===qr&&!this.finished&&this.cursor+1>=r)return!0;if(e===qr&&this.prev_class()&6&&this.next_class()&3){let n=this.node_stack[this.node_stack.length-1];if(!this.emphasis_has_content)return this.open_inner_doubled(n,9,15)||(this.out.revoke(n),this.pending_remove(n),this.states.pop(),this.node_stack.pop(),this.states[this.states.length-1]===8&&this.states.pop()),!1;this.out.set_value_end(n,this.cursor),this.emit_close(n,this.cursor+1),this.pending_remove(n),this.states.pop(),this.node_stack.pop(),this.mark_closed=++this.cursor,this.states[this.states.length-1]===8&&this.states.pop()}else{if(e===V&&this._delimiter_lf_close(t))return!1;this.emphasis_has_content=!0,this.states.push(8)}return!1}_run_strikethrough(e,t){let r=this.source,n=this.source_base,s=this.source_end;if(this.in_table&&(e===Ye||e===V))return this.unwind_inline_for_table(),!1;if(!e)return this._unwind_unterminated_delimiter(),!1;if(e===Ar&&!this.finished&&(this.cursor+1>=s||this.cursor+2>=s&&v.call(r,this.cursor+1-n)===Ar))return!0;if(e===Ar&&v.call(r,this.cursor+1-n)===Ar&&this.prev_class()&6&&Cn(v.call(r,this.cursor+2-n))&3){let i=this.node_stack[this.node_stack.length-1];if(this.cursor===this.pending_starts[this.id_slots[i]]+2){if(!(this.after_tildes_class()&1)){this.states.push(8);let l=this.emit_open_pending(19,this.cursor,i);return this.out.set_value_start(l,this.cursor+2),this.node_stack.push(l),this.states.push(19),this.chomp(2),!1}let o=this.states,a=this.node_stack;for(let l=i;;){let _=this.pending_starts[this.id_slots[l]];if(this.out.revoke(l),this.pending_remove(l),o.pop(),a.pop(),o[o.length-1]===8&&o.pop(),o[o.length-1]!==19||(l=a[a.length-1],_!==this.pending_starts[this.id_slots[l]]+2))break}return!1}this.out.set_value_end(i,this.cursor),this.emit_close(i,this.cursor+2),this.pending_remove(i),this.states.pop(),this.node_stack.pop(),this.chomp(2),this.mark_closed=this.cursor,this.states[this.states.length-1]===8&&this.states.pop()}else{if(e===V&&this._delimiter_lf_close(t))return!1;this.states.push(8)}return!1}_run_superscript(e,t){if(this.in_table&&(e===Ye||e===V))return this.unwind_inline_for_table(),!1;if(!e)return this._unwind_unterminated_delimiter(),!1;if(e===On&&this.prev_class()&6){let r=this.node_stack[this.node_stack.length-1];this.out.set_value_end(r,this.cursor),this.emit_close(r,this.cursor+1),this.pending_remove(r),this.states.pop(),this.node_stack.pop(),this.cursor++,this.states[this.states.length-1]===8&&this.states.pop()}else{if(e===V&&this._delimiter_lf_close(t))return!1;this.states.push(8)}return!1}_run_subscript(e,t){let r=this.source,n=this.source_base;if(this.in_table&&(e===Ye||e===V))return this.unwind_inline_for_table(),!1;if(!e)return this._unwind_unterminated_delimiter(),!1;if(e===Ar&&!this.finished&&this.cursor+1>=this.source_end)return!0;if(e===Ar&&v.call(r,this.cursor+1-n)!==Ar&&this.prev_class()&6){let s=this.node_stack[this.node_stack.length-1];this.out.set_value_end(s,this.cursor),this.emit_close(s,this.cursor+1),this.pending_remove(s),this.states.pop(),this.node_stack.pop(),this.mark_closed=++this.cursor,this.states[this.states.length-1]===8&&this.states.pop()}else{if(e===V&&this._delimiter_lf_close(t))return!1;this.states.push(8)}return!1}_run_link_text(e,t){let r=this.source,n=this.source_base,s=this.source_end;if(this.in_table&&(e===Ye||e===V))return this.unwind_inline_for_table(),!1;if(!e)return this._unwind_unterminated_delimiter(),!1;if(e===as){if(this.kind_of(t)===30){let o=this.directive_text_brackets.length-1;if(this.directive_text_brackets[o]>0)return this.states.push(8),!1;let a=this.cursor+1;if(a>=s&&!this.finished)return!0;let l=a;if(a<s&&v.call(r,a-n)===mn){let _=this.try_parse_directive_args(a);if(_===!1)return!0;_!==null&&(_.args&&this.out.attr(t,"args",_.args),l=_.end)}return this.out.set_value_end(t,this.cursor),this.pending_remove(t),this.emit_close(t,l),this.node_stack.pop(),this.states.pop(),this.directive_text_pop(t),this.states[this.states.length-1]===8&&this.states.pop(),this.chomp(l,!0),!1}let i=this.link_close(this.cursor+1);if(i<0)return!0;if(i===jv){let o=this.link_end,a=t,l=g_(je.call(r,this.link_dest_start-n,this.link_dest_end-n)),_=this.kind_of(a)===13;return this.out.attr(a,_?"src":"href",l),this.link_title_start>=0&&this.link_title_end>=0&&this.out.attr(a,"title",g_(je.call(r,this.link_title_start-n,this.link_title_end-n))),this.out.set_value_end(a,this.cursor),this.spec_para!==-1&&this.spec_media_end(a,!0),this.pending_remove(a),this.emit_close(a,o),this.node_stack.pop(),this.states.pop(),this.states[this.states.length-1]===8&&this.states.pop(),this.chomp(o,!0),!1}return i===h_&&this.close_reference(t,je.call(r,this.link_label_start-n,this.link_label_end-n),this.link_end)||(this.out.revoke(t),this.pending_remove(t),this.node_stack.pop(),this.states.pop()),!1}return e===V&&!this.finished&&!this.can_decide_after_lf(this.cursor)?!0:e===V&&this.link_text_lf_ends(t)?(this.out.revoke(t),this.pending_remove(t),this.directive_text_pop(t),this.node_stack.pop(),this.states.pop(),!1):(this.states.push(8),!1)}link_close(e){let t=this.source,r=this.source_base,n=this.source_end;if(e>=n)return this.finished?0:-1;let s=v.call(t,e-r);if(s===mn){let i=e+1;for(;i<n&&(v.call(t,i-r)===U||v.call(t,i-r)===Q);)i++;let o=i,a=i;if(i<n&&v.call(t,i-r)===gn){for(i++,o=i;i<n&&v.call(t,i-r)!==er&&v.call(t,i-r)!==V;)i++;i<n&&v.call(t,i-r)===er&&(a=i,i++)}else if(i>=n||v.call(t,i-r)!==Tn){let c=0;for(;i<n;){let h=v.call(t,i-r);if(h<=32)break;if(h===Tn){if(c===0)break;c--}if(h===mn&&c++,h===bt&&i+1<n&&v.call(t,i+1-r)>32){i+=2;continue}i++}a=i}for(;i<n&&(v.call(t,i-r)===U||v.call(t,i-r)===Q);)i++;let l=-1,_=-1;if(i<n){let c=v.call(t,i-r);if(c===34||c===39||c===mn){let h=c===mn?Tn:c;for(i++,l=i;i<n&&v.call(t,i-r)!==h&&v.call(t,i-r)!==V;){if(v.call(t,i-r)===bt&&i+1<n){i+=2;continue}i++}i<n&&v.call(t,i-r)===h&&(_=i,i++)}}for(;i<n&&(v.call(t,i-r)===U||v.call(t,i-r)===Q);)i++;return i<n&&v.call(t,i-r)===Tn?(this.link_dest_start=o,this.link_dest_end=a,this.link_title_start=l,this.link_title_end=_,this.link_end=i+1,jv):!this.finished&&i>=n?-1:0}if(s===Pr){let i=e+1;if(i>=n)return this.finished?0:-1;if(v.call(t,i-r)===as)return this.link_label_start=this.link_text_start,this.link_label_end=this.cursor,this.link_end=i+1,h_;let o=i;for(;i<n;){let a=v.call(t,i-r);if(a===as||a===Pr||a===V)break;if(a===bt&&i+1<n){i+=2;continue}i++}if(i>=n)return this.finished?0:-1;if(v.call(t,i-r)===as&&i>o)return this.link_label_start=o,this.link_label_end=i,this.link_end=i+1,h_}return 0}close_marks_at_bracket(){let e=this.states,t=e.length-2,r=0;for(;;){let s=e[t];if(s!==15&&s!==14&&s!==19&&s!==20&&s!==21)break;if(r++,e[t-1]!==8)return 0;t-=2}if(r===0||e[t]!==22)return 0;let n=this.node_stack[this.node_stack.length-1-r];if(this.kind_of(n)===30){let s=this.directive_text_brackets.length-1;if(this.directive_text_brackets[s]>0)return 0}else{let s=this.link_close(this.cursor+1);if(s<0)return-1;if(s===0)return 0;if(s===h_){let i=je.call(this.source,this.link_label_start-this.source_base,this.link_label_end-this.source_base);if(Fv(i)==="")return 0}}e.pop();for(let s=0;s<r;s++){let i=this.node_stack.pop();this.out.revoke(i),this.pending_remove(i),e.pop(),e.pop()}return 1}close_reference(e,t,r){let n=Fv(t);if(n==="")return!1;let s=this.ref_map,i=s.size===0?void 0:s.get(n);if(i!==void 0){let o=this.kind_of(e)===13;this.out.attr(e,o?"src":"href",i.url),i.title&&this.out.attr(e,"title",i.title)}else{let o=this.ref_waiting;o===null&&(o=this.ref_waiting=new Map);let a=o.get(n);a===void 0?o.set(n,[e]):a.push(e)}return this.out.set_value_end(e,this.cursor),this.spec_para!==-1&&this.spec_media_end(e,!0),this.pending_remove(e),this.emit_close(e,r),this.node_stack.pop(),this.states.pop(),this.states[this.states.length-1]===8&&this.states.pop(),this.chomp(r,!0),!0}link_text_lf_ends(e){return this.in_heading?!0:this.block_quote_depth>0?!this.soft_break(e):this.is_blank_line_after(this.cursor)||this.para_line(this.cursor)===1}is_fence_start(e){let t=this.source,r=this.source_base;return e+2<this.source_end&&v.call(t,e-r)===be&&v.call(t,e+1-r)===be&&v.call(t,e+2-r)===be}_run_html_element(e,t){let r=this.source,n=this.source_base;if(e===gn){if(!this.finished&&de.call(r,">",this.cursor+1-n)===-1)return!0;let s=this.try_parse_html_close_tag(this.cursor+1);if(s===null&&this.tag_wait)return!0;if(s){let i=this.find_html_opener(s.tag);if(i!==-1&&this.html_tag_stack[i].id===t){for(;this.html_tag_stack.length>i+1;){let o=this.html_tag_stack.pop();this.close_html_inline(o.id,this.cursor)}return this.html_tag_stack.pop(),this.pending_remove(t),this.out.set_value_end(t,this.cursor),this.emit_close(t,s.end),this.node_stack.pop(),this.states.pop(),this.chomp(s.end,!0),this.states[this.states.length-1]===8&&this.states.pop(),t===this.spec_block&&this.end_block_para(s.end),!1}}}return this.in_table&&(e===Ye||e===V)?(this.unwind_inline_for_table(),!1):e===V&&!this.finished&&!this.can_decide_after_lf(this.cursor)?!0:e===V&&(this.in_heading||(this.block_quote_depth>0?!this.soft_break(t):this.para_line(this.cursor)===1))?(this.html_tag_stack.length>0&&this.html_tag_stack[this.html_tag_stack.length-1].id===t&&this.html_tag_stack.pop(),this.states.pop(),this.node_stack.pop(),!1):e?(this.states.push(8),!1):this.finished?(this.html_tag_stack.length>0&&this.html_tag_stack[this.html_tag_stack.length-1].id===t&&this.html_tag_stack.pop(),this.states.pop(),this.node_stack.pop(),!1):!0}close_outer_html(e,t){for(;this.html_tag_stack.length>e+1;)this.close_html_inline(this.html_tag_stack.pop().id,this.cursor);this.close_html_inline(this.html_tag_stack.pop().id,t),this.chomp(t,!0)}end_branch_containers(){let e=this.states,t=e.length-1;for(;t>=0&&(e[t]===26||e[t]===28);)t--;if(t<0||e[t]!==27)return!1;let r=this.html_tag_stack,n=!1;for(let s=e.length-1;s>t;s--){let i=this.node_stack.pop();if(e.pop()===28){n&&this.revoke_stale_pending(!1),n=!1,this.emit_close(i,this.cursor),this.directive_colon_counts.pop();continue}let o=r.length-1;for(;o>=0&&r[o].id!==i;)o--;o!==-1&&(r.length=o),this.html_block_depth--,n=!0}return n&&this.revoke_stale_pending(!1),!0}branch_token_ends(){if(!this.finished&&this.probe_matching_brace(this.cursor+1)===-1)return-1;let e=this.try_parse_svelte_block_token(this.cursor);return e===null||e.kind==="#"?0:this.end_branch_containers()?1:0}close_outer_tag(){if(!this.finished&&de.call(this.source,">",this.cursor+1-this.source_base)===-1)return this.wait_for(">"),-1;let e=this.try_parse_html_close_tag(this.cursor+1);if(e===null)return this.tag_wait?-1:0;let t=this.find_html_opener(e.tag);return t===-1?0:(this.close_outer_html(t,e.end),1)}open_block_tag(e){if(!this.finished&&de.call(this.source,">",this.cursor+1-this.source_base)===-1)return this.wait_for(">"),-1;let t=this.try_parse_html_open_tag(this.cursor+1);if(t===null)return this.tag_wait?-1:0;let r=t.self_closing||this.is_void_tag(t.tag)?t.end:Yo(t.tag)?0:this.closes_on_line(t.tag,t.end);if(r===-1)return this.wait_for(`
115
+ `),-1;if(r>0)this.open_spec_tag(t,r,e,this.in_phrasing(e));else if(Yo(t.tag))this.open_raw_text(t,e);else if(this.inline_past_line(t))this.open_spec_para(e,this.in_phrasing(e)),this.open_inline_tag(t,this.spec_para);else{let n=this.emit_open_pending(2,this.cursor,e);this.out.attr(n,"tag",t.tag),t.has_attrs&&this.tag_attributes(n,t),this.out.set_value_start(n,t.end),this.html_tag_stack.push({id:n,tag:t.tag}),t.lines&&this.note_tag_end(t.end),this.node_stack.push(n),this.states.push(26),this.html_block_depth++,this.chomp(t.end,!0)}return 1}fence_ends_elements(){let e=this.states,t=e.length-1;for(;t>=0&&e[t]===26;)t--;if(t<0||e[t]!==28)return 0;let r=this.directive_colon_counts,n=this.try_parse_directive_close(this.cursor,r[r.length-1]);if(n===-2)return-1;if(n<0)return 0;let s=this.html_tag_stack;for(let i=e.length-1;i>t;i--){let o=this.node_stack.pop(),a=s.length-1;for(;a>=0&&s[a].id!==o;)a--;a!==-1&&(s.length=a),this.html_block_depth--,e.pop()}return this.revoke_stale_pending(!1),1}leave_html_block(e){let t=this.html_tag_stack;t.length>0&&t[t.length-1].id===e&&t.pop(),this.html_block_depth--,this.states.pop(),this.node_stack.pop()}_run_html_block_element(e,t){let r=this.source,n=this.source_base,s=this.source_end;if(!e)return this.finished?(this.leave_html_block(t),!1):!0;if(e===gn){if(!this.finished&&de.call(r,">",this.cursor+1-n)===-1)return this.wait_for(">"),!0;let a=this.try_parse_html_close_tag(this.cursor+1);if(a===null&&this.tag_wait)return!0;if(a){let l=this.find_html_opener(a.tag);if(l!==-1&&this.html_tag_stack[l].id===t){for(;this.html_tag_stack.length>l+1;){let _=this.html_tag_stack.pop();this.is_closed(_.id)||(this.out.set_value_end(_.id,this.cursor),this.emit_close(_.id,this.cursor))}return this.html_tag_stack.pop(),this.pending_remove(t),this.out.set_value_end(t,this.cursor),this.emit_close(t,a.end),this.html_block_depth--,this.node_stack.pop(),this.states.pop(),this.chomp(a.end,!0),!1}if(l!==-1)return this.close_outer_html(l,a.end),!1}}if(e===V){if(this.frames.length!==0){let a=this.container_lf(t);return a<0?!0:(a===0&&this.leave_html_block(t),!1)}return this.emit_bare_leaf(6,this.cursor,t,this.cursor+1),this.cursor++,!1}if(e===U||e===Q){let a=this.cursor;for(;a<s&&(v.call(r,a-n)===U||v.call(r,a-n)===Q);)a++;return a>=s&&!this.finished?!0:a<s&&v.call(r,a-n)===V&&this.frames.length===0?(this.emit_bare_leaf(6,this.cursor,t,a+1),this.chomp(a+1,!0),!1):(this.cursor=a,!1)}if(e===Ot&&this.svelte_block_depth>0){let a=this.branch_token_ends();if(a!==0)return a===-1}let i=this.block_start(e,t,-1,this.cursor);if(i!==0)return i===-1;if(e===Jt&&this.directive_colon_counts.length!==0){let a=this.fence_ends_elements();if(a!==0)return a===-1}if(this.in_phrasing(t))return this.open_spec_para(t,!0),!1;this.states.push(7);let o=this.emit_open(7,this.cursor,t);return this.node_stack.push(o),!1}_run_svelte_branch(e,t){let r=this.source,n=this.source_base,s=this.source_end;if(!e)return this.finished?(this.close_svelte_block(this.cursor),!1):!0;if(e===Ot){if(!this.finished&&this.probe_matching_brace(this.cursor+1)===-1)return!0;let a=this.try_parse_svelte_block_token(this.cursor);if(a){if(a.kind===":"){this.emit_close(this.svelte_branch_id,this.cursor),this.node_stack.pop();let l=this.emit_open(29,this.cursor,this.svelte_block_id);return this.out.attr(l,"tag",a.tag),(a.expr_start!==0||a.expr_end!==0)&&(this.out.set_value_start(l,a.expr_start),this.out.set_value_end(l,a.expr_end)),this.svelte_branch_id=l,this.node_stack.push(l),this.chomp(a.end,!0),!1}if(a.kind==="/"&&a.tag===this.svelte_block_tag)return this.close_svelte_block(a.end),this.chomp(a.end,!0),!1;if(a.kind==="#")return this.start_svelte_block(a,t),!1}}if(e===V){if(this.frames.length!==0){let a=this.container_lf(t);return a<0?!0:(a===0&&this.close_svelte_block(this.cursor),!1)}return this.emit_bare_leaf(6,this.cursor,t,this.cursor+1),this.cursor++,!1}if(e===U||e===Q){let a=this.cursor;for(;a<s&&(v.call(r,a-n)===U||v.call(r,a-n)===Q);)a++;return a>=s&&!this.finished?!0:a<s&&v.call(r,a-n)===V&&this.frames.length===0?(this.emit_bare_leaf(6,this.cursor,t,a+1),this.chomp(a+1,!0),!1):(this.cursor=a,!1)}let i=this.block_start(e,t,-1,this.cursor);if(i!==0)return i===-1;if(e===gn){let a=this.try_parse_html_close_tag(this.cursor+1);if(a===null&&this.tag_wait)return!0;if(a){let l=this.find_html_opener(a.tag);if(l!==-1)return this.close_outer_html(l,a.end),!1}}this.states.push(7);let o=this.emit_open(7,this.cursor,t);return this.node_stack.push(o),!1}_run_block_quote(e,t){if(this.source,this.source_base,this.source_end,!this.finished&&this.can_trim(this.node_stack.length)&&(this.trim_point=this.cursor),!e)return this.finished?(this.emit_close(t,this.cursor),this.states.pop(),this.node_stack.pop(),this.block_quote_depth--,this.pop_frame(),!1):!0;switch(e){case V:{if(this.frames[this.frames.length-1]!==0)return this.note_lf(t);if(!this.finished&&!this.can_decide_after_lf(this.cursor))return!0;let s=this.line_start(this.cursor+1);if(s<0)return!0;let i=this.line_pos;return s===this.frames.length?this.is_blank_at_pos(i)?(this.emit_bare_leaf(6,this.cursor,t,i),this.chomp(i,!0),!1):(this.chomp(i,!0),!1):(this.emit_close(t,this.cursor),this.states.pop(),this.node_stack.pop(),this.block_quote_depth--,this.pop_frame(),!1)}case U:case Q:return this.cursor++,!1}let r=this.block_start(e,t,-1,this.cursor);if(r!==0)return r===-1;this.states.push(7);let n=this.emit_open(7,this.cursor,t);return this.node_stack.push(n),(e>=128||e!==0&&Qe[e]===0)&&this.para_text(n),!1}note_label_end(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.in_table,i=e;for(;;){if(i>=n)return this.finished?0:-1;let o=v.call(t,i-r);if(o===as)return i===e?0:i;if(o<=U||o===Pr||o===On||o===Ye&&s)return 0;i++}}note_reference(e){let t=this.node_stack;for(let i=t.length-1;i>0;i--)if(this.kind_of(t[i])===13)return 0;let r=this.cursor,n=this.note_label_end(r+2);if(n<=0)return n;let s=this.emit_open(36,r,e);return this.out.attr(s,"label",je.call(this.source,r+2-this.source_base,n-this.source_base)),this.emit_close(s,n+1),l_(),this.chomp(n+1,!0),1}note_text_at(e){let t=this.source,r=this.source_base,n=this.note_label_end(e+2);if(n<=0||v.call(t,n+1-r)!==Jt)return 0;let s=n+2,i=v.call(t,s-r);for(;i===U||i===Q;)i=v.call(t,++s-r);return s>=this.source_end&&!this.finished?0:s}open_note(e,t){let r=this.source_base,n=this.cursor,s=this.lead_columns(n)+Sw,i=this.emit_open(37,n,e);this.out.attr(i,"label",je.call(this.source,n+2-r,de.call(this.source,"]",n+2-r))),l_(),this.block_quote_depth++,this.push_frame(s),this.node_stack.push(i),this.states.push(17),this.cold.note_pos=t,this.cold.note_column=s,this.chomp(t,!0)}note_lf(e){let t=this.source,r=this.source_base,n=this.source_end,s=n-r,i=this.frames.length-1,o=this.cursor,a=!1;for(;;){if(!this.finished&&!this.can_decide_after_lf(o))return!0;let l=this.line_start(o+1);if(l<0)return!0;if(l<i)break;let _=this.line_pos,c=os(t,_-r,s);for(;c===U||c===Q;)c=os(t,++_-r,s);if(_>=n){if(!this.finished)return!0;break}if(c!==V){a=l>i;break}o=_}return a?(this.chomp(this.line_pos,!0),!1):(this.emit_close(e,this.cursor),this.states.pop(),this.node_stack.pop(),this.block_quote_depth--,this.pop_frame(),!1)}_run_list_item(e,t){if(!this.finished&&this.can_trim(this.node_stack.length)&&(this.trim_point=this.cursor),!e)return this.finished?(this.end_list(),!1):!0;switch(e){case V:return this.item_lf(t);case U:case Q:return this.cold.task_pos===this.cursor&&this.cold.task_pos++,this.cursor++,!1;case Pr:{if(this.cold.task_pos!==this.cursor)break;let s=this.task_marker_end(this.cursor);if(s===-2)return!0;if(s<0)break;let i=this.unwrap_images?this.image_start(s):0;if(i<0)return!0;if(this.out.attr(t,"checked",v.call(this.source,this.cursor+1-this.source_base)!==U),this.chomp(s,!0),i>0)return this.open_image_para(t),!1;this.states.push(7);let o=this.emit_open_pending(7,this.cursor,t);return this.track_list_pending_para(o),this.node_stack.push(o),!1}}let r=this.block_start(e,t,-1,this.cursor);if(r!==0)return r===-1;this.states.push(7);let n=this.emit_open_pending(7,this.cursor,t);return this.track_list_pending_para(n),this.node_stack.push(n),(e>=128||e!==0&&Qe[e]===0)&&this.para_text(n),!1}item_lf(e){let t=this.source,r=this.source_base,n=this.source_end,s=n-r,i=this.frames.length-1;for(;;){let o=this.cursor,a=o===0||os(t,o-1-r,s)===V,l;for(;;){if(!this.finished&&!this.can_decide_after_lf(o)||(l=this.line_start(o+1),l<0))return!0;if(l<i)return this.end_list(),!1;let p=this.line_pos;if(this.interrupt_marker_pos===p)break;let m=os(t,p-r,s);for(;m===U||m===Q;)m=os(t,++p-r,s);if(p>=n)return this.finished?(this.end_list(),!1):!0;if(m!==V)break;a=!0,o=p}let _=this.line_pos;if(l>i)return a&&(this.list_is_loose=!0),this.chomp(_,!0),!1;let c=null;if(this.interrupt_marker_pos===_?c=this.interrupt_marker:Xo&&v.call(t,_-1-r)===V&&this.margin_marker(_)?c=this.interrupt_marker:this.is_thematic_break_start(_)||(c=this.try_parse_list_marker(_)),c===null||c.indent<this.list_marker_indent||c.ordered!==this.list_ordered||c.marker_char!==this.list_marker)return this.end_list(),!1;a&&(this.list_is_loose=!0),this.emit_close(e,this.cursor),this.node_stack.pop();let h=this.emit_open(16,_,this.list_node_id);if(this.node_stack.push(h),this.list_content_offset=c.content_offset,this.frames[this.frames.length-1]=c.content_offset,this.line_at=-1,this.chomp(c.content_start,!0),this.cold.task_pos=c.content_start,a&&!Xo)return!1;this.item_para(h);let d=this.states,f=this.cursor;if(!Xo||!this.finished||f>=n||d[d.length-1]!==18||this.pending_count!==this.pending_para_count||os(t,f-r,s)!==V)return!1;e=h}}block_start(e,t,r,n){let s=this.source,i=this.source_base,o=this.source_end,a=r>=0;switch(e){case pn:return a?this.is_heading_start(n)?1:0:this.start_heading(t)?1:-1;case be:return a?this.is_fence_start(n)?1:0:(this.start_fence(t),1);case er:{if(a)return 1;let l=this.cursor+1;l<o&&v.call(s,l-i)===U&&l++,this.block_quote_depth++,this.push_frame(0);let _=this.emit_open(14,this.cursor,t);return this.node_stack.push(_),this.states.push(17),this.chomp(l,!0),1}case gn:{if(a)return this.tag_interrupts(n)?1:0;if(!this.finished&&de.call(s,">",this.cursor+1-i)===-1)return this.wait_for(">"),-1;if(this.try_parse_uri_autolink(this.cursor+1)!==-1)return 0;let l=this.try_parse_html_comment(this.cursor+1);if(l===!1)return this.cursor+3<o&&this.wait_for("-->"),-1;if(l){let _=l.end,c=v.call(s,_-i);for(;c===U||c===Q;)c=v.call(s,++_-i);if(_>=o){if(!this.finished)return-1}else c!==V&&(this.open_spec_para(t,this.in_phrasing(t)),t=this.spec_para);let h=this.emit_open(26,this.cursor,t);return this.out.text(h,l.content_start,l.content_end,26),l.text!==null&&this.out.attr(h,"text",l.text),this.emit_close(h,l.end),this.chomp(l.end,!0),1}return this.open_block_tag(t)}case gt:case Gr:case qr:{if(a)return this.is_thematic_break_start(r)||e!==qr&&this.is_list_item_start_interrupt(r)?1:0;if(this.could_be_thematic_break(this.cursor,e))return-1;if(this.is_thematic_break_start(this.cursor)){let l=this.cursor;for(;l<o&&v.call(s,l-i)!==V;)l++;return l<o&&this.states.length===1&&l++,this.emit_bare_leaf(11,this.cursor,t,l),this.chomp(l,!0),1}if(e!==qr){let l=this.try_parse_list_marker(this.cursor);if(l&&this.opens_list(l))return this.start_list(l,t),1}return 0}case Ye:{if(a)return 0;let l=this.try_start_table(t);return l===!1?-1:l===!0?1:0}case Ot:{if(a){let _=v.call(s,n+1-i);return _===pn?w_(v.call(s,n+2-i))?1:0:this.svelte_block_depth===0?0:_===Jt||_===kt&&this.closes_block(n)?1:0}if(!this.finished&&this.probe_matching_brace(this.cursor+1)===-1)return-1;let l=this.try_parse_svelte_block_token(this.cursor);return l&&l.kind==="#"?(this.start_svelte_block(l,t),1):this.at_svelte_tag(e)?(this.open_spec_para(t,this.in_phrasing(t)),1):0}case Pr:{let l=v.call(s,n+1-i)===On;if(a)return l&&this.note_text_at(n)>0?1:0;if(!this.finished&&de.call(s,`
116
+ `,this.cursor-i)===-1)return-1;if(l){let c=this.note_text_at(n);if(c>0)return this.open_note(t,c),1}let _=this.try_parse_link_ref_definition(this.cursor,t);return _===-2?-1:_>=0?(this.chomp(_,!0),1):this.unwrap_images?this.open_image_para(t):0}case Jt:{if(a)return v.call(s,n+1-i)===Jt?1:0;let l=this.try_parse_block_directive(this.cursor);return l===!1?(this.cold.label_start!==-1&&this.guess_label(t),-1):l!==null?(this.start_block_directive(l,t),1):0}case Zi:return a?0:this.unwrap_images?this.open_image_para(t):0;default:{if(a)return this.is_list_item_start_interrupt(r)?1:0;if(e===bl||e>=48&&e<=57){if(!this.finished&&this.plus_marker_pending(this.cursor))return-1;let l=this.try_parse_list_marker(this.cursor);if(l&&this.opens_list(l))return this.start_list(l,t),1}return 0}}}opens_list(e){let t=this.states;return t[t.length-1]!==18||e.indent>=this.list_content_offset}_run_directive_container(e,t){let r=this.source,n=this.source_base,s=this.source_end;if(this.inline_range_parse&&this.kind_of(t)===35)return e?(this.states.push(8),!1):!0;if(!e)return this.finished?(this.emit_close(t,this.cursor),this.node_stack.pop(),this.states.pop(),this.directive_colon_counts.pop(),!1):!0;let i=this.directive_colon_counts[this.directive_colon_counts.length-1];switch(e){case V:{if(!this.finished&&!this.can_decide_after_lf(this.cursor))return!0;if(this.frames.length!==0){let l=this.container_lf(t);return l<0?!0:(l===0&&(this.emit_close(t,this.cursor),this.node_stack.pop(),this.states.pop(),this.directive_colon_counts.pop()),!1)}return this.emit_bare_leaf(6,this.cursor,t,this.cursor+1),this.cursor++,!1}case U:case Q:{let l=this.cursor;for(;l<s&&(v.call(r,l-n)===U||v.call(r,l-n)===Q);)l++;return l>=s&&!this.finished?!0:l<s&&v.call(r,l-n)===V?(this.emit_bare_leaf(6,this.cursor,t,l+1),this.chomp(l+1,!0),!1):(this.cursor++,!1)}case Jt:{let l=this.try_parse_directive_close(this.cursor,i);if(l===-2)return!0;if(l>=0){let _=this.frames.length!==0&&v.call(r,l-1-n)===V?l-1:l;return this.emit_close(t,_),this.node_stack.pop(),this.states.pop(),this.directive_colon_counts.pop(),this.chomp(_,!0),!1}break}case gn:{if(this.html_tag_stack.length!==0){let l=this.close_outer_tag();if(l!==0)return l===-1}break}case Ot:{if(this.svelte_block_depth>0){let l=this.branch_token_ends();if(l!==0)return l===-1}break}}let o=this.block_start(e,t,-1,this.cursor);if(o!==0)return o===-1;this.states.push(7);let a=this.emit_open(7,this.cursor,t);return this.node_stack.push(a),!1}_run_frontmatter(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.cursor>0?this.cursor-1:0,i=de.call(t,`
117
+ ---`,s-r),o=i===-1?-1:i+r;if(o===-1){if(!this.finished)return this.wait_for(`
118
+ ---`),!0;this.frontmatter_failed=!0;let c=this.node_stack.pop();return this.states.pop(),this.out.revoke(c),this.chomp(0,!0),!1}let a=o+4,l=a,_=v.call(t,l-r);for(;_===U||_===Q;)_=v.call(t,++l-r);if(l>=n&&!this.finished)return!0;if(_===V||_!==_){let c=e,h=_===V?l+1:l;return this.out.set_value_end(c,o+1),this.emit_close(c,h),this.node_stack.pop(),this.states.pop(),this.chomp(h,!0),!1}return this.chomp(a,!0),!1}try_start_table(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.cursor,i=s;for(;i<n;){let j=v.call(t,i-r);if(j!==U&&j!==Q)break;i++}i<n&&v.call(t,i-r)===Ye&&i++;let o=this.cold.table_bounds;o===null&&(o=this.cold.table_bounds=new Int32Array(16));let a=0,l=i,_=-1,c=i,h=!0,d=n;for(;i<n;){let j=v.call(t,i-r);if(j<128&&Qe[j]!==0){if(j===V){d=i;break}if(j===Ye)a+4>o.length&&(o=this.grow_table_bounds(o)),o[a]=l,o[a+1]=i,o[a+2]=_<0?i:_,o[a+3]=_<0?i:h?c:~c,a+=4,l=i+1,_=-1,h=!0;else if(h=!1,_<0&&(_=i),c=i+1,j===bt&&i+1<n){let P=v.call(t,i+1-r);P!==V&&(i++,P!==U&&P!==Q&&(c=i+1))}}else j!==U&&j!==Q&&(j===0&&(h=!1),_<0&&(_=i),c=i+1);i++}if(d>=n&&!this.finished)return this.wait_for(`
119
+ `),!1;if(_>=0&&(a+4>o.length&&(o=this.grow_table_bounds(o)),o[a]=l,o[a+1]=d,o[a+2]=_,o[a+3]=h?c:~c,a+=4),a===0)return null;let f=a>>2,p=d+1;if(p>=n&&!this.finished)return!1;let m=this.frames.length!==0;if(m&&p<n){let j=this.line_start(p);if(j<0)return!1;if(j<this.frames.length)return null;p=this.line_pos}let g=n;if(p<n){let j=de.call(t,`
120
+ `,p-r);j!==-1&&(g=j+r)}if(g>=n&&!this.finished)return this.wait_for(`
121
+ `),!1;let b=this.parse_delimiter_row(p,g,f);if(b===null)return null;let k=b.length,x=this.table_bound_l,w=this.table_bound_r;this.table_bound_l=-1,this.table_bound_r=-1;let O=-1,N=-1,S=-1,D=-1;if(x>=0){if(O=x,x>=k||o[O<<2]!==o[(O<<2)+1])return null;if(w>=0){if(N=w+1,w>=k||o[N<<2]!==o[(N<<2)+1])return null;S=x,D=w}else x<=k-x?S=x:D=x}let X=this.emit_open(22,s,e);this.out.attr(X,"alignments",b),this.out.attr(X,"col_count",k),x>=0&&this.out.attr(X,"header_columns",[S<0?0:S,D<0?0:k-D]),this.table_col_count=k,this.table_node_id=X,this.table_bound_l=S,this.table_bound_r=D,this.in_table=!0;let G=this.cold;G.table_rowspans!==null&&G.table_rowspans.clear();let H=this.emit_open(23,s,X),R=0;for(let j=0;j<f;j++){if(j===O||j===N)continue;let P=o[j<<2],M=o[(j<<2)+1],F=o[(j<<2)+2],Z=o[(j<<2)+3];this.table_cell_id=this.emit_open(25,P,H,R);let re=1;for(let ie=j+1;ie<f;ie++){let we=R+re;if(we>=k||we===S||we===D||ie===O||ie===N)break;let _e=o[(ie<<2)+2];if(o[(ie<<2)+3]!==_e+1||v.call(t,_e-r)!==er)break;re++}if(re>1&&(this.out.attr(this.table_cell_id,"colspan",re),this.table_spans()),Z>=0?F<Z&&(this.emit_leaf(1,F,this.table_cell_id,F,Z,Z),this.interrupt_pos=-1,this.loop_without_progress=0):(Z=~Z,this.node_stack.push(this.table_cell_id),this.table_cell_has_content=!0,this.parse_inline_range(F,Z),this.node_stack.pop()),re>1){j+=re-1,this.emit_close(this.table_cell_id,o[(j<<2)+1]),R+=re;continue}this.emit_close(this.table_cell_id,M),R++}this.emit_close(H,d),this.table_cur=0;for(let j=k;j<k<<1;j++)o[j]=0;this.node_stack.push(X),this.states.push(23);let W=g<n&&!m?g+1:g;return this.chomp(W,!0),!0}grow_table_bounds(e){let t=new Int32Array(e.length<<1);return t.set(e),this.cold.table_bounds=t,t}stalled(){let e=this.states.length;return this.cursor!==this.prev_cursor?(this.prev_cursor=this.cursor,this.prev_depth=e,this.loop_without_progress=0,!1):e<this.prev_depth?(this.prev_depth=e,this.loop_without_progress=0,!1):(this.loop_without_progress+=64,this.loop_without_progress>100)}para_text(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.cursor;for(;;){let i=this.text_run(s+1);if(i<n&&v.call(t,i-r)===V){let a=this.block_quote_depth>0,l=!a&&!this.finished&&!this.can_decide_after_lf(i);if(!l||this.list_depth>0){if(l&&this.states.push(8),this.emit_leaf(1,s,e,s,i,i),l||a&&!(Xo&&this.finished)){this.cursor=i;return}if(this.para_line(i)===1){this.emit_close(e,i),this.states.pop(),this.node_stack.pop(),this.cursor=i;return}this.emit_bare_leaf(18,i,e,i+1);let _=i+1;if(a)_=this.skip_spaces(this.line_pos),this.class_floor=-1;else for(;_<n&&v.call(t,_-r)===U;)_++;let c=_<n?v.call(t,_-r):0;if(!(c>=128||c!==0&&Qe[c]===0)){this.states.push(8),this.cursor=_;return}s=_;continue}}let o=this.emit_open(1,s,e);this.out.set_value_start(o,s),this.states.push(8),this.node_stack.push(o),this.states.push(1),this.cursor=i;return}}table_cells(){let e=this.source,t=this.source_base,r=this.source_end;for(;;){let n=this.cursor;for(;n<r;){let _=v.call(e,n-t);if(_!==U&&_!==Q)break;n++}if(this.cursor=n,n>=r){this.finished||this.wait_table_cell(n);return}let s=v.call(e,n-t);if(s>=128||s!==0&&Qe[s]===0&&s!==er){if(this.table_cell_has_content=!0,!this.table_cell_text(this.table_cell_id))return}else if(s===be){if(!this.table_cell_code(n))return}else if(s===er||s===On){let _=this.table_merge(s);if(_===2){this.wait_table_cell(n),this.cursor=r;return}if(_===0&&(s===On||(this.table_cell_has_content=!0,!this.table_cell_text(this.table_cell_id))))return}else return;if(v.call(e,this.cursor-t)!==Ye)return;let i=this.table_cell_col+1,o=i===this.table_bound_l||i===this.table_bound_r;if(o&&this.cursor+1>=r&&!this.finished)return;this.close_table_cell(),this.table_cell_col=i;let a=this.cursor+1;if(o&&v.call(e,a-t)===Ye&&a++,this.cursor=a,i>=this.table_col_count)return;let l=this.emit_open(25,a,this.table_row_id,i);this.table_cell_id=l,this.cold.table_bounds[this.table_cur+i]=l,this.table_cell_has_content=!1,this.node_stack.push(l)}}skip_extra_cells(){let e=this.source,t=this.source_base,r=this.source_end,n=this.cursor+1;for(;n<r&&v.call(e,n-t)!==V;)n++;this.cursor=n}wait_table_cell(e){this.wait_kind=7,this.cold.wait_cursor=e}table_cell_resume(){this.cursor=this.cold.wait_cursor,this.table_cells()}table_pipe(){let e=this.table_cell_col+1,t=e===this.table_bound_l||e===this.table_bound_r;if(t&&this.cursor+1>=this.source_end&&!this.finished)return!1;e<=this.table_col_count&&this.close_table_cell(),this.table_cell_col=e;let r=this.cursor+1;if(t&&v.call(this.source,r-this.source_base)===Ye&&r++,this.cursor=r,e<this.table_col_count){let n=this.emit_open(25,r,this.table_row_id,e);this.table_cell_id=n,this.cold.table_bounds[this.table_cur+e]=n,this.table_cell_has_content=!1,this.node_stack.push(n)}return!0}table_cell_code(e){let t=this.source,r=this.source_base,n=this.source_end;this.table_cell_has_content=!0,this.states.push(8);let s=e+1;s<n&&v.call(t,s-r)===be&&s++;let i=s-e;if(s>=n)return!1;let o=v.call(t,s-r);if(o===be||o===U||o===pn||o===V||o===Ye)return!1;let a=s+1;for(;a<n;){let h=v.call(t,a-r);if(h===be||h===V||h===Ye)break;a++}if(a>=n||v.call(t,a-r)!==be)return!1;let l=a+1;for(;l<n&&v.call(t,l-r)===be;)l++;if(l-a!==i||l>=n)return!1;let _=this.table_cell_id;this.emit_leaf(8,e,_,s,a,l),this.extra=i,this.code_span_open_pos=e,this.cursor=l;let c=v.call(t,l-r);return c===0||c<128&&Qe[c]!==0?!1:(this.states.pop(),this.table_cell_text(_))}table_cell_text(e){let t=this.source,r=this.source_base,n=this.source_end,s=this.cursor,i=s,o=s+1,a=o<n?v.call(t,o-r):0;if(a!==0)for(;;){if(a<=U){if(a===V)break;o++,a!==U&&a!==Q&&(i=o)}else{if(a<128&&Qe[a]!==0)break;o++,i=o}if(o>=n)break;a=v.call(t,o-r)}if(o<n&&(a===Ye||a===V))return i===s&&(i=this.blank_run_end(s+1)),i>s&&this.emit_leaf(1,s,e,s,i,o),this.cursor=o,!0;if(i===s&&o>=n){let _=v.call(t,s-r);if(_===U||_===Q)return this.finished?(this.cursor=o,!0):(this.states.push(8),!1)}let l=this.emit_open(1,s,e);return this.out.set_value_start(l,s),this.states.push(8),this.node_stack.push(l),this.states.push(1),this.cursor=o,!1}table_cell_padding(){let e=this.source,t=this.source_base,r=this.source_end,n=this.cursor+1;for(;n<r;){let s=v.call(e,n-t);if(s!==U&&s!==Q)break;n++}if(n>=r){if(!this.finished)return 2}else{let s=v.call(e,n-t);if(s!==Ye&&s!==V)return 0}return this.cursor=n,1}blank_run_end(e){let t=this.source,r=this.source_base;for(;e>0;){let n=v.call(t,e-1-r);if(n!==U&&n!==Q)break;e--}return e}parse_delimiter_row(e,t,r){let n=this.source,s=this.source_base,i=e,o=i<t?v.call(n,i-s):-1;for(;o===U||o===Q;)i++,o=i<t?v.call(n,i-s):-1;o===Ye&&(i++,o=i<t?v.call(n,i-s):-1);let a=[],l=-1,_=-1,c=r;for(;i<t;){for(;o===U;)i++,o=i<t?v.call(n,i-s):-1;if(i>=t||o===Ye&&i+1>=t)break;let h=!1;o===Jt&&(h=!0,i++,o=i<t?v.call(n,i-s):-1);let d=i;for(;o===Gr;)i++,o=i<t?v.call(n,i-s):-1;if(i===d){if(o!==Ye||a.length===0||v.call(n,i-1-s)!==Ye||_>=0)return null;l<0?l=a.length:_=a.length,c--,i++,o=i<t?v.call(n,i-s):-1;continue}let f=!1;for(o===Jt&&(f=!0,i++,o=i<t?v.call(n,i-s):-1);o===U;)i++,o=i<t?v.call(n,i-s):-1;if(i<t){if(o!==Ye)return null;i++,o=i<t?v.call(n,i-s):-1}if(a.length===c)return null;h&&f?a.push("center"):f?a.push("right"):h?a.push("left"):a.push("none")}return a.length!==c?null:(this.table_bound_l=l,this.table_bound_r=_,a)}parse_inline_range(e,t,r=24){let n=this.cursor,s=this.finished,i=this.class_floor;this.cursor=e,this.finished=!0,this.class_floor=e,this.range_next_class=Cn(e+1<this.source_end?v.call(this.source,e+1-this.source_base):NaN);let o=this.states.length;this.states.push(r),this.states.push(8);let a=this.source,l=this.source_end;this.source=je.call(this.source,0,t-this.source_base),this.source_end=this.source_base+this.source.length,this.inline_range_parse=!0;let _=this.html_tag_stack;_.length!==0&&(this.html_tag_stack=[]),this._run(),this.source=a,this.source_end=l,this.inline_range_parse=!1,this.html_tag_stack=_,this.unwind_range(o,t),this.cursor=n,this.finished=s,this.class_floor=i,this.interrupt_pos=-1,this.interrupt_marker_pos=-1}unwind_range(e,t){for(;this.states.length>e;){let r=this.states[this.states.length-1];if(r===1||r===15||r===14||r===19||r===20||r===21||r===22){let n=this.node_stack[this.node_stack.length-1];this.out.set_value_end(n,t),this.emit_close(n,t),this.kind_of(n)===30&&this.directive_text_pop(n),this.node_stack.pop()}this.states.pop()}}unwind_inline_for_table(){for(;this.states.length>0;){let e=this.states[this.states.length-1];if(e===24)break;if(e===1){let t=this.node_stack[this.node_stack.length-1],r=this.cursor;for(;r>0&&(v.call(this.source,r-1-this.source_base)===U||v.call(this.source,r-1-this.source_base)===Q);)r--;this.out.set_value_end(t,r),this.emit_close(t,this.cursor),this.node_stack.pop(),this.states.pop()}else if(e===8)this.states.pop();else{let t=this.node_stack[this.node_stack.length-1];if(this.pending_has(t)){if(this.kind_of(t)===2){let n=this.pending_starts[this.id_slots[t]];this.out.revoke(t,this.html_open_tag_text(n),this.one_shot?n:void 0)}else this.out.revoke(t);this.pending_remove(t)}else this.out.set_value_end(t,this.cursor),this.emit_close(t,this.cursor);this.kind_of(t)===30&&this.directive_text_pop(t);let r=this.html_tag_stack;r.length!==0&&r[r.length-1].id===t&&r.pop(),this.node_stack.pop(),this.states.pop()}}}close_table_cell(){let e=this.table_cell_id;e!==0&&(this.emit_close(e,this.cursor),this.node_stack[this.node_stack.length-1]===e&&this.node_stack.pop())}pad_and_close_row(){let e=this.cold.table_bounds,t=this.table_cur;for(let r=this.table_cell_col;r<this.table_col_count;r++){let n=this.emit_open(25,this.cursor,this.table_row_id,r);this.emit_close(n,this.cursor),e[t+r]=n}this.emit_close(this.table_row_id,this.cursor),this.table_cur=t===0?this.table_col_count:0}table_merge(e){if(this.inline_range_parse||this.table_cell_col>=this.table_col_count)return 0;let t=this.source,r=this.source_base,n=this.source_end,s=this.cursor+1;for(;s<n;){let f=v.call(t,s-r);if(f!==U&&f!==Q)break;s++}if(s>=n){if(!this.finished)return 2}else{let f=v.call(t,s-r);if(f!==Ye&&f!==V)return 0}let i=this.table_cell_col,o=this.cold,a=o.table_bounds,l=this.table_cur,_=l===0?this.table_col_count:0,c;if(e===er){if(i===0||i===this.table_bound_l||i===this.table_bound_r||(c=a[l+i-1],c===a[_+i-1]))return 0;let f=i-1;for(;f>0&&a[l+f-1]===c;)f--;this.out.attr(c,"colspan",i-f+1)}else{if(c=a[_+i],c===0)return 0;let f=i;for(;f>0&&a[_+f-1]===c;)f--;if(f<i){if(a[l+i-1]!==c)return 0}else{let p=i+1;for(;p<this.table_col_count&&a[_+p]===c;)p++;if(p>i+1){let b=this.table_merge_rest(s,p-i-1);if(b!==1)return b}let m=o.table_rowspans;m===null&&(m=o.table_rowspans=new Map);let g=(m.get(c)??1)+1;m.set(c,g),this.out.attr(c,"rowspan",g)}}let h=this.table_cell_id;this.out.revoke(h),this.id_info[h]|=Wo;let d=this.node_stack;return d[d.length-1]===h&&d.pop(),this.table_cell_id=0,this.table_cell_has_content=!0,a[l+i]=c,this.table_spans(),this.cursor=s,1}table_spans(){let e=this.cold,t=e.table_rowspans;t===null&&(t=e.table_rowspans=new Map),!t.has(0)&&(t.set(0,1),this.out.attr(this.table_node_id,"spans",!0))}table_merge_rest(e,t){let r=this.source,n=this.source_base,s=this.source_end;for(let i=0;i<t;i++){if(e>=s)return this.finished?0:2;if(v.call(r,e-n)!==Ye)return 0;for(e++;e<s;){let a=v.call(r,e-n);if(a!==U&&a!==Q)break;e++}if(e>=s)return this.finished?0:2;if(v.call(r,e-n)!==On)return 0;for(e++;e<s;){let a=v.call(r,e-n);if(a!==U&&a!==Q)break;e++}if(e>=s){if(!this.finished)return 2;continue}let o=v.call(r,e-n);if(o!==Ye&&o!==V)return 0}return 1}table_next_line(){let e=this.line_start(this.cursor+1);if(e<0)return-1;if(e<this.frames.length)return 0;let t=this.source,r=this.source_base,n=this.line_pos,s=n,i=v.call(t,s-r);for(;i===U||i===Q;)i=v.call(t,++s-r);return s>=this.source_end?this.finished?0:-1:i===V?0:(this.chomp(n,!0),1)}table_line_ends(){let e=this.source,t=this.source_base,r=this.cursor,n=v.call(e,r-t);for(;n===U||n===Q;)n=v.call(e,++r-t);return!this.finished&&(r>=this.source_end||n<128&&($l[n]&2)!==0&&de.call(e,`
122
+ `,r-t)===-1)?-1:this.line_interrupts(this.cursor)?1:(this.line_pos=n===Ye?r+1:this.cursor,0)}row_ends_at(e){let t=this.source,r=this.source_base,n=v.call(t,e-r);for(;n===U||n===Q;)n=v.call(t,++e-r);return n===V?1:e<this.source_end?0:this.finished?1:-1}row_end(){let e=de.call(this.source,`
123
+ `,this.cursor-this.source_base);return e!==-1?e+this.source_base:this.finished?this.source_end:-1}tag_fits_row(e,t){if(t!==-1&&e.end>t)return 0;if(!Yo(e.tag))return 1;let r=this.source_base,n=de.call(this.source,"</"+e.tag+">",e.end-r);return n!==-1&&(t===-1||n+r<t)?1:t===-1?-1:0}end_table(){this.states.pop(),this.close_table_node()}close_table_node(){this.emit_close(this.table_node_id,this.cursor),this.node_stack.pop(),this.table_col_count=0,this.table_node_id=0,this.table_row_id=0,this.table_cell_id=0,this.table_cell_col=0,this.table_bound_l=-1,this.table_bound_r=-1,this.in_table=!1}_finalize(){let e=this.source_end,t=this.finalized_below;for(let n=0;n<this.node_stack.length;n++){let s=this.node_stack[n];t>0&&!(s>=t)||!this.is_closed(s)&&!this.pending_has(s)&&(this.out.set_value_end(s,e),this.emit_close(s,e))}let r=this.cold.stale_html;for(let n=0;n<this.pending_count;n++){let s=this.pending_ids[n];this.kind_of(s)===2?r.push(s,this.pending_starts[n]):this.out.revoke(s)}r.length!==0&&this.revoke_stale_html(),this.ref_waiting!==null&&Av(),this.pending_count=0,this.pending_para_count=0,this.give_back_ids()}}var Pw=4;class T_ extends kf{#r="";#t=new Map;#e=new Map;set_source(e){this.#r=e,super.set_source(e)}open(e,t,r,n,s,i){if(t===Pw)this.#t.set(e,r);super.open(e,t,r,n,s,i)}close(e,t){if(this.#t.has(e))this.#e.set(e,t);super.close(e,t)}flush(){let e=super.flush();if(!this.#e.size)return e;let t=[];for(let r of e){let n=r[1];if(r[0]==="C"&&this.#e.has(n)){let s=this.#r.slice(this.#t.get(n),this.#e.get(n));t.push(["T",n,s]),this.#t.delete(n),this.#e.delete(n)}t.push(r)}return t}reset(){this.#t.clear(),this.#e.clear(),this.#r="",super.reset()}}class Al{id;#r=Le("");get kind(){return y(this.#r)}set kind(e){Me(this.#r,e,!0)}#t=Le(0);get extra(){return y(this.#t)}set extra(e){Me(this.#t,e,!0)}#e=Le(cr({}));get attrs(){return y(this.#e)}set attrs(e){Me(this.#e,e,!0)}#o=Le(cr([]));get children(){return y(this.#o)}set children(e){Me(this.#o,e,!0)}#n=Le(!1);get pending(){return y(this.#n)}set pending(e){Me(this.#n,e,!0)}#s=Le(!1);get closed(){return y(this.#s)}set closed(e){Me(this.#s,e,!0)}constructor(e,t="",r=0,n=!1){this.id=e,this.kind=t,this.extra=r,this.pending=n}}var qw=new Set(["paragraph","heading","code_fence","block_quote","list","list_item","thematic_break","table","line_break","definition","footnote_definition","directive_leaf","directive_container","frontmatter"]),Lw=new Set(["root","block_quote","list_item"]),Fw=new Set(["html","html_comment","svelte_tag","line_break","soft_break","hard_break"]),C_=(e)=>typeof e!=="string"&&qw.has(e.kind);function S_(e){let t=[];for(let r of e){let n=t.length-1;if(typeof r==="string"){if(!r)continue;if(typeof t[n]==="string")t[n]+=r;else t.push(r)}else t.push(r)}return t}var jw=(e)=>/[\ud800-\udbff]$/.test(e);class Tl{root=new Al(0,"root");#r=Le(!1);get finished(){return y(this.#r)}set finished(e){Me(this.#r,e,!0)}#t=new T_;#e=new A_(this.#t);#o="";#n="";#s="";#a=[];#i=new Map;#l=new Map;#u=-1;constructor(){this.#e.init(),this.root.kind="root"}static parse(e){let t=new Tl;return t.#_(e),t}#_(e){this.#n=this.#o=e,this.#t.set_source(El(e)),this.#e.parse(e),this.#d(this.#t.flush()),this.finished=!0}sync(e,t=!1){if(this.finished&&(!t||e!==this.#n))this.reset();if(!this.#n.length&&t)return this.#_(e);if(e.length<this.#n.length||!e.startsWith(this.#n))this.reset();if(this.feed(e.slice(this.#n.length)),t)this.finish()}get blocks(){return this.root.children.filter((e)=>typeof e!=="string"&&e.kind!=="line_break")}feed(e){if(this.finished)return;this.#n+=e;let t=this.#s+e;if(this.#s="",jw(t))this.#s=t.slice(-1),t=t.slice(0,-1);if(!t)return;this.#o+=t,this.#t.set_source(El(this.#o)),this.#e.feed(t),this.#d(this.#t.flush())}finish(){if(this.finished)return;if(this.finished=!0,this.#s)this.#o+=this.#s,this.#e.feed(this.#s),this.#s="";this.#t.set_source(El(this.#o)),this.#e.finish(),this.#d(this.#t.flush())}reset(){this.#t=new T_,this.#e=new A_(this.#t),this.#e.init(),this.#o=this.#s=this.#n="",this.#i.clear(),this.#l.clear(),this.#u=-1,this.root.children=[],this.root.attrs={},this.root.closed=this.root.pending=!1,this.finished=!1}#d(e){for(let t of e)switch(t[0]){case"S":this.#a=t[1];break;case"O":this.#h(t[1],this.#a[t[2]]??String(t[2]),t[3],t[4]===1,t[5]);break;case"T":this.#m(t[1],t[2]);break;case"A":{let r=this.#i.get(t[1]);if(r)r.attrs[t[2]]=t[3];break}case"C":{let r=this.#i.get(t[1]);if(!r)break;if(r.closed=!0,t[2]!==1&&!(r.kind==="paragraph"&&r.pending))r.pending=!1;break}case"K":{let r=this.#i.get(t[1]);if(r)r.pending=!1;break}case"X":{let r=this.#i.get(t[1]);if(!r)break;this.#c(r.children),r.children=[];break}case"R":this.#p(t[1],t[2]??"");break}}#h(e,t,r,n,s){let i;if(r===-1)i=this.root,i.id=e,i.kind=t,i.extra=s,i.pending=n;else{let o=this.#i.get(r);if(!o)return;i=new Al(e,t,s,n),o.children.push(i),this.#l.set(e,o)}this.#i.set(e,i)}#m(e,t){let r=this.#i.get(e);if(!r||!t)return;let n=r.children.length-1;if(typeof r.children[n]==="string")r.children[n]+=t;else r.children.push(t)}#c(e){for(let t of e){if(typeof t==="string")continue;this.#c(t.children),this.#i.delete(t.id),this.#l.delete(t.id)}}#f(e,t){for(let r of e)if(typeof r!=="string")this.#l.set(r.id,t)}#p(e,t){let r=this.#i.get(e),n=this.#l.get(e);if(!r||!n)return;if(r.kind==="html"&&Lw.has(n.kind)){this.#g(r,n,t);return}let s=[...n.children],i=s.indexOf(r);if(i<0)return;let o=[...r.children];s.splice(i,1,t,...o),this.#f(o,n),n.children=S_(s),this.#i.delete(e),this.#l.delete(e)}#g(e,t,r){let n=[...t.children],s=n.indexOf(e);if(s<0)return;let i=s,o=s+1;while(i>0&&!C_(n[i-1]))i--;while(o<n.length&&!C_(n[o]))o++;let a=n.slice(i,s),l=n.slice(s+1,o),_=[...e.children],c=_.findIndex(C_);if(c<0)c=_.length;let h=_.slice(0,c),d=_.slice(c),f=[...a,r,...h,...l],p,m=d[0];if(typeof m==="object"&&m.kind==="paragraph")p=m,d.shift(),p.children=S_([...f,...p.children]),this.#i.delete(e.id),this.#l.delete(e.id);else p=e,e.kind="paragraph",e.attrs={},e.pending=!1,e.children=S_(f);this.#f(f,p);let g=[],b=[],k=()=>{let x=b.every((w)=>typeof w==="string"&&!w.trim()||typeof w!=="string"&&Fw.has(w.kind));if(!b.length)return;if(x)g.push(...b.filter((w)=>typeof w!=="string"));else{let w=new Al(this.#u--,"paragraph");w.closed=!0,w.children=S_(b),this.#i.set(w.id,w),this.#l.set(w.id,t),this.#f(w.children,w),g.push(w)}b=[]};for(let x of d)if(C_(x))k(),g.push(x);else b.push(x);k(),this.#f(g,t),this.#l.set(p.id,t),t.children=[...n.slice(0,i),p,...g,...n.slice(o)]}}var zw=(e)=>typeof e==="string"&&!e.trim();function wf(e,t){let r=e.children.filter((s)=>!zw(s)),n=r.length===1?r[0]:void 0;return typeof n==="object"&&n.kind===t}function xf(e,t){switch(e.kind){case"strong_emphasis":return t?.kind==="strong_emphasis"&&wf(t,"strong_emphasis")?"transparent":"strong";case"emphasis":if(t?.kind==="emphasis")return wf(t,"emphasis")?"transparent":"strong";return wf(e,"emphasis")?"strong":"emphasis";case"strikethrough":case"superscript":case"subscript":case"link":case"image":return e.kind;case"code_span":return"code";case"hard_break":return"break";case"soft_break":return"soft_break";case"mustache":return"literal";default:return"other"}}function Bn(e){if(typeof e==="string")return e;return e.children.map(Bn).join("")}var Cl=(e,t)=>e.children.filter((r)=>typeof r!=="string"&&r.kind===t);function $f(e){let t=[];for(let r of e.children){if(typeof r==="string")continue;if(r.kind==="table")for(let n of Cl(r,"table_row")){let s=Cl(n,"table_cell");t.push([s[0]?Bn(s[0]):"",s[1]?Bn(s[1]):""])}else if(r.kind==="list")for(let n of Cl(r,"list_item"))t.push(Zh(Bn(n).trim()))}return t}function O_(e){return Cl(e,"list_item").map((t)=>{let r=Cl(t,"list");return{name:t.children.filter((s)=>typeof s==="string"||s.kind!=="list").map(Bn).join("").trim(),children:r.flatMap(O_)}})}function Ef(e,t){let r=Math.max(0,Math.floor((t-e)/1000));if(r<60)return`${r}s ago`;let n=Math.floor(r/60);if(n<60)return`${n}m ago`;return`${Math.floor(n/60)}h ago`}var $s=(e)=>e<1000?String(e):`${(e/1000).toFixed(e<1e4?1:0)}k`,ta=(e)=>`$${e<0.01?e.toFixed(4):e.toFixed(2)}`,ra=(e)=>`${(e/1000).toFixed(1)}s`;function Sl(e){if(typeof e!=="string")return;try{let t=new URL(e);return["http:","https:","mailto:"].includes(t.protocol)?e:void 0}catch{return}}function Af(e){let t=Math.max(0,...e);return e.map((r)=>t>0?Math.max(0,r)/t:0)}var Tf=(e)=>e==="session"?"This session":"This workspace";function Cf(e){return`${e.turns} ${e.turns===1?"turn":"turns"} · `+`${e.requests} ${e.requests===1?"request":"requests"} · `+`${e.tools} tool calls · `+`${$s(e.input_tokens)} in / ${$s(e.output_tokens)} out`+(e.cost_usd?" · "+ta(e.cost_usd):"")+` · ${ra(e.duration_ms)}`}var Sf=1,Of=2;var Uw=Symbol("ANY"),ib=Symbol("ASCII"),ob=Symbol("DIGIT"),ab=Symbol("LETTER"),lb=Symbol("LOWER"),cb=Symbol("UPPER"),_b=Symbol("ALNUM"),ub=Symbol("SPACE"),hb=Symbol("WORD"),fb=Symbol("HEX"),db=Symbol("PUNCT"),pb=Symbol("PRINT"),mb=Symbol("CONTROL");function Gt(e,t,r,n){let s=128*t+r;e[s]===65535&&(e[s]=n)}function sb(e,t,r,n,s,i,o){let a=e.get(t);a===void 0&&(a=[],e.set(t,a));for(let l=0;l<a.length;l+=3)if(r<=a[l+1]&&n>=a[l])throw Error(`Grammar validation error in state "${i}": Multiple rules match ${o}. Rule ${a[l+2]} and rule ${s} both match this character.`);a.push(r,n,s)}function Bw(e){for(let t=1;t<e.length;t++){let r=e[t],n=t-1;for(;n>=0&&e[n].length<r.length;)e[n+1]=e[n],n--;e[n+1]=r}}function Hw(e){let t={name:e.name,states:{...e.states}},r={},n=new Map;for(let[s,i]of Object.entries(t.states)){let o=[];for(let a of i.rules??[])if(a.match_delimited){let l=a.match_delimited;if(l.start.length<2||l.start.charCodeAt(0)>=128||!l.open||!l.close||!l.end||!Number.isSafeInteger(l.max_length)||l.max_length<0||a.match||a.range||a.any||a.match_within||i.mode==="probe")throw Error(`Invalid match_delimited rule in state "${s}"`);o.push({...a,match:l.start})}else if(a.match_within){if(a.match_within.begin!==void 0)throw Error(`Grammar error in state "${s}" rule ${o.length}: match_within uses "start" not "begin". Change { begin: "..." } to { start: "..." }.`);let{start:l,end:_,escape:c,multiline:h}=a.match_within,d=JSON.stringify([l,_,c,h,a.token]),f=n.get(d),p=f??`__match_within_${n.size}`;if(n.set(d,p),o.push({match:a.match_within.start,token:a.token,state:p,seal:a.seal}),f)continue;let m=[];a.match_within.escape&&(m.push({match:a.match_within.escape,token:a.token,state:`${p}_escape`}),r[`${p}_escape`]={rules:[{range:[0,65535],token:a.token,exit:!0}]}),m.push({match:a.match_within.end,token:a.token,exit:!0}),m.push({range:a.match_within.multiline===!1?[[0,9],[11,65535]]:[0,65535],token:a.token}),r[p]={rules:m}}else o.push(a);t.states[s]={...i,rules:o}}return Object.assign(t.states,r),t}function Tt(e){return e}function yt(e){let t=Hw(e),r=Object.keys(t.states),n=new Map;r.forEach((G,H)=>n.set(G,H));let s=new Set;for(let G of r)(t.states[G].rules??[]).forEach((H)=>{H.token&&s.add(H.token)});let i=Array.from(s),o=new Map;if(i.forEach((G,H)=>o.set(G,H)),r.length>65534)throw Error(`Grammar exceeds state limit: ${r.length} states (max 65534, including states generated by match_within).`);let a=!1,l=r[0];(t.states[l].rules??[]).forEach((G,H)=>{G.exit&&!G.state&&console.warn(`Grammar warning: rule ${H} in root state "${l}" has exit:true but there is no parent state to return to. This exit will be a no-op.`)});let _=new Uint16Array(r.length*256*3);_.fill(65535);let c=new Uint16Array(128*r.length);c.fill(65535);let h=new Uint16Array(3*r.length);h.fill(65535);let d=new Uint8Array(r.length*256),f=new Uint8Array(r.length),p=new Map,m=new Map,g=new Map,b=new Set,k=new Set,x=new Map;r.forEach((G)=>{let H=t.states[G],R=n.get(G);if(R===void 0)throw Error(`State ${G} not found in state_map`);if(H.mode==="probe"&&(k.add(R),H.fallback)){let P=n.get(H.fallback);if(P===void 0)throw Error(`Grammar "${e.name??"unnamed"}": probe state "${G}" fallback references unknown state "${H.fallback}"`);x.set(R,P)}let W=Array(128);for(let P=0;P<128;P++)W[P]=null;H.rules.forEach((P,M)=>{let F=65535,Z=0;if(P.state&&P.exit){let _e=n.get(P.state);if(_e===void 0)throw Error(`Grammar "${e.name??"unnamed"}": state "${G}" rule ${M} references unknown state "${P.state}"`);F=_e,Z=2}else if(P.state){let _e=n.get(P.state);if(_e===void 0)throw Error(`Grammar "${e.name??"unnamed"}": state "${G}" rule ${M} references unknown state "${P.state}"`);F=_e,Z=1}else P.exit&&(Z=2);let re=65535;if(P.token){let _e=o.get(P.token);_e!==void 0&&(re=_e)}let ie=P.seal===!0||P.boundary===!0;ie&&(a=!0,d[R*256+M]=1);let we=3*((R<<8)+M);if(_[we]=F,_[we+1]=re,_[we+2]=Z,P.match){let _e=Array.isArray(P.match)?P.match:[P.match];for(let oe of _e)if(oe===ib)for(let Y=0;Y<128;Y++)Gt(c,R,Y,M);else if(oe===ob)for(let Y=48;Y<=57;Y++)Gt(c,R,Y,M);else if(oe===ab){for(let Y=65;Y<=90;Y++)Gt(c,R,Y,M);for(let Y=97;Y<=122;Y++)Gt(c,R,Y,M)}else if(oe===lb)for(let Y=97;Y<=122;Y++)Gt(c,R,Y,M);else if(oe===cb)for(let Y=65;Y<=90;Y++)Gt(c,R,Y,M);else if(oe===_b){for(let Y=48;Y<=57;Y++)Gt(c,R,Y,M);for(let Y=65;Y<=90;Y++)Gt(c,R,Y,M);for(let Y=97;Y<=122;Y++)Gt(c,R,Y,M)}else if(oe===ub)for(let Y of[32,9,10,13])Gt(c,R,Y,M);else if(oe===hb){for(let Y=48;Y<=57;Y++)Gt(c,R,Y,M);for(let Y=65;Y<=90;Y++)Gt(c,R,Y,M);for(let Y=97;Y<=122;Y++)Gt(c,R,Y,M);Gt(c,R,95,M)}else if(oe===fb){for(let Y=48;Y<=57;Y++)Gt(c,R,Y,M);for(let Y=65;Y<=70;Y++)Gt(c,R,Y,M);for(let Y=97;Y<=102;Y++)Gt(c,R,Y,M)}else if(oe===pb)for(let Y=32;Y<=126;Y++)Gt(c,R,Y,M);else if(oe===db)for(let[Y,Ee]of[[33,47],[58,64],[91,96],[123,126]])for(let ve=Y;ve<=Ee;ve++)Gt(c,R,ve,M);else if(oe===mb){for(let Y=0;Y<=31;Y++)Gt(c,R,Y,M);Gt(c,R,127,M)}else if(typeof oe=="string"){if(oe.length===1){let Y=oe.charCodeAt(0);Y<128?(Gt(c,R,Y,M),P.boundary&&b.add(256*R+M)):(sb(g,R,Y,Y,M,G,`non-ASCII character '${oe}' (code: ${Y})`),P.boundary&&b.add(256*R+M))}else if(oe.length>1){let Y=oe.charCodeAt(0);if(Y<128){let Ee=new Uint16Array(oe.length);for(let fe=0;fe<oe.length;fe++)Ee[fe]=oe.charCodeAt(fe);let ve={delimited:P.match_delimited,codes:Ee,length:oe.length,rule_idx:M,boundary:P.boundary};W[Y]||(W[Y]=[]),W[Y].push(ve)}}}}if(P.range){let _e=Array.isArray(P.range[0])?P.range:[P.range];for(let oe of _e){let Y=typeof oe[0]=="string"?oe[0].charCodeAt(0):oe[0],Ee=typeof oe[1]=="string"?oe[1].charCodeAt(0):oe[1],ve=Ee<127?Ee:127;for(let fe=Y;fe<=ve;fe++)Gt(c,R,fe,M);if(Ee>=128){let fe=Y<128?128:Y;sb(g,R,fe,Ee,M,G,`characters in range ${fe}..${Ee}`)}}}if(P.any){for(let oe=0;oe<128;oe++)c[128*R+oe]===65535&&(c[128*R+oe]=M);let _e=3*R;h[_e]=F,h[_e+1]=re,h[_e+2]=Z,ie&&(f[R]=1)}});let j=!1;for(let P=0;P<128;P++){let M=W[P];M!==null&&(M.length>1&&Bw(M),j=!0)}j&&m.set(R,W)});let w=new Uint8Array(r.length),O;if(k.forEach((G)=>{w[G]=1}),b.size>0){O=new Uint8Array(r.length*256);for(let G of b)O[G]=1}let N=new Uint8Array(r.length*256);for(let G of r){let H=n.get(G);if(w[H]===1)continue;let R=t.states[G].rules?.length??0;for(let W=0;W<R;W++){let j=H*256+W,P=3*j;_[P]===65535&&_[P+2]===0&&O?.[j]!==1&&(_[P+1]===65535?N[j]=2:d[j]!==1&&(N[j]=1))}}let S=new Map;for(let[G,H]of g)S.set(G,Int32Array.from(H));let D=[],X=[];for(let G=0;G<r.length;G++)D.push(m.get(G)),X.push(S.get(G));return{states:n,transitions:_,char_maps:c,keywords:p,token_types:i,patterns:m,fallback_transitions:h,non_ascii_ranges:S,patterns_by_state:D,non_ascii_by_state:X,probe_states:k,probe_mask:w,probe_fallbacks:x,boundary_rules:b.size>0?b:void 0,boundary_flags:O,run_kinds:N,has_seals:a,seal_flags:a?d:void 0,fallback_seal_flags:a?f:void 0}}var gb=1048576,N_=new Uint32Array(4096);function Yw(e,t,r){let n=t+r.start.length,s=n;for(;s<=n+r.max_length&&s<e.length;){if(e.startsWith(r.open,s)){let o=r.close+e.slice(n,s)+r.end,a=e.indexOf(o,s+r.open.length);return(a<0?e.length:a+o.length)-t}let i=e.charCodeAt(s);if(i<33||i>126||r.exclude.includes(e[s]))return 0;s++}return 0}var vb=[];function Gw(e){if(e<=N_.length)return N_;if(e>gb)return new Uint32Array(e);let t=Math.max(e,2*N_.length);return N_=new Uint32Array(Math.min(t,gb))}var bb=new WeakMap;function Ww(e){let t=bb.get(e);if(t!==void 0)return t;let r=1;for(let n of e.patterns_by_state)if(n!==void 0){for(let s of n)if(s!==null)for(let i of s)i.length>r&&(r=i.length)}return t=r+1,bb.set(e,t),t}function Xw(e,t,r=null,n=!1){let{transitions:s,char_maps:i,token_types:o,patterns_by_state:a,fallback_transitions:l,non_ascii_by_state:_,probe_states:c,probe_mask:h,probe_fallbacks:d,boundary_flags:f,run_kinds:p,has_seals:m,seal_flags:g,fallback_seal_flags:b}=t,k=e.length,x=r===null?Gw(3*k):new Uint32Array(3*k),w=0,O=vb.pop()??new Uint16Array(256),N=0,S=0,D=a[0],X=0,G=0,H=_[0],R=0,W=-1,j=65535,P=-1,M=null,F=null,Z=!1,re=n?k-Ww(t):k,ie=k,we=n?o.indexOf("comment"):-1,_e=we<0?0:k;for(;;){if(R>=k){if(M===null||!c||!c.has(S))break;M.pos<ie&&(ie=M.pos);let ye=d?.get(S);if(ye!==void 0)R=M.pos,O[M.stack_ptr]=M.state,N=M.stack_ptr+1,S=ye;else{let Ie=M.pos<<16|M.state<<8|M.rule_idx;F===null&&(F=new Set),F.add(Ie),Z=!0,R=M.pos,S=M.state,N=M.stack_ptr}M=null,D=a[S],X=128*S,G=256*S*3,H=_[S];continue}R>W&&(Z&&=(F.clear(),!1),W=R);let Ee=e.charCodeAt(R),ve=R,fe=h?!!h[S]:!(!c||!c.has(S));if(Ee<128){let ye=0,Ie=65535;if(Ie===65535&&D){let Ke=D[Ee];if(Ke){let rt=Ke.length;for(let Ze=0;Ze<rt;Ze++){let it=Ke[Ze],Xe=it.length;if(R+Xe>k){if(R<_e&&s[G+3*it.rule_idx+1]===we){let Fe=1;for(;R+Fe<k&&e.charCodeAt(R+Fe)===it.codes[Fe];)Fe++;R+Fe===k&&(_e=R)}continue}let ht=it.codes,dt=!0;for(let Fe=1;Fe<Xe;Fe++)if(e.charCodeAt(R+Fe)!==ht[Fe]){dt=!1;break}if(dt){if(it.boundary&&R+Xe<k){let De=e.charCodeAt(R+Xe);if(De>=97&&De<=122||De>=65&&De<=90||De>=48&&De<=57||De===95||De===36)continue}if(Z&&F.has(R<<16|S<<8|it.rule_idx))continue;let Fe=it.delimited?Yw(e,R,it.delimited):Xe;if(Fe===0)continue;ye=Fe,Ie=it.rule_idx;break}}}}let Se=Ie;if(Se===65535&&(Se=i[X+Ee]),Se!==65535){if(Ie===65535&&f!==void 0&&f[(S<<8)+Se]===1&&R+1<k){let Ke=e.charCodeAt(R+1);(Ke>=97&&Ke<=122||Ke>=65&&Ke<=90||Ke>=48&&Ke<=57||Ke===95||Ke===36)&&(Se=65535)}Ie===65535&&Z&&Se!==65535&&F.has(R<<16|S<<8|Se)&&(Se=65535)}if(Se!==65535){let Ke=p[(S<<8)+Se];if(Ke!==0&&ye===0&&!Z){if(Ke===2){for(R++;R<k;){let De=e.charCodeAt(R);if(De>127||i[X+De]!==Se||D!==void 0&&D[De]!==null)break;R++}continue}let Fe=s[G+3*Se+1];if(Fe===j&&R===P)R++;else{let De=3*w;x[De]=Fe,x[De+1]=R,w++,R++}for(;R<k;){let De=e.charCodeAt(R);if(De>127||i[X+De]!==Se||D!==void 0&&D[De]!==null)break;R++}x[3*(w-1)+2]=R,j=Fe,P=R;continue}let rt=G+3*Se,Ze=s[rt],it=s[rt+1],Xe=s[rt+2],ht=S;Xe===1&&Ze!==65535||Xe===2&&Ze!==65535?ht=Ze:Xe===2&&N>0?ht=O[N-1]:Ze!==65535&&(ht=Ze);let dt=h?!!h[ht]:!(!c||!c.has(ht));if(fe&&M&&!dt&&(M.resolved_state=ht,M.resolved_pos=R),!fe&&dt&&(M={pos:R,entry_pos:R+(ye||1),state:S,stack_ptr:N,rule_idx:Se,probe_state:ht,resolved_state:-1,resolved_pos:-1}),fe||it===65535)Xe===2?Xe===2&&Ze!==65535&&ye>0&&(R+=ye):R+=ye||1;else{let Fe=R+(ye||1);if(ye!==0||it!==j||R!==P||m&&g[256*S+Se]){let De=3*w;x[De]=it,x[De+1]=R,x[De+2]=Fe,w++}else x[3*(w-1)+2]=Fe;j=it,P=Fe,R=Fe}Xe===1?(O[N++]=S,S=Ze,fe&&M&&(M.resolved_state=S,M.resolved_pos=R),D=a[S],X=S<<7,G=3*(S<<8),H=_[S]):Xe===2?(Ze===65535?N>0&&(S=O[--N]):S=Ze,D=a[S],X=S<<7,G=3*(S<<8),H=_[S]):Ze!==65535&&(S=Ze,D=a[S],X=S<<7,G=3*(S<<8),H=_[S]),fe&&!dt&&M&&(R=M.pos,N=M.stack_ptr,Xe===1&&(O[N++]=M.state),M.resolved_pos>=re&&M.pos<ie&&(ie=M.pos),M=null,D=a[S],X=S<<7,G=3*(S<<8),H=_[S])}else R++}else{let ye=65535;if(H!==void 0){for(let Ie=0;Ie<H.length;Ie+=3)if(Ee>=H[Ie]&&Ee<=H[Ie+1]){ye=H[Ie+2];break}}if(ye!==65535){let Ie=G+3*ye,Se=s[Ie],Ke=s[Ie+1],rt=s[Ie+2],Ze=S;rt===1&&Se!==65535||rt===2&&Se!==65535?Ze=Se:rt===2&&N>0?Ze=O[N-1]:Se!==65535&&(Ze=Se);let it=h?!!h[Ze]:!(!c||!c.has(Ze));if(!fe&&it){if(Z&&F.has(R<<16|S<<8|ye)){R++;continue}M={pos:R,entry_pos:R+1,state:S,stack_ptr:N,rule_idx:ye,probe_state:Ze,resolved_state:-1,resolved_pos:-1}}if(fe||Ke===65535)rt!==2&&R++;else{let Xe=R+1;if(m&&g[256*S+ye]||Ke!==j||ve!==P){let ht=3*w;x[ht]=Ke,x[ht+1]=R,x[ht+2]=Xe,w++}else x[3*(w-1)+2]=Xe;j=Ke,P=Xe,R=Xe}rt===1?(O[N++]=S,S=Se,fe&&M&&(M.resolved_state=S,M.resolved_pos=R),D=a[S],X=128*S,G=256*S*3,H=_[S]):rt===2?(Se===65535?N>0&&(S=O[--N]):S=Se,D=a[S],X=128*S,G=256*S*3,H=_[S]):Se!==65535&&(S=Se,D=a[S],X=128*S,G=256*S*3,H=_[S]),fe&&!it&&M&&(R=M.pos,N=M.stack_ptr,rt===1&&(O[N++]=M.state),M.resolved_pos>=re&&M.pos<ie&&(ie=M.pos),M=null)}else if(l){let Ie=3*S,Se=l[Ie],Ke=l[Ie+1],rt=l[Ie+2],Ze=S;rt===1&&Se!==65535||rt===2&&Se!==65535?Ze=Se:rt===2&&N>0?Ze=O[N-1]:Se!==65535&&(Ze=Se);let it=h?!!h[Ze]:!(!c||!c.has(Ze));if(!fe&&it){if(Z&&F.has(R<<16|S<<8|255)){R++;continue}M={pos:R,entry_pos:R+1,state:S,stack_ptr:N,rule_idx:255,probe_state:Ze,resolved_state:-1,resolved_pos:-1}}if(fe||Ke===65535)rt!==2&&R++;else{let Xe=R+1;if(m&&b[S]||Ke!==j||ve!==P){let ht=3*w;x[ht]=Ke,x[ht+1]=R,x[ht+2]=Xe,w++}else x[3*(w-1)+2]=Xe;j=Ke,P=Xe,R=Xe}rt===1?(O[N++]=S,S=Se,fe&&M&&(M.resolved_state=S,M.resolved_pos=R),D=a[S],X=128*S,G=256*S*3,H=_[S]):rt===2?(Se===65535?N>0&&(S=O[--N]):S=Se,D=a[S],X=128*S,G=256*S*3,H=_[S]):Se!==65535&&(S=Se,D=a[S],X=128*S,G=256*S*3,H=_[S]),fe&&!it&&M&&(R=M.pos,N=M.stack_ptr,rt===1&&(O[N++]=M.state),M.resolved_pos>=re&&M.pos<ie&&(ie=M.pos),M=null)}else R++}}vb.push(O);let oe=3*w,Y={tokens:x.slice(0,oe),token_types:o};if(n){let Ee=Math.max(0,Math.min(re,ie)),ve=oe-3;for(;ve>=0&&x[ve+1]>=Ee;)ve-=3;if(ve>=0&&x[ve+2]>=Ee&&(Ee=x[ve+1]),Y.stable_end=Ee===0?0:e.lastIndexOf(`
124
+ `,Ee-1)+1,we>=0&&_e<k){let fe=oe-3;for(;fe>=0&&x[fe+2]>_e&&x[fe]!==we;)fe-=3;(fe<0||x[fe+2]<=_e)&&(Y.comment_cut=_e)}}return Y}function Kw(e,t){let r=Jw(e.plugins),n=t.indexOf("comment");return(s,i,o=!1,a=-1)=>{if(!(n<0)&&(!(s.indexOf("[!")<0)||o&&(a>=0||Zw(s,i,n))))return Qw(s,i,r,n,e.on_error,o,o?a:-1)}}function Zw(e,t,r){let n=t.tokens,s=n.length-3;return s>=0&&n[s]===r&&n[s+2]===e.length&&!Dl(e,n[s+1],e.length)}function Jw(e){let t=new Map;for(let r of e)for(let n of r.verbs){if(t.has(n))throw Error(`annotation: verb "${n}" claimed by multiple plugins`);t.set(n,r)}return t}var yi=class extends Error{constructor(e,t,r=!1){super(t),this.kind=e,this.pending=r}};function Qw(e,t,r,n,s,i,o){let a=t.tokens,l=a.length/3,_=[],c=-1,h=[],d=[],f=new Map,p=[],m=null,g=null,b=()=>(g===null&&(g=mx(a,n)),g),k=(M)=>{let F=f.get(M);return F===void 0&&(F=p.length,p.push(M),f.set(M,F)),F},x=()=>(m===null&&(m=hx(e)),m),w=(M,F,Z)=>{s?s({kind:M,message:F,position:Z}):typeof console<"u"&&typeof console.warn=="function"&&console.warn(`twinkleplop annotation [${M}] at line ${Z.line}: ${F}`)},O=(M,F)=>{let{start:Z,end:re,type:ie}=M;if(M.verbatim!==!0)return void w("malformed","overlay verbatim must be true",F);if(ie!==void 0&&(typeof ie!="string"||!ux(ie)))return void w("malformed","verbatim type must be one or more css class tokens",F);let we=e.indexOf(`
125
+ `,Z);we!==-1&&we<re?w("malformed","verbatim range spans a line break",F):Z<re&&h.push({start:Z,end:re,type:ie??"",marker:F})},N=new Map,S=(M,F)=>M+"\x00"+(F??""),D=(M)=>{let F=x();return{start:la(F,M.line),end:Il(F,M.line,e.length),start_line:M.line,end_line:M.line}},X=(M)=>M.line===x().length,G=(M,F)=>{let Z=x();switch(M.kind){case"wholeLine":return[D(F)];case"set":{let re=dx(M.scope,F,Z,e.length);if(re===null)throw new yi("malformed","set scope names a line that does not exist",!0);let ie=px(e,M.anchor,re.start,re.end,b());if(ie.length===0)throw new yi("anchor_not_found","set anchor matched zero occurrences",re.end>=e.length);let we=[];for(let _e of ie)we.push({start:_e.start,end:_e.end,start_line:si(Z,_e.start),end_line:si(Z,Math.max(_e.start,_e.end-1))});return we}case"range":{if(M.from===null||M.to===null)throw new yi("malformed","half-open range cannot be resolved outside a pair");let re=Nf(M.from,M.to,M.inclusive_start,M.inclusive_end,F,F,e,Z,b());if(re===null)throw new yi("anchor_not_found","anchor not found",X(F));return[re]}default:{let re=Lb(M,F,Z,e.length);if(re===null)throw new yi("malformed","unable to resolve marker range",!0);return[re]}}},H=(M,F)=>{let Z=yb(M,0,M.length);if(Z===null)throw new yi("malformed",`malformed argument: "${M}"`);return G(Z,F)},R=(M,F,Z,re,ie,we,_e)=>{let oe;try{oe=M.handle({verb:F,id:Z,args:re,range:ie,marker:we,standalone:_e,resolve:(Y)=>H(Y,we)[0],resolve_all:(Y)=>H(Y,we)})}catch(Y){return Y instanceof yi?i&&Y.pending||w(Y.kind,Y.message,we):w("malformed",`plugin "${F}" threw: ${Y instanceof Error?Y.message:String(Y)}`,we),!0}if(!oe)return!0;if(oe.overlays){for(let Y of oe.overlays)if(!(i&&Y.start>=0&&Y.end>e.length&&(Y.end=e.length,Y.start>=Y.end))){if(Y.start<0||Y.end>e.length)throw RangeError(`annotation: plugin "${F}" emitted an overlay outside the source (${Y.start}..${Y.end}, source length ${e.length})`);"verbatim"in Y?O(Y,we):rx(_,k,Y)}}if(oe.issues)for(let Y of oe.issues)w(Y.kind,Y.message,Y.position??we);return oe.consumed!==!1},W=(M,F,Z)=>{let re=F.marker,ie=yb(e,F.args_start,F.args_end);if(ie===null)return w("malformed",`malformed argument: "${e.slice(F.args_start,F.args_end)}"`,re),!1;if(ie.kind==="range"&&(ie.from===null||ie.to===null)){if(ie.from!==null){let fe=S(F.verb,F.id),ye=N.get(fe);return ye===void 0&&(ye=[],N.set(fe,ye)),ye.push({marker:re,verb:F.verb,id:F.id,from:ie.from,inclusive_start:ie.inclusive_start,standalone:Z}),!0}if(ie.to===null)return w("malformed","range with no anchors",re),!0;let oe=S(F.verb,F.id),Y=N.get(oe),Ee=Y&&Y.length>0?Y.pop():void 0;if(Ee===void 0)return w("unmatched_pair",`unmatched close for "[!${F.verb}${F.id?"#"+F.id:""}]"`,re),!0;let ve=Nf(Ee.from,ie.to,Ee.inclusive_start,ie.inclusive_end,Ee.marker,re,e,x(),b());return ve===null?(i&&X(re)||w("anchor_not_found","anchor not found",re),!0):R(M,F.verb,F.id,{kind:"range",from:Ee.from,to:ie.to,inclusive_start:Ee.inclusive_start,inclusive_end:ie.inclusive_end},ve,Ee.marker,Ee.standalone)}let we;try{we=G(ie,re)}catch(oe){if(oe instanceof yi)return i&&oe.pending||w(oe.kind,oe.message,re),!0;throw oe}let _e=!0;for(let oe of we)R(M,F.verb,F.id,ie,oe,re,Z)||(_e=!1);return _e},j=(M)=>{let F=r.get(M.verb);if(F===void 0)return;let Z=x(),re={start:e.length,end:e.length,line:Z.length},ie={kind:"wildcard"},we=M.from.kind==="wildcard"?{start:la(Z,M.marker.line),end:e.length,start_line:M.marker.line,end_line:Z.length}:Nf(M.from,ie,M.inclusive_start,!0,M.marker,re,e,Z,b());we!==null&&R(F,M.verb,M.id,{kind:"range",from:M.from,to:ie,inclusive_start:M.inclusive_start,inclusive_end:!0},we,M.marker,M.standalone)};for(let M=0;M<l;M++){if(a[3*M]!==n)continue;let F=a[3*M+1],Z=a[3*M+2];for(;M+1<l&&a[3*(M+1)]===n&&a[3*(M+1)+1]===Z;){let ve=a[3*(M+1)+2];if(e.charCodeAt(Z-1)===10&&!kx(e,Z,ve))break;M++,Z=ve}let re=[],ie=-1,we=i&&Z===e.length,_e=F;for(;_e<Z;){let ve=ix(e,_e,Z);if(ve<0)break;if(ve>F&&e.charCodeAt(ve-1)===92){_e=ve+2;continue}let fe=ox(e,ve,Z,x(),we);if(fe===na){ie=ve;break}if(fe===null){_e=ve+2;continue}let ye=r.get(fe.verb);ye===void 0?_e=fe.marker.end:fe.spans_newline?(w("marker_spans_newline","marker spans a newline",fe.marker),_e=fe.marker.end):fe.error===null?(re.push({parsed:fe,plugin:ye}),_e=fe.marker.end):(w(fe.error.kind,fe.error.message,fe.marker),_e=fe.marker.end)}if(we&&ie<0&&Z-1>=_e&&e.charCodeAt(Z-1)===91&&(Z-1===F||e.charCodeAt(Z-2)!==92)&&(ie=Z-1),we&&ie<0&&re.length===0&&e.charCodeAt(Z-1)!==10&&!Dl(e,F,Z)&&(ie=Z),re.length===0&&ie<0)continue;let oe=nx(re);ie>=0&&oe.push({start:ie,end:Z});let Y=$b(e,F,Z,oe),Ee=[];for(let{parsed:ve,plugin:fe}of re){let ye=ve.marker,Ie=Y&&sx(e,x(),ye.line,F,Z);(fe.parse==="raw"?R(fe,ve.verb,ve.id,e.slice(ve.raw_start,ve.args_end),D(ye),ye,Ie):W(fe,ve,Ie))&&Ee.push({start:ye.start,end:ye.end,line:ye.line})}if(ie>=0){let ve=si(x(),Math.min(ie,Z-1));Ee.push({start:ie,end:Z,line:ve})}if(Ee.length>0)if(we&&(c=F),$b(e,F,Z,Ee))tx(d,e,F,Z,x());else for(let ve of Ee)d.push(ve)}if(o>=0&&o<e.length){let M=si(x(),o);d.push({start:o,end:e.length,line:M}),c=o}for(let M of N.values())for(let F of M)i?j(F):w("unmatched_pair",`unmatched open for "[!${F.verb}${F.id?"#"+F.id:""}]"`,F.marker);if(h.length!==0){h.sort((F,Z)=>F.start-Z.start||F.end-Z.end);let M=0;for(let F of h)F.start<M?w("malformed","verbatim range overlaps another verbatim range",F.marker):ex(d,F.start,F.end)?w("malformed","verbatim range overlaps a hidden marker",F.marker):(M=F.end,_.push({start:F.start,end:F.end,class_id:k(F.type),flags:2}))}if(_.length===0&&d.length===0)return;let P=vx(_,p,d,e,x);return c>=0&&(P.undecided=c),P}function ex(e,t,r){for(let n of e)if(n.start<r&&n.end>t)return!0;return!1}function tx(e,t,r,n,s){let i=si(s,r),o=r;for(;;){let a=t.indexOf(`
126
+ `,o),l=a<0||a>=n?n:a,_=l;for(;_>o&&t.charCodeAt(_-1)===13;)_--;if(_>o&&e.push({start:o,end:_,line:i}),l===n)return;o=l+1,i++}}function rx(e,t,r){r.start>=r.end||e.push({start:r.start,end:r.end,class_id:t(r.classification),flags:+!!r.line_mode})}function nx(e){let t=[];for(let r=0;r<e.length;r++)t.push(e[r].parsed.marker);return t}function sx(e,t,r,n,s){let i=la(t,r),o=Il(t,r,e.length);return!(n>i&&Nl(e,i,n)||s<o&&Nl(e,s,o))}function ix(e,t,r){for(let n=t;n+1<r;n++)if(e.charCodeAt(n)===91&&e.charCodeAt(n+1)===33)return n;return-1}function ox(e,t,r,n,s=!1){let i=e.length,o=t+2,a=o;if(o>=i)return s?na:null;if(!jf(e.charCodeAt(o)))return null;for(o++;o<i&&xb(e.charCodeAt(o));)o++;if(o>=i&&s)return na;let l=e.slice(a,o),_;if(o<i&&e.charCodeAt(o)===35){o++;let f=o;if(o>=i&&s)return na;if(o>=i||!jf(e.charCodeAt(o)))return kb(0,t,o,n,l,void 0,{kind:"malformed",message:"expected identifier after `#`"});for(o++;o<i&&xb(e.charCodeAt(o));)o++;if(o>=i&&s)return na;_=e.slice(f,o)}let c=o,h=o,d=o;if(o<i&&e.charCodeAt(o)===32){o++,c=o,d=o;let f=!1;for(;o<i&&o<r;){let p=e.charCodeAt(o);if(p===10)break;if(p===92&&o+1<r&&e.charCodeAt(o+1)!==10)o+=2;else if(f)p===34&&(f=!1),o++;else if(p!==34){if(p===93)break;o++}else f=!0,o++}for(h=o;c<h;){let p=e.charCodeAt(c);if(p!==32&&p!==9&&p!==13)break;c++}for(;h>c;){let p=e.charCodeAt(h-1);if(p!==32&&p!==9&&p!==13)break;h--}}return o>=i||o>=r||e.charCodeAt(o)!==93?o<i&&e.charCodeAt(o)===10?kb(0,t,o,n,l,_,{kind:"marker_spans_newline",message:"marker not closed before newline"}):o>=i&&s?na:null:(o++,{verb:l,id:_,args_start:c,args_end:h,raw_start:d,marker:{start:t,end:o,line:si(n,t)},spans_newline:!1,error:null})}var na={verb:"",args_start:0,args_end:0,raw_start:0,marker:{start:0,end:0,line:0},spans_newline:!1,error:null};function kb(e,t,r,n,s,i,o){return{verb:s,id:i,args_start:r,args_end:r,raw_start:r,marker:{start:t,end:r,line:si(n,t)},spans_newline:o.kind==="marker_spans_newline",error:o}}function yb(e,t,r){if(t>=r)return{kind:"bare"};if(r-t===3&&e.charCodeAt(t)===42&&e.charCodeAt(t+1)===42&&e.charCodeAt(t+2)===42)return{kind:"wholeLine"};let n=e.charCodeAt(t);if(n===43){let s=to(e,t+1,r);return s===null||s<1?null:{kind:"lineCount",count:s}}return n===58?qb(e,t+1,r):n===61?ax(e,t+1,r):cx(e,t,r)}function qb(e,t,r){let n=wb(e,"...",t,r);if(n>=0){let a=to(e,t,n),l=to(e,n+3,r);return a===null||l===null||a<1||l<a?null:{kind:"lineRef",from:a,to:l,inclusive:!0}}let s=wb(e,"..",t,r);if(s<0){let a=to(e,t,r);return a===null||a<1?null:{kind:"lineRef",from:a}}let i=to(e,t,s),o=to(e,s+2,r);return i===null||o===null||i<1||o<i?null:{kind:"lineRef",from:i,to:o,inclusive:!1}}function ax(e,t,r){let n=sa(e,t,r),s=Ff(e,n,r);if(s===null||(n=sa(e,s.next,r),s.anchor.kind==="wildcard"))return null;if(n===r)return{kind:"set",anchor:s.anchor};let i=lx(e,n,r);return i===null?null:{kind:"set",anchor:s.anchor,scope:i}}function lx(e,t,r){let n=e.charCodeAt(t);if(n===43){let i=to(e,t+1,r);return i===null||i<1?null:{kind:"lineCount",count:i}}if(n!==58)return null;if(r-t===2&&e.charCodeAt(t+1)===42)return{kind:"all"};let s=qb(e,t+1,r);return s===null||s.kind!=="lineRef"?null:s}function cx(e,t,r){let n,s=sa(e,t,r),i=null;if(s<r&&e.charCodeAt(s)!==46){let l=Ff(e,s,r);if(l===null)return null;i=l.anchor,s=l.next}if(s=sa(e,s,r),s+3<=r&&e.startsWith("...",s))n=!0,s+=3;else{if(!(s+2<=r&&e.startsWith("..",s)))return null;n=!1,s+=2}s=sa(e,s,r);let o=null,a=n;if(s<r){let l=Ff(e,s,r);if(l===null)return null;o=l.anchor,s=l.next}return s=sa(e,s,r),s!==r||i===null&&o===null?null:{kind:"range",from:i,to:o,inclusive_start:i===null?a:n,inclusive_end:o===null?n:a}}function Ff(e,t,r){if(t>=r)return null;let n=e.charCodeAt(t);if(n===42)return{anchor:{kind:"wildcard"},next:t+1};if(n===34)return _x(e,t,r);if(P_(n)){let s=t;for(;s<r&&P_(e.charCodeAt(s));)s++;return{anchor:{kind:"word",value:e.slice(t,s)},next:s}}return null}function _x(e,t,r){let n=t+1,s="",i=n;for(;n<r;){let o=e.charCodeAt(n);if(o===34)return n>i&&(s+=e.slice(i,n)),{anchor:{kind:"literal",value:s},next:n+1};if(o===92){if(n+1>=r)return null;let a=e.charCodeAt(n+1);if(a!==34&&a!==92)return null;n>i&&(s+=e.slice(i,n)),s+=String.fromCharCode(a),n+=2,i=n;continue}n++}return null}function sa(e,t,r){for(;t<r&&e.charCodeAt(t)===32;)t++;return t}function wb(e,t,r,n){let s=e.indexOf(t,r);return s<0||s+t.length>n?-1:s}function P_(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95}function to(e,t,r){if(t>=r)return null;let n=0;for(let s=t;s<r;s++){let i=e.charCodeAt(s);if(i<48||i>57)return null;n=10*n+(i-48)}return n}function jf(e){return e>=65&&e<=90||e>=97&&e<=122}function xb(e){return jf(e)||e>=48&&e<=57||e===95||e===45}function ux(e){let t=e.length;if(t===0)return!1;let r=0;for(let n=0;n<=t;n++){let s=n<t?e.charCodeAt(n):32;if(s!==32){if(!(s>=128||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||s===45||s===95))return!1}else{if(n===r||e.charCodeAt(r)>=48&&e.charCodeAt(r)<=57)return!1;r=n+1}}return!0}function hx(e){let t=1;for(let s=0;s<e.length;s++)e.charCodeAt(s)===10&&t++;let r=new Int32Array(t),n=1;r[0]=0;for(let s=0;s<e.length;s++)e.charCodeAt(s)===10&&(r[n++]=s+1);return r}function si(e,t){let r=0,n=e.length-1;for(;r<n;){let s=r+n+1>>>1;e[s]<=t?r=s:n=s-1}return r+1}function fx(e,t,r){return t>=e.length?r:e[t]}function Lb(e,t,r,n){let s=r.length,i,o;switch(e.kind){case"bare":i=t.line,o=t.line;break;case"lineCount":if(i=t.line+1,o=Math.min(s,t.line+e.count),i>s)return{start:0,end:0,start_line:t.line,end_line:t.line};break;case"lineRef":if(e.from>s)return null;if(e.to===void 0)i=e.from,o=e.from;else if(e.inclusive)i=e.from,o=Math.min(s,e.to);else if(i=e.from+1,o=Math.min(s,e.to-1),o<i)return{start:0,end:0,start_line:t.line,end_line:t.line};break;default:return null}return{start:r[i-1],end:fx(r,o,n),start_line:i,end_line:o}}function dx(e,t,r,n){if(e===void 0)return{start:la(r,t.line),end:Il(r,t.line,n)};if(e.kind==="all")return{start:0,end:n};let s=Lb(e,t,r,n);return s===null?null:{start:s.start,end:s.end}}function Nf(e,t,r,n,s,i,o,a,l){if(e.kind==="wildcard"&&t.kind==="wildcard")return null;let _=la(a,s.line),c=Il(a,s.line,o.length),h=la(a,i.line),d=Il(a,i.line,o.length),f=e.kind==="wildcard"?null:zf(o,e,_,c,l);if(e.kind!=="wildcard"&&f===null)return null;let p=t.kind==="wildcard"?null:zf(o,t,f!==null&&s.line===i.line?f.end:h,d,l);if(t.kind!=="wildcard"&&p===null)return null;let m,g;return m=e.kind==="wildcard"?_:r?f.start:f.end,g=t.kind==="wildcard"?d:n?p.end:p.start,g<m&&(g=m),{start:m,end:g,start_line:si(a,m),end_line:si(a,Math.max(m,g-1))}}function la(e,t){return e[t-1]}function Il(e,t,r){return t<e.length?e[t]-1:r}function zf(e,t,r,n,s){if(t.kind==="wildcard")return null;let i=t.value;if(i.length===0)return null;let o=r;for(;o+i.length<=n;){let a=e.indexOf(i,o);if(a<0||a+i.length>n)return null;let l=gx(s,a);if(!(l>=0)){if(t.kind==="word"){let _=a===0||!P_(e.charCodeAt(a-1)),c=a+i.length,h=c>=e.length||!P_(e.charCodeAt(c));if(!_||!h){o=a+1;continue}}return{start:a,end:a+i.length}}o=l}return null}function px(e,t,r,n,s){let i=[],o=r;for(;o<n;){let a=zf(e,t,o,n,s);if(a===null)break;i.push(a),o=Math.max(a.end,a.start+1)}return i}function mx(e,t){let r=0;for(let i=0;i<e.length;i+=3)e[i]===t&&r++;let n=new Uint32Array(2*r),s=0;for(let i=0;i<e.length;i+=3)e[i]===t&&(n[s++]=e[i+1],n[s++]=e[i+2]);return n}function gx(e,t){if(e.length===0)return-1;let r=0,n=e.length/2-1;for(;r<=n;){let i=r+n>>>1;e[2*i]<=t?r=i+1:n=i-1}if(n<0)return-1;let s=e[2*n+1];return t<s?s:-1}function vx(e,t,r,n,s){e.sort((a,l)=>a.start-l.start||a.end-l.end);let i=new Uint32Array(4*e.length);for(let a=0;a<e.length;a++){let l=e[a];i[4*a]=l.start,i[4*a+1]=l.end,i[4*a+2]=l.class_id,i[4*a+3]=l.flags}r.sort((a,l)=>a.start-l.start);let o=new Uint32Array(2*r.length);for(let a=0;a<r.length;a++)o[2*a]=r[a].start,o[2*a+1]=r[a].end;return{ranges:i,classifications:t,skip_ranges:o,elided_lines:bx(n,r,s())}}function bx(e,t,r){let n=r.length,s=new Uint8Array(n),i=new Map;for(let o of t){let a=i.get(o.line);a===void 0&&(a=[],i.set(o.line,a)),a.push(o)}for(let[o,a]of i){let l=o<n?r[o]-1:e.length,_=!1,c=!1,h=r[o-1];a.sort((d,f)=>d.start-f.start);for(let d=0;d<a.length;d++){let f=a[d];Nl(e,h,f.start)&&(_=!0,c=!0),Nl(e,f.start,f.end)&&(_=!0),h=f.end}Nl(e,h,l)&&(_=!0,c=!0),_&&!c&&(s[o-1]=1)}return s}function Nl(e,t,r){for(let n=t;n<r;n++){let s=e.charCodeAt(n);if(s!==32&&s!==9&&s!==13)return!0}return!1}function $b(e,t,r,n){let s=t;for(let i=0;i<n.length;i++){let o=n[i];if(Dl(e,s,o.start))return!1;s=o.end}return!Dl(e,s,r)}function kx(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===10)return!1;return!Dl(e,t,r)}function Dl(e,t,r){for(let n=t;n<r;n++){let s=e.charCodeAt(n);if(s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||s===95||s>=128)return!0}return!1}var ro=Array(128);for(let e=0;e<128;e++)ro[e]=String.fromCharCode(e);ro[38]="&amp;",ro[60]="&lt;",ro[62]="&gt;",ro[34]="&quot;",ro[39]="&#39;";var eo=new Uint8Array(63);eo[10]=1,eo[34]=2,eo[38]=2,eo[39]=2,eo[60]=2,eo[62]=2;var Fb=`</span></span>
127
+ <span class="l">`,yx=[],wx=[];for(let e=0;e<=32;e++)yx.push(Fb+" ".repeat(e));for(let e=0;e<=8;e++)wx.push(Fb+"\t".repeat(e));var xx=[],$x=[],Ex=[];for(let e=0;e<256;e++)xx.push(""),$x.push('<span class="tok ">'),Ex.push('</span><span class="tok ">');var lz={scan:eo,max:62,table:ro,char_cls:Array(8192).fill(null),char_open:Array(8192).fill(""),char_swap:Array(8192).fill("")};var cz={input:"",result:{tokens:new Uint32Array,token_types:[]},overlays:void 0,options:{},block_overlays:void 0,empty:!1};var Uf=null,Eb=new Set;function Rn(){return Uf!==null}function nt(e,t,r){if(Uf===null)return;let n=`${e}\x00${t}`;Eb.has(n)||(Eb.add(n),Uf({source:e,message:r}))}function Ax(e){let t=Array(128).fill(null),r=null,n=1/0,s=0;for(let i of e){if(i.length===0)continue;i.length<n&&(n=i.length),i.length>s&&(s=i.length);let o=i.charCodeAt(0);if(o>=128){r??=new Set,r.add(i);continue}let a=new Uint16Array(i.length);for(let _=0;_<i.length;_++)a[_]=i.charCodeAt(_);let l=t[o];l===null&&(l=[],t[o]=l),l.push(a)}return{buckets:t,wide:r,min_len:n===1/0?1:n,max_len:s}}function jb(e,t,r,n){let s=n-r;if(s<e.min_len||s>e.max_len)return!1;let i=t.charCodeAt(r);if(i>=128)return e.wide!==null&&e.wide.has(t.slice(r,n));let o=e.buckets[i];if(o===null)return!1;for(let a=0;a<o.length;a++){let l=o[a];if(l.length!==s)continue;let _=!0;for(let c=1;c<s;c++)if(t.charCodeAt(r+c)!==l[c]){_=!1;break}if(_)return!0}return!1}function Ei(e,t,r){let n=Ax(r);return Wf((s,i,o,a)=>{let l=o.indexOf(e);if(l<0)return void(Rn()&&nt("fidelity",`source-type:${e}`,`source type "${e}" is not in the token vocabulary; pass disabled`));let _=o.indexOf(t);_<0&&(_=o.length,o.push(t));let c=Mn(t),h=i.length/3;for(let d=0;d<h;d++)i[3*d]===l&&jb(n,s,i[3*d+1],i[3*d+2])&&a.emit(d,_,c)},{kind:Bb,source_type:e,target_type:t,set:n})}function z_(e,t){return Wf((r,n,s,i)=>{let o=s.indexOf(e);if(o<0)return void(Rn()&&nt("fidelity",`source-type:${e}`,`source type "${e}" is not in the token vocabulary; pass disabled`));let a=s.indexOf(t);a<0&&(a=s.length,s.push(t));let l=Mn(t),_=n.length/3;for(let c=0;c<_;c++)n[3*c]===o&&zb(r,n[3*c+1],n[3*c+2])&&i.emit(c,a,l)},{kind:Hb,source_type:e,target_type:t,set:null})}function zb(e,t,r){let n=e.charCodeAt(t);if(n<65||n>90)return!1;if(r-t<2)return!0;for(let s=t;s<r;s++){let i=e.charCodeAt(s);if(i>=97&&i<=122)return!0}return!1}function Tx(e){return e>=65&&e<=90||e>=48&&e<=57||e===95}function ca(e,t){return Wf((r,n,s,i)=>{let o=s.indexOf(e);if(o<0)return void(Rn()&&nt("fidelity",`source-type:${e}`,`source type "${e}" is not in the token vocabulary; pass disabled`));let a=s.indexOf(t);a<0&&(a=s.length,s.push(t));let l=Mn(t),_=n.length/3;for(let c=0;c<_;c++)n[3*c]===o&&Ub(r,n[3*c+1],n[3*c+2])&&i.emit(c,a,l)},{kind:Cx,source_type:e,target_type:t,set:null})}function Ub(e,t,r){if(r-t<2)return!1;let n=e.charCodeAt(t);if(n<65||n>90)return!1;for(let s=t+1;s<r;s++)if(!Tx(e.charCodeAt(s)))return!1;return!0}var Bb=0,Hb=1,Cx=2;function Wf(e,t){let r=ii(e);return r.__ident=t,r}function Rf(e){return e.__ident??null}function Sx(e,t,r,n){return e.kind===Bb?jb(e.set,t,r,n):e.kind===Hb?zb(t,r,n):Ub(t,r,n)}function Ox(e){let t=e[0].source_type,r=e.length,n=new Int32Array(r);for(let i=0;i<r;i++)n[i]=Mn(e[i].target_type);let s=new Int32Array(r);return ii((i,o,a,l)=>{let _=a.indexOf(t);if(_<0)return void(Rn()&&nt("fidelity",`source-type:${t}`,`source type "${t}" is not in the token vocabulary; pass disabled`));for(let h=0;h<r;h++){let d=e[h].target_type,f=a.indexOf(d);f<0&&(f=a.length,a.push(d)),s[h]=f}let c=o.length/3;for(let h=0;h<c;h++){if(o[3*h]!==_)continue;let d=o[3*h+1],f=o[3*h+2];for(let p=0;p<r;p++)Sx(e[p],i,d,f)&&l.emit(h,s[p],n[p])}})}function Ab(e){let t=null,r=0;for(;r<e.length;){let n=Rf(e[r]),s=r+1;if(n!==null)for(;s<e.length&&Rf(e[s])?.source_type===n.source_type;)s++;if(s-r>1){t??=e.slice(0,r);let i=[];for(let o=r;o<s;o++)i.push(Rf(e[o]));t.push(Ox(i))}else t!==null&&t.push(e[r]);r=s}return t??e}function Ai(e="identifier",t="function",r={plain:!0},n){let s=[],i=Lr("(",")");return r.plain&&s.push(i),r.macro&&s.push(ut(Ce("builtin",["!"]),i)),r.generic_fn&&s.push(ut(Lr("<",">"),i)),r.turbofish&&s.push(ut(Ce("punctuation",["::"]),Lr("<",">"),i)),s.length===0?(o,a)=>a:an([{anchor:e,when:s.length===1?s[0]:Cr(...s),rewrite:t}],n)}function Ce(e,t,r){return{__kind:"type",type_name:e,value:t,text_pred:r?.text_pred}}function ut(...e){return{__kind:"seq",children:e}}function Cr(...e){return{__kind:"anyOf",branches:e}}function _a(e){return{__kind:"optional",inner:e}}function Vb(e,t){return{__kind:"capture",name:e,inner:t}}function Lr(e="(",t=")",r=200,n="punctuation"){return{__kind:"balanced",open:e,close:t,max_tokens:r,punct_type:n}}function Yb(e){return{__kind:"not",inner:e}}function U_(e){return{__kind:"params",into:e.into,find_open:e.find_open??"starts_with",strategy:e.strategy??"first_ident",separator:e.separator??",",default_introducer:e.default_introducer,transparent_texts_for_type:e.transparent_texts_for_type,skip_generics:e.skip_generics??!1,skip_ts_return_type:e.skip_ts_return_type??!1,skip_in_type_position:e.skip_in_type_position??!1,scan_max_tokens:e.scan_max_tokens??64}}function ao(e){return{__kind:"type_span",into:e.into,exit_on_comma:e.exit_on_comma??!0,exit_on_eq:e.exit_on_eq??!0,exit_on_qmark:e.exit_on_qmark??!1,enter_angle:e.enter_angle??!1,brace_exit_on_closer:e.brace_exit_on_closer??!1,value_op_terminators:e.value_op_terminators,stmt_keyword_terminators:e.stmt_keyword_terminators,type_terminal_keywords:e.type_terminal_keywords,verify_generic_args:e.verify_generic_args??!1}}var Ft=-1,bn=-2,Nx=new Uint8Array,As=0,ri=1,B_=2,no=3,Gb=4,Wb=5,Xb=6,Rl=7,Bf=8,Kb=9,Xf=10,Zb=11,Rx=0,Jb=1,Kf=2,Mx=0,Qb=1;function Ix(e,t){let r=e.transparent_texts_for_type;if(r===void 0||r.length===0)return null;let n=null;for(let s of r){if(s.texts.length===0)continue;let i=t.get(s.type);if(i===void 0)continue;for(n===null&&(n=[]);n.length<=i;)n.push(null);let o=n[i];n[i]=o===null?s.texts.slice():o.concat(s.texts)}return n}function e1(e,t){let r=e.transparent_by_type;return r===null||t>=r.length?null:r[t]}function Dx(e,t,r,n,s,i){for(let o=r;o<n;o++){let a=3*o,l=t[a];if(i[l])continue;if(l===e.ident_id)return!0;let _=e1(e,l);if(_===null||_.indexOf(s.slice(t[a+1],t[a+2]))<0)return!1}return!1}function Px(e,t){let r=e.program_len+t;if(r<=e.program.length)return;let n=2*e.program.length;for(;n<r;)n*=2;let s=new Int32Array(n);s.set(e.program),e.program=s}function ft(e,...t){Px(e,t.length);for(let r=0;r<t.length;r++)e.program[e.program_len++]=t[r]}function oa(e,t){if(t===null)return-1;if(2*(e.value_offsets_len+1)>e.value_offsets.length){let s=new Int32Array(2*e.value_offsets.length);s.set(e.value_offsets),e.value_offsets=s}let r=0;for(let s=0;s<t.length;s++)r+=1+t[s].length;if(e.value_pool_len+r>e.value_pool.length){let s=2*e.value_pool.length;for(;s<e.value_pool_len+r;)s*=2;let i=new Uint16Array(s);i.set(e.value_pool),e.value_pool=i}let n=e.value_offsets_len;e.value_offsets[2*n]=e.value_pool_len,e.value_offsets[2*n+1]=t.length,e.value_offsets_len++;for(let s=0;s<t.length;s++){let i=t[s];e.value_pool[e.value_pool_len++]=i.length;for(let o=0;o<i.length;o++)e.value_pool[e.value_pool_len++]=i.charCodeAt(o)}return n}function qx(){return{name_to_slot:new Map,max_slots:0}}function Mf(e,t){let r=e.name_to_slot.get(t);return r===void 0&&(r=e.max_slots++,e.name_to_slot.set(t,r)),r}function ei(e,t,r,n){switch(e.__kind){case"type":{let s=t.get(e.type_name)??Ft;s===Ft&&nt("rewrite_types",`pattern-type:${e.type_name}`,`pattern references type "${e.type_name}" which is not in the token vocabulary; the branch can never match`);let i=null;e.value!==void 0&&(i=Array.isArray(e.value)?e.value:[e.value]);let o=oa(r,i),a=-1;if(e.text_pred!==void 0){let l=L_(e.text_pred);l<0?(s=Ft,nt("rewrite_types",`pattern-pred:${e.text_pred}`,`unknown text predicate "${e.text_pred}"; the branch can never match`)):a=l}ft(r,As,s,o,a);return}case"seq":for(let s=0;s<e.children.length;s++)ei(e.children[s],t,r,n);return;case"anyOf":{let s=[],i=e.branches;for(let a=0;a<i.length;a++){let l=a===i.length-1,_=-1;l||(ft(r,ri,0),_=r.program_len-1),ei(i[a],t,r,n),l||(ft(r,no),ft(r,B_,0),s.push(r.program_len-1),r.program[_]=r.program_len)}let o=r.program_len;for(let a=0;a<s.length;a++)r.program[s[a]]=o;return}case"optional":{ft(r,ri,0);let s=r.program_len-1;ei(e.inner,t,r,n),ft(r,no),r.program[s]=r.program_len;return}case"capture":{let s=Mf(n,e.name);ft(r,Gb,s),ei(e.inner,t,r,n),ft(r,Wb,s);return}case"balanced":{let s=e.punct_type??"punctuation",i=t.get(s)??Ft;i===Ft&&nt("rewrite_types",`balanced-punct:${s}`,`balanced pattern's bracket type "${s}" is not in the token vocabulary; the branch can never match`),ft(r,Xb,i,e.open.charCodeAt(0),e.close.charCodeAt(0),e.max_tokens??200);return}case"repeat":{if(e.separator!==void 0){ft(r,ri,0);let o=r.program_len-1;ei(e.inner,t,r,n),ft(r,no);let a=r.program_len;ft(r,ri,0);let l=r.program_len-1;ei(e.separator,t,r,n),ei(e.inner,t,r,n),ft(r,Bf,a);let _=r.program_len;r.program[o]=_,r.program[l]=_;return}let s=r.program_len;ft(r,ri,0);let i=r.program_len-1;ei(e.inner,t,r,n),ft(r,Bf,s),r.program[i]=r.program_len;return}case"not":{let s=e.inner,i=t.get(s.type_name)??Ft,o=-1;if(s.text_pred!==void 0){let _=L_(s.text_pred);_<0?i=Ft:o=_}if(i===Ft)return nt("rewrite_types",`not-inner:${s.type_name}:${s.text_pred??""}`,`not() inner spec (type "${s.type_name}") cannot resolve; the branch can never match`),void ft(r,As,Ft,-1,-1);let a=null;s.value!==void 0&&(a=Array.isArray(s.value)?s.value:[s.value]);let l=oa(r,a);ft(r,Kb,i,l,o);return}case"params":{let s=t.get("identifier")??Ft,i=t.get("punctuation")??Ft;if(s===Ft||i===Ft)return nt("rewrite_types","params-base-types",'params() needs "identifier" and "punctuation" in the token vocabulary; the branch can never match'),void ft(r,As,Ft,-1,-1);if(e.find_open==="arrow"&&r.program_len!==r.rule_start_pc)return nt("rewrite_types","params-arrow-position",'params({find_open: "arrow"}) must be the first element of when; the branch can never match'),void ft(r,As,Ft,-1,-1);let o=Mf(n,e.into),a=r.params_specs.length;r.params_specs.push({find_open:e.find_open==="starts_with"?Rx:e.find_open==="scan"?Jb:Kf,strategy:e.strategy==="carry_pending"?Qb:Mx,separator_code:e.separator.charCodeAt(0),default_introducer:e.default_introducer??null,transparent_by_type:Ix(e,t),skip_generics:e.skip_generics,skip_ts_return_type:e.skip_ts_return_type,skip_in_type_position:e.skip_in_type_position,scan_max_tokens:e.scan_max_tokens,ident_id:s,function_id:t.get("function")??-1,punct_id:i,operator_id:t.get("operator")??-1}),ft(r,Xf,a,o);return}case"type_span":{let s=t.get("identifier")??Ft,i=t.get("punctuation")??Ft;if(s===Ft||i===Ft)return nt("rewrite_types","type-span-base-types",'type_span() needs "identifier" and "punctuation" in the token vocabulary; the branch can never match'),void ft(r,As,Ft,-1,-1);let o=Mf(n,e.into),a=r.span_specs.length,l=(_)=>_!==void 0&&_.length>0?oa(r,_):-1;r.span_specs.push({exit_on_comma:e.exit_on_comma,exit_on_eq:e.exit_on_eq,exit_on_qmark:e.exit_on_qmark,enter_angle:e.enter_angle,brace_exit_on_closer:e.brace_exit_on_closer,verify_generic_args:e.verify_generic_args,value_ops_id:l(e.value_op_terminators),stmt_keywords_id:l(e.stmt_keyword_terminators),terminal_keywords_id:l(e.type_terminal_keywords),ident_id:s,punct_id:i,keyword_id:t.get("keyword")??-1,operator_id:t.get("operator")??-1,type_id:t.get("type")??-1}),ft(r,Zb,a,o);return}}}function I_(e,t,r){switch(e.__kind){case"type":{let n=t.get(e.type_name)??Ft;n===Ft&&nt("rewrite_types",`pattern-type:${e.type_name}`,`pattern references type "${e.type_name}" which is not in the token vocabulary; the branch can never match`);let s=null;e.value!==void 0&&(s=Array.isArray(e.value)?e.value:[e.value]);let i=oa(r,s),o=-1;if(e.text_pred!==void 0){let a=L_(e.text_pred);a<0?(n=Ft,nt("rewrite_types",`pattern-pred:${e.text_pred}`,`unknown text predicate "${e.text_pred}"; the branch can never match`)):o=a}ft(r,As,n,i,o);return}case"seq":for(let n=e.children.length-1;n>=0;n--)I_(e.children[n],t,r);return;case"anyOf":{let n=[],s=e.branches;for(let o=0;o<s.length;o++){let a=o===s.length-1,l=-1;a||(ft(r,ri,0),l=r.program_len-1),I_(s[o],t,r),a||(ft(r,no),ft(r,B_,0),n.push(r.program_len-1),r.program[l]=r.program_len)}let i=r.program_len;for(let o=0;o<n.length;o++)r.program[n[o]]=i;return}case"optional":{ft(r,ri,0);let n=r.program_len-1;I_(e.inner,t,r),ft(r,no),r.program[n]=r.program_len;return}case"capture":case"balanced":case"repeat":case"not":case"params":case"type_span":nt("rewrite_types",`before-unsupported:${e.__kind}`,`"${e.__kind}" is not supported in before lookbehind; the rule can never match`),ft(r,As,Ft,-1,-1);return}}var wi=3,q_=new Int32Array(128*wi),ia=new Uint32Array(8),Es=new Int32Array(192),ni=0;function Lx(e){if(e>ia.length){let t=2*ia.length;for(;t<e;)t*=2;let r=new Uint32Array(t);r.set(ia),ia=r}}function Pl(e,t,r){if(ni+3>Es.length){let n=new Int32Array(2*Es.length);n.set(Es),Es=n}Es[ni]=e,Es[ni+1]=t,Es[ni+2]=r,ni+=3}var t1=0,r1=1,Hf=65,Vf=90,Fx=97,jx=122,zx=48,Ux=57,Bx=95;function Hx(e,t,r){if(r-t<2)return!1;let n=e.charCodeAt(t);if(n<Hf||n>Vf)return!1;for(let s=t+1;s<r;s++){let i=e.charCodeAt(s);if(!(i>=Hf&&i<=Vf||i>=zx&&i<=Ux||i===Bx))return!1}return!0}function Vx(e,t,r){let n=e.charCodeAt(t);if(n<Hf||n>Vf)return!1;if(r-t<=1)return!0;for(let s=t+1;s<r;s++){let i=e.charCodeAt(s);if(i>=Fx&&i<=jx)return!0}return!1}function ql(e,t,r,n){switch(e){case t1:return Hx(t,r,n);case r1:return Vx(t,r,n);default:return!1}}function L_(e){switch(e){case"upper_snake_case":return t1;case"pascal_case":return r1;default:return-1}}function n1(e,t,r,n,s,i){let o=i-s,a=2*r,l=t[a+1],_=t[a];for(let c=0;c<l;c++){let h=e[_++];if(h<=o){let d=!0,f=i-h;for(let p=0;p<h;p++)if(e[_+p]!==n.charCodeAt(f+p)){d=!1;break}if(d)return!0}_+=h}return!1}function io(e,t,r,n,s,i){let o=i-s,a=2*r,l=t[a+1],_=t[a];for(let c=0;c<l;c++){let h=e[_++];if(h===o){let d=!0;for(let f=0;f<h;f++)if(e[_+f]!==n.charCodeAt(s+f)){d=!1;break}if(d)return!0}_+=h}return!1}function Yx(e,t,r,n,s,i,o,a){if(t>=r)return bn;let l=3*t;if(e[l]!==s)return bn;let _=0,c=e[l+1],h=e[l+2];if(n.charCodeAt(c)!==i)return bn;for(let f=c;f<h;f++){let p=n.charCodeAt(f);if(p===i)_++;else if(p===o&&(_--,_===0))return t+1}let d=Math.min(r,t+1+a);for(let f=t+1;f<d;f++){let p=3*f;if(e[p]===s){let m=e[p+2];for(let g=e[p+1];g<m;g++){let b=n.charCodeAt(g);if(b===i)_++;else if(b===o&&(_--,_===0))return f+1}}}return bn}var kn=40,ls=41,cs=91,Cs=93,Ss=123,Hn=125,so=58,H_=44,Ll=59,aa=46,oo=60,Ts=62,$i=61,Fl=0,jl=0,Ml=0,Yf=0;function zl(e,t,r,n){for(let s=t;s<r;s++)if(!n[e[3*s]])return s;return-1}function Bl(e,t,r){for(let n=t;n>=0;n--)if(!r[e[3*n]])return n;return-1}function Gx(e,t,r,n,s,i){for(;r<n&&i[t[3*r]];)r++;if(r>=n)return!1;let o=3*r;return t[o]===e.punct_id&&s.charCodeAt(t[o+1])===kn&&(Fl=r,jl=0,!0)}function Wx(e,t,r,n,s,i){for(;r<n&&i[t[3*r]];)r++;if(r>=n||t[3*r]!==e.punct_id)return!1;let o=0,a=0,l=Math.min(n,r+e.scan_max_tokens);for(let _=r;_<l;_++){let c=3*_;if(i[t[c]]||t[c]!==e.punct_id)continue;let h=t[c+1],d=t[c+2];for(let f=h;f<d;f++){let p=s.charCodeAt(f);if(p===cs)o++;else if(p===Cs){if(o===0)return!1;o--}else if(p===Ss)a++;else if(p===Hn){if(a===0)return!1;a--}else if(p===kn){if(o===0&&a===0)return Fl=_,jl=f-h,!0}else if(p===ls&&o===0&&a===0)return!1}}return!1}function Xx(e,t,r,n,s,i){let o=1,a=t[3*r+1],l=t[3*r+2];for(let _=a+n+1;_<l;_++){let c=i.charCodeAt(_);if(c===kn||c===cs||c===Ss)o++;else if((c===ls||c===Cs||c===Hn)&&(o--,o===0))return Ml=r,Yf=_-a,!0}for(let _=r+1;_<s;_++){let c=3*_;if(t[c]!==e.punct_id)continue;let h=t[c+1],d=t[c+2];for(let f=h;f<d;f++){let p=i.charCodeAt(f);if(p===kn||p===cs||p===Ss)o++;else if((p===ls||p===Cs||p===Hn)&&(o--,o===0))return Ml=_,Yf=f-h,!0}}return!1}function Kx(e,t,r,n,s,i,o){if(!Xx(e,t,r,n,s,i)||Yf+1<t[3*Ml+2]-t[3*Ml+1])return!1;let a=zl(t,Ml+1,s,o);if(a<0)return!1;let l=3*a;if(e.skip_ts_return_type&&t[l]===e.punct_id){let c=t[l+1];if(t[l+2]-c===1&&i.charCodeAt(c)===so){let h=0,d=a+1;for(;d<s;){let f=3*d,p=t[f];if(o[p])d++;else{if(p===e.punct_id){let m=t[f+2];for(let g=t[f+1];g<m;g++){let b=i.charCodeAt(g);if(b===kn||b===cs||b===Ss)h++;else if(b===ls||b===Cs||b===Hn){if(h===0)return!1;h--}else if((b===H_||b===Ll)&&h===0)return!1}}else if(p===e.operator_id&&h===0){let m=t[f+1];if(t[f+2]-m===2&&i.charCodeAt(m)===$i&&i.charCodeAt(m+1)===Ts)return!0}d++}}return!1}}if(t[l]!==e.operator_id)return!1;let _=t[l+1];return t[l+2]-_===2&&i.charCodeAt(_)===$i&&i.charCodeAt(_+1)===Ts}function Zx(e,t,r,n,s){if(e.operator_id<0)return!1;let i=Bl(t,r-1,s);if(i<0)return!1;let o=3*i;if(t[o]!==e.operator_id)return!1;let a=t[o+1];return t[o+2]-a===1&&n.charCodeAt(a)===xi}function Jx(e,t,r,n,s,i,o){if(r<0)return!1;let a=3*r;if(t[a]!==e.punct_id)return!1;let l=t[a+1],_=t[a+2],c=-2;for(let h=0;h<_-l;h++)if(s.charCodeAt(l+h)===kn){if(e.skip_in_type_position&&h===0&&o!==void 0){let d=Bl(t,r-1,i);if(d>=0&&t[3*d]===e.punct_id){let f=t[3*d+2];if(f>t[3*d+1]&&s.charCodeAt(f-1)===so){c===-2&&(c=o.kind_names.indexOf("object"));let p=o.frames[r>0?o.active_frame[r-1]:0],m=p.bracket===1&&p.kind===c,g=d<o.signals.length&&!!(1&o.signals[d]);if(g&&Zx(e,t,d,s,i)&&(g=!1),!m&&!g)continue}}}if(Kx(e,t,r,h,n,s,i))return Fl=r,jl=h,!0}return!1}function Qx(e,t,r,n,s,i){for(;r<n&&i[t[3*r]];)r++;if(r>=n)return r;let o=3*r;if(t[o]!==e.operator_id)return r;let a=t[o+1];if(t[o+2]-a!==1||s.charCodeAt(a)!==oo)return r;let l=1,_=r+1;for(;_<n&&l>0;){let c=3*_;if(i[t[c]])_++;else{if(t[c]===e.operator_id){let h=t[c+1],d=t[c+2]-h;if(d===1&&s.charCodeAt(h)===oo)l++;else if(d>=1&&d<=3&&s.charCodeAt(h)===Ts){let f=1;d>=2&&s.charCodeAt(h+1)===Ts&&(f=2),d===3&&s.charCodeAt(h+2)===Ts&&(f=3),f===d&&(l=Math.max(0,l-f))}}_++}}return _}function e$(e,t,r,n,s,i,o,a){let l=1,_=!0,c=!1,h=e.separator_code,d=r[3*n+2];for(let p=r[3*n+1]+s+1;p<d;p++){let m=o.charCodeAt(p);if(m===kn||m===cs||m===Ss)l++;else if(m===ls||m===Cs||m===Hn){if(l--,l===0)return n+1}else m===h&&l===1&&(_=!0,c=!1)}let f=n+1;for(;f<i&&l>0;){let p=3*f,m=r[p];if(a[m])f++;else{if(m===e.punct_id){let g=r[p+2];for(let b=r[p+1];b<g;b++){let k=o.charCodeAt(b);if(k===kn||k===cs||k===Ss)l++;else if(k===ls||k===Cs||k===Hn){if(l--,l===0)break}else k===h&&l===1&&(_=!0,c=!1)}f++;continue}if(l===1&&_&&!c){if(m===e.ident_id){Pl(t,f,f+1),_=!1,f++;continue}let g=e1(e,m),b=m===e.operator_id&&e.default_introducer!==null;if(g!==null||b){let k=o.slice(r[p+1],r[p+2]);if(b&&k===e.default_introducer){_=!1,c=!0,f++;continue}if(g!==null&&g.indexOf(k)>=0&&Dx(e,r,f+1,i,o,a)){f++;continue}}_=!1}f++}}return f}function t$(e,t,r,n){if(r.length<2)return!1;let s=r[1];if(t[3*s]===e.punct_id){let i=n.charCodeAt(t[3*s+1]);if(i===aa)return!1;if(i===cs)return r$(e,t,r,1,n)}return!0}function r$(e,t,r,n,s){let i=0,o=!1;for(let a=n;a<r.length;a++){let l=r[a];if(t[3*l]!==e.punct_id)continue;let _=s.slice(t[3*l+1],t[3*l+2]);for(let c=0;c<_.length;c++){let h=_[c];if(h==="[")i++,o=!0;else if(h==="]"&&i>0&&(i--,o&&i===0)){for(let d=c+1;d<_.length;d++){let f=_[d];if(f!==")"&&f!==",")return!0}return a<r.length-1}}}return!0}function n$(e,t,r,n,s,i,o,a){let l=1,_=0,c=0,h=[],d=[],f=n,p=s+1,m=e.separator_code;for(;f<i&&l>0;){let b=3*f;if(a[r[b]]){f++,p=0;continue}if(r[b]!==e.punct_id){d.push(f),f++,p=0;continue}let k=r[b+2],x=!1;for(let w=r[b+1]+p;w<k;w++){let O=o.charCodeAt(w);if(O!==m||l!==1||_!==0||c!==0)if(O===kn)l++,x=!0;else if(O===ls){if(l--,l===0)break;x=!0}else O===cs?(_++,x=!0):O===Cs?(_=Math.max(0,_-1),x=!0):O===Ss?(c++,x=!0):(O===Hn&&(c=Math.max(0,c-1)),x=!0);else x&&d.push(f),h.push(d),d=[],x=!1}x&&d.push(f),f++,p=0}d.length>0&&h.push(d);let g=[];for(let b of h){if(b.length===0)continue;let k=b[0],x=r[3*k];if(x===e.ident_id||e.function_id>=0&&x===e.function_id)if(t$(e,r,b,o)){for(let w of g)Pl(t,w,w+1);Pl(t,k,k+1),g=[]}else b.length===1?g.push(k):g=[];else g=[]}return f}var xi=63,s1=124,i1=38,o1=33;function Gf(e,t,r,n){if(r-t!==n.length)return!1;for(let s=0;s<n.length;s++)if(e.charCodeAt(t+s)!==n.charCodeAt(s))return!1;return!0}function V_(e,t,r){let n=r-t;if(n<1||n>3)return 0;for(let s=t;s<r;s++)if(e.charCodeAt(s)!==Ts)return 0;return n}var s$=42,i$=47,o$=37,a$=94,l$=126,c$=43,_$=45;function Zf(e,t,r){let n=e.charCodeAt(t);if(n===s$||n===i$||n===o$||n===a$||n===l$||n===o1)return!0;if(r-t<2)return!1;let s=e.charCodeAt(t+1);if(s===$i)return!0;if(n===xi)return s===xi||s===aa;if(n!==s)return!1;if(n===i1||n===s1||n===c$||n===_$)return!0;if(n!==oo&&n!==Ts)return!1;let i=t+2;for(;i<r&&e.charCodeAt(i)===n;)i++;return i<r&&e.charCodeAt(i)===$i}function u$(e,t,r,n,s,i){if(e.operator_id<0)return!1;let o=1,a=r+1;for(;a<n;){let l=3*a,_=t[l];if(i[_]){a++;continue}let c=t[l+1],h=t[l+2];if(_===e.operator_id)if(h-c===1&&s.charCodeAt(c)===oo)o++;else{let d=V_(s,c,h);if(d>0&&(o-=d,o<=0)){let f=zl(t,a+1,n,i);return f>=0&&t[3*f]===e.punct_id&&s.charCodeAt(t[3*f+1])===kn}}else if(_===e.punct_id)for(let d=c;d<h;d++){let f=s.charCodeAt(d);if(f===Ll||f===Hn)return!1}a++}return!1}function h$(e,t,r,n,s,i){let o=1,a=0,l=r,_=-1;for(;l<n;){let m=3*l,g=t[m];if(i[g]){l++;continue}let b=t[m+1],k=t[m+2];if(e.operator_id>=0&&g===e.operator_id)if(k-b===1&&s.charCodeAt(b)===oo)o++;else{let x=a===0?V_(s,b,k):0;if(x>0){if(o-=x,o<=0){_=l;break}}else if(Zf(s,b,k))return!1}else if(g===e.punct_id)for(let x=b;x<k;x++){let w=s.charCodeAt(x);if(w===Ss)a++;else if(w===Hn){if(a===0)return!1;a--}else if(w===Ll&&a===0)return!1}l++}if(_<0)return!1;let c=zl(t,_+1,n,i);if(c<0)return!0;let h=3*c,d=t[h],f=t[h+1],p=t[h+2];if(d===e.punct_id){let m=s.charCodeAt(f);return m===kn||m===ls||m===Ss||m===Hn||m===cs||m===Cs||m===H_||m===Ll||m===aa||m===so}if(e.operator_id>=0&&d===e.operator_id){let m=p-f,g=s.charCodeAt(f);if(m===1)return g===$i||g===s1||g===i1||g===Ts||g===xi||g===o1;if(m===2){let b=s.charCodeAt(f+1);return g===$i&&b===Ts||g===xi&&b===so}return!1}return e.keyword_id>=0&&d===e.keyword_id&&(Gf(s,f,p,"extends")||Gf(s,f,p,"implements"))}function f$(e,t,r,n,s,i,o){let a=Bl(t,r-1,s);if(a<0)return!1;let l=3*a,_=t[l],c=t[l+1],h=t[l+2];if(_===e.punct_id){let d=n.charCodeAt(h-1);return d===Cs||d===ls||d===Hn}return _===e.ident_id||e.type_id>=0&&_===e.type_id||_===e.operator_id&&V_(n,c,h)>0||_===e.keyword_id&&e.terminal_keywords_id>=0&&io(i,o,e.terminal_keywords_id,n,c,h)}function d$(e,t,r,n,s){let i=Bl(t,r-1,s);if(i<0)return!1;let o=3*i,a=t[o],l=t[o+1],_=t[o+2];if(a===e.punct_id){let c=n.charCodeAt(_-1);return c===cs||c===H_||_-l>=3&&c===aa&&n.charCodeAt(_-2)===aa&&n.charCodeAt(_-3)===aa}return e.operator_id>=0&&a===e.operator_id&&Gf(n,l,_,"...")}function p$(e,t,r,n,s,i,o,a,l){if(e.verify_generic_args&&!h$(e,r,n,s,i,o))return bn;let _=0,c=0,h=0,d=0,f=n;for(;f<s;){let p=3*f,m=r[p];if(o[m]){f++;continue}let g=r[p+1],b=r[p+2];if(m!==e.punct_id){if(e.operator_id>=0&&m===e.operator_id){let k=b-g;if(k===1&&i.charCodeAt(g)===oo){d++,f++;continue}let x=V_(i,g,b);if(x>0){if(d>=x){d-=x,f++;continue}if(d=0,e.enter_angle)return f}if(_===0&&c===0&&h===0&&d===0){if(k===1&&i.charCodeAt(g)===$i){if(e.exit_on_eq)return f;f++;continue}if(k===2&&i.charCodeAt(g)===$i&&i.charCodeAt(g+1)===Ts){let w=Bl(r,f-1,o);if(w>=0&&i.charCodeAt(r[3*w+2]-1)===ls){f++;continue}return f}if(k===1&&i.charCodeAt(g)===xi){if(e.exit_on_qmark)return f;f++;continue}if(e.value_ops_id>=0&&io(a,l,e.value_ops_id,i,g,b))return f}f++;continue}if(e.keyword_id>=0&&m===e.keyword_id){if(_===0&&c===0&&h===0&&d===0&&e.stmt_keywords_id>=0&&io(a,l,e.stmt_keywords_id,i,g,b))return f;f++}else{if(m===e.ident_id){let k=!1,x=_>0||c>0;if(x||h>0&&d$(e,r,f,i,o)){let w=zl(r,f+1,s,o);if(w>=0){let O=3*w,N=r[O+1],S=r[O+2]-N,D=r[O];if(D===e.punct_id){let X=i.charCodeAt(N);(S===1&&X===so||x&&X===kn)&&(k=!0)}else if(e.operator_id>=0&&D===e.operator_id){let X=i.charCodeAt(N);if(S===2&&X===xi&&i.charCodeAt(N+1)===so)k=!0;else if(S===1&&X===xi){let G=zl(r,w+1,s,o);G>=0&&r[3*G]===e.punct_id&&i.charCodeAt(r[3*G+1])===so&&(k=!0)}else x&&S===1&&X===oo&&(k=u$(e,r,w,s,i,o))}}}k||Pl(t,f,f+1),f++;continue}f++}}else{for(let k=g;k<b;k++){let x=i.charCodeAt(k);if(x===kn)_++;else if(x===ls){if(_--,_<0)return f}else if(x===Ss){if(e.brace_exit_on_closer&&c===0&&_===0&&f$(e,r,f,i,o,a,l))return f;c++}else if(x===Hn){if(c--,c<0)return f}else if(x===cs)h++;else if(x===Cs){if(h--,h<0)return f}else if(x===Ll&&_===0&&c===0&&h===0&&d===0)return f}if(e.exit_on_comma&&_===0&&c===0&&h===0&&d===0){for(let k=g;k<b;k++)if(i.charCodeAt(k)===H_)return f}f++}}return s}function m$(e,t,r,n,s,i,o,a){let l;if(e.find_open===Kf){if(e.skip_in_type_position&&a===void 0)return nt("rewrite_types","params-frames-missing","params() with skip_in_type_position ran without a frame_track stage upstream; the branch is disabled"),bn;l=Jx(e,r,n-1,s,i,o,a)}else e.skip_generics&&(n=Qx(e,r,n,s,i,o)),l=e.find_open===Jb?Wx(e,r,n,s,i,o):Gx(e,r,n,s,i,o);return l?e.strategy===Qb?n$(e,t,r,Fl,jl,s,i,o):e$(e,t,r,Fl,jl,s,i,o):bn}function g$(e,t,r,n,s,i,o,a,l,_,c,h,d){_>0&&Lx(_),ni=0;let f=t,p=0,m=q_,g=!1;for(;;){switch(e[f]){case As:{for(;n<s&&o[r[3*n]];)n++;if(n>=s){g=!0;break}let b=3*n;if(r[b]!==e[f+1]){g=!0;break}let k=e[f+2];if(k>=0&&!io(a,l,k,i,r[b+1],r[b+2])){g=!0;break}let x=e[f+3];if(x>=0&&!ql(x,i,r[b+1],r[b+2])){g=!0;break}n++,f+=4;break}case ri:if(p+wi>m.length){let b=new Int32Array(2*m.length);b.set(m),m=b,q_=b}m[p++]=e[f+1],m[p++]=n,m[p++]=ni,f+=2;break;case B_:f=e[f+1];break;case no:p-=wi,f+=1;break;case Gb:for(;n<s&&o[r[3*n]];)n++;ia[e[f+1]]=n,f+=2;break;case Wb:{let b=e[f+1];Pl(b,ia[b],n),f+=2;break}case Xb:{for(;n<s&&o[r[3*n]];)n++;let b=Yx(r,n,s,i,e[f+1],e[f+2],e[f+3],e[f+4]);if(b===bn){g=!0;break}n=b,f+=5;break}case Bf:p-=wi,f=n===m[p+1]?m[p]:e[f+1];break;case Kb:{for(;n<s&&o[r[3*n]];)n++;if(n>=s){f+=4;break}let b=3*n,k=r[b]===e[f+1];if(k){let x=e[f+2];x>=0&&(k=io(a,l,x,i,r[b+1],r[b+2]))}if(k){let x=e[f+3];x>=0&&(k=ql(x,i,r[b+1],r[b+2]))}if(k){g=!0;break}f+=4;break}case Xf:{let b=m$(c[e[f+1]],e[f+2],r,n,s,i,o,d);if(b===bn){g=!0;break}n=b,f+=3;break}case Zb:{let b=p$(h[e[f+1]],e[f+2],r,n,s,i,o,a,l);if(b===bn){g=!0;break}n=b,f+=3;break}case Rl:return n;default:g=!0}if(g){if(p===0)return bn;p-=wi,f=m[p],n=m[p+1],ni=m[p+2],g=!1}}}function v$(e,t,r,n,s,i,o,a){let l=t,_=0,c=q_,h=!1;for(;;){switch(e[l]){case As:{for(;n>=0&&i[r[3*n]];)n--;if(n<0){h=!0;break}let d=3*n;if(r[d]!==e[l+1]){h=!0;break}let f=e[l+2];if(f>=0&&!n1(o,a,f,s,r[d+1],r[d+2])){h=!0;break}let p=e[l+3];if(p>=0&&!ql(p,s,r[d+1],r[d+2])){h=!0;break}n--,l+=4;break}case ri:if(_+wi>c.length){let d=new Int32Array(2*c.length);d.set(c),c=d,q_=d}c[_++]=e[l+1],c[_++]=n,c[_++]=0,l+=2;break;case B_:l=e[l+1];break;case no:_-=wi,l+=1;break;case Rl:return n;default:h=!0}if(h){if(_===0)return bn;_-=wi,l=c[_],n=c[_+1],h=!1}}}var b$={identifier:0,punctuation:5,operator:5,variable:10,parameter:15,property:20,function:30,builtin:40,type:45,class_name:50,constant:55,keyword:70,boolean:75,null:75,number:75,comment:80,string:80},k$=25;function Mn(e){let t=b$[e];return t===void 0?k$:t}var a1=class{constructor(e=1024){this.count=0,this.capacity=e,this.token_idx=new Int32Array(e),this.type_id=new Int32Array(e),this.precedence=new Int32Array(e)}emit(e,t,r){this.count>=this.capacity&&this.grow(),this.token_idx[this.count]=e,this.type_id[this.count]=t,this.precedence[this.count]=r,this.count++}reset(){this.count=0}grow(){let e=2*this.capacity,t=new Int32Array(e),r=new Int32Array(e),n=new Int32Array(e);t.set(this.token_idx),r.set(this.type_id),n.set(this.precedence),this.token_idx=t,this.type_id=r,this.precedence=n,this.capacity=e}},R_=new a1,Qi=new Int32Array(1024),If=new Int32Array(1024);function l1(e,t){if(t.count===0)return;let r=e.length/3;if(Qi.length<r){let o=2*Qi.length;for(;o<r;)o*=2;Qi=new Int32Array(o),If=new Int32Array(o)}Qi.fill(-1,0,r);let{token_idx:n,type_id:s,precedence:i}=t;for(let o=0;o<t.count;o++){let a=n[o],l=i[o];(Qi[a]===-1||l>If[a])&&(Qi[a]=s[o],If[a]=l)}for(let o=0;o<r;o++){let a=Qi[o];a!==-1&&(e[3*o]=a)}}var Df=[],Pf=0;function c1(e,t,r){Pf===Df.length&&Df.push(new a1(256));let n=Df[Pf++];n.reset();let s=r.token_types.slice();try{if(e(t,r.tokens,s,n,r.frames),n.count===0)return{tokens:r.tokens,token_types:s,frames:r.frames};let i=new Uint32Array(r.tokens);return l1(i,n),{tokens:i,token_types:s,frames:r.frames}}finally{Pf--}}function y$(e,t,r){let n=r.slice(),s=new Map;for(let H=0;H<n.length;H++)s.set(n[H],H);let i=n.length,o=(H)=>{let R=s.get(H);return R===void 0&&(R=n.length,n.push(H),s.set(H,R)),R},a={program:new Int32Array(64),program_len:0,value_pool:new Uint16Array(32),value_pool_len:0,value_offsets:new Int32Array(16),value_offsets_len:0,params_specs:[],span_specs:[],rule_start_pc:0},l=[];for(let H of e){let R=typeof H.anchor=="string"?{type_name:H.anchor,value:void 0,value_ends_with:void 0,text_pred:void 0,at_start:void 0,frame_kinds:void 0,frame_direct:void 0,ternary_colon:void 0,stmt_flags_all:void 0,stmt_flags_none:void 0}:{type_name:H.anchor.type_name,value:H.anchor.value,value_ends_with:H.anchor.value_ends_with,text_pred:H.anchor.text_pred,at_start:H.anchor.at_start,frame_kinds:H.anchor.frame_kinds,frame_direct:H.anchor.frame_direct,ternary_colon:H.anchor.ternary_colon,stmt_flags_all:H.anchor.stmt_flags_all,stmt_flags_none:H.anchor.stmt_flags_none},W=s.get(R.type_name);if(W===void 0){nt("rewrite_types",`anchor-type:${R.type_name}`,`anchor type "${R.type_name}" is not in the token vocabulary; rule disabled`);continue}let j=qx(),P=a.program_len;a.rule_start_pc=P,H.when!==void 0&&ei(H.when,s,a,j),ft(a,Rl);let M=-1,F=null;if(typeof H.rewrite=="string")M=o(H.rewrite);else{F=[];for(let ye of Object.keys(H.rewrite)){let Ie=j.name_to_slot.get(ye);Ie===void 0?nt("rewrite_types",`rewrite-capture:${ye}`,`rewrite target references capture "${ye}" which the when pattern never declares; target ignored`):F.push({slot_id:Ie,target_id:o(H.rewrite[ye])})}}let Z=-1;R.value!==void 0&&(Z=oa(a,Array.isArray(R.value)?R.value:[R.value]));let re=-1;R.value_ends_with!==void 0&&(re=oa(a,Array.isArray(R.value_ends_with)?R.value_ends_with:[R.value_ends_with]));let ie=-1;if(R.text_pred!==void 0){let ye=L_(R.text_pred);ye<0&&nt("rewrite_types",`anchor-pred:${R.text_pred}`,`unknown text predicate "${R.text_pred}" on anchor; rule disabled`),ie=ye<0?-2:ye}let we=-1;H.before!==void 0&&(we=a.program_len,I_(H.before,s,a),ft(a,Rl));let _e=null;if(F!==null&&F.length>0){_e=new Int32Array(j.max_slots).fill(-1);for(let ye of F)_e[ye.slot_id]=ye.target_id}let oe=-1;a.program[P]===Xf&&a.params_specs[a.program[P+1]].find_open===Kf&&(oe=kn);let Y=-1;{let ye=[];if(R.value!==void 0&&ye.push(...Array.isArray(R.value)?R.value:[R.value]),R.value_ends_with!==void 0&&ye.push(...Array.isArray(R.value_ends_with)?R.value_ends_with:[R.value_ends_with]),ye.length>0&&ye.every((Ie)=>Ie.length>0)){let Ie=ye[0].charCodeAt(ye[0].length-1);ye.every((Se)=>Se.charCodeAt(Se.length-1)===Ie)&&(Y=Ie)}}let Ee=-1,ve=-1,fe=-1;a.program[P]===As&&a.program[P+1]!==Ft&&a.program[P+4]===Rl&&(Ee=a.program[P+1],ve=a.program[P+2],fe=a.program[P+3]),l.push({anchor_id:W,anchor_value_id:Z,anchor_value_suffix_id:re,anchor_text_pred_id:ie,anchor_target_id:M,capture_targets:F,capture_slot_targets:_e,before_pc:we,when_pc:P,max_capture_slots:j.max_slots,anchor_at_start:R.at_start===!0,anchor_frame_kinds:R.frame_kinds!==void 0&&R.frame_kinds.length>0?R.frame_kinds:null,anchor_frame_direct:R.frame_direct===!0,anchor_ternary_colon:R.ternary_colon===void 0?-1:+!!R.ternary_colon,anchor_flags_all:R.stmt_flags_all!==void 0&&R.stmt_flags_all.length>0?R.stmt_flags_all:null,anchor_flags_none:R.stmt_flags_none!==void 0&&R.stmt_flags_none.length>0?R.stmt_flags_none:null,anchor_must_contain:oe,anchor_last_char:Y,inline_when_type:Ee,inline_when_values:ve,inline_when_pred:fe,precedence_override:H.precedence??-1})}let _=Math.max(256,n.length),c=new Int32Array(_);c.fill(-1);let h=new Uint8Array(_),d=[],f=new Map;for(let H of l){let R=f.get(H.anchor_id);R||(R=[],f.set(H.anchor_id,R)),R.push(H)}for(let[H,R]of f){c[H]=d.length,h[H]=R.length;for(let W of R)d.push(W)}let p=new Int32Array(_).fill(-1),m=new Uint8Array(_),g=[],b=[],k=[],x=(H,R,W)=>{g.push(k.length);let j=0;for(let P=H;P<H+R;P++)W(d[P])&&(k.push(P),j++);b.push(j)};for(let[H]of f){let R=c[H],W=h[H];p[H]=g.length;let j=!1;for(let P=R;P<R+W;P++)d[P].anchor_last_char>=0&&(j=!0);if(j){m[H]=1;for(let P=0;P<128;P++)x(R,W,(M)=>M.anchor_last_char<0||M.anchor_last_char===P);x(R,W,(P)=>P.anchor_last_char<0||P.anchor_last_char>=128)}else x(R,W,()=>!0)}let w=Int32Array.from(g),O=Uint8Array.from(b),N=Int32Array.from(k),S=new Uint8Array(Math.max(256,n.length));if(t.trivia)for(let H of t.trivia){let R=s.get(H);R!==void 0&&(S[R]=1)}let D=a.program.slice(0,a.program_len),X=a.value_pool.slice(0,a.value_pool_len),G=a.value_offsets.slice(0,2*a.value_offsets_len);return{compile_base_len:i,appended_names:n.slice(i),compiled:l,anchor_offset:c,anchor_count:h,slot_base:p,slot_by_char:m,slot_start:w,slot_len:O,slot_rules:N,rule_table:d,trivia:S,program:D,value_pool:X,value_offsets:G,params_specs:a.params_specs,span_specs:a.span_specs,has_frame_gates:l.some((H)=>H.anchor_at_start||H.anchor_frame_kinds!==null),has_signal_gates:l.some((H)=>H.anchor_ternary_colon>=0||H.anchor_flags_all!==null||H.anchor_flags_none!==null),kind_gate_cache:new WeakMap,signal_gate_cache:new WeakMap}}function w$(e,t){return e.map((r)=>{if(r.anchor_frame_kinds===null)return null;let n=new Int32Array(r.anchor_frame_kinds.length);for(let s=0;s<r.anchor_frame_kinds.length;s++)n[s]=t.indexOf(r.anchor_frame_kinds[s]),n[s]<0&&Rn()&&nt("rewrite_types",`frame-kind:${r.anchor_frame_kinds[s]}`,`anchor frame kind "${r.anchor_frame_kinds[s]}" is not in the frame table's kind names; the gate can never pass`);return n})}function x$(e,t){let r=new Int32Array(e.length),n=new Int32Array(e.length);for(let s=0;s<e.length;s++){let i=e[s];if(i.anchor_flags_all===null&&i.anchor_flags_none===null)continue;let o=!1,a=(c)=>{if(c===null)return 0;let h=0;for(let d of c){let f=t.indexOf(d);f<0?(o=!0,Rn()&&nt("rewrite_types",`stmt-flag:${d}`,`anchor stmt flag "${d}" is not in the frame table's flag names; the gate can never pass`)):h|=1<<f+1}return h},l=a(i.anchor_flags_all),_=a(i.anchor_flags_none);o&&(l|=1073741824),r[s]=l,n[s]=_}return{all:r,none:n}}function $$(e,t){let r=e.appended_names.length,n=new Int32Array(r);for(let s=0;s<r;s++){let i=e.appended_names[s],o=-1;for(let a=0;a<t.length;a++)if(t[a]===i){o=a;break}o<0&&(o=t.length,t.push(i)),n[s]=o}return n}function Tb(e,t,r){return e<t.compile_base_len?e:r[e-t.compile_base_len]}function an(e,t={}){let r=[];function n(a){e:for(let _=0;_<r.length;_++){let c=r[_].snapshot;if(c.length===a.length){for(let h=0;h<c.length;h++)if(c[h]!==a[h])continue e;return r[_].state}}let l=y$(e,t,a);return r.length>=8&&(r.length=0),r.push({snapshot:a.slice(),state:l}),l}function s(a,l,_,c,h,d){c.compiled.length!==0&&E$(a,l,_,c,$$(c,_),h,d)}let i=(a,l,_,c,h)=>{s(a,l,_,n(_),c,h)},o=(a,l)=>c1(i,a,l);return o.__claim=i,o}function E$(e,t,r,n,s,i,o){let a=t.length/3,{slot_base:l,slot_by_char:_,slot_start:c,slot_len:h,slot_rules:d,rule_table:f,trivia:p,program:m,value_pool:g,value_offsets:b,params_specs:k,span_specs:x}=n,w=null;n.has_frame_gates&&o!==void 0&&(w=n.kind_gate_cache.get(o.kind_names)??null,w===null&&(w=w$(f,o.kind_names),n.kind_gate_cache.set(o.kind_names,w))),n.has_frame_gates&&o===void 0&&Rn()&&nt("rewrite_types","frames-missing","rules with frame gates ran without a frame_track stage upstream; gated rules are disabled");let O=null,N=null,S=o===void 0?Nx:o.signals;if(n.has_signal_gates&&o!==void 0&&S.length>0){let D=n.signal_gate_cache.get(o.flag_names)??null;D===null&&(D=x$(f,o.flag_names),n.signal_gate_cache.set(o.flag_names,D)),O=D.all,N=D.none}n.has_signal_gates&&S.length===0&&Rn()&&nt("rewrite_types","signals-missing","rules with signal gates ran without ternary / stmt_flags configured in the frame_track stage; gated rules are disabled");for(let D=0;D<a;D++){let X=t[3*D];if(p[X])continue;let G=l[X];if(G<0)continue;if(_[X]===1){let W=e.charCodeAt(t[3*D+2]-1);G+=W<128?W:128}let H=c[G],R=H+h[G];for(let W=H;W<R;W++){let j=d[W],P=f[j];if(!(P.anchor_last_char>=0&&e.charCodeAt(t[3*D+2]-1)!==P.anchor_last_char)){if(P.anchor_value_id!==-1&&!io(g,b,P.anchor_value_id,e,t[3*D+1],t[3*D+2])||P.anchor_value_suffix_id!==-1&&!n1(g,b,P.anchor_value_suffix_id,e,t[3*D+1],t[3*D+2]))continue;if(P.anchor_at_start||P.anchor_frame_kinds!==null){if(o===void 0||P.anchor_at_start&&o.at_start[D]!==1)continue;if(P.anchor_frame_kinds!==null){let M=w[j],F;if(P.anchor_frame_direct)F=o.frames[o.active_frame[D]].kind;else{let re=o.active_frame[D],ie=o.frames[re];for(;re>0&&ie.bracket!==1;)re=ie.parent,ie=o.frames[re];F=ie.bracket===1?ie.kind:0}let Z=!1;for(let re=0;re<M.length;re++)if(M[re]===F){Z=!0;break}if(!Z)continue}}if(P.anchor_ternary_colon>=0||P.anchor_flags_all!==null||P.anchor_flags_none!==null){if(D>=S.length)continue;let M=S[D];if(P.anchor_ternary_colon>=0&&(1&M)!==P.anchor_ternary_colon)continue;if(O!==null){let F=O[j];if((M&F)!==F||(M&N[j])!==0)continue}else if(P.anchor_flags_all!==null||P.anchor_flags_none!==null)continue}if(P.anchor_text_pred_id!==-1&&(P.anchor_text_pred_id===-2||!ql(P.anchor_text_pred_id,e,t[3*D+1],t[3*D+2])))continue;if(P.anchor_must_contain>=0){let M=t[3*D+2],F=!1;for(let Z=t[3*D+1];Z<M;Z++)if(e.charCodeAt(Z)===P.anchor_must_contain){F=!0;break}if(!F)continue}if(!(P.before_pc>=0&&v$(m,P.before_pc,t,D-1,e,p,g,b)===bn)){if(P.inline_when_type>=0){let M=D+1;for(;M<a&&p[t[3*M]];)M++;if(M>=a||t[3*M]!==P.inline_when_type||P.inline_when_values>=0&&!io(g,b,P.inline_when_values,e,t[3*M+1],t[3*M+2])||P.inline_when_pred>=0&&!ql(P.inline_when_pred,e,t[3*M+1],t[3*M+2]))continue}else if(g$(m,P.when_pc,t,D+1,a,e,p,g,b,P.max_capture_slots,k,x,o)===bn)continue;if(P.anchor_target_id!==-1){let M=Tb(P.anchor_target_id,n,s),F=P.precedence_override>=0?P.precedence_override:Mn(r[M]);i.emit(D,M,F)}if(P.capture_slot_targets!==null){let M=P.capture_slot_targets;for(let F=0;F<ni;F+=3){let Z=M[Es[F]];if(Z<0)continue;let re=Tb(Z,n,s),ie=P.precedence_override>=0?P.precedence_override:Mn(r[re]),we=Es[F+2];for(let _e=Es[F+1];_e<we;_e++)i.emit(_e,re,ie)}}break}}}}}function ua(e){let t=Object.keys(e),r=t.map((s)=>{return typeof(i=e[s])=="function"?{language:i,trim_start:0,trim_end:0,wrap_token:null}:{language:i.language,trim_start:i.trim_start??0,trim_end:i.trim_end??0,wrap_token:i.wrap_token??null};var i}),n=new WeakMap;return(s,i)=>{let{tokens:o,token_types:a}=i,l=o.length/3,_=n.get(a);if(_===void 0){let f=new Int32Array(a.length).fill(-1),p=!1;for(let m=0;m<t.length;m++){let g=a.indexOf(t[m]);g!==-1&&(f[g]=m,p=!0)}_={table:p?f:null},n.set(a,_)}let c=_.table;if(c===null)return i;let h=[],d=l;for(let f=0;f<l;f++){let p=o[3*f],m=p<c.length?c[p]:-1;if(m<0)continue;let g=r[m],b=f,k=o[3*f+1],x=o[3*f+2];if(g.trim_start===0&&g.trim_end===0)for(;f+1<l&&o[3*(f+1)]===p&&o[3*(f+1)+1]===x;)f++,x=o[3*f+2];let w=Math.min(k+g.trim_start,x),O=Math.max(x-g.trim_end,w),N=s.slice(w,O),S=g.language(N),D=S.tokens.length/3;h.push({host_idx:b,host_end_idx:f+1,sub:S,content_start:w,entry:g,host_start:k,host_end:x});let X=D;g.wrap_token!==null&&(g.trim_start>0&&X++,g.trim_end>0&&X++),d=d-(f+1-b)+X}return h.length===0?i:_1(i,h,d)}}function _1(e,t,r){let n=e.tokens,s=n.length/3,i=e.token_types.slice(),o=new Map;for(let p=0;p<i.length;p++)o.set(i[p],p);let a=(p)=>{let m=o.get(p);return m===void 0&&(m=i.length,i.push(p),o.set(p,m)),m},l=[],_=[],c=(p)=>{e:for(let g=l.length-1;g>=0;g--){let b=l[g];if(b.length===p.length){for(let k=0;k<b.length;k++)if(b[k]!==p[k])continue e;return _[g]}}let m=new Uint32Array(p.length);for(let g=0;g<p.length;g++)m[g]=a(p[g]);return l.push(p),_.push(m),m},h=new Uint32Array(3*r),d=0,f=0;for(let p=0;p<s;p++)if(f<t.length&&t[f].host_idx===p){let{sub:m,content_start:g,entry:b,host_start:k,host_end:x,host_end_idx:w}=t[f++];p=w-1;let O=c(m.token_types),N=b.wrap_token===null?-1:a(b.wrap_token);N!==-1&&b.trim_start>0&&(h[3*d]=N,h[3*d+1]=k,h[3*d+2]=g,d++);let S=m.tokens.length/3;for(let D=0;D<S;D++){let X=3*D;h[3*d]=O[m.tokens[X]],h[3*d+1]=m.tokens[X+1]+g,h[3*d+2]=m.tokens[X+2]+g,d++}N!==-1&&b.trim_end>0&&(h[3*d]=N,h[3*d+1]=x-b.trim_end,h[3*d+2]=x,d++)}else{let m=3*p;h[3*d]=n[m],h[3*d+1]=n[m+1],h[3*d+2]=n[m+2],d++}return{tokens:h,token_types:i}}function Cb(e){return e===32||e===9||e===13||e===10}function A$(e,t,r){for(;t<r&&Cb(e.charCodeAt(t));)t++;let n=t;for(;n<r&&!Cb(e.charCodeAt(n));)n++;return e.slice(t,n)}function T$(e,t,r){if(t>=r)return 0;let n=e.charCodeAt(t);return n===13?t+1<r&&e.charCodeAt(t+1)===10?2:1:+(n===10)}function C$(e,t,r){if(t>=r)return 0;let n=e.charCodeAt(r-1);return n===10?r-1>t&&e.charCodeAt(r-2)===13?2:1:+(n===13)}function u1(e){let t=new Map(Object.entries(e.languages)),r=new WeakMap;return(n,s)=>{let{tokens:i,token_types:o}=s,a=i.length/3,l=r.get(o);l===void 0&&(l={label:o.indexOf(e.label),body:o.indexOf(e.body)},r.set(o,l));let _=l.label,c=l.body;if(_===-1||c===-1)return s;let h=[],d=a;for(let f=0;f<a;f++){if(i[3*f]!==_)continue;let p=i[3*f+1],m=i[3*f+2];for(;f+1<a&&i[3*(f+1)]===_;)f++,m=i[3*f+2];if(f+1>=a||i[3*(f+1)]!==c)continue;let g=t.get(A$(n,p,m));if(g===void 0)continue;let b=++f,k=i[3*f+1],x=i[3*f+2];for(;f+1<a&&i[3*(f+1)]===c&&i[3*(f+1)+1]===x;)f++,x=i[3*f+2];let w=k+T$(n,k,x),O=x-C$(n,w,x);if(w===O)continue;let N=g(n.slice(w,O));h.push({host_idx:b,host_end_idx:f+1,sub:N,content_start:w,entry:{language:g,trim_start:0,trim_end:0,wrap_token:null},host_start:k,host_end:x}),d=d-(f+1-b)+N.tokens.length/3}return h.length===0?s:_1(s,h,d)}}function Y_(e){let t=e.hole_char??" ",r=e.may_match;return(n,s)=>{if(r!==void 0&&!r(n))return s;let i=s;for(let o=0;o<16;o++){let a=S$(e,t,n,i);if(a===i)return i;i=a}return i}}function S$(e,t,r,n){let{tokens:s,token_types:i}=n,o=s.length/3,a=null;if(e.trigger_types!==void 0){a=new Uint8Array(i.length);let O=!1;for(let N of e.trigger_types){let S=i.indexOf(N);S<0||(a[S]=1,O=!0)}if(!O)return n}let l=i,_=null,c=()=>{if(_!==null)return _;l=i.slice();let O=new Map;for(let N=0;N<l.length;N++)O.set(l[N],N);return _=O,O},h=(O)=>{let N=c(),S=N.get(O);return S===void 0&&(S=l.length,l.push(O),N.set(O,S)),S},d=null,f=(O)=>{d===null&&(d=new WeakMap);let N=d.get(O);if(N)return N;N=new Uint32Array(O.length);for(let S=0;S<O.length;S++)N[S]=h(O[S]);return d.set(O,N),N},p=[],m=o,g=0;for(;g<o;){if(a!==null&&a[s[3*g]]===0){g++;continue}let O=e.scan(s,r,g,l);if(O===null){g++;continue}let N=O.language??e.language;if(N===void 0){g++;continue}c();let S=O$(O,r,s,N,t,f,h);p.push({out_idx:0,out:S,token_start:O.token_start,token_end:O.token_end}),m+=S.length-(O.token_end-O.token_start),g=O.token_end>g?O.token_end:g+1}if(p.length===0)return n;let b=new Uint32Array(3*m),k=0,x=0,w=0;for(;w<o;){if(x<p.length&&p[x].token_start===w){let S=p[x++];for(let D=0;D<S.out.length;D++){let X=S.out[D];b[3*k]=X.type,b[3*k+1]=X.start,b[3*k+2]=X.end,k++}w=S.token_end;continue}let O=x<p.length?p[x].token_start:o,N=O>w?O:o;b.set(s.subarray(3*w,3*N),3*k),k+=N-w,w=N}return{tokens:b.subarray(0,3*k),token_types:l}}function O$(e,t,r,n,s,i,o){let a="",l=[],_=[];for(let b=0;b<e.regions.length;b++){let k=e.regions[b];if(k.kind==="content"){let x=t.slice(k.source_start,k.source_end),w=a.length;a+=x,l.push({v_start:w,v_end:a.length,real_start:k.source_start})}else if(k.kind==="hole"){let x=k.source_end-k.source_start,w=a.length;a+=e.fill_hole===void 0?s.length===1?s.repeat(x):s.repeat(x).slice(0,x):e.fill_hole(a,x),_.push({v_start:w,v_end:a.length})}}let c=n(a),h=c.tokens,d=h.length/3,f=i(c.token_types),p=[];for(let b=0;b<d;b++){let k=3*b,x=h[k+1],w=h[k+2],O=f[h[k]];for(let N=0;N<l.length;N++){let S=l[N];if(S.v_end<=x)continue;if(S.v_start>=w)break;let D=Math.max(x,S.v_start),X=Math.min(w,S.v_end);X<=D||p.push({type:O,v_start:D,real_start:S.real_start+(D-S.v_start),real_end:S.real_start+(X-S.v_start)})}}p.sort((b,k)=>b.v_start-k.v_start);let m=[],g=0;for(let b=0;b<e.regions.length;b++){let k=e.regions[b];if(k.kind==="content")for(;g<p.length&&p[g].real_start<k.source_end;){let x=p[g++];m.push({type:x.type,start:x.real_start,end:x.real_end})}else if(k.kind==="hole")for(let x=k.token_start;x<k.token_end;x++){let w=3*x;m.push({type:r[w],start:r[w+1],end:r[w+2]})}else k.kind==="synthetic"&&m.push({type:o(k.type_name),start:k.source_start,end:k.source_end})}return m}function N$(e){return"__claim"in e&&typeof e.__claim=="function"}function R$(e){let t=[],r=[];for(let n=0;n<e.length;n++){let s=e[n];N$(s)?r.push(s):(r.length>0&&(t.push({batch:Ab(r),fn:null}),r=[]),t.push({batch:null,fn:s}))}return r.length>0&&t.push({batch:Ab(r),fn:null}),t}function M$(e){let t=null;return(r,n)=>{t===null&&(t=R$(e));let s=n;for(let i=0;i<t.length;i++){let o=t[i];if(o.batch!==null){s=I$(r,s,o.batch);continue}let a=s.frames,l=s.tokens.length;s=(0,o.fn)(r,s),s.frames===void 0&&a!==void 0&&s.tokens.length===l&&(s={tokens:s.tokens,token_types:s.token_types,overlays:s.overlays,frames:a})}return s}}function I$(e,t,r){let n=t.token_types.slice();R_.reset();for(let i=0;i<r.length;i++)r[i].__claim(e,t.tokens,n,R_,t.frames);if(R_.count===0)return{tokens:t.tokens,token_types:n,frames:t.frames};let s=new Uint32Array(t.tokens);return l1(s,R_),{tokens:s,token_types:n,frames:t.frames}}function ze(e,t,r="type_claim"){return{reclassifier:e,produces:t,layer:r}}function Ht(e,t){return{reclassifier:e,produces:[],layer:t}}function ii(e){let t=(r,n)=>c1(e,r,n);return t.__claim=e,t}function D_(e){return typeof e!="function"}function Sb(e){return e.produces.length===0}function D$(e,t){if(t===void 0||t==="high")return e.map((s)=>D_(s)?s.reclassifier:s);if(t==="low"){let s=[];for(let i of e)D_(i)?Sb(i)&&s.push(i.reclassifier):s.push(i);return s}let r=new Set(t),n=[];for(let s of e)D_(s)?(Sb(s)||s.produces.some((i)=>r.has(i)))&&n.push(s.reclassifier):n.push(s);return n}function Ct(e,t=[]){return(r)=>{let n=M$(D$(t,r?.fidelity)),s=q$(e.token_types,t,r?.fidelity),i=P$(e.token_types,r?.fidelity),o=r?.annotation?Kw(r.annotation,e.token_types):null;return(a,l)=>{let _=l?.open===!0,c=Xw(a,e,null,_),{stable_end:h,comment_cut:d}=c;s!==null&&(Ob(c.tokens,s.remap),c.token_types=s.token_types);let f=n(a,c);if(i!==null&&Ob(f.tokens,i),o!==null){let p=o(a,f,_,d);if(p!==void 0){f.overlays=p;let m=p.undecided;m!==void 0&&h!==void 0&&m<h&&(h=m===0?0:a.lastIndexOf(`
128
+ `,m-1)+1)}}return h!==void 0&&(f.stable_end=h),f}}}var h1={boolean:"identifier",function:"identifier",decorator:"identifier"},_z=Object.keys(h1);function P$(e,t){if(t===void 0||t==="high")return null;let r=t==="low"?null:new Set(t),n=new Int32Array(e.length);n.fill(-1);let s=!1;for(let[i,o]of Object.entries(h1)){if(r!==null&&r.has(i))continue;let a=e.indexOf(i);if(a<0)continue;let l=e.indexOf(o);l<0||(n[a]=l,s=!0)}return s?n:null}function q$(e,t,r){if(r===void 0||r==="high")return null;let n=r==="low"?null:new Set(r),s=new Int32Array(e.length);s.fill(-1);let i=e.length,o=!1;for(let a of t)if(D_(a)&&a.clears!==void 0){for(let[l,_]of Object.entries(a.clears))if(n===null||!n.has(l))for(let c of _){let h=e.indexOf(c);h<0||(s[h]=i,o=!0)}}return o?{remap:s,token_types:[...e,""]}:null}function Ob(e,t){let r=e.length/3,n=t.length;for(let s=0;s<r;s++){let i=e[3*s];if(i<n){let o=t[i];o>=0&&(e[3*s]=o)}}}var L$=class{constructor(e,t,r,n=["comment"]){this.input=e,this.tokens=t,this.token_types=r,this.count=t.length/3;let s=-1,i=new Set;for(let o of n){let a=r.indexOf(o);a<0||(i.add(a),s<0&&(s=a))}this.comment_id=s,this.trivia_set=i.size<=1?null:i}kind_of(e){return this.tokens[3*e]}text_of(e){let t=this.tokens;return this.input.slice(t[3*e+1],t[3*e+2])}is_trivia(e){let t=this.tokens[3*e];return this.trivia_set===null?t===this.comment_id:this.trivia_set.has(t)}next_non_trivia(e){let t=this.tokens,r=this.count,n=this.trivia_set;if(n===null){let s=this.comment_id;for(let i=e;i<r;i++)if(t[3*i]!==s)return i;return-1}for(let s=e;s<r;s++)if(!n.has(t[3*s]))return s;return-1}prev_non_trivia(e){let t=this.tokens,r=this.trivia_set;if(r===null){let n=this.comment_id;for(let s=e;s>=0;s--)if(t[3*s]!==n)return s;return-1}for(let n=e;n>=0;n--)if(!r.has(t[3*n]))return n;return-1}};function Fr(e,t,r,n=["comment"]){return new L$(e,t,r,n)}var qf=new Uint8Array,M_=[],f1=["top","paren","bracket"];function ti(e){let t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return{codes:t}}function Nn(e,t,r,n){let s=n.codes;if(r-t!==s.length)return!1;for(let i=0;i<s.length;i++)if(e.charCodeAt(t+i)!==s[i])return!1;return!0}function Ol(e){if(e===void 0)return[];let t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return t}function F$(e){let t=f1.slice(),r=(i)=>{let o=t.indexOf(i);return o>=0?o:(t.push(i),t.length-1)},n=(e.body_markers??[]).map((i)=>({type:i.type,text:ti(i.text),kind_id:r(i.kind)})),s=(e.prev_rules??[]).map((i)=>{let o=i.prev_last_char_in===void 0?null:[];if(o!==null&&i.prev_last_char_in!==void 0)for(let l=0;l<i.prev_last_char_in.length;l++)o.push(i.prev_last_char_in.charCodeAt(l));return{type:i.prev_type,texts:i.prev_texts===void 0?null:i.prev_texts.map(ti),last_chars:o,in_kind_names:i.in_kinds??null,in_kind_ids:null,scan:i.scan_back===void 0?null:(a=i.scan_back,{over:a.over.map((l)=>({type:l.type,texts:l.texts===void 0?null:l.texts.map(ti),chars:l.chars===void 0?null:Ol(l.chars)})),to_type:a.to.type,to_texts:a.to.texts===void 0?null:a.to.texts.map(ti),to_last_chars:a.to.last_char_in===void 0?null:Ol(a.to.last_char_in),to_prev_chars:a.to.preceded_by_char_in===void 0?null:Ol(a.to.preceded_by_char_in),max:a.max===void 0?16:a.max,skip_groups:a.skip_groups??null}),kind_id:r(i.kind)};var a});for(let i of s){if(i.in_kind_names===null)continue;let o=new Set;for(let a of i.in_kind_names){let l=t.indexOf(a);l>=0?o.add(l):nt("frame_track",`in-kind:${a}`,`prev rule in_kinds kind "${a}" is not declared by the brace_kinds spec; the rule can never match`)}i.in_kind_ids=o}return{kind_names:t,markers:n,pending_in_angles_kind:e.pending_in_angles_kind===void 0?-1:r(e.pending_in_angles_kind),angle_type:e.angles?.type??null,angle_open:e.angles===void 0?null:ti(e.angles.open),angle_closes:(e.angles?.closes??[]).map((i)=>({text:ti(i.text),pops:i.pops})),angle_reset_chars:Ol(e.angles?.reset_chars),marker_reset_chars:Ol(e.marker_reset_chars),prev_rules:s,default_kind:r(e.default_kind),start_kind:r(e.start_kind===void 0?e.default_kind:e.start_kind)}}function j$(e,t){let r=Array(t.length).fill(null);for(let s of e.over){let i=t.indexOf(s.type);if(i<0){nt("frame_track",`scan-over-type:${s.type}`,`scan_back over type "${s.type}" is not in the token vocabulary; the walk stops at it`);continue}let o=s.texts===null&&s.chars===null,a=r[i];a===null?r[i]={any:o,texts:s.texts,chars:s.chars}:(a.any=a.any||o,s.texts!==null&&(a.texts=a.texts===null?s.texts:a.texts.concat(s.texts)),s.chars!==null&&(a.chars=a.chars===null?s.chars:a.chars.concat(s.chars)))}let n=t.indexOf(e.to_type);return n<0&&nt("frame_track",`scan-to-type:${e.to_type}`,`scan_back landing type "${e.to_type}" is not in the token vocabulary; the rule can never match`),{over:r,to_type_id:n,to_texts:e.to_texts,to_last_chars:e.to_last_chars,to_prev_chars:e.to_prev_chars,max:e.max,group_type_id:e.skip_groups===null?-1:t.indexOf(e.skip_groups)}}function z$(e,t){let r=Array(t.length).fill(null);for(let o of e.markers){let a=t.indexOf(o.type);if(a<0){nt("frame_track",`marker-type:${o.type}`,`body marker type "${o.type}" is not in the token vocabulary; the marker can never arm`);continue}let l=r[a];l===null&&(l=[],r[a]=l),l.push({text:o.text,kind_id:o.kind_id})}let n=e.angle_type===null?-1:t.indexOf(e.angle_type);e.angle_type!==null&&n<0&&nt("frame_track",`angle-type:${e.angle_type}`,`angle type "${e.angle_type}" is not in the token vocabulary; angle depth is never tracked`);let s=e.prev_rules.map((o)=>{let a=t.indexOf(o.type);return a<0&&nt("frame_track",`prev-rule-type:${o.type}`,`prev rule type "${o.type}" is not in the token vocabulary; the rule can never match`),{type_id:a,texts:o.texts,last_chars:o.last_chars,in_kind_ids:o.in_kind_ids,scan:o.scan===null?null:j$(o.scan,t),kind_id:o.kind_id}}),i=Array(t.length).fill(null);for(let o of s){if(o.type_id<0)continue;let a=i[o.type_id];a===null&&(a=[],i[o.type_id]=a),a.push(o)}return{marker_lists:r,angle_type_id:n,prev_rules:s,prev_rule_lists:i}}var F_=127;function U$(e,t){if(t.codes.length===0){for(let n=0;n<128;n++)Nb(e,n,t);return}let r=t.codes[0];Nb(e,r<F_?r:F_,t)}function Nb(e,t,r){let n=e[t];n===null?e[t]=[r]:n.push(r)}function Rb(e,t,r){let n=t<r?e.charCodeAt(t):0;return n<F_?n:F_}function B$(e,t){let r=-1;e.ternary_qmark_type!==null&&(r=t.indexOf(e.ternary_qmark_type),r<0&&nt("frame_track",`qmark-type:${e.ternary_qmark_type}`,`ternary qmark type "${e.ternary_qmark_type}" is not in the token vocabulary; ternary colons are never marked`));let n=Array(t.length).fill(null);for(let s of e.stmt_rules){let i=t.indexOf(s.type);if(i<0){nt("frame_track",`stmt-type:${s.type}`,`stmt flag trigger type "${s.type}" is not in the token vocabulary; the trigger can never fire`);continue}let o=s.text.codes.length>0?s.text.codes[0]:0;if(o>=128){nt("frame_track",`stmt-text:${s.type}`,"stmt flag trigger text starting with a non-ascii char cannot be bucketed; the trigger can never fire");continue}let a=n[i];a===null&&(a=Array(128).fill(null),n[i]=a);let l=a[o];l===null&&(l=[],a[o]=l),l.push(s)}return{qmark_type_id:r,stmt_lists:n}}function Ul(e,t){for(let r=0;r<e.length;r++)if(t===e[r])return!0;return!1}function Jf(e,t,r){let n=r;for(;n>=0&&1&t[e[3*n]];)n--;return n}function H$(e,t,r,n,s,i){let o=t[3*s+1];if(n.to_texts!==null){let a=!1;for(let l=0;l<n.to_texts.length;l++)if(Nn(e,o,i,n.to_texts[l])){a=!0;break}if(!a)return!1}if(n.to_last_chars!==null&&!Ul(n.to_last_chars,e.charCodeAt(i-1)))return!1;if(n.to_prev_chars!==null){let a;if(i-2>=o)a=e.charCodeAt(i-2);else{let l=Jf(t,r,s-1);if(l<0)return!1;a=e.charCodeAt(t[3*l+2]-1)}if(!Ul(n.to_prev_chars,a))return!1}return!0}function Lf(e,t,r,n,s,i=-1){let o=n.over,a=s,l=i;for(let _=0;_<n.max;_++){if(l<0&&(a=Jf(t,r,a),a<0))return!1;let c=3*a,h=t[c],d=t[c+1],f=l>=0?l:t[c+2];if(l=-1,h===n.to_type_id&&H$(e,t,r,n,a,f))return!0;if(h===n.group_type_id&&j_(e.charCodeAt(f-1))){let m=J$(e,t,r,n.group_type_id,a,f);if(m<0)return!1;a=d1,m>t[3*a+1]?l=m:a--;continue}let p=o[h]??null;if(p===null)return!1;if(!p.any){let m=!1;if(p.texts!==null){for(let g=0;g<p.texts.length;g++)if(Nn(e,d,f,p.texts[g])){m=!0;break}}if(!m&&p.chars!==null){m=!0;for(let g=d;g<f;g++)if(!Ul(p.chars,e.charCodeAt(g))){m=!1;break}}if(!m)return!1}a--}return!1}var V$=41,Y$=93,G$=125,W$=40,X$=91,K$=123;function j_(e){return e===V$||e===Y$||e===G$}function Z$(e){return e===W$||e===X$||e===K$}var d1=-1;function J$(e,t,r,n,s,i){let o=0,a=s,l=i-1;for(let _=0;_<256;_++){if(t[3*a]===n){let c=t[3*a+1];for(;l>=c;l--){let h=e.charCodeAt(l);if(j_(h))o++;else if(Z$(h)&&--o===0)return d1=a,l}}if(a=Jf(t,r,a-1),a<0)return-1;l=t[3*a+2]-1}return-1}function Mb(e,t,r,n,s,i,o,a,l,_,c,h){if(_>=0){let b=s.prev_rule_lists[l]??null;if(b===null)return n.default_kind;for(let k=0;k<b.length;k++){let x=b[k];if(x.texts!==null){let w=!1;for(let O=0;O<x.texts.length;O++){let N=x.texts[O].codes;if(N.length===1&&N[0]===_){w=!0;break}}if(!w)continue}else if(x.last_chars!==null&&!Ul(x.last_chars,_))continue;if((x.in_kind_ids===null||x.in_kind_ids.has(o[a].kind))&&(x.scan===null||(x.scan.group_type_id===l&&j_(_)?Lf(e,t,r,x.scan,c,h):Lf(e,t,r,x.scan,i))))return x.kind_id}return n.default_kind}if(i<0)return n.start_kind;let d=3*i,f=t[d],p=s.prev_rule_lists[f]??null;if(p===null)return n.default_kind;let m=t[d+1],g=t[d+2];for(let b=0;b<p.length;b++){let k=p[b];if(k.texts!==null){let x=k.texts,w=!1;for(let O=0;O<x.length;O++)if(Nn(e,m,g,x[O])){w=!0;break}if(!w)continue}else if(k.last_chars!==null&&!Ul(k.last_chars,e.charCodeAt(g-1)))continue;if((k.in_kind_ids===null||k.in_kind_ids.has(o[a].kind))&&(k.scan===null||Lf(e,t,r,k.scan,f===k.scan.group_type_id&&j_(e.charCodeAt(g-1))?i:i-1)))return k.kind_id}return n.default_kind}function Ib(e,t,r){if(e===void 0)return null;if(t===null)return nt("frame_track",`${r}-without-kinds`,`${r} is set but brace_kinds is not configured; it never matches`),null;let n=new Set;for(let s of e){let i=t.kind_names.indexOf(s);i>=0?n.add(i):nt("frame_track",`${r}:${s}`,`${r} kind "${s}" is not declared by the brace_kinds spec; it never matches`)}return n}function Q$(e){let t=(p)=>p!==void 0&&p.length>0?p.charCodeAt(0):-1,r=[];if(e.at_start!==void 0)for(let p=0;p<e.at_start.reset_chars.length;p++)r.push(e.at_start.reset_chars.charCodeAt(p));let n=(e.at_start?.transparent_texts_for_type??[]).map((p)=>({type:p.type,texts:p.texts.map(ti)})),s=e.brace_kinds===void 0?null:F$(e.brace_kinds),i=Ib(e.at_start?.rearm_after_close_kinds,s,"rearm_after_close_kinds"),o=Ib(e.ternary?.optional_member_kinds,s,"optional_member_kinds"),a=e.stmt_flags??[];a.length>7&&nt("frame_track","stmt-flags-overflow",`stmt_flags declares ${a.length} flags but only 7 signal bits exist; extras are ignored`);let l=[],_=new Map,c=[],h=[],d=0,f=(p,m)=>{let g=`${p}\x00${m}`,b=_.get(g);return b===void 0&&(b={type:p,text:ti(m),arm_mask:0,clear_mask:0},_.set(g,b)),b};for(let p=0;p<a.length&&p<7;p++){let m=a[p],g=1<<p;l.push(m.name);for(let b of m.arm.texts)f(m.arm.type,b).arm_mask|=g;if(m.clear!==void 0)for(let b of m.clear.texts)f(m.clear.type,b).clear_mask|=g;if(m.clear_chars!==void 0)for(let b=0;b<m.clear_chars.length;b++){let k=m.clear_chars.charCodeAt(b),x=c.indexOf(k);x>=0?h[x]|=g:(c.push(k),h.push(g))}m.clear_on_brace_close===!0&&(d|=g)}return{punct_type:e.punct_type,paren_open:t(e.brackets.paren?.open),paren_close:t(e.brackets.paren?.close),brace_open:t(e.brackets.brace?.open),brace_close:t(e.brackets.brace?.close),bracket_open:t(e.brackets.bracket?.open),bracket_close:t(e.brackets.bracket?.close),at_start_reset_chars:r,at_start_transparent:e.at_start?.transparent_types??[],at_start_transparent_texts:n,at_start_enabled:e.at_start!==void 0,rearm_kind_ids:i,brace_kinds:s,ternary_qmark_type:e.ternary?.qmark.type??null,ternary_qmark_text:e.ternary===void 0?null:ti(e.ternary.qmark.text),ternary_colon_code:e.ternary!==void 0&&e.ternary.colon_char.length>0?e.ternary.colon_char.charCodeAt(0):-1,optional_kind_ids:o,stmt_flag_names:l,stmt_rules:Array.from(_.values()),stmt_clear_char_codes:c,stmt_clear_char_masks:h,stmt_brace_close_clear_mask:d,signals_enabled:e.ternary!==void 0||l.length>0}}function Db(e,t){let r=t.indexOf(e.punct_type);r<0&&Rn()&&nt("frame_track",`punct-type:${e.punct_type}`,`punct_type "${e.punct_type}" is not in the token vocabulary; no frames will be tracked`);let n=e.brace_kinds,s=n===null?null:z$(n,t),i=e.signals_enabled?B$(e,t):null,o=null,a=null;if(e.at_start_enabled||n!==null||e.signals_enabled){o=new Uint8Array(t.length);let l=t.indexOf("comment");l>=0&&(o[l]|=1);for(let _=0;_<e.at_start_transparent.length;_++){let c=t.indexOf(e.at_start_transparent[_]);c>=0&&(o[c]|=2)}for(let _ of e.at_start_transparent_texts){let c=t.indexOf(_.type);c>=0&&(o[c]|=4)}if(s!==null){for(let _=0;_<s.marker_lists.length;_++)s.marker_lists[_]!==null&&(o[_]|=8);s.angle_type_id>=0&&(o[s.angle_type_id]|=16)}if(i!==null){i.qmark_type_id>=0&&(o[i.qmark_type_id]|=32);for(let _=0;_<i.stmt_lists.length;_++)i.stmt_lists[_]!==null&&(o[_]|=64)}if(e.at_start_transparent_texts.length>0){a=Array(t.length).fill(null);for(let _ of e.at_start_transparent_texts){let c=t.indexOf(_.type);if(c<0)continue;let h=a[c];h===null&&(h=Array(128).fill(null),a[c]=h);for(let d of _.texts)U$(h,d)}}}return{punct_id:r,kind_tables:s,signal_tables:i,type_flags:o,transparent_texts:a}}function G_(e){let t=Q$(e),r=t.brace_kinds===null?f1:t.brace_kinds.kind_names,n=new WeakMap;return t.signals_enabled?(s,i)=>{let o=n.get(i.token_types);o===void 0&&(o=Db(t,i.token_types),n.set(i.token_types,o));let a=o.punct_id,l=o.kind_tables,_=o.type_flags,c=o.transparent_texts,h=o.signal_tables.stmt_lists,{brace_kinds:d,at_start_enabled:f,paren_open:p,paren_close:m,brace_open:g,brace_close:b,bracket_open:k,bracket_close:x,at_start_reset_chars:w}=t,O=w.length,N=t.rearm_kind_ids,S=l===null?null:l.marker_lists,{ternary_qmark_text:D,ternary_colon_code:X,optional_kind_ids:G,stmt_clear_char_codes:H,stmt_clear_char_masks:R}=t,W=H.length,j=t.stmt_brace_close_clear_mask,{tokens:P}=i,M=P.length/3,F=new Uint32Array(M),Z=new Uint8Array(3*M),re=f?new Uint8Array(M):qf,ie=new Uint8Array(M),we=[{bracket:-1,kind:0,enter_idx:-1,parent:-1}],_e=0,oe=1,Y=[],Ee=[],ve=0,fe=0,ye=[],Ie=[],Se=!1,Ke=0,rt=0,Ze=0,it=0,Xe=d===null?M_:d.angle_reset_chars,ht=Xe.length,dt=-1,Fe=-1,De=-1,Yn=d===null?M_:d.marker_reset_chars,gk=Yn.length,uc=-1;for(let Gn=0;Gn<M;Gn++){let jr=3*Gn,Ia=P[jr],Rs=_[Ia],Wp=!!(1&Rs),hc=!1;if(f&&(hc=!!(2&Rs),re[Gn]=oe,oe!==0&&!hc&&4&Rs&&c!==null)){let Sr=c[Ia],Pn=P[jr+1],hr=P[jr+2],wt=Sr===null?null:Sr[Rb(s,Pn,hr)];if(wt!==null){for(let ot=0;ot<wt.length;ot++)if(Nn(s,Pn,hr,wt[ot])){hc=!0;break}}}if(24&Rs&&S!==null){if(8&Rs){let Sr=S[Ia];if(Sr!==null){let Pn=P[jr+1],hr=P[jr+2];for(let wt=0;wt<Sr.length;wt++)if(Nn(s,Pn,hr,Sr[wt].text)){dt=Sr[wt].kind_id,Fe=rt,De=Ke|Ze<<8|it<<16;break}}}if(16&Rs&&d!==null){let Sr=P[jr+1],Pn=P[jr+2];if(d.angle_open!==null&&Nn(s,Sr,Pn,d.angle_open))it++;else{let hr=d.angle_closes;for(let wt=0;wt<hr.length;wt++)if(Nn(s,Sr,Pn,hr[wt].text)){it=Math.max(0,it-hr[wt].pops);break}}}}let Xp=0,Kp=!1;if(96&Rs&&(32&Rs&&D!==null&&(!Nn(s,P[jr+1],P[jr+2],D)||G!==null&&f&&uc>=0&&re[uc]===1&&G.has(we[_e].kind)||(ve++,Kp=!0)),64&Rs)){let Sr=h[Ia];if(Sr!==null){let Pn=P[jr+1],hr=P[jr+2],wt=s.charCodeAt(Pn),ot=wt<128?Sr[wt]:null;if(ot!==null){for(let _n=0;_n<ot.length;_n++)if(Nn(s,Pn,hr,ot[_n].text)){fe=(fe|ot[_n].arm_mask)&~ot[_n].clear_mask;break}}}}if(a>=0&&Ia===a){let Sr=P[jr+1],Pn=P[jr+2];for(let hr=Sr;hr<Pn;hr++){let wt=s.charCodeAt(hr);if(wt===p){f&&(oe=0);let ot=we.length;we.push({bracket:0,kind:1,enter_idx:Gn,parent:_e}),Y.push(_e),Ee.push(oe),ye.push(ve),Ie.push(fe),_e=ot,oe=0,ve=0,fe=0,Ke++}else if(wt===m)Y.length>0&&(_e=Y.pop(),oe=Ee.pop(),ve=ye.pop(),fe=Ie.pop()),Ke>0&&Ke--,f&&(oe=0);else if(wt===g){f&&(oe=0);let ot=0;d!==null&&l!==null&&(dt>=0&&it===0&&Ke===0&&Ze===0?(ot=dt,dt=-1):ot=dt>=0&&it>0?d.pending_in_angles_kind>=0?d.pending_in_angles_kind:d.default_kind:Mb(s,P,_,d,l,uc,we,_e,a,hr>Sr?s.charCodeAt(hr-1):-1,Gn,hr));let _n=we.length;we.push({bracket:1,kind:ot,enter_idx:Gn,parent:_e}),Y.push(_e),Ee.push(oe),ye.push(ve),Ie.push(fe),_e=_n,oe=1,ve=0,fe=0,rt++}else if(wt===b){it=0;let ot=!1;if(Y.length>0&&(_e=Y.pop(),oe=Ee.pop(),ve=ye.pop(),fe=Ie.pop()&~j,ot=!0),rt>0&&rt--,f){let _n=0;ot&&N!==null&&N.has(we[_e].kind)&&(_n=1),oe=_n}}else if(wt===k){f&&(oe=0);let ot=we.length;we.push({bracket:2,kind:2,enter_idx:Gn,parent:_e}),Y.push(_e),Ee.push(oe),ye.push(ve),Ie.push(fe),_e=ot,oe=0,ve=0,fe=0,Ze++}else if(wt===x)Y.length>0&&(_e=Y.pop(),oe=Ee.pop(),ve=ye.pop(),fe=Ie.pop()),Ze>0&&Ze--,f&&(oe=0);else{if(wt===X&&ve>0)ve--,Se&&hr===Sr||(Xp|=1);else if(W>0){for(let ot=0;ot<W;ot++)if(wt===H[ot]){fe&=~R[ot];break}}for(let ot=0;ot<ht;ot++)if(wt===Xe[ot]){it=0;break}if(dt>=0&&rt===Fe&&(Ke|Ze<<8|it<<16)===De){for(let ot=0;ot<gk;ot++)if(wt===Yn[ot]){dt=-1,Fe=-1;break}}if(f){let ot=!1;for(let _n=0;_n<O;_n++)if(wt===w[_n]){ot=!0;break}oe=+!!ot}}}}else!f||Wp||hc||(oe=0);Wp||(uc=Gn,Se=Kp),F[Gn]=_e,ie[Gn]=Xp|fe<<1,Z[jr]=Ke,Z[jr+1]=rt,Z[jr+2]=Ze}return{tokens:i.tokens,token_types:i.token_types,overlays:i.overlays,frames:{active_frame:F,depths:Z,at_start:re,frames:we,kind_names:r,signals:ie,flag_names:t.stmt_flag_names}}}:(s,i)=>{let o=n.get(i.token_types);o===void 0&&(o=Db(t,i.token_types),n.set(i.token_types,o));let a=o.punct_id,l=o.kind_tables,_=o.type_flags,c=o.transparent_texts,{brace_kinds:h,at_start_enabled:d,paren_open:f,paren_close:p,brace_open:m,brace_close:g,bracket_open:b,bracket_close:k,at_start_reset_chars:x}=t,w=x.length,O=t.rearm_kind_ids,N=l===null?null:l.marker_lists,{tokens:S}=i,D=S.length/3,X=new Uint32Array(D),G=new Uint8Array(3*D),H=d?new Uint8Array(D):qf,R=[{bracket:-1,kind:0,enter_idx:-1,parent:-1}],W=0,j=1,P=[],M=[],F=0,Z=0,re=0,ie=0,we=h===null?M_:h.angle_reset_chars,_e=we.length,oe=-1,Y=-1,Ee=-1,ve=h===null?M_:h.marker_reset_chars,fe=ve.length,ye=-1;for(let Ie=0;Ie<D;Ie++){let Se=3*Ie,Ke=S[Se],rt=_===null?0:_[Ke],Ze=!!(1&rt),it=!1;if(d&&(it=!!(2&rt),H[Ie]=j,j!==0&&!it&&4&rt&&c!==null)){let Xe=c[Ke],ht=S[Se+1],dt=S[Se+2],Fe=Xe===null?null:Xe[Rb(s,ht,dt)];if(Fe!==null){for(let De=0;De<Fe.length;De++)if(Nn(s,ht,dt,Fe[De])){it=!0;break}}}if(24&rt&&N!==null){if(8&rt){let Xe=N[Ke];if(Xe!==null){let ht=S[Se+1],dt=S[Se+2];for(let Fe=0;Fe<Xe.length;Fe++)if(Nn(s,ht,dt,Xe[Fe].text)){oe=Xe[Fe].kind_id,Y=Z,Ee=F|re<<8|ie<<16;break}}}if(16&rt&&h!==null){let Xe=S[Se+1],ht=S[Se+2];if(h.angle_open!==null&&Nn(s,Xe,ht,h.angle_open))ie++;else{let dt=h.angle_closes;for(let Fe=0;Fe<dt.length;Fe++)if(Nn(s,Xe,ht,dt[Fe].text)){ie=Math.max(0,ie-dt[Fe].pops);break}}}}if(a>=0&&Ke===a){let Xe=S[Se+1],ht=S[Se+2];for(let dt=Xe;dt<ht;dt++){let Fe=s.charCodeAt(dt);if(Fe===f){d&&(j=0);let De=R.length;R.push({bracket:0,kind:1,enter_idx:Ie,parent:W}),P.push(W),M.push(j),W=De,j=0,F++}else if(Fe===p)P.length>0&&(W=P.pop(),j=M.pop()),F>0&&F--,d&&(j=0);else if(Fe===m){d&&(j=0);let De=0;h!==null&&l!==null&&(oe>=0&&ie===0&&F===0&&re===0?(De=oe,oe=-1):oe>=0&&ie>0?De=h.pending_in_angles_kind>=0?h.pending_in_angles_kind:h.default_kind:_!==null&&(De=Mb(s,S,_,h,l,ye,R,W,a,dt>Xe?s.charCodeAt(dt-1):-1,Ie,dt)));let Yn=R.length;R.push({bracket:1,kind:De,enter_idx:Ie,parent:W}),P.push(W),M.push(j),W=Yn,j=1,Z++}else if(Fe===g){ie=0;let De=!1;if(P.length>0&&(W=P.pop(),j=M.pop(),De=!0),Z>0&&Z--,d){let Yn=0;De&&O!==null&&O.has(R[W].kind)&&(Yn=1),j=Yn}}else if(Fe===b){d&&(j=0);let De=R.length;R.push({bracket:2,kind:2,enter_idx:Ie,parent:W}),P.push(W),M.push(j),W=De,j=0,re++}else if(Fe===k)P.length>0&&(W=P.pop(),j=M.pop()),re>0&&re--,d&&(j=0);else{for(let De=0;De<_e;De++)if(Fe===we[De]){ie=0;break}if(oe>=0&&Z===Y&&(F|re<<8|ie<<16)===Ee){for(let De=0;De<fe;De++)if(Fe===ve[De]){oe=-1,Y=-1;break}}if(d){let De=!1;for(let Yn=0;Yn<w;Yn++)if(Fe===x[Yn]){De=!0;break}j=+!!De}}}}else!d||Ze||it||(j=0);Ze||(ye=Ie),X[Ie]=W,G[Se]=F,G[Se+1]=Z,G[Se+2]=re}return{tokens:i.tokens,token_types:i.token_types,overlays:i.overlays,frames:{active_frame:X,depths:G,at_start:H,frames:R,kind_names:r,signals:qf,flag_names:t.stmt_flag_names}}}}function p1(e){let t=e.post_open_required===void 0?null:new Set(e.post_open_required.text_in);return ii((r,n,s,i)=>{let o=n.length/3;if(o===0)return;let a=s.indexOf(e.open_type),l=s.indexOf(e.close_type);if(a<0||l<0){if(Rn()){let b=a<0?e.open_type:e.close_type;nt("matched_bracket",`endpoint-type:${b}`,`endpoint type "${b}" is not in the token vocabulary; pass disabled`)}return}let _=s.indexOf("comment"),c=e.post_open_required===void 0?-1:s.indexOf(e.post_open_required.type);if(e.post_open_required!==void 0&&c<0)return void(Rn()&&nt("matched_bracket",`post-open-type:${e.post_open_required.type}`,`post_open_required type "${e.post_open_required.type}" is not in the token vocabulary; pass disabled`));let h=e.retag_open_to===void 0?a:s.indexOf(e.retag_open_to),d=e.retag_close_to===void 0?l:s.indexOf(e.retag_close_to);if(h<0||d<0){if(Rn()){let b=h<0?e.retag_open_to:e.retag_close_to;nt("matched_bracket",`retag-type:${b}`,`retag target "${b}" is not in the token vocabulary; pass disabled`)}return}let f=Mn(e.retag_open_to??e.open_type),p=Mn(e.retag_close_to??e.close_type),m=(b)=>r.slice(n[3*b+1],n[3*b+2]),g=(b)=>{for(let k=b;k<o;k++)if(n[3*k]!==_)return k;return-1};for(let b=0;b<o;b++)if(n[3*b]===a&&m(b)===e.open_text){if(t!==null){let k=g(b+1);if(k===-1||n[3*k]!==c||!t.has(m(k)))continue}for(let k=b+1;k<o;k++)if(n[3*k]===l&&m(k)===e.close_text){h!==a&&i.emit(b,h,f),d!==l&&i.emit(k,d,p),b=k;break}}})}function e2(e,t){let r=new Map,n=new Map;for(let s of t.styles){let i=e.indexOf(s.open_type),o=e.indexOf(s.close_type);i>=0&&r.set(i,s.style_name),o>=0&&n.set(o,s.style_name)}return{by_open_id:r,by_close_id:n}}function m1(e){return(t,r)=>{let{tokens:n,token_types:s}=r,i=s.slice(),o=e2(i,e);if(o.by_open_id.size===0&&o.by_close_id.size===0)return Rn()&&nt("compound_compose","no-styles","none of the configured open/close marker types are in the token vocabulary; pass disabled"),r;let a=new Map;for(let k=0;k<i.length;k++)a.set(i[k],k);let l=(k)=>{let x=a.get(k);return x===void 0&&(x=i.length,i.push(k),a.set(k,x)),x},_=(k,x)=>k.length===0?x:x===""||e.dedup_against_base&&k.indexOf(x)!==-1?k.join(e.join_separator):k.join(e.join_separator)+e.join_separator+x,c=new Uint32Array(n.length),h=[],d=0,f=i.length,p=Array(f).fill(void 0),m=Array(f).fill(void 0);for(let[k,x]of o.by_open_id)p[k]=x;for(let[k,x]of o.by_close_id)m[k]=x;let g=a.size===f,b=-2;for(let k=0;k<n.length;k+=3){let x=n[k],w=n[k+1],O=n[k+2];e.auto_pop_on_newline&&h.length>0&&(b!==-1&&b<d&&(b=t.indexOf(`
129
+ `,d)),b!==-1&&b<w&&(h.length=0));let N=p[x],S=N===void 0?m[x]:void 0;if(N!==void 0){let D,X=h.lastIndexOf(N);X===-1?(h.push(N),D=h.join(e.join_separator)):(D=h.join(e.join_separator),h.length=X),c[k]=l(D)}else if(S!==void 0){let D=h.join(e.join_separator),X=h.lastIndexOf(S);X!==-1&&(h.length=X),c[k]=l(D)}else c[k]=h.length===0&&g?x:l(_(h,i[x]));c[k+1]=w,c[k+2]=O,d=O}return{tokens:c,token_types:i,overlays:r.overlays,frames:r.frames}}}function g1(e,t){return e<<5|(t<32?t:31)}function ha(e,t={}){let r=t.fold===!0,n=Array(4096).fill(null),s=new Map,i=1/0,o=0;for(let a=0;a<e.length;a++)for(let l of e[a]){if(l.length===0||s.has(l))continue;let _=a+1;s.set(l,_),l.length<i&&(i=l.length),l.length>o&&(o=l.length);let c=l.charCodeAt(0);if(c>=128)continue;let h=new Uint16Array(l.length);for(let p=0;p<l.length;p++)h[p]=l.charCodeAt(p);let d=g1(c,l.length),f=n[d];f===null&&(f=[],n[d]=f),f.push({codes:h,value:_})}return{buckets:n,min_len:i===1/0?1:i,max_len:o,fold:r,exact:s}}function fa(e,t,r,n){let s=n-r;if(s<e.min_len||s>e.max_len)return 0;let i=t.charCodeAt(r);if(i>=128)return Pb(e,t,r,n);let o=e.fold;o&&i>=65&&i<=90&&(i|=32);let a=e.buckets[g1(i,s)];if(a===null)return 0;for(let l=0;l<a.length;l++){let _=a[l].codes;if(_.length!==s)continue;let c=1;for(;c<s;c++){let h=t.charCodeAt(r+c);if(h!==_[c]){if(!o)break;if(h>=128)return Pb(e,t,r,n);if(h<65||h>90||(32|h)!==_[c])break}}if(c===s)return a[l].value}return 0}function Pb(e,t,r,n){let s=e.fold?t.slice(r,n).toLowerCase():t.slice(r,n);return e.exact.get(s)??0}var tt=(e)=>({__range:!0,pairs:e}),t2=(e)=>typeof e=="object"&&!!e&&e.__range===!0,W_=tt([["a","z"]]),X_=tt([["A","Z"]]),Ue=tt([["a","z"],["A","Z"]]),xe=tt([["0","9"]]),st=tt([["a","z"],["A","Z"],["0","9"]]),he=tt([["0","9"],["a","f"],["A","F"]]),A=(e)=>({state:e}),T=(e)=>({state:e,exit:!0}),E=()=>({exit:!0}),ln=(e)=>e?T(e):{},v1=(e,t,r)=>{let n=Array.isArray(e)?e:[e],s=[],i=[];for(let a of n)t2(a)?i.push(...a.pairs):s.push(a);let o={...r};return t!=null&&(o.token=t),s.length===1?o.match=s[0]:s.length>1&&(o.match=s),i.length&&(o.range=i),o},u=(e,t,r={})=>v1(e,t,r),L=(e,t={})=>v1(e,null,t),et=(e,t={},r="keyword")=>({match:e,boundary:!0,token:r,...t}),ct=(e,t,r,n={})=>({match_within:{start:e,end:t,...n},token:r}),C=(e={})=>({any:!0,...e});var uz=new Uint32Array;var b1="boolean",Be="comment",me="identifier",Nt="keyword",J="number",ce="operator",I="punctuation",jt="regex",q="string",K_="template",Os="attribute",Hl="builtin",lo="class_name";var da="decorator",k1="lifetime";var y1="parameter",Vl="property",Qf="type",Wr="variable";var Z_="function",J_="attr_name",pa="doctype",Yl="entity",Xr="tag_name",oi="css_variable",Ns="selector",Q_="selector_class",eu="selector_id",Ti="selector_pseudo",ma="unit",w1="changed",x1="changed_marker",$1="deleted",E1="deleted_marker";var A1="heading",T1="inserted",C1="inserted_marker",ga="label",S1="autolink",ed="bold",O1="code",tu="code_block",td="code_language",rd="italic",N1="link_text",R1="strike",M1="url",Gl="url_link",nd="url_title",I1="autolink_close",sd="autolink_open",id="bold_close",_s="bold_open",D1="code_close",od="code_open",ad="italic_close",us="italic_open",P1="link_text_close",ld="link_text_open",q1="strike_close",va="strike_open",L1="blockquote_marker",co="code_fence",ru="front_matter_marker",F1="heading_marker",nu="hr",j1="list_marker",z1="task_marker",U1="escape",B1="hard_break",ur="expression",cd="svelte_block",H1="svelte_directive";var Wl="raw_code_block",V1="raw_front_matter";var ba="raw_script";var ka="raw_style",Ci="raw_svelte_expression",B="string_escape",su="format",_d="attr_sigil";var iu="bit";var r2=["if","then","elif","else","fi","time","for","in","until","while","do","done","case","esac","coproc","select","function"],n2="cd.echo.exec.exit.export.eval.getopts.hash.printf.pwd.read.readonly.return.set.shift.test.times.trap.unset.break.continue.umask.wait.alias.bind.builtin.caller.command.declare.disown.enable.help.history.jobs.kill.let.local.logout.mapfile.popd.pushd.readarray.shopt.source.suspend.type.typeset.ulimit.unalias".split("."),s2=["true","false"],i2=["$@","$*","$#","$?","$-","$$","$!","$_","$0","$1","$2","$3","$4","$5","$6","$7","$8","$9"],J1=[];for(let e of"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_")J1.push("$"+e);var o2=["<<<","<<-","&>>"],a2=["<<",">>",">&","<&","<>",">|","&>"],l2=["<",">"],c2=[";;&"],_2=[";;",";&","&&","||","|&"],u2=[";","&","|"],Y1=["**=","<<=",">>="],G1=["**","<<",">>","<=",">=","==","!=","&&","||","++","--","+=","-=","*=","/=","%=","&=","|=","^="],W1=["+","-","*","/","%","&","|","^","~","!","<",">","=","?",":",","],h2=["-ef","-nt","-ot","-eq","-ne","-lt","-le","-gt","-ge"],f2="-a.-b.-c.-d.-e.-f.-g.-h.-k.-n.-o.-p.-r.-s.-t.-u.-v.-w.-x.-z.-G.-L.-N.-O.-R.-S".split("."),d2=["@U","@u","@L","@Q","@E","@P","@A","@a","@K","@k"],p2=[":-",":=",":?",":+","##","%%","//","/#","/%","^^",",,"],m2=["#","%","/","^",",","!","-","=","?","+",":","@"],g2=new Set(r2),v2=new Set(n2),b2=new Set(s2),Xl=L([" ","\t",`
130
+ `,"\r"]),Kl=u("\\\n",ce),k2={...ct("#",`
131
+ `,Be),seal:!0},Q1=ct("'","'",q);ct("$'","'",q,{escape:"\\"});var ud=ct("`","`",q,{escape:"\\"}),y2=[u("$'",q,A("ansi_string_state")),u('$"',q,A("double_string"))],e0=[u("$((",I,A("arith")),u("$(",I,A("cmd_sub")),u("${",I,A("param_exp")),u(i2,Wr),u(J1,Wr),u("$",ce)],_o=[...y2,...e0],Zl=[u('"',q,A("double_string")),Q1,ud],X1=["EOF","EOT","END","EOL","EOM","HEREDOC","_EOF_","eof"],w2=(e)=>[`'${e}'`,`"${e}"`,`\\${e}`],K1=(e,t)=>{let r=t?"_raw":"";return{[`heredoc_open_${e}${r}`]:{rules:[L(`
132
+ `,T(`heredoc_line_${e}${r}`)),C(A("heredoc_rest_probe"))]},[`heredoc_line_${e}${r}`]:{rules:[u([`
133
+ `,"\t"],q),et([e],E()),C(A(`heredoc_body_probe${r}`))]}}},t0=(e)=>[...e?[L(`
134
+ `,E()),L([" ","\t","\r"]),u("#",Be,A("heredoc_rest_comment"))]:[Xl,k2,u(["<<","<<-"],ce,A("heredoc_delim"))],Kl,..._o,...Zl,u("((",I,A("arith")),u(["<(",">("],I,A("cmd_sub")),u("(",I,A("cmd_sub")),et(["[["],A("conditional")),u(o2.filter((t)=>e||t!=="<<-"),ce),u(a2.filter((t)=>e||t!=="<<"),ce),u(l2,ce),u(c2,I),u(_2,I),u(u2,I),u("+=",ce),u("=",ce),et(["!"],{},ce),et([":"],{},Hl),u(["{","}","[","]"],I),u([",",".","~"],I),u(["*","?"],I),u([Ue,"_",xe],me),u(["-","/"],ce)],Z1=t0(!1),x2=Tt({name:"bash",states:{main:{rules:Z1},cmd_sub:{rules:[u(")",I,E()),...Z1]},arith:{rules:[u("))",I,E()),Xl,Kl,..._o,...Zl,u("(",I,A("arith_group")),u(Y1,ce),u(G1,ce),u(W1,ce),u(["0x","0X"],J),u(xe,J),u("#",I),u(".",I),u([Ue,"_"],me),C({token:me})]},arith_group:{rules:[u(")",I,E()),Xl,Kl,..._o,...Zl,u("(",I,A("arith_group")),u(Y1,ce),u(G1,ce),u(W1,ce),u(["0x","0X"],J),u(xe,J),u("#",I),u(".",I),u([Ue,"_"],me),C({token:me})]},conditional:{rules:[et(["]]"],E()),Xl,Kl,..._o,...Zl,u("=~",ce,A("regex_rhs_initial")),u(["==","!=","<=",">="],ce),u(["=","<",">"],ce),u(h2,ce),u(f2,ce),u(["&&","||"],ce),u("!",ce),u(["(",")"],I),u([Ue,"_",xe],me),u(["-","/","*","?",":",".",",","~","+"],ce),C({token:me})]},regex_rhs_initial:{rules:[L([" ","\t"]),C({state:"regex_rhs_body",exit:!0})]},regex_rhs_body:{rules:[L([" ","\t",`
135
+ `,"\r"],E()),u('"',q,A("double_string")),Q1,..._o,C({token:jt})]},double_string:{rules:[u('"',q,E()),u(["\\$","\\`","\\\"","\\\\","\\\n"],B),..._o,ud,C({token:q})]},ansi_string_state:{rules:[u("'",q,E()),u("\\",B,A("ansi_esc_start")),C({token:q})]},ansi_esc_start:{rules:[u("x",B,T("ansi_esc_hex_d1")),u("u",B,T("ansi_esc_u4_d1")),u("U",B,T("ansi_esc_u8_d1")),u("c",B,T("ansi_esc_control")),u(tt([["0","7"]]),B,T("ansi_esc_oct_d2")),C({token:B,exit:!0})]},ansi_esc_hex_d1:{rules:[u(he,B,T("ansi_esc_hex_d2")),C(E())]},ansi_esc_hex_d2:{rules:[u(he,B,E()),C(E())]},ansi_esc_u4_d1:{rules:[u(he,B,T("ansi_esc_u4_d2")),C(E())]},ansi_esc_u4_d2:{rules:[u(he,B,T("ansi_esc_u4_d3")),C(E())]},ansi_esc_u4_d3:{rules:[u(he,B,T("ansi_esc_u4_d4")),C(E())]},ansi_esc_u4_d4:{rules:[u(he,B,E()),C(E())]},ansi_esc_u8_d1:{rules:[u(he,B,T("ansi_esc_u8_d2")),C(E())]},ansi_esc_u8_d2:{rules:[u(he,B,T("ansi_esc_u8_d3")),C(E())]},ansi_esc_u8_d3:{rules:[u(he,B,T("ansi_esc_u8_d4")),C(E())]},ansi_esc_u8_d4:{rules:[u(he,B,T("ansi_esc_u8_d5")),C(E())]},ansi_esc_u8_d5:{rules:[u(he,B,T("ansi_esc_u8_d6")),C(E())]},ansi_esc_u8_d6:{rules:[u(he,B,T("ansi_esc_u8_d7")),C(E())]},ansi_esc_u8_d7:{rules:[u(he,B,T("ansi_esc_u8_d8")),C(E())]},ansi_esc_u8_d8:{rules:[u(he,B,E()),C(E())]},ansi_esc_control:{rules:[C({token:B,exit:!0})]},ansi_esc_oct_d2:{rules:[u(tt([["0","7"]]),B,T("ansi_esc_oct_d3")),C(E())]},ansi_esc_oct_d3:{rules:[u(tt([["0","7"]]),B,E()),C(E())]},heredoc_delim:{rules:[L([" ","\t"]),...X1.flatMap((e)=>[et([e],T(`heredoc_open_${e}`)),u(w2(e),Nt,T(`heredoc_open_${e}_raw`))]),C(E())]},...Object.assign({},...X1.flatMap((e)=>[K1(e,!1),K1(e,!0)])),heredoc_rest:{rules:t0(!0)},heredoc_rest_comment:{rules:[L(`
136
+ `,E()),C({token:Be})]},heredoc_rest_probe:{mode:"probe",fallback:"heredoc_rest",rules:[C(A("heredoc_rest"))]},heredoc_body_probe:{mode:"probe",fallback:"heredoc_body",rules:[C(A("heredoc_body"))]},heredoc_body_probe_raw:{mode:"probe",fallback:"heredoc_body_raw",rules:[C(A("heredoc_body_raw"))]},heredoc_body:{rules:[L(`
137
+ `,E()),u(["\\$","\\`","\\\\"],B),...e0,ud,C({token:q})]},heredoc_body_raw:{rules:[L(`
138
+ `,E()),C({token:q})]},param_exp:{rules:[u("}",I,E()),Xl,Kl,..._o,...Zl,u(d2,ce),u(p2,ce),u(m2,ce),u(["[","]"],I),u(["*","?"],I),u([Ue,"_",xe],me),C({token:me})]}}}),$2=(e)=>e==="_"||e>="0"&&e<="9"||e>="a"&&e<="z"||e>="A"&&e<="Z",E2=(e,t,r)=>{let n=t;for(;n<r&&$2(e[n]);)n++;return n-t},A2=(e,t)=>{let r=t.tokens,n=t.token_types.slice(),s=r.length/3;if(s===0)return{tokens:r,token_types:n};let i=n.indexOf("variable");if(i<0)return{tokens:r,token_types:n};let o=[],a=0;for(;a<s;){let l=r[a*3],_=r[a*3+1],c=r[a*3+2];if(l!==i||a===s-1){o.push(l,_,c),a++;continue}let h=r[(a+1)*3],d=r[(a+1)*3+1],f=r[(a+1)*3+2];if(d!==c){o.push(l,_,c),a++;continue}let p=E2(e,d,f);if(p===0){o.push(l,_,c),a++;continue}let m=c+p;o.push(l,_,m),p===f-d||o.push(h,m,f),a+=2}return{tokens:new Uint32Array(o),token_types:n}},T2=ha([g2,v2,b2]),C2=(e,t)=>{let r=new Uint32Array(t.tokens),n=t.token_types.slice(),s=r.length/3;if(s===0)return{tokens:r,token_types:n};let i=n.indexOf("identifier");if(i<0)return{tokens:r,token_types:n};let o=(c)=>{let h=n.indexOf(c);return h<0&&(h=n.length,n.push(c)),h},a=o("keyword"),l=o("builtin"),_=o("boolean");for(let c=0;c<s;c++){if(r[c*3]!==i)continue;let h=r[c*3+1],d=r[c*3+2],f=fa(T2,e,h,d);f===1?r[c*3]=a:f===2?r[c*3]=l:f===3&&(r[c*3]=_)}return{tokens:r,token_types:n}},S2=(e,t)=>{let r=t.tokens,n=t.token_types.slice(),s=r.length/3;if(s===0)return{tokens:r,token_types:n};let i=n.indexOf("number");if(i<0)return{tokens:r,token_types:n};let o=n.indexOf("identifier"),a=n.indexOf("punctuation"),l=[],_=0;for(;_<s;){let c=r[_*3],h=r[_*3+1],d=r[_*3+2];if(c!==i){l.push(c,h,d),_++;continue}if(o>=0){let f=e.slice(h,d);if(f.startsWith("0x")||f.startsWith("0X")){let p=d,m=_+1;for(;m<s;){let g=r[m*3],b=r[m*3+1],k=r[m*3+2];if(b!==p||g!==i&&g!==o)break;p=k,m++}if(p>d){l.push(i,h,p),_=m;continue}}}if(a>=0&&_+2<s){let f=r[(_+1)*3],p=r[(_+1)*3+1],m=r[(_+1)*3+2];if(f===a&&p===d&&m-p===1&&e[p]==="#"){let g=r[(_+2)*3],b=r[(_+2)*3+1],k=r[(_+2)*3+2];if((g===i||o>=0&&g===o)&&b===m){l.push(i,h,k),_+=3;continue}}}l.push(c,h,d),_++}return{tokens:new Uint32Array(l),token_types:n}},O2=Ai("identifier","function",{plain:!0}),N2=[Ht(A2,"shape"),Ht(S2,"shape"),ze(C2,["keyword","builtin","boolean"]),ze(O2,["function"])],R2=yt(x2),r0=Ct(R2,N2);var Jl=ct("/*","*/",Be),ya=u('"',q,A("string_double")),wa=u("'",q,A("string_single")),hd=u("#",eu,A("id_selector")),fd=u(".",Q_,A("class_selector")),dd=u("::",Ti,A("pseudo_class")),n0=u(":",Ti,A("pseudo")),M2=u("&",Ns,A("nested_selector")),I2=u("#",J,A("hex_color")),D2=u("--",oi,A("css_custom_property")),s0=u(["~=","|=","^=","$=","*=","="],ce),i0=u([">","+","~"],ce),P2=Tt({name:"css",states:{main:{rules:[Jl,ya,wa,u("@",Nt,A("at_rule")),u("{",I,A("declaration")),u("}",I),u([";",")","]",","],I),u("(",I,A("parentheses")),u("[",I,A("brackets")),hd,fd,dd,n0,s0,i0,u("*",Ns),L("-",A("negative_number_or_identifier")),u(xe,J,A("number")),u(Ue,Ns,A("identifier"))]},declaration:{rules:[Jl,u("}",I,E()),u("{",I,A("declaration")),u(";",I),u("@",Nt,A("at_rule")),M2,fd,hd,dd,u("--",oi,A("css_custom_property_declaration")),u(":",I,A("value")),L("-",A("probe_identifier")),L(Ue,A("probe_identifier"))]},value:{rules:[Jl,ya,wa,u(";",I,E()),u("}",I,E()),u("!",Nt,A("important")),I2,u("(",I,A("function_args")),D2,u("-",ce,A("after_minus")),u(xe,J,A("number")),u(".",J,A("decimal")),u(Ue,me,A("value_identifier")),u([",","/","+","*"],ce)]},probe_identifier:{mode:"probe",fallback:"property",rules:[L("{",A("selector")),L([";","}"],A("property"))]},nested_selector:{rules:[n0,dd,fd,hd,u("[",I,A("brackets")),u("{",I,A("declaration")),i0,C(E())]},at_rule:{rules:[ya,wa,u(Ue,Nt),u("-",Nt),u("(",I,A("media_params")),u("{",I,E()),u(";",I,E())]},media_params:{rules:[Jl,ya,wa,u(")",I,E()),u("(",I,A("media_params")),u(":",I),u(",",I),u(";",I),u("=",ce),u([">","<"],ce),u(xe,J,A("number")),u(".",J,A("decimal")),u(Ue,Nt,A("media_keyword")),u("-",Nt,A("media_keyword"))]},media_keyword:{rules:[L([":",",",";",")"," ","\t",`
139
+ `,"\r"],E()),u(st,Nt),u(["-","_"],Nt),C(E())]},property:{rules:[u(st,Vl),u(["-","_"],Vl),u(":",I,A("value")),C(E())]},selector:{rules:[u(st,Ns),u(["-","_"],Ns),u(":",Ti,A("pseudo")),u("{",I,A("declaration")),C(E())]},id_selector:{rules:[u(st,eu),u(["-","_"],eu),C(E())]},class_selector:{rules:[u(st,Q_),u(["-","_"],Q_),C(E())]},pseudo:{rules:[u(Ue,Ti),u("-",Ti),u("(",I,A("parentheses")),C(E())]},pseudo_class:{rules:[u(Ue,Ti),u("-",Ti),C(E())]},parentheses:{rules:[u(")",I,E()),u("(",I,A("parentheses")),u(tt([[0,127]]),me)]},brackets:{rules:[u("]",I,E()),ya,wa,s0,u(st,Os),u(["-","_"],Os)]},number:{rules:[u(xe,J),u(".",J,A("decimal")),u(Ue,ma,A("unit")),u("%",ma,E()),C(E())]},decimal:{rules:[u(xe,J),u(Ue,ma,A("unit")),u("%",ma,E()),C(E())]},after_minus:{rules:[u(xe,J,A("number")),u(".",J,A("decimal")),u("-",oi,A("css_custom_property")),u(Ue,me,A("value_identifier")),C(E())]},unit:{rules:[u(Ue,ma),C(E())]},hex_color:{rules:[u(he,J),C(E())]},css_custom_property:{rules:[u(st,oi),u(["-","_"],oi),C(E())]},css_custom_property_declaration:{rules:[u(st,oi),u(["-","_"],oi),u(":",I,A("value")),C(E())]},value_identifier:{rules:[u(st,me),u(["-","_"],me),u("(",I,A("function_args")),C(E())]},function_args:{rules:[Jl,ya,wa,u(")",I,E()),u("(",I,A("function_args")),u("#",J,A("hex_color")),u("--",oi,A("css_custom_property")),u(xe,J,A("number")),u(".",me,A("url_filename")),u(Ue,me,A("identifier_in_function")),u([",","/","+","*","-"],ce)]},url_filename:{rules:[u(st,me),u([".","-","_","/",":"],me),C(E())]},identifier_in_function:{rules:[u(st,me),u(["-","_"],me),C(E())]},important:{rules:[u("important",Nt,E())]},identifier:{rules:[u(st,Ns),u(["-","_"],Ns),C(E())]},negative_number_or_identifier:{rules:[u(xe,J,A("number")),u(Ue,Ns,A("identifier")),u("-",Ns),C(E())]},string_double:{rules:[u("\\",B,A("esc_start")),u('"',q,E()),C({token:q})]},string_single:{rules:[u("\\",B,A("esc_start")),u("'",q,E()),C({token:q})]},esc_start:{rules:[u(he,B,T("esc_hex_d2")),C({token:B,exit:!0})]},esc_hex_d2:{rules:[u(he,B,T("esc_hex_d3")),u([" ","\t",`
140
+ `,"\r","\f"],B,E()),C(E())]},esc_hex_d3:{rules:[u(he,B,T("esc_hex_d4")),u([" ","\t",`
141
+ `,"\r","\f"],B,E()),C(E())]},esc_hex_d4:{rules:[u(he,B,T("esc_hex_d5")),u([" ","\t",`
142
+ `,"\r","\f"],B,E()),C(E())]},esc_hex_d5:{rules:[u(he,B,T("esc_hex_d6")),u([" ","\t",`
143
+ `,"\r","\f"],B,E()),C(E())]},esc_hex_d6:{rules:[u(he,B,T("esc_hex_done")),u([" ","\t",`
144
+ `,"\r","\f"],B,E()),C(E())]},esc_hex_done:{rules:[u([" ","\t",`
145
+ `,"\r","\f"],B,E()),C(E())]}}}),q2=[ze(an([{anchor:"identifier",when:ut(Ce("punctuation","(")),rewrite:"function"}],{trivia:["comment"]}),["function"])],L2=yt(P2),Si=Ct(L2,q2);var F2=Tt({name:"diff-basic",states:{main:{rules:[L(`
146
+ `),u("@@",ga,A("hunk_range")),u("! ",x1,A("changed_line")),u("\\ ",Be,A("consume_rest_comment")),L("++",A("consume_line")),L("--",A("consume_line")),u("+",C1,A("inserted_line")),u("-",E1,A("deleted_line")),C(A("consume_line"))]},hunk_range:{rules:[u("@@@",ga,T("hunk_context")),u("@@",ga,T("hunk_context")),u("@",ga),u(xe,J),u(",",I),u(["+","-"],I),L(" "),L(`
147
+ `,E()),C({token:ga})]},hunk_context:{rules:[L(`
148
+ `,E()),C({token:Be})]},inserted_line:{rules:[L(`
149
+ `,E()),C({token:T1})]},deleted_line:{rules:[L(`
150
+ `,E()),C({token:$1})]},changed_line:{rules:[L(`
151
+ `,E()),C({token:w1})]},consume_rest_comment:{rules:[L(`
152
+ `,E()),C({token:Be})]},consume_line:{rules:[L(`
153
+ `,E()),C()]}}}),j2=yt(F2),z2=[],o0=Ct(j2,z2);var yd="if.else.switch.case.default.while.do.for.break.continue.return.var.let.const.function.class.extends.static.async.await.new.typeof.instanceof.in.of.delete.void.try.catch.finally.throw.import.export.from.as.this.super.null.undefined.debugger.with.yield.get.set".split("."),wd=["true","false"],xd=["undefined","null","NaN","Infinity"],rc=["return","throw","typeof","new","void","delete","in","of","instanceof","yield","await","case","else"],U2=yd.filter((e)=>!rc.includes(e)),a0=["if","while","for","with"],B2=[">>>="],H2=["===","!==",">>>","<<=",">>=","**=","&&=","||=","??="];var V2=["++","--","<=",">=","==","!=","&&","||","<<",">>","**","??","?.","=>","+=","-=","*=","/=","%=","&=","|=","^="],Y2=["-","+","<",">","=","!","&","|","?","*","~","^","%"],G2=[...B2,...H2,"...",...V2,...Y2],_u=G2.filter((e)=>e!=="?."),Ql=["++","--"],au=_u.filter((e)=>!Ql.includes(e)),pd=["===","!==","--","++","<=",">=","==","!=","&&","||","-","+","<",">","=","!","&","|","?","*","/","~","^","%"],md=["."," ","\t",`
154
+ `,"\r",")","[","]","{","}",";",",",":","`"],W2=u("//",Be,A("line_comment")),X2=u("/*",Be,A("block_comment")),l0=(e)=>({rules:[u(e,Be,E()),u(tt([[0,65535]]),Be)]}),K2=u('"',q,A("string_double")),Z2=u("'",q,A("string_single")),lu=u("`",K_,A("template_literal")),Ni=[W2,X2],nc=[K2,Z2,lu],sc=[L([" ","\t",`
155
+ `,"\r"])],y0=["0","1","2","3","4","5","6","7","8","9"].map((e)=>`.${e}`),J2=[u(["0x","0X"],J,T("hex_number")),u(["0b","0B"],J,T("binary_number")),u(["0o","0O"],J,T("octal_number")),u(xe,J,T(J)),u(y0,J,T("decimal_number"))],uu=[u(["0x","0X"],J,A("hex_number_arg")),u(["0b","0B"],J,A("binary_number_arg")),u(["0o","0O"],J,A("octal_number_arg")),u(xe,J,A("number_arg"))],hu=u(y0,J,A("decimal_number_arg")),ec=[...Ni,...nc,...J2,...sc],$d=[...Ni,...nc,...uu],tc=[...Ni,...nc,...uu,hu,...sc],gd=(e,t)=>({rules:[...Ni,L([" ","\t",`
156
+ `,"\r"]),L(["_","$",Ue],T(t)),C(T(e))]}),Q2={rules:[...Ni,L([" ","\t",`
157
+ `,"\r"]),u(["_","$",st],me),C(T("paren_group"))]},cn=(e)=>[u("?.",ce,T(e)),u(".",I,T(e))],Ed=(e)=>({rules:[L(w0,T("call_operand")),...$d,...e,u(")",I,T("division")),u(",",I),u(["===","!=="],ce),u(["--","++","<=",">=","==","!=","&&","||"],ce),u(["-","+","<",">","=","!","&","|","?","*","~","^","%"],ce),u("/",jt,A("regex_pattern")),u(["[","]","{","}"],I),...cn("member_access"),u([";",":"],I),L(["_","$",Ue],T("identifier_probe"))]}),w0=["(",".",xe,'"',"'","`"],c0=(e)=>({rules:[...nc,...uu,hu,u("(",I,A("paren_group")),C(T(e))]}),Ad=(e)=>({rules:[...$d,hu,...e,u(")",I,E()),u(",",I),...cn("member_access_paren"),u(["[","]","{","}",";",":"],I),u(["===","!=="],ce),u(["--","++","<=",">=","==","!=","&&","||"],ce),u(["-","+","<",">","=","!","&","|","?","*","/","~","^","%"],ce),u(["_","$",st],me),u("(",I,A("paren_group"))]}),Nz=[u(")",I,E()),u(",",I),u(["[","]","{","}",";",".",":"],I),u(["===","!=="],ce),u(["--","++","<=",">=","==","!=","&&","||"],ce),u(["-","+","<",">","=","!","&","|","?","*","/","~","^","%"],ce),u(["_","$",st],me)],vd=(e)=>u(_u,ce,ln(e)),xa=(e,t)=>[u(Ql,ce,ln(t)),u(au,ce,ln(e))],Td=(e,t,r)=>r===void 0?[et(e,ln(t))]:[et(a0,T(r)),et(e.filter((n)=>!a0.includes(n)),ln(t))],Oi=(e,t,r)=>[et(rc,ln(e)),...Td(U2,t,r),et(xd,ln(t)),et(wd,ln(t),"boolean")],eE=(e)=>({rules:[...Ni,...sc,et(["await"]),u("(",I,A("head_regex_allow")),u(")",I,T(e)),C(T("division"))]}),tE=[".",xe,'"',"'","`"],Cd=(e,t)=>({rules:[L(tE,T("head_division")),L("(",T("head_paren")),...Ni,...sc,...t,...e,u("/",jt,A("head_regex_pattern")),L(")",E()),u(["{","["],I),u(["}","]"],I,T("head_division")),u("?.",ce,T("head_member_access")),u([";",",",":"],I),L(["_","$",Ue],T("head_identifier_probe"))]}),Sd=(e,t=[])=>({rules:[...Ni,...nc,...uu,hu,...sc,...t,...xa("head_regex_allow",null),...e,L("(",T("head_paren")),L(")",E()),u(["{","["],I,T("head_regex_allow")),u("/",ce,T("head_regex_allow")),u(["}","]"],I),u([";",",",":"],I,T("head_regex_allow")),...cn("head_member_access"),L(["_","$",Ue],T("head_identifier_probe"))]}),rE={rules:[u("(",I,A("head_regex_allow")),u(")",I,T("head_division")),C(T("head_division"))]},nE={rules:[u(["_","$",st],me),lu,L("(",T("head_paren")),u(["[","{"],I,T("head_regex_allow")),L(")",E()),u(["]","}"],I,T("head_division")),u([",",";",":"],I,T("head_regex_allow")),...cn("head_member_access"),u(Ql,ce,T("head_division")),u([...au,"/"],ce,T("head_regex_allow")),L([" ","\t",`
158
+ `,"\r"],T("head_division"))]},$a=Tt({name:"javascript",states:{regex_allow:{rules:[...ec,vd(null),...Oi(null,"division","control_head"),u("/",jt,A("regex_pattern")),u(["(","{","["],I),u([")","}","]"],I,T("division")),...cn("member_access"),u([";",",",":"],I),L(["_","$",Ue],T("identifier_probe"))]},line_comment:l0(`
159
+ `),block_comment:l0("*/"),member_access:gd("division","identifier_probe"),member_access_tmpl:gd("tmpl_division","identifier_probe_tmpl"),identifier_probe:{mode:"probe",fallback:me,rules:[L("(",T("function_name")),L([...md,...pd],T(me))]},function_name:{rules:[u(["_","$",st],Z_),u("(",I,T("function_body")),L([" ","\t"])]},function_body:Ed(Oi("regex_allow","division")),paren_group:Ad(Oi(null,null)),call_operand:c0("division"),call_operand_tmpl:c0("tmpl_division"),member_access_paren:Q2,control_head:eE("regex_allow"),head_regex_allow:Cd(Oi(null,"head_division"),[vd(null)]),head_division:Sd(Oi("head_regex_allow",null)),head_paren:rE,head_member_access:gd("head_division","head_identifier_probe"),head_identifier_probe:{mode:"probe",fallback:"head_identifier",rules:[L("(",T("head_function_name")),L([...md,...pd],T("head_identifier"))]},head_function_name:{rules:[u(["_","$",st],Z_),u("(",I,A("head_regex_allow")),u(")",I,T("head_division")),L([" ","\t"])]},head_identifier:nE,head_regex_pattern:{rules:[u("/",jt,T("regex_flags")),u("\\",jt,A("regex_escape")),u("[",jt,A("regex_class")),L([`
160
+ `,";"],E()),C({token:jt})]},number_arg:{rules:[u(["_",xe],J),u(".",J,T("decimal_number_arg")),u(["e","E"],J,T("exponent_sign_arg")),u("n",J,E()),C(E())]},decimal_number_arg:{rules:[u(["_",xe],J),u(["e","E"],J,T("exponent_sign_arg")),C(E())]},exponent_sign_arg:{rules:[u(["+","-"],J,T("exponent_digits_arg")),u(xe,J,T("exponent_digits_arg")),C(E())]},exponent_digits_arg:{rules:[u(["_",xe],J),C(E())]},hex_number_arg:{rules:[u(["_",he],J),u("n",J,E()),C(E())]},binary_number_arg:{rules:[u(["_","0","1"],J),u("n",J,E()),C(E())]},octal_number_arg:{rules:[u(["_",tt([["0","7"]])],J),u("n",J,E()),C(E())]},identifier:{rules:[u(["_","$",st],me),lu,u(["(","[","{"],I,T("regex_allow")),u([")","]","}"],I,T("division")),u([",",";",":"],I,T("regex_allow")),...cn("member_access"),u(Ql,ce,T("division")),u([...au,"/"],ce,T("regex_allow")),L([" ","\t",`
161
+ `,"\r"],T("division"))]},division:{rules:[...ec,...xa("regex_allow",null),...Oi("regex_allow",null,"control_head"),u(["(","{","["],I,T("regex_allow")),u("/",ce,T("regex_allow")),u([")","}","]"],I),u([";",",",":"],I,T("regex_allow")),...cn("member_access"),L(["_","$",Ue],T("identifier_probe"))]},number:{rules:[u(["_",xe],J),u(".",J,T("decimal_number")),u(["e","E"],J,T("exponent_sign")),u("n",J,T("division")),C(T("division"))]},decimal_number:{rules:[u(["_",xe],J),u(["e","E"],J,T("exponent_sign")),C(T("division"))]},exponent_sign:{rules:[u(["+","-"],J,T("exponent_digits")),u(xe,J,T("exponent_digits")),C(T("division"))]},exponent_digits:{rules:[u(["_",xe],J),C(T("division"))]},hex_number:{rules:[u(["_",he],J),u("n",J,T("division")),C(T("division"))]},binary_number:{rules:[u(["_","0","1"],J),u("n",J,T("division")),C(T("division"))]},octal_number:{rules:[u(["_",tt([["0","7"]])],J),u("n",J,T("division")),C(T("division"))]},string_double:{rules:[u("\\u{",B,A("esc_u_braces")),u("\\u",B,A("esc_u4_d1")),u("\\x",B,A("esc_hex_d1")),u("\\",B,A("esc_simple")),u('"',q,E()),C({token:q})]},string_single:{rules:[u("\\u{",B,A("esc_u_braces")),u("\\u",B,A("esc_u4_d1")),u("\\x",B,A("esc_hex_d1")),u("\\",B,A("esc_simple")),u("'",q,E()),C({token:q})]},esc_simple:{rules:[C({token:B,exit:!0})]},esc_hex_d1:{rules:[u(he,B,T("esc_hex_d2")),C(E())]},esc_hex_d2:{rules:[u(he,B,E()),C(E())]},esc_u4_d1:{rules:[u(he,B,T("esc_u4_d2")),C(E())]},esc_u4_d2:{rules:[u(he,B,T("esc_u4_d3")),C(E())]},esc_u4_d3:{rules:[u(he,B,T("esc_u4_d4")),C(E())]},esc_u4_d4:{rules:[u(he,B,E()),C(E())]},esc_u_braces:{rules:[u(he,B),u("}",B,E()),C(E())]},template_literal:{rules:[u("${",I,A("tmpl_regex_allow")),u("\\u{",B,A("esc_u_braces")),u("\\u",B,A("esc_u4_d1")),u("\\x",B,A("esc_hex_d1")),u("\\",B,A("esc_simple")),u("`",K_,E()),C({token:K_})]},tmpl_regex_allow:{rules:[...tc,vd(null),...Oi(null,"tmpl_division"),u("}",I,E()),u("/",jt,A("regex_pattern")),u("{",I,A("tmpl_regex_allow")),u(["(","["],I),u([")","]"],I,T("tmpl_division")),...cn("member_access_tmpl"),u([";",",",":"],I),L(["_","$",Ue],T("identifier_probe_tmpl"))]},tmpl_division:{rules:[...tc,...xa("tmpl_regex_allow",null),...Oi("tmpl_regex_allow",null),u("}",I,E()),u("{",I,A("tmpl_regex_allow")),u(["(","["],I,T("tmpl_regex_allow")),u("/",ce,T("tmpl_regex_allow")),u([")","]"],I),u([";",",",":"],I,T("tmpl_regex_allow")),...cn("member_access_tmpl"),L(["_","$",Ue],T("identifier_probe_tmpl"))]},identifier_probe_tmpl:{mode:"probe",fallback:"identifier_tmpl",rules:[L("(",T("function_name_tmpl")),L([...md,...pd],T("identifier_tmpl"))]},function_name_tmpl:{rules:[u(["_","$",st],Z_),u("(",I,T("function_body_tmpl")),L([" ","\t"])]},function_body_tmpl:{rules:[L(w0,T("call_operand_tmpl")),...$d,u(")",I,T("tmpl_division")),u(",",I),u(["===","!=="],ce),u(["--","++","<=",">=","==","!=","&&","||"],ce),u(["-","+","<",">","=","!","&","|","?","*","~","^","%"],ce),u("/",jt,A("regex_pattern")),u("{",I,A("tmpl_regex_allow")),u("}",I,E()),u(["[","]"],I),u([";",".",":"],I),L(["_","$",Ue],T("identifier_probe_tmpl"))]},identifier_tmpl:{rules:[u(["_","$",st],me),lu,u("{",I,A("tmpl_regex_allow")),u(["(","["],I,T("tmpl_regex_allow")),u("}",I,E()),u([")","]"],I,T("tmpl_division")),u([",",";",":"],I,T("tmpl_regex_allow")),...cn("member_access_tmpl"),u(Ql,ce,T("tmpl_division")),u([...au,"/"],ce,T("tmpl_regex_allow")),L([" ","\t",`
162
+ `,"\r"],T("tmpl_division"))]},regex_pattern:{rules:[u("/",jt,T("regex_flags")),u("\\",jt,A("regex_escape")),u("[",jt,A("regex_class")),L([`
163
+ `,";"],T("division")),C({token:jt})]},regex_escape:{rules:[C({token:jt,exit:!0})]},regex_class:{rules:[u("]",jt,E()),u("\\",jt,A("regex_class_escape")),C({token:jt})]},regex_class_escape:{rules:[C({token:jt,exit:!0})]},regex_flags:{rules:[u(["g","i","m","s","u","y","d"],jt),C(E())]}}}),sE=["@param","@arg","@argument","@property","@prop"],iE=["@typedef","@callback","@template"],oE=["<",">","[","]","(",")",",","|","&","=","?","!","*",":",";"],_0=u([" ","\t","\r",`
164
+ `,"*"],Be),aE=Tt({name:"jsdoc",states:{line_start:{rules:[_0,et(sE,T("after_name_tag")),et(iE,T("after_type_tag")),u("@",Nt,T("tag")),C(T("prose"))]},tag:{rules:[u([Ue,xe,"-","_"],Nt),C(T("after_tag"))]},after_tag:{rules:[u([" ","\t"],Be),u("{",I,A("type_expr")),u(`
165
+ `,Be,T("line_start")),C(T("prose"))]},after_name_tag:{rules:[u([" ","\t"],Be),u("{",I,A("type_expr")),u("[",I),u(`
166
+ `,Be,T("line_start")),L(["_","$",Ue],T("name")),C(T("prose"))]},after_type_tag:{rules:[u([" ","\t"],Be),u("{",I,A("type_expr")),u(`
167
+ `,Be,T("line_start")),L(["_","$",Ue],T("type_name")),C(T("prose"))]},name:{rules:[u(["_","$",".",st],y1),C(T("prose"))]},type_name:{rules:[u(["_","$",".",st],Qf),C(T("prose"))]},type_expr:{rules:[u("}",I,E()),u("{",I,A("type_expr")),u("@",Nt,T("inline_tag")),u("'",q,A("type_string_single")),u('"',q,A("type_string_double")),u(["_","$",".",st],Qf),u(oE,I),_0,C({token:Be})]},type_string_single:{rules:[u("\\",q,A("type_string_escape")),u("'",q,E()),u(`
168
+ `,Be,E()),C({token:q})]},type_string_double:{rules:[u("\\",q,A("type_string_escape")),u('"',q,E()),u(`
169
+ `,Be,E()),C({token:q})]},type_string_escape:{rules:[L(`
170
+ `,E()),C({token:q,exit:!0})]},inline_tag:{rules:[u([Ue,xe,"-"],Nt),C(T("type_expr"))]},prose:{rules:[u(`
171
+ `,Be,T("line_start")),C({token:Be})]}}}),lE,cE,u0=(e)=>(lE??=fu())(e),_E=(e)=>(cE??=Si())(e),uE=Cr(Ce("keyword","function"),ut(Ce("keyword","async"),Ce("keyword","function"))),hE=Cr(ut(Lr("(",")"),Ce("operator","=>")),ut(Ce("keyword","async"),Lr("(",")"),Ce("operator","=>")),ut(Ce("identifier"),Ce("operator","=>")),ut(Ce("keyword","async"),Ce("identifier"),Ce("operator","=>"))),Od=[{anchor:"identifier",when:ut(Ce("operator",["="]),Cr(uE,hE)),rewrite:"function"}],cu=Cr(Ce("punctuation",":"),Ce("operator","?:"),ut(Ce("operator","?"),Ce("punctuation",":"))),fE=ut(_a(Ce("keyword","async")),Cr(Ce("keyword","function"),ut(Ce("identifier"),Ce("operator","=>")),ut(Lr("(",")"),Ce("operator","=>")))),h0=["object","interface","type_literal"],dE=["class","interface","object"];Cr(Ce("keyword"),Ce("boolean"));var pE=[{anchor:{type_name:"identifier",at_start:!0,frame_kinds:["object"],frame_direct:!0},when:ut(cu,fE),rewrite:"function"},{anchor:{type_name:"identifier",at_start:!0,frame_kinds:["object","interface","type_literal"],frame_direct:!0},when:ut(cu,Yb(Ce("keyword",["for","while","do","if","switch","try","with"]))),rewrite:"property"}],mE=[{anchor:{type_name:"keyword",value:"new",at_start:!0,frame_kinds:["interface"],frame_direct:!0},when:Lr("(",")"),rewrite:"keyword"},{anchor:{type_name:"keyword",at_start:!0,frame_kinds:dE,frame_direct:!0},when:Lr("(",")"),rewrite:"function"},{anchor:{type_name:"keyword",at_start:!0,frame_kinds:h0,frame_direct:!0},when:cu,rewrite:"identifier"},{anchor:{type_name:"boolean",at_start:!0,frame_kinds:h0,frame_direct:!0},when:cu,rewrite:"identifier"}],gE=[{anchor:{type_name:"keyword",value:["function","yield","static","async"]},when:Vb("star",Ce("operator","*")),rewrite:{star:"keyword"}},{anchor:{type_name:"operator",value:"*",at_start:!0,frame_kinds:["class","object"],frame_direct:!0},rewrite:"keyword"}],vE=an([...mE,...gE],{trivia:["comment"]}),Nd=(e,t)=>vE(e,t),Rd=an(pE,{trivia:["comment"]}),bE=["void","null","undefined","this","typeof","keyof","readonly","infer","is","asserts"],kE=["void","null","undefined","this"],ou={over:[{type:"identifier"},{type:"keyword",texts:bE},{type:"string"},{type:"number"},{type:"boolean"},{type:"operator",texts:["|","&","<",">",">>",">>>","=>"]},{type:"punctuation",chars:".,"}],to:{type:"punctuation",last_char_in:":",preceded_by_char_in:")"},skip_groups:"punctuation"},yE={over:[{type:"identifier"},{type:"string"},{type:"number"},{type:"boolean"},{type:"keyword",texts:["this","null","undefined"]},{type:"operator",texts:["-"]},{type:"punctuation",chars:"."}],to:{type:"keyword",texts:["case","default"]}},Md=["get","set","async","readonly","public","private","protected","static","abstract","override","accessor","declare"],Ea={punct_type:"punctuation",brackets:{paren:{open:"(",close:")"},brace:{open:"{",close:"}"},bracket:{open:"[",close:"]"}},brace_kinds:{body_markers:[{type:"keyword",text:"class",kind:"class"},{type:"keyword",text:"interface",kind:"interface"}],marker_reset_chars:";:",pending_in_angles_kind:"type_literal",angles:{type:"operator",open:"<",closes:[{text:">",pops:1},{text:">>",pops:2},{text:">>>",pops:3}],reset_chars:";"},prev_rules:[{prev_type:"operator",prev_texts:["=>"],kind:"block"},{prev_type:"punctuation",prev_last_char_in:";",kind:"block"},{prev_type:"punctuation",prev_last_char_in:"$",kind:"block"},{prev_type:"punctuation",prev_texts:[":"],in_kinds:["block"],scan_back:yE,kind:"block"},{prev_type:"punctuation",prev_last_char_in:":",kind:"type_literal"},{prev_type:"keyword",prev_texts:["do","try","else","finally"],kind:"block"},{prev_type:"punctuation",prev_last_char_in:")",kind:"block"},{prev_type:"identifier",scan_back:ou,kind:"block"},{prev_type:"keyword",prev_texts:kE,scan_back:ou,kind:"block"},{prev_type:"operator",prev_texts:[">",">>",">>>"],scan_back:ou,kind:"block"},{prev_type:"punctuation",prev_last_char_in:"])}",scan_back:ou,kind:"block"}],default_kind:"object",start_kind:"block"},at_start:{reset_chars:",;",rearm_after_close_kinds:["class","interface"],transparent_texts_for_type:[{type:"keyword",texts:[...Md,"class","interface"]},{type:"operator",texts:["*"]}]}},wE=G_(Ea),xE=4,f0=[],d0=[],p0=null,m0=null;function x0(e,t){let r=t.length;e:for(let n=e.length-1;n>=0;n--){let s=e[n];if(s.length===r){for(let i=0;i<r;i++)if(s[i]!==t[i])continue e;return n}}return-1}function $0(e,t,r,n){e.length===xE&&(e.shift(),t.shift()),e.push(r.slice()),t.push(n)}function $E(e){if(e===p0)return m0;let t=x0(f0,e),r;return t>=0?r=d0[t]:(r={identifier_id:e.indexOf("identifier"),template_id:e.indexOf("template"),punctuation_id:e.indexOf("punctuation")},$0(f0,d0,e,r)),p0=e,m0=r,r}function EE(e,t){return e.endsWith("<")?"x"+" ".repeat(t-1):" ".repeat(t)}function E0(e,t,r,n){let{identifier_id:s,template_id:i,punctuation_id:o}=$E(n);if(s<0||i<0||o<0)return null;let a=e.length/3;if(r>=a||e[r*3]!==s)return null;let l=e[r*3+1],_=e[r*3+2],c,h=_-l;if(h===4&&t.startsWith("html",l))c=u0;else if(h===3&&t.startsWith("css",l))c=_E;else return null;let d=r+1;if(d>=a||e[d*3]!==i)return null;let f=e[d*3+1];if(t[f]!=="`")return null;let p=[];p.push({kind:"synthetic",source_start:f,source_end:f+1,type_name:"template"});let m=d,g=!1,b=0,k=0,x=0;for(;m<a;){let w=e[m*3],O=e[m*3+1],N=e[m*3+2];if(g){if(w===o){let S=t.slice(O,N);for(let D=0;D<S.length;D++){let X=S.charCodeAt(D);X===123?b++:X===125&&b--}b===0&&(p.push({kind:"hole",source_start:x,source_end:N,token_start:k,token_end:m+1}),g=!1)}m++}else if(w===i){let S=+(m===d),D=N-O>S&&t[N-1]==="`",X=O+S,G=D?N-1:N;if(G>X&&p.push({kind:"content",source_start:X,source_end:G}),m++,D)return p.push({kind:"synthetic",source_start:N-1,source_end:N,type_name:"template"}),{token_start:d,token_end:m,regions:p,language:c,fill_hole:c===u0?EE:void 0}}else if(w===o&&N-O===2&&t.startsWith("${",O))g=!0,k=m,x=O,b=1,m++;else return null}return null}var g0=[],v0=[],b0=null,k0=-1;function AE(e){if(e===b0)return k0;let t=x0(g0,e),r;return t>=0?r=v0[t]:(r=e.indexOf("comment"),$0(g0,v0,e,r)),b0=e,k0=r,r}var TE,CE=(e)=>(TE??=Ct(yt(aE))())(e);function A0(e,t,r,n){let s=AE(n);if(s<0||r>=e.length/3||e[r*3]!==s)return null;let i=e[r*3+1],o=e[r*3+2];return o-i<=3||t.charCodeAt(i)!==47||t.charCodeAt(i+1)!==42||t.charCodeAt(i+2)!==42?null:{token_start:r,token_end:r+1,regions:[{kind:"synthetic",source_start:i,source_end:i+3,type_name:"comment"},{kind:"content",source_start:i+3,source_end:o}],language:CE}}var Id=ii((e,t,r,n)=>{let s=Fr(e,t,r),i=s.count;if(i===0)return;let o=r.indexOf("identifier"),a=r.indexOf("keyword"),l=r.indexOf("punctuation"),_=r.indexOf("operator"),c=r.indexOf("type"),h=r.indexOf("function");if(o<0||a<0)return;let d=r.indexOf("class_name");d<0&&(d=r.length,r.push("class_name"));let f=Mn("class_name"),p=(x)=>s.next_non_trivia(x),m=(x)=>{if(x<0||x>=i)return!1;let w=s.kind_of(x);return w===o||w===c||w===h},g=(x)=>{if(x<0||x>=i||s.kind_of(x)!==_||s.text_of(x)!=="<")return x;let w=1,O=x+1;for(;O<i&&w>0;){if(!s.is_trivia(O)&&s.kind_of(O)===_){let N=s.text_of(O);N==="<"?w++:N===">"&&w--}O++}return O},b=(x)=>{let w=p(x),O=-1;for(;w>=0&&w<i&&m(w);){if(O=w,w=p(w+1),w>=0&&s.kind_of(w)===l&&s.text_of(w)==="."){w=p(w+1);continue}break}return O>=0&&n.emit(O,d,f),w<0?i:w},k=(x)=>{let w=p(x);for(;w>=0&&w<i&&m(w);){if(w=b(w),w=p(w),w>=0&&s.kind_of(w)===_&&s.text_of(w)==="<"&&(w=g(w),w=p(w)),w>=0&&s.kind_of(w)===l&&s.text_of(w)===","){w=p(w+1);continue}break}return w<0?i:w};for(let x=0;x<i;x++){if(s.is_trivia(x)||s.kind_of(x)!==a)continue;let w=s.text_of(x);if(w==="class"||w==="interface"){let O=p(x+1);m(O)&&(n.emit(O,d,f),O=p(O+1)),O>=0&&s.kind_of(O)===_&&s.text_of(O)==="<"&&(O=g(O),O=p(O));for(let N=0;N<2;N++){if(O=p(O),O>=0&&s.kind_of(O)===a&&(s.text_of(O)==="extends"||s.text_of(O)==="implements")){O=k(O+1);continue}break}continue}if(w==="new"||w==="instanceof"){b(x+1);continue}}}),Rz=Ei("identifier","boolean",["true","false"]),Mz=Ai("identifier","function",{plain:!0},{trivia:["comment"]}),Dd=ca("identifier","constant"),SE=25;function T0(e,t,r,n){let s=e.next_non_trivia(t+1);if(s<0)return-1;let i=e.next_non_trivia(s+1);return i>=0&&e.kind_of(i)===n&&e.text_of(i)===","?s=e.next_non_trivia(i+1):e.text_of(s)==="type"&&(s=i),s<0||e.kind_of(s)!==r||e.text_of(s)!=="*"?-1:s}var OE=Mn("constant"),Pd=ii((e,t,r,n)=>{let s=r.indexOf("identifier"),i=r.indexOf("keyword"),o=r.indexOf("operator"),a=r.indexOf("punctuation");if(s<0||i<0||o<0||a<0)return;let l=r.indexOf("constant");l<0&&(l=r.length,r.push("constant"));let _=Fr(e,t,r),c=_.count;for(let h=0;h<c;h++){if(_.is_trivia(h)||_.kind_of(h)!==i)continue;let d=_.text_of(h);if(d==="import"||d==="export"){let w=T0(_,h,o,a);w>=0&&n.emit(w,l,OE);continue}if(d!=="const")continue;let f=0,p=[],m=0,g=!0,b=!1,k=0,x=_.next_non_trivia(h+1);if(!(x<0))for(;x<c;x++){if(_.is_trivia(x))continue;let w=_.kind_of(x),O=_.text_of(x);if(w===a){for(let N=0;N<O.length;N++){let S=O[N];if(S==="{")f++,p.push(!0),g=!0;else if(S==="[")f++,p.push(!1),g=!0;else if(S==="(")f++,p.push(!1),g=!1;else if(S==="}"||S==="]"||S===")"){if(f===0){x=c;break}f--,p.pop(),b&&f<k&&(b=!1),g=!1}else if(S===",")b&&f===k&&m===0&&(b=!1),b||(g=!0);else if(S===";"){if(f===0){x=c;break}}else S===":"?f>0&&p[p.length-1]?g=!0:b||(b=!0,k=f):g=!1}continue}if(w===o){if(O==="<"){m++,g=!1;continue}if(O===">"){m>0&&m--,g=!1;continue}if(O===">>"){m>=2?m-=2:m=0,g=!1;continue}if(O===">>>"){m>=3?m-=3:m=0,g=!1;continue}if(O==="="&&!b){b=!0,k=f,g=!1;continue}if(O==="..."&&!b){g=!0;continue}g=!1;continue}if(w===i){if((O==="of"||O==="in")&&f===0){x=c;break}g=!1;continue}if(w===s&&!b&&g){let N=f>0&&p[p.length-1],S=!1;if(N){let D=_.next_non_trivia(x+1);D>=0&&_.kind_of(D)===a&&_.text_of(D)===":"&&(S=!0)}S||n.emit(x,l,SE)}g=!1}}}),kd={into:"p",default_introducer:"=",transparent_texts_for_type:[{type:"operator",texts:["..."]},{type:"keyword",texts:Md}]},NE=["class","object","interface"],bd=(e,t)=>({anchor:{type_name:e,value:t,at_start:!0,frame_kinds:NE,frame_direct:!0},when:U_({...kd,skip_generics:!0}),rewrite:{p:"parameter"}}),qd=an([{anchor:Ce("keyword","function"),when:ut(_a(Ce("operator","*")),_a(Cr(Ce("identifier"),Ce("function"))),U_({...kd,skip_generics:!0})),rewrite:{p:"parameter"}},bd("identifier"),bd("function"),bd("keyword",Md),{anchor:"punctuation",when:U_({...kd,find_open:"arrow",skip_ts_return_type:!0,skip_in_type_position:!0}),rewrite:{p:"parameter"}},{anchor:"identifier",when:Ce("operator","=>"),rewrite:"parameter"},{anchor:"function",when:Ce("operator","=>"),rewrite:"parameter"}],{trivia:["comment"]}),RE=46,Ld=ii((e,t,r,n)=>{let s=r.indexOf("identifier"),i=r.indexOf("keyword"),o=r.indexOf("operator"),a=r.indexOf("punctuation");if(s<0||i<0)return;let l=r.indexOf("namespace");l<0&&(l=r.length,r.push("namespace"));let _=RE,c=Fr(e,t,r),h=c.count;for(let d=0;d<h;d++){if(c.is_trivia(d)||c.kind_of(d)!==i)continue;let f=c.text_of(d);if(f==="import"||f==="export"){let p=T0(c,d,o,a);if(p<0)continue;let m=c.next_non_trivia(p+1);if(m<0||c.kind_of(m)!==i||c.text_of(m)!=="as")continue;let g=c.next_non_trivia(m+1);g>=0&&c.kind_of(g)===s&&n.emit(g,l,_);continue}if(f==="namespace"||f==="module"){let p=c.next_non_trivia(d+1);p>=0&&c.kind_of(p)===s&&n.emit(p,l,_);continue}}});function Fd(e,t,r,n){return E0(e,t,r,n)??A0(e,t,r,n)}var jd=["identifier","comment"];function ME(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95||e===36}function zd(e){if(e.includes("/**"))return!0;let t=e.indexOf("`");for(;t!==-1;){let r=t;for(;r>0&&!ME(e.charCodeAt(r-1));)r--;if(e.startsWith("css",r-3)||e.startsWith("html",r-4))return!0;t=e.indexOf("`",t+1)}return!1}var IE=[Ht(wE,"type_claim"),Ht(Nd,"shape"),ze(Dd,["constant"]),ze(an(Od,{trivia:["comment"]}),["function"]),ze(Pd,["constant"]),ze(Rd,["property"]),ze(Id,["class_name"]),ze(qd,["parameter"]),ze(Ld,["namespace"]),Ht(Y_({scan:Fd,trigger_types:jd,may_match:zd}),"embed")],DE=yt($a),Aa=Ct(DE,IE);var du=tt([["a","z"],["A","Z"],["0","9"],["-","-"],["_","_"],[":",":"]]),C0=(e)=>{let t=[];for(let r=0;r<1<<e.length;r++){let n="";for(let s=0;s<e.length;s++)n+=r&1<<s?e[s].toUpperCase():e[s];t.push(n)}return t},Bd=C0("script"),Hd=C0("style"),PE=Bd.map((e)=>e+">"),qE=Hd.map((e)=>e+">"),LE=tt([["a","z"],["A","Z"]]),Ud=[L([" ","\t",`
172
+ `,"\r"]),u("=",ce),ct('"','"',q),ct("'","'",q),u(du,J_)],FE=Tt({name:"html",states:{content:{rules:[ct("<!--","-->",Be),u(["<!DOCTYPE","<!doctype"],pa,A("doctype")),u("</",I,A("close_tag")),L("<",A("lt_probe")),C({})]},lt_probe:{mode:"probe",fallback:"lt_text",rules:[L(LE,A("lt_tag")),L("<",A("lt_text_before_lt")),C(A("lt_text"))]},lt_tag:{rules:[u("<",I,T("tag_start"))]},lt_text:{rules:[L("<"),C(E())]},lt_text_before_lt:{rules:[u("<",I,E())]},tag_start:{rules:[et(Bd,T("script_attrs"),Xr),et(Hd,T("style_attrs"),Xr),u(du,Xr,T("tag_open"))]},tag_open:{rules:[u("/>",I,E()),u(">",I,E()),L([" ","\t",`
173
+ `,"\r"],T("tag_attrs")),u(du,Xr)]},tag_attrs:{rules:[u("/>",I,E()),u(">",I,E()),...Ud]},close_tag:{rules:[u(">",I,E()),L([" ","\t",`
174
+ `,"\r"]),u(du,Xr)]},doctype:{rules:[u(">",I,E()),C({token:pa})]},script_attrs:{rules:[u("/>",I,E()),u(">",I,T("script_content")),...Ud]},script_content:{rules:[L("</",A("script_close_probe")),C({token:ba})]},script_close_probe:{mode:"probe",fallback:"script_close_fail",rules:[L(PE,T("script_close_emit"))]},script_close_fail:{rules:[u("<",ba,E())]},script_close_emit:{rules:[u("</",I,T("script_close_name"))]},script_close_name:{rules:[u(Bd,Xr,T("script_close_gt"))]},script_close_gt:{rules:[u(">",I,E())]},style_attrs:{rules:[u("/>",I,E()),u(">",I,T("style_content")),...Ud]},style_content:{rules:[L("</",A("style_close_probe")),C({token:ka})]},style_close_probe:{mode:"probe",fallback:"style_close_fail",rules:[L(qE,T("style_close_emit"))]},style_close_fail:{rules:[u("<",ka,E())]},style_close_emit:{rules:[u("</",I,T("style_close_name"))]},style_close_name:{rules:[u(Hd,Xr,T("style_close_gt"))]},style_close_gt:{rules:[u(">",I,E())]}}}),jE,zE,UE=[Ht(ua({raw_script:(e)=>(jE??=Aa())(e),raw_style:(e)=>(zE??=Si())(e)}),"embed")],BE=yt(FE),fu=Ct(BE,UE);var HE=Tt({name:"json",states:{main:{rules:[L([" ","\t",`
175
+ `,"\r"]),u('"',q,A("string_body")),et(["true","false"],{},b1),et(["null"]),u(["{","}","[","]",",",":"],I),u("-",J,A("negative_number")),u(xe,J,A("number"))]},negative_number:{rules:[u(xe,J,T("number")),C(E())]},number:{rules:[u(xe,J),u(".",J,T("decimal")),u(["e","E"],J,T("exponent_sign")),C(E())]},decimal:{rules:[u(xe,J),u(["e","E"],J,T("exponent_sign")),C(E())]},exponent_sign:{rules:[u(["+","-"],J,T("exponent_digits")),u(xe,J,T("exponent_digits")),C(E())]},exponent_digits:{rules:[u(xe,J),C(E())]},string_body:{rules:[u("\\",B,A("string_escape_start")),u('"',q,E()),C({token:q})]},string_escape_start:{rules:[u("u",B,T("esc_u4_d1")),C({token:B,exit:!0})]},esc_u4_d1:{rules:[u(he,B,T("esc_u4_d2")),C(E())]},esc_u4_d2:{rules:[u(he,B,T("esc_u4_d3")),C(E())]},esc_u4_d3:{rules:[u(he,B,T("esc_u4_d4")),C(E())]},esc_u4_d4:{rules:[u(he,B,E()),C(E())]}}}),VE=yt(HE),YE=[],S0=Ct(VE,YE);var N0=u("\\! \\\" \\# \\$ \\% \\& \\' \\( \\) \\* \\+ \\, \\- \\. \\/ \\: \\; \\< \\= \\> \\? \\@ \\[ \\\\ \\] \\^ \\_ \\` \\{ \\| \\} \\~".split(" "),U1),GE=u("\\\n",B1,T("block_start")),WE=L("\\\n",E()),uo=[u("![",ld,A("link_text")),u("[",ld,A("link_text")),u("<",sd,A("autolink_body")),u("&",Yl,A("entity_body")),u("`",od,A("code_body"))],Vd=[u("**",_s,A("bold_star_body")),u("__",_s,A("bold_under_body")),u("~~",va,A("strike_body")),u("*",us,A("italic_star_body")),u("_",us,A("italic_under_body"))],O0=[GE,N0],Ta=[WE,N0],XE=Tt({name:"markdown",states:{main:{rules:[u(`---
176
+ `,ru,T("front_matter_body")),C(T("block_start"))]},front_matter_body:{rules:[u([`
177
+ ---
178
+ `,`
179
+ ...
180
+ `],ru,T("block_start")),u([`
181
+ ---`,`
182
+ ...`],ru,T("block_start")),C({token:V1})]},block_start:{rules:[L([`
183
+ `,"\r"]),u([" ","\t"],tu,A("indented_code")),u(["``````","`````","````","```"],co,T("fence_info_btick")),u(["~~~~~~","~~~~~","~~~~","~~~"],co,T("fence_info_tilde")),u(["######","#####","####","###","##","#"],F1,T("heading_space")),u(["---","***","___"],nu,T("thematic_break_tail")),u(">",L1),u(["- ","* ","+ "],j1,T("list_body_probe")),L([" ","\t"]),C(T("inline_content"))]},heading_space:{rules:[L(`
184
+ `,T("block_start")),L([" ","\t"],T("heading_body")),C(T("inline_content"))]},heading_body:{rules:[L(`
185
+ `,T("block_start")),...O0,...uo,...Vd,C({token:A1})]},inline_content:{rules:[L(`
186
+ `,T("block_start")),...O0,...uo,...Vd,C({})]},bold_star_body:{rules:[u("**",id,E()),L(`
187
+ `,E()),...Ta,...uo,u("__",_s,A("bold_under_body")),u("~~",va,A("strike_body")),u("*",us,A("italic_star_body")),u("_",us,A("italic_under_body")),C({token:ed})]},bold_under_body:{rules:[u("__",id,E()),L(`
188
+ `,E()),...Ta,...uo,u("**",_s,A("bold_star_body")),u("~~",va,A("strike_body")),u("*",us,A("italic_star_body")),u("_",us,A("italic_under_body")),C({token:ed})]},italic_star_body:{rules:[u("*",ad,E()),L(`
189
+ `,E()),...Ta,...uo,u("**",_s,A("bold_star_body")),u("__",_s,A("bold_under_body")),u("~~",va,A("strike_body")),u("_",us,A("italic_under_body")),C({token:rd})]},italic_under_body:{rules:[u("_",ad,E()),L(`
190
+ `,E()),...Ta,...uo,u("**",_s,A("bold_star_body")),u("__",_s,A("bold_under_body")),u("~~",va,A("strike_body")),u("*",us,A("italic_star_body")),C({token:rd})]},strike_body:{rules:[u("~~",q1,E()),L(`
191
+ `,E()),...Ta,...uo,u("**",_s,A("bold_star_body")),u("__",_s,A("bold_under_body")),u("*",us,A("italic_star_body")),u("_",us,A("italic_under_body")),C({token:R1})]},code_body:{rules:[u("`",D1,E()),L(`
192
+ `,E()),C({token:O1})]},link_text:{rules:[u("]",P1,T("link_after_close")),L(`
193
+ `,E()),...Ta,u("<",sd,A("autolink_body")),u("&",Yl,A("entity_body")),u("`",od,A("code_body")),...Vd,C({token:N1})]},link_after_close:{rules:[u("(",Gl,T("link_destination")),u("[",Gl,T("link_reference_label")),C(E())]},link_destination:{rules:[u(")",Gl,E()),L(`
194
+ `,E()),ct('"','"',nd,{escape:"\\",multiline:!1}),ct("'","'",nd,{escape:"\\",multiline:!1}),C({token:M1})]},link_reference_label:{rules:[u("]",Gl,E()),L(`
195
+ `,E()),C({token:Vl})]},autolink_body:{rules:[u(">",I1,E()),L(`
196
+ `,E()),C({token:S1})]},entity_body:{rules:[u(";",Yl,E()),u([Ue,xe,"#","x"],Yl),C(E())]},list_body_probe:{rules:[u(["[ ] ","[x] ","[X] "],z1,T("inline_content")),C(T("inline_content"))]},indented_code:{rules:[u(`
197
+ `,tu,E()),C({token:tu})]},thematic_break_tail:{rules:[u(`
198
+ `,nu,T("block_start")),u(["-","*","_"," ","\t"],nu),C(T("inline_content"))]},fence_info_btick:{rules:[L(`
199
+ `,T("fence_body_btick")),C({token:td})]},fence_body_btick:{rules:[u(`
200
+ `,Wl,T("fence_maybe_close_btick")),C({token:Wl})]},fence_maybe_close_btick:{rules:[u(["``````","`````","````","```"],co,T("fence_close_tail")),C(T("fence_body_btick"))]},fence_info_tilde:{rules:[L(`
201
+ `,T("fence_body_tilde")),C({token:td})]},fence_body_tilde:{rules:[u(`
202
+ `,Wl,T("fence_maybe_close_tilde")),C({token:Wl})]},fence_maybe_close_tilde:{rules:[u(["~~~~~~","~~~~~","~~~~","~~~"],co,T("fence_close_tail")),C(T("fence_body_tilde"))]},fence_close_tail:{rules:[u(`
203
+ `,co,T("block_start")),C({token:co})]}}}),Yd=[{open_type:"bold_open",close_type:"bold_close",style_name:"bold"},{open_type:"italic_open",close_type:"italic_close",style_name:"italic"},{open_type:"strike_open",close_type:"strike_close",style_name:"strike"},{open_type:"code_open",close_type:"code_close",style_name:"code"},{open_type:"link_text_open",close_type:"link_text_close",style_name:"link_text"},{open_type:"autolink_open",close_type:"autolink_close",style_name:"autolink"}],R0=[{...ze(m1({auto_pop_on_newline:!0,join_separator:" ",dedup_against_base:!0,styles:Yd}),Yd.map((e)=>e.style_name)),clears:Object.fromEntries(Yd.map((e)=>[e.style_name,[e.open_type,e.style_name,e.close_type]]))}],M0=yt(XE),KE=Ct(M0,R0);function I0(e){let t=e?.languages,r=e?.front_matter;if(t===void 0&&r===void 0)return KE(e);let n=[...R0];if(r!==void 0&&n.push(Ht(ua({raw_front_matter:r}),"embed")),t!==void 0){let s=u1({label:"code_language",body:"raw_code_block",languages:t});n.push(Ht(s,"embed"))}return Ct(M0,n)(e)}function D0(e){if(e==="")return[""];let t=D0(e.slice(1)),r=e[0].toLowerCase(),n=e[0].toUpperCase();return r===n?t.map((s)=>r+s):[...t.map((s)=>r+s),...t.map((s)=>n+s)]}function pu(e){let t=[];for(let r of e)t.push(...D0(r));return t}var P0=pu(["b","u"]),q0=pu(["r","rb","br"]),L0=[...P0,...q0],F0=pu(["f","t"]),j0=pu(["rf","fr","rt","tr"]),z0=[...F0,...j0],U0=[...z0,...L0],ZE=U0.filter((e)=>e[0]>="a"&&e[0]<="z"),JE=U0.filter((e)=>e[0]>="A"&&e[0]<="Z"),QE=['"""'],e3=["'''"],t3=['"'],r3=["'"],n3="and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield".split("."),s3=["True","False"],i3=["None"],o3=["int","float","complex","bool","str","bytes","bytearray","memoryview","list","tuple","dict","set","frozenset","object","range","slice","type"],a3=["**=","//=","<<=",">>=","..."],l3=["**","//","<<",">>","<=",">=","==","!=","+=","-=","*=","/=","%=","&=","|=","^=","@=",":=","->"],c3=["+","-","*","/","%","&","|","^","~","<",">","=","@"],Gd=[...a3,...l3,...c3],_3=["(","[","{"],u3=[")","]","}"],rp=tt([[128,65535]]),Wd=L([" ","\t",`
204
+ `,"\r","\f"]),Xd={...ct("#",`
205
+ `,Be),seal:!0},Kd=u("\\",ce),Zd=[L(z0,A("fstring_prefix_probe")),L(L0,A("plain_prefix_probe")),u(QE,q,A("string_triple_dq")),u(e3,q,A("string_triple_sq")),u(t3,q,A("string_single_dq")),u(r3,q,A("string_single_sq"))],Jd=[u(["0x","0X"],J,A("hex_number")),u(["0b","0B"],J,A("bin_number")),u(["0o","0O"],J,A("oct_number")),u(xe,J,A("number"))],Qd=[et(i3),et(n3)],ep=u(X_,me,A("type_identifier_body")),tp=u(["_",W_,rp],me,A("identifier_body")),h3=Tt({name:"python",states:{main:{rules:[Wd,Xd,...Zd,...Jd,...Qd,u(Gd,ce),Kd,u(["(",")","[","]","{","}",",",";",":","."],I),ep,tp]},identifier_body:{rules:[u(["_",st,rp],me),C(E())]},type_identifier_body:{rules:[u(["_",st,rp],me),C(E())]},number:{rules:[u(["_",xe],J),u(".",J,A("float_decimal")),u(["e","E"],J,A("float_exponent_sign")),u(["j","J"],J,E()),C(E())]},float_decimal:{rules:[u(["_",xe],J),u(["e","E"],J,A("float_exponent_sign")),u(["j","J"],J,E()),C(E())]},float_exponent_sign:{rules:[u(["+","-"],J,A("float_exponent_digits")),u(xe,J,A("float_exponent_digits")),C(E())]},float_exponent_digits:{rules:[u(["_",xe],J),u(["j","J"],J,E()),C(E())]},hex_number:{rules:[u(["_",he],J),C(E())]},bin_number:{rules:[u(["_","0","1"],J),C(E())]},oct_number:{rules:[u(["_",tt([["0","7"]])],J),C(E())]},string_single_dq:{rules:[u("\\",B,A("string_escape_start")),u('"',q,E()),C({token:q})]},string_single_sq:{rules:[u("\\",B,A("string_escape_start")),u("'",q,E()),C({token:q})]},string_triple_dq:{rules:[u("\\",B,A("string_escape_start")),u('"""',q,E()),C({token:q})]},string_triple_sq:{rules:[u("\\",B,A("string_escape_start")),u("'''",q,E()),C({token:q})]},rstring_single_dq:{rules:[u("\\",q,A("raw_esc_consume")),u('"',q,E()),C({token:q})]},rstring_single_sq:{rules:[u("\\",q,A("raw_esc_consume")),u("'",q,E()),C({token:q})]},rstring_triple_dq:{rules:[u("\\",q,A("raw_esc_consume")),u('"""',q,E()),C({token:q})]},rstring_triple_sq:{rules:[u("\\",q,A("raw_esc_consume")),u("'''",q,E()),C({token:q})]},raw_esc_consume:{rules:[C({token:q,exit:!0})]},string_escape_start:{rules:[u("x",B,T("esc_hex_d1")),u("u",B,T("esc_u4_d1")),u("U",B,T("esc_u8_d1")),u("N",B,T("esc_named_open")),u(tt([["0","7"]]),B,T("esc_oct_d2")),C({token:B,exit:!0})]},esc_hex_d1:{rules:[u(he,B,T("esc_hex_d2")),C(E())]},esc_hex_d2:{rules:[u(he,B,E()),C(E())]},esc_u4_d1:{rules:[u(he,B,T("esc_u4_d2")),C(E())]},esc_u4_d2:{rules:[u(he,B,T("esc_u4_d3")),C(E())]},esc_u4_d3:{rules:[u(he,B,T("esc_u4_d4")),C(E())]},esc_u4_d4:{rules:[u(he,B,E()),C(E())]},esc_u8_d1:{rules:[u(he,B,T("esc_u8_d2")),C(E())]},esc_u8_d2:{rules:[u(he,B,T("esc_u8_d3")),C(E())]},esc_u8_d3:{rules:[u(he,B,T("esc_u8_d4")),C(E())]},esc_u8_d4:{rules:[u(he,B,T("esc_u8_d5")),C(E())]},esc_u8_d5:{rules:[u(he,B,T("esc_u8_d6")),C(E())]},esc_u8_d6:{rules:[u(he,B,T("esc_u8_d7")),C(E())]},esc_u8_d7:{rules:[u(he,B,T("esc_u8_d8")),C(E())]},esc_u8_d8:{rules:[u(he,B,E()),C(E())]},esc_named_open:{rules:[u("{",B,T("esc_named_body")),C(E())]},esc_named_body:{rules:[u("}",B,E()),u([st,"_"," ","-"],B),C(E())]},esc_oct_d2:{rules:[u(tt([["0","7"]]),B,T("esc_oct_d3")),C(E())]},esc_oct_d3:{rules:[u(tt([["0","7"]]),B,E()),C(E())]},fstring_prefix_probe:{mode:"probe",fallback:"string_prefix_fallback",rules:[L(['"""',"'''",'"',"'"],A("fstring_prefix_commit")),C(A("string_prefix_fallback"))]},fstring_prefix_commit:{rules:[u(F0,Nt,T("fstring_prefix_quote")),u(j0,Nt,T("raw_fstring_prefix_quote"))]},fstring_prefix_quote:{rules:[u('"""',q,T("fstring_body_triple_dq")),u("'''",q,T("fstring_body_triple_sq")),u('"',q,T("fstring_body_single_dq")),u("'",q,T("fstring_body_single_sq"))]},raw_fstring_prefix_quote:{rules:[u('"""',q,T("raw_fstring_body_triple_dq")),u("'''",q,T("raw_fstring_body_triple_sq")),u('"',q,T("raw_fstring_body_single_dq")),u("'",q,T("raw_fstring_body_single_sq"))]},plain_prefix_probe:{mode:"probe",fallback:"string_prefix_fallback",rules:[L(['"""',"'''",'"',"'"],A("plain_prefix_commit")),C(A("string_prefix_fallback"))]},plain_prefix_commit:{rules:[u(P0,Nt,T("plain_prefix_quote")),u(q0,Nt,T("raw_prefix_quote"))]},plain_prefix_quote:{rules:[u('"""',q,T("string_triple_dq")),u("'''",q,T("string_triple_sq")),u('"',q,T("string_single_dq")),u("'",q,T("string_single_sq"))]},raw_prefix_quote:{rules:[u('"""',q,T("rstring_triple_dq")),u("'''",q,T("rstring_triple_sq")),u('"',q,T("rstring_single_dq")),u("'",q,T("rstring_single_sq"))]},string_prefix_fallback:{rules:[u(ZE,me,T("identifier_body")),u(JE,me,T("type_identifier_body"))]},fstring_body_single_dq:{rules:[u("\\",B,A("string_escape_start")),u("{{",q),u("}}",q),u("{",ur,A("fstring_expr_top")),u('"',q,E()),C({token:q})]},fstring_body_single_sq:{rules:[u("\\",B,A("string_escape_start")),u("{{",q),u("}}",q),u("{",ur,A("fstring_expr_top")),u("'",q,E()),C({token:q})]},fstring_body_triple_dq:{rules:[u("\\",B,A("string_escape_start")),u("{{",q),u("}}",q),u("{",ur,A("fstring_expr_top")),u('"""',q,E()),C({token:q})]},fstring_body_triple_sq:{rules:[u("\\",B,A("string_escape_start")),u("{{",q),u("}}",q),u("{",ur,A("fstring_expr_top")),u("'''",q,E()),C({token:q})]},raw_fstring_body_single_dq:{rules:[u("\\",q,A("raw_esc_consume")),u("{{",q),u("}}",q),u("{",ur,A("fstring_expr_top")),u('"',q,E()),C({token:q})]},raw_fstring_body_single_sq:{rules:[u("\\",q,A("raw_esc_consume")),u("{{",q),u("}}",q),u("{",ur,A("fstring_expr_top")),u("'",q,E()),C({token:q})]},raw_fstring_body_triple_dq:{rules:[u("\\",q,A("raw_esc_consume")),u("{{",q),u("}}",q),u("{",ur,A("fstring_expr_top")),u('"""',q,E()),C({token:q})]},raw_fstring_body_triple_sq:{rules:[u("\\",q,A("raw_esc_consume")),u("{{",q),u("}}",q),u("{",ur,A("fstring_expr_top")),u("'''",q,E()),C({token:q})]},fstring_expr_top:{rules:[Wd,Xd,...Zd,...Jd,u(["!s","!r","!a"],ur),u(Gd,ce),Kd,u("}",ur,E()),u(":",I,T("fstring_format_spec")),u("{",I,A("fstring_expr_nested")),u(["(","["],I,A("fstring_expr_nested")),u([")","]"],I,E()),u([",",";","."],I),...Qd,ep,tp]},fstring_expr_nested:{rules:[Wd,Xd,...Zd,...Jd,u(Gd,ce),Kd,u(u3,I,E()),u(_3,I,A("fstring_expr_nested")),u([",",";",".",":"],I),...Qd,ep,tp]},fstring_format_spec:{rules:[u("{{",su),u("}}",su),u("{",ur,A("fstring_expr_top")),u("}",ur,E()),C({token:su})]}}}),f3=Ei("identifier","boolean",s3),d3=Ei("identifier","builtin",o3),p3=z_("identifier","class_name"),m3=ca("identifier","constant"),g3=[{anchor:Ce("identifier","type"),when:ut(Cr(Ce("class_name"),Ce("identifier")),_a(Lr("[","]")),Ce("operator","=")),rewrite:"keyword"}],v3=Ai("identifier","function",{plain:!0},{trivia:["comment"]}),b3=[ze(f3,["boolean"]),ze(d3,["builtin"]),ze(m3,["constant"]),ze(p3,["class_name"]),Ht(an(g3,{trivia:["comment"]}),"type_claim"),ze((e,t)=>{let{tokens:r,token_types:n}=t,s=n.indexOf("identifier"),i=n.indexOf("keyword"),o=n.indexOf("punctuation");if(s<0||i<0||o<0)return t;let a=n.indexOf("namespace");a<0&&(a=n.length,n.push("namespace"));let l=Fr(e,r,n),_=l.count,c=(h)=>{let d=h;for(;d>=0&&d<_;){if(l.is_trivia(d)){d++;continue}let f=l.kind_of(d);if(f===s){r[d*3]=a,d++;continue}if(f===o&&l.text_of(d)==="."){d++;continue}break}return d};for(let h=0;h<_;h++){if(l.is_trivia(h)||l.kind_of(h)!==i)continue;let d=l.text_of(h);if(d==="import"){let f=l.next_non_trivia(h+1);for(;f>=0&&f<_&&(f=c(f),f=l.next_non_trivia(f),!(f<0));){if(l.kind_of(f)===i&&l.text_of(f)==="as"&&(f=l.next_non_trivia(f+1),f>=0&&l.kind_of(f)===s&&(r[f*3]=a,f=l.next_non_trivia(f+1))),f>=0&&l.kind_of(f)===o&&l.text_of(f)===","){f=l.next_non_trivia(f+1);continue}break}continue}if(d==="from"){let f=l.next_non_trivia(h+1);f=c(f),f>=0&&l.kind_of(f)===i&&l.text_of(f)==="import"&&(h=f);continue}}return{tokens:r,token_types:n}},["namespace"]),ze((e,t)=>{let{tokens:r,token_types:n}=t,s=n.indexOf("identifier"),i=n.indexOf("keyword"),o=n.indexOf("punctuation"),a=n.indexOf("operator");if(s<0||i<0||o<0)return t;let l=n.indexOf("parameter");l<0&&(l=n.length,n.push("parameter"));let _=Fr(e,r,n),c=_.count,h=(d)=>{let f=1,p=!0,m=d+1;for(;m<c&&f>0;){if(_.is_trivia(m)){m++;continue}let g=_.kind_of(m),b=_.text_of(m);if(g===o){for(let k of b)if(k==="("||k==="[")f++;else if(k===")"||k==="]"){if(f--,f===0)return m+1}else k===","&&f===1&&(p=!0);m++;continue}f===1&&p&&g===s?(r[m*3]=l,p=!1):g===a&&(b==="*"||b==="**")||(p=!1),m++}return m};for(let d=0;d<c;d++){if(_.is_trivia(d)||_.kind_of(d)!==i)continue;let f=_.text_of(d);if(f==="def"){let p=_.next_non_trivia(d+1);if(p<0||_.kind_of(p)!==s||(p=_.next_non_trivia(p+1),p<0||_.kind_of(p)!==o||!_.text_of(p).startsWith("(")))continue;d=h(p)-1;continue}if(f==="lambda"){let p=!0,m=_.next_non_trivia(d+1);for(;m<c;){if(_.is_trivia(m)){m++;continue}let g=_.kind_of(m),b=_.text_of(m);if(g===a&&b===":")break;if(g===o&&(b===","||b==="("||b===")")){b===","&&(p=!0),m++;continue}g===s&&p&&(r[m*3]=l,p=!1),m++}d=m}}return{tokens:r,token_types:n}},["parameter"]),ze(v3,["function"])],k3=yt(h3),B0=Ct(k3,b3);var y3="if.else.match.loop.while.for.break.continue.return.fn.let.const.static.struct.enum.trait.impl.type.mod.use.extern.crate.pub.mut.ref.move.async.await.unsafe.dyn.as.in.where.self.super.Self.abstract.become.box.do.final.macro.override.priv.try.typeof.unsized.virtual.yield".split("."),w3=["true","false"],x3=["<<=",">>=","..="],$3=["::","->","=>","..","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","|=","^="],E3=["+","-","*","/","%","&","|","^","!","<",">","=",".","?","~","@"],A3=[...x3,...$3,...E3],ic=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize"],gu=["f32","f64"],T3=[...ic,...gu],C3=[...ic,...gu,"bool","char","str"],S3=ct("//",`
206
+ `,Be);ct('"','"',q,{escape:"\\"});var O3=Tt({name:"rust",states:{main:{rules:[L([" ","\t",`
207
+ `,"\r"]),S3,u("/*",Be,A("block_comment")),u('r###"',q,A("raw_string_3")),u('r##"',q,A("raw_string_2")),u('r#"',q,A("raw_string_1")),u('r"',q,A("raw_string_0")),u('br###"',q,A("raw_string_3")),u('br##"',q,A("raw_string_2")),u('br#"',q,A("raw_string_1")),u('br"',q,A("raw_string_0")),u('cr###"',q,A("raw_string_3")),u('cr##"',q,A("raw_string_2")),u('cr#"',q,A("raw_string_1")),u('cr"',q,A("raw_string_0")),u('b"',q,A("string_body")),u('c"',q,A("string_body")),u('"',q,A("string_body")),u("b'",q,A("char_body")),L("'",A("quote_probe")),u("#!",_d,A("attribute_open")),u("#",_d,A("attribute_open")),u(["{","}","(",")","[","]",";",","],I),u("::",I),u(":",I),u(A3,ce),et(y3),u(["0x","0X"],J,A("hex_number")),u(["0o","0O"],J,A("octal_number")),u(["0b","0B"],J,A("binary_number")),u(xe,J,A("number")),u(X_,me,A("type_identifier")),u(["_",W_],me,A("identifier"))]},identifier:{rules:[u(["_",st],me),u("!",Hl,E()),C(E())]},type_identifier:{rules:[u(["_",st],me),u("!",Hl,E()),C(E())]},block_comment:{rules:[u("/*",Be,A("block_comment")),u("*/",Be,E()),C({token:Be})]},string_body:{rules:[u("\\u{",B,A("esc_unicode")),u("\\x",B,A("esc_hex")),u("\\",B,A("esc_simple")),u('"',q,E()),C({token:q})]},raw_string_0:{rules:[u('"',q,E()),C({token:q})]},raw_string_1:{rules:[u('"#',q,E()),C({token:q})]},raw_string_2:{rules:[u('"##',q,E()),C({token:q})]},raw_string_3:{rules:[u('"###',q,E()),C({token:q})]},quote_probe:{mode:"probe",fallback:"char_literal",rules:[L(["_",Ue],A("quote_probe_ident")),L("\\",A("char_literal")),L("'",A("char_literal")),L([" ","\t",`
208
+ `,"\r",",",";",":",".",">",")","]","}","+","-","*","/","%","&","|","^","!","=","<","?","(","[","{","#","@","~",xe],A("char_literal"))]},quote_probe_ident:{mode:"probe",fallback:"lifetime_token",rules:[L("'",A("char_literal")),L(`
209
+ \r,;:.>)]}+-*/%&|^!=<?([{#@~`.split(""),A("lifetime_token"))]},char_literal:{rules:[u("'",q,T("char_literal_body")),C(E())]},char_literal_body:{rules:[u("\\u{",B,A("esc_unicode")),u("\\x",B,A("esc_hex")),u("\\",B,A("esc_simple")),u("'",q,E()),C({token:q,...T("char_literal_close")})]},esc_simple:{rules:[C({token:B,exit:!0})]},esc_unicode:{rules:[u(he,B),u("_",B),u("}",B,E()),C(E())]},esc_hex:{rules:[u(he,B),C(E())]},char_literal_close:{rules:[u("'",q,E()),C(E())]},lifetime_token:{rules:[u("'",I,T("lifetime_body")),C(E())]},lifetime_body:{rules:[u(["_",st],k1),C(E())]},char_body:{rules:[u("\\u{",B,A("esc_unicode")),u("\\x",B,A("esc_hex")),u("\\",B,A("esc_simple")),u("'",q,E()),C({token:q,...T("char_literal_close")})]},attribute_open:{rules:[u("[",I,T("attribute_body")),C(E())]},attribute_body:{rules:[u("]",I,E()),u("(",I,A("attribute_parens")),u("[",I,A("attribute_brackets")),u([",","="],I),ct('"','"',q,{escape:"\\"}),L([" ","\t",`
210
+ `,"\r"]),u(["_",st],Os),u(["-",":"],Os)]},attribute_parens:{rules:[u(")",I,E()),u("(",I,A("attribute_parens")),u([",","="],I),ct('"','"',q,{escape:"\\"}),L([" ","\t",`
211
+ `,"\r"]),u(["_",st],Os),u(["-",":"],Os)]},attribute_brackets:{rules:[u("]",I,E()),u("[",I,A("attribute_brackets")),u([",","="],I),ct('"','"',q,{escape:"\\"}),L([" ","\t",`
212
+ `,"\r"]),u(["_",st],Os),u(["-",":"],Os)]},number:{rules:[u(["_",xe],J),u("..",ce,E()),u(".",J,T("decimal")),u(["e","E"],ce,T("exponent_sign")),et(T3,E(),lo),C(E())]},decimal:{rules:[u(["_",xe],J),u(["e","E"],ce,T("exponent_sign")),et(gu,E(),lo),C(E())]},exponent_sign:{rules:[u(["+","-"],J,T("exponent_digits")),u(xe,J,T("exponent_digits")),C(E())]},exponent_digits:{rules:[u(["_",xe],J),et(gu,E(),lo),C(E())]},hex_number:{rules:[u(["_",he],J),et(ic,E(),lo),C(E())]},octal_number:{rules:[u(["_",tt([["0","7"]])],J),et(ic,E(),lo),C(E())]},binary_number:{rules:[u(["_","0","1"],J),et(ic,E(),lo),C(E())]}}}),N3=Ei("identifier","boolean",w3),R3=Ei("identifier","class_name",C3),M3=z_("identifier","class_name"),I3=ca("identifier","constant"),D3=(e,t)=>{let{tokens:r,token_types:n}=t,s=n.indexOf("identifier"),i=n.indexOf("class_name"),o=n.indexOf("namespace"),a=n.indexOf("keyword"),l=n.indexOf("punctuation");if(s<0||a<0||l<0)return t;let _=n.indexOf("variant");_<0&&(_=n.length,n.push("variant"));let c=Fr(e,r,n),h=c.count,d=(m)=>m===s||m===i||o>=0&&m===o,f=(m)=>{let g=r[m*3+1];if(r[m*3+2]<=g)return!1;let b=e.charCodeAt(g);return b>=65&&b<=90},p=new Uint8Array(h);for(let m=0;m<h;m++)if(!c.is_trivia(m)&&c.kind_of(m)===a&&c.text_of(m)==="use")for(let g=m;g<h&&(p[g]=1,!(c.kind_of(g)===l&&c.text_of(g)===";"));g++);for(let m=0;m<h-2;m++){if(p[m]||c.is_trivia(m)||!d(c.kind_of(m))||!f(m))continue;let g=c.next_non_trivia(m+1);if(g<0||c.kind_of(g)!==l||!c.text_of(g).startsWith("::"))continue;let b=c.next_non_trivia(g+1);b<0||!d(c.kind_of(b))||!f(b)||(r[b*3]=_)}return{tokens:r,token_types:n}},P3=(e,t)=>{let{tokens:r,token_types:n}=t,s=n.indexOf("identifier"),i=n.indexOf("keyword"),o=n.indexOf("punctuation"),a=n.indexOf("operator");if(s<0||i<0||o<0)return t;let l=n.indexOf("parameter");l<0&&(l=n.length,n.push("parameter"));let _=Fr(e,r,n),c=_.count;for(let h=0;h<c;h++){if(_.is_trivia(h)||_.kind_of(h)!==i||_.text_of(h)!=="fn")continue;let d=_.next_non_trivia(h+1);if(d>=0&&_.kind_of(d)===s&&(d=_.next_non_trivia(d+1)),d>=0&&_.kind_of(d)===a&&_.text_of(d)==="<"){let g=1;for(d++;d<c&&g>0;){if(_.is_trivia(d)){d++;continue}if(_.kind_of(d)===a){let b=_.text_of(d);b==="<"?g++:b===">"?g--:b===">>"&&(g=Math.max(0,g-2))}d++}}if(d=_.next_non_trivia(d),d<0||_.kind_of(d)!==o||!_.text_of(d).startsWith("("))continue;let f=1,p=!0,m=d+1;for(;m<c&&f>0;){if(_.is_trivia(m)){m++;continue}let g=_.kind_of(m),b=_.text_of(m);if(g===o){for(let k of b)if(k==="("||k==="["||k==="{")f++;else if(k===")"||k==="]"||k==="}"){if(f--,f===0)break}else k===","&&f===1&&(p=!0);m++;continue}if(f===1&&p){if(g===i&&(b==="self"||b==="mut")){m++;continue}if(g===a&&b==="&"){m++;continue}g===s&&(r[m*3]=l),p=!1}m++}h=m-1}return{tokens:r,token_types:n}},q3=(e,t)=>{let{tokens:r,token_types:n}=t,s=n.indexOf("identifier"),i=n.indexOf("keyword"),o=n.indexOf("punctuation"),a=n.indexOf("class_name");if(s<0||i<0||o<0)return t;let l=n.indexOf("namespace");l<0&&(l=n.length,n.push("namespace"));let _=Fr(e,r,n),c=_.count;for(let h=0;h<c;h++)if(!_.is_trivia(h)&&_.kind_of(h)===i&&_.text_of(h)==="use")for(let d=h+1;d<c;d++){if(_.is_trivia(d))continue;let f=_.kind_of(d);if(f===o&&_.text_of(d)===";")break;if(f!==s&&f!==a)continue;let p=_.next_non_trivia(d+1);p>=0&&_.kind_of(p)===o&&_.text_of(p).startsWith("::")&&(r[d*3]=l)}return{tokens:r,token_types:n}},mu=Lr("(",")"),L3=[{anchor:"identifier",when:Cr(ut(mu),ut(Ce("builtin",["!"]),mu),ut(Lr("<",">"),mu),ut(Ce("punctuation",["::"]),Lr("<",">"),mu)),rewrite:"function"}],F3=new Set(["impl","for"]),j3=new Set(["fn","impl","for"]),z3=[ze(N3,["boolean"]),ze(R3,["class_name"]),ze(I3,["constant"]),ze(M3,["class_name"]),ze(q3,["namespace"]),ze(D3,["variant"]),ze(P3,["parameter"]),Ht((e,t)=>{let r=new Uint32Array(t.tokens),n=t.token_types.slice(),s=n.indexOf("operator"),i=n.indexOf("punctuation"),o=n.indexOf("class_name"),a=n.indexOf("keyword"),l=n.indexOf("identifier");if(s===-1||i===-1)return{tokens:r,token_types:n};let _=Fr(e,r,n),c=_.count,h=(f)=>{let p=_.prev_non_trivia(f-1);if(p<0)return!1;let m=_.kind_of(p);if(m===o||m===i&&_.text_of(p)==="::")return!0;if(m===a)return F3.has(_.text_of(p));if(m===l){let g=_.prev_non_trivia(p-1);return g<0||_.kind_of(g)!==a?!1:j3.has(_.text_of(g))}return!1},d=(f)=>{let p=1;for(let m=f+1;m<c;m++){if(_.kind_of(m)!==s)continue;let g=_.text_of(m);if(g==="<")p++;else if(g===">"){if(p--,p===0)return m}else if(g===">>"){if(p-=2,p<=0)return m}else if(g===">="||g===">>="||g==="<="||g==="<<"||g==="<<=")return-1}return-1};for(let f=0;f<c;f++){if(_.kind_of(f)!==s||_.text_of(f)!=="<"||!h(f))continue;let p=d(f);if(p!==-1){for(let m=f;m<=p;m++){if(_.kind_of(m)!==s)continue;let g=_.text_of(m);(g==="<"||g===">"||g===">>")&&(r[m*3]=i)}f=p}}return{tokens:r,token_types:n}},"type_claim"),ze(an(L3,{trivia:["comment"]}),["function"])],U3=yt(O3),H0=Ct(U3,z3);var B3="<=>.!~*.->>.#>>.!=.<=.>=.<>.::.->.#>.@>.<@.||.&&.!~.~*.?|.?&.+=.-=.*=./=.%=.&=.|=.^=.!<.!>.==.**.<<.>>.:=.@@.+.-.*./.%.^.=.<.>.!.~.&.|".split("."),H3=L([" ","\t",`
213
+ `,"\r"]),V3=ct("--",`
214
+ `,Be),Y3={...ct("#",`
215
+ `,Be),seal:!0},Ca=tt([["a","z"],["A","Z"],["0","9"],["_","_"],["$","$"]]),np=tt([["a","z"],["A","Z"],["_","_"]]),G3=Tt({name:"sql",states:{main:{rules:[H3,V3,Y3,u("/*",Be,A("block_comment")),u(["U&'","u&'"],q,A("single_string")),u(['U&"','u&"'],me,A("double_ident")),u(["E","e"],me,A("e_prefix_body")),u(["N","n"],me,A("n_prefix_body")),u(["B","b"],me,A("bx_prefix_body")),u(["X","x"],me,A("bx_prefix_body")),u("'",q,A("single_string")),u('"',me,A("double_ident")),u("`",me,A("backtick_ident")),u("[",me,A("bracket_ident")),u("$$",q,A("dollar_string")),L("$",A("dollar_probe")),L("@@",A("at_at_probe")),L("@",A("at_probe")),u(B3,ce),u(":",Wr,A("colon_var_body")),u("?",me,A("qmark_body")),u(["0x","0X"],J,A("hex_number")),u(["0b","0B"],J,A("bin_number")),u(["0o","0O"],J,A("oct_number")),u(xe,J,A("number")),u(["(",")","{","}",",",";","."],I),u(np,me,A("identifier_body"))]},identifier_body:{rules:[u(Ca,me),C(E())]},block_comment:{rules:[u("/*",Be,A("block_comment")),u("*/",Be,E()),C({token:Be})]},single_string:{rules:[u("''",B),u("\\",B,A("esc_simple")),u("'",q,E()),C({token:q})]},pg_escape_string:{rules:[u("''",B),u("\\x",B,A("esc_hex_d1")),u("\\u",B,A("esc_u4_d1")),u("\\U",B,A("esc_u8_d1")),u("\\",B,A("e_esc_start")),u("'",q,E()),C({token:q})]},esc_simple:{rules:[C({token:B,exit:!0})]},e_esc_start:{rules:[u(tt([["0","7"]]),B,T("esc_oct_d2")),C({token:B,exit:!0})]},esc_hex_d1:{rules:[u(he,B,T("esc_hex_d2")),C(E())]},esc_hex_d2:{rules:[u(he,B,E()),C(E())]},esc_u4_d1:{rules:[u(he,B,T("esc_u4_d2")),C(E())]},esc_u4_d2:{rules:[u(he,B,T("esc_u4_d3")),C(E())]},esc_u4_d3:{rules:[u(he,B,T("esc_u4_d4")),C(E())]},esc_u4_d4:{rules:[u(he,B,E()),C(E())]},esc_u8_d1:{rules:[u(he,B,T("esc_u8_d2")),C(E())]},esc_u8_d2:{rules:[u(he,B,T("esc_u8_d3")),C(E())]},esc_u8_d3:{rules:[u(he,B,T("esc_u8_d4")),C(E())]},esc_u8_d4:{rules:[u(he,B,T("esc_u8_d5")),C(E())]},esc_u8_d5:{rules:[u(he,B,T("esc_u8_d6")),C(E())]},esc_u8_d6:{rules:[u(he,B,T("esc_u8_d7")),C(E())]},esc_u8_d7:{rules:[u(he,B,T("esc_u8_d8")),C(E())]},esc_u8_d8:{rules:[u(he,B,E()),C(E())]},esc_oct_d2:{rules:[u(tt([["0","7"]]),B,T("esc_oct_d3")),C(E())]},esc_oct_d3:{rules:[u(tt([["0","7"]]),B,E()),C(E())]},e_prefix_body:{rules:[u("'",q,T("pg_escape_string")),u(Ca,me,T("identifier_body")),C(E())]},n_prefix_body:{rules:[u("'",q,T("single_string")),u(Ca,me,T("identifier_body")),C(E())]},bx_prefix_body:{rules:[u("'",iu,T("bit_string")),u(Ca,me,T("identifier_body")),C(E())]},bit_string:{rules:[u("'",iu,E()),C({token:iu})]},dollar_string:{rules:[u("$$",q,E()),C({token:q})]},double_ident:{rules:[u('""',me),u('"',me,E()),C({token:me})]},backtick_ident:{rules:[u("``",me),u("`",me,E()),C({token:me})]},bracket_ident:{rules:[u("]]",me),u("]",me,E()),C({token:me})]},dollar_probe:{mode:"probe",fallback:"dollar_as_operator",rules:[L(xe,A("pg_param_start")),L([Ue,"_"," ","\t",`
216
+ `,"\r","'",'"',"`","[","]","{","}","(",")",".",",",";",":","+","-","*","/","%","&","|","^","=","<",">","~","!","?","@","#","$","\\"],A("dollar_as_operator"))]},dollar_as_operator:{rules:[u("$",ce,E())]},pg_param_start:{rules:[u("$",Wr,T("pg_param_body"))]},pg_param_body:{rules:[u(xe,Wr),C(E())]},at_at_probe:{mode:"probe",fallback:"at_at_as_operator",rules:[L(np,A("at_at_variable")),L([xe," ","\t",`
217
+ `,"\r","'",'"',"`","[","]","{","}","(",")",".",",",";",":","+","-","*","/","%","&","|","^","=","<",">","~","!","?","@","#","$","\\"],A("at_at_as_operator"))]},at_at_as_operator:{rules:[u("@@",ce,E())]},at_at_variable:{rules:[u("@@",Wr,T("var_name_body"))]},at_probe:{mode:"probe",fallback:"at_as_operator",rules:[L(np,A("at_variable")),L([xe," ","\t",`
218
+ `,"\r","'",'"',"`","[","]","{","}","(",")",".",",",";",":","+","-","*","/","%","&","|","^","=","<",">","~","!","?","@","#","$","\\"],A("at_as_operator"))]},at_as_operator:{rules:[u("@",ce,E())]},at_variable:{rules:[u("@",Wr,T("var_name_body"))]},var_name_body:{rules:[u(Ca,Wr),C(E())]},colon_var_body:{rules:[u(Ca,Wr),C(E())]},qmark_body:{rules:[u(xe,me),C(E())]},number:{rules:[u(xe,J),u("_",J),u(".",J,T("number_decimal")),u(["e","E"],J,T("number_exp_sign")),C(E())]},number_decimal:{rules:[u(xe,J),u("_",J),u(["e","E"],J,T("number_exp_sign")),C(E())]},number_exp_sign:{rules:[u(["+","-"],J,T("number_exp_digits")),u(xe,J,T("number_exp_digits")),C(E())]},number_exp_digits:{rules:[u(xe,J),C(E())]},hex_number:{rules:[u([xe,tt([["a","f"],["A","F"]]),"_"],J),C(E())]},bin_number:{rules:[u([tt([["0","1"]]),"_"],J),C(E())]},oct_number:{rules:[u([tt([["0","7"]]),"_"],J),C(E())]}}}),W3="type",X3=ha([new Set(["true","false","null","unknown"]),new Set("int.integer.smallint.bigint.tinyint.mediumint.int2.int4.int8.decimal.numeric.dec.fixed.real.float.float4.float8.double.precision.char.character.varchar.nvarchar.nchar.text.ntext.clob.nclob.longtext.mediumtext.tinytext.binary.varbinary.blob.longblob.mediumblob.tinyblob.bytea.bit.varbit.image.bool.boolean.date.time.timestamp.datetime.year.interval.timestamptz.timetz.smalldatetime.datetime2.datetimeoffset.json.jsonb.xml.uuid.money.smallmoney.array.enum.record.point.line.lseg.box.path.polygon.circle.inet.cidr.macaddr.macaddr8.tsvector.tsquery.hstore.geometry.geography.rowversion.cursor.hierarchyid.sql_variant.uniqueidentifier.serial.bigserial.smallserial".split(".")),new Set("select.from.where.group.by.having.order.limit.offset.fetch.first.next.last.union.intersect.except.all.distinct.as.asc.desc.insert.into.values.update.set.delete.returning.upsert.merge.matched.create.alter.drop.truncate.rename.replace.table.view.index.database.schema.trigger.function.procedure.routine.event.sequence.domain.collation.role.user.tablespace.extension.grant.revoke.deny.privileges.to.begin.start.commit.rollback.savepoint.release.work.transaction.isolation.level.serializable.repeatable.read.write.committed.uncommitted.snapshot.join.inner.left.right.full.outer.cross.natural.on.using.lateral.straight_join.apply.pivot.unpivot.tablesample.with.recursive.window.over.partition.row.rows.range.groups.unbounded.preceding.following.current.exclude.ties.others.case.when.then.else.end.if.elseif.elsif.while.loop.for.do.exit.continue.return.returns.declare.cursor.open.close.prior.language.body.try.catch.throw.print.exec.execute.call.and.or.not.xor.in.between.like.ilike.similar.is.isnull.notnull.unique.exists.any.some.collate.div.mod.escape.glob.match.regexp.rlike.overlaps.contains.at.zone.local.default.current_date.current_time.current_timestamp.current_user.session_user.system_user.localtime.localtimestamp.current_role.current_schema.current_catalog.primary.foreign.key.references.check.constraint.generated.always.identity.autoincrement.auto_increment.temporary.temp.global.local.cascade.restrict.deferrable.deferred.immediate.initially.nulls.without.stored.virtual.add.column.change.modify.enable.disable.lock.unlock.tables.show.use.describe.desc.explain.analyze.vacuum.attach.detach.backup.restore.checkpoint.reindex.cluster.dbcc.errlvl.holdlock.nocheck.nonclustered.clustered.opendatasource.openquery.openrowset.openxml.raiserror.reconfigure.revert.rowguidcol.semantickeyphrasetable.try_convert.tsequal.waitfor.recompile.option.fillfactor.go.comment.before.after.instead.each.statement.new.old.of.both.leading.trailing.placing.immutable.stable.volatile.cost.parallel.safe.restricted.unsafe.leakproof.strict.definer.invoker.security.setof.out.inout.variadic.only.rule.materialized.nothing.conflict.excluded.concurrently.verbose.costs.buffers.format.abort.exclusive.share.nowait.skip.locked.filter.within.cast.convert.extract.abort.ignore.fail.abort.replace.perform.raise.notice.warning.exception.found.get.diagnostics.stacked.vacuum.pragma.indexed.without.virtual.materialized.detach.reindex".split("."))],{fold:!0}),K3=1,Z3=2,J3=3,Q3=(e,t)=>{let{tokens:r,token_types:n}=t,s=r.length/3;if(s===0)return t;let i=n.indexOf("identifier");if(i<0)return t;let o=(c)=>{let h=n.indexOf(c);return h<0&&(h=n.length,n.push(c)),h},a=o("keyword"),l=o("boolean"),_=o(W3);for(let c=0;c<s;c++){if(r[c*3]!==i)continue;let h=r[c*3+1],d=r[c*3+2],f=e.charCodeAt(h);if(f===34||f===96||f===91)continue;let p=fa(X3,e,h,d);p===K3?r[c*3]=l:p===Z3?r[c*3]=_:p===J3&&(r[c*3]=a)}return t},eA=Ai("identifier","function",{plain:!0}),tA=[ze(Q3,["keyword","boolean","type"]),ze(eA,["function"])],rA=yt(G3),V0=Ct(rA,tA);var sp=tt([["a","z"],["A","Z"],["0","9"],["-","-"],["_","_"],[":",":"]]),nA=tt([["a","z"],["A","Z"]]),sA=tt([["a","z"],["A","Z"],["0","9"],["-","-"],["_","_"]]),iA=["if","each","await","key","snippet","else if","else","then","catch"],oA=["html","const","debug","render"],ip=[L([" ","\t",`
219
+ `,"\r"]),u("=",ce),u("{",ur,A("expression_body")),u('"',q,A("attr_string_double")),u("'",q,A("attr_string_single")),u(["bind:","on:","use:","transition:","in:","out:","animate:","class:","style:","let:"],H1),u("|",I),u(sA,J_)],Y0=[ct('"','"',Ci,{escape:"\\",multiline:!0}),ct("'","'",Ci,{escape:"\\",multiline:!0}),ct("/*","*/",Ci,{multiline:!0}),ct("//",`
220
+ `,Ci),u("{",Ci,A("expression_brace")),C({token:Ci})],aA=Tt({name:"svelte",states:{content:{rules:[ct("<!--","-->",Be),u(["<!DOCTYPE","<!doctype"],pa,A("doctype")),u("</",I,A("close_tag_start")),L("<",A("lt_probe")),u("{",ur,A("brace_start")),C({})]},brace_start:{rules:[u(["#","/",":"],I,T("block_keyword")),u("@",I,T("at_directive_keyword")),C(T("expression_body"))]},block_keyword:{rules:[u(iA,cd,T("expression_body")),C(T("expression_body"))]},at_directive_keyword:{rules:[u(oA,cd,T("expression_body")),C(T("expression_body"))]},lt_probe:{mode:"probe",fallback:"lt_text",rules:[L(nA,A("lt_tag")),L("<",A("lt_text_before_lt")),C(A("lt_text"))]},lt_tag:{rules:[u("<",I,T("tag_start"))]},lt_text:{rules:[L("<"),C(E())]},lt_text_before_lt:{rules:[u("<",I,E())]},tag_start:{rules:[et(["script"],T("script_attrs"),Xr),et(["style"],T("style_attrs"),Xr),u("svelte","keyword",{boundary:!0,...T("tag_svelte_ns")}),u(sp,Xr,T("tag_open"))]},tag_svelte_ns:{rules:[u(":",I,T("tag_open")),C(T("tag_open"))]},tag_open:{rules:[u("/>",I,E()),u(">",I,E()),L([" ","\t",`
221
+ `,"\r"],T("tag_attrs")),u(sp,Xr)]},tag_attrs:{rules:[u("/>",I,E()),u(">",I,E()),...ip]},close_tag_start:{rules:[u("svelte","keyword",{boundary:!0,...T("close_tag_svelte_ns")}),C(T("close_tag"))]},close_tag_svelte_ns:{rules:[u(":",I,T("close_tag")),C(T("close_tag"))]},close_tag:{rules:[u(">",I,E()),L([" ","\t",`
222
+ `,"\r"]),u(sp,Xr)]},doctype:{rules:[u(">",I,E()),C({token:pa})]},script_attrs:{rules:[u("/>",I,E()),u(">",I,T("script_content")),...ip]},script_content:{rules:[L("</",A("script_close_probe")),C({token:ba})]},script_close_probe:{mode:"probe",fallback:"script_close_fail",rules:[L("script>",T("script_close_emit"))]},script_close_fail:{rules:[u("<",ba,E())]},script_close_emit:{rules:[u("</",I,T("script_close_name"))]},script_close_name:{rules:[u("script",Xr,T("script_close_gt"))]},script_close_gt:{rules:[u(">",I,E())]},style_attrs:{rules:[u("/>",I,E()),u(">",I,T("style_content")),...ip]},style_content:{rules:[L("</",A("style_close_probe")),C({token:ka})]},style_close_probe:{mode:"probe",fallback:"style_close_fail",rules:[L("style>",T("style_close_emit"))]},style_close_fail:{rules:[u("<",ka,E())]},style_close_emit:{rules:[u("</",I,T("style_close_name"))]},style_close_name:{rules:[u("style",Xr,T("style_close_gt"))]},style_close_gt:{rules:[u(">",I,E())]},attr_string_double:{rules:[u('"',q,E()),u("{",ur,A("expression_body")),C({token:q})]},attr_string_single:{rules:[u("'",q,E()),u("{",ur,A("expression_body")),C({token:q})]},expression_body:{rules:[u("}",ur,E()),...Y0]},expression_brace:{rules:[u("}",Ci,E()),...Y0]}}}),lA,cA,G0=(e)=>(lA??=Aa())(e),_A=[Ht(p1({open_type:"expression",open_text:"{",close_type:"expression",close_text:"}",post_open_required:{type:"punctuation",text_in:["#",":","/","@"]},retag_open_to:"punctuation",retag_close_to:"punctuation"}),"type_claim"),Ht(ua({raw_script:G0,raw_style:(e)=>(cA??=Si())(e),raw_svelte_expression:G0}),"embed")],uA=yt(aA),W0=Ct(uA,_A);var hA=["type","interface","enum","namespace","module","declare","abstract","readonly","public","private","protected","override","accessor","as","satisfies","keyof","infer","is","using","implements"],fA=[...yd,...hA].filter((e)=>!rc.includes(e)),op=(e)=>u(_u,ce,ln(e)),Sa=(e)=>u("!",ce,ln(e)),Ri=(e,t,r)=>[et(rc,ln(e)),...Td(fA,t,r),et(xd,ln(t)),et(wd,ln(t),"boolean")],dA=Tt({name:"typescript",states:{...$a.states,decorator:{rules:[u(["_","$",".",st],da),C(E())]},identifier:{rules:[Sa("division"),...$a.states.identifier.rules]},identifier_tmpl:{rules:[Sa("tmpl_division"),...$a.states.identifier_tmpl.rules]},function_body:Ed(Ri("regex_allow","division")),paren_group:Ad(Ri(null,null)),head_regex_allow:Cd(Ri(null,"head_division"),[op(null)]),head_division:Sd(Ri("head_regex_allow",null),[Sa(null)]),head_identifier:{rules:[Sa("head_division"),...$a.states.head_identifier.rules]},regex_allow:{rules:[...ec,op(null),...Ri(null,"division","control_head"),u("@",da,A("decorator")),u("/",jt,A("regex_pattern")),u(["(","{","["],I),u([")","}","]"],I,T("division")),...cn("member_access"),u([";",",",":"],I),L(["_","$",Ue],T("identifier_probe"))]},division:{rules:[...ec,Sa(null),...xa("regex_allow",null),...Ri("regex_allow",null,"control_head"),u("@",da,A("decorator")),u(["(","{","["],I,T("regex_allow")),u("/",ce,T("regex_allow")),u([")","}","]"],I),u([";",",",":"],I,T("regex_allow")),...cn("member_access"),L(["_","$",Ue],T("identifier_probe"))]},tmpl_regex_allow:{rules:[...tc,op(null),...Ri(null,"tmpl_division"),u("@",da,A("decorator")),u("}",I,E()),u("/",jt,A("regex_pattern")),u("{",I,A("tmpl_regex_allow")),u(["(","["],I),u([")","]"],I,T("tmpl_division")),...cn("member_access_tmpl"),u([";",",",":"],I),L(["_","$",Ue],T("identifier_probe_tmpl"))]},tmpl_division:{rules:[...tc,Sa(null),...xa("tmpl_regex_allow",null),...Ri("tmpl_regex_allow",null),u("@",da,A("decorator")),u("}",I,E()),u("{",I,A("tmpl_regex_allow")),u(["(","["],I,T("tmpl_regex_allow")),u("/",ce,T("tmpl_regex_allow")),u([")","]"],I),u([";",",",":"],I,T("tmpl_regex_allow")),...cn("member_access_tmpl"),L(["_","$",Ue],T("identifier_probe_tmpl"))]}}}),ap=["if","else","for","while","do","switch","case","break","continue","throw","try","catch","finally","function","class","interface","enum","namespace","module","import","export","return"],pA=G_({...Ea,brace_kinds:{...Ea.brace_kinds,prev_rules:[{prev_type:"identifier",prev_texts:["global"],kind:"block"},...Ea.brace_kinds.prev_rules],body_markers:[...Ea.brace_kinds.body_markers,{type:"keyword",text:"namespace",kind:"block"},{type:"keyword",text:"module",kind:"block"}]},ternary:{qmark:{type:"operator",text:"?"},colon_char:":",optional_member_kinds:["class","interface","type_literal","object"]},stmt_flags:[{name:"var_decl",arm:{type:"keyword",texts:["let","const","var"]},clear:{type:"keyword",texts:ap},clear_chars:";",clear_on_brace_close:!0},{name:"iface_head",arm:{type:"keyword",texts:["interface"]},clear:{type:"keyword",texts:ap.filter((e)=>e!=="interface")},clear_chars:";",clear_on_brace_close:!0},{name:"alias_head",arm:{type:"keyword",texts:["type"]},clear:{type:"keyword",texts:ap},clear_chars:";",clear_on_brace_close:!0}]}),mA=(e,t)=>{let{tokens:r,token_types:n}=t,s=n.indexOf("identifier"),i=n.indexOf("keyword"),o=n.indexOf("punctuation"),a=n.indexOf("operator");if(s<0||i<0||o<0)return t;let l=n.indexOf("type");l<0&&(l=n.length,n.push("type"));let _=Fr(e,r,n),c=_.count,h=(d)=>{let f=0,p=_.text_of(d);for(let g of p)g==="{"?f++:g==="}"&&f--;if(f<=0)return;let m=d+1;for(;m<c&&f>0;){if(_.is_trivia(m)){m++;continue}let g=_.kind_of(m),b=_.text_of(m);if(g===o){for(let k of b)if(k==="{")f++;else if(k==="}"&&(f--,f===0))break}else g===s&&(r[m*3]=l);m++}};for(let d=0;d<c;d++){if(_.is_trivia(d)||_.kind_of(d)!==i)continue;let f=_.text_of(d);if(f==="type"){let p=_.prev_non_trivia(d-1),m=p<0;if(!m&&p>=0){let b=_.kind_of(p),k=_.text_of(p);b===o&&k.length>0&&(k[k.length-1]===";"||k[k.length-1]==="}")&&(m=!0),b===i&&(k==="export"||k==="declare")&&(m=!0)}if(!m)continue;let g=_.next_non_trivia(d+1);g>=0&&_.kind_of(g)===s&&(r[g*3]=l);continue}if(f==="import"||f==="export"){let p=_.next_non_trivia(d+1);if(p<0||_.kind_of(p)!==i||_.text_of(p)!=="type")continue;let m=_.next_non_trivia(p+1);if(m<0)continue;let g=_.kind_of(m),b=_.text_of(m);if(g===a&&b==="*")continue;if(g===o&&b.length>0&&b[0]==="{"){h(m);continue}g===s&&f==="import"&&(r[m*3]=l);continue}}return t},gA="+,-,*,/,%,**,==,!=,===,!==,<=,>=,&&,||,??,?.,+=,-=,*=,/=,%=,&=,|=,^=,&&=,||=,??=,<<,>>,>>>,<<=,>>=,>>>=,**=,++,--".split(","),vA="return.if.else.for.while.do.switch.case.break.continue.throw.try.catch.finally.function.class.interface.enum.namespace.module.let.const.var.import.export.type".split("."),Q0=["this","void","undefined","null","never","unknown","any","object"],lp=["top","block"],Na={into:"types",value_op_terminators:gA,stmt_keyword_terminators:vA},Oa=ao(Na),X0=ao({...Na,brace_exit_on_closer:!0,type_terminal_keywords:Q0}),vu=ao({...Na,exit_on_comma:!1,brace_exit_on_closer:!0,type_terminal_keywords:Q0}),bA=ao({...Na,exit_on_qmark:!0}),K0=ao({...Na,enter_angle:!0,exit_on_comma:!1,exit_on_eq:!1,verify_generic_args:!0}),kA=ao({...Na,enter_angle:!0,exit_on_comma:!1,exit_on_eq:!1}),yA=an([{anchor:{type_name:"punctuation",value_ends_with:"):",ternary_colon:!1},when:X0,rewrite:{types:"type"}},{anchor:{type_name:"punctuation",value:":",ternary_colon:!1},before:Ce("punctuation",")"),when:X0,rewrite:{types:"type"}},{anchor:{type_name:"punctuation",value_ends_with:":",ternary_colon:!1,frame_kinds:["paren"],frame_direct:!0},when:Oa,rewrite:{types:"type"}},{anchor:{type_name:"punctuation",value_ends_with:":",ternary_colon:!1,frame_kinds:["class","interface"],frame_direct:!0},when:Oa,rewrite:{types:"type"}},{anchor:{type_name:"punctuation",value_ends_with:":",ternary_colon:!1,frame_kinds:["bracket"],frame_direct:!0},when:Oa,rewrite:{types:"type"}},{anchor:{type_name:"punctuation",value_ends_with:":",ternary_colon:!1,frame_kinds:lp,frame_direct:!0,stmt_flags_all:["var_decl"]},when:Oa,rewrite:{types:"type"}},{anchor:{type_name:"keyword",value:"as",frame_kinds:["object"],frame_direct:!0},before:ut(Cr(ut(Cr(Ce("keyword",["import","export","type"]),Ce("punctuation",",")),Ce("punctuation","{")),Ce("punctuation",",")),Cr(Ce("identifier"),Ce("keyword"),Ce("type"))),rewrite:"keyword"},{anchor:{type_name:"keyword",value:["as","satisfies"]},when:bA,rewrite:{types:"type"}},{anchor:{type_name:"keyword",value:"extends",stmt_flags_all:["iface_head"]},when:vu,rewrite:{types:"type"}},{anchor:{type_name:"keyword",value:"extends"},before:ut(Ce("operator","<"),Ce("identifier")),when:vu,rewrite:{types:"type"}},{anchor:{type_name:"keyword",value:"extends"},before:ut(Ce("punctuation",","),Ce("identifier")),when:vu,rewrite:{types:"type"}},{anchor:{type_name:"keyword",value:"implements"},when:vu,rewrite:{types:"type"}},{anchor:{type_name:"operator",value:"<"},before:Ce("identifier"),when:K0,rewrite:{types:"type"}},{anchor:{type_name:"operator",value:"<"},before:Cr(Ce("operator"),Ce("keyword"),Ce("punctuation",["(",",","[","{",":",";"])),when:ut(K0,Ce("operator",">"),Lr("(",")")),rewrite:{types:"type"}},{anchor:{type_name:"operator",value:"<"},before:Ce("tag_name"),when:kA,rewrite:{types:"type"}},{anchor:{type_name:"operator",value:"=",stmt_flags_all:["alias_head"],frame_kinds:lp,frame_direct:!0},before:Ce("identifier"),when:Oa,rewrite:{types:"type"}},{anchor:{type_name:"operator",value:"=",stmt_flags_all:["alias_head"],frame_kinds:lp,frame_direct:!0},before:Ce("operator",">"),when:Oa,rewrite:{types:"type"}}],{trivia:["comment"]}),wA=Mn("property"),oc=58,xA=44,cp=46,ek=63,_p=91,$A=93;function EA(e,t,r,n){let{input:s,tokens:i}=e,o=e.next_non_trivia(t+1);if(o<0)return!1;let a=i[o*3+1],l=i[o*3+2]-a,_=s.charCodeAt(a);if(i[o*3]===r)return l===1&&_===oc;if(i[o*3]!==n||_!==ek)return!1;if(l===2)return s.charCodeAt(a+1)===oc;if(l!==1)return!1;let c=e.next_non_trivia(o+1);return c>=0&&i[c*3]===r&&s.charCodeAt(i[c*3+1])===oc}function Z0(e,t,r){return r-t>=3&&e.charCodeAt(r-1)===cp&&e.charCodeAt(r-2)===cp&&e.charCodeAt(r-3)===cp}function AA(e,t,r,n,s,i){let{input:o,tokens:a}=e,l=t.frames[r];if(l.parent<0||t.frames[l.parent].bracket!==Sf)return!1;let _=l.enter_idx;if(o.charCodeAt(a[_*3+1])===_p){let h=e.prev_non_trivia(_-1);if(h>=0&&a[h*3]===i&&a[h*3+2]-a[h*3+1]===1&&o.charCodeAt(a[h*3+1])===ek)return!1}let c=1;for(let h=n+1;h<e.count;h++){if(a[h*3]!==s)continue;let d=a[h*3+2];for(let f=a[h*3+1];f<d;f++){let p=o.charCodeAt(f);if(p===_p)c++;else if(p===$A&&--c===0){if(f+1<d)return o.charCodeAt(f+1)===oc;let m=e.next_non_trivia(h+1);return m>=0&&a[m*3]===s&&o.charCodeAt(a[m*3+1])===oc}}}return!1}var TA=(e,t,r,n,s)=>{if(s===void 0)return;let i=r.indexOf("identifier"),o=r.indexOf("punctuation"),a=r.indexOf("operator");if(i<0||o<0||a<0)return;let l=Fr(e,t,r),_=l.count,c=s.active_frame;if(c.length<_)return;let h=-1;for(let d=0;d<_;d++){if(t[d*3]!==i)continue;let f=c[d];if(s.frames[f].bracket!==Of||!EA(l,d,o,a))continue;let p=l.prev_non_trivia(d-1);if(p<0)continue;let m=t[p*3+1],g=t[p*3+2];if(t[p*3]===o){let b=e.charCodeAt(g-1);if(b===_p){if(AA(l,s,f,d,o,a))continue}else if(b!==xA&&!Z0(e,m,g))continue}else if(t[p*3]!==a||g-m!==3||!Z0(e,m,g))continue;h<0&&(h=r.indexOf("property"),h<0&&(h=r.length,r.push("property"))),n.emit(d,h,wA)}},CA=ii((e,t,r,n,s)=>{Rd.__claim(e,t,r,n,s),TA(e,t,r,n,s)});function J0(e,t,r,n,s,i,o){let a=e.count,l=1,_=0;for(let c=n+1;c<a;c++){if(e.is_trivia(c))continue;let h=r[c*3],d=r[c*3+1],f=r[c*3+2];if(h===s){let p=f-d,m=t.charCodeAt(d);if(p===1&&m===60)l++,o!==null&&o.push(c);else if(_===0&&m===62&&p>=1&&p<=3&&SA(t,d,f)){if(l-=p,o!==null&&o.push(c),l<=0)return c}else if(Zf(t,d,f))return-1}else if(h===i)for(let p=d;p<f;p++){let m=t.charCodeAt(p);if(m===123)_++;else if(m===125){if(_===0)return-1;_--}else if(m===59&&_===0)return-1}}return-1}function SA(e,t,r){for(let n=t+1;n<r;n++)if(e.charCodeAt(n)!==62)return!1;return!0}function OA(e,t,r,n){let s=t,i=r;for(;s<i;){let o=s+i>>>1;e[o*3+2]>n?i=o:s=o+1}return s}function ho(e,t,r,n,s){let i=e.count;if(n>=i)return-1;let o=t.indexOf("<",r[n*3+1]),a=n;for(;o>=0;){if(a=OA(r,a,i,o),a>=i)return-1;if(r[a*3+1]===o&&r[a*3]===s&&r[a*3+2]-o===1&&!e.is_trivia(a))return a;let l=r[a*3+1];o=t.indexOf("<",l>o?l:r[a*3+2])}return-1}var NA=[Ht(pA,"type_claim"),Ht(Nd,"shape"),ze(Dd,["constant"]),ze(Ld,["namespace"]),ze(an(Od,{trivia:["comment"]}),["function"]),ze(Pd,["constant"]),ze(CA,["property"]),ze(yA,["type"]),ze(mA,["type"]),ze((e,t)=>{let{tokens:r,token_types:n}=t,s=n.indexOf("identifier"),i=n.indexOf("operator"),o=n.indexOf("punctuation");if(s<0||i<0||o<0)return t;let a=n.indexOf("function");a<0&&(a=n.length,n.push("function"));let l=Fr(e,r,n);for(let _=ho(l,e,r,0,i);_>=0;_=ho(l,e,r,_+1,i)){let c=l.prev_non_trivia(_-1);if(c<0||l.kind_of(c)!==s)continue;let h=J0(l,e,r,_,i,o,null);if(h<0)continue;let d=l.next_non_trivia(h+1);d<0||l.kind_of(d)!==o||r[d*3+2]===r[d*3+1]||e.charCodeAt(r[d*3+1])!==40||(r[c*3]=a)}return t},["function"]),ze(Id,["class_name"]),ze(qd,["parameter"]),Ht((e,t)=>{let{tokens:r,token_types:n}=t,s=n.indexOf("operator"),i=n.indexOf("punctuation");if(s<0||i<0)return t;let o=n.indexOf("identifier"),a=n.indexOf("type"),l=n.indexOf("class_name"),_=n.indexOf("function"),c=n.indexOf("keyword"),h=n.indexOf("tag_name"),d=Fr(e,r,n),f=(g)=>g===o||g===a||g===l||g===_||g===h,p=(g)=>{if(g<0)return!0;let b=d.kind_of(g),k=d.text_of(g);if(b===i){let x=k.length>0?k[0]:"";return x==="("||x===")"||x==="{"||x==="}"||x==="["||x==="]"||x===","||x===";"||x==="."||x===":"}return b===s?k==="="||k==="=>"||k==="?:"||k==="|"||k==="&"||k===">"||k===">>"||k===">>>"||k==="?"||k==="!":b===c?k==="extends"||k==="implements":!1},m=ho(d,e,r,0,s);for(;m>=0;){let g=d.prev_non_trivia(m-1);if(g<0||!f(d.kind_of(g))){m=ho(d,e,r,m+1,s);continue}let b=[m],k=J0(d,e,r,m,s,i,b);if(k<0){m=ho(d,e,r,m+1,s);continue}let x=d.next_non_trivia(k+1);if(d.kind_of(g)!==h&&!p(x)){m=ho(d,e,r,m+1,s);continue}for(let w of b)r[w*3]=i;m=ho(d,e,r,k+1,s)}return t},"shape"),Ht(Y_({scan:Fd,trigger_types:jd,may_match:zd}),"embed")],RA=yt(dA),tk=Ct(RA,NA);var ai=[" ","\t"],Ra=[`
223
+ `,"\r"],up=[...ai,...Ra],rk=[Ue,xe,"_","-",".","/",":","@","$","#","!","%","?","+","=","~","'","(",")"],MA=[Ue,xe,"_","-",".","/",":","@","$","#","+","=","~","'","(",")","?","&",";","*","%","!"],sk={...ct("#",`
224
+ `,Be,{multiline:!1}),seal:!0},IA=u('"',q,A("double_string_body")),DA=ct("'","'",q),pp=L(ai),PA=L(Ra),hp=u(["@","`"],I),fp=[pp,PA,sk,IA,DA,u(["---","..."],I),u("&",Wr,A("anchor_body")),u("*",Wr,A("alias_body")),u(["!!","!"],ce,A("tag_body")),u("[",I,A("flow_seq")),u("{",I,A("flow_map"))],dp=32;function qA(){let e={block_exit:{rules:[u(`
225
+ `,q,E())]}};for(let t=0;t<=dp;t++)e[`block_indent_${t}`]={rules:[u(" ",q,T(`block_indent_${Math.min(t+1,dp)}`)),u("\r",q),u(`
226
+ `,q,T("block_indent_0")),C(t===0?E():T(`block_body_${t}`))]};for(let t=1;t<=dp;t++)e[`block_body_${t}`]={rules:[L(`
227
+ `,A(`block_nl_${t}`)),C({token:q})]},e[`block_nl_${t}`]={mode:"probe",fallback:`block_stay_${t}`,rules:[L(" ".repeat(t),T(`block_stay_${t}`)),L(Ra,T(`block_stay_${t}`)),L(ai,A(`block_ws_${t}`)),C(T("block_exit"))]},e[`block_ws_${t}`]={mode:"probe",fallback:`block_stay_${t}`,rules:[L(ai),L(Ra,T(`block_stay_${t}`)),C(T("block_exit"))]},e[`block_stay_${t}`]={rules:[u(`
228
+ `,q,T(`block_body_${t}`))]};return e}var LA=Tt({name:"yaml",states:{main:{rules:[...fp,u(["|",">"],ce,A("block_header")),u("%",ce,A("directive_name")),u([":",","],I),L("-",A("dash_probe")),L("?",A("question_probe")),hp,C({token:me,state:"plain_scalar"})]},flow_seq:{rules:[...fp,u("]",I,E()),u("}",I,E()),u([":",","],I),L("-",A("dash_probe_flow")),L("?",A("question_probe_flow")),hp,C({token:me,state:"plain_scalar_flow"})]},flow_map:{rules:[...fp,u("}",I,E()),u("]",I,E()),u([":",","],I),L("-",A("dash_probe_flow")),L("?",A("question_probe_flow")),hp,C({token:me,state:"plain_scalar_flow"})]},plain_scalar:{rules:[L(up,E()),L(":",A("colon_probe")),C({token:me})]},plain_scalar_flow:{rules:[L(up,E()),L(":",A("colon_probe")),L([",","[","]","{","}"],E()),C({token:me})]},colon_probe:{mode:"probe",fallback:"colon_sep",rules:[L(up,T("colon_sep")),C(T("colon_scalar"))]},colon_sep:{rules:[u(":",I,E())]},colon_scalar:{rules:[u(":",me,T("plain_scalar"))]},dash_probe:{mode:"probe",fallback:"dash_as_punct",rules:[L([...ai,`
229
+ `,"\r"],A("dash_as_punct")),C(A("dash_as_scalar"))]},dash_as_punct:{rules:[u("-",I,E())]},dash_as_scalar:{rules:[u("-",me,T("plain_scalar"))]},question_probe:{mode:"probe",fallback:"question_as_punct",rules:[L([...ai,`
230
+ `,"\r"],A("question_as_punct")),C(A("question_as_scalar"))]},question_as_punct:{rules:[u("?",I,E())]},question_as_scalar:{rules:[u("?",me,T("plain_scalar"))]},dash_probe_flow:{mode:"probe",fallback:"dash_as_punct",rules:[L([...ai,`
231
+ `,"\r"],A("dash_as_punct")),C(A("dash_as_scalar_flow"))]},dash_as_scalar_flow:{rules:[u("-",me,T("plain_scalar_flow"))]},question_probe_flow:{mode:"probe",fallback:"question_as_punct",rules:[L([...ai,`
232
+ `,"\r"],A("question_as_punct")),C(A("question_as_scalar_flow"))]},question_as_scalar_flow:{rules:[u("?",me,T("plain_scalar_flow"))]},anchor_body:{rules:[u(rk,Wr),C(E())]},alias_body:{rules:[u(rk,Wr),C(E())]},tag_body:{rules:[u("<",ce,T("tag_verbatim")),u(MA,Nt),C(E())]},tag_verbatim:{rules:[u(">",ce,E()),C({token:Nt})]},directive_name:{rules:[L(ai,T("directive_body")),L(Ra,E()),u([Ue,xe,"_"],Nt),C(T("directive_body"))]},directive_body:{rules:[pp,L(Ra,E()),C({token:me})]},block_header:{rules:[u(["-","+"],ce),u(xe,J),pp,sk,L(`
233
+ `,T("block_indent_0")),C({token:q})]},...qA(),double_string_body:{rules:[u("\\x",B,A("esc_hex_d1")),u("\\u",B,A("esc_u4_d1")),u("\\U",B,A("esc_u8_d1")),u("\\",B,A("esc_simple")),u('"',q,E()),C({token:q})]},esc_simple:{rules:[C({token:B,exit:!0})]},esc_hex_d1:{rules:[u(he,B,T("esc_hex_d2")),C(E())]},esc_hex_d2:{rules:[u(he,B,E()),C(E())]},esc_u4_d1:{rules:[u(he,B,T("esc_u4_d2")),C(E())]},esc_u4_d2:{rules:[u(he,B,T("esc_u4_d3")),C(E())]},esc_u4_d3:{rules:[u(he,B,T("esc_u4_d4")),C(E())]},esc_u4_d4:{rules:[u(he,B,E()),C(E())]},esc_u8_d1:{rules:[u(he,B,T("esc_u8_d2")),C(E())]},esc_u8_d2:{rules:[u(he,B,T("esc_u8_d3")),C(E())]},esc_u8_d3:{rules:[u(he,B,T("esc_u8_d4")),C(E())]},esc_u8_d4:{rules:[u(he,B,T("esc_u8_d5")),C(E())]},esc_u8_d5:{rules:[u(he,B,T("esc_u8_d6")),C(E())]},esc_u8_d6:{rules:[u(he,B,T("esc_u8_d7")),C(E())]},esc_u8_d7:{rules:[u(he,B,T("esc_u8_d8")),C(E())]},esc_u8_d8:{rules:[u(he,B,E()),C(E())]}}}),FA=new Set(["true","True","TRUE","false","False","FALSE","yes","Yes","YES","no","No","NO","on","On","ON","off","Off","OFF","y","Y","n","N"]),jA=new Set(["null","Null","NULL","~"]),zA=new Set([".inf",".Inf",".INF"]),UA=new Set([".nan",".NaN",".NAN"]),fo=(e)=>e>="0"&&e<="9",BA=(e)=>e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F",HA=(e)=>e>="0"&&e<="7";function VA(e){let t=e.length;if(t===0)return!1;let r=0,n=e[0],s=n==="+"||n==="-";if(s&&(r=1),r===t)return!1;if(e[r]==="."){let i=e.slice(r);return zA.has(i)||!s&&UA.has(i)?!0:nk(e,r)}if(!s&&e[r]==="0"&&r+1<t){let i=e[r+1];if(i==="x"){if(r+2===t)return!1;for(let o=r+2;o<t;o++)if(!BA(e[o]))return!1;return!0}if(i==="o"){if(r+2===t)return!1;for(let o=r+2;o<t;o++)if(!HA(e[o]))return!1;return!0}}return nk(e,r)}function nk(e,t){let r=e.length,n=t;if(n===r)return!1;let s=!1;if(e[n]==="."){if(n++,n===r||!fo(e[n]))return!1;for(;n<r&&fo(e[n]);)s=!0,n++}else if(fo(e[n])){for(;n<r&&fo(e[n]);)s=!0,n++;if(n<r&&e[n]===".")for(n++;n<r&&fo(e[n]);)n++}else return!1;if(!s)return!1;if(n<r&&(e[n]==="e"||e[n]==="E")){if(n++,n<r&&(e[n]==="+"||e[n]==="-")&&n++,n===r||!fo(e[n]))return!1;for(;n<r&&fo(e[n]);)n++}return n===r}var YA=ha([FA,jA]);function GA(e){return e===43||e===45||e===46||e>=48&&e<=57}var WA=[ze((e,t)=>{let r=new Uint32Array(t.tokens),n=t.token_types.slice(),s=r.length/3;if(s===0)return{tokens:r,token_types:n};let i=n.indexOf("identifier");if(i<0)return{tokens:r,token_types:n};let o=(c)=>{let h=n.indexOf(c);return h<0&&(h=n.length,n.push(c)),h},a=o("boolean"),l=o("null"),_=o("number");for(let c=0;c<s;c++){if(r[c*3]!==i)continue;let h=r[c*3+1],d=r[c*3+2],f=fa(YA,e,h,d);f===1?r[c*3]=a:f===2?r[c*3]=l:GA(e.charCodeAt(h))&&VA(e.slice(h,d))&&(r[c*3]=_)}return{tokens:r,token_types:n}},["boolean","null","number"]),ze((e,t)=>{let r=new Uint32Array(t.tokens),n=t.token_types.slice(),s=r.length/3;if(s===0)return{tokens:r,token_types:n};let i=n.indexOf("identifier"),o=n.indexOf("punctuation"),a=n.indexOf("comment");if(i<0||o<0)return{tokens:r,token_types:n};let l=n.indexOf("property");l<0&&(l=n.length,n.push("property"));for(let _=0;_<s;_++){if(r[_*3]!==i)continue;let c=_+1;for(;c<s&&r[c*3]===a;)c++;if(c>=s||r[c*3]!==o)continue;let h=r[c*3+1];r[c*3+2]-h===1&&e[h]===":"&&(r[_*3]=l)}return{tokens:r,token_types:n}},["property"])],XA=yt(LA),ik=Ct(XA,WA);var ak={typescript:tk,javascript:Aa,svelte:W0,json:S0,bash:r0,css:Si,html:fu,markdown:I0,python:B0,rust:H0,sql:V0,yaml:ik,diff:o0},KA={ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",jsonc:"json",json5:"json",sh:"bash",shell:"bash",zsh:"bash",console:"bash",htm:"html",md:"markdown",py:"python",rs:"rust",yml:"yaml",patch:"diff"},ok=new Map;function mp(e){if(typeof e!=="string")return;let t=e.trim().split(/[\s{]/)[0].toLowerCase(),r=KA[t]??t;return Object.hasOwn(ak,r)?r:void 0}var ZA={keyword:["keyword","builtin","decorator","boolean","null","attr_sigil","doctype","svelte_block","svelte_directive","tag_name","selector","bit","inserted_marker","deleted_marker","changed_marker","heading_marker","list_marker"],string:["string","template","string_escape","regex","url","url_link","attribute","raw_code_block","code"],number:["number","unit","constant","lifetime"],comment:["comment"],function:["function","heading","selector_id","selector_class"],type:["type","class_name","namespace","variant","selector_pseudo","label"],punctuation:["punctuation","hr","blockquote_marker"],operator:["operator"],variable:["variable","css_variable","property","parameter","attr_name","expression"]},JA={inserted:"success",deleted:"danger",changed:"warning"},QA=new Set(Object.keys(JA));var lk=new Map;for(let[e,t]of Object.entries(ZA))for(let r of t)lk.set(r,e);function gp(e,t,r=!1){if(!t||!e)return[{text:e}];let n=ok.get(t);if(!n)n=ak[t](),ok.set(t,n);let s;try{s=n(e,{open:r})}catch{return[{text:e}]}let i=r?s.stable_end??0:e.length,o=s.token_types.map((h)=>QA.has(h)?h:lk.get(h)),a=[],l=(h,d)=>{if(!h)return;let f=a[a.length-1];if(f&&f.token===d)f.text+=h;else a.push({text:h,token:d})},{tokens:_}=s,c=0;for(let h=0;h+2<_.length;h+=3){let d=_[h+1],f=_[h+2];if(d>=i)break;l(e.slice(c,d));let p=Math.min(f,i);l(e.slice(d,p),o[_[h]]),c=p}return l(e.slice(c)),a}var Mi={surface:"var(--surface)",text:"var(--text)",muted:"var(--muted)",accent:"var(--accent)",border:"var(--border)",success:"var(--success)",warning:"var(--warning)",danger:"var(--danger)"};function ck(e){return{heading:e.accent,link:e.markup?.link??e.accent,list:e.markup?.list??e.accent,quote:e.markup?.quote??e.muted,code:e.markup?.code??e.warning,rule:e.border}}function ac(e){let t=ck(e),r={"--bg":e.background,"--surface":e.surface,"--text":e.text,"--muted":e.muted,"--accent":e.accent,"--border":e.border,"--success":e.success,"--warning":e.warning,"--danger":e.danger,"--user":e.user,"--heading":t.heading,"--link":t.link,"--list":t.list,"--quote":t.quote,"--code":t.code};for(let[n,s]of Object.entries(e.syntax))r[`--syntax-${n}`]=s;return r}function vp(e){let t=parseInt(e.slice(1),16);if(!Number.isFinite(t))return!1;let r=t>>16&255,n=t>>8&255,s=t&255;return 0.2126*r+0.7152*n+0.0722*s>140}function bp(e,t){return!e?"muted":t==="ok"?"success":t==="running"?"warning":"danger"}function kp(e){return Object.entries(e).map(([t,r])=>/^[\w./:@-]+$/.test(r)&&t==="path"?r:/^[\w./:@-]+$/.test(r)?`${t}=${r}`:`${t}=${JSON.stringify(r)}`).join(" ")}function yp(e){return e.includes("?")||e.includes("A")?"success":e.includes("D")||e.includes("U")?"danger":"warning"}var e4=te('<p class="danger"> </p>'),t4=te('<span class="muted"> </span> ',1),bu=te('<p class="muted"> </p>'),r4=te('<p class="muted"> </p> <pre class="file"></pre> <!>',1),n4=te("<li><code> </code> </li>"),s4=te('<p><span class="muted">branch</span> </p> <ul class="plain"></ul> <!>',1),_k=te('<pre class="output"> </pre>'),i4=te('<p><strong> </strong> <span class="muted"> </span></p> <!>',1),o4=te('<p class="warning"> </p>'),a4=te('<p class="usage"><span class="muted"> </span> </p>'),l4=te('<section><header class="muted"><span class="dot">●</span> <strong class="text"> </strong> </header> <!></section>');function lc(e,t){Oe(t,!0);let r=Vo(),n=ne(()=>t.widget.live!==!1),s=ne(()=>bp(y(n),t.widget.value.status)),i=ne(()=>kp(t.widget.args)),o=ne(()=>y(n)?Ef(t.widget.updated_at,r.now()):""),a=40,l=20,_=ne(()=>t.widget.value.data),c=ne(()=>y(_)),h=ne(()=>(y(c)?.text??"").split(`
234
+ `)),d=ne(()=>y(_)),f=ne(()=>y(_)),p=ne(()=>y(_)?.totals);var m=l4(),g=ke(m),b=se(ke(g)),k=se(b),x=Te(k,!0),w=se(k);ue(g);var O=se(g,2);{var N=(R)=>{var W=e4(),j=Te(W,!0);le(()=>ae(j,t.widget.value.text)),z(R,W)},S=(R)=>{var W=Ve(),j=$e(W);{var P=(F)=>{var Z=r4(),re=$e(Z),ie=Te(re),we=se(re,2);At(we,21,()=>y(h).slice(0,a),_r,(Y,Ee,ve)=>{var fe=t4(),ye=$e(fe),Ie=Te(ye,!0),Se=se(ye,1,!0);le((Ke,rt)=>{ae(Ie,Ke),ae(Se,rt)},[()=>String(ve+1).padStart(3)+" │ ",()=>y(Ee).replaceAll("\t"," ")+`
235
+ `]),z(Y,fe)}),ue(we);var _e=se(we,2);{var oe=(Y)=>{var Ee=bu(),ve=Te(Ee);le(()=>ae(ve,`… ${(y(c).lines??0)-a} more lines`)),z(Y,Ee)};ge(_e,(Y)=>{if((y(c).lines??0)>a)Y(oe)})}le(()=>ae(ie,`${y(c).path??""} · ${y(c).lines??""}
236
+ ${y(c).lines===1?"line":"lines"}`)),z(F,Z)},M=(F)=>{var Z=bu(),re=Te(Z,!0);le(()=>ae(re,t.widget.value.text||"Reading…")),z(F,Z)};ge(j,(F)=>{if(y(c)?.text!==void 0||y(c)?.path)F(P);else F(M,-1)})}z(R,W)},D=(R)=>{var W=Ve(),j=$e(W);{var P=(F)=>{var Z=s4(),re=$e(Z),ie=se(ke(re));ue(re);var we=se(re,2);At(we,21,()=>(y(d).entries??[]).slice(0,l),_r,(Y,Ee)=>{var ve=n4(),fe=ke(ve),ye=Te(fe,!0),Ie=se(fe);ue(ve),le((Se)=>{sr(fe,1,Se),ae(ye,y(Ee).status),ae(Ie,` ${y(Ee).path??""}`)},[()=>Bo(yp(y(Ee).status))]),z(Y,ve)}),ue(we);var _e=se(we,2);{var oe=(Y)=>{var Ee=bu(),ve=Te(Ee);le(()=>ae(ve,`… ${(y(d).entries?.length??0)-l} more`)),z(Y,Ee)};ge(_e,(Y)=>{if((y(d).entries?.length??0)>l)Y(oe)})}le(()=>ae(ie,` ${y(d).branch??""}${y(d).entries?.length?"":" · clean"}`)),z(F,Z)},M=(F)=>{var Z=bu(),re=Te(Z,!0);le(()=>ae(re,t.widget.value.text||"Reading…")),z(F,Z)};ge(j,(F)=>{if(y(d))F(P);else F(M,-1)})}z(R,W)},X=(R)=>{var W=Ve(),j=$e(W);{var P=(F)=>{var Z=i4(),re=$e(Z),ie=ke(re),we=Te(ie,!0),_e=se(ie,2),oe=Te(_e);ue(re);var Y=se(re,2);{var Ee=(ve)=>{var fe=_k(),ye=Te(fe,!0);le(()=>ae(ye,y(f).output)),z(ve,fe)};ge(Y,(ve)=>{if(y(f).output)ve(Ee)})}le(()=>{sr(re,1,Bo(y(f).exit_code===0?"success":"danger")),ae(we,y(f).exit_code===0?"Check passed":"Check failed"),ae(oe,`${y(f).command??""} · exit ${y(f).exit_code??"none"??""}`)}),z(F,Z)},M=(F)=>{var Z=o4(),re=Te(Z,!0);le(()=>ae(re,t.widget.value.text)),z(F,Z)};ge(j,(F)=>{if(y(f))F(P);else F(M,-1)})}z(R,W)},G=(R)=>{var W=a4(),j=ke(W),P=Te(j),M=se(j);ue(W),le((F,Z,re,ie)=>{ae(P,`${t.widget.args.scope==="workspace"?"This workspace":"This session"} ·`),ae(M,` ${y(p).turns??""}
237
+ ${y(p).turns===1?"turn":"turns"} · ${y(p).requests??""}
238
+ ${y(p).requests===1?"request":"requests"} · ${y(p).tools??""}
239
+ tool calls · ${F??""} in / ${Z??""} out${re??""} · ${ie??""}`)},[()=>$s(y(p).input_tokens),()=>$s(y(p).output_tokens),()=>y(p).cost_usd?" · "+ta(y(p).cost_usd):"",()=>ra(y(p).duration_ms)]),z(R,W)},H=(R)=>{var W=_k(),j=Te(W,!0);le((P)=>ae(j,P),[()=>t.widget.value.text.split(`
240
+ `).slice(0,12).join(`
241
+ `)]),z(R,W)};ge(O,(R)=>{if(t.widget.value.status==="error")R(N);else if(t.widget.source==="file")R(S,1);else if(t.widget.source==="git_status")R(D,2);else if(t.widget.source==="check")R(X,3);else if(t.widget.source==="usage"&&y(p))R(G,4);else R(H,-1)})}ue(m),le(()=>{sr(m,1,`card widget tone-${y(s)??""}`),ae(b,` ${y(n)?"live":"ended"} · `),ae(x,t.widget.source),ae(w,`${y(i)?" "+y(i):""}
242
+ · ${y(n)?"updated "+y(o):"last value"}`)}),z(e,m),Ne()}var c4=te("<span> </span>"),_4=te('<details class="diff-more"><summary> </summary> <pre class="diff"><!></pre></details>'),u4=te('<pre class="diff"><!></pre> <!>',1);function cc(e,t){Oe(t,!0);let r=(d,f=Rt)=>{var p=Ve(),m=$e(p);At(m,17,f,_r,(g,b)=>{var k=c4(),x=Te(k,!0);le((w)=>{sr(k,1,`diff-${w??""}`),ae(x,y(b)+`
243
+ `)},[()=>o(y(b))]),z(g,k)}),z(d,p)},n=on(t,"max_lines",3,40),s=ne(()=>t.lines.slice(0,n())),i=ne(()=>t.lines.slice(n())),o=(d)=>d.startsWith("+ ")?"add":d.startsWith("- ")?"del":d.startsWith("@@")?"hunk":d.startsWith("\\")?"note":"ctx";var a=u4(),l=$e(a),_=ke(l);r(_,()=>y(s)),ue(l);var c=se(l,2);{var h=(d)=>{var f=_4(),p=ke(f),m=Te(p),g=se(p,2),b=ke(g);r(b,()=>y(i)),ue(g),ue(f),le(()=>ae(m,`… ${y(i).length??""} more lines`)),z(d,f)};ge(c,(d)=>{if(y(i).length)d(h)})}z(e,a),Ne()}var h4=te('<textarea class="edit" rows="12" spellcheck="false"></textarea>'),f4=te('<button type="button">Cancel edit</button>'),d4=te('<button type="button">Edit</button>'),p4=te('<section class="card review tone-warning" aria-label="Review change"><header><strong>Review</strong> <span> </span> <span class="muted"> </span></header> <!> <footer><button type="button" class="primary"> </button> <button type="button">Apply all</button> <!> <button type="button" class="danger-button">Decline</button></footer></section>');function wp(e,t){Oe(t,!0);let r=Le(!1),n=Le(""),s="";Ir(()=>{if(t.pending.path!==s)s=t.pending.path,Me(r,!1)});let i=ne(()=>y(r)&&y(n)!==t.pending.after),o=()=>y(i)?y(n):void 0;var a=p4(),l=ke(a),_=se(ke(l),2),c=Te(_,!0),h=se(_,2),d=Te(h,!0);ue(l);var f=se(l,2);{var p=(D)=>{var X=h4();cl(X),le(()=>St(X,"aria-label",`Edit the new contents of ${t.pending.path??""}`)),pl(X,()=>y(n),(G)=>Me(n,G)),z(D,X)},m=(D)=>{cc(D,{get lines(){return t.pending.diff},max_lines:60})};ge(f,(D)=>{if(y(r))D(p);else D(m,-1)})}var g=se(f,2),b=ke(g),k=Te(b),x=se(b,2),w=se(x,2);{var O=(D)=>{var X=f4();$r("click",X,()=>Me(r,!1)),z(D,X)},N=(D)=>{var X=d4();$r("click",X,()=>{Me(n,t.pending.after,!0),Me(r,!0)}),z(D,X)};ge(w,(D)=>{if(y(r))D(O);else D(N,-1)})}var S=se(w,2);ue(g),ue(a),le(()=>{ae(c,t.pending.path),ae(d,t.pending.created?"new file":"edit"),ae(k,`Apply${y(i)?" edited":""}`)}),$r("click",b,()=>t.onapprove(o())),$r("click",x,()=>t.onapprove_all(o())),$r("click",S,function(...D){t.ondecline?.apply(this,D)}),z(e,a),Ne()}ss(["click"]);var m4=te('<button type="button" class="stop">Stop</button>'),g4=te('<button type="button">Undo</button>'),v4=te('<span class="warning" role="status"> </span>'),b4=te('<span class="danger" role="alert"> </span>'),k4=te('<a href="#/">Chat</a>'),y4=te('<a href="#/usage">Usage</a>'),w4=te('<header class="status"><strong class="brand">svarness</strong> <button type="button" class="mode" title="Toggle auto-apply / ask before each edit"> </button> <span> </span> <!> <span class="spacer"></span> <!> <!> <!></header>');function xp(e,t){Oe(t,!0);let r=ne(()=>t.phase!=="idle"),n=ne(()=>({idle:"Ready",replying:t.activity?`Working · ${t.activity}`:"Replying…",checking:"Running check…",reverting:"Undoing…"})[t.phase]);var s=w4(),i=se(ke(s),2),o=Te(i),a=se(i,2);let l;var _=Te(a,!0),c=se(a,2);{var h=(w)=>{var O=m4();$r("click",O,function(...N){t.onstop?.apply(this,N)}),z(w,O)},d=(w)=>{var O=g4();$r("click",O,function(...N){t.onundo?.apply(this,N)}),z(w,O)};ge(c,(w)=>{if(y(r))w(h);else w(d,-1)})}var f=se(c,4);{var p=(w)=>{var O=v4(),N=Te(O,!0);le(()=>ae(N,t.notice)),z(w,O)};ge(f,(w)=>{if(t.notice)w(p)})}var m=se(f,2);{var g=(w)=>{var O=b4(),N=Te(O,!0);le(()=>ae(N,t.error)),z(w,O)};ge(m,(w)=>{if(t.error)w(g)})}var b=se(m,2);{var k=(w)=>{var O=k4();z(w,O)},x=(w)=>{var O=y4();z(w,O)};ge(b,(w)=>{if(t.route==="usage")w(k);else w(x,-1)})}ue(s),le(()=>{ae(o,`Mode: ${t.mode==="auto"?"auto-apply":"ask first"}`),l=sr(a,1,"phase",null,l,{busy:y(r)}),ae(_,t.connected?y(n):"Disconnected")}),$r("click",i,function(...w){t.ontoggle?.apply(this,w)}),z(e,s),Ne()}ss(["click"]);var x4={name:"",background:"#101724",surface:"#1b2638",text:"#eef3fa",muted:"#adbad0",accent:"#96c6ff",border:"#74859e",success:"#89dec1",warning:"#f4c979",danger:"#ffacac",user:"#d4b7ff",syntax:{}};class $p{#r=Le([]);get messages(){return y(this.#r)}set messages(e){Me(this.#r,e)}#t=Le("idle");get phase(){return y(this.#t)}set phase(e){Me(this.#t,e,!0)}#e=Le(null);get activity(){return y(this.#e)}set activity(e){Me(this.#e,e,!0)}#o=Le(null);get error(){return y(this.#o)}set error(e){Me(this.#o,e,!0)}#n=Le("auto");get mode(){return y(this.#n)}set mode(e){Me(this.#n,e,!0)}#s=Le(null);get pending(){return y(this.#s)}set pending(e){Me(this.#s,e)}#a=Le([]);get widgets(){return y(this.#a)}set widgets(e){Me(this.#a,e)}#i=Le(x4);get theme(){return y(this.#i)}set theme(e){Me(this.#i,e)}#l=Le("");get check(){return y(this.#l)}set check(e){Me(this.#l,e,!0)}#u=Le(!1);get connected(){return y(this.#u)}set connected(e){Me(this.#u,e,!0)}#_=Le("");get notice(){return y(this.#_)}set notice(e){Me(this.#_,e,!0)}#d=Le(cr(Date.now()));get now(){return y(this.#d)}set now(e){Me(this.#d,e,!0)}#h=Le(0);get revision(){return y(this.#h)}set revision(e){Me(this.#h,e,!0)}#m;#c;#f;connect(){this.#c=setInterval(()=>this.now=Date.now(),1000);let e=this.#m=new EventSource("/events");e.onopen=()=>this.connected=!0,e.onerror=()=>{if(this.connected=!1,e.readyState===EventSource.CLOSED)this.flash("Session ended. Run /web again in the terminal.")},e.addEventListener("snapshot",(t)=>this.apply_snapshot(JSON.parse(t.data))),e.addEventListener("update",(t)=>this.apply_update(JSON.parse(t.data)))}close(){this.#m?.close(),clearInterval(this.#c),clearTimeout(this.#f)}#p(e){if(e.phase==="idle"&&this.phase!=="idle")this.revision++;this.phase=e.phase,this.activity=e.activity,this.error=e.error,this.mode=e.mode,this.pending=e.pending,this.widgets=e.widgets,this.theme=e.theme,this.check=e.check}apply_snapshot(e){let{messages:t,...r}=e;this.messages=t,this.#p(r)}apply_update(e){let t=this.messages.slice(0,e.count);for(let{index:r,message:n}of e.changes)t[r]=n;this.messages=t,this.#p(e.state)}flash(e){this.notice=e,clearTimeout(this.#f),this.#f=setTimeout(()=>this.notice="",5000)}async act(e){try{let t=await fetch("/action",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)});if(!t.ok)return this.flash((await t.text()).trim()||"Not accepted."),!1;return!0}catch{return this.flash("Could not reach the terminal."),!1}}async usage(e){let t=await fetch(`/api/usage?scope=${e}`);if(!t.ok)throw Error("usage unavailable");return t.json()}}function uk(e,t){for(let[r,n]of Object.entries(ac(e)))t.style.setProperty(r,n);t.style.colorScheme=vp(e.background)?"light":"dark"}var $4=te("<figcaption> </figcaption>"),E4=te("<span> </span>"),A4=te('<figure class="code"><!> <pre><code></code></pre></figure>');function Ep(e,t){Oe(t,!0);let r=on(t,"streaming",3,!1),n=ne(()=>mp(t.info)),s=ne(()=>typeof t.info==="string"?t.info.trim():""),i=ne(()=>t.code.replace(/\n$/,"")),o=ne(()=>gp(y(i),y(n),r()));var a=A4(),l=ke(a);{var _=(d)=>{var f=$4(),p=Te(f,!0);le(()=>ae(p,y(s))),z(d,f)};ge(l,(d)=>{if(y(s))d(_)})}var c=se(l,2),h=ke(c);At(h,21,()=>y(o),_r,(d,f)=>{var p=Ve(),m=$e(p);{var g=(k)=>{var x=E4(),w=Te(x,!0);le(()=>{sr(x,1,`tok-${y(f).token??""}`),ae(w,y(f).text)}),z(k,x)},b=(k)=>{var x=Bt();le(()=>ae(x,y(f).text)),z(k,x)};ge(m,(k)=>{if(y(f).token)k(g);else k(b,-1)})}z(d,p)}),ue(h),ue(c),ue(a),z(e,a),Ne()}var T4=te("<!> <!>",1);function Ap(e,t){Oe(t,!0);let r=on(t,"streaming",3,!1),{Box:n,Text:s,Markdown:i}=zn(),o=ne(()=>String(t.args.kind)),a=ne(()=>({info:t.theme.accent,tip:t.theme.success,warning:t.theme.warning,danger:t.theme.danger})[y(o)]??t.theme.accent),l=ne(()=>({info:"Info",tip:"Tip",warning:"Warning",danger:"Danger"})[y(o)]);n(e,{flexShrink:0,border:["left"],get borderColor(){return y(a)},paddingX:1,get backgroundColor(){return t.theme.surface},children:(_,c)=>{var h=T4(),d=$e(h);s(d,{get fg(){return y(a)},bold:!0,get content(){return y(l)}});var f=se(d,2);i(f,{get node(){return t.node},get theme(){return t.theme},get streaming(){return r()},gap:1}),z(_,h)},$$slots:{default:!0}}),Ne()}var C4=te(" <!>",1),S4=te("<!><!> ",1),O4=te("<!> <!> <!> <!>",1);function Tp(e,t){Oe(t,!0);let r=on(t,"streaming",3,!1),{Box:n,Text:s,Span:i,text_width:o}=zn(),a=ne(()=>Kh($f(t.node),r()&&!t.node.closed)),l=ne(()=>Math.max(0,...y(a).bars.map((d)=>o(d.label)))),_=ne(()=>Math.max(0,...y(a).bars.map((d)=>d.value))),c=ne(()=>t.args.title?String(t.args.title):""),h=ne(()=>y(a).bars.map((d)=>d.value));n(e,{flexShrink:0,children:(d,f)=>{var p=O4(),m=$e(p);{var g=(D)=>{s(D,{get fg(){return t.theme.text},bold:!0,get content(){return y(c)}})};ge(m,(D)=>{if(y(c))D(g)})}var b=se(m,2);{var k=(D)=>{s(D,{get fg(){return t.theme.accent},pre:!0,children:(X,G)=>{or();var H=C4(),R=$e(H,!0),W=se(R);i(W,{get fg(){return t.theme.muted},children:(j,P)=>{or();var M=Bt();le((F)=>ae(M,F),[()=>y(h).length?` ${Math.min(...y(h))}–${Math.max(...y(h))}`:""]),z(j,M)},$$slots:{default:!0}}),le((j)=>ae(R,j),[()=>Xh(y(h))]),z(X,H)},$$slots:{default:!0}})},x=(D)=>{s(D,{get fg(){return t.theme.text},pre:!0,children:(X,G)=>{var H=Ve(),R=$e(H);At(R,17,()=>y(a).bars,_r,(W,j,P)=>{var M=S4(),F=$e(M);i(F,{get fg(){return t.theme.muted},children:(ie,we)=>{or();var _e=Bt();le((oe)=>ae(_e,oe),[()=>y(j).label+" ".repeat(y(l)-o(y(j).label))+" "]),z(ie,_e)},$$slots:{default:!0}});var Z=se(F);i(Z,{get fg(){return t.theme.accent},children:(ie,we)=>{or();var _e=Bt();le((oe)=>ae(_e,oe),[()=>gl(y(_)>0?y(j).value/y(_):0,20)]),z(ie,_e)},$$slots:{default:!0}});var re=se(Z);le(()=>ae(re,`${" "+y(j).value}${P+1<y(a).bars.length?`
244
+ `:""}`)),z(W,M)}),z(X,H)},$$slots:{default:!0}})};ge(b,(D)=>{if(t.args.type==="sparkline")D(k);else D(x,-1)})}var w=se(b,2);{var O=(D)=>{s(D,{get fg(){return t.theme.muted},content:"No data yet"})};ge(w,(D)=>{if(!y(a).bars.length&&!y(a).skipped)D(O)})}var N=se(w,2);{var S=(D)=>{{let X=ne(()=>y(a).skipped),G=ne(()=>y(a).skipped===1?"row":"rows");s(D,{get fg(){return t.theme.muted},get content(){return`${y(X)??""} ${y(G)??""} skipped (not a number)`}})}};ge(N,(D)=>{if(y(a).skipped)D(S)})}z(d,p)},$$slots:{default:!0}}),Ne()}var N4=te(" <!>",1),R4=te("<!> <!>",1);function Cp(e,t){Oe(t,!0);let r=on(t,"streaming",3,!1),{Box:n,Text:s,Span:i,Markdown:o}=zn(),a=Le(!1),l=()=>Me(a,!y(a));n(e,{flexShrink:0,children:(_,c)=>{var h=R4(),d=$e(h);n(d,{flexShrink:0,onclick:l,children:(m,g)=>{s(m,{get fg(){return t.theme.accent},children:(b,k)=>{or();var x=N4(),w=$e(x),O=se(w);i(O,{get fg(){return t.theme.muted},children:(N,S)=>{or();var D=Bt();le(()=>ae(D,y(a)?" (click to collapse)":" (click to expand)")),z(N,D)},$$slots:{default:!0}}),le((N)=>ae(w,`${y(a)?"▾ ":"▸ "}${N??""}`),[()=>String(t.args.summary)]),z(b,x)},$$slots:{default:!0}})},$$slots:{default:!0}});var f=se(d,2);{var p=(m)=>{n(m,{flexShrink:0,border:["left"],get borderColor(){return t.theme.border},paddingLeft:1,children:(g,b)=>{o(g,{get node(){return t.node},get theme(){return t.theme},get streaming(){return r()}})},$$slots:{default:!0}})};ge(f,(m)=>{if(y(a))m(p)})}z(_,h)},$$slots:{default:!0}}),Ne()}var M4=te("<!><!> ",1);function Sp(e,t){Oe(t,!0);let{Text:r,Span:n}=zn(),s=ne(()=>Number(t.args.value)),i=ne(()=>Number(t.args.max)),o=ne(()=>y(i)>0?Math.min(1,Math.max(0,y(s)/y(i))):0),a=ne(()=>t.args.label?String(t.args.label):"");r(e,{get fg(){return t.theme.text},pre:!0,children:(l,_)=>{var c=M4(),h=$e(c);{var d=(m)=>{n(m,{get fg(){return t.theme.muted},children:(g,b)=>{or();var k=Bt();le(()=>ae(k,y(a)+" ")),z(g,k)},$$slots:{default:!0}})};ge(h,(m)=>{if(y(a))m(d)})}var f=se(h);{let m=ne(()=>y(o)>=1?t.theme.success:t.theme.accent);n(f,{get fg(){return y(m)},children:(g,b)=>{or();var k=Bt();le((x)=>ae(k,x),[()=>gl(y(o),20)]),z(g,k)},$$slots:{default:!0}})}var p=se(f,1,!0);le((m)=>ae(p,m),[()=>" "+Math.round(y(o)*100)+"%"]),z(l,c)},$$slots:{default:!0}}),Ne()}var I4=te("<!><!> ",1),D4=te("<!> <!> <!>",1);function Op(e,t){Oe(t,!0);let{Box:r,Text:n,Span:s}=zn(),i=ne(()=>o_(t.node.children.flatMap((a)=>typeof a!=="string"&&a.kind==="list"?O_(a):[]))),o=ne(()=>t.args.title?String(t.args.title):"");r(e,{flexShrink:0,children:(a,l)=>{var _=D4(),c=$e(_);{var h=(m)=>{n(m,{get fg(){return t.theme.text},bold:!0,get content(){return y(o)}})};ge(c,(m)=>{if(y(o))m(h)})}var d=se(c,2);n(d,{get fg(){return t.theme.text},pre:!0,children:(m,g)=>{var b=Ve(),k=$e(b);At(k,17,()=>y(i),_r,(x,w,O)=>{var N=I4(),S=$e(N);s(S,{get fg(){return t.theme.border},children:(R,W)=>{or();var j=Bt();le(()=>ae(j,y(w).prefix)),z(R,j)},$$slots:{default:!0}});var D=se(S);{var X=(R)=>{s(R,{get fg(){return t.theme.accent},bold:!0,children:(W,j)=>{or();var P=Bt();le(()=>ae(P,y(w).name)),z(W,P)},$$slots:{default:!0}})},G=(R)=>{var W=Bt();le(()=>ae(W,y(w).name)),z(R,W)};ge(D,(R)=>{if(y(w).folder)R(X);else R(G,-1)})}var H=se(D,1,!0);le(()=>ae(H,O+1<y(i).length?`
245
+ `:"")),z(x,N)}),z(m,b)},$$slots:{default:!0}});var f=se(d,2);{var p=(m)=>{n(m,{get fg(){return t.theme.muted},content:"Empty tree"})};ge(f,(m)=>{if(!y(i).length)m(p)})}z(a,_)},$$slots:{default:!0}}),Ne()}var P4=te("<!> ",1);function Np(e,t){Oe(t,!0);let{Text:r,Span:n}=zn(),s=pv(),i=ne(()=>t.args.scope==="workspace"?"workspace":"session"),o=(g)=>!!g&&typeof g.then==="function",a=ne(()=>{s.revision?.();try{return s.usage?.(y(i))}catch{return}}),l=Le(void 0),_=Le(!1);Ir(()=>{let g=y(a);if(!o(g))return;g.then((b)=>{Me(l,b,!0),Me(_,!1)},()=>Me(_,!0))});let c=ne(()=>o(y(a))?y(l):y(a)),h=ne(()=>o(y(a))?y(_)&&!y(l):!y(a));var d=Ve(),f=$e(d);{var p=(g)=>{r(g,{get fg(){return t.theme.text},children:(b,k)=>{var x=P4(),w=$e(x);n(w,{get fg(){return t.theme.muted},children:(N,S)=>{or();var D=Bt();le((X)=>ae(D,`${X??""} ·`),[()=>Tf(y(i))]),z(N,D)},$$slots:{default:!0}});var O=se(w);le((N)=>ae(O,` ${N??""}`),[()=>Cf(y(c).totals)]),z(b,x)},$$slots:{default:!0}})},m=(g)=>{{let b=ne(()=>y(h)?"Usage is not available.":"Loading usage…");r(g,{get fg(){return t.theme.muted},get content(){return y(b)}})}};ge(f,(g)=>{if(y(c))g(p);else g(m,-1)})}z(e,d),Ne()}var q4=te('<span class="added"> </span> <span class="removed"> </span>',1),L4=te('<p class="danger"> </p>'),F4=te('<p class="muted">diff not saved</p>'),j4=te("<section><header><strong> </strong> <span> </span> <!></header> <!> <!></section>");function Rp(e,t){Oe(t,!0);let r=ne(()=>t.change.diff.filter((w)=>w.startsWith("+ ")).length),n=ne(()=>t.change.diff.filter((w)=>w.startsWith("- ")).length),s=ne(()=>({pending:"Awaiting review",applying:"Writing",applied:t.change.created?"Created":"Edited",declined:"Declined",stale:"Changed on disk, not written",failed:"Failed",reverted:"Reverted"})[t.change.status]),i=ne(()=>t.change.status==="applied"?"success":t.change.status==="pending"||t.change.status==="applying"?"warning":t.change.status==="declined"||t.change.status==="reverted"?"muted":"danger");var o=j4(),a=ke(o),l=ke(a),_=Te(l,!0),c=se(l,2);let h;var d=Te(c,!0),f=se(c,2);{var p=(w)=>{var O=q4(),N=$e(O),S=Te(N),D=se(N,2),X=Te(D);le(()=>{ae(S,`+${y(r)??""}`),ae(X,`−${y(n)??""}`)}),z(w,O)};ge(f,(w)=>{if(!t.change.omitted&&t.change.status!=="reverted")w(p)})}ue(a);var m=se(a,2);{var g=(w)=>{var O=L4(),N=Te(O,!0);le(()=>ae(N,t.change.error)),z(w,O)};ge(m,(w)=>{if(t.change.error)w(g)})}var b=se(m,2);{var k=(w)=>{var O=F4();z(w,O)},x=(w)=>{cc(w,{get lines(){return t.change.diff}})};ge(b,(w)=>{if(t.change.omitted)w(k);else if(t.change.status!=="declined"&&t.change.status!=="reverted")w(x,1)})}ue(o),le(()=>{sr(o,1,`card change tone-${y(i)??""}`),ae(_,y(s)),h=sr(c,1,"",null,h,{struck:t.change.status==="reverted"}),ae(d,t.change.path)}),z(e,o),Ne()}function Mp(e,t){Oe(t,!0);let r=ki(),n=ne(()=>r?.owns(t.node.id)?r.changes()?.[Number(t.args.index)]:void 0);var s=Ve(),i=$e(s);{var o=(a)=>{Rp(a,{get change(){return y(n)}})};ge(i,(a)=>{if(y(n)&&y(n).status!=="pending")a(o)})}z(e,s),Ne()}var z4=te('<pre class="output"> </pre>'),U4=te('<section><header><strong> </strong> <span class="muted"> </span></header> <!></section>');function Ip(e,t){Oe(t,!0);let r=ki(),n=ne(()=>r?.owns(t.node.id)?r.check():void 0),s=ne(()=>y(n)?.exitCode===0);var i=Ve(),o=$e(i);{var a=(l)=>{var _=U4(),c=ke(_),h=ke(c),d=Te(h,!0),f=se(h,2),p=Te(f);ue(c);var m=se(c,2);{var g=(b)=>{var k=z4(),x=Te(k,!0);le(()=>ae(x,y(n).output||"(no output)")),z(b,k)};ge(m,(b)=>{if(!y(s))b(g)})}ue(_),le(()=>{sr(_,1,`card tone-${y(s)?"success":"danger"}`),ae(d,y(s)?"Check passed":"Check failed"),ae(p,`${y(n).command??""} · exit ${y(n).exitCode??"none"??""}`)}),z(l,_)};ge(o,(l)=>{if(y(n))l(a)})}z(e,i),Ne()}function B4(e){if(!e||typeof e!=="object"||Array.isArray(e))return;let t=e;if(t.type!=="size"||typeof t.height!=="number"||!Number.isFinite(t.height))return;return Math.min(4000,Math.max(0,Math.ceil(t.height)))}function hk(e,t){if(!t||e.source!==t)return;return B4(e.data)}var H4=te('<p class="muted warn"> </p>'),V4=te('<div class="view-frame"><div class="muted"> </div> <iframe sandbox="allow-scripts" referrerpolicy="no-referrer" loading="lazy"></iframe></div>');function Dp(e,t){Oe(t,!0);let r=ki(),n=Vo(),s=ne(()=>r?.owns(t.node.id)?r.view(Number(t.args.index)):void 0),i=ne(()=>y(s)&&/^[0-9a-f]{64}$/.test(y(s).hash)?y(s).hash:void 0),o=Le(void 0);Ir(()=>{let p=y(i);if(!p||y(s)?.error)return;let m=!0;return fetch(`/views/${p}.js`).then(async(g)=>{let b=g.ok?void 0:(await g.text()).trim().split(`
246
+ `)[0].slice(0,200)||`HTTP ${g.status}`;if(m)Me(o,{hash:p,error:b},!0)}).catch(()=>{if(m)Me(o,{hash:p,error:"not available"},!0)}),()=>{m=!1}});let a=ne(()=>!!y(i)&&y(o)?.hash===y(i)&&!y(o).error),l=Le(void 0),_=Le(0),c=Le(0);Ir(()=>{let p=_i(y(s)?.data),m=n.theme?.(),g=y(l)?.contentWindow;if(!y(_)||!g)return;g.postMessage({type:"render",data:p,theme_vars:m?ac(m):{}},"*")});var h=Ve();ys("message",Wi,(p)=>{let m=hk(p,y(l)?.contentWindow);if(m!==void 0)Me(c,m,!0)});var d=$e(h);{var f=(p)=>{var m=Ve(),g=$e(m);{var b=(x)=>{var w=H4(),O=Te(w);le(()=>ae(O,`⚠ view "${y(s).name??""}": ${y(s).error??y(o)?.error??"not available"??""}`)),z(x,w)},k=(x)=>{var w=V4(),O=ke(w),N=Te(O,!0),S=se(O,2);ml(S,(D)=>Me(l,D),()=>y(l)),ue(w),le(()=>{ae(N,y(s).name),St(S,"title",y(s).name),St(S,"src",`/views/${y(i)??""}.html`),Dr(S,`height:${y(c)??""}px`)}),ys("load",S,()=>el(_)),Eh(S),z(x,w)};ge(g,(x)=>{if(y(s).error||!y(i)||y(o)?.error)x(b);else if(y(a))x(k,1)})}z(p,m)};ge(d,(p)=>{if(y(s))p(f)})}z(e,h),Ne()}function Pp(e,t){Oe(t,!0);let r=ki(),n=ne(()=>r?.owns(t.node.id)?r.widget(Number(t.args.id)):void 0);var s=Ve(),i=$e(s);{var o=(a)=>{lc(a,{get widget(){return y(n)}})};ge(i,(a)=>{if(y(n))a(o)})}z(e,s),Ne()}var ku=(e)=>`${e}ch`,_c=(e)=>`${e}lh`,fk=(e,t)=>typeof e==="number"?t(e):e,dk=["top","right","bottom","left"];function qp(e){let t=["display:flex",`flex-direction:${e.flexDirection??"column"}`,"box-sizing:border-box","min-width:0"],r=e.flexDirection==="row";if(e.gap)t.push(`gap:${r?ku(e.gap):_c(e.gap)}`);let n=(s)=>{let i=s==="left"||s==="right",o=(s==="left"?e.paddingLeft:void 0)??(i?e.paddingX:e.paddingY)??e.padding;if(o)t.push(`padding-${s}:${i?ku(o):_c(o)}`)};for(let s of dk)n(s);if(e.margin)t.push(`margin:${_c(e.margin)} ${ku(e.margin)}`);if(e.marginTop)t.push(`margin-top:${_c(e.marginTop)}`);if(e.border){let s=e.border===!0?dk:e.border;for(let i of s)t.push(`border-${i}:1px solid ${e.borderColor??"currentColor"}`)}if(e.backgroundColor)t.push(`background:${e.backgroundColor}`);if(e.width!==void 0)t.push(`width:${fk(e.width,ku)}`);if(e.height!==void 0)t.push(`height:${fk(e.height,_c)}`);if(e.flexGrow!==void 0)t.push(`flex-grow:${e.flexGrow}`);if(e.flexShrink!==void 0)t.push(`flex-shrink:${e.flexShrink}`);return t.join(";")}function Ma(e){let t=[];if(e.fg)t.push(`color:${e.fg}`);if(e.bg)t.push(`background:${e.bg}`);if(e.bold)t.push("font-weight:700");if(e.italic)t.push("font-style:italic");if(e.pre)t.push("white-space:pre");return t.join(";")}var Y4=new Set(["$$slots","$$events","$$legacy","children","onclick"]),G4=te('<div role="button" tabindex="0"><!></div>'),W4=te("<div><!></div>");function Lp(e,t){Oe(t,!0);let r=Ks(t,Y4);var n=Ve(),s=$e(n);{var i=(a)=>{var l=G4(),_=ke(l);xs(_,()=>t.children??Rt),ue(l),le((c)=>Dr(l,`${c??""};cursor:pointer`),[()=>qp(r)]),$r("click",l,function(...c){t.onclick?.apply(this,c)}),$r("keydown",l,(c)=>{if(c.key==="Enter"||c.key===" ")c.preventDefault(),t.onclick()}),z(a,l)},o=(a)=>{var l=W4(),_=ke(l);xs(_,()=>t.children??Rt),ue(l),le((c)=>Dr(l,c),[()=>qp(r)]),z(a,l)};ge(s,(a)=>{if(t.onclick)a(i);else a(o,-1)})}z(e,n),Ne()}ss(["click","keydown"]);var X4=new Set(["$$slots","$$events","$$legacy","href","children"]),K4=te('<a rel="noopener noreferrer"><!></a>');function Fp(e,t){Oe(t,!0);let r=Ks(t,X4),n=ne(()=>Sl(t.href));var s=K4(),i=ke(s);xs(i,()=>t.children??Rt),ue(s),le((o)=>{St(s,"href",y(n)),Dr(s,o),St(s,"target",y(n)?"_blank":void 0)},[()=>Ma(r)]),z(e,s),Ne()}var Z4=new Set(["$$slots","$$events","$$legacy","children"]),J4=te("<span><!></span>");function jp(e,t){Oe(t,!0);let r=Ks(t,Z4);var n=J4(),s=ke(n);xs(s,()=>t.children??Rt),ue(n),le((i)=>Dr(n,i),[()=>Ma(r)]),z(e,n),Ne()}var Q4=new Set(["$$slots","$$events","$$legacy","content","children"]),e9=te("<div><!></div>");function zp(e,t){Oe(t,!0);let r=Ks(t,Q4);var n=e9(),s=ke(n);{var i=(a)=>{var l=Ve(),_=$e(l);xs(_,()=>t.children),z(a,l)},o=(a)=>{var l=Bt();le(()=>ae(l,t.content)),z(a,l)};ge(s,(a)=>{if(t.children)a(i);else a(o,-1)})}ue(n),le((a)=>Dr(n,a),[()=>Ma(r)]),z(e,n),Ne()}var pk=()=>({Box:Lp,Text:zp,Span:jp,Link:Fp,Markdown:hs,text_width:(e)=>Array.from(e).length});var t9=te('<p class="muted warn"> </p> <!>',1);function Up(e,t){Oe(t,!0);let r=on(t,"streaming",3,!1);gv(pk());let n=ne(()=>String(t.node.attrs.name??"")),s=ne(()=>vl(y(n))),i=ne(()=>t.node.kind==="directive_container"),o=ne(()=>!y(s)?{ok:!1,error:"unknown directive"}:y(s).kind!==(y(i)?"container":"leaf")?{ok:!1,error:`is a ${y(s).kind} directive; write it as ${y(s).kind==="leaf"?"::":":::"}${y(n)}`}:Jh(y(n),t.node.attrs.args));var a=Ve(),l=$e(a);{var _=(h)=>{var d=Ve(),f=$e(d);{var p=(D)=>{Ap(D,{get node(){return t.node},get args(){return y(o).args},get theme(){return Mi},get streaming(){return r()}})},m=(D)=>{Tp(D,{get node(){return t.node},get args(){return y(o).args},get theme(){return Mi},get streaming(){return r()}})},g=(D)=>{Op(D,{get node(){return t.node},get args(){return y(o).args},get theme(){return Mi}})},b=(D)=>{Sp(D,{get args(){return y(o).args},get theme(){return Mi}})},k=(D)=>{Cp(D,{get node(){return t.node},get args(){return y(o).args},get theme(){return Mi},get streaming(){return r()}})},x=(D)=>{Np(D,{get args(){return y(o).args},get theme(){return Mi}})},w=(D)=>{Mp(D,{get node(){return t.node},get args(){return y(o).args}})},O=(D)=>{Ip(D,{get node(){return t.node}})},N=(D)=>{Pp(D,{get node(){return t.node},get args(){return y(o).args}})},S=(D)=>{Dp(D,{get node(){return t.node},get args(){return y(o).args}})};ge(f,(D)=>{if(y(n)==="callout")D(p);else if(y(n)==="chart")D(m,1);else if(y(n)==="tree")D(g,2);else if(y(n)==="progress")D(b,3);else if(y(n)==="details")D(k,4);else if(y(n)==="usage")D(x,5);else if(y(n)==="change")D(w,6);else if(y(n)==="check")D(O,7);else if(y(n)==="widget")D(N,8);else if(y(n)==="view")D(S,9)})}z(h,d)},c=(h)=>{var d=t9(),f=$e(d),p=Te(f),m=se(f,2);{var g=(b)=>{hs(b,{get node(){return t.node},get streaming(){return r()}})};ge(m,(b)=>{if(y(i))b(g)})}le(()=>ae(p,`⚠ ::${y(n)??""}: ${y(o).error??""}`)),z(h,d)};ge(l,(h)=>{if(y(o).ok)h(_);else if(!y(s)?.internal)h(c,1)})}z(e,a),Ne()}var Dn=(e,t=Rt,r=Rt)=>{var n=Ve(),s=$e(n);At(s,19,t,(i,o)=>typeof i==="string"?"s"+o:i.id,(i,o)=>{var a=Ve(),l=$e(a);{var _=(h)=>{var d=Bt();le(()=>ae(d,y(o))),z(h,d)},c=(h)=>{let d=ne(()=>xf(y(o),r()));var f=Ve(),p=$e(f);{var m=(W)=>{var j=r9(),P=ke(j);Dn(P,()=>y(o).children,()=>y(o)),ue(j),z(W,j)},g=(W)=>{var j=n9(),P=ke(j);Dn(P,()=>y(o).children,()=>y(o)),ue(j),z(W,j)},b=(W)=>{var j=s9(),P=ke(j);Dn(P,()=>y(o).children,()=>y(o)),ue(j),z(W,j)},k=(W)=>{var j=i9(),P=ke(j);Dn(P,()=>y(o).children,()=>y(o)),ue(j),z(W,j)},x=(W)=>{var j=o9(),P=ke(j);Dn(P,()=>y(o).children,()=>y(o)),ue(j),z(W,j)},w=(W)=>{var j=a9(),P=Te(j,!0);le((M)=>ae(P,M),[()=>Bn(y(o))]),z(W,j)},O=(W)=>{let j=ne(()=>Sl(y(o).attrs.href));var P=Ve(),M=$e(P);{var F=(re)=>{var ie=l9(),we=ke(ie);Dn(we,()=>y(o).children,()=>y(o)),ue(ie),le(()=>St(ie,"href",y(j))),z(re,ie)},Z=(re)=>{Dn(re,()=>y(o).children,()=>y(o))};ge(M,(re)=>{if(y(j))re(F);else re(Z,-1)})}z(W,P)},N=(W)=>{var j=c9(),P=Te(j);le((M)=>ae(P,`[image: ${M??""}]`),[()=>Bn(y(o))]),z(W,j)},S=(W)=>{var j=_9();z(W,j)},D=(W)=>{var j=Bt();j.nodeValue=`
247
+ `,z(W,j)},X=(W)=>{var j=Bt();le((P)=>ae(j,P),[()=>Bn(y(o))]),z(W,j)},G=(W)=>{},H=(W)=>{var j=u9(),P=Te(j);le(()=>ae(P,`[^${y(o).attrs.label??""}]`)),z(W,j)},R=(W)=>{Dn(W,()=>y(o).children,()=>y(o))};ge(p,(W)=>{if(y(d)==="strong")W(m);else if(y(d)==="emphasis")W(g,1);else if(y(d)==="strikethrough")W(b,2);else if(y(d)==="superscript")W(k,3);else if(y(d)==="subscript")W(x,4);else if(y(d)==="code")W(w,5);else if(y(d)==="link")W(O,6);else if(y(d)==="image")W(N,7);else if(y(d)==="break")W(S,8);else if(y(d)==="soft_break")W(D,9);else if(y(d)==="literal")W(X,10);else if(y(o).kind==="html_comment")W(G,11);else if(y(o).kind==="footnote_reference")W(H,12);else W(R,-1)})}z(h,f)};ge(l,(h)=>{if(typeof y(o)==="string")h(_);else h(c,-1)})}z(i,a)}),z(e,n)},r9=te("<strong><!></strong>"),n9=te("<em><!></em>"),s9=te("<s><!></s>"),i9=te("<sup><!></sup>"),o9=te("<sub><!></sub>"),a9=te('<code class="inline"> </code>'),l9=te('<a target="_blank" rel="noopener noreferrer"><!></a>'),c9=te('<span class="muted"> </span>'),_9=te("<br/>"),u9=te('<sup class="muted"> </sup>'),h9=te("<th><!></th>"),mk=te("<tr></tr>"),f9=te("<thead></thead>"),d9=te("<td><!></td>"),p9=te('<div class="table-wrap"><table><!><tbody></tbody></table></div>'),m9=te('<input type="checkbox" disabled=""/>'),g9=te("<li><!> <!></li>"),v9=te("<p><!></p>"),b9=te("<blockquote><!></blockquote>"),k9=te("<hr/>"),y9=te('<span class="run"><!></span>'),w9=te('<div class="md"></div>');function hs(e,t){Oe(t,!0);let r=(f,p=Rt)=>{let m=ne(()=>_(p(),"table_header").map(c)),g=ne(()=>_(p(),"table_row").map(c));var b=p9(),k=ke(b),x=ke(k);{var w=(N)=>{var S=f9();At(S,21,()=>y(m),_r,(D,X)=>{var G=mk();At(G,21,()=>y(X),_r,(H,R,W)=>{var j=h9();let P;var M=ke(j);Dn(M,()=>y(R).children,()=>y(R)),ue(j),le((F)=>P=Dr(j,"",P,{"text-align":F}),[()=>h(p().attrs.alignments,W)]),z(H,j)}),ue(G),z(D,G)}),ue(S),z(N,S)};ge(x,(N)=>{if(y(m).length)N(w)})}var O=se(x);At(O,21,()=>y(g),_r,(N,S)=>{var D=mk();At(D,21,()=>y(S),_r,(X,G,H)=>{var R=d9();let W;var j=ke(R);Dn(j,()=>y(G).children,()=>y(G)),ue(R),le((P)=>W=Dr(R,"",W,{"text-align":P}),[()=>h(p().attrs.alignments,H)]),z(X,R)}),ue(D),z(N,D)}),ue(O),ue(k),ue(b),z(f,b)},n=(f,p=Rt)=>{let m=ne(()=>_(p(),"list_item")),g=ne(()=>p().attrs.ordered===!0),b=ne(()=>Number(p().attrs.start??1)),k=ne(()=>p().attrs.tight===!0);var x=Ve(),w=$e(x);Jc(w,()=>y(g)?"ol":"ul",!1,(O,N)=>{zh(O,()=>({start:y(g)&&y(b)!==1?y(b):void 0,class:"",[bi]:{tight:y(k)}}));var S=Ve(),D=$e(S);At(D,17,()=>y(m),(X)=>X.id,(X,G)=>{let H=ne(()=>y(G).attrs.checked);var R=g9();let W;var j=ke(R);{var P=(F)=>{var Z=m9();r_(Z),le(()=>jh(Z,y(H))),z(F,Z)};ge(j,(F)=>{if(typeof y(H)==="boolean")F(P)})}var M=se(j,2);hs(M,{get node(){return y(G)},get streaming(){return i()}}),ue(R),le(()=>W=sr(R,1,"",null,W,{task:typeof y(H)==="boolean"})),z(X,R)}),z(N,S)}),z(f,x)},s=(f,p=Rt)=>{var m=Ve(),g=$e(m);{var b=(G)=>{var H=v9(),R=ke(H);Dn(R,()=>p().children,p),ue(H),z(G,H)},k=(G)=>{var H=Ve(),R=$e(H);Jc(R,()=>"h"+Math.min(6,Math.max(1,p().extra||1)),!1,(W,j)=>{Dn(j,()=>p().children,p)}),z(G,H)},x=(G)=>{{let H=ne(()=>Bn(p())),R=ne(()=>i()&&!p().closed);Ep(G,{get code(){return y(H)},get info(){return p().attrs.info},get streaming(){return y(R)}})}},w=(G)=>{var H=b9(),R=ke(H);hs(R,{get node(){return p()},get streaming(){return i()}}),ue(H),z(G,H)},O=(G)=>{n(G,p)},N=(G)=>{var H=k9();z(G,H)},S=(G)=>{r(G,p)},D=(G)=>{Up(G,{get node(){return p()},get streaming(){return i()}})},X=(G)=>{hs(G,{get node(){return p()},get streaming(){return i()}})};ge(g,(G)=>{if(p().kind==="paragraph")G(b);else if(p().kind==="heading")G(k,1);else if(p().kind==="code_fence")G(x,2);else if(p().kind==="block_quote")G(w,3);else if(p().kind==="list")G(O,4);else if(p().kind==="thematic_break")G(N,5);else if(p().kind==="table")G(S,6);else if(p().kind==="directive_leaf"||p().kind==="directive_container")G(D,7);else G(X,-1)})}z(f,m)},i=on(t,"streaming",3,!1),o=new Set(["emphasis","strong_emphasis","strikethrough","superscript","subscript","code_span","link","image","hard_break","soft_break","mustache","html","html_comment","svelte_tag","directive_inline","footnote_reference","text"]),a=new Set(["line_break","definition","frontmatter","import_statement"]),l=ne(()=>{let f=[],p=[],m=()=>{if(p.some((g)=>typeof g!=="string"||g.trim()))f.push({key:"run"+f.length,items:p});p=[]};for(let g of t.node.children)if(typeof g==="string"||o.has(g.kind))p.push(g);else if(!a.has(g.kind))m(),f.push({key:String(g.id),node:g});return m(),f});function _(f,p){return f.children.filter((m)=>typeof m!=="string"&&m.kind===p)}let c=(f)=>_(f,"table_cell"),h=(f,p)=>{let m=Array.isArray(f)?f[p]:null;return m==="left"||m==="right"||m==="center"?m:void 0};var d=w9();At(d,21,()=>y(l),(f)=>f.key,(f,p)=>{var m=Ve(),g=$e(m);{var b=(x)=>{s(x,()=>y(p).node)},k=(x)=>{var w=y9(),O=ke(w);Dn(O,()=>y(p).items,()=>t.node),ue(w),z(x,w)};ge(g,(x)=>{if(y(p).node)x(b);else if(y(p).items)x(k,1)})}z(f,m)}),ue(d),z(e,d),Ne()}function Bp(e,t){Oe(t,!0);let r=new Tl;pt(()=>r.sync(t.message.text,!t.streaming)),qo(()=>{let s=t.message.text,i=!t.streaming;pt(()=>r.sync(s,i))});let n=ne(()=>{let s=new Set,i=new Set;for(let o of r.root.children){if(typeof o==="string"||o.kind!=="directive_leaf")continue;let a=o.attrs.args,l=o.attrs.name==="change"&&a?.index!==void 0?"change"+Number(a.index):o.attrs.name==="check"?"check":o.attrs.name==="widget"&&a?.id!==void 0?"widget"+Number(a.id):o.attrs.name==="view"&&a?.index!==void 0?"view"+Number(a.index):void 0;if(l&&!i.has(l))i.add(l),s.add(o.id)}return s});yv({changes:()=>t.message.changes,check:()=>t.message.check,widget:(s)=>t.message.widgets?.find((i)=>i.id===s),view:(s)=>t.message.views?.[s],owns:(s)=>y(n).has(s)}),hs(e,{get node(){return r.root},get streaming(){return t.streaming}}),Ne()}var x9=te('<div class="bubble user"><p> </p></div>'),$9=te('<article class="reply"><!></article>'),E9=te('<p class="empty muted">Ask something, or type in the terminal. Both show here.</p>'),A9=te('<div class="transcript"></div>');function Hp(e,t){Oe(t,!0);let r=Le(void 0),n=!0,s=ne(()=>t.messages.at(-1)?.text);Ir(()=>{if(y(s),t.messages.length,y(r)&&n)y(r).scrollTop=y(r).scrollHeight});var i=A9();At(i,21,()=>t.messages,_r,(o,a,l)=>{var _=Ve(),c=$e(_);{var h=(f)=>{var p=x9(),m=ke(p),g=Te(m,!0);ue(p),le(()=>ae(g,y(a).text)),z(f,p)},d=(f)=>{var p=$9(),m=ke(p);{let g=ne(()=>t.busy&&l===t.messages.length-1);Bp(m,{get message(){return y(a)},get streaming(){return y(g)}})}ue(p),z(f,p)};ge(c,(f)=>{if(y(a).role==="user")f(h);else f(d,-1)})}z(o,_)},(o)=>{var a=E9();z(o,a)}),ue(i),ml(i,(o)=>Me(r,o),()=>y(r)),ys("scroll",i,()=>{if(y(r))n=y(r).scrollHeight-y(r).scrollTop-y(r).clientHeight<80}),z(e,i),Ne()}var T9=Kc('<text text-anchor="end" class="svg-muted"> </text><rect rx="2"></rect><text class="svg-text"> </text>',1),C9=Kc('<svg class="bars" role="img" aria-label="Time spent per tool"></svg>'),S9=te('<p class="muted">No tool calls yet.</p>');function Vp(e,t){Oe(t,!0);let r=ne(()=>t.tools.map((c)=>c.calls*c.avg_ms)),n=ne(()=>Af(y(r))),s=26,i=ne(()=>Math.min(200,Math.max(60,...t.tools.map((c)=>c.name.length*7.5+8))));var o=Ve(),a=$e(o);{var l=(c)=>{var h=C9();At(h,23,()=>t.tools,(d)=>d.name,(d,f,p)=>{var m=T9(),g=$e(m),b=Te(g,!0),k=se(g);St(k,"height",s-8);var x=se(k),w=Te(x);le((O,N)=>{St(g,"x",y(i)-6),St(g,"y",y(p)*s+17),ae(b,y(f).name),St(k,"x",y(i)),St(k,"y",y(p)*s+4),St(k,"width",O),St(k,"fill",y(f).errors?"var(--warning)":"var(--accent)"),St(x,"x",y(i)+y(n)[y(p)]*240+6),St(x,"y",y(p)*s+17),ae(w,`${N??""}s · ${y(f).calls??""}×`)},[()=>Math.max(1,y(n)[y(p)]*240),()=>(y(r)[y(p)]/1000).toFixed(1)]),z(d,m)}),ue(h),le(()=>St(h,"viewBox",`0 0 ${y(i)+340} ${t.tools.length*s}`)),z(c,h)},_=(c)=>{var h=S9();z(c,h)};ge(a,(c)=>{if(t.tools.length)c(l);else c(_,-1)})}z(e,o),Ne()}var O9=te('<p class="danger">Usage is not available.</p>'),N9=te('<dl class="totals"><div><dt>Turns</dt> <dd> </dd></div> <div><dt>Requests</dt> <dd> </dd></div> <div><dt>Tool calls</dt> <dd> </dd></div> <div><dt>Tokens in</dt> <dd> </dd></div> <div><dt>Tokens out</dt> <dd> </dd></div> <div><dt>Cache reads</dt> <dd> </dd></div> <div><dt>Cost</dt> <dd> </dd></div> <div><dt>Time</dt> <dd> </dd></div></dl> <h3>Top tools by time</h3> <!>',1),R9=te('<p class="muted">Loading…</p>'),M9=te('<section class="card"><h2> </h2> <!></section>'),I9=te('<main class="usage-page"><h1>Usage</h1> <!> <!></main>');function Yp(e,t){Oe(t,!0);let r=Vo(),n=["session","workspace"],s=cr({}),i=Le(!1);Ir(()=>{r.revision();for(let c of n)r.usage(c).then((h)=>{s[c]=h,Me(i,!1)},()=>Me(i,!0))});var o=I9(),a=se(ke(o),2);{var l=(c)=>{var h=O9();z(c,h)};ge(a,(c)=>{if(y(i))c(l)})}var _=se(a,2);At(_,16,()=>n,(c)=>c,(c,h)=>{let d=ne(()=>s[h]);var f=M9(),p=ke(f),m=Te(p,!0),g=se(p,2);{var b=(x)=>{let w=ne(()=>y(d).totals);var O=N9(),N=$e(O),S=ke(N),D=se(ke(S),2),X=Te(D,!0);ue(S);var G=se(S,2),H=se(ke(G),2),R=Te(H,!0);ue(G);var W=se(G,2),j=se(ke(W),2),P=Te(j);ue(W);var M=se(W,2),F=se(ke(M),2),Z=Te(F,!0);ue(M);var re=se(M,2),ie=se(ke(re),2),we=Te(ie,!0);ue(re);var _e=se(re,2),oe=se(ke(_e),2),Y=Te(oe,!0);ue(_e);var Ee=se(_e,2),ve=se(ke(Ee),2),fe=Te(ve,!0);ue(Ee);var ye=se(Ee,2),Ie=se(ke(ye),2),Se=Te(Ie,!0);ue(ye),ue(N);var Ke=se(N,4);Vp(Ke,{get tools(){return y(d).tools}}),le((rt,Ze,it,Xe,ht)=>{ae(X,y(w).turns),ae(R,y(w).requests),ae(P,`${y(w).tools??""}${y(w).tool_errors?` (${y(w).tool_errors} failed)`:""}`),ae(Z,rt),ae(we,Ze),ae(Y,it),ae(fe,Xe),ae(Se,ht)},[()=>$s(y(w).input_tokens),()=>$s(y(w).output_tokens),()=>$s(y(w).cache_read_tokens),()=>y(w).cost_usd?ta(y(w).cost_usd):"–",()=>ra(y(w).duration_ms)]),z(x,O)},k=(x)=>{var w=R9();z(x,w)};ge(g,(x)=>{if(y(d))x(b);else x(k,-1)})}ue(f),le(()=>ae(m,h==="session"?"This session":"This workspace")),z(c,f)}),ue(o),z(e,o),Ne()}var D9=te('<aside class="widgets" aria-label="Live widgets"></aside>'),P9=te('<div class="body"><main class="column"><!> <!> <!></main> <!></div>'),q9=te('<div class="app"><!> <!></div>');function Gp(e,t){Oe(t,!0);let r=new $p;bv({now:()=>r.now,usage:(f)=>r.usage(f),revision:()=>r.revision,theme:()=>r.theme}),dv({usage:(f)=>r.usage(f),revision:()=>r.revision});let n=Le(cr(location.hash)),s=ne(()=>y(n).startsWith("#/usage")?"usage":"chat"),i=ne(()=>r.phase!=="idle"),o=ne(()=>new Set(r.messages.flatMap((f)=>f.widgets?.map((p)=>p.id)??[]))),a=ne(()=>r.widgets.filter((f)=>!y(o).has(f.id)));Ir(()=>uk(r.theme,document.documentElement)),uv(()=>(history.replaceState(null,"",location.pathname+location.hash),r.connect(),()=>r.close()));var l=q9();ys("hashchange",Wi,()=>Me(n,location.hash,!0));var _=ke(l);xp(_,{get mode(){return r.mode},get phase(){return r.phase},get activity(){return r.activity},get error(){return r.error},get notice(){return r.notice},get connected(){return r.connected},get route(){return y(s)},ontoggle:()=>r.act({action:"toggle_mode"}),onstop:()=>r.act({action:"stop"}),onundo:()=>r.act({action:"undo"})});var c=se(_,2);{var h=(f)=>{Yp(f,{})},d=(f)=>{var p=P9(),m=ke(p),g=ke(m);Hp(g,{get messages(){return r.messages},get busy(){return y(i)}});var b=se(g,2);{var k=(N)=>{wp(N,{get pending(){return r.pending},onapprove:(S)=>r.act({action:"approve",after:S}),onapprove_all:(S)=>r.act({action:"approve_all",after:S}),ondecline:()=>r.act({action:"decline"})})};ge(b,(N)=>{if(r.pending)N(k)})}var x=se(b,2);Wh(x,{get busy(){return y(i)},onsend:(N)=>r.act({action:"send",text:N})}),ue(m);var w=se(m,2);{var O=(N)=>{var S=D9();At(S,21,()=>y(a),(D)=>D.id,(D,X)=>{lc(D,{get widget(){return y(X)}})}),ue(S),z(N,S)};ge(w,(N)=>{if(y(a).length)N(O)})}ue(p),z(f,p)};ge(c,(f)=>{if(y(s)==="usage")f(h);else f(d,-1)})}ue(l),z(e,l),Ne()}Uo(Gp,{target:document.getElementById("app")});