diff --git a/Cargo.lock b/Cargo.lock
index 1acdf4e..c3b1ca9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1779,6 +1779,12 @@ dependencies = [
"libc",
]
+[[package]]
+name = "memo-map"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "374c335b2df19e62d4cb323103473cbc6510980253119180de862d89184f6a83"
+
[[package]]
name = "memoffset"
version = "0.8.0"
@@ -1804,6 +1810,17 @@ dependencies = [
"unicase",
]
+[[package]]
+name = "minijinja"
+version = "1.0.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "80084fa3099f58b7afab51e5f92e24c2c2c68dcad26e96ad104bd6011570461d"
+dependencies = [
+ "memo-map",
+ "self_cell",
+ "serde",
+]
+
[[package]]
name = "minimal-lexical"
version = "0.2.1"
@@ -2790,6 +2807,12 @@ dependencies = [
"libc",
]
+[[package]]
+name = "self_cell"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c309e515543e67811222dbc9e3dd7e1056279b782e1dacffe4242b718734fb6"
+
[[package]]
name = "serde"
version = "1.0.171"
@@ -3078,6 +3101,7 @@ dependencies = [
"lazy_static",
"llama-cpp-bindings",
"mime_guess",
+ "minijinja",
"nvml-wrapper",
"opentelemetry",
"opentelemetry-otlp",
diff --git a/clients/tabby-playground/components/chat.tsx b/clients/tabby-playground/components/chat.tsx
index 21113d4..2405191 100644
--- a/clients/tabby-playground/components/chat.tsx
+++ b/clients/tabby-playground/components/chat.tsx
@@ -39,9 +39,6 @@ export function Chat({ id, initialMessages, className }: ChatProps) {
}
}
})
- if (messages.length > 2) {
- setMessages(messages.slice(messages.length - 2, messages.length))
- }
return (
<>
diff --git a/clients/tabby-playground/lib/hooks/use-patch-fetch.ts b/clients/tabby-playground/lib/hooks/use-patch-fetch.ts
index 8f85df2..4e3e624 100644
--- a/clients/tabby-playground/lib/hooks/use-patch-fetch.ts
+++ b/clients/tabby-playground/lib/hooks/use-patch-fetch.ts
@@ -1,5 +1,6 @@
import { type Message } from 'ai/react'
-import { CohereStream, StreamingTextResponse } from 'ai'
+import { StreamingTextResponse } from 'ai'
+import { TabbyStream } from '@/lib/tabby-stream'
import { useEffect } from 'react'
const serverUrl =
@@ -15,25 +16,17 @@ export function usePatchFetch() {
}
const { messages } = JSON.parse(options!.body as string)
- const res = await fetch(`${serverUrl}/v1beta/generate_stream`, {
+ const res = await fetch(`${serverUrl}/v1beta/chat/completions`, {
...options,
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
- body: JSON.stringify({
- prompt: messagesToPrompt(messages)
- })
})
- const stream = CohereStream(res, undefined)
+ const stream = TabbyStream(res, undefined)
return new StreamingTextResponse(stream)
}
}, [])
}
-function messagesToPrompt(messages: Message[]) {
- const instruction = messages[messages.length - 1].content
- const prompt = `Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n${instruction}\n\n### Response:`
- return prompt
-}
diff --git a/clients/tabby-playground/lib/tabby-stream.ts b/clients/tabby-playground/lib/tabby-stream.ts
new file mode 100644
index 0000000..c0423f3
--- /dev/null
+++ b/clients/tabby-playground/lib/tabby-stream.ts
@@ -0,0 +1,71 @@
+import {
+ type AIStreamCallbacksAndOptions,
+ createCallbacksTransformer,
+ createStreamDataTransformer
+} from 'ai';
+
+const utf8Decoder = new TextDecoder('utf-8');
+
+async function processLines(
+ lines: string[],
+ controller: ReadableStreamDefaultController
,
+) {
+ for (const line of lines) {
+ const { content } = JSON.parse(line);
+ controller.enqueue(content);
+ }
+}
+
+async function readAndProcessLines(
+ reader: ReadableStreamDefaultReader,
+ controller: ReadableStreamDefaultController,
+) {
+ let segment = '';
+
+ while (true) {
+ const { value: chunk, done } = await reader.read();
+ if (done) {
+ break;
+ }
+
+ segment += utf8Decoder.decode(chunk, { stream: true });
+
+ const linesArray = segment.split(/\r\n|\n|\r/g);
+ segment = linesArray.pop() || '';
+
+ await processLines(linesArray, controller);
+ }
+
+ if (segment) {
+ const linesArray = [segment];
+ await processLines(linesArray, controller);
+ }
+
+ controller.close();
+}
+
+function createParser(res: Response) {
+ const reader = res.body?.getReader();
+
+ return new ReadableStream({
+ async start(controller): Promise {
+ if (!reader) {
+ controller.close();
+ return;
+ }
+
+ await readAndProcessLines(reader, controller);
+ },
+ });
+}
+
+export function TabbyStream(
+ reader: Response,
+ callbacks?: AIStreamCallbacksAndOptions,
+): ReadableStream {
+ return createParser(reader)
+ .pipeThrough(createCallbacksTransformer(callbacks))
+ .pipeThrough(
+ createStreamDataTransformer(callbacks?.experimental_streamData),
+ );
+}
diff --git a/crates/ctranslate2-bindings/src/lib.rs b/crates/ctranslate2-bindings/src/lib.rs
index ffc07ea..25ce843 100644
--- a/crates/ctranslate2-bindings/src/lib.rs
+++ b/crates/ctranslate2-bindings/src/lib.rs
@@ -137,7 +137,7 @@ impl TextGeneration for CTranslate2Engine {
let decoding = self
.decoding_factory
- .create(self.tokenizer.clone(), truncate_tokens(encoding.get_ids(), options.max_input_length), &options.stop_words, options.static_stop_words);
+ .create_incremental_decoding(self.tokenizer.clone(), truncate_tokens(encoding.get_ids(), options.max_input_length), options.stop_words);
let (sender, mut receiver) = channel::(8);
let context = InferenceContext::new(sender, decoding, cancel_for_inference);
diff --git a/crates/http-api-bindings/src/fastchat.rs b/crates/http-api-bindings/src/fastchat.rs
index c08ad01..f71e048 100644
--- a/crates/http-api-bindings/src/fastchat.rs
+++ b/crates/http-api-bindings/src/fastchat.rs
@@ -58,11 +58,8 @@ impl FastChatEngine {
#[async_trait]
impl TextGeneration for FastChatEngine {
async fn generate(&self, prompt: &str, options: TextGenerationOptions) -> String {
- let _stop_sequences: Vec = options
- .static_stop_words
- .iter()
- .map(|x| x.to_string())
- .collect();
+ let _stop_sequences: Vec =
+ options.stop_words.iter().map(|x| x.to_string()).collect();
let tokens: Vec<&str> = prompt.split("").collect();
let request = Request {
diff --git a/crates/http-api-bindings/src/vertex_ai.rs b/crates/http-api-bindings/src/vertex_ai.rs
index 6d83210..1d74b59 100644
--- a/crates/http-api-bindings/src/vertex_ai.rs
+++ b/crates/http-api-bindings/src/vertex_ai.rs
@@ -67,7 +67,7 @@ impl VertexAIEngine {
impl TextGeneration for VertexAIEngine {
async fn generate(&self, prompt: &str, options: TextGenerationOptions) -> String {
let stop_sequences: Vec = options
- .static_stop_words
+ .stop_words
.iter()
.map(|x| x.to_string())
// vertex supports at most 5 stop sequence.
diff --git a/crates/llama-cpp-bindings/src/engine.cc b/crates/llama-cpp-bindings/src/engine.cc
index 0b335ae..abcaee0 100644
--- a/crates/llama-cpp-bindings/src/engine.cc
+++ b/crates/llama-cpp-bindings/src/engine.cc
@@ -10,7 +10,8 @@ namespace llama {
TextInferenceEngine::~TextInferenceEngine() {}
namespace {
-static size_t N_BATCH = 512;
+static size_t N_BATCH = 512; // # per batch inference.
+static size_t N_CTX = 4096; // # max kv history.
template
using owned = std::unique_ptr>;
@@ -59,7 +60,7 @@ class TextInferenceEngineImpl : public TextInferenceEngine {
return std::distance(logits, std::max_element(logits, logits + n_vocab));
}
- bool eval(llama_token* data, size_t size, bool reset) {
+ void eval(llama_token* data, size_t size, bool reset) {
if (reset) {
n_past_ = 0;
}
@@ -76,12 +77,10 @@ class TextInferenceEngineImpl : public TextInferenceEngine {
auto* ctx = ctx_.get();
llama_kv_cache_tokens_rm(ctx, n_past_, -1);
if (llama_decode(ctx, batch_)) {
- fprintf(stderr, "%s : failed to eval\n", __func__);
- return false;
+ throw std::runtime_error("Failed to eval");
}
n_past_ += size;
- return true;
}
size_t n_past_;
@@ -127,7 +126,7 @@ std::unique_ptr create_engine(rust::Str model_path) {
}
llama_context_params ctx_params = llama_context_default_params();
- ctx_params.n_ctx = 2048;
+ ctx_params.n_ctx = N_CTX;
ctx_params.n_batch = N_BATCH;
llama_context* ctx = llama_new_context_with_model(model, ctx_params);
diff --git a/crates/llama-cpp-bindings/src/lib.rs b/crates/llama-cpp-bindings/src/lib.rs
index af26ede..8e8e294 100644
--- a/crates/llama-cpp-bindings/src/lib.rs
+++ b/crates/llama-cpp-bindings/src/lib.rs
@@ -18,7 +18,7 @@ mod ffi {
fn create_engine(model_path: &str) -> UniquePtr;
fn start(self: Pin<&mut TextInferenceEngine>, input_token_ids: &[u32]);
- fn step(self: Pin<&mut TextInferenceEngine>) -> u32;
+ fn step(self: Pin<&mut TextInferenceEngine>) -> Result;
fn end(self: Pin<&mut TextInferenceEngine>);
fn eos_token(&self) -> u32;
@@ -75,10 +75,12 @@ impl TextGeneration for LlamaEngine {
let input_token_ids = truncate_tokens(encoding.get_ids(), options.max_input_length);
engine.as_mut().start(input_token_ids);
- let mut decoding = self.decoding_factory.create(self.tokenizer.clone(), input_token_ids, &options.stop_words, options.static_stop_words);
+ let mut decoding = self.decoding_factory.create_incremental_decoding(self.tokenizer.clone(), input_token_ids, options.stop_words);
let mut n_remains = options.max_decoding_length ;
while n_remains > 0 {
- let next_token_id = engine.as_mut().step();
+ let Ok(next_token_id) = engine.as_mut().step() else {
+ panic!("Failed to eval");
+ };
if next_token_id == eos_token {
break;
}
diff --git a/crates/tabby-inference/src/decoding.rs b/crates/tabby-inference/src/decoding.rs
index ac7a60a..78cb1a7 100644
--- a/crates/tabby-inference/src/decoding.rs
+++ b/crates/tabby-inference/src/decoding.rs
@@ -24,35 +24,16 @@ impl Default for DecodingFactory {
}
impl DecodingFactory {
- pub fn create(
+ pub fn create_incremental_decoding(
&self,
tokenizer: Arc,
input_token_ids: &[u32],
- stop_words: &Vec,
- static_stop_words: &'static Vec<&'static str>,
+ stop_words: &'static Vec<&'static str>,
) -> IncrementalDecoding {
- IncrementalDecoding::new(
- tokenizer,
- vec![
- self.get_static_re(static_stop_words),
- self.get_re(stop_words),
- ]
- .into_iter()
- .flatten()
- .collect(),
- input_token_ids,
- )
+ IncrementalDecoding::new(tokenizer, self.get_re(stop_words), input_token_ids)
}
- fn get_re(&self, stop_words: &Vec) -> Option {
- if !stop_words.is_empty() {
- Some(create_stop_regex(stop_words))
- } else {
- None
- }
- }
-
- fn get_static_re(&self, stop_words: &'static Vec<&'static str>) -> Option {
+ fn get_re(&self, stop_words: &'static Vec<&'static str>) -> Option {
if stop_words.is_empty() {
None
} else {
@@ -67,8 +48,8 @@ impl DecodingFactory {
}
}
-fn create_stop_regex>(stop_words: &[T]) -> Regex {
- let tokens: Vec = stop_words.iter().map(|x| reverse(x.as_ref())).collect();
+fn create_stop_regex(stop_words: &[&str]) -> Regex {
+ let tokens: Vec = stop_words.iter().map(|x| reverse(*x)).collect();
// (?m) enables multi-line matching mode.
// \A means absolute begins of string.
@@ -78,7 +59,7 @@ fn create_stop_regex>(stop_words: &[T]) -> Regex {
pub struct IncrementalDecoding {
tokenizer: Arc,
- stop_re: Vec,
+ stop_re: Option,
token_ids: Vec,
prefix_offset: usize,
@@ -88,7 +69,7 @@ pub struct IncrementalDecoding {
}
impl IncrementalDecoding {
- pub fn new(tokenizer: Arc, stop_re: Vec, input_token_ids: &[u32]) -> Self {
+ pub fn new(tokenizer: Arc, stop_re: Option, input_token_ids: &[u32]) -> Self {
let text = tokenizer
.decode(input_token_ids, /* skip_special_token = */ true)
.expect("Cannot decode token from tokenizer.");
@@ -129,7 +110,8 @@ impl IncrementalDecoding {
if !new_text.is_empty() {
self.reversed_text = reverse(new_text) + &self.reversed_text;
- for re in &self.stop_re {
+
+ if let Some(re) = &self.stop_re {
if re.find(&self.reversed_text).is_some() {
return None;
}
diff --git a/crates/tabby-inference/src/lib.rs b/crates/tabby-inference/src/lib.rs
index a36f4ad..495785e 100644
--- a/crates/tabby-inference/src/lib.rs
+++ b/crates/tabby-inference/src/lib.rs
@@ -16,10 +16,7 @@ pub struct TextGenerationOptions {
pub sampling_temperature: f32,
#[builder(default = "&EMPTY_STOP_WORDS")]
- pub static_stop_words: &'static Vec<&'static str>,
-
- #[builder(default = "vec![]")]
- pub stop_words: Vec,
+ pub stop_words: &'static Vec<&'static str>,
}
static EMPTY_STOP_WORDS: Vec<&'static str> = vec![];
diff --git a/crates/tabby/Cargo.toml b/crates/tabby/Cargo.toml
index 7e1dc74..39b0230 100644
--- a/crates/tabby/Cargo.toml
+++ b/crates/tabby/Cargo.toml
@@ -39,6 +39,7 @@ http-api-bindings = { path = "../http-api-bindings" }
futures = { workspace = true }
async-stream = { workspace = true }
axum-streams = { version = "0.9.1", features = ["json"] }
+minijinja = { version = "1.0.8", features = ["loader"] }
[target.'cfg(all(target_os="macos", target_arch="aarch64"))'.dependencies]
llama-cpp-bindings = { path = "../llama-cpp-bindings" }
diff --git a/crates/tabby/playground/404.html b/crates/tabby/playground/404.html
index e046919..390f684 100644
--- a/crates/tabby/playground/404.html
+++ b/crates/tabby/playground/404.html
@@ -1 +1 @@
-404: This page could not be found.Tabby Playground404
This page could not be found.
\ No newline at end of file
+404: This page could not be found.Tabby Playground404
This page could not be found.
\ No newline at end of file
diff --git a/crates/tabby/playground/_next/static/f6rsO7djEUh4Fn3OO-Bie/_buildManifest.js b/crates/tabby/playground/_next/static/9a4m76mRTGOnagTYXSPKd/_buildManifest.js
similarity index 100%
rename from crates/tabby/playground/_next/static/f6rsO7djEUh4Fn3OO-Bie/_buildManifest.js
rename to crates/tabby/playground/_next/static/9a4m76mRTGOnagTYXSPKd/_buildManifest.js
diff --git a/crates/tabby/playground/_next/static/f6rsO7djEUh4Fn3OO-Bie/_ssgManifest.js b/crates/tabby/playground/_next/static/9a4m76mRTGOnagTYXSPKd/_ssgManifest.js
similarity index 100%
rename from crates/tabby/playground/_next/static/f6rsO7djEUh4Fn3OO-Bie/_ssgManifest.js
rename to crates/tabby/playground/_next/static/9a4m76mRTGOnagTYXSPKd/_ssgManifest.js
diff --git a/crates/tabby/playground/_next/static/chunks/978-ab68c4a2390585a1.js b/crates/tabby/playground/_next/static/chunks/978-342eae78521d80e5.js
similarity index 83%
rename from crates/tabby/playground/_next/static/chunks/978-ab68c4a2390585a1.js
rename to crates/tabby/playground/_next/static/chunks/978-342eae78521d80e5.js
index 3ffd5ee..63b2223 100644
--- a/crates/tabby/playground/_next/static/chunks/978-ab68c4a2390585a1.js
+++ b/crates/tabby/playground/_next/static/chunks/978-342eae78521d80e5.js
@@ -30,5 +30,5 @@
- horizontal
- vertical
-Defaulting to \`${i}\`.`):null}};let u=s},4913:function(e,t,n){"use strict";n.d(t,{Ks:function(){return c},wn:function(){return a}}),(0,n(22776).k)("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var r={text:0,function_call:1,data:2},o=(e,t)=>`${r[e]}:${JSON.stringify(t)}
-`;Symbol("internal_openai_fn_messages");var a=class extends Response{constructor(e,t,n){let r=e;n&&(r=e.pipeThrough(n.stream)),super(r,{...t,status:200,headers:{"Content-Type":"text/plain; charset=utf-8","X-Experimental-Stream-Data":n?"true":"false",...null==t?void 0:t.headers}})}},i=new TextDecoder("utf-8");async function l(e,t){for(let n of e){let{text:e,is_finished:r}=JSON.parse(n);!0===r?t.close():t.enqueue(e)}}async function s(e,t){let n="";for(;;){let{value:r,done:o}=await e.read();if(o)break;n+=i.decode(r,{stream:!0});let a=n.split(/\r\n|\n|\r/g);n=a.pop()||"",await l(a,t)}if(n){let e=[n];await l(e,t)}t.close()}function c(e,t){return(function(e){var t;let n=null==(t=e.body)?void 0:t.getReader();return new ReadableStream({async start(e){if(!n){e.close();return}await s(n,e)}})})(e).pipeThrough(function(e){let t=new TextEncoder,n="",r=e||{};return new TransformStream({async start(){r.onStart&&await r.onStart()},async transform(e,o){o.enqueue(t.encode(e)),r.onToken&&await r.onToken(e),r.onCompletion&&(n+=e)},async flush(){r.onCompletion&&await r.onCompletion(n),!r.onFinal||"experimental_onFunctionCall"in r||await r.onFinal(n)}})}(t)).pipeThrough(function(e){if(!e)return new TransformStream({transform:async(e,t)=>{t.enqueue(e)}});let t=new TextEncoder,n=new TextDecoder;return new TransformStream({transform:async(e,r)=>{let a=n.decode(e);r.enqueue(t.encode(o("text",a)))}})}(null==t?void 0:t.experimental_streamData))}},22776:function(e,t,n){"use strict";n.d(t,{k:function(){return r}});let r=(e,t=21)=>(n=t)=>{let r="",o=n;for(;o--;)r+=e[Math.random()*e.length|0];return r}},57139:function(e,t,n){"use strict";n.d(t,{R:function(){return ea}});var r,o=n(2265),a=n(26272);let i=()=>{},l=i(),s=Object,c=e=>e===l,u=e=>"function"==typeof e,d=(e,t)=>({...e,...t}),p=e=>u(e.then),g=new WeakMap,f=0,m=e=>{let t,n;let r=typeof e,o=e&&e.constructor,a=o==Date;if(s(e)!==e||a||o==RegExp)t=a?e.toJSON():"symbol"==r?e.toString():"string"==r?JSON.stringify(e):""+e;else{if(t=g.get(e))return t;if(t=++f+"~",g.set(e,t),o==Array){for(n=0,t="@";nE&&typeof window.requestAnimationFrame!=S,w=(e,t)=>{let n=b.get(e);return[()=>!c(t)&&e.get(t)||h,r=>{if(!c(t)){let o=e.get(t);t in y||(y[t]=o),n[5](t,d(o,r),o||h)}},n[6],()=>!c(t)&&t in y?y[t]:!c(t)&&e.get(t)||h]},T=!0,[v,x]=E&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[i,i],R={initFocus:e=>(k&&document.addEventListener("visibilitychange",e),v("focus",e),()=>{k&&document.removeEventListener("visibilitychange",e),x("focus",e)}),initReconnect:e=>{let t=()=>{T=!0,e()},n=()=>{T=!1};return v("online",t),v("offline",n),()=>{x("online",t),x("offline",n)}}},C=!o.useId,_=!E||"Deno"in window,I=e=>A()?window.requestAnimationFrame(e):setTimeout(e,1),N=_?o.useEffect:o.useLayoutEffect,O="undefined"!=typeof navigator&&navigator.connection,L=!_&&O&&(["slow-2g","2g"].includes(O.effectiveType)||O.saveData),D=e=>{if(u(e))try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?m(e):"",t]},M=0,P=()=>++M;var F={ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:0,MUTATE_EVENT:2,RECONNECT_EVENT:1};async function B(...e){let[t,n,r,o]=e,a=d({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{}),i=a.populateCache,s=a.rollbackOnError,g=a.optimisticData,f=!1!==a.revalidate,m=e=>"function"==typeof s?s(e):!1!==s,h=a.throwOnError;if(u(n)){let e=[],r=t.keys();for(let o of r)!/^\$(inf|sub)\$/.test(o)&&n(t.get(o)._k)&&e.push(o);return Promise.all(e.map(y))}return y(n);async function y(n){let o;let[a]=D(n);if(!a)return;let[s,d]=w(t,a),[y,S,E,k]=b.get(t),A=y[a],T=()=>f&&(delete E[a],delete k[a],A&&A[0])?A[0](2).then(()=>s().data):s().data;if(e.length<3)return T();let v=r,x=P();S[a]=[x,0];let R=!c(g),C=s(),_=C.data,I=C._c,N=c(I)?_:I;if(R&&d({data:g=u(g)?g(N,_):g,_c:N}),u(v))try{v=v(N)}catch(e){o=e}if(v&&p(v)){if(v=await v.catch(e=>{o=e}),x!==S[a][0]){if(o)throw o;return v}o&&R&&m(o)&&(i=!0,d({data:v=N,_c:l}))}i&&!o&&(u(i)&&(v=i(v,N)),d({data:v,error:l,_c:l})),S[a][1]=P();let O=await T();if(d({_c:l}),o){if(h)throw o;return}return i?O:v}}let U=(e,t)=>{for(let n in e)e[n][0]&&e[n][0](t)},z=(e,t)=>{if(!b.has(e)){let n=d(R,t),r={},o=B.bind(l,e),a=i,s={},c=(e,t)=>{let n=s[e]||[];return s[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},u=(t,n,r)=>{e.set(t,n);let o=s[t];if(o)for(let e of o)e(n,r)},p=()=>{if(!b.has(e)&&(b.set(e,[r,{},{},{},o,u,c]),!_)){let t=n.initFocus(setTimeout.bind(l,U.bind(l,r,0))),o=n.initReconnect(setTimeout.bind(l,U.bind(l,r,1)));a=()=>{t&&t(),o&&o(),b.delete(e)}}};return p(),[e,o,p,a]}return[e,b.get(e)[4]]},[H,G]=z(new Map),$=d({onLoadingSlow:i,onSuccess:i,onError:i,onErrorRetry:(e,t,n,r,o)=>{let a=n.errorRetryCount,i=o.retryCount,l=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;(c(a)||!(i>a))&&setTimeout(r,l,o)},onDiscarded:i,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:L?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:L?5e3:3e3,compare:(e,t)=>m(e)==m(t),isPaused:()=>!1,cache:H,mutate:G,fallback:{}},{isOnline:()=>T,isVisible:()=>{let e=k&&document.visibilityState;return c(e)||"hidden"!==e}}),j=(e,t)=>{let n=d(e,t);if(t){let{use:r,fallback:o}=e,{use:a,fallback:i}=t;r&&a&&(n.use=r.concat(a)),o&&i&&(n.fallback=d(o,i))}return n},W=(0,o.createContext)({}),V=E&&window.__SWR_DEVTOOLS_USE__,q=V?window.__SWR_DEVTOOLS_USE__:[],Y=e=>u(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],K=()=>d($,(0,o.useContext)(W)),Z=q.concat(e=>(t,n,r)=>{let o=n&&((...e)=>{let[r]=D(t),[,,,o]=b.get(H),a=o[r];return c(a)?n(...e):(delete o[r],a)});return e(t,o,r)}),X=(e,t,n)=>{let r=t[e]||(t[e]=[]);return r.push(n),()=>{let e=r.indexOf(n);e>=0&&(r[e]=r[r.length-1],r.pop())}};V&&(window.__SWR_DEVTOOLS_REACT__=o);let Q=o.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;if("rejected"===e.status)throw e.reason;throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}),J={dedupe:!0};s.defineProperty(e=>{let{value:t}=e,n=(0,o.useContext)(W),r=u(t),a=(0,o.useMemo)(()=>r?t(n):t,[r,n,t]),i=(0,o.useMemo)(()=>r?a:j(n,a),[r,n,a]),s=a&&a.provider,c=(0,o.useRef)(l);s&&!c.current&&(c.current=z(s(i.cache||H),a));let p=c.current;return p&&(i.cache=p[0],i.mutate=p[1]),N(()=>{if(p)return p[2]&&p[2](),p[3]},[]),(0,o.createElement)(W.Provider,d(e,{value:i}))},"defaultValue",{value:$});let ee=(r=(e,t,n)=>{let{cache:r,compare:i,suspense:s,fallbackData:p,revalidateOnMount:g,revalidateIfStale:f,refreshInterval:m,refreshWhenHidden:h,refreshWhenOffline:y,keepPreviousData:S}=n,[E,k,A,T]=b.get(r),[v,x]=D(e),R=(0,o.useRef)(!1),O=(0,o.useRef)(!1),L=(0,o.useRef)(v),M=(0,o.useRef)(t),U=(0,o.useRef)(n),z=()=>U.current,H=()=>z().isVisible()&&z().isOnline(),[G,$,j,W]=w(r,v),V=(0,o.useRef)({}).current,q=c(p)?n.fallback[v]:p,Y=(e,t)=>{for(let n in V)if("data"===n){if(!i(e[n],t[n])&&(!c(e[n])||!i(ei,t[n])))return!1}else if(t[n]!==e[n])return!1;return!0},K=(0,o.useMemo)(()=>{let e=!!v&&!!t&&(c(g)?!z().isPaused()&&!s&&(!!c(f)||f):g),n=t=>{let n=d(t);return(delete n._k,e)?{isValidating:!0,isLoading:!0,...n}:n},r=G(),o=W(),a=n(r),i=r===o?a:n(o),l=a;return[()=>{let e=n(G()),t=Y(e,l);return t?(l.data=e.data,l.isLoading=e.isLoading,l.isValidating=e.isValidating,l.error=e.error,l):(l=e,e)},()=>i]},[r,v]),Z=(0,a.useSyncExternalStore)((0,o.useCallback)(e=>j(v,(t,n)=>{Y(n,t)||e()}),[r,v]),K[0],K[1]),ee=!R.current,et=E[v]&&E[v].length>0,en=Z.data,er=c(en)?q:en,eo=Z.error,ea=(0,o.useRef)(er),ei=S?c(en)?ea.current:en:er,el=(!et||!!c(eo))&&(ee&&!c(g)?g:!z().isPaused()&&(s?!c(er)&&f:c(er)||f)),es=!!(v&&t&&ee&&el),ec=c(Z.isValidating)?es:Z.isValidating,eu=c(Z.isLoading)?es:Z.isLoading,ed=(0,o.useCallback)(async e=>{let t,r;let o=M.current;if(!v||!o||O.current||z().isPaused())return!1;let a=!0,s=e||{},d=!A[v]||!s.dedupe,p=()=>C?!O.current&&v===L.current&&R.current:v===L.current,g={isValidating:!1,isLoading:!1},f=()=>{$(g)},m=()=>{let e=A[v];e&&e[1]===r&&delete A[v]},b={isValidating:!0};c(G().data)&&(b.isLoading=!0);try{if(d&&($(b),n.loadingTimeout&&c(G().data)&&setTimeout(()=>{a&&p()&&z().onLoadingSlow(v,n)},n.loadingTimeout),A[v]=[o(x),P()]),[t,r]=A[v],t=await t,d&&setTimeout(m,n.dedupingInterval),!A[v]||A[v][1]!==r)return d&&p()&&z().onDiscarded(v),!1;g.error=l;let e=k[v];if(!c(e)&&(r<=e[0]||r<=e[1]||0===e[1]))return f(),d&&p()&&z().onDiscarded(v),!1;let s=G().data;g.data=i(s,t)?s:t,d&&p()&&z().onSuccess(t,v,n)}catch(n){m();let e=z(),{shouldRetryOnError:t}=e;!e.isPaused()&&(g.error=n,d&&p()&&(e.onError(n,v,e),(!0===t||u(t)&&t(n))&&H()&&e.onErrorRetry(n,v,e,e=>{let t=E[v];t&&t[0]&&t[0](F.ERROR_REVALIDATE_EVENT,e)},{retryCount:(s.retryCount||0)+1,dedupe:!0})))}return a=!1,f(),!0},[v,r]),ep=(0,o.useCallback)((...e)=>B(r,L.current,...e),[]);if(N(()=>{M.current=t,U.current=n,c(en)||(ea.current=en)}),N(()=>{if(!v)return;let e=ed.bind(l,J),t=0,n=X(v,E,(n,r={})=>{if(n==F.FOCUS_EVENT){let n=Date.now();z().revalidateOnFocus&&n>t&&H()&&(t=n+z().focusThrottleInterval,e())}else if(n==F.RECONNECT_EVENT)z().revalidateOnReconnect&&H()&&e();else if(n==F.MUTATE_EVENT)return ed();else if(n==F.ERROR_REVALIDATE_EVENT)return ed(r)});return O.current=!1,L.current=v,R.current=!0,$({_k:x}),el&&(c(er)||_?e():I(e)),()=>{O.current=!0,n()}},[v]),N(()=>{let e;function t(){let t=u(m)?m(G().data):m;t&&-1!==e&&(e=setTimeout(n,t))}function n(){!G().error&&(h||z().isVisible())&&(y||z().isOnline())?ed(J).then(t):t()}return t(),()=>{e&&(clearTimeout(e),e=-1)}},[m,h,y,v]),(0,o.useDebugValue)(ei),s&&c(er)&&v){if(!C&&_)throw Error("Fallback data is required when using suspense in SSR.");M.current=t,U.current=n,O.current=!1;let e=T[v];if(!c(e)){let t=ep(e);Q(t)}if(c(eo)){let e=ed(J);c(ei)||(e.status="fulfilled",e.value=!0),Q(e)}else throw eo}return{mutate:ep,get data(){return V.data=!0,ei},get error(){return V.error=!0,eo},get isValidating(){return V.isValidating=!0,ec},get isLoading(){return V.isLoading=!0,eu}}},function(...e){let t=K(),[n,o,a]=Y(e),i=j(t,a),l=r,{use:s}=i,c=(s||[]).concat(Z);for(let e=c.length;e--;)l=c[e](l);return l(n,o||i.fetcher||null,i)});var et=(0,n(22776).k)("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),en={text:0,function_call:1,data:2},er=e=>{let t=e.indexOf(":"),n=e.slice(0,t),r=Object.keys(en).find(e=>en[e]===Number(n)),o=e.slice(t+1),a=o;if(!o)return{type:r,value:""};try{a=JSON.parse(o)}catch(e){console.error("Failed to parse JSON value:",o)}return{type:r,value:a}},eo=async(e,t,n,r,o,a,i,l,s,c,u)=>{var d,p;let g=i.current;n(t.messages,!1);let f=await fetch(e,{method:"POST",body:JSON.stringify({messages:u?t.messages:t.messages.map(({role:e,content:t,name:n,function_call:r})=>({role:e,content:t,...void 0!==n&&{name:n},...void 0!==r&&{function_call:r}})),...a.current.body,...null==(d=t.options)?void 0:d.body,...void 0!==t.functions&&{functions:t.functions},...void 0!==t.function_call&&{function_call:t.function_call}}),credentials:a.current.credentials,headers:{...a.current.headers,...null==(p=t.options)?void 0:p.headers},...null!==l.current&&{signal:l.current.signal}}).catch(e=>{throw n(g,!1),e});if(c)try{await c(f)}catch(e){throw e}if(!f.ok)throw n(g,!1),Error(await f.text()||"Failed to fetch the chat response.");if(!f.body)throw Error("The response body is empty.");let m="true"===f.headers.get("X-Experimental-Stream-Data"),b=new Date,h=f.body.getReader(),y=function(e){let t=new TextDecoder;return e?function(e){let n=t.decode(e,{stream:!0}).split("\n");return n.map(er).filter(Boolean)}:function(e){return e?t.decode(e,{stream:!0}):""}}(m),S=[],E=[],k={},A=[],w=0;if(m){for(;;){let{value:e}=await h.read();if(e&&(A.push(e),w+=e.length,10!==e[e.length-1]))continue;if(0===A.length)break;let a=new Uint8Array(w),i=0;for(let e of A)a.set(e,i),i+=e.length;A.length=0,w=0;let s=y(a);if("string"==typeof s)throw Error("Invalid response format. Complex mode was set but the response is a string. This should never happen.");for(let{type:e,value:a}of s){"text"===e&&(k.text?k.text={...k.text,content:(k.text.content||"")+a}:k.text={id:et(),role:"assistant",content:a,createdAt:b});let i=null;if("function_call"===e){k.function_call=a;let e=k.function_call;if(e&&"string"==typeof e){let t=JSON.parse(e).function_call;i={id:et(),role:"assistant",content:"",function_call:t,name:t.name,createdAt:b},k.function_call=i}}if("data"===e){let e=JSON.parse(a);k.data?k.data=[...k.data,...e]:k.data=e}let s=k.data,c=k.text,u=[i,c].filter(Boolean);if(n([...t.messages,...u],!1),r([...o||[],...s||[]],!1),null===l.current){h.cancel();break}}}for(let[e,t]of Object.entries(k))s&&"text"===e&&s(t),"data"===e?E.push(t):S.push(t);return{messages:S,data:E}}{let e="",r=et(),o={id:r,createdAt:b,content:"",role:"assistant"};for(;;){let{done:r,value:a}=await h.read();if(r)break;if((e+=y(a)).startsWith('{"function_call":')?o.function_call=e:o.content=e,n([...t.messages,{...o}],!1),null===l.current){h.cancel();break}}if(e.startsWith('{"function_call":')){let r=JSON.parse(e).function_call;o.function_call=r,n([...t.messages,{...o}])}return s&&s(o),o}};function ea({api:e="/api/chat",id:t,initialMessages:n=[],initialInput:r="",sendExtraMessageFields:a,experimental_onFunctionCall:i,onResponse:l,onFinish:s,onError:c,credentials:u,headers:d,body:p}={}){let g=(0,o.useId)(),f=t||g,{data:m,mutate:b}=ee([e,f],null,{fallbackData:n}),{data:h=!1,mutate:y}=ee([f,"loading"],null),{data:S,mutate:E}=ee([f,"streamData"],null),k=(0,o.useRef)(m||[]);(0,o.useEffect)(()=>{k.current=m||[]},[m]);let A=(0,o.useRef)(null),w=(0,o.useRef)({credentials:u,headers:d,body:p});(0,o.useEffect)(()=>{w.current={credentials:u,headers:d,body:p}},[u,d,p]);let[T,v]=(0,o.useState)(),x=(0,o.useCallback)(async t=>{try{y(!0),v(void 0);let n=new AbortController;for(A.current=n;;){let n=await eo(e,t,b,E,S,w,k,A,s,l,a);if("messages"in n){let e=!1;for(let r of n.messages)if(void 0!==r.function_call&&"string"!=typeof r.function_call&&(e=!0,i)){let e=r.function_call,n=await i(k.current,e);if(void 0===n)break;t=n}if(!e)break}else{if(void 0===n.function_call||"string"==typeof n.function_call)break;if(i){let e=n.function_call,r=await i(k.current,e);if(void 0===r)break;t=r}}}A.current=null}catch(e){if("AbortError"===e.name)return A.current=null,null;c&&e instanceof Error&&c(e),v(e)}finally{y(!1)}},[b,y,e,w,l,s,c,v,E,S,a,i,k.current,A.current]),R=(0,o.useCallback)(async(e,{options:t,functions:n,function_call:r}={})=>{e.id||(e.id=et());let o={messages:k.current.concat(e),options:t,...void 0!==n&&{functions:n},...void 0!==r&&{function_call:r}};return x(o)},[x]),C=(0,o.useCallback)(async({options:e,functions:t,function_call:n}={})=>{if(0===k.current.length)return null;let r=k.current[k.current.length-1];if("assistant"===r.role){let r={messages:k.current.slice(0,-1),options:e,...void 0!==t&&{functions:t},...void 0!==n&&{function_call:n}};return x(r)}let o={messages:k.current,options:e,...void 0!==t&&{functions:t},...void 0!==n&&{function_call:n}};return x(o)},[x]),_=(0,o.useCallback)(()=>{A.current&&(A.current.abort(),A.current=null)},[]),I=(0,o.useCallback)(e=>{b(e,!1),k.current=e},[b]),[N,O]=(0,o.useState)(r),L=(0,o.useCallback)((e,{options:t,functions:n,function_call:r}={},o)=>{o&&(w.current={...w.current,...o}),e.preventDefault(),N&&(R({content:N,role:"user",createdAt:new Date},{options:t,functions:n,function_call:r}),O(""))},[N,R]);return{messages:m||[],error:T,append:R,reload:C,stop:_,setMessages:I,input:N,setInput:O,handleInputChange:e=>{O(e.target.value)},handleSubmit:L,isLoading:h,data:S}}},63034:function(e,t,n){"use strict";n.d(t,{T:function(){return o}});let r=document.createElement("i");function o(e){let t="&"+e+";";r.innerHTML=t;let n=r.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}},57785:function(e,t,n){"use strict";function r(e){if(!e._compiled){let t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}n.d(t,{T:function(){return r}})},62848:function(e,t,n){"use strict";n.d(t,{T:function(){return a}});var r=n(57785);function o(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r=f)&&(!(e+1a?0:a+t:t>a?a:t,n=n>0?n:0,r.length<1e4)(o=Array.from(r)).unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i0?(r(e,e.length,0,t),e):t}n.d(t,{V:function(){return o},d:function(){return r}})},75786:function(e,t,n){"use strict";n.d(t,{r:function(){return o}});var r=n(82659);function o(e){return null===e||(0,r.z3)(e)||(0,r.B8)(e)?1:(0,r.Xh)(e)?2:void 0}},6361:function(e,t,n){"use strict";n.d(t,{W:function(){return a}});var r=n(58180);let o={}.hasOwnProperty;function a(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCharCode(n)}n.d(t,{o:function(){return r}})},11559:function(e,t,n){"use strict";n.d(t,{v:function(){return i}});var r=n(63034),o=n(43012);let a=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function i(e){return e.replace(a,l)}function l(e,t,n){if(t)return t;let a=n.charCodeAt(0);if(35===a){let e=n.charCodeAt(1),t=120===e||88===e;return(0,o.o)(n.slice(t?2:1),t?16:10)}return(0,r.T)(n)||e}},93575:function(e,t,n){"use strict";function r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}n.d(t,{d:function(){return r}})},80594:function(e,t,n){"use strict";function r(e,t,n){let r=[],o=-1;for(;++o{let r;if(!d&&b)return r=function(e,t,n={},r=s){if(void 0===window.IntersectionObserver&&void 0!==r){let o=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:o,intersectionRect:o,rootBounds:o}),()=>{}}let{id:o,observer:c,elements:u}=function(e){let t=Object.keys(e).sort().filter(t=>void 0!==e[t]).map(t=>{var n;return`${t}_${"root"===t?(n=e.root)?(i.has(n)||(l+=1,i.set(n,l.toString())),i.get(n)):"0":e[t]}`}).toString(),n=a.get(t);if(!n){let r;let o=new Map,i=new IntersectionObserver(t=>{t.forEach(t=>{var n;let a=t.isIntersecting&&r.some(e=>t.intersectionRatio>=e);e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=a),null==(n=o.get(t.target))||n.forEach(e=>{e(a,t)})})},e);r=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:i,elements:o},a.set(t,n)}return n}(n),d=u.get(e)||[];return u.has(e)||u.set(e,d),d.push(t),c.observe(e),function(){d.splice(d.indexOf(t),1),0===d.length&&(u.delete(e),c.unobserve(e)),0===u.size&&(c.disconnect(),a.delete(o))}}(b,(e,t)=>{E({inView:e,entry:t}),y.current&&y.current(e,t),t.isIntersecting&&u&&r&&(r(),r=void 0)},{root:c,rootMargin:o,threshold:e,trackVisibility:n,delay:t},g),()=>{r&&r()}},[Array.isArray(e)?e.toString():e,b,c,o,u,d,n,g,t]);let k=null==(m=S.entry)?void 0:m.target,A=r.useRef();b||!k||u||d||A.current===k||(A.current=k,E({inView:!!p,entry:void 0}));let w=[h,S.inView,S.entry];return w.ref=w[0],w.inView=w[1],w.entry=w[2],w}r.Component},19349:function(e,t,n){"use strict";n.d(t,{D:function(){return tJ}});var r={};n.r(r),n.d(r,{attentionMarkers:function(){return ez},contentInitial:function(){return eD},disable:function(){return eH},document:function(){return eL},flow:function(){return eP},flowInitial:function(){return eM},insideSpan:function(){return eU},string:function(){return eF},text:function(){return eB}});var o={};n.r(o),n.d(o,{boolean:function(){return tf},booleanish:function(){return tm},commaOrSpaceSeparated:function(){return tE},commaSeparated:function(){return tS},number:function(){return th},overloadedBoolean:function(){return tb},spaceSeparated:function(){return ty}});var a=n(2265),i=n(69934);function l(e){return e&&"object"==typeof e?"position"in e||"type"in e?c(e.position):"start"in e||"end"in e?c(e):"line"in e||"column"in e?s(e):"":""}function s(e){return u(e&&e.line)+":"+u(e&&e.column)}function c(e){return s(e&&e.start)+"-"+s(e&&e.end)}function u(e){return e&&"number"==typeof e?e:1}class d extends Error{constructor(e,t,n){let r=[null,null],o={start:{line:null,column:null},end:{line:null,column:null}};if(super(),"string"==typeof t&&(n=t,t=void 0),"string"==typeof n){let e=n.indexOf(":");-1===e?r[1]=n:(r[0]=n.slice(0,e),r[1]=n.slice(e+1))}t&&("type"in t||"position"in t?t.position&&(o=t.position):"start"in t||"end"in t?o=t:("line"in t||"column"in t)&&(o.start=t)),this.name=l(t)||"1:1",this.message="object"==typeof e?e.message:e,this.stack="","object"==typeof e&&e.stack&&(this.stack=e.stack),this.reason=this.message,this.fatal,this.line=o.start.line,this.column=o.start.column,this.position=o,this.source=r[0],this.ruleId=r[1],this.file,this.actual,this.expected,this.url,this.note}}d.prototype.file="",d.prototype.name="",d.prototype.reason="",d.prototype.message="",d.prototype.stack="",d.prototype.fatal=null,d.prototype.column=null,d.prototype.line=null,d.prototype.source=null,d.prototype.ruleId=null,d.prototype.position=null;let p={basename:function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');g(e);let r=0,o=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.charCodeAt(a)){if(n){r=a+1;break}}else o<0&&(n=!0,o=a+1);return o<0?"":e.slice(r,o)}if(t===e)return"";let i=-1,l=t.length-1;for(;a--;)if(47===e.charCodeAt(a)){if(n){r=a+1;break}}else i<0&&(n=!0,i=a+1),l>-1&&(e.charCodeAt(a)===t.charCodeAt(l--)?l<0&&(o=a):(l=-1,o=i));return r===o?o=i:o<0&&(o=e.length),e.slice(r,o)},dirname:function(e){let t;if(g(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.charCodeAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.charCodeAt(0)?"/":".":1===n&&47===e.charCodeAt(0)?"//":e.slice(0,n)},extname:function(e){let t;g(e);let n=e.length,r=-1,o=0,a=-1,i=0;for(;n--;){let l=e.charCodeAt(n);if(47===l){if(t){o=n+1;break}continue}r<0&&(t=!0,r=n+1),46===l?a<0?a=n:1!==i&&(i=1):a>-1&&(i=-1)}return a<0||r<0||0===i||1===i&&a===r-1&&a===o+1?"":e.slice(a,r)},join:function(...e){let t,n=-1;for(;++n2){if((r=o.lastIndexOf("/"))!==o.length-1){r<0?(o="",a=0):a=(o=o.slice(0,r)).length-1-o.lastIndexOf("/"),i=s,l=0;continue}}else if(o.length>0){o="",a=0,i=s,l=0;continue}}t&&(o=o.length>0?o+"/..":"..",a=2)}else o.length>0?o+="/"+e.slice(i+1,s):o=e.slice(i+1,s),a=s-i-1;i=s,l=0}else 46===n&&l>-1?l++:l=-1}return o}(e,!t);return 0!==n.length||t||(n="."),n.length>0&&47===e.charCodeAt(e.length-1)&&(n+="/"),t?"/"+n:n}(t)},sep:"/"};function g(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function f(e){return null!==e&&"object"==typeof e&&e.href&&e.origin}let m=["history","path","basename","stem","extname","dirname"];class b{constructor(e){let t,n;t=e?"string"==typeof e||i(e)?{value:e}:f(e)?{path:e}:e:{},this.data={},this.messages=[],this.history=[],this.cwd="/",this.value,this.stored,this.result,this.map;let r=-1;for(;++rt.length;i&&t.push(r);try{a=e.apply(this,t)}catch(e){if(i&&n)throw e;return r(e)}i||(a instanceof Promise?a.then(o,r):a instanceof Error?r(a):o(a))};function r(e,...o){n||(n=!0,t(e,...o))}function o(e){r(null,e)}})(l,o)(...i):r(null,...i)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}(),r=[],o={},a=-1;return l.data=function(e,n){return"string"==typeof e?2==arguments.length?(C("data",t),o[e]=n,l):T.call(o,e)&&o[e]||null:e?(C("data",t),o=e,l):o},l.Parser=void 0,l.Compiler=void 0,l.freeze=function(){if(t)return l;for(;++a{if(!e&&t&&n){let r=l.stringify(t,n);null==r||("string"==typeof r||i(r)?n.value=r:n.result=r),a(e,n)}else a(e)})}n(null,t)},l.processSync=function(e){let t;l.freeze(),x("processSync",l.Parser),R("processSync",l.Compiler);let n=N(e);return l.process(n,function(e){t=!0,E(e)}),I("processSync","process",t),n},l;function l(){let t=e(),n=-1;for(;++nr))return;let l=o.events.length,s=l;for(;s--;)if("exit"===o.events[s][0]&&"chunkFlow"===o.events[s][1].type){if(e){n=o.events[s][1].end;break}e=!0}for(b(i),a=l;at;){let t=a[n];o.containerState=t[1],t[0].exit.call(o,e)}a.length=t}function h(){t.write([null]),n=void 0,t=void 0,o.containerState._closeFlow=void 0}}},H={tokenize:function(e,t,n){return(0,P.f)(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};var G=n(56833);function $(e){let t,n,r,o,a,i,l;let s={},c=-1;for(;++c=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}},partial:!0},V={tokenize:function(e){let t=this,n=e.attempt(G.w,function(r){if(null===r){e.consume(r);return}return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,(0,P.f)(e,e.attempt(this.parser.constructs.flow,r,e.attempt(j,r)),"linePrefix")));return n;function r(r){if(null===r){e.consume(r);return}return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n}}},q={resolveAll:X()},Y=Z("string"),K=Z("text");function Z(e){return{tokenize:function(t){let n=this,r=this.parser.constructs[e],o=t.attempt(r,a,i);return a;function a(e){return s(e)?o(e):i(e)}function i(e){if(null===e){t.consume(e);return}return t.enter("data"),t.consume(e),l}function l(e){return s(e)?(t.exit("data"),o(e)):(t.consume(e),l)}function s(e){if(null===e)return!0;let t=r[e],o=-1;if(t)for(;++o=3&&(null===i||(0,F.Ch)(i))?(e.exit("thematicBreak"),t(i)):n(i)}(a)}}},et={name:"list",tokenize:function(e,t,n){let r=this,o=r.events[r.events.length-1],a=o&&"linePrefix"===o[1].type?o[2].sliceSerialize(o[1],!0).length:0,i=0;return function(t){let o=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===o?!r.containerState.marker||t===r.containerState.marker:(0,F.pY)(t)){if(r.containerState.type||(r.containerState.type=o,e.enter(o,{_container:!0})),"listUnordered"===o)return e.enter("listItemPrefix"),42===t||45===t?e.check(ee,n,l)(t):l(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(o){return(0,F.pY)(o)&&++i<10?(e.consume(o),t):(!r.interrupt||i<2)&&(r.containerState.marker?o===r.containerState.marker:41===o||46===o)?(e.exit("listItemValue"),l(o)):n(o)}(t)}return n(t)};function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(G.w,r.interrupt?n:s,e.attempt(en,u,c))}function s(e){return r.containerState.initialBlankLine=!0,a++,u(e)}function c(t){return(0,F.xz)(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}},continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(G.w,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,(0,P.f)(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!(0,F.xz)(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(er,t,o)(n))});function o(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,(0,P.f)(e,e.attempt(et,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}},exit:function(e){e.exit(this.containerState.type)}},en={tokenize:function(e,t,n){let r=this;return(0,P.f)(e,function(e){let o=r.events[r.events.length-1];return!(0,F.xz)(e)&&o&&"listItemPrefixWhitespace"===o[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)},partial:!0},er={tokenize:function(e,t,n){let r=this;return(0,P.f)(e,function(e){let o=r.events[r.events.length-1];return o&&"listItemIndent"===o[1].type&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)},partial:!0},eo={name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),o}return n(t)};function o(n){return(0,F.xz)(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}},continuation:{tokenize:function(e,t,n){let r=this;return function(t){return(0,F.xz)(t)?(0,P.f)(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):o(t)};function o(r){return e.attempt(eo,t,n)(r)}}},exit:function(e){e.exit("blockQuote")}};function ea(e,t,n,r,o,a,i,l,s){let c=s||Number.POSITIVE_INFINITY,u=0;return function(t){return 60===t?(e.enter(r),e.enter(o),e.enter(a),e.consume(t),e.exit(a),d):null===t||32===t||41===t||(0,F.Av)(t)?n(t):(e.enter(r),e.enter(i),e.enter(l),e.enter("chunkString",{contentType:"string"}),f(t))};function d(n){return 62===n?(e.enter(a),e.consume(n),e.exit(a),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(n))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(l),d(t)):null===t||60===t||(0,F.Ch)(t)?n(t):(e.consume(t),92===t?g:p)}function g(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function f(o){return!u&&(null===o||41===o||(0,F.z3)(o))?(e.exit("chunkString"),e.exit(l),e.exit(i),e.exit(r),t(o)):u999||null===d||91===d||93===d&&!i||94===d&&!s&&"_hiddenFootnoteSupport"in l.parser.constructs?n(d):93===d?(e.exit(a),e.enter(o),e.consume(d),e.exit(o),e.exit(r),t):(0,F.Ch)(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||(0,F.Ch)(t)||s++>999?(e.exit("chunkString"),c(t)):(e.consume(t),i||(i=!(0,F.xz)(t)),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),s++,u):u(t)}}function el(e,t,n,r,o,a){let i;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(o),e.consume(t),e.exit(o),i=40===t?41:t,l):n(t)};function l(n){return n===i?(e.enter(o),e.consume(n),e.exit(o),e.exit(r),t):(e.enter(a),s(n))}function s(t){return t===i?(e.exit(a),l(i)):null===t?n(t):(0,F.Ch)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),(0,P.f)(e,s,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===i||null===t||(0,F.Ch)(t)?(e.exit("chunkString"),s(t)):(e.consume(t),92===t?u:c)}function u(t){return t===i||92===t?(e.consume(t),c):c(t)}}function es(e,t){let n;return function r(o){return(0,F.Ch)(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):(0,F.xz)(o)?(0,P.f)(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}var ec=n(93575);let eu={tokenize:function(e,t,n){return function(t){return(0,F.z3)(t)?es(e,r)(t):n(t)};function r(t){return el(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function o(t){return(0,F.xz)(t)?(0,P.f)(e,a,"whitespace")(t):a(t)}function a(e){return null===e||(0,F.Ch)(e)?t(e):n(e)}},partial:!0},ed={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),(0,P.f)(e,o,"linePrefix",5)(t)};function o(t){let o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?function t(n){return null===n?a(n):(0,F.Ch)(n)?e.attempt(ep,t,a)(n):(e.enter("codeFlowValue"),function n(r){return null===r||(0,F.Ch)(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function a(n){return e.exit("codeIndented"),t(n)}}},ep={tokenize:function(e,t,n){let r=this;return o;function o(t){return r.parser.lazy[r.now().line]?n(t):(0,F.Ch)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):(0,P.f)(e,a,"linePrefix",5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):(0,F.Ch)(e)?o(e):n(e)}},partial:!0},eg={name:"setextUnderline",tokenize:function(e,t,n){let r;let o=this;return function(t){let i,l=o.events.length;for(;l--;)if("lineEnding"!==o.events[l][1].type&&"linePrefix"!==o.events[l][1].type&&"content"!==o.events[l][1].type){i="paragraph"===o.events[l][1].type;break}return!o.parser.lazy[o.now().line]&&(o.interrupt||i)?(e.enter("setextHeadingLine"),r=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),(0,F.xz)(n)?(0,P.f)(e,a,"lineSuffix")(n):a(n))}(t)):n(t)};function a(r){return null===r||(0,F.Ch)(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}},resolveTo:function(e,t){let n,r,o,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){n=a;break}"paragraph"===e[a][1].type&&(r=a)}else"content"===e[a][1].type&&e.splice(a,1),o||"definition"!==e[a][1].type||(o=a);let i={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[r][1].type="setextHeadingText",o?(e.splice(r,0,["enter",i,t]),e.splice(o+1,0,["exit",e[n][1],t]),e[n][1].end=Object.assign({},e[o][1].end)):e[n][1]=i,e.push(["exit",i,t]),e}},ef=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],em=["pre","script","style","textarea"],eb={tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(G.w,t,n)}},partial:!0},eh={tokenize:function(e,t,n){let r=this;return function(t){return(0,F.Ch)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):n(t)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},ey={tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},eS={name:"codeFenced",tokenize:function(e,t,n){let r;let o=this,a={tokenize:function(e,t,n){let a=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i};function i(t){return e.enter("codeFencedFence"),(0,F.xz)(t)?(0,P.f)(e,s,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):s(t)}function s(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(o){return o===r?(a++,e.consume(o),t):a>=l?(e.exit("codeFencedFenceSequence"),(0,F.xz)(o)?(0,P.f)(e,c,"whitespace")(o):c(o)):n(o)}(t)):n(t)}function c(r){return null===r||(0,F.Ch)(r)?(e.exit("codeFencedFence"),t(r)):n(r)}},partial:!0},i=0,l=0;return function(t){return function(t){let a=o.events[o.events.length-1];return i=a&&"linePrefix"===a[1].type?a[2].sliceSerialize(a[1],!0).length:0,r=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(o){return o===r?(l++,e.consume(o),t):l<3?n(o):(e.exit("codeFencedFenceSequence"),(0,F.xz)(o)?(0,P.f)(e,s,"whitespace")(o):s(o))}(t)}(t)};function s(a){return null===a||(0,F.Ch)(a)?(e.exit("codeFencedFence"),o.interrupt?t(a):e.check(ey,u,f)(a)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(o){return null===o||(0,F.Ch)(o)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),s(o)):(0,F.xz)(o)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),(0,P.f)(e,c,"whitespace")(o)):96===o&&o===r?n(o):(e.consume(o),t)}(a))}function c(t){return null===t||(0,F.Ch)(t)?s(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(o){return null===o||(0,F.Ch)(o)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),s(o)):96===o&&o===r?n(o):(e.consume(o),t)}(t))}function u(t){return e.attempt(a,f,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p}function p(t){return i>0&&(0,F.xz)(t)?(0,P.f)(e,g,"linePrefix",i+1)(t):g(t)}function g(t){return null===t||(0,F.Ch)(t)?e.check(ey,u,f)(t):(e.enter("codeFlowValue"),function t(n){return null===n||(0,F.Ch)(n)?(e.exit("codeFlowValue"),g(n)):(e.consume(n),t)}(t))}function f(n){return e.exit("codeFenced"),t(n)}},concrete:!0};var eE=n(63034);let ek={name:"characterReference",tokenize:function(e,t,n){let r,o;let a=this,i=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),l};function l(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),s):(e.enter("characterReferenceValue"),r=31,o=F.H$,c(t))}function s(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,o=F.AF,c):(e.enter("characterReferenceValue"),r=7,o=F.pY,c(t))}function c(l){if(59===l&&i){let r=e.exit("characterReferenceValue");return o!==F.H$||(0,eE.T)(a.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(l)}return o(l)&&i++1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;let d=Object.assign({},e[n][1].end),p=Object.assign({},e[u][1].start);eN(d,-l),eN(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},e[n][1].end)},i={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[u][1].start),end:p},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[u][1].start)},r={type:l>1?"strong":"emphasis",start:Object.assign({},a.start),end:Object.assign({},i.end)},e[n][1].end=Object.assign({},a.start),e[u][1].start=Object.assign({},i.end),s=[],e[n][1].end.offset-e[n][1].start.offset&&(s=(0,U.V)(s,[["enter",e[n][1],t],["exit",e[n][1],t]])),s=(0,U.V)(s,[["enter",r,t],["enter",a,t],["exit",a,t],["enter",o,t]]),s=(0,U.V)(s,(0,J.C)(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),s=(0,U.V)(s,[["exit",o,t],["enter",i,t],["exit",i,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,s=(0,U.V)(s,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,(0,U.d)(e,n-1,u-n+3,s),u=n+s.length-c-2;break}}for(u=-1;++ua&&"whitespace"===e[o][1].type&&(o-=2),"atxHeadingSequence"===e[o][1].type&&(a===o-1||o-4>a&&"whitespace"===e[o-2][1].type)&&(o-=a+1===o?2:4),o>a&&(n={type:"atxHeadingText",start:e[a][1].start,end:e[o][1].end},r={type:"chunkText",start:e[a][1].start,end:e[o][1].end,contentType:"text"},(0,U.d)(e,a,o-a+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e}},42:ee,45:[eg,ee],60:{name:"htmlFlow",tokenize:function(e,t,n){let r,o,a,i,l;let s=this;return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c};function c(i){return 33===i?(e.consume(i),u):47===i?(e.consume(i),o=!0,g):63===i?(e.consume(i),r=3,s.interrupt?t:O):(0,F.jv)(i)?(e.consume(i),a=String.fromCharCode(i),f):n(i)}function u(o){return 45===o?(e.consume(o),r=2,d):91===o?(e.consume(o),r=5,i=0,p):(0,F.jv)(o)?(e.consume(o),r=4,s.interrupt?t:O):n(o)}function d(r){return 45===r?(e.consume(r),s.interrupt?t:O):n(r)}function p(r){let o="CDATA[";return r===o.charCodeAt(i++)?(e.consume(r),i===o.length)?s.interrupt?t:T:p:n(r)}function g(t){return(0,F.jv)(t)?(e.consume(t),a=String.fromCharCode(t),f):n(t)}function f(i){if(null===i||47===i||62===i||(0,F.z3)(i)){let l=47===i,c=a.toLowerCase();return!l&&!o&&em.includes(c)?(r=1,s.interrupt?t(i):T(i)):ef.includes(a.toLowerCase())?(r=6,l)?(e.consume(i),m):s.interrupt?t(i):T(i):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(i):o?function t(n){return(0,F.xz)(n)?(e.consume(n),t):A(n)}(i):b(i))}return 45===i||(0,F.H$)(i)?(e.consume(i),a+=String.fromCharCode(i),f):n(i)}function m(r){return 62===r?(e.consume(r),s.interrupt?t:T):n(r)}function b(t){return 47===t?(e.consume(t),A):58===t||95===t||(0,F.jv)(t)?(e.consume(t),h):(0,F.xz)(t)?(e.consume(t),b):A(t)}function h(t){return 45===t||46===t||58===t||95===t||(0,F.H$)(t)?(e.consume(t),h):y(t)}function y(t){return 61===t?(e.consume(t),S):(0,F.xz)(t)?(e.consume(t),y):b(t)}function S(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,E):(0,F.xz)(t)?(e.consume(t),S):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||(0,F.z3)(n)?y(n):(e.consume(n),t)}(t)}function E(t){return t===l?(e.consume(t),l=null,k):null===t||(0,F.Ch)(t)?n(t):(e.consume(t),E)}function k(e){return 47===e||62===e||(0,F.xz)(e)?b(e):n(e)}function A(t){return 62===t?(e.consume(t),w):n(t)}function w(t){return null===t||(0,F.Ch)(t)?T(t):(0,F.xz)(t)?(e.consume(t),w):n(t)}function T(t){return 45===t&&2===r?(e.consume(t),C):60===t&&1===r?(e.consume(t),_):62===t&&4===r?(e.consume(t),L):63===t&&3===r?(e.consume(t),O):93===t&&5===r?(e.consume(t),N):(0,F.Ch)(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(eb,D,v)(t)):null===t||(0,F.Ch)(t)?(e.exit("htmlFlowData"),v(t)):(e.consume(t),T)}function v(t){return e.check(eh,x,D)(t)}function x(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),R}function R(t){return null===t||(0,F.Ch)(t)?v(t):(e.enter("htmlFlowData"),T(t))}function C(t){return 45===t?(e.consume(t),O):T(t)}function _(t){return 47===t?(e.consume(t),a="",I):T(t)}function I(t){if(62===t){let n=a.toLowerCase();return em.includes(n)?(e.consume(t),L):T(t)}return(0,F.jv)(t)&&a.length<8?(e.consume(t),a+=String.fromCharCode(t),I):T(t)}function N(t){return 93===t?(e.consume(t),O):T(t)}function O(t){return 62===t?(e.consume(t),L):45===t&&2===r?(e.consume(t),O):T(t)}function L(t){return null===t||(0,F.Ch)(t)?(e.exit("htmlFlowData"),D(t)):(e.consume(t),L)}function D(n){return e.exit("htmlFlow"),t(n)}},resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},concrete:!0},61:eg,95:ee,96:eS,126:eS},eF={38:ek,92:eA},eB={[-5]:ew,[-4]:ew,[-3]:ew,33:eC,38:ek,42:eI,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o};function o(t){return(0,F.jv)(t)?(e.consume(t),a):l(t)}function a(t){return 43===t||45===t||46===t||(0,F.H$)(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,i):(43===n||45===n||46===n||(0,F.H$)(n))&&r++<32?(e.consume(n),t):(r=0,l(n))}(t)):l(t)}function i(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||(0,F.Av)(r)?n(r):(e.consume(r),i)}function l(t){return 64===t?(e.consume(t),s):(0,F.n9)(t)?(e.consume(t),l):n(t)}function s(o){return(0,F.H$)(o)?function o(a){return 46===a?(e.consume(a),r=0,s):62===a?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(a),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(a){if((45===a||(0,F.H$)(a))&&r++<63){let n=45===a?t:o;return e.consume(a),n}return n(a)}(a)}(o):n(o)}}},{name:"htmlText",tokenize:function(e,t,n){let r,o,a;let i=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),l};function l(t){return 33===t?(e.consume(t),s):47===t?(e.consume(t),E):63===t?(e.consume(t),y):(0,F.jv)(t)?(e.consume(t),A):n(t)}function s(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),o=0,g):(0,F.jv)(t)?(e.consume(t),h):n(t)}function c(t){return 45===t?(e.consume(t),p):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):(0,F.Ch)(t)?(a=u,I(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),p):u(t)}function p(e){return 62===e?_(e):45===e?d(e):u(e)}function g(t){let r="CDATA[";return t===r.charCodeAt(o++)?(e.consume(t),o===r.length?f:g):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):(0,F.Ch)(t)?(a=f,I(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),b):f(t)}function b(t){return 62===t?_(t):93===t?(e.consume(t),b):f(t)}function h(t){return null===t||62===t?_(t):(0,F.Ch)(t)?(a=h,I(t)):(e.consume(t),h)}function y(t){return null===t?n(t):63===t?(e.consume(t),S):(0,F.Ch)(t)?(a=y,I(t)):(e.consume(t),y)}function S(e){return 62===e?_(e):y(e)}function E(t){return(0,F.jv)(t)?(e.consume(t),k):n(t)}function k(t){return 45===t||(0,F.H$)(t)?(e.consume(t),k):function t(n){return(0,F.Ch)(n)?(a=t,I(n)):(0,F.xz)(n)?(e.consume(n),t):_(n)}(t)}function A(t){return 45===t||(0,F.H$)(t)?(e.consume(t),A):47===t||62===t||(0,F.z3)(t)?w(t):n(t)}function w(t){return 47===t?(e.consume(t),_):58===t||95===t||(0,F.jv)(t)?(e.consume(t),T):(0,F.Ch)(t)?(a=w,I(t)):(0,F.xz)(t)?(e.consume(t),w):_(t)}function T(t){return 45===t||46===t||58===t||95===t||(0,F.H$)(t)?(e.consume(t),T):function t(n){return 61===n?(e.consume(n),v):(0,F.Ch)(n)?(a=t,I(n)):(0,F.xz)(n)?(e.consume(n),t):w(n)}(t)}function v(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,x):(0,F.Ch)(t)?(a=v,I(t)):(0,F.xz)(t)?(e.consume(t),v):(e.consume(t),R)}function x(t){return t===r?(e.consume(t),r=void 0,C):null===t?n(t):(0,F.Ch)(t)?(a=x,I(t)):(e.consume(t),x)}function R(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||(0,F.z3)(t)?w(t):(e.consume(t),R)}function C(e){return 47===e||62===e||(0,F.z3)(e)?w(e):n(e)}function _(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function I(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),N}function N(t){return(0,F.xz)(t)?(0,P.f)(e,O,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):O(t)}function O(t){return e.enter("htmlTextData"),a(t)}}}],91:eO,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return(0,F.Ch)(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},eA],93:eT,95:eI,96:{name:"codeText",tokenize:function(e,t,n){let r,o,a=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),a++,t):(e.exit("codeTextSequence"),i(n))}(t)};function i(s){return null===s?n(s):32===s?(e.enter("space"),e.consume(s),e.exit("space"),i):96===s?(o=e.enter("codeTextSequence"),r=0,function n(i){return 96===i?(e.consume(i),r++,n):r===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(i)):(o.type="codeTextData",l(i))}(s)):(0,F.Ch)(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):(e.enter("codeTextData"),l(s))}function l(t){return null===t||32===t||96===t||(0,F.Ch)(t)?(e.exit("codeTextData"),i(t)):(e.consume(t),l)}},resolve:function(e){let t,n,r=e.length-4,o=3;if(("lineEnding"===e[3][1].type||"space"===e[o][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=o;++t0){let e=a.tokenStack[a.tokenStack.length-1],t=e[1]||eY;t.call(a,void 0,e[0])}for(n.position={start:eq(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:eq(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c-1){let e=n[0];"string"==typeof e?n[0]=e.slice(o):n.shift()}i>0&&n.push(e[a].slice(0,i))}return n}(i,e)}function p(){let{line:e,column:t,offset:n,_index:o,_bufferIndex:a}=r;return{line:e,column:t,offset:n,_index:o,_bufferIndex:a}}function g(e,t){t.restore()}function f(e,t){return function(n,o,a){let i,u,d,g;return Array.isArray(n)?f(n):"tokenize"in n?f([n]):function(e){let t=null!==e&&n[e],r=null!==e&&n.null,o=[...Array.isArray(t)?t:t?[t]:[],...Array.isArray(r)?r:r?[r]:[]];return f(o)(e)};function f(e){return(i=e,u=0,0===e.length)?a:m(e[u])}function m(e){return function(n){return(g=function(){let e=p(),t=c.previous,n=c.currentConstruct,o=c.events.length,a=Array.from(l);return{restore:function(){r=e,c.previous=t,c.currentConstruct=n,c.events.length=o,l=a,b()},from:o}}(),d=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?y(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,s,h,y)(n)}}function h(t){return e(d,g),o}function y(e){return(g.restore(),++u{let n=this.data("settings");return eV(t,Object.assign({},n,e,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}function eZ(e){let t=[],n=-1,r=0,o=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(i=String.fromCharCode(a,t),o=1):i="�"}else i=String.fromCharCode(a);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+o+1,i=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}var eX=n(37462);let eQ=function(e,t,n,r){"function"==typeof t&&"function"!=typeof n&&(r=n,n=t,t=null),(0,eX.S4)(e,t,function(e,t){let r=t[t.length-1];return n(e,r?r.children.indexOf(e):null,r)},r)},eJ=e1("start"),e0=e1("end");function e1(e){return function(t){let n=t&&t.position&&t.position[e]||{};return{line:n.line||null,column:n.column||null,offset:n.offset>-1?n.offset:null}}}let e2={}.hasOwnProperty;function e3(e){return String(e||"").toUpperCase()}function e4(e,t){let n;let r=String(t.identifier).toUpperCase(),o=eZ(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);-1===a?(e.footnoteOrder.push(r),e.footnoteCounts[r]=1,n=e.footnoteOrder.length):(e.footnoteCounts[r]++,n=a+1);let i=e.footnoteCounts[r],l={type:"element",tagName:"a",properties:{href:"#"+e.clobberPrefix+"fn-"+o,id:e.clobberPrefix+"fnref-"+o+(i>1?"-"+i:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let s={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,s),e.applyData(t,s)}function e5(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return{type:"text",value:"!["+t.alt+r};let o=e.all(t),a=o[0];a&&"text"===a.type?a.value="["+a.value:o.unshift({type:"text",value:"["});let i=o[o.length-1];return i&&"text"===i.type?i.value+=r:o.push({type:"text",value:r}),o}function e9(e){let t=e.spread;return null==t?e.children.length>1:t}function e6(e,t,n){let r=0,o=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(o-1);for(;9===t||32===t;)o--,t=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}let e8={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r=t.lang?t.lang.match(/^[^ \t]+(?=[ \t]|$)/):null,o={};r&&(o.className=["language-"+r]);let a={type:"element",tagName:"code",properties:o,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a={type:"element",tagName:"pre",properties:{},children:[a=e.applyData(t,a)]},e.patch(t,a),a},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:e4,footnote:function(e,t){let n=e.footnoteById,r=1;for(;(r in n);)r++;let o=String(r);return n[o]={type:"footnoteDefinition",identifier:o,children:[{type:"paragraph",children:t.children}],position:t.position},e4(e,{type:"footnoteReference",identifier:o,position:t.position})},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.dangerous){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}return null},imageReference:function(e,t){let n=e.definition(t.identifier);if(!n)return e5(e,t);let r={src:eZ(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(r.title=n.title);let o={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function(e,t){let n={src:eZ(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=e.definition(t.identifier);if(!n)return e5(e,t);let r={href:eZ(n.url||"")};null!==n.title&&void 0!==n.title&&(r.title=n.title);let o={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function(e,t){let n={href:eZ(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),o=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let l=-1;for(;++l0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=eJ(t.children[1]),i=e0(t.children[t.children.length-1]);a.line&&i.line&&(r.position={start:a,end:i}),o.push(r)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,o=r?r.indexOf(t):1,a=0===o?"th":"td",i=n&&"table"===n.type?n.align:void 0,l=i?i.length:t.children.length,s=-1,c=[];for(;++s0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return a.push(e6(t.slice(o),o>0,!1)),a.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:e7,yaml:e7,definition:e7,footnoteDefinition:e7};function e7(){return null}let te={}.hasOwnProperty;function tt(e,t){e.position&&(t.position={start:eJ(e),end:e0(e)})}function tn(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,o=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:[]}),"element"===n.type&&o&&(n.properties={...n.properties,...o}),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function tr(e,t,n){let r=t&&t.type;if(!r)throw Error("Expected node, got `"+t+"`");return te.call(e.handlers,r)?e.handlers[r](e,t,n):e.passThrough&&e.passThrough.includes(r)?"children"in t?{...t,children:to(e,t)}:t:e.unknownHandler?e.unknownHandler(e,t,n):function(e,t){let n=t.data||{},r="value"in t&&!(te.call(n,"hProperties")||te.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:to(e,t)};return e.patch(t,r),e.applyData(t,r)}(e,t)}function to(e,t){let n=[];if("children"in t){let r=t.children,o=-1;for(;++o0&&n.push({type:"text",value:"\n"}),n}function ti(e,t){let n=function(e,t){let n=t||{},r=n.allowDangerousHtml||!1,o={};return i.dangerous=r,i.clobberPrefix=void 0===n.clobberPrefix||null===n.clobberPrefix?"user-content-":n.clobberPrefix,i.footnoteLabel=n.footnoteLabel||"Footnotes",i.footnoteLabelTagName=n.footnoteLabelTagName||"h2",i.footnoteLabelProperties=n.footnoteLabelProperties||{className:["sr-only"]},i.footnoteBackLabel=n.footnoteBackLabel||"Back to content",i.unknownHandler=n.unknownHandler,i.passThrough=n.passThrough,i.handlers={...e8,...n.handlers},i.definition=function(e){let t=Object.create(null);if(!e||!e.type)throw Error("mdast-util-definitions expected node");return eQ(e,"definition",e=>{let n=e3(e.identifier);n&&!e2.call(t,n)&&(t[n]=e)}),function(e){let n=e3(e);return n&&e2.call(t,n)?t[n]:null}}(e),i.footnoteById=o,i.footnoteOrder=[],i.footnoteCounts={},i.patch=tt,i.applyData=tn,i.one=function(e,t){return tr(i,e,t)},i.all=function(e){return to(i,e)},i.wrap=ta,i.augment=a,eQ(e,"footnoteDefinition",e=>{let t=String(e.identifier).toUpperCase();te.call(o,t)||(o[t]=e)}),i;function a(e,t){if(e&&"data"in e&&e.data){let n=e.data;n.hName&&("element"!==t.type&&(t={type:"element",tagName:"",properties:{},children:[]}),t.tagName=n.hName),"element"===t.type&&n.hProperties&&(t.properties={...t.properties,...n.hProperties}),"children"in t&&t.children&&n.hChildren&&(t.children=n.hChildren)}if(e){let n="type"in e?e:{position:e};!n||!n.position||!n.position.start||!n.position.start.line||!n.position.start.column||!n.position.end||!n.position.end.line||!n.position.end.column||(t.position={start:eJ(n),end:e0(n)})}return t}function i(e,t,n,r){return Array.isArray(n)&&(r=n,n={}),a(e,{type:"element",tagName:t,properties:n||{},children:r||[]})}}(e,t),r=n.one(e,null),o=function(e){let t=[],n=-1;for(;++n1?"-"+l:""),dataFootnoteBackref:!0,className:["data-footnote-backref"],ariaLabel:e.footnoteBackLabel},children:[{type:"text",value:"↩"}]};l>1&&t.children.push({type:"element",tagName:"sup",children:[{type:"text",value:String(l)}]}),s.length>0&&s.push({type:"text",value:" "}),s.push(t)}let c=o[o.length-1];if(c&&"element"===c.type&&"p"===c.tagName){let e=c.children[c.children.length-1];e&&"text"===e.type?e.value+=" ":c.children.push({type:"text",value:" "}),c.children.push(...s)}else o.push(...s);let u={type:"element",tagName:"li",properties:{id:e.clobberPrefix+"fn-"+i},children:e.wrap(o,!0)};e.patch(r,u),t.push(u)}if(0!==t.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:e.footnoteLabelTagName,properties:{...JSON.parse(JSON.stringify(e.footnoteLabelProperties)),id:"footnote-label"},children:[{type:"text",value:e.footnoteLabel}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(t,!0)},{type:"text",value:"\n"}]}}(n);return o&&r.children.push({type:"text",value:"\n"},o),Array.isArray(r)?{type:"root",children:r}:r}var tl=function(e,t){var n;return e&&"run"in e?(n,r,o)=>{e.run(ti(n,t),r,e=>{o(e)})}:(n=e||t,e=>ti(e,n))},ts=n(74275);class tc{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}}function tu(e,t){let n={},r={},o=-1;for(;++o"xlink:"+t.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),tR=tv({space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function tC(e,t){return t in e?e[t]:t}function t_(e,t){return tC(e,t.toLowerCase())}let tI=tv({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:t_,properties:{xmlns:null,xmlnsXLink:null}}),tN=tv({transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:tm,ariaAutoComplete:null,ariaBusy:tm,ariaChecked:tm,ariaColCount:th,ariaColIndex:th,ariaColSpan:th,ariaControls:ty,ariaCurrent:null,ariaDescribedBy:ty,ariaDetails:null,ariaDisabled:tm,ariaDropEffect:ty,ariaErrorMessage:null,ariaExpanded:tm,ariaFlowTo:ty,ariaGrabbed:tm,ariaHasPopup:null,ariaHidden:tm,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ty,ariaLevel:th,ariaLive:null,ariaModal:tm,ariaMultiLine:tm,ariaMultiSelectable:tm,ariaOrientation:null,ariaOwns:ty,ariaPlaceholder:null,ariaPosInSet:th,ariaPressed:tm,ariaReadOnly:tm,ariaRelevant:null,ariaRequired:tm,ariaRoleDescription:ty,ariaRowCount:th,ariaRowIndex:th,ariaRowSpan:th,ariaSelected:tm,ariaSetSize:th,ariaSort:null,ariaValueMax:th,ariaValueMin:th,ariaValueNow:th,ariaValueText:null,role:null}}),tO=tv({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:t_,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:tS,acceptCharset:ty,accessKey:ty,action:null,allow:null,allowFullScreen:tf,allowPaymentRequest:tf,allowUserMedia:tf,alt:null,as:null,async:tf,autoCapitalize:null,autoComplete:ty,autoFocus:tf,autoPlay:tf,blocking:ty,capture:tf,charSet:null,checked:tf,cite:null,className:ty,cols:th,colSpan:null,content:null,contentEditable:tm,controls:tf,controlsList:ty,coords:th|tS,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tf,defer:tf,dir:null,dirName:null,disabled:tf,download:tb,draggable:tm,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tf,formTarget:null,headers:ty,height:th,hidden:tf,high:th,href:null,hrefLang:null,htmlFor:ty,httpEquiv:ty,id:null,imageSizes:null,imageSrcSet:null,inert:tf,inputMode:null,integrity:null,is:null,isMap:tf,itemId:null,itemProp:ty,itemRef:ty,itemScope:tf,itemType:ty,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tf,low:th,manifest:null,max:null,maxLength:th,media:null,method:null,min:null,minLength:th,multiple:tf,muted:tf,name:null,nonce:null,noModule:tf,noValidate:tf,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:tf,optimum:th,pattern:null,ping:ty,placeholder:null,playsInline:tf,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tf,referrerPolicy:null,rel:ty,required:tf,reversed:tf,rows:th,rowSpan:th,sandbox:ty,scope:null,scoped:tf,seamless:tf,selected:tf,shape:null,size:th,sizes:null,slot:null,span:th,spellCheck:tm,src:null,srcDoc:null,srcLang:null,srcSet:null,start:th,step:null,style:null,tabIndex:th,target:null,title:null,translate:null,type:null,typeMustMatch:tf,useMap:null,value:tm,width:th,wrap:null,align:null,aLink:null,archive:ty,axis:null,background:null,bgColor:null,border:th,borderColor:null,bottomMargin:th,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tf,declare:tf,event:null,face:null,frame:null,frameBorder:null,hSpace:th,leftMargin:th,link:null,longDesc:null,lowSrc:null,marginHeight:th,marginWidth:th,noResize:tf,noHref:tf,noShade:tf,noWrap:tf,object:null,profile:null,prompt:null,rev:null,rightMargin:th,rules:null,scheme:null,scrolling:tm,standby:null,summary:null,text:null,topMargin:th,valueType:null,version:null,vAlign:null,vLink:null,vSpace:th,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tf,disableRemotePlayback:tf,prefix:null,property:null,results:th,security:null,unselectable:null}}),tL=tv({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:tC,properties:{about:tE,accentHeight:th,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:th,amplitude:th,arabicForm:null,ascent:th,attributeName:null,attributeType:null,azimuth:th,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:th,by:null,calcMode:null,capHeight:th,className:ty,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:th,diffuseConstant:th,direction:null,display:null,dur:null,divisor:th,dominantBaseline:null,download:tf,dx:null,dy:null,edgeMode:null,editable:null,elevation:th,enableBackground:null,end:null,event:null,exponent:th,externalResourcesRequired:null,fill:null,fillOpacity:th,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:tS,g2:tS,glyphName:tS,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:th,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:th,horizOriginX:th,horizOriginY:th,id:null,ideographic:th,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:th,k:th,k1:th,k2:th,k3:th,k4:th,kernelMatrix:tE,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:th,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:th,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:th,overlineThickness:th,paintOrder:null,panose1:null,path:null,pathLength:th,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ty,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:th,pointsAtY:th,pointsAtZ:th,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:tE,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:tE,rev:tE,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:tE,requiredFeatures:tE,requiredFonts:tE,requiredFormats:tE,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:th,specularExponent:th,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:th,strikethroughThickness:th,string:null,stroke:null,strokeDashArray:tE,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:th,strokeOpacity:th,strokeWidth:null,style:null,surfaceScale:th,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:tE,tabIndex:th,tableValues:null,target:null,targetX:th,targetY:th,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:tE,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:th,underlineThickness:th,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:th,values:null,vAlphabetic:th,vMathematical:th,vectorEffect:null,vHanging:th,vIdeographic:th,version:null,vertAdvY:th,vertOriginX:th,vertOriginY:th,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:th,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),tD=tu([tR,tx,tI,tN,tO],"html"),tM=tu([tR,tx,tI,tN,tL],"svg");function tP(e){if(e.allowedElements&&e.disallowedElements)throw TypeError("Only one of `allowedElements` and `disallowedElements` should be defined");if(e.allowedElements||e.disallowedElements||e.allowElement)return t=>{eQ(t,"element",(t,n,r)=>{let o;if(e.allowedElements?o=!e.allowedElements.includes(t.tagName):e.disallowedElements&&(o=e.disallowedElements.includes(t.tagName)),!o&&e.allowElement&&"number"==typeof n&&(o=!e.allowElement(t,n,r)),o&&"number"==typeof n)return e.unwrapDisallowed&&t.children?r.children.splice(n,1,...t.children):r.children.splice(n,1),n})}}var tF=n(9176);let tB=/^data[-\w.:]+$/i,tU=/-[a-z]/g,tz=/[A-Z]/g;function tH(e){return"-"+e.toLowerCase()}function tG(e){return e.charAt(1).toUpperCase()}let t$={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};var tj=n(48699);let tW=["http","https","mailto","tel"];function tV(e){let t=(e||"").trim(),n=t.charAt(0);if("#"===n||"/"===n)return t;let r=t.indexOf(":");if(-1===r)return t;let o=-1;for(;++oo||-1!==(o=t.indexOf("#"))&&r>o?t:"javascript:void(0)"}let tq={}.hasOwnProperty,tY=new Set(["table","thead","tbody","tfoot","tr"]);function tK(e,t){let n=-1,r=0;for(;++n for more info)`),delete tQ[t]}let t=w().use(eK).use(e.remarkPlugins||[]).use(tl,{...e.remarkRehypeOptions,allowDangerousHtml:!0}).use(e.rehypePlugins||[]).use(tP,e),n=new b;"string"==typeof e.children?n.value=e.children:void 0!==e.children&&null!==e.children&&console.warn(`[react-markdown] Warning: please pass a string as \`children\` (not: \`${e.children}\`)`);let r=t.runSync(t.parse(n),n);if("root"!==r.type)throw TypeError("Expected a `root` node");let o=a.createElement(a.Fragment,{},function e(t,n){let r;let o=[],i=-1;for(;++i4&&"data"===n.slice(0,4)&&tB.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(tU,tG);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!tU.test(e)){let n=e.replace(tz,tH);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}o=tw}return new o(r,t)}(r.schema,t),a=n;null!=a&&a==a&&(Array.isArray(a)&&(a=o.commaSeparated?function(e,t){let n={},r=""===e[e.length-1]?[...e,""]:e;return r.join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}(a):a.join(" ").trim()),"style"===o.property&&"string"==typeof a&&(a=function(e){let t={};try{tj(e,function(e,n){let r="-ms-"===e.slice(0,4)?`ms-${e.slice(4)}`:e;t[r.replace(/-([a-z])/g,tZ)]=n})}catch{}return t}(a)),o.space&&o.property?e[tq.call(t$,o.property)?t$[o.property]:o.property]=a:o.attribute&&(e[o.attribute]=a))}(d,i,n.properties[i],t);("ol"===u||"ul"===u)&&t.listDepth++;let g=e(t,n);("ol"===u||"ul"===u)&&t.listDepth--,t.schema=c;let f=n.position||{start:{line:null,column:null,offset:null},end:{line:null,column:null,offset:null}},m=l.components&&tq.call(l.components,u)?l.components[u]:u,b="string"==typeof m||m===a.Fragment;if(!tF.isValidElementType(m))throw TypeError(`Component for name \`${u}\` not defined or is not renderable`);if(d.key=r,"a"===u&&l.linkTarget&&(d.target="function"==typeof l.linkTarget?l.linkTarget(String(d.href||""),n.children,"string"==typeof d.title?d.title:null):l.linkTarget),"a"===u&&s&&(d.href=s(String(d.href||""),n.children,"string"==typeof d.title?d.title:null)),b||"code"!==u||"element"!==o.type||"pre"===o.tagName||(d.inline=!0),b||"h1"!==u&&"h2"!==u&&"h3"!==u&&"h4"!==u&&"h5"!==u&&"h6"!==u||(d.level=Number.parseInt(u.charAt(1),10)),"img"===u&&l.transformImageUri&&(d.src=l.transformImageUri(String(d.src||""),String(d.alt||""),"string"==typeof d.title?d.title:null)),!b&&"li"===u&&"element"===o.type){let e=function(e){let t=-1;for(;++t0?a.createElement(m,d,g):a.createElement(m,d)}(t,r,i,n)):"text"===r.type?"element"===n.type&&tY.has(n.tagName)&&function(e){let t=e&&"object"==typeof e&&"text"===e.type?e.value||"":e;return"string"==typeof t&&""===t.replace(/[ \t\n\f\r]/g,"")}(r)||o.push(r.value):"raw"!==r.type||t.options.skipHtml||o.push(r.value);return o}({options:e,schema:tD,listDepth:0},r));return e.className&&(o=a.createElement("div",{className:e.className},o)),o}tJ.propTypes={children:ts.string,className:ts.string,allowElement:ts.func,allowedElements:ts.arrayOf(ts.string),disallowedElements:ts.arrayOf(ts.string),unwrapDisallowed:ts.bool,remarkPlugins:ts.arrayOf(ts.oneOfType([ts.object,ts.func,ts.arrayOf(ts.oneOfType([ts.bool,ts.string,ts.object,ts.func,ts.arrayOf(ts.any)]))])),rehypePlugins:ts.arrayOf(ts.oneOfType([ts.object,ts.func,ts.arrayOf(ts.oneOfType([ts.bool,ts.string,ts.object,ts.func,ts.arrayOf(ts.any)]))])),sourcePos:ts.bool,rawSourcePos:ts.bool,skipHtml:ts.bool,includeElementIndex:ts.bool,transformLinkUri:ts.oneOfType([ts.func,ts.bool]),linkTarget:ts.oneOfType([ts.func,ts.string]),transformImageUri:ts.func,components:ts.object}},48975:function(e,t,n){"use strict";n.d(t,{Z:function(){return eL}});var r=n(6361),o=n(82659);let a={tokenize:function(e,t,n){let r=0;return function t(a){return(87===a||119===a)&&r<3?(r++,e.consume(a),t):46===a&&3===r?(e.consume(a),o):n(a)};function o(e){return null===e?n(e):t(e)}},partial:!0},i={tokenize:function(e,t,n){let r,a,i;return l;function l(t){return 46===t||95===t?e.check(s,u,c)(t):null===t||(0,o.z3)(t)||(0,o.B8)(t)||45!==t&&(0,o.Xh)(t)?u(t):(i=!0,e.consume(t),l)}function c(t){return 95===t?r=!0:(a=r,r=void 0),e.consume(t),l}function u(e){return a||r||!i?n(e):t(e)}},partial:!0},l={tokenize:function(e,t){let n=0,r=0;return a;function a(l){return 40===l?(n++,e.consume(l),a):41===l&&r0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}g[43]=p,g[45]=p,g[46]=p,g[95]=p,g[72]=[p,d],g[104]=[p,d],g[87]=[p,u],g[119]=[p,u];var k=n(56833),A=n(9471),w=n(93575);let T={tokenize:function(e,t,n){let r=this;return(0,A.f)(e,function(e){let o=r.events[r.events.length-1];return o&&"gfmFootnoteDefinitionIndent"===o[1].type&&4===o[2].sliceSerialize(o[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function v(e,t,n){let r;let o=this,a=o.events.length,i=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);for(;a--;){let e=o.events[a][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!r||!r._balanced)return n(a);let l=(0,w.d)(o.sliceSerialize({start:r.end,end:o.now()}));return 94===l.codePointAt(0)&&i.includes(l.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)):n(a)}}function x(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function R(e,t,n){let r;let a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),l=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(s){if(l>999||93===s&&!r||null===s||91===s||(0,o.z3)(s))return n(s);if(93===s){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return i.includes((0,w.d)(a.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(s)}return(0,o.z3)(s)||(r=!0),l++,e.consume(s),92===s?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}}function C(e,t,n){let r,a;let i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),c};function c(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(t)}function u(t){if(s>999||93===t&&!a||null===t||91===t||(0,o.z3)(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=(0,w.d)(i.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return(0,o.z3)(t)||(a=!0),s++,e.consume(t),92===t?d:u}function d(t){return 91===t||92===t||93===t?(e.consume(t),s++,u):u(t)}function p(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),l.includes(r)||l.push(r),(0,A.f)(e,g,"gfmFootnoteDefinitionWhitespace")):n(t)}function g(e){return t(e)}}function _(e,t,n){return e.check(k.w,t,e.attempt(T,t,n))}function I(e){e.exit("gfmFootnoteDefinition")}var N=n(58180),O=n(75786),L=n(80594);class D{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let o=0;if(0!==n||0!==r.length){for(;oe[0]-t[0]),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1])),n.push(this.map[t][2]),e.length=this.map[t][0];n.push([...e]),e.length=0;let r=n.pop();for(;r;)e.push(...r),r=n.pop();this.map.length=0}}let M={flow:{null:{tokenize:function(e,t,n){let r;let a=this,i=0,l=0;return function(e){let t=a.events.length-1;for(;t>-1;){let e=a.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?a.events[t][1].type:null,o="tableHead"===r||"tableRow"===r?S:s;return o===S&&a.parser.lazy[a.now().line]?n(e):o(e)};function s(t){return e.enter("tableHead"),e.enter("tableRow"),124===t||(r=!0,l+=1),c(t)}function c(t){return null===t?n(t):(0,o.Ch)(t)?l>1?(l=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p):n(t):(0,o.xz)(t)?(0,A.f)(e,c,"whitespace")(t):(l+=1,r&&(r=!1,i+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),r=!0,c):(e.enter("data"),u(t))}function u(t){return null===t||124===t||(0,o.z3)(t)?(e.exit("data"),c(t)):(e.consume(t),92===t?d:u)}function d(t){return 92===t||124===t?(e.consume(t),u):u(t)}function p(t){return(a.interrupt=!1,a.parser.lazy[a.now().line])?n(t):(e.enter("tableDelimiterRow"),r=!1,(0,o.xz)(t))?(0,A.f)(e,g,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):g(t)}function g(t){return 45===t||58===t?m(t):124===t?(r=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):n(t)}function f(t){return(0,o.xz)(t)?(0,A.f)(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(l+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),b):45===t?(l+=1,b(t)):null===t||(0,o.Ch)(t)?y(t):n(t)}function b(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),h):(e.exit("tableDelimiterFiller"),h(n))}(t)):n(t)}function h(t){return(0,o.xz)(t)?(0,A.f)(e,y,"whitespace")(t):y(t)}function y(a){return 124===a?g(a):null===a||(0,o.Ch)(a)?r&&i===l?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(a)):n(a):n(a)}function S(t){return e.enter("tableRow"),E(t)}function E(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),E):null===n||(0,o.Ch)(n)?(e.exit("tableRow"),t(n)):(0,o.xz)(n)?(0,A.f)(e,E,"whitespace")(n):(e.enter("data"),k(n))}function k(t){return null===t||124===t||(0,o.z3)(t)?(e.exit("data"),E(t)):(e.consume(t),92===t?w:k)}function w(t){return 92===t||124===t?(e.consume(t),k):k(t)}},resolveAll:function(e,t){let n,r,o,a=-1,i=!0,l=0,s=[0,0,0,0],c=[0,0,0,0],u=!1,d=0,p=new D;for(;++an[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",i,t]])}return void 0!==o&&(a.end=Object.assign({},B(t.events,o)),e.add(o,0,[["exit",a,t]]),a=void 0),a}function F(e,t,n,r,o){let a=[],i=B(t.events,n);o&&(o.end=Object.assign({},i),a.push(["exit",o,t])),r.end=Object.assign({},i),a.push(["exit",r,t]),e.add(n+1,0,a)}function B(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}let U={text:{91:{tokenize:function(e,t,n){let r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),a):n(t)};function a(t){return(0,o.z3)(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),i):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),i):n(t)}function i(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(t)}function l(r){return(0,o.Ch)(r)?t(r):(0,o.xz)(r)?e.check({tokenize:z},t,n)(r):n(r)}}}}};function z(e,t,n){return(0,A.f)(e,function(e){return null===e?n(e):t(e)},"whitespace")}function H(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,o=n.indexOf(t);for(;-1!==o;)r++,o=n.indexOf(t,o+t.length);return r}var G=n(37462),$=n(54e3);let j={}.hasOwnProperty,W=function(e,t,n,r){let o,a;"string"==typeof t||t instanceof RegExp?(a=[[t,n]],o=r):(a=t,o=n),o||(o={});let i=(0,$.O)(o.ignore||[]),l=function(e){let t=[];if("object"!=typeof e)throw TypeError("Expected array or object as schema");if(Array.isArray(e)){let n=-1;for(;++n0?{type:"text",value:l}:void 0),!1!==l&&(a!==n&&u.push({type:"text",value:e.value.slice(a,n)}),Array.isArray(l)?u.push(...l):l&&u.push(l),a=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}return c?(ae}let Y="phrasing",K=["autolink","link","image","label"],Z={transforms:[function(e){W(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,J],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,ee]],{ignore:["link","linkReference"]})}],enter:{literalAutolink:function(e){this.enter({type:"link",title:null,url:"",children:[]},e)},literalAutolinkEmail:Q,literalAutolinkHttp:Q,literalAutolinkWww:Q},exit:{literalAutolink:function(e){this.exit(e)},literalAutolinkEmail:function(e){this.config.exit.autolinkEmail.call(this,e)},literalAutolinkHttp:function(e){this.config.exit.autolinkProtocol.call(this,e)},literalAutolinkWww:function(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.url="http://"+this.sliceSerialize(e)}}},X={unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Y,notInConstruct:K},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Y,notInConstruct:K},{character:":",before:"[ps]",after:"\\/",inConstruct:Y,notInConstruct:K}]};function Q(e){this.config.enter.autolinkProtocol.call(this,e)}function J(e,t,n,r,o){let a="";if(!et(o)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!function(e){let t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}(n)))return!1;let i=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),o=H(e,"("),a=H(e,")");for(;-1!==r&&o>a;)e+=n.slice(0,r+1),r=(n=n.slice(r+1)).indexOf(")"),a++;return[e,n]}(n+r);if(!i[0])return!1;let l={type:"link",title:null,url:a+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[l,{type:"text",value:i[1]}]:l}function ee(e,t,n,r){return!(!et(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function et(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||(0,o.B8)(n)||(0,o.Xh)(n))&&(!t||47!==n)}var en=n(11559);function er(e){return e.label||!e.identifier?e.label||"":(0,en.v)(e.identifier)}let eo=/\r?\n|\r/g;var ea=n(62848),ei=n(12101);function el(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function es(){this.buffer()}function ec(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,w.d)(this.sliceSerialize(e)).toLowerCase()}function eu(e){this.exit(e)}function ed(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ep(){this.buffer()}function eg(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,w.d)(this.sliceSerialize(e)).toLowerCase()}function ef(e){this.exit(e)}function em(e,t,n,r){let o=(0,ei.j)(r),a=o.move("[^"),i=n.enter("footnoteReference"),l=n.enter("reference");return a+=o.move((0,ea.T)(n,er(e),{...o.current(),before:a,after:"]"})),l(),i(),a+=o.move("]")}function eb(e,t,n,r){let o=(0,ei.j)(r),a=o.move("[^"),i=n.enter("footnoteDefinition"),l=n.enter("label");return a+=o.move((0,ea.T)(n,er(e),{...o.current(),before:a,after:"]"})),l(),a+=o.move("]:"+(e.children&&e.children.length>0?" ":"")),o.shift(4),a+=o.move(function(e,t){let n;let r=[],o=0,a=0;for(;n=eo.exec(e);)i(e.slice(o,n.index)),r.push(n[0]),o=n.index+n[0].length,a++;return i(e.slice(o)),r.join("");function i(e){r.push(t(e,a,!e))}}(function(e,t,n){let r=t.indexStack,o=e.children||[],a=t.createTracker(n),i=[],l=-1;for(r.push(-1);++l\n\n"}return"\n\n"}(n,o[l+1],e,t)))}return r.pop(),i.join("")}(e,n,o.current()),eh)),i(),a}function eh(e,t,n){return 0===t?e:(n?"":" ")+e}function ey(e,t,n){let r=t.indexStack,o=e.children||[],a=[],i=-1,l=n.before;r.push(-1);let s=t.createTracker(n);for(;++i0&&("\r"===l||"\n"===l)&&"html"===u.type&&(a[a.length-1]=a[a.length-1].replace(/(\r?\n|\r)$/," "),l=" ",(s=t.createTracker(n)).move(a.join(""))),a.push(s.move(t.handle(u,e,t,{...s.current(),before:l,after:c}))),l=a[a.length-1].slice(-1)}return r.pop(),a.join("")}em.peek=function(){return"["},ek.peek=function(){return"~"};let eS={canContainEols:["delete"],enter:{strikethrough:function(e){this.enter({type:"delete",children:[]},e)}},exit:{strikethrough:function(e){this.exit(e)}}},eE={unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"]}],handlers:{delete:ek}};function ek(e,t,n,r){let o=(0,ei.j)(r),a=n.enter("strikethrough"),i=o.move("~~");return i+=ey(e,n,{...o.current(),before:i,after:"~"})+o.move("~~"),a(),i}var eA=n(57785);function ew(e,t,n){let r=e.value||"",o="`",a=-1;for(;RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a"none"===e?null:e),children:[]},e),this.setData("inTable",!0)},tableData:eC,tableHeader:eC,tableRow:function(e){this.enter({type:"tableRow",children:[]},e)}},exit:{codeText:function(e){let t=this.resume();this.getData("inTable")&&(t=t.replace(/\\([\\|])/g,e_));let n=this.stack[this.stack.length-1];n.value=t,this.exit(e)},table:function(e){this.exit(e),this.setData("inTable")},tableData:eR,tableHeader:eR,tableRow:eR}};function eR(e){this.exit(e)}function eC(e){this.enter({type:"tableCell",children:[]},e)}function e_(e,t){return"|"===t?t:e}let eI={exit:{taskListCheckValueChecked:eO,taskListCheckValueUnchecked:eO,paragraph:function(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1],n=e.children[0];if(n&&"text"===n.type){let r;let o=t.children,a=-1;for(;++a-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+a);let i=a.length+1;("tab"===o||"mixed"===o&&(t&&"list"===t.type&&t.spread||e.spread))&&(i=4*Math.ceil(i/4));let l=n.createTracker(r);l.move(a+" ".repeat(i-a.length)),l.shift(i);let s=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,l.current()),function(e,t,n){return t?(n?"":" ".repeat(i))+e:(n?a:a+" ".repeat(i-a.length))+e});return s(),c}(e,t,n,{...r,...l.current()});return a&&(s=s.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+i})),s}}};function eO(e){let t=this.stack[this.stack.length-2];t.checked="taskListCheckValueChecked"===e.type}function eL(e={}){let t=this.data();function n(e,n){let r=t[e]?t[e]:t[e]=[];r.push(n)}n("micromarkExtensions",(0,r.W)([f,{document:{91:{tokenize:C,continuation:{tokenize:_},exit:I}},text:{91:{tokenize:R},93:{add:"after",tokenize:v,resolveTo:x}}},function(e){let t=(e||{}).singleTilde,n={tokenize:function(e,n,r){let o=this.previous,a=this.events,i=0;return function(l){return 126===o&&"characterEscape"!==a[a.length-1][1].type?r(l):(e.enter("strikethroughSequenceTemporary"),function a(l){let s=(0,O.r)(o);if(126===l)return i>1?r(l):(e.consume(l),i++,a);if(i<2&&!t)return r(l);let c=e.exit("strikethroughSequenceTemporary"),u=(0,O.r)(l);return c._open=!u||2===u&&!!s,c._close=!s||2===s&&!!u,n(l)}(l))}},resolveAll:function(e,t){let n=-1;for(;++ns&&(s=e[c].length);++dl[d])&&(l[d]=e)}n.push(a)}a[c]=n,i[c]=o}let d=-1;if("object"==typeof n&&"length"in n)for(;++dl[d]&&(l[d]=a),g[d]=a),p[d]=i}a.splice(1,0,p),i.splice(1,0,g),c=-1;let f=[];for(;++ci&&(i=a):a=1,o=r+t.length,r=n.indexOf(t,o);return i}(o,"$")+1,2)),l=n.enter("mathFlow"),s=a.move(i);if(e.meta){let t=n.enter("mathFlowMeta");s+=a.move((0,c.T)(n,e.meta,{before:s,after:"\n",encode:["$"],...a.current()})),t()}return s+=a.move("\n"),o&&(s+=a.move(o+"\n")),s+=a.move(i),l(),s},inlineMath:n}};function n(e,n,r){let o=e.value||"",a=1;for(!t&&a++;RegExp("(^|[^$])"+"\\$".repeat(a)+"([^$]|$)").test(o);)a++;let i="$".repeat(a);/[^ \r\n]/.test(o)&&(/^[ \r\n]/.test(o)&&/[ \r\n]$/.test(o)||/^\$|\$$/.test(o))&&(o=" "+o+" ");let l=-1;for(;++l":"")+")"})}return u;function u(){var c;let u,d,p,g=[];if((!t||a(r,l,s[s.length-1]||null))&&!1===(g=Array.isArray(c=n(r,s))?c:"number"==typeof c?[!0,c]:[c])[0])return g;if(r.children&&"skip"!==g[0])for(d=(o?r.children.length:-1)+i,p=s.concat(r);d>-1&&d","Iacute":"\xcd","Icirc":"\xce","Igrave":"\xcc","Iuml":"\xcf","LT":"<","Ntilde":"\xd1","Oacute":"\xd3","Ocirc":"\xd4","Ograve":"\xd2","Oslash":"\xd8","Otilde":"\xd5","Ouml":"\xd6","QUOT":"\\"","REG":"\xae","THORN":"\xde","Uacute":"\xda","Ucirc":"\xdb","Ugrave":"\xd9","Uuml":"\xdc","Yacute":"\xdd","aacute":"\xe1","acirc":"\xe2","acute":"\xb4","aelig":"\xe6","agrave":"\xe0","amp":"&","aring":"\xe5","atilde":"\xe3","auml":"\xe4","brvbar":"\xa6","ccedil":"\xe7","cedil":"\xb8","cent":"\xa2","copy":"\xa9","curren":"\xa4","deg":"\xb0","divide":"\xf7","eacute":"\xe9","ecirc":"\xea","egrave":"\xe8","eth":"\xf0","euml":"\xeb","frac12":"\xbd","frac14":"\xbc","frac34":"\xbe","gt":">","iacute":"\xed","icirc":"\xee","iexcl":"\xa1","igrave":"\xec","iquest":"\xbf","iuml":"\xef","laquo":"\xab","lt":"<","macr":"\xaf","micro":"\xb5","middot":"\xb7","nbsp":"\xa0","not":"\xac","ntilde":"\xf1","oacute":"\xf3","ocirc":"\xf4","ograve":"\xf2","ordf":"\xaa","ordm":"\xba","oslash":"\xf8","otilde":"\xf5","ouml":"\xf6","para":"\xb6","plusmn":"\xb1","pound":"\xa3","quot":"\\"","raquo":"\xbb","reg":"\xae","sect":"\xa7","shy":"\xad","sup1":"\xb9","sup2":"\xb2","sup3":"\xb3","szlig":"\xdf","thorn":"\xfe","times":"\xd7","uacute":"\xfa","ucirc":"\xfb","ugrave":"\xf9","uml":"\xa8","uuml":"\xfc","yacute":"\xfd","yen":"\xa5","yuml":"\xff"}')},46561:function(e){"use strict";e.exports=JSON.parse('{"0":"�","128":"€","130":"‚","131":"ƒ","132":"„","133":"…","134":"†","135":"‡","136":"ˆ","137":"‰","138":"Š","139":"‹","140":"Œ","142":"Ž","145":"‘","146":"’","147":"“","148":"”","149":"•","150":"–","151":"—","152":"˜","153":"™","154":"š","155":"›","156":"œ","158":"ž","159":"Ÿ"}')}}]);
\ No newline at end of file
+Defaulting to \`${i}\`.`):null}};let u=s},4913:function(e,t,n){"use strict";function r(e){let t=new TextEncoder,n="",r=e||{};return new TransformStream({async start(){r.onStart&&await r.onStart()},async transform(e,o){o.enqueue(t.encode(e)),r.onToken&&await r.onToken(e),r.onCompletion&&(n+=e)},async flush(){r.onCompletion&&await r.onCompletion(n),!r.onFinal||"experimental_onFunctionCall"in r||await r.onFinal(n)}})}n.d(t,{T_:function(){return r},h6:function(){return i},wn:function(){return l}}),(0,n(22776).k)("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var o={text:0,function_call:1,data:2},a=(e,t)=>`${o[e]}:${JSON.stringify(t)}
+`;function i(e){if(!e)return new TransformStream({transform:async(e,t)=>{t.enqueue(e)}});let t=new TextEncoder,n=new TextDecoder;return new TransformStream({transform:async(e,r)=>{let o=n.decode(e);r.enqueue(t.encode(a("text",o)))}})}Symbol("internal_openai_fn_messages");var l=class extends Response{constructor(e,t,n){let r=e;n&&(r=e.pipeThrough(n.stream)),super(r,{...t,status:200,headers:{"Content-Type":"text/plain; charset=utf-8","X-Experimental-Stream-Data":n?"true":"false",...null==t?void 0:t.headers}})}};new TextDecoder("utf-8")},22776:function(e,t,n){"use strict";n.d(t,{k:function(){return r}});let r=(e,t=21)=>(n=t)=>{let r="",o=n;for(;o--;)r+=e[Math.random()*e.length|0];return r}},57139:function(e,t,n){"use strict";n.d(t,{R:function(){return ea}});var r,o=n(2265),a=n(26272);let i=()=>{},l=i(),s=Object,c=e=>e===l,u=e=>"function"==typeof e,d=(e,t)=>({...e,...t}),p=e=>u(e.then),g=new WeakMap,f=0,m=e=>{let t,n;let r=typeof e,o=e&&e.constructor,a=o==Date;if(s(e)!==e||a||o==RegExp)t=a?e.toJSON():"symbol"==r?e.toString():"string"==r?JSON.stringify(e):""+e;else{if(t=g.get(e))return t;if(t=++f+"~",g.set(e,t),o==Array){for(n=0,t="@";nE&&typeof window.requestAnimationFrame!=S,w=(e,t)=>{let n=b.get(e);return[()=>!c(t)&&e.get(t)||h,r=>{if(!c(t)){let o=e.get(t);t in y||(y[t]=o),n[5](t,d(o,r),o||h)}},n[6],()=>!c(t)&&t in y?y[t]:!c(t)&&e.get(t)||h]},T=!0,[v,x]=E&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[i,i],R={initFocus:e=>(k&&document.addEventListener("visibilitychange",e),v("focus",e),()=>{k&&document.removeEventListener("visibilitychange",e),x("focus",e)}),initReconnect:e=>{let t=()=>{T=!0,e()},n=()=>{T=!1};return v("online",t),v("offline",n),()=>{x("online",t),x("offline",n)}}},C=!o.useId,_=!E||"Deno"in window,I=e=>A()?window.requestAnimationFrame(e):setTimeout(e,1),N=_?o.useEffect:o.useLayoutEffect,O="undefined"!=typeof navigator&&navigator.connection,L=!_&&O&&(["slow-2g","2g"].includes(O.effectiveType)||O.saveData),D=e=>{if(u(e))try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?m(e):"",t]},M=0,P=()=>++M;var F={ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:0,MUTATE_EVENT:2,RECONNECT_EVENT:1};async function B(...e){let[t,n,r,o]=e,a=d({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{}),i=a.populateCache,s=a.rollbackOnError,g=a.optimisticData,f=!1!==a.revalidate,m=e=>"function"==typeof s?s(e):!1!==s,h=a.throwOnError;if(u(n)){let e=[],r=t.keys();for(let o of r)!/^\$(inf|sub)\$/.test(o)&&n(t.get(o)._k)&&e.push(o);return Promise.all(e.map(y))}return y(n);async function y(n){let o;let[a]=D(n);if(!a)return;let[s,d]=w(t,a),[y,S,E,k]=b.get(t),A=y[a],T=()=>f&&(delete E[a],delete k[a],A&&A[0])?A[0](2).then(()=>s().data):s().data;if(e.length<3)return T();let v=r,x=P();S[a]=[x,0];let R=!c(g),C=s(),_=C.data,I=C._c,N=c(I)?_:I;if(R&&d({data:g=u(g)?g(N,_):g,_c:N}),u(v))try{v=v(N)}catch(e){o=e}if(v&&p(v)){if(v=await v.catch(e=>{o=e}),x!==S[a][0]){if(o)throw o;return v}o&&R&&m(o)&&(i=!0,d({data:v=N,_c:l}))}i&&!o&&(u(i)&&(v=i(v,N)),d({data:v,error:l,_c:l})),S[a][1]=P();let O=await T();if(d({_c:l}),o){if(h)throw o;return}return i?O:v}}let U=(e,t)=>{for(let n in e)e[n][0]&&e[n][0](t)},z=(e,t)=>{if(!b.has(e)){let n=d(R,t),r={},o=B.bind(l,e),a=i,s={},c=(e,t)=>{let n=s[e]||[];return s[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},u=(t,n,r)=>{e.set(t,n);let o=s[t];if(o)for(let e of o)e(n,r)},p=()=>{if(!b.has(e)&&(b.set(e,[r,{},{},{},o,u,c]),!_)){let t=n.initFocus(setTimeout.bind(l,U.bind(l,r,0))),o=n.initReconnect(setTimeout.bind(l,U.bind(l,r,1)));a=()=>{t&&t(),o&&o(),b.delete(e)}}};return p(),[e,o,p,a]}return[e,b.get(e)[4]]},[H,G]=z(new Map),$=d({onLoadingSlow:i,onSuccess:i,onError:i,onErrorRetry:(e,t,n,r,o)=>{let a=n.errorRetryCount,i=o.retryCount,l=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;(c(a)||!(i>a))&&setTimeout(r,l,o)},onDiscarded:i,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:L?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:L?5e3:3e3,compare:(e,t)=>m(e)==m(t),isPaused:()=>!1,cache:H,mutate:G,fallback:{}},{isOnline:()=>T,isVisible:()=>{let e=k&&document.visibilityState;return c(e)||"hidden"!==e}}),j=(e,t)=>{let n=d(e,t);if(t){let{use:r,fallback:o}=e,{use:a,fallback:i}=t;r&&a&&(n.use=r.concat(a)),o&&i&&(n.fallback=d(o,i))}return n},W=(0,o.createContext)({}),V=E&&window.__SWR_DEVTOOLS_USE__,q=V?window.__SWR_DEVTOOLS_USE__:[],Y=e=>u(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],K=()=>d($,(0,o.useContext)(W)),Z=q.concat(e=>(t,n,r)=>{let o=n&&((...e)=>{let[r]=D(t),[,,,o]=b.get(H),a=o[r];return c(a)?n(...e):(delete o[r],a)});return e(t,o,r)}),X=(e,t,n)=>{let r=t[e]||(t[e]=[]);return r.push(n),()=>{let e=r.indexOf(n);e>=0&&(r[e]=r[r.length-1],r.pop())}};V&&(window.__SWR_DEVTOOLS_REACT__=o);let Q=o.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;if("rejected"===e.status)throw e.reason;throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}),J={dedupe:!0};s.defineProperty(e=>{let{value:t}=e,n=(0,o.useContext)(W),r=u(t),a=(0,o.useMemo)(()=>r?t(n):t,[r,n,t]),i=(0,o.useMemo)(()=>r?a:j(n,a),[r,n,a]),s=a&&a.provider,c=(0,o.useRef)(l);s&&!c.current&&(c.current=z(s(i.cache||H),a));let p=c.current;return p&&(i.cache=p[0],i.mutate=p[1]),N(()=>{if(p)return p[2]&&p[2](),p[3]},[]),(0,o.createElement)(W.Provider,d(e,{value:i}))},"defaultValue",{value:$});let ee=(r=(e,t,n)=>{let{cache:r,compare:i,suspense:s,fallbackData:p,revalidateOnMount:g,revalidateIfStale:f,refreshInterval:m,refreshWhenHidden:h,refreshWhenOffline:y,keepPreviousData:S}=n,[E,k,A,T]=b.get(r),[v,x]=D(e),R=(0,o.useRef)(!1),O=(0,o.useRef)(!1),L=(0,o.useRef)(v),M=(0,o.useRef)(t),U=(0,o.useRef)(n),z=()=>U.current,H=()=>z().isVisible()&&z().isOnline(),[G,$,j,W]=w(r,v),V=(0,o.useRef)({}).current,q=c(p)?n.fallback[v]:p,Y=(e,t)=>{for(let n in V)if("data"===n){if(!i(e[n],t[n])&&(!c(e[n])||!i(ei,t[n])))return!1}else if(t[n]!==e[n])return!1;return!0},K=(0,o.useMemo)(()=>{let e=!!v&&!!t&&(c(g)?!z().isPaused()&&!s&&(!!c(f)||f):g),n=t=>{let n=d(t);return(delete n._k,e)?{isValidating:!0,isLoading:!0,...n}:n},r=G(),o=W(),a=n(r),i=r===o?a:n(o),l=a;return[()=>{let e=n(G()),t=Y(e,l);return t?(l.data=e.data,l.isLoading=e.isLoading,l.isValidating=e.isValidating,l.error=e.error,l):(l=e,e)},()=>i]},[r,v]),Z=(0,a.useSyncExternalStore)((0,o.useCallback)(e=>j(v,(t,n)=>{Y(n,t)||e()}),[r,v]),K[0],K[1]),ee=!R.current,et=E[v]&&E[v].length>0,en=Z.data,er=c(en)?q:en,eo=Z.error,ea=(0,o.useRef)(er),ei=S?c(en)?ea.current:en:er,el=(!et||!!c(eo))&&(ee&&!c(g)?g:!z().isPaused()&&(s?!c(er)&&f:c(er)||f)),es=!!(v&&t&&ee&&el),ec=c(Z.isValidating)?es:Z.isValidating,eu=c(Z.isLoading)?es:Z.isLoading,ed=(0,o.useCallback)(async e=>{let t,r;let o=M.current;if(!v||!o||O.current||z().isPaused())return!1;let a=!0,s=e||{},d=!A[v]||!s.dedupe,p=()=>C?!O.current&&v===L.current&&R.current:v===L.current,g={isValidating:!1,isLoading:!1},f=()=>{$(g)},m=()=>{let e=A[v];e&&e[1]===r&&delete A[v]},b={isValidating:!0};c(G().data)&&(b.isLoading=!0);try{if(d&&($(b),n.loadingTimeout&&c(G().data)&&setTimeout(()=>{a&&p()&&z().onLoadingSlow(v,n)},n.loadingTimeout),A[v]=[o(x),P()]),[t,r]=A[v],t=await t,d&&setTimeout(m,n.dedupingInterval),!A[v]||A[v][1]!==r)return d&&p()&&z().onDiscarded(v),!1;g.error=l;let e=k[v];if(!c(e)&&(r<=e[0]||r<=e[1]||0===e[1]))return f(),d&&p()&&z().onDiscarded(v),!1;let s=G().data;g.data=i(s,t)?s:t,d&&p()&&z().onSuccess(t,v,n)}catch(n){m();let e=z(),{shouldRetryOnError:t}=e;!e.isPaused()&&(g.error=n,d&&p()&&(e.onError(n,v,e),(!0===t||u(t)&&t(n))&&H()&&e.onErrorRetry(n,v,e,e=>{let t=E[v];t&&t[0]&&t[0](F.ERROR_REVALIDATE_EVENT,e)},{retryCount:(s.retryCount||0)+1,dedupe:!0})))}return a=!1,f(),!0},[v,r]),ep=(0,o.useCallback)((...e)=>B(r,L.current,...e),[]);if(N(()=>{M.current=t,U.current=n,c(en)||(ea.current=en)}),N(()=>{if(!v)return;let e=ed.bind(l,J),t=0,n=X(v,E,(n,r={})=>{if(n==F.FOCUS_EVENT){let n=Date.now();z().revalidateOnFocus&&n>t&&H()&&(t=n+z().focusThrottleInterval,e())}else if(n==F.RECONNECT_EVENT)z().revalidateOnReconnect&&H()&&e();else if(n==F.MUTATE_EVENT)return ed();else if(n==F.ERROR_REVALIDATE_EVENT)return ed(r)});return O.current=!1,L.current=v,R.current=!0,$({_k:x}),el&&(c(er)||_?e():I(e)),()=>{O.current=!0,n()}},[v]),N(()=>{let e;function t(){let t=u(m)?m(G().data):m;t&&-1!==e&&(e=setTimeout(n,t))}function n(){!G().error&&(h||z().isVisible())&&(y||z().isOnline())?ed(J).then(t):t()}return t(),()=>{e&&(clearTimeout(e),e=-1)}},[m,h,y,v]),(0,o.useDebugValue)(ei),s&&c(er)&&v){if(!C&&_)throw Error("Fallback data is required when using suspense in SSR.");M.current=t,U.current=n,O.current=!1;let e=T[v];if(!c(e)){let t=ep(e);Q(t)}if(c(eo)){let e=ed(J);c(ei)||(e.status="fulfilled",e.value=!0),Q(e)}else throw eo}return{mutate:ep,get data(){return V.data=!0,ei},get error(){return V.error=!0,eo},get isValidating(){return V.isValidating=!0,ec},get isLoading(){return V.isLoading=!0,eu}}},function(...e){let t=K(),[n,o,a]=Y(e),i=j(t,a),l=r,{use:s}=i,c=(s||[]).concat(Z);for(let e=c.length;e--;)l=c[e](l);return l(n,o||i.fetcher||null,i)});var et=(0,n(22776).k)("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),en={text:0,function_call:1,data:2},er=e=>{let t=e.indexOf(":"),n=e.slice(0,t),r=Object.keys(en).find(e=>en[e]===Number(n)),o=e.slice(t+1),a=o;if(!o)return{type:r,value:""};try{a=JSON.parse(o)}catch(e){console.error("Failed to parse JSON value:",o)}return{type:r,value:a}},eo=async(e,t,n,r,o,a,i,l,s,c,u)=>{var d,p;let g=i.current;n(t.messages,!1);let f=await fetch(e,{method:"POST",body:JSON.stringify({messages:u?t.messages:t.messages.map(({role:e,content:t,name:n,function_call:r})=>({role:e,content:t,...void 0!==n&&{name:n},...void 0!==r&&{function_call:r}})),...a.current.body,...null==(d=t.options)?void 0:d.body,...void 0!==t.functions&&{functions:t.functions},...void 0!==t.function_call&&{function_call:t.function_call}}),credentials:a.current.credentials,headers:{...a.current.headers,...null==(p=t.options)?void 0:p.headers},...null!==l.current&&{signal:l.current.signal}}).catch(e=>{throw n(g,!1),e});if(c)try{await c(f)}catch(e){throw e}if(!f.ok)throw n(g,!1),Error(await f.text()||"Failed to fetch the chat response.");if(!f.body)throw Error("The response body is empty.");let m="true"===f.headers.get("X-Experimental-Stream-Data"),b=new Date,h=f.body.getReader(),y=function(e){let t=new TextDecoder;return e?function(e){let n=t.decode(e,{stream:!0}).split("\n");return n.map(er).filter(Boolean)}:function(e){return e?t.decode(e,{stream:!0}):""}}(m),S=[],E=[],k={},A=[],w=0;if(m){for(;;){let{value:e}=await h.read();if(e&&(A.push(e),w+=e.length,10!==e[e.length-1]))continue;if(0===A.length)break;let a=new Uint8Array(w),i=0;for(let e of A)a.set(e,i),i+=e.length;A.length=0,w=0;let s=y(a);if("string"==typeof s)throw Error("Invalid response format. Complex mode was set but the response is a string. This should never happen.");for(let{type:e,value:a}of s){"text"===e&&(k.text?k.text={...k.text,content:(k.text.content||"")+a}:k.text={id:et(),role:"assistant",content:a,createdAt:b});let i=null;if("function_call"===e){k.function_call=a;let e=k.function_call;if(e&&"string"==typeof e){let t=JSON.parse(e).function_call;i={id:et(),role:"assistant",content:"",function_call:t,name:t.name,createdAt:b},k.function_call=i}}if("data"===e){let e=JSON.parse(a);k.data?k.data=[...k.data,...e]:k.data=e}let s=k.data,c=k.text,u=[i,c].filter(Boolean);if(n([...t.messages,...u],!1),r([...o||[],...s||[]],!1),null===l.current){h.cancel();break}}}for(let[e,t]of Object.entries(k))s&&"text"===e&&s(t),"data"===e?E.push(t):S.push(t);return{messages:S,data:E}}{let e="",r=et(),o={id:r,createdAt:b,content:"",role:"assistant"};for(;;){let{done:r,value:a}=await h.read();if(r)break;if((e+=y(a)).startsWith('{"function_call":')?o.function_call=e:o.content=e,n([...t.messages,{...o}],!1),null===l.current){h.cancel();break}}if(e.startsWith('{"function_call":')){let r=JSON.parse(e).function_call;o.function_call=r,n([...t.messages,{...o}])}return s&&s(o),o}};function ea({api:e="/api/chat",id:t,initialMessages:n=[],initialInput:r="",sendExtraMessageFields:a,experimental_onFunctionCall:i,onResponse:l,onFinish:s,onError:c,credentials:u,headers:d,body:p}={}){let g=(0,o.useId)(),f=t||g,{data:m,mutate:b}=ee([e,f],null,{fallbackData:n}),{data:h=!1,mutate:y}=ee([f,"loading"],null),{data:S,mutate:E}=ee([f,"streamData"],null),k=(0,o.useRef)(m||[]);(0,o.useEffect)(()=>{k.current=m||[]},[m]);let A=(0,o.useRef)(null),w=(0,o.useRef)({credentials:u,headers:d,body:p});(0,o.useEffect)(()=>{w.current={credentials:u,headers:d,body:p}},[u,d,p]);let[T,v]=(0,o.useState)(),x=(0,o.useCallback)(async t=>{try{y(!0),v(void 0);let n=new AbortController;for(A.current=n;;){let n=await eo(e,t,b,E,S,w,k,A,s,l,a);if("messages"in n){let e=!1;for(let r of n.messages)if(void 0!==r.function_call&&"string"!=typeof r.function_call&&(e=!0,i)){let e=r.function_call,n=await i(k.current,e);if(void 0===n)break;t=n}if(!e)break}else{if(void 0===n.function_call||"string"==typeof n.function_call)break;if(i){let e=n.function_call,r=await i(k.current,e);if(void 0===r)break;t=r}}}A.current=null}catch(e){if("AbortError"===e.name)return A.current=null,null;c&&e instanceof Error&&c(e),v(e)}finally{y(!1)}},[b,y,e,w,l,s,c,v,E,S,a,i,k.current,A.current]),R=(0,o.useCallback)(async(e,{options:t,functions:n,function_call:r}={})=>{e.id||(e.id=et());let o={messages:k.current.concat(e),options:t,...void 0!==n&&{functions:n},...void 0!==r&&{function_call:r}};return x(o)},[x]),C=(0,o.useCallback)(async({options:e,functions:t,function_call:n}={})=>{if(0===k.current.length)return null;let r=k.current[k.current.length-1];if("assistant"===r.role){let r={messages:k.current.slice(0,-1),options:e,...void 0!==t&&{functions:t},...void 0!==n&&{function_call:n}};return x(r)}let o={messages:k.current,options:e,...void 0!==t&&{functions:t},...void 0!==n&&{function_call:n}};return x(o)},[x]),_=(0,o.useCallback)(()=>{A.current&&(A.current.abort(),A.current=null)},[]),I=(0,o.useCallback)(e=>{b(e,!1),k.current=e},[b]),[N,O]=(0,o.useState)(r),L=(0,o.useCallback)((e,{options:t,functions:n,function_call:r}={},o)=>{o&&(w.current={...w.current,...o}),e.preventDefault(),N&&(R({content:N,role:"user",createdAt:new Date},{options:t,functions:n,function_call:r}),O(""))},[N,R]);return{messages:m||[],error:T,append:R,reload:C,stop:_,setMessages:I,input:N,setInput:O,handleInputChange:e=>{O(e.target.value)},handleSubmit:L,isLoading:h,data:S}}},63034:function(e,t,n){"use strict";n.d(t,{T:function(){return o}});let r=document.createElement("i");function o(e){let t="&"+e+";";r.innerHTML=t;let n=r.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}},57785:function(e,t,n){"use strict";function r(e){if(!e._compiled){let t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}n.d(t,{T:function(){return r}})},62848:function(e,t,n){"use strict";n.d(t,{T:function(){return a}});var r=n(57785);function o(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r=f)&&(!(e+1a?0:a+t:t>a?a:t,n=n>0?n:0,r.length<1e4)(o=Array.from(r)).unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i0?(r(e,e.length,0,t),e):t}n.d(t,{V:function(){return o},d:function(){return r}})},75786:function(e,t,n){"use strict";n.d(t,{r:function(){return o}});var r=n(82659);function o(e){return null===e||(0,r.z3)(e)||(0,r.B8)(e)?1:(0,r.Xh)(e)?2:void 0}},6361:function(e,t,n){"use strict";n.d(t,{W:function(){return a}});var r=n(58180);let o={}.hasOwnProperty;function a(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCharCode(n)}n.d(t,{o:function(){return r}})},11559:function(e,t,n){"use strict";n.d(t,{v:function(){return i}});var r=n(63034),o=n(43012);let a=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function i(e){return e.replace(a,l)}function l(e,t,n){if(t)return t;let a=n.charCodeAt(0);if(35===a){let e=n.charCodeAt(1),t=120===e||88===e;return(0,o.o)(n.slice(t?2:1),t?16:10)}return(0,r.T)(n)||e}},93575:function(e,t,n){"use strict";function r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}n.d(t,{d:function(){return r}})},80594:function(e,t,n){"use strict";function r(e,t,n){let r=[],o=-1;for(;++o{let r;if(!d&&b)return r=function(e,t,n={},r=s){if(void 0===window.IntersectionObserver&&void 0!==r){let o=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:o,intersectionRect:o,rootBounds:o}),()=>{}}let{id:o,observer:c,elements:u}=function(e){let t=Object.keys(e).sort().filter(t=>void 0!==e[t]).map(t=>{var n;return`${t}_${"root"===t?(n=e.root)?(i.has(n)||(l+=1,i.set(n,l.toString())),i.get(n)):"0":e[t]}`}).toString(),n=a.get(t);if(!n){let r;let o=new Map,i=new IntersectionObserver(t=>{t.forEach(t=>{var n;let a=t.isIntersecting&&r.some(e=>t.intersectionRatio>=e);e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=a),null==(n=o.get(t.target))||n.forEach(e=>{e(a,t)})})},e);r=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:i,elements:o},a.set(t,n)}return n}(n),d=u.get(e)||[];return u.has(e)||u.set(e,d),d.push(t),c.observe(e),function(){d.splice(d.indexOf(t),1),0===d.length&&(u.delete(e),c.unobserve(e)),0===u.size&&(c.disconnect(),a.delete(o))}}(b,(e,t)=>{E({inView:e,entry:t}),y.current&&y.current(e,t),t.isIntersecting&&u&&r&&(r(),r=void 0)},{root:c,rootMargin:o,threshold:e,trackVisibility:n,delay:t},g),()=>{r&&r()}},[Array.isArray(e)?e.toString():e,b,c,o,u,d,n,g,t]);let k=null==(m=S.entry)?void 0:m.target,A=r.useRef();b||!k||u||d||A.current===k||(A.current=k,E({inView:!!p,entry:void 0}));let w=[h,S.inView,S.entry];return w.ref=w[0],w.inView=w[1],w.entry=w[2],w}r.Component},19349:function(e,t,n){"use strict";n.d(t,{D:function(){return tJ}});var r={};n.r(r),n.d(r,{attentionMarkers:function(){return ez},contentInitial:function(){return eD},disable:function(){return eH},document:function(){return eL},flow:function(){return eP},flowInitial:function(){return eM},insideSpan:function(){return eU},string:function(){return eF},text:function(){return eB}});var o={};n.r(o),n.d(o,{boolean:function(){return tf},booleanish:function(){return tm},commaOrSpaceSeparated:function(){return tE},commaSeparated:function(){return tS},number:function(){return th},overloadedBoolean:function(){return tb},spaceSeparated:function(){return ty}});var a=n(2265),i=n(69934);function l(e){return e&&"object"==typeof e?"position"in e||"type"in e?c(e.position):"start"in e||"end"in e?c(e):"line"in e||"column"in e?s(e):"":""}function s(e){return u(e&&e.line)+":"+u(e&&e.column)}function c(e){return s(e&&e.start)+"-"+s(e&&e.end)}function u(e){return e&&"number"==typeof e?e:1}class d extends Error{constructor(e,t,n){let r=[null,null],o={start:{line:null,column:null},end:{line:null,column:null}};if(super(),"string"==typeof t&&(n=t,t=void 0),"string"==typeof n){let e=n.indexOf(":");-1===e?r[1]=n:(r[0]=n.slice(0,e),r[1]=n.slice(e+1))}t&&("type"in t||"position"in t?t.position&&(o=t.position):"start"in t||"end"in t?o=t:("line"in t||"column"in t)&&(o.start=t)),this.name=l(t)||"1:1",this.message="object"==typeof e?e.message:e,this.stack="","object"==typeof e&&e.stack&&(this.stack=e.stack),this.reason=this.message,this.fatal,this.line=o.start.line,this.column=o.start.column,this.position=o,this.source=r[0],this.ruleId=r[1],this.file,this.actual,this.expected,this.url,this.note}}d.prototype.file="",d.prototype.name="",d.prototype.reason="",d.prototype.message="",d.prototype.stack="",d.prototype.fatal=null,d.prototype.column=null,d.prototype.line=null,d.prototype.source=null,d.prototype.ruleId=null,d.prototype.position=null;let p={basename:function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');g(e);let r=0,o=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.charCodeAt(a)){if(n){r=a+1;break}}else o<0&&(n=!0,o=a+1);return o<0?"":e.slice(r,o)}if(t===e)return"";let i=-1,l=t.length-1;for(;a--;)if(47===e.charCodeAt(a)){if(n){r=a+1;break}}else i<0&&(n=!0,i=a+1),l>-1&&(e.charCodeAt(a)===t.charCodeAt(l--)?l<0&&(o=a):(l=-1,o=i));return r===o?o=i:o<0&&(o=e.length),e.slice(r,o)},dirname:function(e){let t;if(g(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.charCodeAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.charCodeAt(0)?"/":".":1===n&&47===e.charCodeAt(0)?"//":e.slice(0,n)},extname:function(e){let t;g(e);let n=e.length,r=-1,o=0,a=-1,i=0;for(;n--;){let l=e.charCodeAt(n);if(47===l){if(t){o=n+1;break}continue}r<0&&(t=!0,r=n+1),46===l?a<0?a=n:1!==i&&(i=1):a>-1&&(i=-1)}return a<0||r<0||0===i||1===i&&a===r-1&&a===o+1?"":e.slice(a,r)},join:function(...e){let t,n=-1;for(;++n2){if((r=o.lastIndexOf("/"))!==o.length-1){r<0?(o="",a=0):a=(o=o.slice(0,r)).length-1-o.lastIndexOf("/"),i=s,l=0;continue}}else if(o.length>0){o="",a=0,i=s,l=0;continue}}t&&(o=o.length>0?o+"/..":"..",a=2)}else o.length>0?o+="/"+e.slice(i+1,s):o=e.slice(i+1,s),a=s-i-1;i=s,l=0}else 46===n&&l>-1?l++:l=-1}return o}(e,!t);return 0!==n.length||t||(n="."),n.length>0&&47===e.charCodeAt(e.length-1)&&(n+="/"),t?"/"+n:n}(t)},sep:"/"};function g(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function f(e){return null!==e&&"object"==typeof e&&e.href&&e.origin}let m=["history","path","basename","stem","extname","dirname"];class b{constructor(e){let t,n;t=e?"string"==typeof e||i(e)?{value:e}:f(e)?{path:e}:e:{},this.data={},this.messages=[],this.history=[],this.cwd="/",this.value,this.stored,this.result,this.map;let r=-1;for(;++rt.length;i&&t.push(r);try{a=e.apply(this,t)}catch(e){if(i&&n)throw e;return r(e)}i||(a instanceof Promise?a.then(o,r):a instanceof Error?r(a):o(a))};function r(e,...o){n||(n=!0,t(e,...o))}function o(e){r(null,e)}})(l,o)(...i):r(null,...i)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}(),r=[],o={},a=-1;return l.data=function(e,n){return"string"==typeof e?2==arguments.length?(C("data",t),o[e]=n,l):T.call(o,e)&&o[e]||null:e?(C("data",t),o=e,l):o},l.Parser=void 0,l.Compiler=void 0,l.freeze=function(){if(t)return l;for(;++a{if(!e&&t&&n){let r=l.stringify(t,n);null==r||("string"==typeof r||i(r)?n.value=r:n.result=r),a(e,n)}else a(e)})}n(null,t)},l.processSync=function(e){let t;l.freeze(),x("processSync",l.Parser),R("processSync",l.Compiler);let n=N(e);return l.process(n,function(e){t=!0,E(e)}),I("processSync","process",t),n},l;function l(){let t=e(),n=-1;for(;++nr))return;let l=o.events.length,s=l;for(;s--;)if("exit"===o.events[s][0]&&"chunkFlow"===o.events[s][1].type){if(e){n=o.events[s][1].end;break}e=!0}for(b(i),a=l;at;){let t=a[n];o.containerState=t[1],t[0].exit.call(o,e)}a.length=t}function h(){t.write([null]),n=void 0,t=void 0,o.containerState._closeFlow=void 0}}},H={tokenize:function(e,t,n){return(0,P.f)(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};var G=n(56833);function $(e){let t,n,r,o,a,i,l;let s={},c=-1;for(;++c=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}},partial:!0},V={tokenize:function(e){let t=this,n=e.attempt(G.w,function(r){if(null===r){e.consume(r);return}return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,(0,P.f)(e,e.attempt(this.parser.constructs.flow,r,e.attempt(j,r)),"linePrefix")));return n;function r(r){if(null===r){e.consume(r);return}return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n}}},q={resolveAll:X()},Y=Z("string"),K=Z("text");function Z(e){return{tokenize:function(t){let n=this,r=this.parser.constructs[e],o=t.attempt(r,a,i);return a;function a(e){return s(e)?o(e):i(e)}function i(e){if(null===e){t.consume(e);return}return t.enter("data"),t.consume(e),l}function l(e){return s(e)?(t.exit("data"),o(e)):(t.consume(e),l)}function s(e){if(null===e)return!0;let t=r[e],o=-1;if(t)for(;++o=3&&(null===i||(0,F.Ch)(i))?(e.exit("thematicBreak"),t(i)):n(i)}(a)}}},et={name:"list",tokenize:function(e,t,n){let r=this,o=r.events[r.events.length-1],a=o&&"linePrefix"===o[1].type?o[2].sliceSerialize(o[1],!0).length:0,i=0;return function(t){let o=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===o?!r.containerState.marker||t===r.containerState.marker:(0,F.pY)(t)){if(r.containerState.type||(r.containerState.type=o,e.enter(o,{_container:!0})),"listUnordered"===o)return e.enter("listItemPrefix"),42===t||45===t?e.check(ee,n,l)(t):l(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(o){return(0,F.pY)(o)&&++i<10?(e.consume(o),t):(!r.interrupt||i<2)&&(r.containerState.marker?o===r.containerState.marker:41===o||46===o)?(e.exit("listItemValue"),l(o)):n(o)}(t)}return n(t)};function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(G.w,r.interrupt?n:s,e.attempt(en,u,c))}function s(e){return r.containerState.initialBlankLine=!0,a++,u(e)}function c(t){return(0,F.xz)(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}},continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(G.w,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,(0,P.f)(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!(0,F.xz)(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(er,t,o)(n))});function o(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,(0,P.f)(e,e.attempt(et,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}},exit:function(e){e.exit(this.containerState.type)}},en={tokenize:function(e,t,n){let r=this;return(0,P.f)(e,function(e){let o=r.events[r.events.length-1];return!(0,F.xz)(e)&&o&&"listItemPrefixWhitespace"===o[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)},partial:!0},er={tokenize:function(e,t,n){let r=this;return(0,P.f)(e,function(e){let o=r.events[r.events.length-1];return o&&"listItemIndent"===o[1].type&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)},partial:!0},eo={name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),o}return n(t)};function o(n){return(0,F.xz)(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}},continuation:{tokenize:function(e,t,n){let r=this;return function(t){return(0,F.xz)(t)?(0,P.f)(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):o(t)};function o(r){return e.attempt(eo,t,n)(r)}}},exit:function(e){e.exit("blockQuote")}};function ea(e,t,n,r,o,a,i,l,s){let c=s||Number.POSITIVE_INFINITY,u=0;return function(t){return 60===t?(e.enter(r),e.enter(o),e.enter(a),e.consume(t),e.exit(a),d):null===t||32===t||41===t||(0,F.Av)(t)?n(t):(e.enter(r),e.enter(i),e.enter(l),e.enter("chunkString",{contentType:"string"}),f(t))};function d(n){return 62===n?(e.enter(a),e.consume(n),e.exit(a),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(n))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(l),d(t)):null===t||60===t||(0,F.Ch)(t)?n(t):(e.consume(t),92===t?g:p)}function g(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function f(o){return!u&&(null===o||41===o||(0,F.z3)(o))?(e.exit("chunkString"),e.exit(l),e.exit(i),e.exit(r),t(o)):u999||null===d||91===d||93===d&&!i||94===d&&!s&&"_hiddenFootnoteSupport"in l.parser.constructs?n(d):93===d?(e.exit(a),e.enter(o),e.consume(d),e.exit(o),e.exit(r),t):(0,F.Ch)(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||(0,F.Ch)(t)||s++>999?(e.exit("chunkString"),c(t)):(e.consume(t),i||(i=!(0,F.xz)(t)),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),s++,u):u(t)}}function el(e,t,n,r,o,a){let i;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(o),e.consume(t),e.exit(o),i=40===t?41:t,l):n(t)};function l(n){return n===i?(e.enter(o),e.consume(n),e.exit(o),e.exit(r),t):(e.enter(a),s(n))}function s(t){return t===i?(e.exit(a),l(i)):null===t?n(t):(0,F.Ch)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),(0,P.f)(e,s,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===i||null===t||(0,F.Ch)(t)?(e.exit("chunkString"),s(t)):(e.consume(t),92===t?u:c)}function u(t){return t===i||92===t?(e.consume(t),c):c(t)}}function es(e,t){let n;return function r(o){return(0,F.Ch)(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):(0,F.xz)(o)?(0,P.f)(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}var ec=n(93575);let eu={tokenize:function(e,t,n){return function(t){return(0,F.z3)(t)?es(e,r)(t):n(t)};function r(t){return el(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function o(t){return(0,F.xz)(t)?(0,P.f)(e,a,"whitespace")(t):a(t)}function a(e){return null===e||(0,F.Ch)(e)?t(e):n(e)}},partial:!0},ed={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),(0,P.f)(e,o,"linePrefix",5)(t)};function o(t){let o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?function t(n){return null===n?a(n):(0,F.Ch)(n)?e.attempt(ep,t,a)(n):(e.enter("codeFlowValue"),function n(r){return null===r||(0,F.Ch)(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function a(n){return e.exit("codeIndented"),t(n)}}},ep={tokenize:function(e,t,n){let r=this;return o;function o(t){return r.parser.lazy[r.now().line]?n(t):(0,F.Ch)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):(0,P.f)(e,a,"linePrefix",5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):(0,F.Ch)(e)?o(e):n(e)}},partial:!0},eg={name:"setextUnderline",tokenize:function(e,t,n){let r;let o=this;return function(t){let i,l=o.events.length;for(;l--;)if("lineEnding"!==o.events[l][1].type&&"linePrefix"!==o.events[l][1].type&&"content"!==o.events[l][1].type){i="paragraph"===o.events[l][1].type;break}return!o.parser.lazy[o.now().line]&&(o.interrupt||i)?(e.enter("setextHeadingLine"),r=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),(0,F.xz)(n)?(0,P.f)(e,a,"lineSuffix")(n):a(n))}(t)):n(t)};function a(r){return null===r||(0,F.Ch)(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}},resolveTo:function(e,t){let n,r,o,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){n=a;break}"paragraph"===e[a][1].type&&(r=a)}else"content"===e[a][1].type&&e.splice(a,1),o||"definition"!==e[a][1].type||(o=a);let i={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[r][1].type="setextHeadingText",o?(e.splice(r,0,["enter",i,t]),e.splice(o+1,0,["exit",e[n][1],t]),e[n][1].end=Object.assign({},e[o][1].end)):e[n][1]=i,e.push(["exit",i,t]),e}},ef=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],em=["pre","script","style","textarea"],eb={tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(G.w,t,n)}},partial:!0},eh={tokenize:function(e,t,n){let r=this;return function(t){return(0,F.Ch)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):n(t)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},ey={tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},eS={name:"codeFenced",tokenize:function(e,t,n){let r;let o=this,a={tokenize:function(e,t,n){let a=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i};function i(t){return e.enter("codeFencedFence"),(0,F.xz)(t)?(0,P.f)(e,s,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):s(t)}function s(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(o){return o===r?(a++,e.consume(o),t):a>=l?(e.exit("codeFencedFenceSequence"),(0,F.xz)(o)?(0,P.f)(e,c,"whitespace")(o):c(o)):n(o)}(t)):n(t)}function c(r){return null===r||(0,F.Ch)(r)?(e.exit("codeFencedFence"),t(r)):n(r)}},partial:!0},i=0,l=0;return function(t){return function(t){let a=o.events[o.events.length-1];return i=a&&"linePrefix"===a[1].type?a[2].sliceSerialize(a[1],!0).length:0,r=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(o){return o===r?(l++,e.consume(o),t):l<3?n(o):(e.exit("codeFencedFenceSequence"),(0,F.xz)(o)?(0,P.f)(e,s,"whitespace")(o):s(o))}(t)}(t)};function s(a){return null===a||(0,F.Ch)(a)?(e.exit("codeFencedFence"),o.interrupt?t(a):e.check(ey,u,f)(a)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(o){return null===o||(0,F.Ch)(o)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),s(o)):(0,F.xz)(o)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),(0,P.f)(e,c,"whitespace")(o)):96===o&&o===r?n(o):(e.consume(o),t)}(a))}function c(t){return null===t||(0,F.Ch)(t)?s(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(o){return null===o||(0,F.Ch)(o)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),s(o)):96===o&&o===r?n(o):(e.consume(o),t)}(t))}function u(t){return e.attempt(a,f,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p}function p(t){return i>0&&(0,F.xz)(t)?(0,P.f)(e,g,"linePrefix",i+1)(t):g(t)}function g(t){return null===t||(0,F.Ch)(t)?e.check(ey,u,f)(t):(e.enter("codeFlowValue"),function t(n){return null===n||(0,F.Ch)(n)?(e.exit("codeFlowValue"),g(n)):(e.consume(n),t)}(t))}function f(n){return e.exit("codeFenced"),t(n)}},concrete:!0};var eE=n(63034);let ek={name:"characterReference",tokenize:function(e,t,n){let r,o;let a=this,i=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),l};function l(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),s):(e.enter("characterReferenceValue"),r=31,o=F.H$,c(t))}function s(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,o=F.AF,c):(e.enter("characterReferenceValue"),r=7,o=F.pY,c(t))}function c(l){if(59===l&&i){let r=e.exit("characterReferenceValue");return o!==F.H$||(0,eE.T)(a.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(l)}return o(l)&&i++1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;let d=Object.assign({},e[n][1].end),p=Object.assign({},e[u][1].start);eN(d,-l),eN(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},e[n][1].end)},i={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[u][1].start),end:p},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[u][1].start)},r={type:l>1?"strong":"emphasis",start:Object.assign({},a.start),end:Object.assign({},i.end)},e[n][1].end=Object.assign({},a.start),e[u][1].start=Object.assign({},i.end),s=[],e[n][1].end.offset-e[n][1].start.offset&&(s=(0,U.V)(s,[["enter",e[n][1],t],["exit",e[n][1],t]])),s=(0,U.V)(s,[["enter",r,t],["enter",a,t],["exit",a,t],["enter",o,t]]),s=(0,U.V)(s,(0,J.C)(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),s=(0,U.V)(s,[["exit",o,t],["enter",i,t],["exit",i,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,s=(0,U.V)(s,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,(0,U.d)(e,n-1,u-n+3,s),u=n+s.length-c-2;break}}for(u=-1;++ua&&"whitespace"===e[o][1].type&&(o-=2),"atxHeadingSequence"===e[o][1].type&&(a===o-1||o-4>a&&"whitespace"===e[o-2][1].type)&&(o-=a+1===o?2:4),o>a&&(n={type:"atxHeadingText",start:e[a][1].start,end:e[o][1].end},r={type:"chunkText",start:e[a][1].start,end:e[o][1].end,contentType:"text"},(0,U.d)(e,a,o-a+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e}},42:ee,45:[eg,ee],60:{name:"htmlFlow",tokenize:function(e,t,n){let r,o,a,i,l;let s=this;return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c};function c(i){return 33===i?(e.consume(i),u):47===i?(e.consume(i),o=!0,g):63===i?(e.consume(i),r=3,s.interrupt?t:O):(0,F.jv)(i)?(e.consume(i),a=String.fromCharCode(i),f):n(i)}function u(o){return 45===o?(e.consume(o),r=2,d):91===o?(e.consume(o),r=5,i=0,p):(0,F.jv)(o)?(e.consume(o),r=4,s.interrupt?t:O):n(o)}function d(r){return 45===r?(e.consume(r),s.interrupt?t:O):n(r)}function p(r){let o="CDATA[";return r===o.charCodeAt(i++)?(e.consume(r),i===o.length)?s.interrupt?t:T:p:n(r)}function g(t){return(0,F.jv)(t)?(e.consume(t),a=String.fromCharCode(t),f):n(t)}function f(i){if(null===i||47===i||62===i||(0,F.z3)(i)){let l=47===i,c=a.toLowerCase();return!l&&!o&&em.includes(c)?(r=1,s.interrupt?t(i):T(i)):ef.includes(a.toLowerCase())?(r=6,l)?(e.consume(i),m):s.interrupt?t(i):T(i):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(i):o?function t(n){return(0,F.xz)(n)?(e.consume(n),t):A(n)}(i):b(i))}return 45===i||(0,F.H$)(i)?(e.consume(i),a+=String.fromCharCode(i),f):n(i)}function m(r){return 62===r?(e.consume(r),s.interrupt?t:T):n(r)}function b(t){return 47===t?(e.consume(t),A):58===t||95===t||(0,F.jv)(t)?(e.consume(t),h):(0,F.xz)(t)?(e.consume(t),b):A(t)}function h(t){return 45===t||46===t||58===t||95===t||(0,F.H$)(t)?(e.consume(t),h):y(t)}function y(t){return 61===t?(e.consume(t),S):(0,F.xz)(t)?(e.consume(t),y):b(t)}function S(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,E):(0,F.xz)(t)?(e.consume(t),S):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||(0,F.z3)(n)?y(n):(e.consume(n),t)}(t)}function E(t){return t===l?(e.consume(t),l=null,k):null===t||(0,F.Ch)(t)?n(t):(e.consume(t),E)}function k(e){return 47===e||62===e||(0,F.xz)(e)?b(e):n(e)}function A(t){return 62===t?(e.consume(t),w):n(t)}function w(t){return null===t||(0,F.Ch)(t)?T(t):(0,F.xz)(t)?(e.consume(t),w):n(t)}function T(t){return 45===t&&2===r?(e.consume(t),C):60===t&&1===r?(e.consume(t),_):62===t&&4===r?(e.consume(t),L):63===t&&3===r?(e.consume(t),O):93===t&&5===r?(e.consume(t),N):(0,F.Ch)(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(eb,D,v)(t)):null===t||(0,F.Ch)(t)?(e.exit("htmlFlowData"),v(t)):(e.consume(t),T)}function v(t){return e.check(eh,x,D)(t)}function x(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),R}function R(t){return null===t||(0,F.Ch)(t)?v(t):(e.enter("htmlFlowData"),T(t))}function C(t){return 45===t?(e.consume(t),O):T(t)}function _(t){return 47===t?(e.consume(t),a="",I):T(t)}function I(t){if(62===t){let n=a.toLowerCase();return em.includes(n)?(e.consume(t),L):T(t)}return(0,F.jv)(t)&&a.length<8?(e.consume(t),a+=String.fromCharCode(t),I):T(t)}function N(t){return 93===t?(e.consume(t),O):T(t)}function O(t){return 62===t?(e.consume(t),L):45===t&&2===r?(e.consume(t),O):T(t)}function L(t){return null===t||(0,F.Ch)(t)?(e.exit("htmlFlowData"),D(t)):(e.consume(t),L)}function D(n){return e.exit("htmlFlow"),t(n)}},resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},concrete:!0},61:eg,95:ee,96:eS,126:eS},eF={38:ek,92:eA},eB={[-5]:ew,[-4]:ew,[-3]:ew,33:eC,38:ek,42:eI,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o};function o(t){return(0,F.jv)(t)?(e.consume(t),a):l(t)}function a(t){return 43===t||45===t||46===t||(0,F.H$)(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,i):(43===n||45===n||46===n||(0,F.H$)(n))&&r++<32?(e.consume(n),t):(r=0,l(n))}(t)):l(t)}function i(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||(0,F.Av)(r)?n(r):(e.consume(r),i)}function l(t){return 64===t?(e.consume(t),s):(0,F.n9)(t)?(e.consume(t),l):n(t)}function s(o){return(0,F.H$)(o)?function o(a){return 46===a?(e.consume(a),r=0,s):62===a?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(a),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(a){if((45===a||(0,F.H$)(a))&&r++<63){let n=45===a?t:o;return e.consume(a),n}return n(a)}(a)}(o):n(o)}}},{name:"htmlText",tokenize:function(e,t,n){let r,o,a;let i=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),l};function l(t){return 33===t?(e.consume(t),s):47===t?(e.consume(t),E):63===t?(e.consume(t),y):(0,F.jv)(t)?(e.consume(t),A):n(t)}function s(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),o=0,g):(0,F.jv)(t)?(e.consume(t),h):n(t)}function c(t){return 45===t?(e.consume(t),p):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):(0,F.Ch)(t)?(a=u,I(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),p):u(t)}function p(e){return 62===e?_(e):45===e?d(e):u(e)}function g(t){let r="CDATA[";return t===r.charCodeAt(o++)?(e.consume(t),o===r.length?f:g):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):(0,F.Ch)(t)?(a=f,I(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),b):f(t)}function b(t){return 62===t?_(t):93===t?(e.consume(t),b):f(t)}function h(t){return null===t||62===t?_(t):(0,F.Ch)(t)?(a=h,I(t)):(e.consume(t),h)}function y(t){return null===t?n(t):63===t?(e.consume(t),S):(0,F.Ch)(t)?(a=y,I(t)):(e.consume(t),y)}function S(e){return 62===e?_(e):y(e)}function E(t){return(0,F.jv)(t)?(e.consume(t),k):n(t)}function k(t){return 45===t||(0,F.H$)(t)?(e.consume(t),k):function t(n){return(0,F.Ch)(n)?(a=t,I(n)):(0,F.xz)(n)?(e.consume(n),t):_(n)}(t)}function A(t){return 45===t||(0,F.H$)(t)?(e.consume(t),A):47===t||62===t||(0,F.z3)(t)?w(t):n(t)}function w(t){return 47===t?(e.consume(t),_):58===t||95===t||(0,F.jv)(t)?(e.consume(t),T):(0,F.Ch)(t)?(a=w,I(t)):(0,F.xz)(t)?(e.consume(t),w):_(t)}function T(t){return 45===t||46===t||58===t||95===t||(0,F.H$)(t)?(e.consume(t),T):function t(n){return 61===n?(e.consume(n),v):(0,F.Ch)(n)?(a=t,I(n)):(0,F.xz)(n)?(e.consume(n),t):w(n)}(t)}function v(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,x):(0,F.Ch)(t)?(a=v,I(t)):(0,F.xz)(t)?(e.consume(t),v):(e.consume(t),R)}function x(t){return t===r?(e.consume(t),r=void 0,C):null===t?n(t):(0,F.Ch)(t)?(a=x,I(t)):(e.consume(t),x)}function R(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||(0,F.z3)(t)?w(t):(e.consume(t),R)}function C(e){return 47===e||62===e||(0,F.z3)(e)?w(e):n(e)}function _(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function I(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),N}function N(t){return(0,F.xz)(t)?(0,P.f)(e,O,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):O(t)}function O(t){return e.enter("htmlTextData"),a(t)}}}],91:eO,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return(0,F.Ch)(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},eA],93:eT,95:eI,96:{name:"codeText",tokenize:function(e,t,n){let r,o,a=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),a++,t):(e.exit("codeTextSequence"),i(n))}(t)};function i(s){return null===s?n(s):32===s?(e.enter("space"),e.consume(s),e.exit("space"),i):96===s?(o=e.enter("codeTextSequence"),r=0,function n(i){return 96===i?(e.consume(i),r++,n):r===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(i)):(o.type="codeTextData",l(i))}(s)):(0,F.Ch)(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):(e.enter("codeTextData"),l(s))}function l(t){return null===t||32===t||96===t||(0,F.Ch)(t)?(e.exit("codeTextData"),i(t)):(e.consume(t),l)}},resolve:function(e){let t,n,r=e.length-4,o=3;if(("lineEnding"===e[3][1].type||"space"===e[o][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=o;++t0){let e=a.tokenStack[a.tokenStack.length-1],t=e[1]||eY;t.call(a,void 0,e[0])}for(n.position={start:eq(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:eq(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c-1){let e=n[0];"string"==typeof e?n[0]=e.slice(o):n.shift()}i>0&&n.push(e[a].slice(0,i))}return n}(i,e)}function p(){let{line:e,column:t,offset:n,_index:o,_bufferIndex:a}=r;return{line:e,column:t,offset:n,_index:o,_bufferIndex:a}}function g(e,t){t.restore()}function f(e,t){return function(n,o,a){let i,u,d,g;return Array.isArray(n)?f(n):"tokenize"in n?f([n]):function(e){let t=null!==e&&n[e],r=null!==e&&n.null,o=[...Array.isArray(t)?t:t?[t]:[],...Array.isArray(r)?r:r?[r]:[]];return f(o)(e)};function f(e){return(i=e,u=0,0===e.length)?a:m(e[u])}function m(e){return function(n){return(g=function(){let e=p(),t=c.previous,n=c.currentConstruct,o=c.events.length,a=Array.from(l);return{restore:function(){r=e,c.previous=t,c.currentConstruct=n,c.events.length=o,l=a,b()},from:o}}(),d=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?y(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,s,h,y)(n)}}function h(t){return e(d,g),o}function y(e){return(g.restore(),++u{let n=this.data("settings");return eV(t,Object.assign({},n,e,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}function eZ(e){let t=[],n=-1,r=0,o=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(i=String.fromCharCode(a,t),o=1):i="�"}else i=String.fromCharCode(a);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+o+1,i=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}var eX=n(37462);let eQ=function(e,t,n,r){"function"==typeof t&&"function"!=typeof n&&(r=n,n=t,t=null),(0,eX.S4)(e,t,function(e,t){let r=t[t.length-1];return n(e,r?r.children.indexOf(e):null,r)},r)},eJ=e1("start"),e0=e1("end");function e1(e){return function(t){let n=t&&t.position&&t.position[e]||{};return{line:n.line||null,column:n.column||null,offset:n.offset>-1?n.offset:null}}}let e2={}.hasOwnProperty;function e3(e){return String(e||"").toUpperCase()}function e4(e,t){let n;let r=String(t.identifier).toUpperCase(),o=eZ(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);-1===a?(e.footnoteOrder.push(r),e.footnoteCounts[r]=1,n=e.footnoteOrder.length):(e.footnoteCounts[r]++,n=a+1);let i=e.footnoteCounts[r],l={type:"element",tagName:"a",properties:{href:"#"+e.clobberPrefix+"fn-"+o,id:e.clobberPrefix+"fnref-"+o+(i>1?"-"+i:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let s={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,s),e.applyData(t,s)}function e5(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return{type:"text",value:"!["+t.alt+r};let o=e.all(t),a=o[0];a&&"text"===a.type?a.value="["+a.value:o.unshift({type:"text",value:"["});let i=o[o.length-1];return i&&"text"===i.type?i.value+=r:o.push({type:"text",value:r}),o}function e9(e){let t=e.spread;return null==t?e.children.length>1:t}function e6(e,t,n){let r=0,o=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(o-1);for(;9===t||32===t;)o--,t=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}let e8={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r=t.lang?t.lang.match(/^[^ \t]+(?=[ \t]|$)/):null,o={};r&&(o.className=["language-"+r]);let a={type:"element",tagName:"code",properties:o,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a={type:"element",tagName:"pre",properties:{},children:[a=e.applyData(t,a)]},e.patch(t,a),a},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:e4,footnote:function(e,t){let n=e.footnoteById,r=1;for(;(r in n);)r++;let o=String(r);return n[o]={type:"footnoteDefinition",identifier:o,children:[{type:"paragraph",children:t.children}],position:t.position},e4(e,{type:"footnoteReference",identifier:o,position:t.position})},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.dangerous){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}return null},imageReference:function(e,t){let n=e.definition(t.identifier);if(!n)return e5(e,t);let r={src:eZ(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(r.title=n.title);let o={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function(e,t){let n={src:eZ(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=e.definition(t.identifier);if(!n)return e5(e,t);let r={href:eZ(n.url||"")};null!==n.title&&void 0!==n.title&&(r.title=n.title);let o={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function(e,t){let n={href:eZ(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),o=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let l=-1;for(;++l0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=eJ(t.children[1]),i=e0(t.children[t.children.length-1]);a.line&&i.line&&(r.position={start:a,end:i}),o.push(r)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,o=r?r.indexOf(t):1,a=0===o?"th":"td",i=n&&"table"===n.type?n.align:void 0,l=i?i.length:t.children.length,s=-1,c=[];for(;++s0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return a.push(e6(t.slice(o),o>0,!1)),a.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:e7,yaml:e7,definition:e7,footnoteDefinition:e7};function e7(){return null}let te={}.hasOwnProperty;function tt(e,t){e.position&&(t.position={start:eJ(e),end:e0(e)})}function tn(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,o=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:[]}),"element"===n.type&&o&&(n.properties={...n.properties,...o}),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function tr(e,t,n){let r=t&&t.type;if(!r)throw Error("Expected node, got `"+t+"`");return te.call(e.handlers,r)?e.handlers[r](e,t,n):e.passThrough&&e.passThrough.includes(r)?"children"in t?{...t,children:to(e,t)}:t:e.unknownHandler?e.unknownHandler(e,t,n):function(e,t){let n=t.data||{},r="value"in t&&!(te.call(n,"hProperties")||te.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:to(e,t)};return e.patch(t,r),e.applyData(t,r)}(e,t)}function to(e,t){let n=[];if("children"in t){let r=t.children,o=-1;for(;++o0&&n.push({type:"text",value:"\n"}),n}function ti(e,t){let n=function(e,t){let n=t||{},r=n.allowDangerousHtml||!1,o={};return i.dangerous=r,i.clobberPrefix=void 0===n.clobberPrefix||null===n.clobberPrefix?"user-content-":n.clobberPrefix,i.footnoteLabel=n.footnoteLabel||"Footnotes",i.footnoteLabelTagName=n.footnoteLabelTagName||"h2",i.footnoteLabelProperties=n.footnoteLabelProperties||{className:["sr-only"]},i.footnoteBackLabel=n.footnoteBackLabel||"Back to content",i.unknownHandler=n.unknownHandler,i.passThrough=n.passThrough,i.handlers={...e8,...n.handlers},i.definition=function(e){let t=Object.create(null);if(!e||!e.type)throw Error("mdast-util-definitions expected node");return eQ(e,"definition",e=>{let n=e3(e.identifier);n&&!e2.call(t,n)&&(t[n]=e)}),function(e){let n=e3(e);return n&&e2.call(t,n)?t[n]:null}}(e),i.footnoteById=o,i.footnoteOrder=[],i.footnoteCounts={},i.patch=tt,i.applyData=tn,i.one=function(e,t){return tr(i,e,t)},i.all=function(e){return to(i,e)},i.wrap=ta,i.augment=a,eQ(e,"footnoteDefinition",e=>{let t=String(e.identifier).toUpperCase();te.call(o,t)||(o[t]=e)}),i;function a(e,t){if(e&&"data"in e&&e.data){let n=e.data;n.hName&&("element"!==t.type&&(t={type:"element",tagName:"",properties:{},children:[]}),t.tagName=n.hName),"element"===t.type&&n.hProperties&&(t.properties={...t.properties,...n.hProperties}),"children"in t&&t.children&&n.hChildren&&(t.children=n.hChildren)}if(e){let n="type"in e?e:{position:e};!n||!n.position||!n.position.start||!n.position.start.line||!n.position.start.column||!n.position.end||!n.position.end.line||!n.position.end.column||(t.position={start:eJ(n),end:e0(n)})}return t}function i(e,t,n,r){return Array.isArray(n)&&(r=n,n={}),a(e,{type:"element",tagName:t,properties:n||{},children:r||[]})}}(e,t),r=n.one(e,null),o=function(e){let t=[],n=-1;for(;++n1?"-"+l:""),dataFootnoteBackref:!0,className:["data-footnote-backref"],ariaLabel:e.footnoteBackLabel},children:[{type:"text",value:"↩"}]};l>1&&t.children.push({type:"element",tagName:"sup",children:[{type:"text",value:String(l)}]}),s.length>0&&s.push({type:"text",value:" "}),s.push(t)}let c=o[o.length-1];if(c&&"element"===c.type&&"p"===c.tagName){let e=c.children[c.children.length-1];e&&"text"===e.type?e.value+=" ":c.children.push({type:"text",value:" "}),c.children.push(...s)}else o.push(...s);let u={type:"element",tagName:"li",properties:{id:e.clobberPrefix+"fn-"+i},children:e.wrap(o,!0)};e.patch(r,u),t.push(u)}if(0!==t.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:e.footnoteLabelTagName,properties:{...JSON.parse(JSON.stringify(e.footnoteLabelProperties)),id:"footnote-label"},children:[{type:"text",value:e.footnoteLabel}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(t,!0)},{type:"text",value:"\n"}]}}(n);return o&&r.children.push({type:"text",value:"\n"},o),Array.isArray(r)?{type:"root",children:r}:r}var tl=function(e,t){var n;return e&&"run"in e?(n,r,o)=>{e.run(ti(n,t),r,e=>{o(e)})}:(n=e||t,e=>ti(e,n))},ts=n(74275);class tc{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}}function tu(e,t){let n={},r={},o=-1;for(;++o"xlink:"+t.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),tR=tv({space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function tC(e,t){return t in e?e[t]:t}function t_(e,t){return tC(e,t.toLowerCase())}let tI=tv({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:t_,properties:{xmlns:null,xmlnsXLink:null}}),tN=tv({transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:tm,ariaAutoComplete:null,ariaBusy:tm,ariaChecked:tm,ariaColCount:th,ariaColIndex:th,ariaColSpan:th,ariaControls:ty,ariaCurrent:null,ariaDescribedBy:ty,ariaDetails:null,ariaDisabled:tm,ariaDropEffect:ty,ariaErrorMessage:null,ariaExpanded:tm,ariaFlowTo:ty,ariaGrabbed:tm,ariaHasPopup:null,ariaHidden:tm,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ty,ariaLevel:th,ariaLive:null,ariaModal:tm,ariaMultiLine:tm,ariaMultiSelectable:tm,ariaOrientation:null,ariaOwns:ty,ariaPlaceholder:null,ariaPosInSet:th,ariaPressed:tm,ariaReadOnly:tm,ariaRelevant:null,ariaRequired:tm,ariaRoleDescription:ty,ariaRowCount:th,ariaRowIndex:th,ariaRowSpan:th,ariaSelected:tm,ariaSetSize:th,ariaSort:null,ariaValueMax:th,ariaValueMin:th,ariaValueNow:th,ariaValueText:null,role:null}}),tO=tv({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:t_,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:tS,acceptCharset:ty,accessKey:ty,action:null,allow:null,allowFullScreen:tf,allowPaymentRequest:tf,allowUserMedia:tf,alt:null,as:null,async:tf,autoCapitalize:null,autoComplete:ty,autoFocus:tf,autoPlay:tf,blocking:ty,capture:tf,charSet:null,checked:tf,cite:null,className:ty,cols:th,colSpan:null,content:null,contentEditable:tm,controls:tf,controlsList:ty,coords:th|tS,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tf,defer:tf,dir:null,dirName:null,disabled:tf,download:tb,draggable:tm,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tf,formTarget:null,headers:ty,height:th,hidden:tf,high:th,href:null,hrefLang:null,htmlFor:ty,httpEquiv:ty,id:null,imageSizes:null,imageSrcSet:null,inert:tf,inputMode:null,integrity:null,is:null,isMap:tf,itemId:null,itemProp:ty,itemRef:ty,itemScope:tf,itemType:ty,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tf,low:th,manifest:null,max:null,maxLength:th,media:null,method:null,min:null,minLength:th,multiple:tf,muted:tf,name:null,nonce:null,noModule:tf,noValidate:tf,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:tf,optimum:th,pattern:null,ping:ty,placeholder:null,playsInline:tf,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tf,referrerPolicy:null,rel:ty,required:tf,reversed:tf,rows:th,rowSpan:th,sandbox:ty,scope:null,scoped:tf,seamless:tf,selected:tf,shape:null,size:th,sizes:null,slot:null,span:th,spellCheck:tm,src:null,srcDoc:null,srcLang:null,srcSet:null,start:th,step:null,style:null,tabIndex:th,target:null,title:null,translate:null,type:null,typeMustMatch:tf,useMap:null,value:tm,width:th,wrap:null,align:null,aLink:null,archive:ty,axis:null,background:null,bgColor:null,border:th,borderColor:null,bottomMargin:th,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tf,declare:tf,event:null,face:null,frame:null,frameBorder:null,hSpace:th,leftMargin:th,link:null,longDesc:null,lowSrc:null,marginHeight:th,marginWidth:th,noResize:tf,noHref:tf,noShade:tf,noWrap:tf,object:null,profile:null,prompt:null,rev:null,rightMargin:th,rules:null,scheme:null,scrolling:tm,standby:null,summary:null,text:null,topMargin:th,valueType:null,version:null,vAlign:null,vLink:null,vSpace:th,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tf,disableRemotePlayback:tf,prefix:null,property:null,results:th,security:null,unselectable:null}}),tL=tv({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:tC,properties:{about:tE,accentHeight:th,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:th,amplitude:th,arabicForm:null,ascent:th,attributeName:null,attributeType:null,azimuth:th,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:th,by:null,calcMode:null,capHeight:th,className:ty,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:th,diffuseConstant:th,direction:null,display:null,dur:null,divisor:th,dominantBaseline:null,download:tf,dx:null,dy:null,edgeMode:null,editable:null,elevation:th,enableBackground:null,end:null,event:null,exponent:th,externalResourcesRequired:null,fill:null,fillOpacity:th,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:tS,g2:tS,glyphName:tS,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:th,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:th,horizOriginX:th,horizOriginY:th,id:null,ideographic:th,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:th,k:th,k1:th,k2:th,k3:th,k4:th,kernelMatrix:tE,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:th,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:th,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:th,overlineThickness:th,paintOrder:null,panose1:null,path:null,pathLength:th,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ty,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:th,pointsAtY:th,pointsAtZ:th,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:tE,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:tE,rev:tE,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:tE,requiredFeatures:tE,requiredFonts:tE,requiredFormats:tE,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:th,specularExponent:th,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:th,strikethroughThickness:th,string:null,stroke:null,strokeDashArray:tE,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:th,strokeOpacity:th,strokeWidth:null,style:null,surfaceScale:th,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:tE,tabIndex:th,tableValues:null,target:null,targetX:th,targetY:th,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:tE,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:th,underlineThickness:th,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:th,values:null,vAlphabetic:th,vMathematical:th,vectorEffect:null,vHanging:th,vIdeographic:th,version:null,vertAdvY:th,vertOriginX:th,vertOriginY:th,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:th,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),tD=tu([tR,tx,tI,tN,tO],"html"),tM=tu([tR,tx,tI,tN,tL],"svg");function tP(e){if(e.allowedElements&&e.disallowedElements)throw TypeError("Only one of `allowedElements` and `disallowedElements` should be defined");if(e.allowedElements||e.disallowedElements||e.allowElement)return t=>{eQ(t,"element",(t,n,r)=>{let o;if(e.allowedElements?o=!e.allowedElements.includes(t.tagName):e.disallowedElements&&(o=e.disallowedElements.includes(t.tagName)),!o&&e.allowElement&&"number"==typeof n&&(o=!e.allowElement(t,n,r)),o&&"number"==typeof n)return e.unwrapDisallowed&&t.children?r.children.splice(n,1,...t.children):r.children.splice(n,1),n})}}var tF=n(9176);let tB=/^data[-\w.:]+$/i,tU=/-[a-z]/g,tz=/[A-Z]/g;function tH(e){return"-"+e.toLowerCase()}function tG(e){return e.charAt(1).toUpperCase()}let t$={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};var tj=n(48699);let tW=["http","https","mailto","tel"];function tV(e){let t=(e||"").trim(),n=t.charAt(0);if("#"===n||"/"===n)return t;let r=t.indexOf(":");if(-1===r)return t;let o=-1;for(;++oo||-1!==(o=t.indexOf("#"))&&r>o?t:"javascript:void(0)"}let tq={}.hasOwnProperty,tY=new Set(["table","thead","tbody","tfoot","tr"]);function tK(e,t){let n=-1,r=0;for(;++n for more info)`),delete tQ[t]}let t=w().use(eK).use(e.remarkPlugins||[]).use(tl,{...e.remarkRehypeOptions,allowDangerousHtml:!0}).use(e.rehypePlugins||[]).use(tP,e),n=new b;"string"==typeof e.children?n.value=e.children:void 0!==e.children&&null!==e.children&&console.warn(`[react-markdown] Warning: please pass a string as \`children\` (not: \`${e.children}\`)`);let r=t.runSync(t.parse(n),n);if("root"!==r.type)throw TypeError("Expected a `root` node");let o=a.createElement(a.Fragment,{},function e(t,n){let r;let o=[],i=-1;for(;++i4&&"data"===n.slice(0,4)&&tB.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(tU,tG);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!tU.test(e)){let n=e.replace(tz,tH);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}o=tw}return new o(r,t)}(r.schema,t),a=n;null!=a&&a==a&&(Array.isArray(a)&&(a=o.commaSeparated?function(e,t){let n={},r=""===e[e.length-1]?[...e,""]:e;return r.join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}(a):a.join(" ").trim()),"style"===o.property&&"string"==typeof a&&(a=function(e){let t={};try{tj(e,function(e,n){let r="-ms-"===e.slice(0,4)?`ms-${e.slice(4)}`:e;t[r.replace(/-([a-z])/g,tZ)]=n})}catch{}return t}(a)),o.space&&o.property?e[tq.call(t$,o.property)?t$[o.property]:o.property]=a:o.attribute&&(e[o.attribute]=a))}(d,i,n.properties[i],t);("ol"===u||"ul"===u)&&t.listDepth++;let g=e(t,n);("ol"===u||"ul"===u)&&t.listDepth--,t.schema=c;let f=n.position||{start:{line:null,column:null,offset:null},end:{line:null,column:null,offset:null}},m=l.components&&tq.call(l.components,u)?l.components[u]:u,b="string"==typeof m||m===a.Fragment;if(!tF.isValidElementType(m))throw TypeError(`Component for name \`${u}\` not defined or is not renderable`);if(d.key=r,"a"===u&&l.linkTarget&&(d.target="function"==typeof l.linkTarget?l.linkTarget(String(d.href||""),n.children,"string"==typeof d.title?d.title:null):l.linkTarget),"a"===u&&s&&(d.href=s(String(d.href||""),n.children,"string"==typeof d.title?d.title:null)),b||"code"!==u||"element"!==o.type||"pre"===o.tagName||(d.inline=!0),b||"h1"!==u&&"h2"!==u&&"h3"!==u&&"h4"!==u&&"h5"!==u&&"h6"!==u||(d.level=Number.parseInt(u.charAt(1),10)),"img"===u&&l.transformImageUri&&(d.src=l.transformImageUri(String(d.src||""),String(d.alt||""),"string"==typeof d.title?d.title:null)),!b&&"li"===u&&"element"===o.type){let e=function(e){let t=-1;for(;++t0?a.createElement(m,d,g):a.createElement(m,d)}(t,r,i,n)):"text"===r.type?"element"===n.type&&tY.has(n.tagName)&&function(e){let t=e&&"object"==typeof e&&"text"===e.type?e.value||"":e;return"string"==typeof t&&""===t.replace(/[ \t\n\f\r]/g,"")}(r)||o.push(r.value):"raw"!==r.type||t.options.skipHtml||o.push(r.value);return o}({options:e,schema:tD,listDepth:0},r));return e.className&&(o=a.createElement("div",{className:e.className},o)),o}tJ.propTypes={children:ts.string,className:ts.string,allowElement:ts.func,allowedElements:ts.arrayOf(ts.string),disallowedElements:ts.arrayOf(ts.string),unwrapDisallowed:ts.bool,remarkPlugins:ts.arrayOf(ts.oneOfType([ts.object,ts.func,ts.arrayOf(ts.oneOfType([ts.bool,ts.string,ts.object,ts.func,ts.arrayOf(ts.any)]))])),rehypePlugins:ts.arrayOf(ts.oneOfType([ts.object,ts.func,ts.arrayOf(ts.oneOfType([ts.bool,ts.string,ts.object,ts.func,ts.arrayOf(ts.any)]))])),sourcePos:ts.bool,rawSourcePos:ts.bool,skipHtml:ts.bool,includeElementIndex:ts.bool,transformLinkUri:ts.oneOfType([ts.func,ts.bool]),linkTarget:ts.oneOfType([ts.func,ts.string]),transformImageUri:ts.func,components:ts.object}},48975:function(e,t,n){"use strict";n.d(t,{Z:function(){return eL}});var r=n(6361),o=n(82659);let a={tokenize:function(e,t,n){let r=0;return function t(a){return(87===a||119===a)&&r<3?(r++,e.consume(a),t):46===a&&3===r?(e.consume(a),o):n(a)};function o(e){return null===e?n(e):t(e)}},partial:!0},i={tokenize:function(e,t,n){let r,a,i;return l;function l(t){return 46===t||95===t?e.check(s,u,c)(t):null===t||(0,o.z3)(t)||(0,o.B8)(t)||45!==t&&(0,o.Xh)(t)?u(t):(i=!0,e.consume(t),l)}function c(t){return 95===t?r=!0:(a=r,r=void 0),e.consume(t),l}function u(e){return a||r||!i?n(e):t(e)}},partial:!0},l={tokenize:function(e,t){let n=0,r=0;return a;function a(l){return 40===l?(n++,e.consume(l),a):41===l&&r0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}g[43]=p,g[45]=p,g[46]=p,g[95]=p,g[72]=[p,d],g[104]=[p,d],g[87]=[p,u],g[119]=[p,u];var k=n(56833),A=n(9471),w=n(93575);let T={tokenize:function(e,t,n){let r=this;return(0,A.f)(e,function(e){let o=r.events[r.events.length-1];return o&&"gfmFootnoteDefinitionIndent"===o[1].type&&4===o[2].sliceSerialize(o[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function v(e,t,n){let r;let o=this,a=o.events.length,i=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);for(;a--;){let e=o.events[a][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!r||!r._balanced)return n(a);let l=(0,w.d)(o.sliceSerialize({start:r.end,end:o.now()}));return 94===l.codePointAt(0)&&i.includes(l.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)):n(a)}}function x(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function R(e,t,n){let r;let a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),l=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(s){if(l>999||93===s&&!r||null===s||91===s||(0,o.z3)(s))return n(s);if(93===s){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return i.includes((0,w.d)(a.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(s)}return(0,o.z3)(s)||(r=!0),l++,e.consume(s),92===s?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}}function C(e,t,n){let r,a;let i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),c};function c(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(t)}function u(t){if(s>999||93===t&&!a||null===t||91===t||(0,o.z3)(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=(0,w.d)(i.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return(0,o.z3)(t)||(a=!0),s++,e.consume(t),92===t?d:u}function d(t){return 91===t||92===t||93===t?(e.consume(t),s++,u):u(t)}function p(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),l.includes(r)||l.push(r),(0,A.f)(e,g,"gfmFootnoteDefinitionWhitespace")):n(t)}function g(e){return t(e)}}function _(e,t,n){return e.check(k.w,t,e.attempt(T,t,n))}function I(e){e.exit("gfmFootnoteDefinition")}var N=n(58180),O=n(75786),L=n(80594);class D{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let o=0;if(0!==n||0!==r.length){for(;oe[0]-t[0]),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1])),n.push(this.map[t][2]),e.length=this.map[t][0];n.push([...e]),e.length=0;let r=n.pop();for(;r;)e.push(...r),r=n.pop();this.map.length=0}}let M={flow:{null:{tokenize:function(e,t,n){let r;let a=this,i=0,l=0;return function(e){let t=a.events.length-1;for(;t>-1;){let e=a.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?a.events[t][1].type:null,o="tableHead"===r||"tableRow"===r?S:s;return o===S&&a.parser.lazy[a.now().line]?n(e):o(e)};function s(t){return e.enter("tableHead"),e.enter("tableRow"),124===t||(r=!0,l+=1),c(t)}function c(t){return null===t?n(t):(0,o.Ch)(t)?l>1?(l=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p):n(t):(0,o.xz)(t)?(0,A.f)(e,c,"whitespace")(t):(l+=1,r&&(r=!1,i+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),r=!0,c):(e.enter("data"),u(t))}function u(t){return null===t||124===t||(0,o.z3)(t)?(e.exit("data"),c(t)):(e.consume(t),92===t?d:u)}function d(t){return 92===t||124===t?(e.consume(t),u):u(t)}function p(t){return(a.interrupt=!1,a.parser.lazy[a.now().line])?n(t):(e.enter("tableDelimiterRow"),r=!1,(0,o.xz)(t))?(0,A.f)(e,g,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):g(t)}function g(t){return 45===t||58===t?m(t):124===t?(r=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):n(t)}function f(t){return(0,o.xz)(t)?(0,A.f)(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(l+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),b):45===t?(l+=1,b(t)):null===t||(0,o.Ch)(t)?y(t):n(t)}function b(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),h):(e.exit("tableDelimiterFiller"),h(n))}(t)):n(t)}function h(t){return(0,o.xz)(t)?(0,A.f)(e,y,"whitespace")(t):y(t)}function y(a){return 124===a?g(a):null===a||(0,o.Ch)(a)?r&&i===l?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(a)):n(a):n(a)}function S(t){return e.enter("tableRow"),E(t)}function E(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),E):null===n||(0,o.Ch)(n)?(e.exit("tableRow"),t(n)):(0,o.xz)(n)?(0,A.f)(e,E,"whitespace")(n):(e.enter("data"),k(n))}function k(t){return null===t||124===t||(0,o.z3)(t)?(e.exit("data"),E(t)):(e.consume(t),92===t?w:k)}function w(t){return 92===t||124===t?(e.consume(t),k):k(t)}},resolveAll:function(e,t){let n,r,o,a=-1,i=!0,l=0,s=[0,0,0,0],c=[0,0,0,0],u=!1,d=0,p=new D;for(;++an[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",i,t]])}return void 0!==o&&(a.end=Object.assign({},B(t.events,o)),e.add(o,0,[["exit",a,t]]),a=void 0),a}function F(e,t,n,r,o){let a=[],i=B(t.events,n);o&&(o.end=Object.assign({},i),a.push(["exit",o,t])),r.end=Object.assign({},i),a.push(["exit",r,t]),e.add(n+1,0,a)}function B(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}let U={text:{91:{tokenize:function(e,t,n){let r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),a):n(t)};function a(t){return(0,o.z3)(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),i):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),i):n(t)}function i(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(t)}function l(r){return(0,o.Ch)(r)?t(r):(0,o.xz)(r)?e.check({tokenize:z},t,n)(r):n(r)}}}}};function z(e,t,n){return(0,A.f)(e,function(e){return null===e?n(e):t(e)},"whitespace")}function H(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,o=n.indexOf(t);for(;-1!==o;)r++,o=n.indexOf(t,o+t.length);return r}var G=n(37462),$=n(54e3);let j={}.hasOwnProperty,W=function(e,t,n,r){let o,a;"string"==typeof t||t instanceof RegExp?(a=[[t,n]],o=r):(a=t,o=n),o||(o={});let i=(0,$.O)(o.ignore||[]),l=function(e){let t=[];if("object"!=typeof e)throw TypeError("Expected array or object as schema");if(Array.isArray(e)){let n=-1;for(;++n0?{type:"text",value:l}:void 0),!1!==l&&(a!==n&&u.push({type:"text",value:e.value.slice(a,n)}),Array.isArray(l)?u.push(...l):l&&u.push(l),a=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}return c?(ae}let Y="phrasing",K=["autolink","link","image","label"],Z={transforms:[function(e){W(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,J],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,ee]],{ignore:["link","linkReference"]})}],enter:{literalAutolink:function(e){this.enter({type:"link",title:null,url:"",children:[]},e)},literalAutolinkEmail:Q,literalAutolinkHttp:Q,literalAutolinkWww:Q},exit:{literalAutolink:function(e){this.exit(e)},literalAutolinkEmail:function(e){this.config.exit.autolinkEmail.call(this,e)},literalAutolinkHttp:function(e){this.config.exit.autolinkProtocol.call(this,e)},literalAutolinkWww:function(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.url="http://"+this.sliceSerialize(e)}}},X={unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Y,notInConstruct:K},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Y,notInConstruct:K},{character:":",before:"[ps]",after:"\\/",inConstruct:Y,notInConstruct:K}]};function Q(e){this.config.enter.autolinkProtocol.call(this,e)}function J(e,t,n,r,o){let a="";if(!et(o)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!function(e){let t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}(n)))return!1;let i=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),o=H(e,"("),a=H(e,")");for(;-1!==r&&o>a;)e+=n.slice(0,r+1),r=(n=n.slice(r+1)).indexOf(")"),a++;return[e,n]}(n+r);if(!i[0])return!1;let l={type:"link",title:null,url:a+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[l,{type:"text",value:i[1]}]:l}function ee(e,t,n,r){return!(!et(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function et(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||(0,o.B8)(n)||(0,o.Xh)(n))&&(!t||47!==n)}var en=n(11559);function er(e){return e.label||!e.identifier?e.label||"":(0,en.v)(e.identifier)}let eo=/\r?\n|\r/g;var ea=n(62848),ei=n(12101);function el(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function es(){this.buffer()}function ec(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,w.d)(this.sliceSerialize(e)).toLowerCase()}function eu(e){this.exit(e)}function ed(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ep(){this.buffer()}function eg(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,w.d)(this.sliceSerialize(e)).toLowerCase()}function ef(e){this.exit(e)}function em(e,t,n,r){let o=(0,ei.j)(r),a=o.move("[^"),i=n.enter("footnoteReference"),l=n.enter("reference");return a+=o.move((0,ea.T)(n,er(e),{...o.current(),before:a,after:"]"})),l(),i(),a+=o.move("]")}function eb(e,t,n,r){let o=(0,ei.j)(r),a=o.move("[^"),i=n.enter("footnoteDefinition"),l=n.enter("label");return a+=o.move((0,ea.T)(n,er(e),{...o.current(),before:a,after:"]"})),l(),a+=o.move("]:"+(e.children&&e.children.length>0?" ":"")),o.shift(4),a+=o.move(function(e,t){let n;let r=[],o=0,a=0;for(;n=eo.exec(e);)i(e.slice(o,n.index)),r.push(n[0]),o=n.index+n[0].length,a++;return i(e.slice(o)),r.join("");function i(e){r.push(t(e,a,!e))}}(function(e,t,n){let r=t.indexStack,o=e.children||[],a=t.createTracker(n),i=[],l=-1;for(r.push(-1);++l\n\n"}return"\n\n"}(n,o[l+1],e,t)))}return r.pop(),i.join("")}(e,n,o.current()),eh)),i(),a}function eh(e,t,n){return 0===t?e:(n?"":" ")+e}function ey(e,t,n){let r=t.indexStack,o=e.children||[],a=[],i=-1,l=n.before;r.push(-1);let s=t.createTracker(n);for(;++i0&&("\r"===l||"\n"===l)&&"html"===u.type&&(a[a.length-1]=a[a.length-1].replace(/(\r?\n|\r)$/," "),l=" ",(s=t.createTracker(n)).move(a.join(""))),a.push(s.move(t.handle(u,e,t,{...s.current(),before:l,after:c}))),l=a[a.length-1].slice(-1)}return r.pop(),a.join("")}em.peek=function(){return"["},ek.peek=function(){return"~"};let eS={canContainEols:["delete"],enter:{strikethrough:function(e){this.enter({type:"delete",children:[]},e)}},exit:{strikethrough:function(e){this.exit(e)}}},eE={unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"]}],handlers:{delete:ek}};function ek(e,t,n,r){let o=(0,ei.j)(r),a=n.enter("strikethrough"),i=o.move("~~");return i+=ey(e,n,{...o.current(),before:i,after:"~"})+o.move("~~"),a(),i}var eA=n(57785);function ew(e,t,n){let r=e.value||"",o="`",a=-1;for(;RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a"none"===e?null:e),children:[]},e),this.setData("inTable",!0)},tableData:eC,tableHeader:eC,tableRow:function(e){this.enter({type:"tableRow",children:[]},e)}},exit:{codeText:function(e){let t=this.resume();this.getData("inTable")&&(t=t.replace(/\\([\\|])/g,e_));let n=this.stack[this.stack.length-1];n.value=t,this.exit(e)},table:function(e){this.exit(e),this.setData("inTable")},tableData:eR,tableHeader:eR,tableRow:eR}};function eR(e){this.exit(e)}function eC(e){this.enter({type:"tableCell",children:[]},e)}function e_(e,t){return"|"===t?t:e}let eI={exit:{taskListCheckValueChecked:eO,taskListCheckValueUnchecked:eO,paragraph:function(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1],n=e.children[0];if(n&&"text"===n.type){let r;let o=t.children,a=-1;for(;++a-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+a);let i=a.length+1;("tab"===o||"mixed"===o&&(t&&"list"===t.type&&t.spread||e.spread))&&(i=4*Math.ceil(i/4));let l=n.createTracker(r);l.move(a+" ".repeat(i-a.length)),l.shift(i);let s=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,l.current()),function(e,t,n){return t?(n?"":" ".repeat(i))+e:(n?a:a+" ".repeat(i-a.length))+e});return s(),c}(e,t,n,{...r,...l.current()});return a&&(s=s.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+i})),s}}};function eO(e){let t=this.stack[this.stack.length-2];t.checked="taskListCheckValueChecked"===e.type}function eL(e={}){let t=this.data();function n(e,n){let r=t[e]?t[e]:t[e]=[];r.push(n)}n("micromarkExtensions",(0,r.W)([f,{document:{91:{tokenize:C,continuation:{tokenize:_},exit:I}},text:{91:{tokenize:R},93:{add:"after",tokenize:v,resolveTo:x}}},function(e){let t=(e||{}).singleTilde,n={tokenize:function(e,n,r){let o=this.previous,a=this.events,i=0;return function(l){return 126===o&&"characterEscape"!==a[a.length-1][1].type?r(l):(e.enter("strikethroughSequenceTemporary"),function a(l){let s=(0,O.r)(o);if(126===l)return i>1?r(l):(e.consume(l),i++,a);if(i<2&&!t)return r(l);let c=e.exit("strikethroughSequenceTemporary"),u=(0,O.r)(l);return c._open=!u||2===u&&!!s,c._close=!s||2===s&&!!u,n(l)}(l))}},resolveAll:function(e,t){let n=-1;for(;++ns&&(s=e[c].length);++dl[d])&&(l[d]=e)}n.push(a)}a[c]=n,i[c]=o}let d=-1;if("object"==typeof n&&"length"in n)for(;++dl[d]&&(l[d]=a),g[d]=a),p[d]=i}a.splice(1,0,p),i.splice(1,0,g),c=-1;let f=[];for(;++ci&&(i=a):a=1,o=r+t.length,r=n.indexOf(t,o);return i}(o,"$")+1,2)),l=n.enter("mathFlow"),s=a.move(i);if(e.meta){let t=n.enter("mathFlowMeta");s+=a.move((0,c.T)(n,e.meta,{before:s,after:"\n",encode:["$"],...a.current()})),t()}return s+=a.move("\n"),o&&(s+=a.move(o+"\n")),s+=a.move(i),l(),s},inlineMath:n}};function n(e,n,r){let o=e.value||"",a=1;for(!t&&a++;RegExp("(^|[^$])"+"\\$".repeat(a)+"([^$]|$)").test(o);)a++;let i="$".repeat(a);/[^ \r\n]/.test(o)&&(/^[ \r\n]/.test(o)&&/[ \r\n]$/.test(o)||/^\$|\$$/.test(o))&&(o=" "+o+" ");let l=-1;for(;++l":"")+")"})}return u;function u(){var c;let u,d,p,g=[];if((!t||a(r,l,s[s.length-1]||null))&&!1===(g=Array.isArray(c=n(r,s))?c:"number"==typeof c?[!0,c]:[c])[0])return g;if(r.children&&"skip"!==g[0])for(d=(o?r.children.length:-1)+i,p=s.concat(r);d>-1&&d","Iacute":"\xcd","Icirc":"\xce","Igrave":"\xcc","Iuml":"\xcf","LT":"<","Ntilde":"\xd1","Oacute":"\xd3","Ocirc":"\xd4","Ograve":"\xd2","Oslash":"\xd8","Otilde":"\xd5","Ouml":"\xd6","QUOT":"\\"","REG":"\xae","THORN":"\xde","Uacute":"\xda","Ucirc":"\xdb","Ugrave":"\xd9","Uuml":"\xdc","Yacute":"\xdd","aacute":"\xe1","acirc":"\xe2","acute":"\xb4","aelig":"\xe6","agrave":"\xe0","amp":"&","aring":"\xe5","atilde":"\xe3","auml":"\xe4","brvbar":"\xa6","ccedil":"\xe7","cedil":"\xb8","cent":"\xa2","copy":"\xa9","curren":"\xa4","deg":"\xb0","divide":"\xf7","eacute":"\xe9","ecirc":"\xea","egrave":"\xe8","eth":"\xf0","euml":"\xeb","frac12":"\xbd","frac14":"\xbc","frac34":"\xbe","gt":">","iacute":"\xed","icirc":"\xee","iexcl":"\xa1","igrave":"\xec","iquest":"\xbf","iuml":"\xef","laquo":"\xab","lt":"<","macr":"\xaf","micro":"\xb5","middot":"\xb7","nbsp":"\xa0","not":"\xac","ntilde":"\xf1","oacute":"\xf3","ocirc":"\xf4","ograve":"\xf2","ordf":"\xaa","ordm":"\xba","oslash":"\xf8","otilde":"\xf5","ouml":"\xf6","para":"\xb6","plusmn":"\xb1","pound":"\xa3","quot":"\\"","raquo":"\xbb","reg":"\xae","sect":"\xa7","shy":"\xad","sup1":"\xb9","sup2":"\xb2","sup3":"\xb3","szlig":"\xdf","thorn":"\xfe","times":"\xd7","uacute":"\xfa","ucirc":"\xfb","ugrave":"\xf9","uml":"\xa8","uuml":"\xfc","yacute":"\xfd","yen":"\xa5","yuml":"\xff"}')},46561:function(e){"use strict";e.exports=JSON.parse('{"0":"�","128":"€","130":"‚","131":"ƒ","132":"„","133":"…","134":"†","135":"‡","136":"ˆ","137":"‰","138":"Š","139":"‹","140":"Œ","142":"Ž","145":"‘","146":"’","147":"“","148":"”","149":"•","150":"–","151":"—","152":"˜","153":"™","154":"š","155":"›","156":"œ","158":"ž","159":"Ÿ"}')}}]);
\ No newline at end of file
diff --git a/crates/tabby/playground/_next/static/chunks/app/page-757d8cb1ec33d4cb.js b/crates/tabby/playground/_next/static/chunks/app/page-2ebc2d344df80bd2.js
similarity index 75%
rename from crates/tabby/playground/_next/static/chunks/app/page-757d8cb1ec33d4cb.js
rename to crates/tabby/playground/_next/static/chunks/app/page-2ebc2d344df80bd2.js
index 447706f..8bf8549 100644
--- a/crates/tabby/playground/_next/static/chunks/app/page-757d8cb1ec33d4cb.js
+++ b/crates/tabby/playground/_next/static/chunks/app/page-2ebc2d344df80bd2.js
@@ -1 +1 @@
-(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{92720:function(e,s,t){Promise.resolve().then(t.bind(t,64074))},64074:function(e,s,t){"use strict";t.r(s),t.d(s,{Chat:function(){return K}});var n=t(57437),a=t(57139),r=t(39311),l=t(2265),i=t(26823);let o=l.forwardRef((e,s)=>{let{className:t,orientation:a="horizontal",decorative:l=!0,...o}=e;return(0,n.jsx)(i.f,{ref:s,decorative:l,orientation:a,className:(0,r.cn)("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":"h-full w-[1px]",t),...o})});o.displayName=i.f.displayName;var c=t(48975),d=t(82180),u=t(30513),m=t(4523);function h(e){let{timeout:s=2e3}=e,[t,n]=l.useState(!1);return{isCopied:t,copyToClipboard:e=>{var t;(null===(t=navigator.clipboard)||void 0===t?void 0:t.writeText)&&e&&navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>{n(!1)},s)})}}}var p=t(84168),x=t(93023);let f={javascript:".js",python:".py",java:".java",c:".c",cpp:".cpp","c++":".cpp","c#":".cs",ruby:".rb",php:".php",swift:".swift","objective-c":".m",kotlin:".kt",typescript:".ts",go:".go",perl:".pl",rust:".rs",scala:".scala",haskell:".hs",lua:".lua",shell:".sh",sql:".sql",html:".html",css:".css"},g=function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t="ABCDEFGHJKLMNPQRSTUVWXY3456789",n="";for(let s=0;s{let{language:s,value:t}=e,{isCopied:a,copyToClipboard:r}=h({timeout:2e3});return(0,n.jsxs)("div",{className:"relative w-full font-sans codeblock bg-zinc-950",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between w-full px-6 py-2 pr-4 bg-zinc-800 text-zinc-100",children:[(0,n.jsx)("span",{className:"text-xs lowercase",children:s}),(0,n.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,n.jsxs)(x.z,{variant:"ghost",className:"hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>{let e=f[s]||".file",n="file-".concat(g(3,!0)).concat(e),a=window.prompt("Enter file name",n);if(!a)return;let r=new Blob([t],{type:"text/plain"}),l=URL.createObjectURL(r),i=document.createElement("a");i.download=a,i.href=l,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(l)},size:"icon",children:[(0,n.jsx)(p.Dj,{}),(0,n.jsx)("span",{className:"sr-only",children:"Download"})]}),(0,n.jsxs)(x.z,{variant:"ghost",size:"icon",className:"text-xs hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>{a||r(t)},children:[a?(0,n.jsx)(p.NO,{}):(0,n.jsx)(p.vU,{}),(0,n.jsx)("span",{className:"sr-only",children:"Copy code"})]})]})]}),(0,n.jsx)(u.Z,{language:s,style:m.RY,PreTag:"div",showLineNumbers:!0,customStyle:{margin:0,width:"100%",background:"transparent",padding:"1.5rem 1rem"},codeTagProps:{style:{fontSize:"0.9rem",fontFamily:"var(--font-mono)"}},children:t})]})});b.displayName="CodeBlock";var v=t(19349);let j=(0,l.memo)(v.D,(e,s)=>e.children===s.children&&e.className===s.className);var y=t(16691),w=t.n(y);function N(e){let{message:s,className:t,...a}=e,{isCopied:l,copyToClipboard:i}=h({timeout:2e3});return(0,n.jsx)("div",{className:(0,r.cn)("flex items-center justify-end transition-opacity group-hover:opacity-100 md:absolute md:-right-10 md:-top-2 md:opacity-0",t),...a,children:(0,n.jsxs)(x.z,{variant:"ghost",size:"icon",onClick:()=>{l||i(s.content)},children:[l?(0,n.jsx)(p.NO,{}):(0,n.jsx)(p.vU,{}),(0,n.jsx)("span",{className:"sr-only",children:"Copy message"})]})})}function k(e){let{message:s,...t}=e;return(0,n.jsxs)("div",{className:(0,r.cn)("group relative mb-4 flex items-start md:-ml-12"),...t,children:[(0,n.jsx)("div",{className:(0,r.cn)("flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border shadow","user"===s.role?"bg-background":"bg-primary text-primary-foreground"),children:"user"===s.role?(0,n.jsx)(p.f7,{}):(0,n.jsx)(z,{})}),(0,n.jsxs)("div",{className:"flex-1 px-1 ml-4 space-y-2 overflow-hidden",children:[(0,n.jsx)(j,{className:"prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0",remarkPlugins:[c.Z,d.Z],components:{p(e){let{children:s}=e;return(0,n.jsx)("p",{className:"mb-2 last:mb-0",children:s})},code(e){let{node:s,inline:t,className:a,children:r,...l}=e;if(r.length){if("▍"==r[0])return(0,n.jsx)("span",{className:"mt-1 cursor-default animate-pulse",children:"▍"});r[0]=r[0].replace("`▍`","▍")}let i=/language-(\w+)/.exec(a||"");return t?(0,n.jsx)("code",{className:a,...l,children:r}):(0,n.jsx)(b,{language:i&&i[1]||"",value:String(r).replace(/\n$/,""),...l},Math.random())}},children:s.content}),(0,n.jsx)(N,{message:s})]})]})}function z(){return(0,n.jsx)(w(),{style:{borderRadius:4},src:"https://avatars.githubusercontent.com/u/125617854?s=128&v=4",alt:"tabby",width:"128",height:"128"})}function C(e){let{messages:s}=e;return s.length?(0,n.jsx)("div",{className:"relative mx-auto max-w-2xl px-4",children:s.map((e,t)=>(0,n.jsxs)("div",{children:[(0,n.jsx)(k,{message:e}),t{if("Enter"===s.key&&!s.shiftKey&&!s.nativeEvent.isComposing){var t;null===(t=e.current)||void 0===t||t.requestSubmit(),s.preventDefault()}}}}(),d=l.useRef(null);return(0,R.useRouter)(),l.useEffect(()=>{d.current&&d.current.focus()},[]),(0,n.jsx)("form",{onSubmit:async e=>{e.preventDefault(),(null==t?void 0:t.trim())&&(a(""),await s(t))},ref:o,children:(0,n.jsxs)("div",{className:"relative flex max-h-60 w-full grow flex-col overflow-hidden bg-background px-8 sm:rounded-md sm:border sm:px-12",children:[(0,n.jsx)("span",{className:(0,r.cn)((0,x.d)({size:"sm",variant:"ghost"}),"absolute left-0 top-4 h-8 w-8 rounded-full bg-background p-0 sm:left-4 hover:bg-background"),children:(0,n.jsx)(p.yl,{})}),(0,n.jsx)(E.Z,{ref:d,tabIndex:0,onKeyDown:c,rows:1,value:t,onChange:e=>a(e.target.value),placeholder:"Ask a question.",spellCheck:!1,className:"min-h-[60px] w-full resize-none bg-transparent px-4 py-[1.3rem] focus-within:outline-none sm:text-sm"}),(0,n.jsx)("div",{className:"absolute right-0 top-4 sm:right-4",children:(0,n.jsxs)(L.u,{children:[(0,n.jsx)(L.aJ,{asChild:!0,children:(0,n.jsxs)(x.z,{type:"submit",size:"icon",disabled:i||""===t,children:[(0,n.jsx)(p.vq,{}),(0,n.jsx)("span",{className:"sr-only",children:"Send message"})]})}),(0,n.jsx)(L._v,{children:"Send message"})]})})]})})}function T(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,[s,t]=l.useState(!1);return l.useEffect(()=>{let s=()=>{t(window.innerHeight+window.scrollY>=document.body.offsetHeight-e)};return window.addEventListener("scroll",s,{passive:!0}),s(),()=>{window.removeEventListener("scroll",s)}},[e]),s}function _(e){let{className:s,...t}=e,a=T();return(0,n.jsxs)(x.z,{variant:"outline",size:"icon",className:(0,r.cn)("absolute right-4 top-1 z-10 bg-background transition-opacity duration-300 sm:right-8 md:top-2",a?"opacity-0":"opacity-100",s),onClick:()=>window.scrollTo({top:document.body.offsetHeight,behavior:"smooth"}),...t,children:[(0,n.jsx)(p.BD,{}),(0,n.jsx)("span",{className:"sr-only",children:"Scroll to bottom"})]})}function D(e){let{href:s,children:t}=e;return(0,n.jsxs)("a",{href:s,target:"_blank",className:"inline-flex flex-1 justify-center gap-1 leading-4 hover:underline",children:[(0,n.jsx)("span",{children:t}),(0,n.jsx)("svg",{"aria-hidden":"true",height:"7",viewBox:"0 0 6 6",width:"7",className:"opacity-70",children:(0,n.jsx)("path",{d:"M1.25215 5.54731L0.622742 4.9179L3.78169 1.75597H1.3834L1.38936 0.890915H5.27615V4.78069H4.40513L4.41109 2.38538L1.25215 5.54731Z",fill:"currentColor"})})]})}function B(e){let{className:s,...t}=e;return(0,n.jsxs)("p",{className:(0,r.cn)("px-2 text-center text-xs leading-normal text-muted-foreground",s),...t,children:[(0,n.jsx)(D,{href:"https://tabby.tabbyml.com",children:"Tabby"}),", an opensource, self-hosted AI coding assistant ."]})}function O(e){let{id:s,isLoading:t,stop:a,append:r,reload:l,input:i,setInput:o,messages:c}=e;return(0,n.jsxs)("div",{className:"fixed inset-x-0 bottom-0 bg-gradient-to-b from-muted/10 from-10% to-muted/30 to-50%",children:[(0,n.jsx)(_,{}),(0,n.jsxs)("div",{className:"mx-auto sm:max-w-2xl sm:px-4",children:[(0,n.jsx)("div",{className:"flex h-10 items-center justify-center",children:t?(0,n.jsxs)(x.z,{variant:"outline",onClick:()=>a(),className:"bg-background",children:[(0,n.jsx)(p.zu,{className:"mr-2"}),"Stop generating"]}):(null==c?void 0:c.length)>0&&(0,n.jsxs)(x.z,{variant:"outline",onClick:()=>l(),className:"bg-background",children:[(0,n.jsx)(p.tr,{className:"mr-2"}),"Regenerate response"]})}),(0,n.jsxs)("div",{className:"space-y-4 border-t bg-background px-4 py-2 shadow-lg sm:rounded-t-xl sm:border md:py-4",children:[(0,n.jsx)(S,{onSubmit:async e=>{await r({id:s,content:e,role:"user"})},input:i,setInput:o,isLoading:t}),(0,n.jsx)(B,{className:"hidden sm:block"})]})]})]})}let U=[{heading:"Explain technical concepts",message:'What is a "serverless function"?'},{heading:"Explain how to parse email address",message:"How to parse email address with regex"}];function H(e){let{setInput:s}=e;return(0,n.jsx)("div",{className:"mx-auto max-w-2xl px-4",children:(0,n.jsxs)("div",{className:"rounded-lg border bg-background p-8",children:[(0,n.jsx)("h1",{className:"mb-2 text-lg font-semibold",children:"Welcome to Tabby Playground!"}),(0,n.jsx)("p",{className:"leading-normal text-muted-foreground",children:"You can start a conversation here or try the following examples:"}),(0,n.jsx)("div",{className:"mt-4 flex flex-col items-start space-y-2",children:U.map((e,t)=>(0,n.jsxs)(x.z,{variant:"link",className:"h-auto p-0 text-base",onClick:()=>s(e.message),children:[(0,n.jsx)(p.Ec,{className:"mr-2 text-muted-foreground"}),e.heading]},t))})]})})}var I=t(4327);function P(e){let{trackVisibility:s}=e,t=T(),{ref:a,entry:r,inView:i}=(0,I.YD)({trackVisibility:s,delay:100,rootMargin:"0px 0px -150px 0px"});return l.useEffect(()=>{t&&s&&!i&&(null==r||r.target.scrollIntoView({block:"start"}))},[i,r,t,s]),(0,n.jsx)("div",{ref:a,className:"h-px w-full"})}var q=t(5925),M=t(4913),Y=t(62601);let A=Y.env.NEXT_PUBLIC_TABBY_SERVER_URL||"http://localhost:8080";function K(e){let{id:s,initialMessages:t,className:i}=e;(0,l.useEffect)(()=>{let e=window.fetch;window.fetch=async function(s,t){if("/api/chat"!==s)return e(s,t);let{messages:n}=JSON.parse(t.body),a=await e("".concat(A,"/v1beta/generate_stream"),{...t,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:function(e){let s=e[e.length-1].content;return"Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n".concat(s,"\n\n### Response:")}(n)})}),r=(0,M.Ks)(a,void 0);return new M.wn(r)}},[]);let{messages:o,append:c,reload:d,stop:u,isLoading:m,input:h,setInput:p,setMessages:x}=(0,a.R)({initialMessages:t,id:s,body:{id:s},onResponse(e){401===e.status&&q.toast.error(e.statusText)}});return o.length>2&&x(o.slice(o.length-2,o.length)),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:(0,r.cn)("pb-[200px] pt-4 md:pt-10",i),children:o.length?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C,{messages:o}),(0,n.jsx)(P,{trackVisibility:m})]}):(0,n.jsx)(H,{setInput:p})}),(0,n.jsx)(O,{id:s,isLoading:m,stop:u,append:c,reload:d,messages:o,input:h,setInput:p})]})}}},function(e){e.O(0,[346,978,524,971,864,744],function(){return e(e.s=92720)}),_N_E=e.O()}]);
\ No newline at end of file
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{92720:function(e,s,t){Promise.resolve().then(t.bind(t,10413))},10413:function(e,s,t){"use strict";t.r(s),t.d(s,{Chat:function(){return J}});var n=t(57437),a=t(57139),r=t(39311),l=t(2265),i=t(26823);let o=l.forwardRef((e,s)=>{let{className:t,orientation:a="horizontal",decorative:l=!0,...o}=e;return(0,n.jsx)(i.f,{ref:s,decorative:l,orientation:a,className:(0,r.cn)("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":"h-full w-[1px]",t),...o})});o.displayName=i.f.displayName;var c=t(48975),d=t(82180),u=t(30513),m=t(4523);function h(e){let{timeout:s=2e3}=e,[t,n]=l.useState(!1);return{isCopied:t,copyToClipboard:e=>{var t;(null===(t=navigator.clipboard)||void 0===t?void 0:t.writeText)&&e&&navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>{n(!1)},s)})}}}var p=t(84168),x=t(93023);let f={javascript:".js",python:".py",java:".java",c:".c",cpp:".cpp","c++":".cpp","c#":".cs",ruby:".rb",php:".php",swift:".swift","objective-c":".m",kotlin:".kt",typescript:".ts",go:".go",perl:".pl",rust:".rs",scala:".scala",haskell:".hs",lua:".lua",shell:".sh",sql:".sql",html:".html",css:".css"},g=function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t="ABCDEFGHJKLMNPQRSTUVWXY3456789",n="";for(let s=0;s{let{language:s,value:t}=e,{isCopied:a,copyToClipboard:r}=h({timeout:2e3});return(0,n.jsxs)("div",{className:"relative w-full font-sans codeblock bg-zinc-950",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between w-full px-6 py-2 pr-4 bg-zinc-800 text-zinc-100",children:[(0,n.jsx)("span",{className:"text-xs lowercase",children:s}),(0,n.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,n.jsxs)(x.z,{variant:"ghost",className:"hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>{let e=f[s]||".file",n="file-".concat(g(3,!0)).concat(e),a=window.prompt("Enter file name",n);if(!a)return;let r=new Blob([t],{type:"text/plain"}),l=URL.createObjectURL(r),i=document.createElement("a");i.download=a,i.href=l,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(l)},size:"icon",children:[(0,n.jsx)(p.Dj,{}),(0,n.jsx)("span",{className:"sr-only",children:"Download"})]}),(0,n.jsxs)(x.z,{variant:"ghost",size:"icon",className:"text-xs hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>{a||r(t)},children:[a?(0,n.jsx)(p.NO,{}):(0,n.jsx)(p.vU,{}),(0,n.jsx)("span",{className:"sr-only",children:"Copy code"})]})]})]}),(0,n.jsx)(u.Z,{language:s,style:m.RY,PreTag:"div",showLineNumbers:!0,customStyle:{margin:0,width:"100%",background:"transparent",padding:"1.5rem 1rem"},codeTagProps:{style:{fontSize:"0.9rem",fontFamily:"var(--font-mono)"}},children:t})]})});v.displayName="CodeBlock";var b=t(19349);let j=(0,l.memo)(b.D,(e,s)=>e.children===s.children&&e.className===s.className);var y=t(16691),w=t.n(y);function N(e){let{message:s,className:t,...a}=e,{isCopied:l,copyToClipboard:i}=h({timeout:2e3});return(0,n.jsx)("div",{className:(0,r.cn)("flex items-center justify-end transition-opacity group-hover:opacity-100 md:absolute md:-right-10 md:-top-2 md:opacity-0",t),...a,children:(0,n.jsxs)(x.z,{variant:"ghost",size:"icon",onClick:()=>{l||i(s.content)},children:[l?(0,n.jsx)(p.NO,{}):(0,n.jsx)(p.vU,{}),(0,n.jsx)("span",{className:"sr-only",children:"Copy message"})]})})}function k(e){let{message:s,...t}=e;return(0,n.jsxs)("div",{className:(0,r.cn)("group relative mb-4 flex items-start md:-ml-12"),...t,children:[(0,n.jsx)("div",{className:(0,r.cn)("flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border shadow","user"===s.role?"bg-background":"bg-primary text-primary-foreground"),children:"user"===s.role?(0,n.jsx)(p.f7,{}):(0,n.jsx)(z,{})}),(0,n.jsxs)("div",{className:"flex-1 px-1 ml-4 space-y-2 overflow-hidden",children:[(0,n.jsx)(j,{className:"prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0",remarkPlugins:[c.Z,d.Z],components:{p(e){let{children:s}=e;return(0,n.jsx)("p",{className:"mb-2 last:mb-0",children:s})},code(e){let{node:s,inline:t,className:a,children:r,...l}=e;if(r.length){if("▍"==r[0])return(0,n.jsx)("span",{className:"mt-1 cursor-default animate-pulse",children:"▍"});r[0]=r[0].replace("`▍`","▍")}let i=/language-(\w+)/.exec(a||"");return t?(0,n.jsx)("code",{className:a,...l,children:r}):(0,n.jsx)(v,{language:i&&i[1]||"",value:String(r).replace(/\n$/,""),...l},Math.random())}},children:s.content}),(0,n.jsx)(N,{message:s})]})]})}function z(){return(0,n.jsx)(w(),{style:{borderRadius:4},src:"https://avatars.githubusercontent.com/u/125617854?s=128&v=4",alt:"tabby",width:"128",height:"128"})}function C(e){let{messages:s}=e;return s.length?(0,n.jsx)("div",{className:"relative mx-auto max-w-2xl px-4",children:s.map((e,t)=>(0,n.jsxs)("div",{children:[(0,n.jsx)(k,{message:e}),t{if("Enter"===s.key&&!s.shiftKey&&!s.nativeEvent.isComposing){var t;null===(t=e.current)||void 0===t||t.requestSubmit(),s.preventDefault()}}}}(),d=l.useRef(null);return(0,T.useRouter)(),l.useEffect(()=>{d.current&&d.current.focus()},[]),(0,n.jsx)("form",{onSubmit:async e=>{e.preventDefault(),(null==t?void 0:t.trim())&&(a(""),await s(t))},ref:o,children:(0,n.jsxs)("div",{className:"relative flex max-h-60 w-full grow flex-col overflow-hidden bg-background px-8 sm:rounded-md sm:border sm:px-12",children:[(0,n.jsx)("span",{className:(0,r.cn)((0,x.d)({size:"sm",variant:"ghost"}),"absolute left-0 top-4 h-8 w-8 rounded-full bg-background p-0 sm:left-4 hover:bg-background"),children:(0,n.jsx)(p.yl,{})}),(0,n.jsx)(E.Z,{ref:d,tabIndex:0,onKeyDown:c,rows:1,value:t,onChange:e=>a(e.target.value),placeholder:"Ask a question.",spellCheck:!1,className:"min-h-[60px] w-full resize-none bg-transparent px-4 py-[1.3rem] focus-within:outline-none sm:text-sm"}),(0,n.jsx)("div",{className:"absolute right-0 top-4 sm:right-4",children:(0,n.jsxs)(R.u,{children:[(0,n.jsx)(R.aJ,{asChild:!0,children:(0,n.jsxs)(x.z,{type:"submit",size:"icon",disabled:i||""===t,children:[(0,n.jsx)(p.vq,{}),(0,n.jsx)("span",{className:"sr-only",children:"Send message"})]})}),(0,n.jsx)(R._v,{children:"Send message"})]})})]})})}function S(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,[s,t]=l.useState(!1);return l.useEffect(()=>{let s=()=>{t(window.innerHeight+window.scrollY>=document.body.offsetHeight-e)};return window.addEventListener("scroll",s,{passive:!0}),s(),()=>{window.removeEventListener("scroll",s)}},[e]),s}function _(e){let{className:s,...t}=e,a=S();return(0,n.jsxs)(x.z,{variant:"outline",size:"icon",className:(0,r.cn)("absolute right-4 top-1 z-10 bg-background transition-opacity duration-300 sm:right-8 md:top-2",a?"opacity-0":"opacity-100",s),onClick:()=>window.scrollTo({top:document.body.offsetHeight,behavior:"smooth"}),...t,children:[(0,n.jsx)(p.BD,{}),(0,n.jsx)("span",{className:"sr-only",children:"Scroll to bottom"})]})}function D(e){let{href:s,children:t}=e;return(0,n.jsxs)("a",{href:s,target:"_blank",className:"inline-flex flex-1 justify-center gap-1 leading-4 hover:underline",children:[(0,n.jsx)("span",{children:t}),(0,n.jsx)("svg",{"aria-hidden":"true",height:"7",viewBox:"0 0 6 6",width:"7",className:"opacity-70",children:(0,n.jsx)("path",{d:"M1.25215 5.54731L0.622742 4.9179L3.78169 1.75597H1.3834L1.38936 0.890915H5.27615V4.78069H4.40513L4.41109 2.38538L1.25215 5.54731Z",fill:"currentColor"})})]})}function O(e){let{className:s,...t}=e;return(0,n.jsxs)("p",{className:(0,r.cn)("px-2 text-center text-xs leading-normal text-muted-foreground",s),...t,children:[(0,n.jsx)(D,{href:"https://tabby.tabbyml.com",children:"Tabby"}),", an opensource, self-hosted AI coding assistant ."]})}function U(e){let{id:s,isLoading:t,stop:a,append:r,reload:l,input:i,setInput:o,messages:c}=e;return(0,n.jsxs)("div",{className:"fixed inset-x-0 bottom-0 bg-gradient-to-b from-muted/10 from-10% to-muted/30 to-50%",children:[(0,n.jsx)(_,{}),(0,n.jsxs)("div",{className:"mx-auto sm:max-w-2xl sm:px-4",children:[(0,n.jsx)("div",{className:"flex h-10 items-center justify-center",children:t?(0,n.jsxs)(x.z,{variant:"outline",onClick:()=>a(),className:"bg-background",children:[(0,n.jsx)(p.zu,{className:"mr-2"}),"Stop generating"]}):(null==c?void 0:c.length)>0&&(0,n.jsxs)(x.z,{variant:"outline",onClick:()=>l(),className:"bg-background",children:[(0,n.jsx)(p.tr,{className:"mr-2"}),"Regenerate response"]})}),(0,n.jsxs)("div",{className:"space-y-4 border-t bg-background px-4 py-2 shadow-lg sm:rounded-t-xl sm:border md:py-4",children:[(0,n.jsx)(L,{onSubmit:async e=>{await r({id:s,content:e,role:"user"})},input:i,setInput:o,isLoading:t}),(0,n.jsx)(O,{className:"hidden sm:block"})]})]})]})}let B=[{heading:"Explain technical concepts",message:'What is a "serverless function"?'},{heading:"Explain how to parse email address",message:"How to parse email address with regex"}];function H(e){let{setInput:s}=e;return(0,n.jsx)("div",{className:"mx-auto max-w-2xl px-4",children:(0,n.jsxs)("div",{className:"rounded-lg border bg-background p-8",children:[(0,n.jsx)("h1",{className:"mb-2 text-lg font-semibold",children:"Welcome to Tabby Playground!"}),(0,n.jsx)("p",{className:"leading-normal text-muted-foreground",children:"You can start a conversation here or try the following examples:"}),(0,n.jsx)("div",{className:"mt-4 flex flex-col items-start space-y-2",children:B.map((e,t)=>(0,n.jsxs)(x.z,{variant:"link",className:"h-auto p-0 text-base",onClick:()=>s(e.message),children:[(0,n.jsx)(p.Ec,{className:"mr-2 text-muted-foreground"}),e.heading]},t))})]})})}var P=t(4327);function I(e){let{trackVisibility:s}=e,t=S(),{ref:a,entry:r,inView:i}=(0,P.YD)({trackVisibility:s,delay:100,rootMargin:"0px 0px -150px 0px"});return l.useEffect(()=>{t&&s&&!i&&(null==r||r.target.scrollIntoView({block:"start"}))},[i,r,t,s]),(0,n.jsx)("div",{ref:a,className:"h-px w-full"})}var q=t(5925),M=t(4913);let Y=new TextDecoder("utf-8");async function A(e,s){for(let t of e){let{content:e}=JSON.parse(t);s.enqueue(e)}}async function V(e,s){let t="";for(;;){let{value:n,done:a}=await e.read();if(a)break;t+=Y.decode(n,{stream:!0});let r=t.split(/\r\n|\n|\r/g);t=r.pop()||"",await A(r,s)}if(t){let e=[t];await A(e,s)}s.close()}var Z=t(62601);let F=Z.env.NEXT_PUBLIC_TABBY_SERVER_URL||"http://localhost:8080";function J(e){let{id:s,initialMessages:t,className:i}=e;(0,l.useEffect)(()=>{let e=window.fetch;window.fetch=async function(s,t){var n;if("/api/chat"!==s)return e(s,t);let{messages:a}=JSON.parse(t.body),r=await e("".concat(F,"/v1beta/chat/completions"),{...t,method:"POST",headers:{"Content-Type":"application/json"}}),l=(n=void 0,(function(e){var s;let t=null===(s=e.body)||void 0===s?void 0:s.getReader();return new ReadableStream({async start(e){if(!t){e.close();return}await V(t,e)}})})(r).pipeThrough((0,M.T_)(n)).pipeThrough((0,M.h6)(null==n?void 0:n.experimental_streamData)));return new M.wn(l)}},[]);let{messages:o,append:c,reload:d,stop:u,isLoading:m,input:h,setInput:p,setMessages:x}=(0,a.R)({initialMessages:t,id:s,body:{id:s},onResponse(e){401===e.status&&q.toast.error(e.statusText)}});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:(0,r.cn)("pb-[200px] pt-4 md:pt-10",i),children:o.length?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C,{messages:o}),(0,n.jsx)(I,{trackVisibility:m})]}):(0,n.jsx)(H,{setInput:p})}),(0,n.jsx)(U,{id:s,isLoading:m,stop:u,append:c,reload:d,messages:o,input:h,setInput:p})]})}}},function(e){e.O(0,[346,978,524,971,864,744],function(){return e(e.s=92720)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/crates/tabby/playground/index.html b/crates/tabby/playground/index.html
index d28f629..d7abaee 100644
--- a/crates/tabby/playground/index.html
+++ b/crates/tabby/playground/index.html
@@ -1 +1 @@
-Tabby PlaygroundWelcome to Tabby Playground!
You can start a conversation here or try the following examples:
Tabby, an opensource, self-hosted AI coding assistant .
\ No newline at end of file
+Tabby PlaygroundWelcome to Tabby Playground!
You can start a conversation here or try the following examples:
Tabby, an opensource, self-hosted AI coding assistant .
\ No newline at end of file
diff --git a/crates/tabby/playground/index.txt b/crates/tabby/playground/index.txt
index 02a3767..0cec8a7 100644
--- a/crates/tabby/playground/index.txt
+++ b/crates/tabby/playground/index.txt
@@ -1,13 +1,13 @@
1:HL["/playground/_next/static/media/86fdec36ddd9097e-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
2:HL["/playground/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
3:HL["/playground/_next/static/css/d091dc2da2a795e4.css","style"]
-0:["f6rsO7djEUh4Fn3OO-Bie",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L4",[[["$","link","0",{"rel":"stylesheet","href":"/playground/_next/static/css/d091dc2da2a795e4.css","precedence":"next"}]],"$L5"]]]]
+0:["9a4m76mRTGOnagTYXSPKd",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L4",[[["$","link","0",{"rel":"stylesheet","href":"/playground/_next/static/css/d091dc2da2a795e4.css","precedence":"next"}]],"$L5"]]]]
6:I{"id":5925,"chunks":["346:static/chunks/346-c4227fa5fd95e485.js","524:static/chunks/524-6309ecb76a77fdcf.js","185:static/chunks/app/layout-38d79c8bb16c51be.js"],"name":"Toaster","async":false}
7:I{"id":78495,"chunks":["346:static/chunks/346-c4227fa5fd95e485.js","524:static/chunks/524-6309ecb76a77fdcf.js","185:static/chunks/app/layout-38d79c8bb16c51be.js"],"name":"Providers","async":false}
8:I{"id":78963,"chunks":["346:static/chunks/346-c4227fa5fd95e485.js","524:static/chunks/524-6309ecb76a77fdcf.js","185:static/chunks/app/layout-38d79c8bb16c51be.js"],"name":"Header","async":false}
9:I{"id":81443,"chunks":["272:static/chunks/webpack-e23fff8c5b5084ca.js","971:static/chunks/fd9d1056-5dfc77aa37d8c76f.js","864:static/chunks/864-1669531662d5540a.js"],"name":"","async":false}
a:I{"id":18639,"chunks":["272:static/chunks/webpack-e23fff8c5b5084ca.js","971:static/chunks/fd9d1056-5dfc77aa37d8c76f.js","864:static/chunks/864-1669531662d5540a.js"],"name":"","async":false}
-c:I{"id":64074,"chunks":["346:static/chunks/346-c4227fa5fd95e485.js","978:static/chunks/978-ab68c4a2390585a1.js","524:static/chunks/524-6309ecb76a77fdcf.js","931:static/chunks/app/page-757d8cb1ec33d4cb.js"],"name":"Chat","async":false}
+c:I{"id":10413,"chunks":["346:static/chunks/346-c4227fa5fd95e485.js","978:static/chunks/978-342eae78521d80e5.js","524:static/chunks/524-6309ecb76a77fdcf.js","931:static/chunks/app/page-2ebc2d344df80bd2.js"],"name":"Chat","async":false}
5:[["$","meta","0",{"charSet":"utf-8"}],["$","title","1",{"children":"Tabby Playground"}],["$","meta","2",{"name":"description","content":"Tabby, an opensource, self-hosted AI coding assistant."}],["$","meta","3",{"name":"theme-color","media":"(prefers-color-scheme: light)","content":"white"}],["$","meta","4",{"name":"theme-color","media":"(prefers-color-scheme: dark)","content":"black"}],["$","meta","5",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","6",{"name":"next-size-adjust"}]]
-4:[null,["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{}],["$","body",null,{"className":"font-sans antialiased __variable_4e6684 __variable_3d950d","children":[["$","$L6",null,{}],["$","$L7",null,{"attribute":"class","defaultTheme":"system","enableSystem":true,"children":[["$","div",null,{"className":"flex flex-col min-h-screen","children":[["$","$L8",null,{}],["$","main",null,{"className":"flex flex-col flex-1 bg-muted/50","children":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"childProp":{"current":["$Lb",["$","$Lc",null,{"id":"JBeXiJC"}],null],"segment":"__PAGE__"},"styles":[]}]}]]}],null]}]]}]]}],null]
+4:[null,["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{}],["$","body",null,{"className":"font-sans antialiased __variable_4e6684 __variable_3d950d","children":[["$","$L6",null,{}],["$","$L7",null,{"attribute":"class","defaultTheme":"system","enableSystem":true,"children":[["$","div",null,{"className":"flex flex-col min-h-screen","children":[["$","$L8",null,{}],["$","main",null,{"className":"flex flex-col flex-1 bg-muted/50","children":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"childProp":{"current":["$Lb",["$","$Lc",null,{"id":"Z43ogQe"}],null],"segment":"__PAGE__"},"styles":[]}]}]]}],null]}]]}]]}],null]
b:null
diff --git a/crates/tabby/src/serve/chat.rs b/crates/tabby/src/serve/chat.rs
new file mode 100644
index 0000000..2cf17d1
--- /dev/null
+++ b/crates/tabby/src/serve/chat.rs
@@ -0,0 +1,96 @@
+mod prompt;
+
+use std::sync::Arc;
+
+use async_stream::stream;
+use axum::{
+ extract::State,
+ response::{IntoResponse, Response},
+ Json,
+};
+use axum_streams::StreamBodyAs;
+use prompt::ChatPromptBuilder;
+use serde::{Deserialize, Serialize};
+use tabby_inference::{TextGeneration, TextGenerationOptions, TextGenerationOptionsBuilder};
+use tracing::instrument;
+use utoipa::ToSchema;
+
+pub struct ChatState {
+ engine: Arc>,
+ prompt_builder: ChatPromptBuilder,
+}
+
+impl ChatState {
+ pub fn new(engine: Arc>, prompt_template: String) -> Self {
+ Self {
+ engine,
+ prompt_builder: ChatPromptBuilder::new(prompt_template),
+ }
+ }
+}
+
+#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
+#[schema(example=json!({
+ "messages": [
+ Message { role: "user".to_owned(), content: "What is tail recursion?".to_owned()},
+ Message { role: "assistant".to_owned(), content: "It's a kind of optimization in compiler?".to_owned()},
+ Message { role: "user".to_owned(), content: "Could you share more details?".to_owned()},
+ ]
+}))]
+pub struct ChatCompletionRequest {
+ messages: Vec,
+}
+
+#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
+pub struct Message {
+ role: String,
+ content: String,
+}
+
+#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
+pub struct ChatCompletionChunk {
+ content: String,
+}
+
+#[utoipa::path(
+ post,
+ path = "/v1beta/chat/completions",
+ request_body = ChatCompletionRequest,
+ operation_id = "chat_completions",
+ tag = "v1beta",
+ responses(
+ (status = 200, description = "Success", body = ChatCompletionChunk, content_type = "application/jsonstream"),
+ (status = 405, description = "When chat model is not specified, the endpoint will returns 405 Method Not Allowed"),
+ )
+)]
+#[instrument(skip(state, request))]
+pub async fn completions(
+ State(state): State>,
+ Json(request): Json,
+) -> Response {
+ let (prompt, options) = parse_request(&state, request);
+ let s = stream! {
+ for await content in state.engine.generate_stream(&prompt, options).await {
+ yield ChatCompletionChunk { content }
+ }
+ };
+
+ StreamBodyAs::json_nl(s).into_response()
+}
+
+fn parse_request(
+ state: &Arc,
+ request: ChatCompletionRequest,
+) -> (String, TextGenerationOptions) {
+ let mut builder = TextGenerationOptionsBuilder::default();
+
+ builder
+ .max_input_length(2048)
+ .max_decoding_length(1920)
+ .sampling_temperature(0.1);
+
+ (
+ state.prompt_builder.build(&request.messages),
+ builder.build().unwrap(),
+ )
+}
diff --git a/crates/tabby/src/serve/chat/prompt.rs b/crates/tabby/src/serve/chat/prompt.rs
new file mode 100644
index 0000000..f4d9acf
--- /dev/null
+++ b/crates/tabby/src/serve/chat/prompt.rs
@@ -0,0 +1,65 @@
+use minijinja::{context, Environment};
+
+use super::Message;
+
+pub struct ChatPromptBuilder {
+ env: Environment<'static>,
+}
+
+impl ChatPromptBuilder {
+ pub fn new(prompt_template: String) -> Self {
+ let mut env = Environment::new();
+ env.add_function("raise_exception", |e: String| panic!("{}", e));
+ env.add_template_owned("prompt", prompt_template)
+ .expect("Failed to compile template");
+
+ Self { env }
+ }
+
+ pub fn build(&self, messages: &[Message]) -> String {
+ self.env
+ .get_template("prompt")
+ .unwrap()
+ .render(context!(
+ messages => messages
+ ))
+ .expect("Failed to evaluate")
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ static PROMPT_TEMPLATE : &str = "{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if message['role'] == 'user' %}{{ '[INST] ' + message['content'] + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + ' ' }}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}";
+
+ #[test]
+ fn test_it_works() {
+ let builder = ChatPromptBuilder::new(PROMPT_TEMPLATE.to_owned());
+ let messages = vec![
+ Message {
+ role: "user".to_owned(),
+ content: "What is tail recursion?".to_owned(),
+ },
+ Message {
+ role: "assistant".to_owned(),
+ content: "It's a kind of optimization in compiler?".to_owned(),
+ },
+ Message {
+ role: "user".to_owned(),
+ content: "Could you share more details?".to_owned(),
+ },
+ ];
+ assert_eq!(builder.build(&messages), "[INST] What is tail recursion? [/INST]It's a kind of optimization in compiler? [INST] Could you share more details? [/INST]")
+ }
+
+ #[test]
+ #[should_panic]
+ fn test_it_panic() {
+ let builder = ChatPromptBuilder::new(PROMPT_TEMPLATE.to_owned());
+ let messages = vec![Message {
+ role: "system".to_owned(),
+ content: "system".to_owned(),
+ }];
+ builder.build(&messages);
+ }
+}
diff --git a/crates/tabby/src/serve/completions.rs b/crates/tabby/src/serve/completions.rs
index 26bcfe7..1334b87 100644
--- a/crates/tabby/src/serve/completions.rs
+++ b/crates/tabby/src/serve/completions.rs
@@ -71,7 +71,7 @@ pub struct CompletionResponse {
)
)]
#[instrument(skip(state, request))]
-pub async fn completion(
+pub async fn completions(
State(state): State>,
Json(request): Json,
) -> Result, StatusCode> {
@@ -80,7 +80,7 @@ pub async fn completion(
.max_input_length(1024 + 512)
.max_decoding_length(128)
.sampling_temperature(0.1)
- .static_stop_words(get_stop_words(&language))
+ .stop_words(get_stop_words(&language))
.build()
.unwrap();
diff --git a/crates/tabby/src/serve/generate.rs b/crates/tabby/src/serve/generate.rs
deleted file mode 100644
index 1ec3f1c..0000000
--- a/crates/tabby/src/serve/generate.rs
+++ /dev/null
@@ -1,94 +0,0 @@
-use std::sync::Arc;
-
-use async_stream::stream;
-use axum::{extract::State, response::IntoResponse, Json};
-use axum_streams::StreamBodyAs;
-use serde::{Deserialize, Serialize};
-use tabby_inference::{TextGeneration, TextGenerationOptions, TextGenerationOptionsBuilder};
-use tracing::instrument;
-use utoipa::ToSchema;
-
-pub struct GenerateState {
- engine: Arc>,
-}
-
-impl GenerateState {
- pub fn new(engine: Arc>) -> Self {
- Self { engine }
- }
-}
-
-#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
-#[schema(example=json!({
- "prompt": "# Dijkstra'\''s shortest path algorithm in Python (4 spaces indentation) + complexity analysis:\n\n",
-}))]
-pub struct GenerateRequest {
- prompt: String,
- stop_words: Option>,
-}
-
-#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
-pub struct GenerateResponse {
- text: String,
-}
-
-#[utoipa::path(
- post,
- path = "/v1beta/generate",
- request_body = GenerateRequest,
- operation_id = "generate",
- tag = "v1beta",
- responses(
- (status = 200, description = "Success", body = GenerateResponse, content_type = "application/json"),
- )
-)]
-#[instrument(skip(state, request))]
-pub async fn generate(
- State(state): State>,
- Json(request): Json,
-) -> impl IntoResponse {
- let (prompt, options) = parse_request(request);
- Json(GenerateResponse {
- text: state.engine.generate(&prompt, options).await,
- })
-}
-
-#[utoipa::path(
- post,
- path = "/v1beta/generate_stream",
- request_body = GenerateRequest,
- operation_id = "generate_stream",
- tag = "v1beta",
- responses(
- (status = 200, description = "Success", body = GenerateResponse, content_type = "application/jsonstream"),
- )
-)]
-#[instrument(skip(state, request))]
-pub async fn generate_stream(
- State(state): State>,
- Json(request): Json,
-) -> impl IntoResponse {
- let (prompt, options) = parse_request(request);
- let s = stream! {
- for await text in state.engine.generate_stream(&prompt, options).await {
- yield GenerateResponse { text }
- }
- };
-
- StreamBodyAs::json_nl(s)
-}
-
-fn parse_request(request: GenerateRequest) -> (String, TextGenerationOptions) {
- let mut builder = TextGenerationOptionsBuilder::default();
-
- builder
- .max_input_length(1024)
- .max_decoding_length(968)
- .sampling_temperature(0.1);
-
- if let Some(stop_words) = request.stop_words {
- builder.stop_words(stop_words);
- };
-
- (request.prompt, builder.build().unwrap())
-}
diff --git a/crates/tabby/src/serve/health.rs b/crates/tabby/src/serve/health.rs
index 401255a..65ff7b2 100644
--- a/crates/tabby/src/serve/health.rs
+++ b/crates/tabby/src/serve/health.rs
@@ -11,7 +11,7 @@ use utoipa::ToSchema;
pub struct HealthState {
model: String,
#[serde(skip_serializing_if = "Option::is_none")]
- instruct_model: Option,
+ chat_model: Option,
device: String,
compute_type: String,
arch: String,
@@ -32,7 +32,7 @@ impl HealthState {
Self {
model: args.model.clone(),
- instruct_model: args.instruct_model.clone(),
+ chat_model: args.chat_model.clone(),
device: args.device.to_string(),
compute_type: args.compute_type.to_string(),
arch: ARCH.to_string(),
diff --git a/crates/tabby/src/serve/mod.rs b/crates/tabby/src/serve/mod.rs
index 2ce45dc..aee696a 100644
--- a/crates/tabby/src/serve/mod.rs
+++ b/crates/tabby/src/serve/mod.rs
@@ -1,7 +1,7 @@
+mod chat;
mod completions;
mod engine;
mod events;
-mod generate;
mod health;
mod playground;
@@ -42,15 +42,16 @@ Install following IDE / Editor extensions to get started with [Tabby](https://gi
servers(
(url = "https://playground.app.tabbyml.com", description = "Playground server"),
),
- paths(events::log_event, completions::completion, generate::generate, generate::generate_stream, health::health),
+ paths(events::log_event, completions::completions, chat::completions, health::health),
components(schemas(
events::LogEventRequest,
completions::CompletionRequest,
completions::CompletionResponse,
completions::Segments,
completions::Choice,
- generate::GenerateRequest,
- generate::GenerateResponse,
+ chat::ChatCompletionRequest,
+ chat::Message,
+ chat::ChatCompletionChunk,
health::HealthState,
health::Version,
))
@@ -105,14 +106,13 @@ pub enum ComputeType {
#[derive(Args)]
pub struct ServeArgs {
- /// Model id for `/completion` API endpoint.
+ /// Model id for `/completions` API endpoint.
#[clap(long)]
model: String,
- /// Model id for `/generate` and `/generate_stream` API endpoints.
- /// If not set, `model` will be loaded for the purpose.
+ /// Model id for `/chat/completions` API endpoints.
#[clap(long)]
- instruct_model: Option,
+ chat_model: Option,
#[clap(long, default_value_t = 8080)]
port: u16,
@@ -149,8 +149,8 @@ pub async fn main(config: &Config, args: &ServeArgs) {
if args.device != Device::ExperimentalHttp {
download_model(&args.model, &args.device).await;
- if let Some(instruct_model) = &args.instruct_model {
- download_model(instruct_model, &args.device).await;
+ if let Some(chat_model) = &args.chat_model {
+ download_model(chat_model, &args.device).await;
}
} else {
warn!("HTTP device is unstable and does not comply with semver expectations.")
@@ -160,12 +160,18 @@ pub async fn main(config: &Config, args: &ServeArgs) {
let doc = add_localhost_server(ApiDoc::openapi(), args.port);
let doc = add_proxy_server(doc, config.swagger.server_url.clone());
- let app = api_router(args, config)
+ let app = Router::new()
+ .merge(api_router(args, config))
.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", doc))
- .route("/playground", routing::get(playground::handler))
- .route("/playground/*path", routing::get(playground::handler))
.fallback(fallback());
+ let app = if args.chat_model.is_some() {
+ app.route("/playground", routing::get(playground::handler))
+ .route("/playground/*path", routing::get(playground::handler))
+ } else {
+ app
+ };
+
let address = SocketAddr::from((Ipv4Addr::UNSPECIFIED, args.port));
info!("Listening at {}", address);
@@ -177,15 +183,26 @@ pub async fn main(config: &Config, args: &ServeArgs) {
}
fn api_router(args: &ServeArgs, config: &Config) -> Router {
- let (engine, prompt_template) = create_engine(&args.model, args);
- let engine = Arc::new(engine);
- let instruct_engine = if let Some(instruct_model) = &args.instruct_model {
- Arc::new(create_engine(instruct_model, args).0)
- } else {
- engine.clone()
+ let completion_state = {
+ let (engine, prompt_template) = create_engine(&args.model, args);
+ let engine = Arc::new(engine);
+ let state = completions::CompletionState::new(engine.clone(), prompt_template, config);
+ Arc::new(state)
};
- Router::new()
+ let chat_state = if let Some(chat_model) = &args.chat_model {
+ let (engine, prompt_template) = create_engine(chat_model, args);
+ let Some(prompt_template) = prompt_template else {
+ panic!("Chat model requires specifying prompt template");
+ };
+ let engine = Arc::new(engine);
+ let state = chat::ChatState::new(engine, prompt_template);
+ Some(Arc::new(state))
+ } else {
+ None
+ };
+
+ let router = Router::new()
.route("/v1/events", routing::post(events::log_event))
.route(
"/v1/health",
@@ -193,22 +210,19 @@ fn api_router(args: &ServeArgs, config: &Config) -> Router {
)
.route(
"/v1/completions",
- routing::post(completions::completion).with_state(Arc::new(
- completions::CompletionState::new(engine.clone(), prompt_template, config),
- )),
- )
- .route(
- "/v1beta/generate",
- routing::post(generate::generate).with_state(Arc::new(generate::GenerateState::new(
- instruct_engine.clone(),
- ))),
- )
- .route(
- "/v1beta/generate_stream",
- routing::post(generate::generate_stream).with_state(Arc::new(
- generate::GenerateState::new(instruct_engine.clone()),
- )),
+ routing::post(completions::completions).with_state(completion_state),
+ );
+
+ let router = if let Some(chat_state) = chat_state {
+ router.route(
+ "/v1beta/chat/completions",
+ routing::post(chat::completions).with_state(chat_state),
)
+ } else {
+ router
+ };
+
+ router
.layer(CorsLayer::permissive())
.layer(opentelemetry_tracing_layer())
}