@brainbase-labs/chat-widget 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/embed/index.js +3 -3
- package/dist/index.cjs +17 -4
- package/dist/index.js +7613 -854
- package/dist/styles.css +1 -1
- package/package.json +7 -4
- package/styles.css +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react"),g=require("react/jsx-runtime"),Fn="bb-chat-";function Ut(e){try{const n=sessionStorage.getItem(`${Fn}${e}`);return n?JSON.parse(n):null}catch{return null}}function vn(e,n){try{sessionStorage.setItem(`${Fn}${e}`,JSON.stringify(n))}catch{}}function Tn(e){try{sessionStorage.removeItem(`${Fn}${e}`)}catch{}}function qt(e){const{config:n,apiClient:t,mockMode:r,onSessionStart:i,onSessionEnd:l,onMessage:o,onError:a}=e,[c,s]=F.useState([]),[u,p]=F.useState([]),[m,h]=F.useState(!1),[C,E]=F.useState(null),[_,x]=F.useState(null),N=F.useRef(0),T=F.useRef(!1);F.useEffect(()=>{if(T.current)return;T.current=!0;const A=Ut(n.embedId);A&&A.status==="active"&&(x(A.sessionId),s(A.messages),p(A.toolCalls),N.current=A.startTime)},[n.embedId]),F.useEffect(()=>{_&&c.length>0&&vn(n.embedId,{sessionId:_,deploymentId:n.deploymentId,workerId:n.workerId,flowId:n.flowId,startTime:N.current,messages:c,toolCalls:u,status:"active"})},[_,c,u,n]);const H=F.useCallback(async()=>(N.current=Date.now(),x(null),s([]),p([]),Tn(n.embedId),""),[n.embedId]),$=F.useCallback((A,L,v)=>{switch(A.type){case"session":{const P=A.data;P.session_id&&(v(P.session_id),P.is_new&&(N.current=Date.now(),i==null||i(P.session_id)));break}case"message":{const P=A.data;P.content&&s(I=>I.map(k=>k.id===L?{...k,content:P.content,status:"streaming"}:k));break}case"tool_call":{const P=A.data;p(I=>{const k=I.findIndex(j=>j.name===P.function&&j.status==="pending");return k!==-1&&P.result!==void 0?I.map((j,q)=>q===k?{...j,result:P.result,status:"completed"}:j):k===-1?[...I,{id:`tc-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:P.function,arguments:P.args??{},status:"pending",timestamp:Date.now()}]:I}),P.content&&s(I=>I.map(k=>k.id===L?{...k,content:P.content,status:"streaming"}:k));break}case"waiting":break;case"done":{s(P=>P.map(I=>I.id===L?{...I,status:"sent"}:I));break}case"completed":{s(P=>P.map(I=>I.id===L?{...I,status:"sent"}:I)),_&&vn(n.embedId,{sessionId:_,deploymentId:n.deploymentId,workerId:n.workerId,flowId:n.flowId,startTime:N.current,messages:c,toolCalls:u,status:"completed"});break}case"error":{const P=A.data;s(I=>I.map(k=>k.id===L?{...k,status:"error",content:P.error??"An error occurred"}:k));break}}},[n,_,c,u,i]),b=F.useCallback(async(A,L,v)=>{const P=A.getReader(),I=new TextDecoder;let k="";try{for(;;){const{done:j,value:q}=await P.read();if(j)break;for(k+=I.decode(q,{stream:!0});k.includes(`
|
|
2
2
|
|
|
3
|
-
`);){const[
|
|
3
|
+
`);){const[Y,J]=k.split(`
|
|
4
4
|
|
|
5
|
-
`,2);
|
|
6
|
-
`))if(te.startsWith("data: "))try{const pe=JSON.parse(te.slice(6));D(pe,k,j)}catch{}}}}finally{d.releaseLock()}},[D]),G=i.useCallback(async p=>{if(!p.trim())return;const k={id:`user-${Date.now()}`,role:"user",content:p,timestamp:Date.now(),status:"sent"};o(a=>[...a,k]),c==null||c(k);const j=`assistant-${Date.now()}`,d={id:j,role:"assistant",content:"",timestamp:Date.now(),status:"streaming"};o(a=>[...a,d]),T(!0),V(null);const h=a=>{_(a)};try{if(r){const a=n.sendMessage(p);for await(const f of a)D(f,j,h)}else{const a=await n.sendMessage({embedId:t.embedId,message:p,sessionId:b??void 0});await S(a,j,h)}o(a=>a.map(f=>f.id===j&&f.status==="streaming"?{...f,status:"sent"}:f))}catch(a){const f=a instanceof Error?a:new Error("Failed to send message");V(f),m==null||m(f),o(N=>N.map(C=>C.id===j?{...C,status:"error",content:"Failed to get response"}:C))}finally{T(!1)}},[b,n,r,t.embedId,D,S,c,m]),U=i.useCallback(async()=>{if(!b)return;const p={sessionId:b,deploymentId:t.deploymentId,workerId:t.workerId,flowId:t.flowId,startTime:$.current,messages:l,toolCalls:x,status:"completed"};g==null||g(p),X(t.embedId),_(null),o([]),L([])},[b,t,l,x,g]),A=i.useCallback(()=>{o([]),L([])},[]);return{messages:l,toolCalls:x,isLoading:E,error:W,sessionId:b,sendMessage:G,endSession:U,clearMessages:A,startNewSession:q}}const ne="https://chat-embed-deployment.onrender.com";function re(s=ne){return{async getDeploymentConfig(t){const n=await fetch(`${s}/chat/config/${t}`);if(!n.ok)throw new Error(`Failed to fetch deployment config: ${n.status}`);const r=await n.json();return{embedId:r.embedId,deploymentId:"",workerId:"",flowId:"",welcomeMessage:r.welcomeMessage,agentName:r.agentName,agentLogoUrl:r.agentLogoUrl,primaryColor:r.primaryColor,styling:r.styling}},async sendMessage(t){const n=await fetch(`${s}/chat/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embed_id:t.embedId,message:t.message,session_id:t.sessionId||void 0,metadata:t.metadata})});if(!n.ok){const r=await n.text();throw new Error(`Failed to send message: ${n.status} - ${r}`)}if(!n.body)throw new Error("No response stream available");return n.body}}}const he={embedId:"mock-embed-id",deploymentId:"mock-deployment-id",workerId:"mock-worker-id",flowId:"mock-flow-id",agentName:"AI Assistant",agentLogoUrl:void 0,primaryColor:"#1a1a2e",styling:{}},_e=[{trigger:/hello|hi|hey/i,response:"Hello! I'm a demo AI assistant. How can I help you today?",delay:500},{trigger:/weather/i,response:"I'd check the weather for you, but I'm in mock mode! In production, I could use a weather API.",delay:800,toolCalls:[{name:"get_weather",arguments:{location:"San Francisco"},result:{temperature:72,condition:"sunny"}}]},{trigger:/help|support/i,response:"I'm here to help! You can ask me questions, and I'll do my best to assist you. In production, I'd be connected to your agent with full capabilities.",delay:600},{trigger:/pricing|cost|price/i,response:"For pricing information, I'd typically check our database or connect you with the sales team. This is a mock response demonstrating how I'd handle pricing questions.",delay:700,toolCalls:[{name:"lookup_pricing",arguments:{plan:"all"},result:{plans:[{name:"Starter",price:"$29/mo"},{name:"Pro",price:"$99/mo"}]}}]},{trigger:/.*/,response:"I'm running in mock mode. This is a simulated response to demonstrate the chat UI. In production, I'd be connected to your agent!",delay:1e3}];function R(s){return new Promise(t=>setTimeout(t,s))}function ae(s,t){const n={...he,...s},r=t??_e,u=`mock-session-${Date.now()}`;return{async getDeploymentConfig(g){return await R(300),n},async*sendMessage(g){yield{type:"session",data:{session_id:u,is_new:!0},timestamp:Date.now()};const c=r.find(o=>typeof o.trigger=="string"?g.toLowerCase().includes(o.trigger.toLowerCase()):o.trigger.test(g))??r[r.length-1];if(await R(c.delay??500),c.toolCalls)for(const o of c.toolCalls)yield{type:"tool_call",data:{function:o.name,args:o.arguments},timestamp:Date.now()},await R(300),yield{type:"tool_call",data:{function:o.name,result:o.result},timestamp:Date.now()},await R(200);const m=c.response.split(" ");let l="";for(const o of m)l+=(l?" ":"")+o,yield{type:"message",data:{content:l,role:"assistant"},timestamp:Date.now()},await R(30+Math.random()*40);yield{type:"done",data:{session_id:u},timestamp:Date.now()}}}}const O=({className:s,color:t="currentColor",cutoutColor:n="var(--bb-primary-color)"})=>e.jsxs("svg",{className:s,viewBox:"0 0 800 800",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H788C794.627 400 800 405.373 800 412V740C800 773.137 773.137 800 740 800H412C405.373 800 400 794.627 400 788V412Z",fill:t}),e.jsx("circle",{cx:"400",cy:"400",r:"400",fill:t}),e.jsx("path",{d:"M0 60C0 26.8629 26.8629 0 60 0H397.614C398.932 0 400 1.06811 400 2.38569V2.38569C400 221.982 221.982 400 2.38569 400V400C1.06811 400 0 398.932 0 397.614V60Z",fill:t}),e.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H738C744.627 400 750 405.373 750 412V725C750 738.807 738.807 750 725 750H412C405.373 750 400 744.627 400 738V412Z",fill:t}),e.jsx("circle",{cx:"400",cy:"400",r:"350",fill:t}),e.jsx("path",{d:"M50 75C50 61.1929 61.1929 50 75 50H388C394.627 50 400 55.3726 400 62V388C400 394.627 394.627 400 388 400H62C55.3726 400 50 394.627 50 388V75Z",fill:t}),e.jsx("rect",{x:"399.919",y:"209",width:"270",height:"270",rx:"12",transform:"rotate(45 399.919 209)",fill:n})]}),fe="_header_1p6z5_1",xe="_compact_1p6z5_9",be="_headerBackground_1p6z5_20",ye="_headerContent_1p6z5_59",we="_topRow_1p6z5_64",je="_agentInfo_1p6z5_79",Ce="_agentLogo_1p6z5_85",ke="_agentLogoPlaceholder_1p6z5_102",ve="_brainbaseLogo_1p6z5_123",Ie="_agentName_1p6z5_137",Ne="_actions_1p6z5_144",Le="_actionButton_1p6z5_149",$e="_welcomeText_1p6z5_183",Se="_title_1p6z5_202",Be="_subtitle_1p6z5_210",y={header:fe,compact:xe,headerBackground:be,headerContent:ye,topRow:we,agentInfo:je,agentLogo:Ce,agentLogoPlaceholder:ke,brainbaseLogo:ve,agentName:Ie,actions:Ne,actionButton:Le,welcomeText:$e,title:Se,subtitle:Be},ce=({agentName:s="AI Assistant",agentLogoUrl:t,welcomeTitle:n,welcomeSubtitle:r,onClose:u,onNewChatRequest:g,showNewChatButton:c=!1,compact:m=!1})=>{const l=n||"Hello there.",o=r!==void 0?r:n?void 0:"How can we help?";return e.jsxs("div",{className:`${y.header} ${m?y.compact:""}`,children:[e.jsx("div",{className:y.headerBackground}),e.jsxs("div",{className:y.headerContent,children:[e.jsxs("div",{className:y.topRow,children:[e.jsxs("div",{className:y.agentInfo,children:[t?e.jsx("img",{src:t,alt:s,className:y.agentLogo}):e.jsx("div",{className:y.agentLogoPlaceholder,children:e.jsx(O,{className:y.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})}),e.jsx("span",{className:y.agentName,children:s})]}),e.jsxs("div",{className:y.actions,children:[c&&g&&e.jsx("button",{className:y.actionButton,onClick:g,"aria-label":"Start new chat",type:"button",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M12 5V19M5 12H19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),u&&e.jsx("button",{className:y.actionButton,onClick:u,"aria-label":"Close chat",type:"button",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),!m&&e.jsxs("div",{className:y.welcomeText,children:[e.jsx("h1",{className:y.title,children:l}),o&&e.jsx("p",{className:y.subtitle,children:o})]})]})]})},Me="_messageWrapper_c86gj_1",Te="_user_c86gj_19",We="_assistant_c86gj_24",De="_avatar_c86gj_28",Pe="_avatarPlaceholder_c86gj_43",He="_brainbaseLogo_c86gj_53",Ee="_messageBubble_c86gj_58",Ve="_error_c86gj_76",Ae="_content_c86gj_81",Re="_cursor_c86gj_88",ze="_errorIndicator_c86gj_107",v={messageWrapper:Me,user:Te,assistant:We,avatar:De,avatarPlaceholder:Pe,brainbaseLogo:He,messageBubble:Ee,error:Ve,content:Ae,cursor:Re,errorIndicator:ze},ie=({message:s,agentName:t,agentLogoUrl:n})=>{const r=s.role==="user",u=s.status==="streaming",g=s.status==="error";return e.jsxs("div",{className:`${v.messageWrapper} ${r?v.user:v.assistant}`,children:[!r&&e.jsx("div",{className:v.avatar,children:n?e.jsx("img",{src:n,alt:t||"AI"}):e.jsx("div",{className:v.avatarPlaceholder,children:e.jsx(O,{className:v.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})})}),e.jsxs("div",{className:`${v.messageBubble} ${g?v.error:""}`,role:"article","aria-label":`${r?"Your message":`${t||"AI"} says`}`,children:[e.jsxs("div",{className:v.content,children:[s.content,u&&e.jsx("span",{className:v.cursor})]}),g&&e.jsxs("div",{className:v.errorIndicator,children:[e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M12 8V12M12 16H12.01",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),e.jsx("span",{children:"Failed to send"})]})]})]})},Oe="_toolCall_1wby1_1",Fe="_iconWrapper_1wby1_24",qe="_spinner_1wby1_33",Ue="_checkIcon_1wby1_48",Ze="_errorIcon_1wby1_54",Ke="_content_1wby1_60",Je="_label_1wby1_66",Ge="_name_1wby1_73",Ye="_pending_1wby1_78",Xe="_completed_1wby1_82",Qe="_error_1wby1_54",I={toolCall:Oe,iconWrapper:Fe,spinner:qe,checkIcon:Ue,errorIcon:Ze,content:Ke,label:Je,name:Ge,pending:Ye,completed:Xe,error:Qe},le=({toolCall:s})=>{const t=s.status==="pending"||s.status==="executing",n=s.status==="completed",r=s.status==="error",u=g=>g.replace(/_/g," ").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,c=>c.toUpperCase());return e.jsxs("div",{className:`${I.toolCall} ${t?I.pending:""} ${n?I.completed:""} ${r?I.error:""}`,children:[e.jsx("div",{className:I.iconWrapper,children:t?e.jsx("div",{className:I.spinner}):n?e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:I.checkIcon,children:e.jsx("path",{d:"M20 6L9 17L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:I.errorIcon,children:e.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsxs("div",{className:I.content,children:[e.jsx("span",{className:I.label,children:t?"Running":n?"Completed":"Failed"}),e.jsx("span",{className:I.name,children:u(s.name)})]})]})},et="_wrapper_10rss_2",tt="_avatar_10rss_22",st="_avatarPlaceholder_10rss_37",ot="_brainbaseLogo_10rss_47",nt="_bubble_10rss_52",rt="_dot_10rss_63",B={wrapper:et,avatar:tt,avatarPlaceholder:st,brainbaseLogo:ot,bubble:nt,dot:rt},de=({agentName:s="AI",agentLogoUrl:t})=>e.jsxs("div",{className:B.wrapper,role:"status","aria-label":`${s} is typing`,children:[e.jsx("div",{className:B.avatar,children:t?e.jsx("img",{src:t,alt:s}):e.jsx("div",{className:B.avatarPlaceholder,children:e.jsx(O,{className:B.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})})}),e.jsxs("div",{className:B.bubble,children:[e.jsx("span",{className:B.dot}),e.jsx("span",{className:B.dot}),e.jsx("span",{className:B.dot})]})]}),at="_messageList_241kk_1",ct="_emptyState_241kk_29",it="_emptyIcon_241kk_40",lt="_emptyText_241kk_52",Z={messageList:at,emptyState:ct,emptyIcon:it,emptyText:lt},ue=({messages:s,toolCalls:t=[],isLoading:n,agentName:r,agentLogoUrl:u})=>{var l;const g=i.useRef(null),c=i.useRef(null);i.useEffect(()=>{var o;(o=c.current)==null||o.scrollIntoView({behavior:"smooth"})},[s,t,n]);const m=t.filter(o=>o.status==="pending"||o.status==="executing");return e.jsxs("div",{className:Z.messageList,ref:g,role:"log","aria-live":"polite",children:[s.length===0&&!n&&e.jsxs("div",{className:Z.emptyState,children:[e.jsx("div",{className:Z.emptyIcon,children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M8 12H8.01M12 12H12.01M16 12H16.01M21 12C21 16.4183 16.9706 20 12 20C10.4607 20 9.01172 19.6565 7.74467 19.0511L3 20L4.39499 16.28C3.51156 15.0423 3 13.5743 3 12C3 7.58172 7.02944 4 12 4C16.9706 4 21 7.58172 21 12Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsx("p",{className:Z.emptyText,children:"Start a conversation"})]}),s.map(o=>e.jsx(ie,{message:o,agentName:r,agentLogoUrl:u},o.id)),m.map(o=>e.jsx(le,{toolCall:o},o.id)),n&&((l=s[s.length-1])==null?void 0:l.role)==="user"&&e.jsx(de,{agentName:r,agentLogoUrl:u}),e.jsx("div",{ref:c})]})},dt="_inputWrapper_5lgg7_1",ut="_inputContainer_5lgg7_7",gt="_textarea_5lgg7_23",mt="_sendButton_5lgg7_50",pt="_hint_5lgg7_89",z={inputWrapper:dt,inputContainer:ut,textarea:gt,sendButton:mt,hint:pt},ge=({onSend:s,disabled:t=!1,placeholder:n="Send a message..."})=>{const[r,u]=i.useState(""),g=i.useRef(null),c=i.useCallback(()=>{const o=g.current;o&&(o.style.height="auto",o.style.height=`${Math.min(o.scrollHeight,150)}px`)},[]);i.useEffect(()=>{c()},[r,c]);const m=i.useCallback(o=>{o==null||o.preventDefault();const x=r.trim();x&&!t&&(s(x),u(""),g.current&&(g.current.style.height="auto"))},[r,t,s]),l=i.useCallback(o=>{o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),m())},[m]);return e.jsxs("form",{className:z.inputWrapper,onSubmit:m,children:[e.jsxs("div",{className:z.inputContainer,children:[e.jsx("textarea",{ref:g,className:z.textarea,value:r,onChange:o=>u(o.target.value),onKeyDown:l,placeholder:n,disabled:t,rows:1,"aria-label":"Message input"}),e.jsx("button",{type:"submit",className:z.sendButton,disabled:t||!r.trim(),"aria-label":"Send message",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:z.hint,children:["Press ",e.jsx("kbd",{children:"Enter"})," to send, ",e.jsx("kbd",{children:"Shift + Enter"})," for new line"]})]})},ht="_poweredBy_9jh5q_1",_t="_logo_9jh5q_20",ft="_poweredText_9jh5q_24",xt="_text_9jh5q_36",K={poweredBy:ht,logo:_t,poweredText:ft,text:xt},bt=({className:s})=>e.jsxs("svg",{className:s,viewBox:"0 0 800 800",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H788C794.627 400 800 405.373 800 412V740C800 773.137 773.137 800 740 800H412C405.373 800 400 794.627 400 788V412Z",fill:"currentColor"}),e.jsx("circle",{cx:"400",cy:"400",r:"400",fill:"currentColor"}),e.jsx("path",{d:"M0 60C0 26.8629 26.8629 0 60 0H397.614C398.932 0 400 1.06811 400 2.38569V2.38569C400 221.982 221.982 400 2.38569 400V400C1.06811 400 0 398.932 0 397.614V60Z",fill:"currentColor"}),e.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H738C744.627 400 750 405.373 750 412V725C750 738.807 738.807 750 725 750H412C405.373 750 400 744.627 400 738V412Z",fill:"currentColor"}),e.jsx("circle",{cx:"400",cy:"400",r:"350",fill:"currentColor"}),e.jsx("path",{d:"M50 75C50 61.1929 61.1929 50 75 50H388C394.627 50 400 55.3726 400 62V388C400 394.627 394.627 400 388 400H62C55.3726 400 50 394.627 50 388V75Z",fill:"currentColor"}),e.jsx("rect",{x:"399.919",y:"209",width:"270",height:"270",rx:"12",transform:"rotate(45 399.919 209)",fill:"var(--bb-surface-bg, #ffffff)"})]}),yt=({showBranding:s=!0})=>s?e.jsxs("a",{href:"https://brainbaselabs.com/",target:"_blank",rel:"noopener noreferrer",className:K.poweredBy,"aria-label":"Powered by Brainbase Labs",children:[e.jsx("span",{className:K.poweredText,children:"Powered by"}),e.jsx(bt,{className:K.logo}),e.jsx("span",{className:K.text,children:"Brainbase Labs"})]}):null,wt="_container_m2o9l_1",jt="_body_m2o9l_26",Ct="_confirmationOverlay_m2o9l_35",kt="_confirmationDialog_m2o9l_56",vt="_confirmationText_m2o9l_78",It="_confirmationButtons_m2o9l_86",Nt="_cancelButton_m2o9l_91",Lt="_confirmButton_m2o9l_92",M={container:wt,body:jt,confirmationOverlay:Ct,confirmationDialog:kt,confirmationText:vt,confirmationButtons:It,cancelButton:Nt,confirmButton:Lt},me=({config:s,messages:t,toolCalls:n=[],isLoading:r,onSendMessage:u,onClose:g,onNewChat:c})=>{var T;const[m,l]=i.useState(!1),o=t.length>0,x=()=>{l(!0)},L=()=>{l(!1),c==null||c()},E=()=>{l(!1)};return e.jsxs("div",{className:M.container,role:"dialog","aria-label":"Chat window",children:[e.jsx(ce,{agentName:s.agentName,agentLogoUrl:s.agentLogoUrl,welcomeTitle:s.welcomeMessage||"Hello there.",welcomeSubtitle:s.welcomeMessage?void 0:"How can we help?",onClose:g,onNewChatRequest:x,showNewChatButton:o,compact:o}),e.jsxs("div",{className:M.body,children:[e.jsx(ue,{messages:t,toolCalls:n,isLoading:r,agentName:s.agentName,agentLogoUrl:s.agentLogoUrl}),e.jsx(ge,{onSend:u,disabled:r,placeholder:"Ask a question..."})]}),e.jsx(yt,{showBranding:((T=s.styling)==null?void 0:T.showBranding)??!0}),m&&e.jsx("div",{className:M.confirmationOverlay,children:e.jsxs("div",{className:M.confirmationDialog,children:[e.jsx("p",{className:M.confirmationText,children:"End current chat and start a new conversation?"}),e.jsxs("div",{className:M.confirmationButtons,children:[e.jsx("button",{className:M.cancelButton,onClick:E,type:"button",children:"Cancel"}),e.jsx("button",{className:M.confirmButton,onClick:L,type:"button",children:"End Chat"})]})]})})]})},$t="_toggleButton_11dqz_1",St="_icon_11dqz_31",Bt="_agentLogo_11dqz_36",Mt="_unreadBadge_11dqz_43",J={toggleButton:$t,icon:St,agentLogo:Bt,unreadBadge:Mt},Q=({onClick:s,agentLogoUrl:t,unreadCount:n=0})=>e.jsxs("button",{className:J.toggleButton,onClick:s,"aria-label":"Open chat",type:"button",children:[t?e.jsx("img",{src:t,alt:"",className:J.agentLogo}):e.jsx("svg",{className:J.icon,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8 12H8.01M12 12H12.01M16 12H16.01M21 12C21 16.4183 16.9706 20 12 20C10.4607 20 9.01172 19.6565 7.74467 19.0511L3 20L4.39499 16.28C3.51156 15.0423 3 13.5743 3 12C3 7.58172 7.02944 4 12 4C16.9706 4 21 7.58172 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),n>0&&e.jsx("span",{className:J.unreadBadge,children:n>9?"9+":n})]}),Tt="_container_kgfgt_1",Wt="_header_kgfgt_25",Dt="_logoWrapper_kgfgt_38",Pt="_logo_kgfgt_38",Ht="_closeButton_kgfgt_51",Et="_content_kgfgt_74",Vt="_iconWrapper_kgfgt_84",At="_errorIcon_kgfgt_95",Rt="_title_kgfgt_101",zt="_description_kgfgt_109",Ot="_retryButton_kgfgt_117",Ft="_footer_kgfgt_139",qt="_poweredBy_kgfgt_146",Ut="_footerLogo_kgfgt_160",w={container:Tt,header:Wt,logoWrapper:Dt,logo:Pt,closeButton:Ht,content:Et,iconWrapper:Vt,errorIcon:At,title:Rt,description:zt,retryButton:Ot,footer:Ft,poweredBy:qt,footerLogo:Ut},Zt=({errorType:s,message:t,onRetry:n,onClose:r})=>{const u=()=>{switch(s){case"not_found":return{title:"Chat Not Found",description:t||"This chat widget is not configured correctly. Please check the embed ID.",icon:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:w.errorIcon,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M12 7V13M12 16V16.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})};case"network":return{title:"Connection Error",description:t||"Unable to connect to the chat service. Please check your internet connection.",icon:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:w.errorIcon,children:[e.jsx("path",{d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M8 15L16 9M8 9L16 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})};default:return{title:"Something Went Wrong",description:t||"An unexpected error occurred. Please try again later.",icon:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:w.errorIcon,children:e.jsx("path",{d:"M12 9V13M12 17H12.01M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}}},{title:g,description:c,icon:m}=u();return e.jsxs("div",{className:w.container,children:[e.jsxs("div",{className:w.header,children:[e.jsx("div",{className:w.logoWrapper,children:e.jsx(O,{className:w.logo,color:"white",cutoutColor:"var(--bb-primary-color)"})}),r&&e.jsx("button",{className:w.closeButton,onClick:r,"aria-label":"Close",type:"button",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:w.content,children:[e.jsx("div",{className:w.iconWrapper,children:m}),e.jsx("h2",{className:w.title,children:g}),e.jsx("p",{className:w.description,children:c}),n&&e.jsx("button",{className:w.retryButton,onClick:n,type:"button",children:"Try Again"})]}),e.jsx("div",{className:w.footer,children:e.jsxs("a",{href:"https://brainbaselabs.com",target:"_blank",rel:"noopener noreferrer",className:w.poweredBy,children:["Powered by"," ",e.jsx(O,{className:w.footerLogo,color:"var(--bb-text-tertiary)",cutoutColor:"var(--bb-surface-bg)"}),e.jsx("span",{children:"Brainbase Labs"})]})})]})},Kt="_widget_1ehud_1",Jt="_inline_1ehud_25",H={widget:Kt,"bottom-right":"_bottom-right_1ehud_10","bottom-left":"_bottom-left_1ehud_17",inline:Jt},Gt=({embedId:s,apiBaseUrl:t=ne,mockMode:n=!1,mockResponses:r,position:u="bottom-right",defaultOpen:g=!1,primaryColor:c,agentName:m,welcomeMessage:l,showBranding:o,className:x,onSessionStart:L,onSessionEnd:E,onMessage:T,onError:W})=>{const[V,b]=i.useState(g),[_,$]=i.useState(null),[F,q]=i.useState(!0),[D,S]=i.useState(null),[G,U]=i.useState(),A=i.useMemo(()=>n?ae({primaryColor:c,agentName:m,welcomeMessage:l},r):re(t),[n,c,m,l,r,t]),p=i.useCallback(async()=>{q(!0),S(null),U(void 0);try{const C=await A.getDeploymentConfig(s);$({...C,primaryColor:c??C.primaryColor,agentName:m??C.agentName,welcomeMessage:l??C.welcomeMessage,styling:{...C.styling??{},...o!==void 0?{showBranding:o}:{}}})}catch(C){const P=C instanceof Error?C:new Error("Failed to load config");P.message.includes("404")?(S("not_found"),U("The chat widget with this embed ID was not found.")):P.message.includes("Failed to fetch")||P.message.includes("network")?S("network"):S("unknown"),n&&($({embedId:s,deploymentId:"mock-deployment",workerId:"mock-worker",flowId:"mock-flow",primaryColor:c??"#1a1a2e",agentName:m??"AI Assistant",styling:o!==void 0?{showBranding:o}:void 0}),S(null)),W==null||W(P)}finally{q(!1)}},[s,n,A,c,m,l,W]);i.useEffect(()=>{p()},[p]);const k=i.useMemo(()=>_||{embedId:s,deploymentId:"",workerId:"",flowId:"",primaryColor:c,agentName:m,welcomeMessage:l,styling:o!==void 0?{showBranding:o}:void 0},[_,s,c,m,l,o]),j=oe({config:k,apiClient:A,mockMode:n,onSessionStart:L,onSessionEnd:E,onMessage:T,onError:W}),d=i.useMemo(()=>({"--bb-primary-color":(_==null?void 0:_.primaryColor)??c??"#1a1a2e"}),[_==null?void 0:_.primaryColor,c]),h=()=>{j.endSession(),j.startNewSession()},a=()=>{b(!1)},f=()=>{p()},N=u==="inline";return F?null:D&&!n?!N&&!V?e.jsx("div",{className:`${H.widget} ${H[u]} ${x??""}`,style:d,children:e.jsx(Q,{onClick:()=>b(!0),agentName:m})}):e.jsx("div",{className:`${H.widget} ${H[u]} ${x??""}`,style:d,children:e.jsx(Zt,{errorType:D,message:G,onRetry:f,onClose:N?void 0:a})}):e.jsx("div",{className:`${H.widget} ${H[u]} ${x??""}`,style:d,children:V||N?e.jsx(me,{config:k,messages:j.messages,isLoading:j.isLoading,onSendMessage:j.sendMessage,onClose:N?void 0:a,onNewChat:h}):e.jsx(Q,{onClick:()=>b(!0),agentName:_==null?void 0:_.agentName,agentLogoUrl:_==null?void 0:_.agentLogoUrl})})};function Yt(){if(typeof crypto<"u"&&crypto.randomUUID)return`bb-${crypto.randomUUID()}`;const s=Date.now().toString(36),t=Math.random().toString(36).substring(2,15),n=Math.random().toString(36).substring(2,15);return`bb-${s}-${t}${n}`}exports.ChatContainer=me;exports.ChatHeader=ce;exports.ChatToggleButton=Q;exports.ChatWidget=Gt;exports.Message=ie;exports.MessageInput=ge;exports.MessageList=ue;exports.ToolCallDisplay=le;exports.TypingIndicator=de;exports.clearSession=X;exports.createAPIClient=re;exports.createMockAPIClient=ae;exports.generateSessionId=Yt;exports.getStoredSession=se;exports.storeSession=Y;exports.useChat=oe;
|
|
5
|
+
`,2);k=J;for(const f of Y.split(`
|
|
6
|
+
`))if(f.startsWith("data: "))try{const le=JSON.parse(f.slice(6));$(le,L,v)}catch{}}}}finally{P.releaseLock()}},[$]),O=F.useCallback(async A=>{if(!A.trim())return;const L={id:`user-${Date.now()}`,role:"user",content:A,timestamp:Date.now(),status:"sent"};s(k=>[...k,L]),o==null||o(L);const v=`assistant-${Date.now()}`,P={id:v,role:"assistant",content:"",timestamp:Date.now(),status:"streaming"};s(k=>[...k,P]),h(!0),E(null);const I=k=>{x(k)};try{if(r){const k=t.sendMessage(A);for await(const j of k)$(j,v,I)}else{const k=await t.sendMessage({embedId:n.embedId,message:A,sessionId:_??void 0});await b(k,v,I)}s(k=>k.map(j=>j.id===v&&j.status==="streaming"?{...j,status:"sent"}:j))}catch(k){const j=k instanceof Error?k:new Error("Failed to send message");E(j),a==null||a(j),s(q=>q.map(Y=>Y.id===v?{...Y,status:"error",content:"Failed to get response"}:Y))}finally{h(!1)}},[_,t,r,n.embedId,$,b,o,a]),V=F.useCallback(async()=>{if(!_)return;const A={sessionId:_,deploymentId:n.deploymentId,workerId:n.workerId,flowId:n.flowId,startTime:N.current,messages:c,toolCalls:u,status:"completed"};l==null||l(A),Tn(n.embedId),x(null),s([]),p([])},[_,n,c,u,l]),B=F.useCallback(()=>{s([]),p([])},[]);return{messages:c,toolCalls:u,isLoading:m,error:C,sessionId:_,sendMessage:O,endSession:V,clearMessages:B,startNewSession:H}}const Wt="https://chat-embed-deployment.onrender.com";function Yt(e=Wt){return{async getDeploymentConfig(n){const t=await fetch(`${e}/chat/config/${n}`);if(!t.ok)throw new Error(`Failed to fetch deployment config: ${t.status}`);const r=await t.json();return{embedId:r.embedId,deploymentId:"",workerId:"",flowId:"",welcomeMessage:r.welcomeMessage,agentName:r.agentName,agentLogoUrl:r.agentLogoUrl,primaryColor:r.primaryColor,styling:r.styling}},async sendMessage(n){const t=await fetch(`${e}/chat/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embed_id:n.embedId,message:n.message,session_id:n.sessionId||void 0,metadata:n.metadata})});if(!t.ok){const r=await t.text();throw new Error(`Failed to send message: ${t.status} - ${r}`)}if(!t.body)throw new Error("No response stream available");return t.body}}}const Yr={embedId:"mock-embed-id",deploymentId:"mock-deployment-id",workerId:"mock-worker-id",flowId:"mock-flow-id",agentName:"AI Assistant",agentLogoUrl:void 0,primaryColor:"#1a1a2e",styling:{}},Xr=[{trigger:/hello|hi|hey/i,response:"Hello! I'm a demo AI assistant. How can I help you today?",delay:500},{trigger:/weather/i,response:"I'd check the weather for you, but I'm in mock mode! In production, I could use a weather API.",delay:800,toolCalls:[{name:"get_weather",arguments:{location:"San Francisco"},result:{temperature:72,condition:"sunny"}}]},{trigger:/help|support/i,response:"I'm here to help! You can ask me questions, and I'll do my best to assist you. In production, I'd be connected to your agent with full capabilities.",delay:600},{trigger:/pricing|cost|price/i,response:"For pricing information, I'd typically check our database or connect you with the sales team. This is a mock response demonstrating how I'd handle pricing questions.",delay:700,toolCalls:[{name:"lookup_pricing",arguments:{plan:"all"},result:{plans:[{name:"Starter",price:"$29/mo"},{name:"Pro",price:"$99/mo"}]}}]},{trigger:/.*/,response:"I'm running in mock mode. This is a simulated response to demonstrate the chat UI. In production, I'd be connected to your agent!",delay:1e3}];function $e(e){return new Promise(n=>setTimeout(n,e))}function Xt(e,n){const t={...Yr,...e},r=n??Xr,i=`mock-session-${Date.now()}`;return{async getDeploymentConfig(l){return await $e(300),t},async*sendMessage(l){yield{type:"session",data:{session_id:i,is_new:!0},timestamp:Date.now()};const o=r.find(s=>typeof s.trigger=="string"?l.toLowerCase().includes(s.trigger.toLowerCase()):s.trigger.test(l))??r[r.length-1];if(await $e(o.delay??500),o.toolCalls)for(const s of o.toolCalls)yield{type:"tool_call",data:{function:s.name,args:s.arguments},timestamp:Date.now()},await $e(300),yield{type:"tool_call",data:{function:s.name,result:s.result},timestamp:Date.now()},await $e(200);const a=o.response.split(" ");let c="";for(const s of a)c+=(c?" ":"")+s,yield{type:"message",data:{content:c,role:"assistant"},timestamp:Date.now()},await $e(30+Math.random()*40);yield{type:"done",data:{session_id:i},timestamp:Date.now()}}}}const Qe=({className:e,color:n="currentColor",cutoutColor:t="var(--bb-primary-color)"})=>g.jsxs("svg",{className:e,viewBox:"0 0 800 800",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H788C794.627 400 800 405.373 800 412V740C800 773.137 773.137 800 740 800H412C405.373 800 400 794.627 400 788V412Z",fill:n}),g.jsx("circle",{cx:"400",cy:"400",r:"400",fill:n}),g.jsx("path",{d:"M0 60C0 26.8629 26.8629 0 60 0H397.614C398.932 0 400 1.06811 400 2.38569V2.38569C400 221.982 221.982 400 2.38569 400V400C1.06811 400 0 398.932 0 397.614V60Z",fill:n}),g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H738C744.627 400 750 405.373 750 412V725C750 738.807 738.807 750 725 750H412C405.373 750 400 744.627 400 738V412Z",fill:n}),g.jsx("circle",{cx:"400",cy:"400",r:"350",fill:n}),g.jsx("path",{d:"M50 75C50 61.1929 61.1929 50 75 50H388C394.627 50 400 55.3726 400 62V388C400 394.627 394.627 400 388 400H62C55.3726 400 50 394.627 50 388V75Z",fill:n}),g.jsx("rect",{x:"399.919",y:"209",width:"270",height:"270",rx:"12",transform:"rotate(45 399.919 209)",fill:t})]}),Kr="_header_1p6z5_1",Qr="_compact_1p6z5_9",Zr="_headerBackground_1p6z5_20",Jr="_headerContent_1p6z5_59",Gr="_topRow_1p6z5_64",ei="_agentInfo_1p6z5_79",ni="_agentLogo_1p6z5_85",ti="_agentLogoPlaceholder_1p6z5_102",ri="_brainbaseLogo_1p6z5_123",ii="_agentName_1p6z5_137",li="_actions_1p6z5_144",oi="_actionButton_1p6z5_149",ai="_welcomeText_1p6z5_183",si="_title_1p6z5_202",ui="_subtitle_1p6z5_210",G={header:Kr,compact:Qr,headerBackground:Zr,headerContent:Jr,topRow:Gr,agentInfo:ei,agentLogo:ni,agentLogoPlaceholder:ti,brainbaseLogo:ri,agentName:ii,actions:li,actionButton:oi,welcomeText:ai,title:si,subtitle:ui},Kt=({agentName:e="AI Assistant",agentLogoUrl:n,welcomeTitle:t,welcomeSubtitle:r,onClose:i,onNewChatRequest:l,showNewChatButton:o=!1,compact:a=!1})=>{const c=t||"Hello there.",s=r!==void 0?r:t?void 0:"How can we help?";return g.jsxs("div",{className:`${G.header} ${a?G.compact:""}`,children:[g.jsx("div",{className:G.headerBackground}),g.jsxs("div",{className:G.headerContent,children:[g.jsxs("div",{className:G.topRow,children:[g.jsxs("div",{className:G.agentInfo,children:[n?g.jsx("img",{src:n,alt:e,className:G.agentLogo}):g.jsx("div",{className:G.agentLogoPlaceholder,children:g.jsx(Qe,{className:G.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})}),g.jsx("span",{className:G.agentName,children:e})]}),g.jsxs("div",{className:G.actions,children:[o&&l&&g.jsx("button",{className:G.actionButton,onClick:l,"aria-label":"Start new chat",type:"button",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M12 5V19M5 12H19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),i&&g.jsx("button",{className:G.actionButton,onClick:i,"aria-label":"Close chat",type:"button",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),!a&&g.jsxs("div",{className:G.welcomeText,children:[g.jsx("h1",{className:G.title,children:c}),s&&g.jsx("p",{className:G.subtitle,children:s})]})]})]})};function ci(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const pi=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hi=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fi={};function ot(e,n){return(fi.jsx?hi:pi).test(e)}const di=/[ \t\n\f\r]/g;function mi(e){return typeof e=="object"?e.type==="text"?at(e.value):!1:at(e)}function at(e){return e.replace(di,"")===""}class Je{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}Je.prototype.normal={};Je.prototype.property={};Je.prototype.space=void 0;function Qt(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Je(t,r,n)}function Ln(e){return e.toLowerCase()}class ie{constructor(n,t){this.attribute=t,this.property=n}}ie.prototype.attribute="";ie.prototype.booleanish=!1;ie.prototype.boolean=!1;ie.prototype.commaOrSpaceSeparated=!1;ie.prototype.commaSeparated=!1;ie.prototype.defined=!1;ie.prototype.mustUseProperty=!1;ie.prototype.number=!1;ie.prototype.overloadedBoolean=!1;ie.prototype.property="";ie.prototype.spaceSeparated=!1;ie.prototype.space=void 0;let gi=0;const D=ve(),Q=ve(),Pn=ve(),w=ve(),X=ve(),ze=ve(),ae=ve();function ve(){return 2**++gi}const Nn=Object.freeze(Object.defineProperty({__proto__:null,boolean:D,booleanish:Q,commaOrSpaceSeparated:ae,commaSeparated:ze,number:w,overloadedBoolean:Pn,spaceSeparated:X},Symbol.toStringTag,{value:"Module"})),dn=Object.keys(Nn);class $n extends ie{constructor(n,t,r,i){let l=-1;if(super(n,t),st(this,"space",i),typeof r=="number")for(;++l<dn.length;){const o=dn[l];st(this,dn[l],(r&Nn[o])===Nn[o])}}}$n.prototype.defined=!0;function st(e,n,t){t&&(e[n]=t)}function De(e){const n={},t={};for(const[r,i]of Object.entries(e.properties)){const l=new $n(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),n[r]=l,t[Ln(r)]=r,t[Ln(l.attribute)]=r}return new Je(n,t,e.space)}const Zt=De({properties:{ariaActiveDescendant:null,ariaAtomic:Q,ariaAutoComplete:null,ariaBusy:Q,ariaChecked:Q,ariaColCount:w,ariaColIndex:w,ariaColSpan:w,ariaControls:X,ariaCurrent:null,ariaDescribedBy:X,ariaDetails:null,ariaDisabled:Q,ariaDropEffect:X,ariaErrorMessage:null,ariaExpanded:Q,ariaFlowTo:X,ariaGrabbed:Q,ariaHasPopup:null,ariaHidden:Q,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:X,ariaLevel:w,ariaLive:null,ariaModal:Q,ariaMultiLine:Q,ariaMultiSelectable:Q,ariaOrientation:null,ariaOwns:X,ariaPlaceholder:null,ariaPosInSet:w,ariaPressed:Q,ariaReadOnly:Q,ariaRelevant:null,ariaRequired:Q,ariaRoleDescription:X,ariaRowCount:w,ariaRowIndex:w,ariaRowSpan:w,ariaSelected:Q,ariaSetSize:w,ariaSort:null,ariaValueMax:w,ariaValueMin:w,ariaValueNow:w,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Jt(e,n){return n in e?e[n]:n}function Gt(e,n){return Jt(e,n.toLowerCase())}const yi=De({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ze,acceptCharset:X,accessKey:X,action:null,allow:null,allowFullScreen:D,allowPaymentRequest:D,allowUserMedia:D,alt:null,as:null,async:D,autoCapitalize:null,autoComplete:X,autoFocus:D,autoPlay:D,blocking:X,capture:null,charSet:null,checked:D,cite:null,className:X,cols:w,colSpan:null,content:null,contentEditable:Q,controls:D,controlsList:X,coords:w|ze,crossOrigin:null,data:null,dateTime:null,decoding:null,default:D,defer:D,dir:null,dirName:null,disabled:D,download:Pn,draggable:Q,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:D,formTarget:null,headers:X,height:w,hidden:Pn,high:w,href:null,hrefLang:null,htmlFor:X,httpEquiv:X,id:null,imageSizes:null,imageSrcSet:null,inert:D,inputMode:null,integrity:null,is:null,isMap:D,itemId:null,itemProp:X,itemRef:X,itemScope:D,itemType:X,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:D,low:w,manifest:null,max:null,maxLength:w,media:null,method:null,min:null,minLength:w,multiple:D,muted:D,name:null,nonce:null,noModule:D,noValidate:D,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle: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:D,optimum:w,pattern:null,ping:X,placeholder:null,playsInline:D,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:D,referrerPolicy:null,rel:X,required:D,reversed:D,rows:w,rowSpan:w,sandbox:X,scope:null,scoped:D,seamless:D,selected:D,shadowRootClonable:D,shadowRootDelegatesFocus:D,shadowRootMode:null,shape:null,size:w,sizes:null,slot:null,span:w,spellCheck:Q,src:null,srcDoc:null,srcLang:null,srcSet:null,start:w,step:null,style:null,tabIndex:w,target:null,title:null,translate:null,type:null,typeMustMatch:D,useMap:null,value:Q,width:w,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:X,axis:null,background:null,bgColor:null,border:w,borderColor:null,bottomMargin:w,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:D,declare:D,event:null,face:null,frame:null,frameBorder:null,hSpace:w,leftMargin:w,link:null,longDesc:null,lowSrc:null,marginHeight:w,marginWidth:w,noResize:D,noHref:D,noShade:D,noWrap:D,object:null,profile:null,prompt:null,rev:null,rightMargin:w,rules:null,scheme:null,scrolling:Q,standby:null,summary:null,text:null,topMargin:w,valueType:null,version:null,vAlign:null,vLink:null,vSpace:w,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:D,disableRemotePlayback:D,prefix:null,property:null,results:w,security:null,unselectable:null},space:"html",transform:Gt}),xi=De({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"},properties:{about:ae,accentHeight:w,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:w,amplitude:w,arabicForm:null,ascent:w,attributeName:null,attributeType:null,azimuth:w,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:w,by:null,calcMode:null,capHeight:w,className:X,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:w,diffuseConstant:w,direction:null,display:null,dur:null,divisor:w,dominantBaseline:null,download:D,dx:null,dy:null,edgeMode:null,editable:null,elevation:w,enableBackground:null,end:null,event:null,exponent:w,externalResourcesRequired:null,fill:null,fillOpacity:w,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:ze,g2:ze,glyphName:ze,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:w,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:w,horizOriginX:w,horizOriginY:w,id:null,ideographic:w,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:w,k:w,k1:w,k2:w,k3:w,k4:w,kernelMatrix:ae,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:w,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:w,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:w,overlineThickness:w,paintOrder:null,panose1:null,path:null,pathLength:w,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:X,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:w,pointsAtY:w,pointsAtZ:w,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ae,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ae,rev:ae,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ae,requiredFeatures:ae,requiredFonts:ae,requiredFormats:ae,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:w,specularExponent:w,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:w,strikethroughThickness:w,string:null,stroke:null,strokeDashArray:ae,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:w,strokeOpacity:w,strokeWidth:null,style:null,surfaceScale:w,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ae,tabIndex:w,tableValues:null,target:null,targetX:w,targetY:w,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ae,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:w,underlineThickness:w,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:w,values:null,vAlphabetic:w,vMathematical:w,vectorEffect:null,vHanging:w,vIdeographic:w,version:null,vertAdvY:w,vertOriginX:w,vertOriginY:w,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:w,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Jt}),er=De({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),nr=De({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Gt}),tr=De({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),ki={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"},bi=/[A-Z]/g,ut=/-[a-z]/g,wi=/^data[-\w.:]+$/i;function Ci(e,n){const t=Ln(n);let r=n,i=ie;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&wi.test(n)){if(n.charAt(4)==="-"){const l=n.slice(5).replace(ut,_i);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=n.slice(4);if(!ut.test(l)){let o=l.replace(bi,Si);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}i=$n}return new i(r,n)}function Si(e){return"-"+e.toLowerCase()}function _i(e){return e.charAt(1).toUpperCase()}const Ii=Qt([Zt,yi,er,nr,tr],"html"),Hn=Qt([Zt,xi,er,nr,tr],"svg");function Ei(e){return e.join(" ").trim()}function rr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ne={},mn,ct;function vi(){if(ct)return mn;ct=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,c=`
|
|
7
|
+
`,s="/",u="*",p="",m="comment",h="declaration";function C(_,x){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];x=x||{};var N=1,T=1;function H(I){var k=I.match(n);k&&(N+=k.length);var j=I.lastIndexOf(c);T=~j?I.length-j:T+I.length}function $(){var I={line:N,column:T};return function(k){return k.position=new b(I),B(),k}}function b(I){this.start=I,this.end={line:N,column:T},this.source=x.source}b.prototype.content=_;function O(I){var k=new Error(x.source+":"+N+":"+T+": "+I);if(k.reason=I,k.filename=x.source,k.line=N,k.column=T,k.source=_,!x.silent)throw k}function V(I){var k=I.exec(_);if(k){var j=k[0];return H(j),_=_.slice(j.length),k}}function B(){V(t)}function A(I){var k;for(I=I||[];k=L();)k!==!1&&I.push(k);return I}function L(){var I=$();if(!(s!=_.charAt(0)||u!=_.charAt(1))){for(var k=2;p!=_.charAt(k)&&(u!=_.charAt(k)||s!=_.charAt(k+1));)++k;if(k+=2,p===_.charAt(k-1))return O("End of comment missing");var j=_.slice(2,k-2);return T+=2,H(j),_=_.slice(k),T+=2,I({type:m,comment:j})}}function v(){var I=$(),k=V(r);if(k){if(L(),!V(i))return O("property missing ':'");var j=V(l),q=I({type:h,property:E(k[0].replace(e,p)),value:j?E(j[0].replace(e,p)):p});return V(o),q}}function P(){var I=[];A(I);for(var k;k=v();)k!==!1&&(I.push(k),A(I));return I}return B(),P()}function E(_){return _?_.replace(a,p):p}return mn=C,mn}var pt;function Ti(){if(pt)return Ne;pt=1;var e=Ne&&Ne.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.default=t;const n=e(vi());function t(r,i){let l=null;if(!r||typeof r!="string")return l;const o=(0,n.default)(r),a=typeof i=="function";return o.forEach(c=>{if(c.type!=="declaration")return;const{property:s,value:u}=c;a?i(s,u,c):u&&(l=l||{},l[s]=u)}),l}return Ne}var He={},ht;function Li(){if(ht)return He;ht=1,Object.defineProperty(He,"__esModule",{value:!0}),He.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,t=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,l=function(s){return!s||t.test(s)||e.test(s)},o=function(s,u){return u.toUpperCase()},a=function(s,u){return"".concat(u,"-")},c=function(s,u){return u===void 0&&(u={}),l(s)?s:(s=s.toLowerCase(),u.reactCompat?s=s.replace(i,a):s=s.replace(r,a),s.replace(n,o))};return He.camelCase=c,He}var Ve,ft;function Pi(){if(ft)return Ve;ft=1;var e=Ve&&Ve.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},n=e(Ti()),t=Li();function r(i,l){var o={};return!i||typeof i!="string"||(0,n.default)(i,function(a,c){a&&c&&(o[(0,t.camelCase)(a,l)]=c)}),o}return r.default=r,Ve=r,Ve}var Ni=Pi();const Ai=rr(Ni),ir=lr("end"),Vn=lr("start");function lr(e){return n;function n(t){const r=t&&t.position&&t.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function ji(e){const n=Vn(e),t=ir(e);if(n&&t)return{start:n,end:t}}function Ye(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?dt(e.position):"start"in e||"end"in e?dt(e):"line"in e||"column"in e?An(e):""}function An(e){return mt(e&&e.line)+":"+mt(e&&e.column)}function dt(e){return An(e&&e.start)+"-"+An(e&&e.end)}function mt(e){return e&&typeof e=="number"?e:1}class ne extends Error{constructor(n,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let i="",l={},o=!1;if(t&&("line"in t&&"column"in t?l={place:t}:"start"in t&&"end"in t?l={place:t}:"type"in t?l={ancestors:[t],place:t.position}:l={...t}),typeof n=="string"?i=n:!l.cause&&n&&(o=!0,i=n.message,l.cause=n),!l.ruleId&&!l.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?l.ruleId=r:(l.source=r.slice(0,c),l.ruleId=r.slice(c+1))}if(!l.place&&l.ancestors&&l.ancestors){const c=l.ancestors[l.ancestors.length-1];c&&(l.place=c.position)}const a=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Ye(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=o&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ne.prototype.file="";ne.prototype.name="";ne.prototype.reason="";ne.prototype.message="";ne.prototype.stack="";ne.prototype.column=void 0;ne.prototype.line=void 0;ne.prototype.ancestors=void 0;ne.prototype.cause=void 0;ne.prototype.fatal=void 0;ne.prototype.place=void 0;ne.prototype.ruleId=void 0;ne.prototype.source=void 0;const Un={}.hasOwnProperty,zi=new Map,Mi=/[A-Z]/g,Di=new Set(["table","tbody","thead","tfoot","tr"]),Bi=new Set(["td","th"]),or="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Oi(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=n.filePath||void 0;let r;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Wi(t,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=qi(t,n.jsx,n.jsxs)}const i={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:r,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Hn:Ii,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},l=ar(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function ar(e,n,t){if(n.type==="element")return Ri(e,n,t);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Fi(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Hi(e,n,t);if(n.type==="mdxjsEsm")return $i(e,n);if(n.type==="root")return Vi(e,n,t);if(n.type==="text")return Ui(e,n)}function Ri(e,n,t){const r=e.schema;let i=r;n.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Hn,e.schema=i),e.ancestors.push(n);const l=ur(e,n.tagName,!1),o=Yi(e,n);let a=Wn(e,n);return Di.has(n.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!mi(c):!0})),sr(e,o,l,n),qn(o,a),e.ancestors.pop(),e.schema=r,e.create(n,l,o,t)}function Fi(e,n){if(n.data&&n.data.estree&&e.evaluater){const r=n.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ze(e,n.position)}function $i(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Ze(e,n.position)}function Hi(e,n,t){const r=e.schema;let i=r;n.name==="svg"&&r.space==="html"&&(i=Hn,e.schema=i),e.ancestors.push(n);const l=n.name===null?e.Fragment:ur(e,n.name,!0),o=Xi(e,n),a=Wn(e,n);return sr(e,o,l,n),qn(o,a),e.ancestors.pop(),e.schema=r,e.create(n,l,o,t)}function Vi(e,n,t){const r={};return qn(r,Wn(e,n)),e.create(n,e.Fragment,r,t)}function Ui(e,n){return n.value}function sr(e,n,t,r){typeof t!="string"&&t!==e.Fragment&&e.passNode&&(n.node=r)}function qn(e,n){if(n.length>0){const t=n.length>1?n:n[0];t&&(e.children=t)}}function qi(e,n,t){return r;function r(i,l,o,a){const s=Array.isArray(o.children)?t:n;return a?s(l,o,a):s(l,o)}}function Wi(e,n){return t;function t(r,i,l,o){const a=Array.isArray(l.children),c=Vn(r);return n(i,l,o,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Yi(e,n){const t={};let r,i;for(i in n.properties)if(i!=="children"&&Un.call(n.properties,i)){const l=Ki(e,i,n.properties[i]);if(l){const[o,a]=l;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Bi.has(n.tagName)?r=a:t[o]=a}}if(r){const l=t.style||(t.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return t}function Xi(e,n){const t={};for(const r of n.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const o=l.expression;o.type;const a=o.properties[0];a.type,Object.assign(t,e.evaluater.evaluateExpression(a.argument))}else Ze(e,n.position);else{const i=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,l=e.evaluater.evaluateExpression(a.expression)}else Ze(e,n.position);else l=r.value===null?!0:r.value;t[i]=l}return t}function Wn(e,n){const t=[];let r=-1;const i=e.passKeys?new Map:zi;for(;++r<n.children.length;){const l=n.children[r];let o;if(e.passKeys){const c=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(c){const s=i.get(c)||0;o=c+"-"+s,i.set(c,s+1)}}const a=ar(e,l,o);a!==void 0&&t.push(a)}return t}function Ki(e,n,t){const r=Ci(e.schema,n);if(!(t==null||typeof t=="number"&&Number.isNaN(t))){if(Array.isArray(t)&&(t=r.commaSeparated?ci(t):Ei(t)),r.property==="style"){let i=typeof t=="object"?t:Qi(e,String(t));return e.stylePropertyNameCase==="css"&&(i=Zi(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?ki[r.property]||r.property:r.attribute,t]}}function Qi(e,n){try{return Ai(n,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};const r=t,i=new ne("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=or+"#cannot-parse-style-attribute",i}}function ur(e,n,t){let r;if(!t)r={type:"Literal",value:n};else if(n.includes(".")){const i=n.split(".");let l=-1,o;for(;++l<i.length;){const a=ot(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(l&&a.type==="Literal"),optional:!1}:a}r=o}else r=ot(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(r.type==="Literal"){const i=r.value;return Un.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ze(e)}function Ze(e,n){const t=new ne("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=or+"#cannot-handle-mdx-estrees-without-createevaluater",t}function Zi(e){const n={};let t;for(t in e)Un.call(e,t)&&(n[Ji(t)]=e[t]);return n}function Ji(e){let n=e.replace(Mi,Gi);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function Gi(e){return"-"+e.toLowerCase()}const gn={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},el={};function nl(e,n){const t=el,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return cr(e,r,i)}function cr(e,n,t){if(tl(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return gt(e.children,n,t)}return Array.isArray(e)?gt(e,n,t):""}function gt(e,n,t){const r=[];let i=-1;for(;++i<e.length;)r[i]=cr(e[i],n,t);return r.join("")}function tl(e){return!!(e&&typeof e=="object")}const yt=document.createElement("i");function Yn(e){const n="&"+e+";";yt.innerHTML=n;const t=yt.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}function ge(e,n,t,r){const i=e.length;let l=0,o;if(n<0?n=-n>i?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)o=Array.from(r),o.unshift(n,t),e.splice(...o);else for(t&&e.splice(n,t);l<r.length;)o=r.slice(l,l+1e4),o.unshift(n,0),e.splice(...o),l+=1e4,n+=1e4}function ce(e,n){return e.length>0?(ge(e,e.length,0,n),e):n}const xt={}.hasOwnProperty;function rl(e){const n={};let t=-1;for(;++t<e.length;)il(n,e[t]);return n}function il(e,n){let t;for(t in n){const i=(xt.call(e,t)?e[t]:void 0)||(e[t]={}),l=n[t];let o;if(l)for(o in l){xt.call(i,o)||(i[o]=[]);const a=l[o];ll(i[o],Array.isArray(a)?a:a?[a]:[])}}}function ll(e,n){let t=-1;const r=[];for(;++t<n.length;)(n[t].add==="after"?e:r).push(n[t]);ge(e,0,0,r)}function pr(e,n){const t=Number.parseInt(e,n);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function Me(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const me=_e(/[A-Za-z]/),se=_e(/[\dA-Za-z]/),ol=_e(/[#-'*+\--9=?A-Z^-~]/);function jn(e){return e!==null&&(e<32||e===127)}const zn=_e(/\d/),al=_e(/[\dA-Fa-f]/),sl=_e(/[!-/:-@[-`{-~]/);function z(e){return e!==null&&e<-2}function re(e){return e!==null&&(e<0||e===32)}function U(e){return e===-2||e===-1||e===32}const ul=_e(new RegExp("\\p{P}|\\p{S}","u")),cl=_e(/\s/);function _e(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Be(e){const n=[];let t=-1,r=0,i=0;for(;++t<e.length;){const l=e.charCodeAt(t);let o="";if(l===37&&se(e.charCodeAt(t+1))&&se(e.charCodeAt(t+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(o=String.fromCharCode(l));else if(l>55295&&l<57344){const a=e.charCodeAt(t+1);l<56320&&a>56319&&a<57344?(o=String.fromCharCode(l,a),i=1):o="�"}else o=String.fromCharCode(l);o&&(n.push(e.slice(r,t),encodeURIComponent(o)),r=t+i+1,o=""),i&&(t+=i,i=0)}return n.join("")+e.slice(r)}function K(e,n,t,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(c){return U(c)?(e.enter(t),a(c)):n(c)}function a(c){return U(c)&&l++<i?(e.consume(c),a):(e.exit(t),n(c))}}const pl={tokenize:hl};function hl(e){const n=e.attempt(this.parser.constructs.contentInitial,r,i);let t;return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),K(e,n,"linePrefix")}function i(a){return e.enter("paragraph"),l(a)}function l(a){const c=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=c),t=c,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return z(a)?(e.consume(a),e.exit("chunkText"),l):(e.consume(a),o)}}const fl={tokenize:dl},kt={tokenize:ml};function dl(e){const n=this,t=[];let r=0,i,l,o;return a;function a(T){if(r<t.length){const H=t[r];return n.containerState=H[1],e.attempt(H[0].continuation,c,s)(T)}return s(T)}function c(T){if(r++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,i&&N();const H=n.events.length;let $=H,b;for(;$--;)if(n.events[$][0]==="exit"&&n.events[$][1].type==="chunkFlow"){b=n.events[$][1].end;break}x(r);let O=H;for(;O<n.events.length;)n.events[O][1].end={...b},O++;return ge(n.events,$+1,0,n.events.slice(H)),n.events.length=O,s(T)}return a(T)}function s(T){if(r===t.length){if(!i)return m(T);if(i.currentConstruct&&i.currentConstruct.concrete)return C(T);n.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(kt,u,p)(T)}function u(T){return i&&N(),x(r),m(T)}function p(T){return n.parser.lazy[n.now().line]=r!==t.length,o=n.now().offset,C(T)}function m(T){return n.containerState={},e.attempt(kt,h,C)(T)}function h(T){return r++,t.push([n.currentConstruct,n.containerState]),m(T)}function C(T){if(T===null){i&&N(),x(0),e.consume(T);return}return i=i||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),E(T)}function E(T){if(T===null){_(e.exit("chunkFlow"),!0),x(0),e.consume(T);return}return z(T)?(e.consume(T),_(e.exit("chunkFlow")),r=0,n.interrupt=void 0,a):(e.consume(T),E)}function _(T,H){const $=n.sliceStream(T);if(H&&$.push(null),T.previous=l,l&&(l.next=T),l=T,i.defineSkip(T.start),i.write($),n.parser.lazy[T.start.line]){let b=i.events.length;for(;b--;)if(i.events[b][1].start.offset<o&&(!i.events[b][1].end||i.events[b][1].end.offset>o))return;const O=n.events.length;let V=O,B,A;for(;V--;)if(n.events[V][0]==="exit"&&n.events[V][1].type==="chunkFlow"){if(B){A=n.events[V][1].end;break}B=!0}for(x(r),b=O;b<n.events.length;)n.events[b][1].end={...A},b++;ge(n.events,V+1,0,n.events.slice(O)),n.events.length=b}}function x(T){let H=t.length;for(;H-- >T;){const $=t[H];n.containerState=$[1],$[0].exit.call(n,e)}t.length=T}function N(){i.write([null]),l=void 0,i=void 0,n.containerState._closeFlow=void 0}}function ml(e,n,t){return K(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bt(e){if(e===null||re(e)||cl(e))return 1;if(ul(e))return 2}function Xn(e,n,t){const r=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!r.includes(l)&&(n=l(n,t),r.push(l))}return n}const Mn={name:"attention",resolveAll:gl,tokenize:yl};function gl(e,n){let t=-1,r,i,l,o,a,c,s,u;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(r=t;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&n.sliceSerialize(e[r][1]).charCodeAt(0)===n.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[r][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const p={...e[r][1].end},m={...e[t][1].start};wt(p,-c),wt(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[t][1].start},end:m},l={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[t][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[t][1].start={...a.end},s=[],e[r][1].end.offset-e[r][1].start.offset&&(s=ce(s,[["enter",e[r][1],n],["exit",e[r][1],n]])),s=ce(s,[["enter",i,n],["enter",o,n],["exit",o,n],["enter",l,n]]),s=ce(s,Xn(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),s=ce(s,[["exit",l,n],["enter",a,n],["exit",a,n],["exit",i,n]]),e[t][1].end.offset-e[t][1].start.offset?(u=2,s=ce(s,[["enter",e[t][1],n],["exit",e[t][1],n]])):u=0,ge(e,r-1,t-r+3,s),t=r+s.length-u-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function yl(e,n){const t=this.parser.constructs.attentionMarkers.null,r=this.previous,i=bt(r);let l;return o;function o(c){return l=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===l)return e.consume(c),a;const s=e.exit("attentionSequence"),u=bt(c),p=!u||u===2&&i||t.includes(c),m=!i||i===2&&u||t.includes(r);return s._open=!!(l===42?p:p&&(i||!m)),s._close=!!(l===42?m:m&&(u||!p)),n(c)}}function wt(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const xl={name:"autolink",tokenize:kl};function kl(e,n,t){let r=0;return i;function i(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(h){return me(h)?(e.consume(h),o):h===64?t(h):s(h)}function o(h){return h===43||h===45||h===46||se(h)?(r=1,a(h)):s(h)}function a(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||se(h))&&r++<32?(e.consume(h),a):(r=0,s(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),n):h===null||h===32||h===60||jn(h)?t(h):(e.consume(h),c)}function s(h){return h===64?(e.consume(h),u):ol(h)?(e.consume(h),s):t(h)}function u(h){return se(h)?p(h):t(h)}function p(h){return h===46?(e.consume(h),r=0,u):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),n):m(h)}function m(h){if((h===45||se(h))&&r++<63){const C=h===45?m:p;return e.consume(h),C}return t(h)}}const pn={partial:!0,tokenize:bl};function bl(e,n,t){return r;function r(l){return U(l)?K(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||z(l)?n(l):t(l)}}const hr={continuation:{tokenize:Cl},exit:Sl,name:"blockQuote",tokenize:wl};function wl(e,n,t){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),l}return t(o)}function l(o){return U(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(o))}}function Cl(e,n,t){const r=this;return i;function i(o){return U(o)?K(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):l(o)}function l(o){return e.attempt(hr,n,t)(o)}}function Sl(e){e.exit("blockQuote")}const fr={name:"characterEscape",tokenize:_l};function _l(e,n,t){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return sl(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(l)}}const dr={name:"characterReference",tokenize:Il};function Il(e,n,t){const r=this;let i=0,l,o;return a;function a(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),c}function c(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),s):(e.enter("characterReferenceValue"),l=31,o=se,u(p))}function s(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,o=al,u):(e.enter("characterReferenceValue"),l=7,o=zn,u(p))}function u(p){if(p===59&&i){const m=e.exit("characterReferenceValue");return o===se&&!Yn(r.sliceSerialize(m))?t(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return o(p)&&i++<l?(e.consume(p),u):t(p)}}const Ct={partial:!0,tokenize:vl},St={concrete:!0,name:"codeFenced",tokenize:El};function El(e,n,t){const r=this,i={partial:!0,tokenize:$};let l=0,o=0,a;return c;function c(b){return s(b)}function s(b){const O=r.events[r.events.length-1];return l=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,a=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(b)}function u(b){return b===a?(o++,e.consume(b),u):o<3?t(b):(e.exit("codeFencedFenceSequence"),U(b)?K(e,p,"whitespace")(b):p(b))}function p(b){return b===null||z(b)?(e.exit("codeFencedFence"),r.interrupt?n(b):e.check(Ct,E,H)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||z(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(b)):U(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),K(e,h,"whitespace")(b)):b===96&&b===a?t(b):(e.consume(b),m)}function h(b){return b===null||z(b)?p(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(b))}function C(b){return b===null||z(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(b)):b===96&&b===a?t(b):(e.consume(b),C)}function E(b){return e.attempt(i,H,_)(b)}function _(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),x}function x(b){return l>0&&U(b)?K(e,N,"linePrefix",l+1)(b):N(b)}function N(b){return b===null||z(b)?e.check(Ct,E,H)(b):(e.enter("codeFlowValue"),T(b))}function T(b){return b===null||z(b)?(e.exit("codeFlowValue"),N(b)):(e.consume(b),T)}function H(b){return e.exit("codeFenced"),n(b)}function $(b,O,V){let B=0;return A;function A(k){return b.enter("lineEnding"),b.consume(k),b.exit("lineEnding"),L}function L(k){return b.enter("codeFencedFence"),U(k)?K(b,v,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):v(k)}function v(k){return k===a?(b.enter("codeFencedFenceSequence"),P(k)):V(k)}function P(k){return k===a?(B++,b.consume(k),P):B>=o?(b.exit("codeFencedFenceSequence"),U(k)?K(b,I,"whitespace")(k):I(k)):V(k)}function I(k){return k===null||z(k)?(b.exit("codeFencedFence"),O(k)):V(k)}}}function vl(e,n,t){const r=this;return i;function i(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}const yn={name:"codeIndented",tokenize:Ll},Tl={partial:!0,tokenize:Pl};function Ll(e,n,t){const r=this;return i;function i(s){return e.enter("codeIndented"),K(e,l,"linePrefix",5)(s)}function l(s){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(s):t(s)}function o(s){return s===null?c(s):z(s)?e.attempt(Tl,o,c)(s):(e.enter("codeFlowValue"),a(s))}function a(s){return s===null||z(s)?(e.exit("codeFlowValue"),o(s)):(e.consume(s),a)}function c(s){return e.exit("codeIndented"),n(s)}}function Pl(e,n,t){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?t(o):z(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):K(e,l,"linePrefix",5)(o)}function l(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):z(o)?i(o):t(o)}}const Nl={name:"codeText",previous:jl,resolve:Al,tokenize:zl};function Al(e){let n=e.length-4,t=3,r,i;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r<n;)if(e[r][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[n][1].type="codeTextPadding",t+=2,n-=2;break}}for(r=t-1,n++;++r<=n;)i===void 0?r!==n&&e[r][1].type!=="lineEnding"&&(i=r):(r===n||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),n-=r-i-2,r=i+2),i=void 0);return e}function jl(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function zl(e,n,t){let r=0,i,l;return o;function o(p){return e.enter("codeText"),e.enter("codeTextSequence"),a(p)}function a(p){return p===96?(e.consume(p),r++,a):(e.exit("codeTextSequence"),c(p))}function c(p){return p===null?t(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),c):p===96?(l=e.enter("codeTextSequence"),i=0,u(p)):z(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("codeTextData"),s(p))}function s(p){return p===null||p===32||p===96||z(p)?(e.exit("codeTextData"),c(p)):(e.consume(p),s)}function u(p){return p===96?(e.consume(p),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),n(p)):(l.type="codeTextData",s(p))}}class Ml{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,t){const r=t??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(n,r):n>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(n,t,r){const i=t||0;this.setCursor(Math.trunc(n));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ue(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),Ue(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),Ue(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const t=this.left.splice(n,Number.POSITIVE_INFINITY);Ue(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);Ue(this.left,t.reverse())}}}function Ue(e,n){let t=0;if(n.length<1e4)e.push(...n);else for(;t<n.length;)e.push(...n.slice(t,t+1e4)),t+=1e4}function mr(e){const n={};let t=-1,r,i,l,o,a,c,s;const u=new Ml(e);for(;++t<u.length;){for(;t in n;)t=n[t];if(r=u.get(t),t&&r[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,l=0,l<c.length&&c[l][1].type==="lineEndingBlank"&&(l+=2),l<c.length&&c[l][1].type==="content"))for(;++l<c.length&&c[l][1].type!=="content";)c[l][1].type==="chunkText"&&(c[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(n,Dl(u,t)),t=n[t],s=!0);else if(r[1]._container){for(l=t,i=void 0;l--;)if(o=u.get(l),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=l);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,t),a.unshift(r),u.splice(i,t-i+1,a))}}return ge(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!s}function Dl(e,n){const t=e.get(n)[1],r=e.get(n)[2];let i=n-1;const l=[];let o=t._tokenizer;o||(o=r.parser[t.contentType](t.start),t._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,c=[],s={};let u,p,m=-1,h=t,C=0,E=0;const _=[E];for(;h;){for(;e.get(++i)[1]!==h;);l.push(i),h._tokenizer||(u=r.sliceStream(h),h.next||u.push(null),p&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),p=h,h=h.next}for(h=t;++m<a.length;)a[m][0]==="exit"&&a[m-1][0]==="enter"&&a[m][1].type===a[m-1][1].type&&a[m][1].start.line!==a[m][1].end.line&&(E=m+1,_.push(E),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):_.pop(),m=_.length;m--;){const x=a.slice(_[m],_[m+1]),N=l.pop();c.push([N,N+x.length-1]),e.splice(N,2,x)}for(c.reverse(),m=-1;++m<c.length;)s[C+c[m][0]]=C+c[m][1],C+=c[m][1]-c[m][0]-1;return s}const Bl={resolve:Rl,tokenize:Fl},Ol={partial:!0,tokenize:$l};function Rl(e){return mr(e),e}function Fl(e,n){let t;return r;function r(a){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?l(a):z(a)?e.check(Ol,o,l)(a):(e.consume(a),i)}function l(a){return e.exit("chunkContent"),e.exit("content"),n(a)}function o(a){return e.consume(a),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,i}}function $l(e,n,t){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),K(e,l,"linePrefix")}function l(o){if(o===null||z(o))return t(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):e.interrupt(r.parser.constructs.flow,t,n)(o)}}function gr(e,n,t,r,i,l,o,a,c){const s=c||Number.POSITIVE_INFINITY;let u=0;return p;function p(x){return x===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(x),e.exit(l),m):x===null||x===32||x===41||jn(x)?t(x):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),E(x))}function m(x){return x===62?(e.enter(l),e.consume(x),e.exit(l),e.exit(i),e.exit(r),n):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===62?(e.exit("chunkString"),e.exit(a),m(x)):x===null||x===60||z(x)?t(x):(e.consume(x),x===92?C:h)}function C(x){return x===60||x===62||x===92?(e.consume(x),h):h(x)}function E(x){return!u&&(x===null||x===41||re(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),n(x)):u<s&&x===40?(e.consume(x),u++,E):x===41?(e.consume(x),u--,E):x===null||x===32||x===40||jn(x)?t(x):(e.consume(x),x===92?_:E)}function _(x){return x===40||x===41||x===92?(e.consume(x),E):E(x)}}function yr(e,n,t,r,i,l){const o=this;let a=0,c;return s;function s(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(l),u}function u(h){return a>999||h===null||h===91||h===93&&!c||h===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?t(h):h===93?(e.exit(l),e.enter(i),e.consume(h),e.exit(i),e.exit(r),n):z(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),p(h))}function p(h){return h===null||h===91||h===93||z(h)||a++>999?(e.exit("chunkString"),u(h)):(e.consume(h),c||(c=!U(h)),h===92?m:p)}function m(h){return h===91||h===92||h===93?(e.consume(h),a++,p):p(h)}}function xr(e,n,t,r,i,l){let o;return a;function a(m){return m===34||m===39||m===40?(e.enter(r),e.enter(i),e.consume(m),e.exit(i),o=m===40?41:m,c):t(m)}function c(m){return m===o?(e.enter(i),e.consume(m),e.exit(i),e.exit(r),n):(e.enter(l),s(m))}function s(m){return m===o?(e.exit(l),c(o)):m===null?t(m):z(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),K(e,s,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||z(m)?(e.exit("chunkString"),s(m)):(e.consume(m),m===92?p:u)}function p(m){return m===o||m===92?(e.consume(m),u):u(m)}}function Xe(e,n){let t;return r;function r(i){return z(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r):U(i)?K(e,r,t?"linePrefix":"lineSuffix")(i):n(i)}}const Hl={name:"definition",tokenize:Ul},Vl={partial:!0,tokenize:ql};function Ul(e,n,t){const r=this;let i;return l;function l(h){return e.enter("definition"),o(h)}function o(h){return yr.call(r,e,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=Me(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):t(h)}function c(h){return re(h)?Xe(e,s)(h):s(h)}function s(h){return gr(e,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function u(h){return e.attempt(Vl,p,p)(h)}function p(h){return U(h)?K(e,m,"whitespace")(h):m(h)}function m(h){return h===null||z(h)?(e.exit("definition"),r.parser.defined.push(i),n(h)):t(h)}}function ql(e,n,t){return r;function r(a){return re(a)?Xe(e,i)(a):t(a)}function i(a){return xr(e,l,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function l(a){return U(a)?K(e,o,"whitespace")(a):o(a)}function o(a){return a===null||z(a)?n(a):t(a)}}const Wl={name:"hardBreakEscape",tokenize:Yl};function Yl(e,n,t){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return z(l)?(e.exit("hardBreakEscape"),n(l)):t(l)}}const Xl={name:"headingAtx",resolve:Kl,tokenize:Ql};function Kl(e,n){let t=e.length-2,r=3,i,l;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},l={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},ge(e,r,t-r+1,[["enter",i,n],["enter",l,n],["exit",l,n],["exit",i,n]])),e}function Ql(e,n,t){let r=0;return i;function i(u){return e.enter("atxHeading"),l(u)}function l(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||re(u)?(e.exit("atxHeadingSequence"),a(u)):t(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||z(u)?(e.exit("atxHeading"),n(u)):U(u)?K(e,a,"whitespace")(u):(e.enter("atxHeadingText"),s(u))}function c(u){return u===35?(e.consume(u),c):(e.exit("atxHeadingSequence"),a(u))}function s(u){return u===null||u===35||re(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),s)}}const Zl=["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"],_t=["pre","script","style","textarea"],Jl={concrete:!0,name:"htmlFlow",resolveTo:no,tokenize:to},Gl={partial:!0,tokenize:io},eo={partial:!0,tokenize:ro};function no(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function to(e,n,t){const r=this;let i,l,o,a,c;return s;function s(d){return u(d)}function u(d){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(d),p}function p(d){return d===33?(e.consume(d),m):d===47?(e.consume(d),l=!0,E):d===63?(e.consume(d),i=3,r.interrupt?n:f):me(d)?(e.consume(d),o=String.fromCharCode(d),_):t(d)}function m(d){return d===45?(e.consume(d),i=2,h):d===91?(e.consume(d),i=5,a=0,C):me(d)?(e.consume(d),i=4,r.interrupt?n:f):t(d)}function h(d){return d===45?(e.consume(d),r.interrupt?n:f):t(d)}function C(d){const pe="CDATA[";return d===pe.charCodeAt(a++)?(e.consume(d),a===pe.length?r.interrupt?n:v:C):t(d)}function E(d){return me(d)?(e.consume(d),o=String.fromCharCode(d),_):t(d)}function _(d){if(d===null||d===47||d===62||re(d)){const pe=d===47,Ie=o.toLowerCase();return!pe&&!l&&_t.includes(Ie)?(i=1,r.interrupt?n(d):v(d)):Zl.includes(o.toLowerCase())?(i=6,pe?(e.consume(d),x):r.interrupt?n(d):v(d)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(d):l?N(d):T(d))}return d===45||se(d)?(e.consume(d),o+=String.fromCharCode(d),_):t(d)}function x(d){return d===62?(e.consume(d),r.interrupt?n:v):t(d)}function N(d){return U(d)?(e.consume(d),N):A(d)}function T(d){return d===47?(e.consume(d),A):d===58||d===95||me(d)?(e.consume(d),H):U(d)?(e.consume(d),T):A(d)}function H(d){return d===45||d===46||d===58||d===95||se(d)?(e.consume(d),H):$(d)}function $(d){return d===61?(e.consume(d),b):U(d)?(e.consume(d),$):T(d)}function b(d){return d===null||d===60||d===61||d===62||d===96?t(d):d===34||d===39?(e.consume(d),c=d,O):U(d)?(e.consume(d),b):V(d)}function O(d){return d===c?(e.consume(d),c=null,B):d===null||z(d)?t(d):(e.consume(d),O)}function V(d){return d===null||d===34||d===39||d===47||d===60||d===61||d===62||d===96||re(d)?$(d):(e.consume(d),V)}function B(d){return d===47||d===62||U(d)?T(d):t(d)}function A(d){return d===62?(e.consume(d),L):t(d)}function L(d){return d===null||z(d)?v(d):U(d)?(e.consume(d),L):t(d)}function v(d){return d===45&&i===2?(e.consume(d),j):d===60&&i===1?(e.consume(d),q):d===62&&i===4?(e.consume(d),le):d===63&&i===3?(e.consume(d),f):d===93&&i===5?(e.consume(d),J):z(d)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Gl,ye,P)(d)):d===null||z(d)?(e.exit("htmlFlowData"),P(d)):(e.consume(d),v)}function P(d){return e.check(eo,I,ye)(d)}function I(d){return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),k}function k(d){return d===null||z(d)?P(d):(e.enter("htmlFlowData"),v(d))}function j(d){return d===45?(e.consume(d),f):v(d)}function q(d){return d===47?(e.consume(d),o="",Y):v(d)}function Y(d){if(d===62){const pe=o.toLowerCase();return _t.includes(pe)?(e.consume(d),le):v(d)}return me(d)&&o.length<8?(e.consume(d),o+=String.fromCharCode(d),Y):v(d)}function J(d){return d===93?(e.consume(d),f):v(d)}function f(d){return d===62?(e.consume(d),le):d===45&&i===2?(e.consume(d),f):v(d)}function le(d){return d===null||z(d)?(e.exit("htmlFlowData"),ye(d)):(e.consume(d),le)}function ye(d){return e.exit("htmlFlow"),n(d)}}function ro(e,n,t){const r=this;return i;function i(o){return z(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):t(o)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}function io(e,n,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(pn,n,t)}}const lo={name:"htmlText",tokenize:oo};function oo(e,n,t){const r=this;let i,l,o;return a;function a(f){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(f),c}function c(f){return f===33?(e.consume(f),s):f===47?(e.consume(f),$):f===63?(e.consume(f),T):me(f)?(e.consume(f),V):t(f)}function s(f){return f===45?(e.consume(f),u):f===91?(e.consume(f),l=0,C):me(f)?(e.consume(f),N):t(f)}function u(f){return f===45?(e.consume(f),h):t(f)}function p(f){return f===null?t(f):f===45?(e.consume(f),m):z(f)?(o=p,q(f)):(e.consume(f),p)}function m(f){return f===45?(e.consume(f),h):p(f)}function h(f){return f===62?j(f):f===45?m(f):p(f)}function C(f){const le="CDATA[";return f===le.charCodeAt(l++)?(e.consume(f),l===le.length?E:C):t(f)}function E(f){return f===null?t(f):f===93?(e.consume(f),_):z(f)?(o=E,q(f)):(e.consume(f),E)}function _(f){return f===93?(e.consume(f),x):E(f)}function x(f){return f===62?j(f):f===93?(e.consume(f),x):E(f)}function N(f){return f===null||f===62?j(f):z(f)?(o=N,q(f)):(e.consume(f),N)}function T(f){return f===null?t(f):f===63?(e.consume(f),H):z(f)?(o=T,q(f)):(e.consume(f),T)}function H(f){return f===62?j(f):T(f)}function $(f){return me(f)?(e.consume(f),b):t(f)}function b(f){return f===45||se(f)?(e.consume(f),b):O(f)}function O(f){return z(f)?(o=O,q(f)):U(f)?(e.consume(f),O):j(f)}function V(f){return f===45||se(f)?(e.consume(f),V):f===47||f===62||re(f)?B(f):t(f)}function B(f){return f===47?(e.consume(f),j):f===58||f===95||me(f)?(e.consume(f),A):z(f)?(o=B,q(f)):U(f)?(e.consume(f),B):j(f)}function A(f){return f===45||f===46||f===58||f===95||se(f)?(e.consume(f),A):L(f)}function L(f){return f===61?(e.consume(f),v):z(f)?(o=L,q(f)):U(f)?(e.consume(f),L):B(f)}function v(f){return f===null||f===60||f===61||f===62||f===96?t(f):f===34||f===39?(e.consume(f),i=f,P):z(f)?(o=v,q(f)):U(f)?(e.consume(f),v):(e.consume(f),I)}function P(f){return f===i?(e.consume(f),i=void 0,k):f===null?t(f):z(f)?(o=P,q(f)):(e.consume(f),P)}function I(f){return f===null||f===34||f===39||f===60||f===61||f===96?t(f):f===47||f===62||re(f)?B(f):(e.consume(f),I)}function k(f){return f===47||f===62||re(f)?B(f):t(f)}function j(f){return f===62?(e.consume(f),e.exit("htmlTextData"),e.exit("htmlText"),n):t(f)}function q(f){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Y}function Y(f){return U(f)?K(e,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):J(f)}function J(f){return e.enter("htmlTextData"),o(f)}}const Kn={name:"labelEnd",resolveAll:co,resolveTo:po,tokenize:ho},ao={tokenize:fo},so={tokenize:mo},uo={tokenize:go};function co(e){let n=-1;const t=[];for(;++n<e.length;){const r=e[n][1];if(t.push(e[n]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",n+=i}}return e.length!==t.length&&ge(e,0,e.length,t),e}function po(e,n){let t=e.length,r=0,i,l,o,a;for(;t--;)if(i=e[t][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[t][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[t][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=t,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=t);const c={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},s={type:"label",start:{...e[l][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",c,n],["enter",s,n]],a=ce(a,e.slice(l+1,l+r+3)),a=ce(a,[["enter",u,n]]),a=ce(a,Xn(n.parser.constructs.insideSpan.null,e.slice(l+r+4,o-3),n)),a=ce(a,[["exit",u,n],e[o-2],e[o-1],["exit",s,n]]),a=ce(a,e.slice(o+1)),a=ce(a,[["exit",c,n]]),ge(e,l,e.length,a),e}function ho(e,n,t){const r=this;let i=r.events.length,l,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){l=r.events[i][1];break}return a;function a(m){return l?l._inactive?p(m):(o=r.parser.defined.includes(Me(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),c):t(m)}function c(m){return m===40?e.attempt(ao,u,o?u:p)(m):m===91?e.attempt(so,u,o?s:p)(m):o?u(m):p(m)}function s(m){return e.attempt(uo,u,p)(m)}function u(m){return n(m)}function p(m){return l._balanced=!0,t(m)}}function fo(e,n,t){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return re(p)?Xe(e,l)(p):l(p)}function l(p){return p===41?u(p):gr(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return re(p)?Xe(e,c)(p):u(p)}function a(p){return t(p)}function c(p){return p===34||p===39||p===40?xr(e,s,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function s(p){return re(p)?Xe(e,u)(p):u(p)}function u(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),n):t(p)}}function mo(e,n,t){const r=this;return i;function i(a){return yr.call(r,e,l,o,"reference","referenceMarker","referenceString")(a)}function l(a){return r.parser.defined.includes(Me(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?n(a):t(a)}function o(a){return t(a)}}function go(e,n,t){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),n):t(l)}}const yo={name:"labelStartImage",resolveAll:Kn.resolveAll,tokenize:xo};function xo(e,n,t){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),l}function l(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):t(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(a):n(a)}}const ko={name:"labelStartLink",resolveAll:Kn.resolveAll,tokenize:bo};function bo(e,n,t){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),l}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(o):n(o)}}const xn={name:"lineEnding",tokenize:wo};function wo(e,n){return t;function t(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),K(e,n,"linePrefix")}}const sn={name:"thematicBreak",tokenize:Co};function Co(e,n,t){let r=0,i;return l;function l(s){return e.enter("thematicBreak"),o(s)}function o(s){return i=s,a(s)}function a(s){return s===i?(e.enter("thematicBreakSequence"),c(s)):r>=3&&(s===null||z(s))?(e.exit("thematicBreak"),n(s)):t(s)}function c(s){return s===i?(e.consume(s),r++,c):(e.exit("thematicBreakSequence"),U(s)?K(e,a,"whitespace")(s):a(s))}}const te={continuation:{tokenize:Eo},exit:To,name:"list",tokenize:Io},So={partial:!0,tokenize:Lo},_o={partial:!0,tokenize:vo};function Io(e,n,t){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(h){const C=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:zn(h)){if(r.containerState.type||(r.containerState.type=C,e.enter(C,{_container:!0})),C==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(sn,t,s)(h):s(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return t(h)}function c(h){return zn(h)&&++o<10?(e.consume(h),c):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),s(h)):t(h)}function s(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(pn,r.interrupt?t:u,e.attempt(So,m,p))}function u(h){return r.containerState.initialBlankLine=!0,l++,m(h)}function p(h){return U(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),m):t(h)}function m(h){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(h)}}function Eo(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(pn,i,l);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,K(e,n,"listItemIndent",r.containerState.size+1)(a)}function l(a){return r.containerState.furtherBlankLines||!U(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(_o,n,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,K(e,e.attempt(te,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function vo(e,n,t){const r=this;return K(e,i,"listItemIndent",r.containerState.size+1);function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?n(l):t(l)}}function To(e){e.exit(this.containerState.type)}function Lo(e,n,t){const r=this;return K(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const o=r.events[r.events.length-1];return!U(l)&&o&&o[1].type==="listItemPrefixWhitespace"?n(l):t(l)}}const It={name:"setextUnderline",resolveTo:Po,tokenize:No};function Po(e,n){let t=e.length,r,i,l;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(i=t)}else e[t][1].type==="content"&&e.splice(t,1),!l&&e[t][1].type==="definition"&&(l=t);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",o,n]),e.splice(l+1,0,["exit",e[r][1],n]),e[r][1].end={...e[l][1].end}):e[r][1]=o,e.push(["exit",o,n]),e}function No(e,n,t){const r=this;let i;return l;function l(s){let u=r.events.length,p;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){p=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),i=s,o(s)):t(s)}function o(s){return e.enter("setextHeadingLineSequence"),a(s)}function a(s){return s===i?(e.consume(s),a):(e.exit("setextHeadingLineSequence"),U(s)?K(e,c,"lineSuffix")(s):c(s))}function c(s){return s===null||z(s)?(e.exit("setextHeadingLine"),n(s)):t(s)}}const Ao={tokenize:jo};function jo(e){const n=this,t=e.attempt(pn,r,e.attempt(this.parser.constructs.flowInitial,i,K(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Bl,i)),"linePrefix")));return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n.currentConstruct=void 0,t}}const zo={resolveAll:br()},Mo=kr("string"),Do=kr("text");function kr(e){return{resolveAll:br(e==="text"?Bo:void 0),tokenize:n};function n(t){const r=this,i=this.parser.constructs[e],l=t.attempt(i,o,a);return o;function o(u){return s(u)?l(u):a(u)}function a(u){if(u===null){t.consume(u);return}return t.enter("data"),t.consume(u),c}function c(u){return s(u)?(t.exit("data"),l(u)):(t.consume(u),c)}function s(u){if(u===null)return!0;const p=i[u];let m=-1;if(p)for(;++m<p.length;){const h=p[m];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function br(e){return n;function n(t,r){let i=-1,l;for(;++i<=t.length;)l===void 0?t[i]&&t[i][1].type==="data"&&(l=i,i++):(!t[i]||t[i][1].type!=="data")&&(i!==l+2&&(t[l][1].end=t[i-1][1].end,t.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(t,r):t}}function Bo(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){const r=e[t-1][1],i=n.sliceStream(r);let l=i.length,o=-1,a=0,c;for(;l--;){const s=i[l];if(typeof s=="string"){for(o=s.length;s.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(s===-2)c=!0,a++;else if(s!==-1){l++;break}}if(n._contentTypeTextTrailing&&t===e.length&&(a=0),a){const s={type:t===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?o:r.start._bufferIndex+o,_index:r.start._index+l,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...s.start},r.start.offset===r.end.offset?Object.assign(r,s):(e.splice(t,0,["enter",s,n],["exit",s,n]),t+=2)}t++}return e}const Oo={42:te,43:te,45:te,48:te,49:te,50:te,51:te,52:te,53:te,54:te,55:te,56:te,57:te,62:hr},Ro={91:Hl},Fo={[-2]:yn,[-1]:yn,32:yn},$o={35:Xl,42:sn,45:[It,sn],60:Jl,61:It,95:sn,96:St,126:St},Ho={38:dr,92:fr},Vo={[-5]:xn,[-4]:xn,[-3]:xn,33:yo,38:dr,42:Mn,60:[xl,lo],91:ko,92:[Wl,fr],93:Kn,95:Mn,96:Nl},Uo={null:[Mn,zo]},qo={null:[42,95]},Wo={null:[]},Yo=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qo,contentInitial:Ro,disable:Wo,document:Oo,flow:$o,flowInitial:Fo,insideSpan:Uo,string:Ho,text:Vo},Symbol.toStringTag,{value:"Module"}));function Xo(e,n,t){let r={_bufferIndex:-1,_index:0,line:t&&t.line||1,column:t&&t.column||1,offset:t&&t.offset||0};const i={},l=[];let o=[],a=[];const c={attempt:O($),check:O(b),consume:N,enter:T,exit:H,interrupt:O(b,{interrupt:!0})},s={code:null,containerState:{},defineSkip:E,events:[],now:C,parser:e,previous:null,sliceSerialize:m,sliceStream:h,write:p};let u=n.tokenize.call(s,c);return n.resolveAll&&l.push(n),s;function p(L){return o=ce(o,L),_(),o[o.length-1]!==null?[]:(V(n,0),s.events=Xn(l,s.events,s),s.events)}function m(L,v){return Qo(h(L),v)}function h(L){return Ko(o,L)}function C(){const{_bufferIndex:L,_index:v,line:P,column:I,offset:k}=r;return{_bufferIndex:L,_index:v,line:P,column:I,offset:k}}function E(L){i[L.line]=L.column,A()}function _(){let L;for(;r._index<o.length;){const v=o[r._index];if(typeof v=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<v.length;)x(v.charCodeAt(r._bufferIndex));else x(v)}}function x(L){u=u(L)}function N(L){z(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,A()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),s.previous=L}function T(L,v){const P=v||{};return P.type=L,P.start=C(),s.events.push(["enter",P,s]),a.push(P),P}function H(L){const v=a.pop();return v.end=C(),s.events.push(["exit",v,s]),v}function $(L,v){V(L,v.from)}function b(L,v){v.restore()}function O(L,v){return P;function P(I,k,j){let q,Y,J,f;return Array.isArray(I)?ye(I):"tokenize"in I?ye([I]):le(I);function le(Z){return Oe;function Oe(be){const Te=be!==null&&Z[be],Le=be!==null&&Z.null,en=[...Array.isArray(Te)?Te:Te?[Te]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return ye(en)(be)}}function ye(Z){return q=Z,Y=0,Z.length===0?j:d(Z[Y])}function d(Z){return Oe;function Oe(be){return f=B(),J=Z,Z.partial||(s.currentConstruct=Z),Z.name&&s.parser.constructs.disable.null.includes(Z.name)?Ie():Z.tokenize.call(v?Object.assign(Object.create(s),v):s,c,pe,Ie)(be)}}function pe(Z){return L(J,f),k}function Ie(Z){return f.restore(),++Y<q.length?d(q[Y]):j}}}function V(L,v){L.resolveAll&&!l.includes(L)&&l.push(L),L.resolve&&ge(s.events,v,s.events.length-v,L.resolve(s.events.slice(v),s)),L.resolveTo&&(s.events=L.resolveTo(s.events,s))}function B(){const L=C(),v=s.previous,P=s.currentConstruct,I=s.events.length,k=Array.from(a);return{from:I,restore:j};function j(){r=L,s.previous=v,s.currentConstruct=P,s.events.length=I,a=k,A()}}function A(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ko(e,n){const t=n.start._index,r=n.start._bufferIndex,i=n.end._index,l=n.end._bufferIndex;let o;if(t===i)o=[e[t].slice(r,l)];else{if(o=e.slice(t,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}l>0&&o.push(e[i].slice(0,l))}return o}function Qo(e,n){let t=-1;const r=[];let i;for(;++t<e.length;){const l=e[t];let o;if(typeof l=="string")o=l;else switch(l){case-5:{o="\r";break}case-4:{o=`
|
|
8
|
+
`;break}case-3:{o=`\r
|
|
9
|
+
`;break}case-2:{o=n?" ":" ";break}case-1:{if(!n&&i)continue;o=" ";break}default:o=String.fromCharCode(l)}i=l===-2,r.push(o)}return r.join("")}function Zo(e){const r={constructs:rl([Yo,...(e||{}).extensions||[]]),content:i(pl),defined:[],document:i(fl),flow:i(Ao),lazy:{},string:i(Mo),text:i(Do)};return r;function i(l){return o;function o(a){return Xo(r,l,a)}}}function Jo(e){for(;!mr(e););return e}const Et=/[\0\t\n\r]/g;function Go(){let e=1,n="",t=!0,r;return i;function i(l,o,a){const c=[];let s,u,p,m,h;for(l=n+(typeof l=="string"?l.toString():new TextDecoder(o||void 0).decode(l)),p=0,n="",t&&(l.charCodeAt(0)===65279&&p++,t=void 0);p<l.length;){if(Et.lastIndex=p,s=Et.exec(l),m=s&&s.index!==void 0?s.index:l.length,h=l.charCodeAt(m),!s){n=l.slice(p);break}if(h===10&&p===m&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),p<m&&(c.push(l.slice(p,m)),e+=m-p),h){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}p=m+1}return a&&(r&&c.push(-5),n&&c.push(n),c.push(null)),c}}const ea=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function na(e){return e.replace(ea,ta)}function ta(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){const i=t.charCodeAt(1),l=i===120||i===88;return pr(t.slice(l?2:1),l?16:10)}return Yn(t)||e}const wr={}.hasOwnProperty;function ra(e,n,t){return typeof n!="string"&&(t=n,n=void 0),ia(t)(Jo(Zo(t).document().write(Go()(e,n,!0))))}function ia(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(it),autolinkProtocol:B,autolinkEmail:B,atxHeading:l(nt),blockQuote:l(Le),characterEscape:B,characterReference:B,codeFenced:l(en),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:l(en,o),codeText:l(Or,o),codeTextData:B,data:B,codeFlowValue:B,definition:l(Rr),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:l(Fr),hardBreakEscape:l(tt),hardBreakTrailing:l(tt),htmlFlow:l(rt,o),htmlFlowData:B,htmlText:l(rt,o),htmlTextData:B,image:l($r),label:o,link:l(it),listItem:l(Hr),listItemValue:m,listOrdered:l(lt,p),listUnordered:l(lt),paragraph:l(Vr),reference:d,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:l(nt),strong:l(Ur),thematicBreak:l(Wr)},exit:{atxHeading:c(),atxHeadingSequence:$,autolink:c(),autolinkEmail:Te,autolinkProtocol:be,blockQuote:c(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:Ie,characterReferenceMarkerNumeric:Ie,characterReferenceValue:Z,characterReference:Oe,codeFenced:c(_),codeFencedFence:E,codeFencedFenceInfo:h,codeFencedFenceMeta:C,codeFlowValue:A,codeIndented:c(x),codeText:c(k),codeTextData:A,data:A,definition:c(),definitionDestinationString:H,definitionLabelString:N,definitionTitleString:T,emphasis:c(),hardBreakEscape:c(v),hardBreakTrailing:c(v),htmlFlow:c(P),htmlFlowData:A,htmlText:c(I),htmlTextData:A,image:c(q),label:J,labelText:Y,lineEnding:L,link:c(j),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:pe,resourceDestinationString:f,resourceTitleString:le,resource:ye,setextHeading:c(V),setextHeadingLineSequence:O,setextHeadingText:b,strong:c(),thematicBreak:c()}};Cr(n,(e||{}).mdastExtensions||[]);const t={};return r;function r(y){let S={type:"root",children:[]};const M={stack:[S],tokenStack:[],config:n,enter:a,exit:s,buffer:o,resume:u,data:t},R=[];let W=-1;for(;++W<y.length;)if(y[W][1].type==="listOrdered"||y[W][1].type==="listUnordered")if(y[W][0]==="enter")R.push(W);else{const he=R.pop();W=i(y,he,W)}for(W=-1;++W<y.length;){const he=n[y[W][0]];wr.call(he,y[W][1].type)&&he[y[W][1].type].call(Object.assign({sliceSerialize:y[W][2].sliceSerialize},M),y[W][1])}if(M.tokenStack.length>0){const he=M.tokenStack[M.tokenStack.length-1];(he[1]||vt).call(M,void 0,he[0])}for(S.position={start:we(y.length>0?y[0][1].start:{line:1,column:1,offset:0}),end:we(y.length>0?y[y.length-2][1].end:{line:1,column:1,offset:0})},W=-1;++W<n.transforms.length;)S=n.transforms[W](S)||S;return S}function i(y,S,M){let R=S-1,W=-1,he=!1,Ee,xe,Re,Fe;for(;++R<=M;){const oe=y[R];switch(oe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{oe[0]==="enter"?W++:W--,Fe=void 0;break}case"lineEndingBlank":{oe[0]==="enter"&&(Ee&&!Fe&&!W&&!Re&&(Re=R),Fe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Fe=void 0}if(!W&&oe[0]==="enter"&&oe[1].type==="listItemPrefix"||W===-1&&oe[0]==="exit"&&(oe[1].type==="listUnordered"||oe[1].type==="listOrdered")){if(Ee){let Pe=R;for(xe=void 0;Pe--;){const ke=y[Pe];if(ke[1].type==="lineEnding"||ke[1].type==="lineEndingBlank"){if(ke[0]==="exit")continue;xe&&(y[xe][1].type="lineEndingBlank",he=!0),ke[1].type="lineEnding",xe=Pe}else if(!(ke[1].type==="linePrefix"||ke[1].type==="blockQuotePrefix"||ke[1].type==="blockQuotePrefixWhitespace"||ke[1].type==="blockQuoteMarker"||ke[1].type==="listItemIndent"))break}Re&&(!xe||Re<xe)&&(Ee._spread=!0),Ee.end=Object.assign({},xe?y[xe][1].start:oe[1].end),y.splice(xe||R,0,["exit",Ee,oe[2]]),R++,M++}if(oe[1].type==="listItemPrefix"){const Pe={type:"listItem",_spread:!1,start:Object.assign({},oe[1].start),end:void 0};Ee=Pe,y.splice(R,0,["enter",Pe,oe[2]]),R++,M++,Re=void 0,Fe=!0}}}return y[S][1]._spread=he,M}function l(y,S){return M;function M(R){a.call(this,y(R),R),S&&S.call(this,R)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(y,S,M){this.stack[this.stack.length-1].children.push(y),this.stack.push(y),this.tokenStack.push([S,M||void 0]),y.position={start:we(S.start),end:void 0}}function c(y){return S;function S(M){y&&y.call(this,M),s.call(this,M)}}function s(y,S){const M=this.stack.pop(),R=this.tokenStack.pop();if(R)R[0].type!==y.type&&(S?S.call(this,y,R[0]):(R[1]||vt).call(this,y,R[0]));else throw new Error("Cannot close `"+y.type+"` ("+Ye({start:y.start,end:y.end})+"): it’s not open");M.position.end=we(y.end)}function u(){return nl(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(y){if(this.data.expectingFirstListItemValue){const S=this.stack[this.stack.length-2];S.start=Number.parseInt(this.sliceSerialize(y),10),this.data.expectingFirstListItemValue=void 0}}function h(){const y=this.resume(),S=this.stack[this.stack.length-1];S.lang=y}function C(){const y=this.resume(),S=this.stack[this.stack.length-1];S.meta=y}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const y=this.resume(),S=this.stack[this.stack.length-1];S.value=y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const y=this.resume(),S=this.stack[this.stack.length-1];S.value=y.replace(/(\r?\n|\r)$/g,"")}function N(y){const S=this.resume(),M=this.stack[this.stack.length-1];M.label=S,M.identifier=Me(this.sliceSerialize(y)).toLowerCase()}function T(){const y=this.resume(),S=this.stack[this.stack.length-1];S.title=y}function H(){const y=this.resume(),S=this.stack[this.stack.length-1];S.url=y}function $(y){const S=this.stack[this.stack.length-1];if(!S.depth){const M=this.sliceSerialize(y).length;S.depth=M}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function O(y){const S=this.stack[this.stack.length-1];S.depth=this.sliceSerialize(y).codePointAt(0)===61?1:2}function V(){this.data.setextHeadingSlurpLineEnding=void 0}function B(y){const M=this.stack[this.stack.length-1].children;let R=M[M.length-1];(!R||R.type!=="text")&&(R=qr(),R.position={start:we(y.start),end:void 0},M.push(R)),this.stack.push(R)}function A(y){const S=this.stack.pop();S.value+=this.sliceSerialize(y),S.position.end=we(y.end)}function L(y){const S=this.stack[this.stack.length-1];if(this.data.atHardBreak){const M=S.children[S.children.length-1];M.position.end=we(y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(S.type)&&(B.call(this,y),A.call(this,y))}function v(){this.data.atHardBreak=!0}function P(){const y=this.resume(),S=this.stack[this.stack.length-1];S.value=y}function I(){const y=this.resume(),S=this.stack[this.stack.length-1];S.value=y}function k(){const y=this.resume(),S=this.stack[this.stack.length-1];S.value=y}function j(){const y=this.stack[this.stack.length-1];if(this.data.inReference){const S=this.data.referenceType||"shortcut";y.type+="Reference",y.referenceType=S,delete y.url,delete y.title}else delete y.identifier,delete y.label;this.data.referenceType=void 0}function q(){const y=this.stack[this.stack.length-1];if(this.data.inReference){const S=this.data.referenceType||"shortcut";y.type+="Reference",y.referenceType=S,delete y.url,delete y.title}else delete y.identifier,delete y.label;this.data.referenceType=void 0}function Y(y){const S=this.sliceSerialize(y),M=this.stack[this.stack.length-2];M.label=na(S),M.identifier=Me(S).toLowerCase()}function J(){const y=this.stack[this.stack.length-1],S=this.resume(),M=this.stack[this.stack.length-1];if(this.data.inReference=!0,M.type==="link"){const R=y.children;M.children=R}else M.alt=S}function f(){const y=this.resume(),S=this.stack[this.stack.length-1];S.url=y}function le(){const y=this.resume(),S=this.stack[this.stack.length-1];S.title=y}function ye(){this.data.inReference=void 0}function d(){this.data.referenceType="collapsed"}function pe(y){const S=this.resume(),M=this.stack[this.stack.length-1];M.label=S,M.identifier=Me(this.sliceSerialize(y)).toLowerCase(),this.data.referenceType="full"}function Ie(y){this.data.characterReferenceType=y.type}function Z(y){const S=this.sliceSerialize(y),M=this.data.characterReferenceType;let R;M?(R=pr(S,M==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):R=Yn(S);const W=this.stack[this.stack.length-1];W.value+=R}function Oe(y){const S=this.stack.pop();S.position.end=we(y.end)}function be(y){A.call(this,y);const S=this.stack[this.stack.length-1];S.url=this.sliceSerialize(y)}function Te(y){A.call(this,y);const S=this.stack[this.stack.length-1];S.url="mailto:"+this.sliceSerialize(y)}function Le(){return{type:"blockquote",children:[]}}function en(){return{type:"code",lang:null,meta:null,value:""}}function Or(){return{type:"inlineCode",value:""}}function Rr(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Fr(){return{type:"emphasis",children:[]}}function nt(){return{type:"heading",depth:0,children:[]}}function tt(){return{type:"break"}}function rt(){return{type:"html",value:""}}function $r(){return{type:"image",title:null,url:"",alt:null}}function it(){return{type:"link",title:null,url:"",children:[]}}function lt(y){return{type:"list",ordered:y.type==="listOrdered",start:null,spread:y._spread,children:[]}}function Hr(y){return{type:"listItem",spread:y._spread,checked:null,children:[]}}function Vr(){return{type:"paragraph",children:[]}}function Ur(){return{type:"strong",children:[]}}function qr(){return{type:"text",value:""}}function Wr(){return{type:"thematicBreak"}}}function we(e){return{line:e.line,column:e.column,offset:e.offset}}function Cr(e,n){let t=-1;for(;++t<n.length;){const r=n[t];Array.isArray(r)?Cr(e,r):la(e,r)}}function la(e,n){let t;for(t in n)if(wr.call(n,t))switch(t){case"canContainEols":{const r=n[t];r&&e[t].push(...r);break}case"transforms":{const r=n[t];r&&e[t].push(...r);break}case"enter":case"exit":{const r=n[t];r&&Object.assign(e[t],r);break}}}function vt(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Ye({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Ye({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Ye({start:n.start,end:n.end})+") is still open")}function oa(e){const n=this;n.parser=t;function t(r){return ra(r,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function aa(e,n){const t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function sa(e,n){const t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:`
|
|
10
|
+
`}]}function ua(e,n){const t=n.value?n.value+`
|
|
11
|
+
`:"",r={},i=n.lang?n.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:t}]};return n.meta&&(l.data={meta:n.meta}),e.patch(n,l),l=e.applyData(n,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(n,l),l}function ca(e,n){const t={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function pa(e,n){const t={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function ha(e,n){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(n.identifier).toUpperCase(),i=Be(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=l+1,a+=1,e.footnoteCounts.set(r,a);const c={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+i,id:t+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(n,c);const s={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(n,s),e.applyData(n,s)}function fa(e,n){const t={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function da(e,n){if(e.options.allowDangerousHtml){const t={type:"raw",value:n.value};return e.patch(n,t),e.applyData(n,t)}}function Sr(e,n){const t=n.referenceType;let r="]";if(t==="collapsed"?r+="[]":t==="full"&&(r+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+r}];const i=e.all(n),l=i[0];l&&l.type==="text"?l.value="["+l.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function ma(e,n){const t=String(n.identifier).toUpperCase(),r=e.definitionById.get(t);if(!r)return Sr(e,n);const i={src:Be(r.url||""),alt:n.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(n,l),e.applyData(n,l)}function ga(e,n){const t={src:Be(n.url)};n.alt!==null&&n.alt!==void 0&&(t.alt=n.alt),n.title!==null&&n.title!==void 0&&(t.title=n.title);const r={type:"element",tagName:"img",properties:t,children:[]};return e.patch(n,r),e.applyData(n,r)}function ya(e,n){const t={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,t);const r={type:"element",tagName:"code",properties:{},children:[t]};return e.patch(n,r),e.applyData(n,r)}function xa(e,n){const t=String(n.identifier).toUpperCase(),r=e.definitionById.get(t);if(!r)return Sr(e,n);const i={href:Be(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"a",properties:i,children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function ka(e,n){const t={href:Be(n.url)};n.title!==null&&n.title!==void 0&&(t.title=n.title);const r={type:"element",tagName:"a",properties:t,children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ba(e,n,t){const r=e.all(n),i=t?wa(t):_r(n),l={},o=[];if(typeof n.checked=="boolean"){const u=r[0];let p;u&&u.type==="element"&&u.tagName==="p"?p=u:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
12
|
+
`}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const c=r[r.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
|
|
13
|
+
`});const s={type:"element",tagName:"li",properties:l,children:o};return e.patch(n,s),e.applyData(n,s)}function wa(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const t=e.children;let r=-1;for(;!n&&++r<t.length;)n=_r(t[r])}return n}function _r(e){const n=e.spread;return n??e.children.length>1}function Ca(e,n){const t={},r=e.all(n);let i=-1;for(typeof n.start=="number"&&n.start!==1&&(t.start=n.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){t.className=["contains-task-list"];break}}const l={type:"element",tagName:n.ordered?"ol":"ul",properties:t,children:e.wrap(r,!0)};return e.patch(n,l),e.applyData(n,l)}function Sa(e,n){const t={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function _a(e,n){const t={type:"root",children:e.wrap(e.all(n))};return e.patch(n,t),e.applyData(n,t)}function Ia(e,n){const t={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Ea(e,n){const t=e.all(n),r=t.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(n.children[0],o),i.push(o)}if(t.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(t,!0)},a=Vn(n.children[1]),c=ir(n.children[n.children.length-1]);a&&c&&(o.position={start:a,end:c}),i.push(o)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(n,l),e.applyData(n,l)}function va(e,n,t){const r=t?t.children:void 0,l=(r?r.indexOf(n):1)===0?"th":"td",o=t&&t.type==="table"?t.align:void 0,a=o?o.length:n.children.length;let c=-1;const s=[];for(;++c<a;){const p=n.children[c],m={},h=o?o[c]:void 0;h&&(m.align=h);let C={type:"element",tagName:l,properties:m,children:[]};p&&(C.children=e.all(p),e.patch(p,C),C=e.applyData(p,C)),s.push(C)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(s,!0)};return e.patch(n,u),e.applyData(n,u)}function Ta(e,n){const t={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}const Tt=9,Lt=32;function La(e){const n=String(e),t=/\r?\n|\r/g;let r=t.exec(n),i=0;const l=[];for(;r;)l.push(Pt(n.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=t.exec(n);return l.push(Pt(n.slice(i),i>0,!1)),l.join("")}function Pt(e,n,t){let r=0,i=e.length;if(n){let l=e.codePointAt(r);for(;l===Tt||l===Lt;)r++,l=e.codePointAt(r)}if(t){let l=e.codePointAt(i-1);for(;l===Tt||l===Lt;)i--,l=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Pa(e,n){const t={type:"text",value:La(String(n.value))};return e.patch(n,t),e.applyData(n,t)}function Na(e,n){const t={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,t),e.applyData(n,t)}const Aa={blockquote:aa,break:sa,code:ua,delete:ca,emphasis:pa,footnoteReference:ha,heading:fa,html:da,imageReference:ma,image:ga,inlineCode:ya,linkReference:xa,link:ka,listItem:ba,list:Ca,paragraph:Sa,root:_a,strong:Ia,table:Ea,tableCell:Ta,tableRow:va,text:Pa,thematicBreak:Na,toml:nn,yaml:nn,definition:nn,footnoteDefinition:nn};function nn(){}const Ir=-1,hn=0,Ke=1,un=2,Qn=3,Zn=4,Jn=5,Gn=6,Er=7,vr=8,Nt=typeof self=="object"?self:globalThis,ja=(e,n)=>{const t=(i,l)=>(e.set(l,i),i),r=i=>{if(e.has(i))return e.get(i);const[l,o]=n[i];switch(l){case hn:case Ir:return t(o,i);case Ke:{const a=t([],i);for(const c of o)a.push(r(c));return a}case un:{const a=t({},i);for(const[c,s]of o)a[r(c)]=r(s);return a}case Qn:return t(new Date(o),i);case Zn:{const{source:a,flags:c}=o;return t(new RegExp(a,c),i)}case Jn:{const a=t(new Map,i);for(const[c,s]of o)a.set(r(c),r(s));return a}case Gn:{const a=t(new Set,i);for(const c of o)a.add(r(c));return a}case Er:{const{name:a,message:c}=o;return t(new Nt[a](c),i)}case vr:return t(BigInt(o),i);case"BigInt":return t(Object(BigInt(o)),i);case"ArrayBuffer":return t(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return t(new DataView(a),o)}}return t(new Nt[l](o),i)};return r},At=e=>ja(new Map,e)(0),Ae="",{toString:za}={},{keys:Ma}=Object,qe=e=>{const n=typeof e;if(n!=="object"||!e)return[hn,n];const t=za.call(e).slice(8,-1);switch(t){case"Array":return[Ke,Ae];case"Object":return[un,Ae];case"Date":return[Qn,Ae];case"RegExp":return[Zn,Ae];case"Map":return[Jn,Ae];case"Set":return[Gn,Ae];case"DataView":return[Ke,t]}return t.includes("Array")?[Ke,t]:t.includes("Error")?[Er,t]:[un,t]},tn=([e,n])=>e===hn&&(n==="function"||n==="symbol"),Da=(e,n,t,r)=>{const i=(o,a)=>{const c=r.push(o)-1;return t.set(a,c),c},l=o=>{if(t.has(o))return t.get(o);let[a,c]=qe(o);switch(a){case hn:{let u=o;switch(c){case"bigint":a=vr,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return i([Ir],o)}return i([a,u],o)}case Ke:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),i([c,[...m]],o)}const u=[],p=i([a,u],o);for(const m of o)u.push(l(m));return p}case un:{if(c)switch(c){case"BigInt":return i([c,o.toString()],o);case"Boolean":case"Number":case"String":return i([c,o.valueOf()],o)}if(n&&"toJSON"in o)return l(o.toJSON());const u=[],p=i([a,u],o);for(const m of Ma(o))(e||!tn(qe(o[m])))&&u.push([l(m),l(o[m])]);return p}case Qn:return i([a,o.toISOString()],o);case Zn:{const{source:u,flags:p}=o;return i([a,{source:u,flags:p}],o)}case Jn:{const u=[],p=i([a,u],o);for(const[m,h]of o)(e||!(tn(qe(m))||tn(qe(h))))&&u.push([l(m),l(h)]);return p}case Gn:{const u=[],p=i([a,u],o);for(const m of o)(e||!tn(qe(m)))&&u.push(l(m));return p}}const{message:s}=o;return i([a,{name:c,message:s}],o)};return l},jt=(e,{json:n,lossy:t}={})=>{const r=[];return Da(!(n||t),!!n,new Map,r)(e),r},cn=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?At(jt(e,n)):structuredClone(e):(e,n)=>At(jt(e,n));function Ba(e,n){const t=[{type:"text",value:"↩"}];return n>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),t}function Oa(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function Ra(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",t=e.options.footnoteBackContent||Ba,r=e.options.footnoteBackLabel||Oa,i=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const s=e.footnoteById.get(e.footnoteOrder[c]);if(!s)continue;const u=e.all(s),p=String(s.identifier).toUpperCase(),m=Be(p.toLowerCase());let h=0;const C=[],E=e.footnoteCounts.get(p);for(;E!==void 0&&++h<=E;){C.length>0&&C.push({type:"text",value:" "});let N=typeof t=="string"?t:t(c,h);typeof N=="string"&&(N={type:"text",value:N}),C.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+m+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const _=u[u.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const N=_.children[_.children.length-1];N&&N.type==="text"?N.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...C)}else u.push(...C);const x={type:"element",tagName:"li",properties:{id:n+"fn-"+m},children:e.wrap(u,!0)};e.patch(s,x),a.push(x)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...cn(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
14
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
15
|
+
`}]}}const Tr=(function(e){if(e==null)return Va;if(typeof e=="function")return fn(e);if(typeof e=="object")return Array.isArray(e)?Fa(e):$a(e);if(typeof e=="string")return Ha(e);throw new Error("Expected function, string, or object as test")});function Fa(e){const n=[];let t=-1;for(;++t<e.length;)n[t]=Tr(e[t]);return fn(r);function r(...i){let l=-1;for(;++l<n.length;)if(n[l].apply(this,i))return!0;return!1}}function $a(e){const n=e;return fn(t);function t(r){const i=r;let l;for(l in e)if(i[l]!==n[l])return!1;return!0}}function Ha(e){return fn(n);function n(t){return t&&t.type===e}}function fn(e){return n;function n(t,r,i){return!!(Ua(t)&&e.call(this,t,typeof r=="number"?r:void 0,i||void 0))}}function Va(){return!0}function Ua(e){return e!==null&&typeof e=="object"&&"type"in e}const Lr=[],qa=!0,zt=!1,Wa="skip";function Ya(e,n,t,r){let i;typeof n=="function"&&typeof t!="function"?(r=t,t=n):i=n;const l=Tr(i),o=r?-1:1;a(e,void 0,[])();function a(c,s,u){const p=c&&typeof c=="object"?c:{};if(typeof p.type=="string"){const h=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return m;function m(){let h=Lr,C,E,_;if((!n||l(c,s,u[u.length-1]||void 0))&&(h=Xa(t(c,u)),h[0]===zt))return h;if("children"in c&&c.children){const x=c;if(x.children&&h[0]!==Wa)for(E=(r?x.children.length:-1)+o,_=u.concat(x);E>-1&&E<x.children.length;){const N=x.children[E];if(C=a(N,E,_)(),C[0]===zt)return C;E=typeof C[1]=="number"?C[1]:E+o}}return h}}}function Xa(e){return Array.isArray(e)?e:typeof e=="number"?[qa,e]:e==null?Lr:[e]}function Pr(e,n,t,r){let i,l,o;typeof n=="function"&&typeof t!="function"?(l=void 0,o=n,i=t):(l=n,o=t,i=r),Ya(e,l,a,i);function a(c,s){const u=s[s.length-1],p=u?u.children.indexOf(c):void 0;return o(c,p,u)}}const Dn={}.hasOwnProperty,Ka={};function Qa(e,n){const t=n||Ka,r=new Map,i=new Map,l=new Map,o={...Aa,...t.handlers},a={all:s,applyData:Ja,definitionById:r,footnoteById:i,footnoteCounts:l,footnoteOrder:[],handlers:o,one:c,options:t,patch:Za,wrap:es};return Pr(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const p=u.type==="definition"?r:i,m=String(u.identifier).toUpperCase();p.has(m)||p.set(m,u)}}),a;function c(u,p){const m=u.type,h=a.handlers[m];if(Dn.call(a.handlers,m)&&h)return h(a,u,p);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in u){const{children:E,..._}=u,x=cn(_);return x.children=a.all(u),x}return cn(u)}return(a.options.unknownHandler||Ga)(a,u,p)}function s(u){const p=[];if("children"in u){const m=u.children;let h=-1;for(;++h<m.length;){const C=a.one(m[h],u);if(C){if(h&&m[h-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=Mt(C.value)),!Array.isArray(C)&&C.type==="element")){const E=C.children[0];E&&E.type==="text"&&(E.value=Mt(E.value))}Array.isArray(C)?p.push(...C):p.push(C)}}}return p}}function Za(e,n){e.position&&(n.position=ji(e))}function Ja(e,n){let t=n;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,l=e.data.hProperties;if(typeof r=="string")if(t.type==="element")t.tagName=r;else{const o="children"in t?t.children:[t];t={type:"element",tagName:r,properties:{},children:o}}t.type==="element"&&l&&Object.assign(t.properties,cn(l)),"children"in t&&t.children&&i!==null&&i!==void 0&&(t.children=i)}return t}function Ga(e,n){const t=n.data||{},r="value"in n&&!(Dn.call(t,"hProperties")||Dn.call(t,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function es(e,n){const t=[];let r=-1;for(n&&t.push({type:"text",value:`
|
|
16
|
+
`});++r<e.length;)r&&t.push({type:"text",value:`
|
|
17
|
+
`}),t.push(e[r]);return n&&e.length>0&&t.push({type:"text",value:`
|
|
18
|
+
`}),t}function Mt(e){let n=0,t=e.charCodeAt(n);for(;t===9||t===32;)n++,t=e.charCodeAt(n);return e.slice(n)}function Dt(e,n){const t=Qa(e,n),r=t.one(e,void 0),i=Ra(t),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&l.children.push({type:"text",value:`
|
|
19
|
+
`},i),l}function ns(e,n){return e&&"run"in e?async function(t,r){const i=Dt(t,{file:r,...n});await e.run(i,r)}:function(t,r){return Dt(t,{file:r,...e||n})}}function Bt(e){if(e)throw e}var kn,Ot;function ts(){if(Ot)return kn;Ot=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(s){return typeof Array.isArray=="function"?Array.isArray(s):n.call(s)==="[object Array]"},l=function(s){if(!s||n.call(s)!=="[object Object]")return!1;var u=e.call(s,"constructor"),p=s.constructor&&s.constructor.prototype&&e.call(s.constructor.prototype,"isPrototypeOf");if(s.constructor&&!u&&!p)return!1;var m;for(m in s);return typeof m>"u"||e.call(s,m)},o=function(s,u){t&&u.name==="__proto__"?t(s,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):s[u.name]=u.newValue},a=function(s,u){if(u==="__proto__")if(e.call(s,u)){if(r)return r(s,u).value}else return;return s[u]};return kn=function c(){var s,u,p,m,h,C,E=arguments[0],_=1,x=arguments.length,N=!1;for(typeof E=="boolean"&&(N=E,E=arguments[1]||{},_=2),(E==null||typeof E!="object"&&typeof E!="function")&&(E={});_<x;++_)if(s=arguments[_],s!=null)for(u in s)p=a(E,u),m=a(s,u),E!==m&&(N&&m&&(l(m)||(h=i(m)))?(h?(h=!1,C=p&&i(p)?p:[]):C=p&&l(p)?p:{},o(E,{name:u,newValue:c(N,C,m)})):typeof m<"u"&&o(E,{name:u,newValue:m}));return E},kn}var rs=ts();const bn=rr(rs);function Bn(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function is(){const e=[],n={run:t,use:r};return n;function t(...i){let l=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(c,...s){const u=e[++l];let p=-1;if(c){o(c);return}for(;++p<i.length;)(s[p]===null||s[p]===void 0)&&(s[p]=i[p]);i=s,u?ls(u,a)(...s):o(null,...s)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),n}}function ls(e,n){let t;return r;function r(...o){const a=e.length>o.length;let c;a&&o.push(i);try{c=e.apply(this,o)}catch(s){const u=s;if(a&&t)throw u;return i(u)}a||(c&&c.then&&typeof c.then=="function"?c.then(l,i):c instanceof Error?i(c):l(c))}function i(o,...a){t||(t=!0,n(o,...a))}function l(o){i(null,o)}}const de={basename:os,dirname:as,extname:ss,join:us,sep:"/"};function os(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Ge(e);let t=0,r=-1,i=e.length,l;if(n===void 0||n.length===0||n.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){t=i+1;break}}else r<0&&(l=!0,r=i+1);return r<0?"":e.slice(t,r)}if(n===e)return"";let o=-1,a=n.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){t=i+1;break}}else o<0&&(l=!0,o=i+1),a>-1&&(e.codePointAt(i)===n.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return t===r?r=o:r<0&&(r=e.length),e.slice(t,r)}function as(e){if(Ge(e),e.length===0)return".";let n=-1,t=e.length,r;for(;--t;)if(e.codePointAt(t)===47){if(r){n=t;break}}else r||(r=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function ss(e){Ge(e);let n=e.length,t=-1,r=0,i=-1,l=0,o;for(;n--;){const a=e.codePointAt(n);if(a===47){if(o){r=n+1;break}continue}t<0&&(o=!0,t=n+1),a===46?i<0?i=n:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||t<0||l===0||l===1&&i===t-1&&i===r+1?"":e.slice(i,t)}function us(...e){let n=-1,t;for(;++n<e.length;)Ge(e[n]),e[n]&&(t=t===void 0?e[n]:t+"/"+e[n]);return t===void 0?".":cs(t)}function cs(e){Ge(e);const n=e.codePointAt(0)===47;let t=ps(e,!n);return t.length===0&&!n&&(t="."),t.length>0&&e.codePointAt(e.length-1)===47&&(t+="/"),n?"/"+t:t}function ps(e,n){let t="",r=0,i=-1,l=0,o=-1,a,c;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||l===1))if(i!==o-1&&l===2){if(t.length<2||r!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(c=t.lastIndexOf("/"),c!==t.length-1){c<0?(t="",r=0):(t=t.slice(0,c),r=t.length-1-t.lastIndexOf("/")),i=o,l=0;continue}}else if(t.length>0){t="",r=0,i=o,l=0;continue}}n&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+e.slice(i+1,o):t=e.slice(i+1,o),r=o-i-1;i=o,l=0}else a===46&&l>-1?l++:l=-1}return t}function Ge(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const hs={cwd:fs};function fs(){return"/"}function On(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ds(e){if(typeof e=="string")e=new URL(e);else if(!On(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return ms(e)}function ms(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let t=-1;for(;++t<n.length;)if(n.codePointAt(t)===37&&n.codePointAt(t+1)===50){const r=n.codePointAt(t+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(n)}const wn=["history","path","basename","stem","extname","dirname"];class Nr{constructor(n){let t;n?On(n)?t={path:n}:typeof n=="string"||gs(n)?t={value:n}:t=n:t={},this.cwd="cwd"in t?"":hs.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<wn.length;){const l=wn[r];l in t&&t[l]!==void 0&&t[l]!==null&&(this[l]=l==="history"?[...t[l]]:t[l])}let i;for(i in t)wn.includes(i)||(this[i]=t[i])}get basename(){return typeof this.path=="string"?de.basename(this.path):void 0}set basename(n){Sn(n,"basename"),Cn(n,"basename"),this.path=de.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?de.dirname(this.path):void 0}set dirname(n){Rt(this.basename,"dirname"),this.path=de.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?de.extname(this.path):void 0}set extname(n){if(Cn(n,"extname"),Rt(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=de.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){On(n)&&(n=ds(n)),Sn(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?de.basename(this.path,this.extname):void 0}set stem(n){Sn(n,"stem"),Cn(n,"stem"),this.path=de.join(this.dirname||"",n+(this.extname||""))}fail(n,t,r){const i=this.message(n,t,r);throw i.fatal=!0,i}info(n,t,r){const i=this.message(n,t,r);return i.fatal=void 0,i}message(n,t,r){const i=new ne(n,t,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function Cn(e,n){if(e&&e.includes(de.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+de.sep+"`")}function Sn(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function Rt(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function gs(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ys=(function(e){const r=this.constructor.prototype,i=r[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,r),l}),xs={}.hasOwnProperty;class et extends ys{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=is()}copy(){const n=new et;let t=-1;for(;++t<this.attachers.length;){const r=this.attachers[t];n.use(...r)}return n.data(bn(!0,{},this.namespace)),n}data(n,t){return typeof n=="string"?arguments.length===2?(En("data",this.frozen),this.namespace[n]=t,this):xs.call(this.namespace,n)&&this.namespace[n]||void 0:n?(En("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=t.call(n,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const t=rn(n),r=this.parser||this.Parser;return _n("parse",r),r(String(t),t)}process(n,t){const r=this;return this.freeze(),_n("process",this.parser||this.Parser),In("process",this.compiler||this.Compiler),t?i(void 0,t):new Promise(i);function i(l,o){const a=rn(n),c=r.parse(a);r.run(c,a,function(u,p,m){if(u||!p||!m)return s(u);const h=p,C=r.stringify(h,m);ws(C)?m.value=C:m.result=C,s(u,m)});function s(u,p){u||!p?o(u):l?l(p):t(void 0,p)}}}processSync(n){let t=!1,r;return this.freeze(),_n("processSync",this.parser||this.Parser),In("processSync",this.compiler||this.Compiler),this.process(n,i),$t("processSync","process",t),r;function i(l,o){t=!0,Bt(l),r=o}}run(n,t,r){Ft(n),this.freeze();const i=this.transformers;return!r&&typeof t=="function"&&(r=t,t=void 0),r?l(void 0,r):new Promise(l);function l(o,a){const c=rn(t);i.run(n,c,s);function s(u,p,m){const h=p||n;u?a(u):o?o(h):r(void 0,h,m)}}}runSync(n,t){let r=!1,i;return this.run(n,t,l),$t("runSync","run",r),i;function l(o,a){Bt(o),i=a,r=!0}}stringify(n,t){this.freeze();const r=rn(t),i=this.compiler||this.Compiler;return In("stringify",i),Ft(n),i(n,r)}use(n,...t){const r=this.attachers,i=this.namespace;if(En("use",this.frozen),n!=null)if(typeof n=="function")c(n,t);else if(typeof n=="object")Array.isArray(n)?a(n):o(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function l(s){if(typeof s=="function")c(s,[]);else if(typeof s=="object")if(Array.isArray(s)){const[u,...p]=s;c(u,p)}else o(s);else throw new TypeError("Expected usable value, not `"+s+"`")}function o(s){if(!("plugins"in s)&&!("settings"in s))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(s.plugins),s.settings&&(i.settings=bn(!0,i.settings,s.settings))}function a(s){let u=-1;if(s!=null)if(Array.isArray(s))for(;++u<s.length;){const p=s[u];l(p)}else throw new TypeError("Expected a list of plugins, not `"+s+"`")}function c(s,u){let p=-1,m=-1;for(;++p<r.length;)if(r[p][0]===s){m=p;break}if(m===-1)r.push([s,...u]);else if(u.length>0){let[h,...C]=u;const E=r[m][1];Bn(E)&&Bn(h)&&(h=bn(!0,E,h)),r[m]=[s,h,...C]}}}}const ks=new et().freeze();function _n(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function In(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function En(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ft(e){if(!Bn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $t(e,n,t){if(!t)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function rn(e){return bs(e)?e:new Nr(e)}function bs(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ws(e){return typeof e=="string"||Cs(e)}function Cs(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ss="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ht=[],Vt={allowDangerousHtml:!0},_s=/^(https?|ircs?|mailto|xmpp)$/i,Is=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Es(e){const n=vs(e),t=Ts(e);return Ls(n.runSync(n.parse(t),t),e)}function vs(e){const n=e.rehypePlugins||Ht,t=e.remarkPlugins||Ht,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Vt}:Vt;return ks().use(oa).use(t).use(ns,r).use(n)}function Ts(e){const n=e.children||"",t=new Nr;return typeof n=="string"&&(t.value=n),t}function Ls(e,n){const t=n.allowedElements,r=n.allowElement,i=n.components,l=n.disallowedElements,o=n.skipHtml,a=n.unwrapDisallowed,c=n.urlTransform||Ps;for(const u of Is)Object.hasOwn(n,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+Ss+u.id,void 0);return Pr(e,s),Oi(e,{Fragment:g.Fragment,components:i,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0});function s(u,p,m){if(u.type==="raw"&&m&&typeof p=="number")return o?m.children.splice(p,1):m.children[p]={type:"text",value:u.value},p;if(u.type==="element"){let h;for(h in gn)if(Object.hasOwn(gn,h)&&Object.hasOwn(u.properties,h)){const C=u.properties[h],E=gn[h];(E===null||E.includes(u.tagName))&&(u.properties[h]=c(String(C||""),h,u))}}if(u.type==="element"){let h=t?!t.includes(u.tagName):l?l.includes(u.tagName):!1;if(!h&&r&&typeof p=="number"&&(h=!r(u,p,m)),h&&m&&typeof p=="number")return a&&u.children?m.children.splice(p,1,...u.children):m.children.splice(p,1),p}}}function Ps(e){const n=e.indexOf(":"),t=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return n===-1||i!==-1&&n>i||t!==-1&&n>t||r!==-1&&n>r||_s.test(e.slice(0,n))?e:""}const Ns="_messageWrapper_1thak_1",As="_user_1thak_19",js="_assistant_1thak_24",zs="_avatar_1thak_28",Ms="_avatarPlaceholder_1thak_43",Ds="_brainbaseLogo_1thak_53",Bs="_messageBubble_1thak_58",Os="_error_1thak_76",Rs="_content_1thak_81",Fs="_markdown_1thak_92",$s="_cursor_1thak_183",Hs="_errorIndicator_1thak_202",ue={messageWrapper:Ns,user:As,assistant:js,avatar:zs,avatarPlaceholder:Ms,brainbaseLogo:Ds,messageBubble:Bs,error:Os,content:Rs,markdown:Fs,cursor:$s,errorIndicator:Hs},Ar=({message:e,agentName:n,agentLogoUrl:t})=>{const r=e.role==="user",i=e.status==="streaming",l=e.status==="error";return g.jsxs("div",{className:`${ue.messageWrapper} ${r?ue.user:ue.assistant}`,children:[!r&&g.jsx("div",{className:ue.avatar,children:t?g.jsx("img",{src:t,alt:n||"AI"}):g.jsx("div",{className:ue.avatarPlaceholder,children:g.jsx(Qe,{className:ue.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})})}),g.jsxs("div",{className:`${ue.messageBubble} ${l?ue.error:""}`,role:"article","aria-label":`${r?"Your message":`${n||"AI"} says`}`,children:[g.jsxs("div",{className:`${ue.content} ${r?"":ue.markdown}`,children:[r?e.content:g.jsx(Es,{components:{a:({href:o,children:a})=>o?g.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:a}):g.jsx(g.Fragment,{children:a})},children:e.content}),i&&g.jsx("span",{className:ue.cursor})]}),l&&g.jsxs("div",{className:ue.errorIndicator,children:[g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",children:[g.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),g.jsx("path",{d:"M12 8V12M12 16H12.01",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),g.jsx("span",{children:"Failed to send"})]})]})]})},Vs="_toolCall_1wby1_1",Us="_iconWrapper_1wby1_24",qs="_spinner_1wby1_33",Ws="_checkIcon_1wby1_48",Ys="_errorIcon_1wby1_54",Xs="_content_1wby1_60",Ks="_label_1wby1_66",Qs="_name_1wby1_73",Zs="_pending_1wby1_78",Js="_completed_1wby1_82",Gs="_error_1wby1_54",fe={toolCall:Vs,iconWrapper:Us,spinner:qs,checkIcon:Ws,errorIcon:Ys,content:Xs,label:Ks,name:Qs,pending:Zs,completed:Js,error:Gs},jr=({toolCall:e})=>{const n=e.status==="pending"||e.status==="executing",t=e.status==="completed",r=e.status==="error",i=l=>l.replace(/_/g," ").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,o=>o.toUpperCase());return g.jsxs("div",{className:`${fe.toolCall} ${n?fe.pending:""} ${t?fe.completed:""} ${r?fe.error:""}`,children:[g.jsx("div",{className:fe.iconWrapper,children:n?g.jsx("div",{className:fe.spinner}):t?g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:fe.checkIcon,children:g.jsx("path",{d:"M20 6L9 17L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:fe.errorIcon,children:g.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),g.jsxs("div",{className:fe.content,children:[g.jsx("span",{className:fe.label,children:n?"Running":t?"Completed":"Failed"}),g.jsx("span",{className:fe.name,children:i(e.name)})]})]})},eu="_wrapper_10rss_2",nu="_avatar_10rss_22",tu="_avatarPlaceholder_10rss_37",ru="_brainbaseLogo_10rss_47",iu="_bubble_10rss_52",lu="_dot_10rss_63",Ce={wrapper:eu,avatar:nu,avatarPlaceholder:tu,brainbaseLogo:ru,bubble:iu,dot:lu},zr=({agentName:e="AI",agentLogoUrl:n})=>g.jsxs("div",{className:Ce.wrapper,role:"status","aria-label":`${e} is typing`,children:[g.jsx("div",{className:Ce.avatar,children:n?g.jsx("img",{src:n,alt:e}):g.jsx("div",{className:Ce.avatarPlaceholder,children:g.jsx(Qe,{className:Ce.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})})}),g.jsxs("div",{className:Ce.bubble,children:[g.jsx("span",{className:Ce.dot}),g.jsx("span",{className:Ce.dot}),g.jsx("span",{className:Ce.dot})]})]}),ou="_messageList_241kk_1",au="_emptyState_241kk_29",su="_emptyIcon_241kk_40",uu="_emptyText_241kk_52",ln={messageList:ou,emptyState:au,emptyIcon:su,emptyText:uu},Mr=({messages:e,toolCalls:n=[],isLoading:t,agentName:r,agentLogoUrl:i})=>{var c;const l=F.useRef(null),o=F.useRef(null);F.useEffect(()=>{var s;(s=o.current)==null||s.scrollIntoView({behavior:"smooth"})},[e,n,t]);const a=n.filter(s=>s.status==="pending"||s.status==="executing");return g.jsxs("div",{className:ln.messageList,ref:l,role:"log","aria-live":"polite",children:[e.length===0&&!t&&g.jsxs("div",{className:ln.emptyState,children:[g.jsx("div",{className:ln.emptyIcon,children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M8 12H8.01M12 12H12.01M16 12H16.01M21 12C21 16.4183 16.9706 20 12 20C10.4607 20 9.01172 19.6565 7.74467 19.0511L3 20L4.39499 16.28C3.51156 15.0423 3 13.5743 3 12C3 7.58172 7.02944 4 12 4C16.9706 4 21 7.58172 21 12Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),g.jsx("p",{className:ln.emptyText,children:"Start a conversation"})]}),e.map(s=>g.jsx(Ar,{message:s,agentName:r,agentLogoUrl:i},s.id)),a.map(s=>g.jsx(jr,{toolCall:s},s.id)),t&&((c=e[e.length-1])==null?void 0:c.role)==="user"&&g.jsx(zr,{agentName:r,agentLogoUrl:i}),g.jsx("div",{ref:o})]})},cu="_inputWrapper_5lgg7_1",pu="_inputContainer_5lgg7_7",hu="_textarea_5lgg7_23",fu="_sendButton_5lgg7_50",du="_hint_5lgg7_89",We={inputWrapper:cu,inputContainer:pu,textarea:hu,sendButton:fu,hint:du},Dr=({onSend:e,disabled:n=!1,placeholder:t="Send a message..."})=>{const[r,i]=F.useState(""),l=F.useRef(null),o=F.useCallback(()=>{const s=l.current;s&&(s.style.height="auto",s.style.height=`${Math.min(s.scrollHeight,150)}px`)},[]);F.useEffect(()=>{o()},[r,o]);const a=F.useCallback(s=>{s==null||s.preventDefault();const u=r.trim();u&&!n&&(e(u),i(""),l.current&&(l.current.style.height="auto"))},[r,n,e]),c=F.useCallback(s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),a())},[a]);return g.jsxs("form",{className:We.inputWrapper,onSubmit:a,children:[g.jsxs("div",{className:We.inputContainer,children:[g.jsx("textarea",{ref:l,className:We.textarea,value:r,onChange:s=>i(s.target.value),onKeyDown:c,placeholder:t,disabled:n,rows:1,"aria-label":"Message input"}),g.jsx("button",{type:"submit",className:We.sendButton,disabled:n||!r.trim(),"aria-label":"Send message",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),g.jsxs("div",{className:We.hint,children:["Press ",g.jsx("kbd",{children:"Enter"})," to send, ",g.jsx("kbd",{children:"Shift + Enter"})," for new line"]})]})},mu="_poweredBy_9jh5q_1",gu="_logo_9jh5q_20",yu="_poweredText_9jh5q_24",xu="_text_9jh5q_36",on={poweredBy:mu,logo:gu,poweredText:yu,text:xu},ku=({className:e})=>g.jsxs("svg",{className:e,viewBox:"0 0 800 800",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H788C794.627 400 800 405.373 800 412V740C800 773.137 773.137 800 740 800H412C405.373 800 400 794.627 400 788V412Z",fill:"currentColor"}),g.jsx("circle",{cx:"400",cy:"400",r:"400",fill:"currentColor"}),g.jsx("path",{d:"M0 60C0 26.8629 26.8629 0 60 0H397.614C398.932 0 400 1.06811 400 2.38569V2.38569C400 221.982 221.982 400 2.38569 400V400C1.06811 400 0 398.932 0 397.614V60Z",fill:"currentColor"}),g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H738C744.627 400 750 405.373 750 412V725C750 738.807 738.807 750 725 750H412C405.373 750 400 744.627 400 738V412Z",fill:"currentColor"}),g.jsx("circle",{cx:"400",cy:"400",r:"350",fill:"currentColor"}),g.jsx("path",{d:"M50 75C50 61.1929 61.1929 50 75 50H388C394.627 50 400 55.3726 400 62V388C400 394.627 394.627 400 388 400H62C55.3726 400 50 394.627 50 388V75Z",fill:"currentColor"}),g.jsx("rect",{x:"399.919",y:"209",width:"270",height:"270",rx:"12",transform:"rotate(45 399.919 209)",fill:"var(--bb-surface-bg, #ffffff)"})]}),bu=({showBranding:e=!0})=>e?g.jsxs("a",{href:"https://brainbaselabs.com/",target:"_blank",rel:"noopener noreferrer",className:on.poweredBy,"aria-label":"Powered by Brainbase Labs",children:[g.jsx("span",{className:on.poweredText,children:"Powered by"}),g.jsx(ku,{className:on.logo}),g.jsx("span",{className:on.text,children:"Brainbase Labs"})]}):null,wu="_container_m2o9l_1",Cu="_body_m2o9l_26",Su="_confirmationOverlay_m2o9l_35",_u="_confirmationDialog_m2o9l_56",Iu="_confirmationText_m2o9l_78",Eu="_confirmationButtons_m2o9l_86",vu="_cancelButton_m2o9l_91",Tu="_confirmButton_m2o9l_92",Se={container:wu,body:Cu,confirmationOverlay:Su,confirmationDialog:_u,confirmationText:Iu,confirmationButtons:Eu,cancelButton:vu,confirmButton:Tu},Br=({config:e,messages:n,toolCalls:t=[],isLoading:r,onSendMessage:i,onClose:l,onNewChat:o})=>{var h;const[a,c]=F.useState(!1),s=n.length>0,u=()=>{c(!0)},p=()=>{c(!1),o==null||o()},m=()=>{c(!1)};return g.jsxs("div",{className:Se.container,role:"dialog","aria-label":"Chat window",children:[g.jsx(Kt,{agentName:e.agentName,agentLogoUrl:e.agentLogoUrl,welcomeTitle:e.welcomeMessage||"Hello there.",welcomeSubtitle:e.welcomeMessage?void 0:"How can we help?",onClose:l,onNewChatRequest:u,showNewChatButton:s,compact:s}),g.jsxs("div",{className:Se.body,children:[g.jsx(Mr,{messages:n,toolCalls:t,isLoading:r,agentName:e.agentName,agentLogoUrl:e.agentLogoUrl}),g.jsx(Dr,{onSend:i,disabled:r,placeholder:"Ask a question..."})]}),g.jsx(bu,{showBranding:((h=e.styling)==null?void 0:h.showBranding)??!0}),a&&g.jsx("div",{className:Se.confirmationOverlay,children:g.jsxs("div",{className:Se.confirmationDialog,children:[g.jsx("p",{className:Se.confirmationText,children:"End current chat and start a new conversation?"}),g.jsxs("div",{className:Se.confirmationButtons,children:[g.jsx("button",{className:Se.cancelButton,onClick:m,type:"button",children:"Cancel"}),g.jsx("button",{className:Se.confirmButton,onClick:p,type:"button",children:"End Chat"})]})]})})]})},Lu="_toggleButton_11dqz_1",Pu="_icon_11dqz_31",Nu="_agentLogo_11dqz_36",Au="_unreadBadge_11dqz_43",an={toggleButton:Lu,icon:Pu,agentLogo:Nu,unreadBadge:Au},Rn=({onClick:e,agentLogoUrl:n,unreadCount:t=0})=>g.jsxs("button",{className:an.toggleButton,onClick:e,"aria-label":"Open chat",type:"button",children:[n?g.jsx("img",{src:n,alt:"",className:an.agentLogo}):g.jsx("svg",{className:an.icon,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M8 12H8.01M12 12H12.01M16 12H16.01M21 12C21 16.4183 16.9706 20 12 20C10.4607 20 9.01172 19.6565 7.74467 19.0511L3 20L4.39499 16.28C3.51156 15.0423 3 13.5743 3 12C3 7.58172 7.02944 4 12 4C16.9706 4 21 7.58172 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),t>0&&g.jsx("span",{className:an.unreadBadge,children:t>9?"9+":t})]}),ju="_container_kgfgt_1",zu="_header_kgfgt_25",Mu="_logoWrapper_kgfgt_38",Du="_logo_kgfgt_38",Bu="_closeButton_kgfgt_51",Ou="_content_kgfgt_74",Ru="_iconWrapper_kgfgt_84",Fu="_errorIcon_kgfgt_95",$u="_title_kgfgt_101",Hu="_description_kgfgt_109",Vu="_retryButton_kgfgt_117",Uu="_footer_kgfgt_139",qu="_poweredBy_kgfgt_146",Wu="_footerLogo_kgfgt_160",ee={container:ju,header:zu,logoWrapper:Mu,logo:Du,closeButton:Bu,content:Ou,iconWrapper:Ru,errorIcon:Fu,title:$u,description:Hu,retryButton:Vu,footer:Uu,poweredBy:qu,footerLogo:Wu},Yu=({errorType:e,message:n,onRetry:t,onClose:r})=>{const i=()=>{switch(e){case"not_found":return{title:"Chat Not Found",description:n||"This chat widget is not configured correctly. Please check the embed ID.",icon:g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:ee.errorIcon,children:[g.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("path",{d:"M12 7V13M12 16V16.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})};case"network":return{title:"Connection Error",description:n||"Unable to connect to the chat service. Please check your internet connection.",icon:g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:ee.errorIcon,children:[g.jsx("path",{d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("path",{d:"M8 15L16 9M8 9L16 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})};default:return{title:"Something Went Wrong",description:n||"An unexpected error occurred. Please try again later.",icon:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:ee.errorIcon,children:g.jsx("path",{d:"M12 9V13M12 17H12.01M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}}},{title:l,description:o,icon:a}=i();return g.jsxs("div",{className:ee.container,children:[g.jsxs("div",{className:ee.header,children:[g.jsx("div",{className:ee.logoWrapper,children:g.jsx(Qe,{className:ee.logo,color:"white",cutoutColor:"var(--bb-primary-color)"})}),r&&g.jsx("button",{className:ee.closeButton,onClick:r,"aria-label":"Close",type:"button",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),g.jsxs("div",{className:ee.content,children:[g.jsx("div",{className:ee.iconWrapper,children:a}),g.jsx("h2",{className:ee.title,children:l}),g.jsx("p",{className:ee.description,children:o}),t&&g.jsx("button",{className:ee.retryButton,onClick:t,type:"button",children:"Try Again"})]}),g.jsx("div",{className:ee.footer,children:g.jsxs("a",{href:"https://brainbaselabs.com",target:"_blank",rel:"noopener noreferrer",className:ee.poweredBy,children:["Powered by"," ",g.jsx(Qe,{className:ee.footerLogo,color:"var(--bb-text-tertiary)",cutoutColor:"var(--bb-surface-bg)"}),g.jsx("span",{children:"Brainbase Labs"})]})})]})},Xu="_widget_1ehud_1",Ku="_inline_1ehud_25",je={widget:Xu,"bottom-right":"_bottom-right_1ehud_10","bottom-left":"_bottom-left_1ehud_17",inline:Ku},Qu=({embedId:e,apiBaseUrl:n=Wt,mockMode:t=!1,mockResponses:r,position:i="bottom-right",defaultOpen:l=!1,primaryColor:o,agentName:a,welcomeMessage:c,showBranding:s,className:u,onSessionStart:p,onSessionEnd:m,onMessage:h,onError:C})=>{const[E,_]=F.useState(l),[x,N]=F.useState(null),[T,H]=F.useState(!0),[$,b]=F.useState(null),[O,V]=F.useState(),B=F.useMemo(()=>t?Xt({primaryColor:o,agentName:a,welcomeMessage:c},r):Yt(n),[t,o,a,c,r,n]),A=F.useCallback(async()=>{H(!0),b(null),V(void 0);try{const Y=await B.getDeploymentConfig(e);N({...Y,primaryColor:o??Y.primaryColor,agentName:a??Y.agentName,welcomeMessage:c??Y.welcomeMessage,styling:{...Y.styling??{},...s!==void 0?{showBranding:s}:{}}})}catch(Y){const J=Y instanceof Error?Y:new Error("Failed to load config");J.message.includes("404")?(b("not_found"),V("The chat widget with this embed ID was not found.")):J.message.includes("Failed to fetch")||J.message.includes("network")?b("network"):b("unknown"),t&&(N({embedId:e,deploymentId:"mock-deployment",workerId:"mock-worker",flowId:"mock-flow",primaryColor:o??"#1a1a2e",agentName:a??"AI Assistant",styling:s!==void 0?{showBranding:s}:void 0}),b(null)),C==null||C(J)}finally{H(!1)}},[e,t,B,o,a,c,C]);F.useEffect(()=>{A()},[A]);const L=F.useMemo(()=>x||{embedId:e,deploymentId:"",workerId:"",flowId:"",primaryColor:o,agentName:a,welcomeMessage:c,styling:s!==void 0?{showBranding:s}:void 0},[x,e,o,a,c,s]),v=qt({config:L,apiClient:B,mockMode:t,onSessionStart:p,onSessionEnd:m,onMessage:h,onError:C}),P=F.useMemo(()=>({"--bb-primary-color":(x==null?void 0:x.primaryColor)??o??"#1a1a2e"}),[x==null?void 0:x.primaryColor,o]),I=()=>{v.endSession(),v.startNewSession()},k=()=>{_(!1)},j=()=>{A()},q=i==="inline";return T?null:$&&!t?!q&&!E?g.jsx("div",{className:`${je.widget} ${je[i]} ${u??""}`,style:P,children:g.jsx(Rn,{onClick:()=>_(!0),agentName:a})}):g.jsx("div",{className:`${je.widget} ${je[i]} ${u??""}`,style:P,children:g.jsx(Yu,{errorType:$,message:O,onRetry:j,onClose:q?void 0:k})}):g.jsx("div",{className:`${je.widget} ${je[i]} ${u??""}`,style:P,children:E||q?g.jsx(Br,{config:L,messages:v.messages,isLoading:v.isLoading,onSendMessage:v.sendMessage,onClose:q?void 0:k,onNewChat:I}):g.jsx(Rn,{onClick:()=>_(!0),agentName:x==null?void 0:x.agentName,agentLogoUrl:x==null?void 0:x.agentLogoUrl})})};function Zu(){if(typeof crypto<"u"&&crypto.randomUUID)return`bb-${crypto.randomUUID()}`;const e=Date.now().toString(36),n=Math.random().toString(36).substring(2,15),t=Math.random().toString(36).substring(2,15);return`bb-${e}-${n}${t}`}exports.ChatContainer=Br;exports.ChatHeader=Kt;exports.ChatToggleButton=Rn;exports.ChatWidget=Qu;exports.Message=Ar;exports.MessageInput=Dr;exports.MessageList=Mr;exports.ToolCallDisplay=jr;exports.TypingIndicator=zr;exports.clearSession=Tn;exports.createAPIClient=Yt;exports.createMockAPIClient=Xt;exports.generateSessionId=Zu;exports.getStoredSession=Ut;exports.storeSession=vn;exports.useChat=qt;
|