super-agent-sdk 1.0.20 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/{mammoth.browser-CxQENq5Q.cjs → mammoth.browser-BWTaSUmQ.cjs} +63 -63
- package/dist/{mammoth.browser-xkqZbK20.js → mammoth.browser-DFPCY35d.js} +3724 -3707
- package/dist/purify.es-BnmCBz16.cjs +3 -0
- package/dist/{purify.es-C-6FFqDW.js → purify.es-CImoWRjX.js} +214 -205
- package/dist/widget.cjs +47 -21
- package/dist/widget.d.ts +46 -6
- package/dist/widget.mjs +3456 -3329
- package/package.json +1 -1
- package/dist/purify.es-Dsdnkgrg.cjs +0 -3
package/dist/widget.cjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),wa=require("react-dom/client"),d=require("react/jsx-runtime"),Me=require("./nosUploader-DLX7JsnR.cjs");function Rr(e){const{sdk:t,sessionId:n,onSessionCreated:r,onRoundStart:i,onStreamStart:s,onStreamEnd:a,onError:o,onMessageSend:l}=e,[u,p]=y.useState([]),[c,h]=y.useState("ready"),[f,m]=y.useState(null),w=y.useRef(new Map),C=y.useRef(new Map),b=y.useRef(n),S=y.useRef(!0),j=y.useRef(u);b.current=n,S.current=u.length===0,j.current=u;const L=y.useCallback((T,E)=>{if(T===b.current)p(I=>{const F=C.current.get(T)??I,q=E(F);return C.current.set(T,q),q});else{const I=C.current.get(T)??[];C.current.set(T,E(I))}},[]),A=y.useCallback((T,E)=>{const I=w.current.get(T);I!=null&&I.stopTimer&&(clearTimeout(I.stopTimer),I.stopTimer=null),w.current.delete(T),C.current.delete(T),T===b.current&&h(E)},[]);y.useEffect(()=>{const T=n?w.current.get(n):void 0;h(T!=null&&T.busy?"streaming":"ready")},[n]);const k=y.useCallback((T,E)=>{var H;const I=b.current;if(I&&((H=w.current.get(I))!=null&&H.busy))return;l==null||l(T);const F={id:`user_${Date.now()}`,role:"user",parts:[...(E??[]).map($=>({type:"attachment",attachment:$})),{type:"text",content:T}],timestamp:Date.now()},q=`assistant_${Date.now()}`,U={id:q,role:"assistant",parts:[],timestamp:Date.now()},P=S.current,B=j.current;p($=>[...$,F,U]),I&&C.current.set(I,[...B,F,U]),h("submitted"),m(null);const x=$=>{let g="",Y="",te=[],ee=!1;C.current.has($)||C.current.set($,[...B,F,U]);const ue={abortController:null,busy:!0,stopTimer:null};w.current.set($,ue);const ae=()=>{const W=[...te];if(g){const se=W.findIndex(le=>le.type==="thinking");se>=0?W[se]={type:"thinking",content:g}:W.unshift({type:"thinking",content:g})}if(Y){const se=W[W.length-1];(se==null?void 0:se.type)==="text"?W[W.length-1]={type:"text",content:Y}:W.push({type:"text",content:Y})}L($,se=>se.map(le=>le.id===q?{...le,parts:W}:le))};ue.abortController=t.chat({sessionId:$,message:T,attachments:E&&E.length>0?E:void 0,stream:!0,onMessage:W=>{switch(ee||(ee=!0,$===b.current&&h("streaming")),W.type){case"session.start":W.roundId&&(i==null||i(W.roundId));break;case"thinking":g+=W.content;break;case"ai":Y+=W.content;break;case"tool_call":Y&&(te.push({type:"text",content:Y}),Y=""),te.push({type:"tool_call",toolName:W.toolName,toolCallId:W.toolCallId,args:W.args??"{}"});break;case"tool_result":Y&&(te.push({type:"text",content:Y}),Y=""),te.push({type:"tool_result",toolName:W.toolName??"",toolCallId:W.toolCallId,content:W.content,artifacts:W.artifacts,renderMode:W.renderMode,html:W.html,markdown:W.markdown});break;case"interrupt":Y&&(te.push({type:"text",content:Y}),Y=""),W.interrupt&&te.push({type:"interrupt",interrupt:W.interrupt,resolved:!1}),ae(),A($,"ready");return;case"stop":W.content&&(Y=W.content),ae();return}ae()},onDone:W=>{if((Y||te.length>0||g)&&ae(),W.artifacts&&W.artifacts.length>0){const le=W.artifacts;L($,Ee=>Ee.map(be=>be.id===q?{...be,artifacts:le}:be))}const se=()=>{A($,"ready"),a==null||a(W.sessionId||$)};if(P){const le=T.slice(0,30),Ee=W.sessionId||$;t.renameConversation(Ee,le).catch(()=>{}).finally(se)}else se()},onError:W=>{te.push({type:"error",content:W.message}),ae(),$===b.current&&(m(W),h("error")),o==null||o(W),A($,"error")}}),s==null||s($)};I?x(I):t.createSession().then($=>{b.current==null&&(b.current=$,r==null||r($)),x($)}).catch($=>{b.current==null&&(m($ instanceof Error?$:new Error(String($))),h("error")),o==null||o($ instanceof Error?$:new Error(String($)))})},[t,r,s,a,o,l,L,A]),N=y.useCallback(()=>{const T=b.current;if(!T)return;const E=w.current.get(T);E!=null&&E.busy&&(E.stopTimer&&clearTimeout(E.stopTimer),E.stopTimer=setTimeout(()=>{var I;E.stopTimer=null,(I=E.abortController)==null||I.abort(),A(T,"ready")},8e3),t.stopGeneration(T).catch(()=>{}))},[t,A]),_=y.useCallback(()=>{var q;const T=b.current;if(T&&((q=w.current.get(T))!=null&&q.busy))return;const E=u.findLastIndex(U=>U.role==="user");if(E<0)return;const I=u[E].parts.filter(U=>U.type==="text").map(U=>U.content).join(""),F=u[E].parts.filter(U=>U.type==="attachment").map(U=>U.attachment);p(U=>U.slice(0,E)),k(I,F.length>0?F:void 0)},[u,k]),O=y.useCallback((T,E)=>{var $;const I=b.current;if(!I||($=w.current.get(I))!=null&&$.busy)return;L(I,g=>g.map(Y=>({...Y,parts:Y.parts.map(te=>te.type==="interrupt"&&te.interrupt.interruptId===T?{...te,resolved:!0,response:E}:te)})));const F={abortController:null,busy:!0,stopTimer:null};w.current.set(I,F);const q=new AbortController;F.abortController=q;let U=0;L(I,g=>g.length>0&&g[g.length-1].role==="assistant"?(U=g[g.length-1].parts.length,g):(U=0,[...g,{id:`assistant_${Date.now()}`,role:"assistant",parts:[],timestamp:Date.now()}])),h("streaming");let P="",B="",x=[];const H=()=>{const g=[...x];if(P){const Y=g.findIndex(te=>te.type==="thinking");Y>=0?g[Y]={type:"thinking",content:P}:g.unshift({type:"thinking",content:P})}if(B){const Y=g[g.length-1];(Y==null?void 0:Y.type)==="text"?g[g.length-1]={type:"text",content:B}:g.push({type:"text",content:B})}L(I,Y=>{const te=Y.findLastIndex(ee=>ee.role==="assistant");return te<0?Y:Y.map((ee,ue)=>ue===te?{...ee,parts:[...ee.parts.slice(0,U),...g]}:ee)})};t.respondInterrupt(T,I,E,g=>{let Y=!1;switch(g.type){case"thinking":P+=g.content;break;case"ai":B+=g.content;break;case"tool_call":B&&(x.push({type:"text",content:B}),B=""),x.push({type:"tool_call",toolName:g.toolName,toolCallId:g.toolCallId,args:g.args??"{}"});break;case"tool_result":B&&(x.push({type:"text",content:B}),B=""),x.push({type:"tool_result",toolName:g.toolName??"",toolCallId:g.toolCallId,content:g.content,artifacts:g.artifacts,renderMode:g.renderMode,html:g.html,markdown:g.markdown});break;case"interrupt":B&&(x.push({type:"text",content:B}),B=""),g.interrupt&&x.push({type:"interrupt",interrupt:g.interrupt,resolved:!1}),Y=!0;break;case"stop":g.content&&(B=g.content),a==null||a(I),Y=!0;break;case"done":if(g.artifacts&&g.artifacts.length>0){const te=g.artifacts;L(I,ee=>{const ue=ee.findLastIndex(ae=>ae.role==="assistant");return ue<0?ee:ee.map((ae,W)=>W===ue?{...ae,artifacts:te}:ae)})}a==null||a(I),Y=!0;break}H(),Y&&A(I,"ready")},g=>{x.push({type:"error",content:g.message}),H(),I===b.current&&(m(g),h("error")),o==null||o(g),A(I,"error")},q.signal).catch(g=>{if((g==null?void 0:g.name)==="AbortError"){A(I,"ready");return}I===b.current&&(m(g instanceof Error?g:new Error(String(g))),h("error")),o==null||o(g instanceof Error?g:new Error(String(g))),A(I,"error")})},[t,o,a,L,A]),v=y.useCallback((T,E)=>{b.current=T;const I=E??C.current.get(T)??[];C.current.set(T,I),p(I)},[]),D=y.useCallback(T=>w.current.has(T)?C.current.get(T)??null:null,[]);return y.useEffect(()=>{var E;if(!n||c!=="ready"||(E=w.current.get(n))!=null&&E.busy)return;const T=Me.popPendingChat();T&&T.sessionId===n&&k(T.message)},[n,c]),{messages:u,status:c,error:f,sendMessage:k,stop:N,regenerate:_,setMessages:p,showSession:v,getLiveMessages:D,respondToInterrupt:O}}const Pr="sa_active_conversation",Pt=20;function Mn(e){try{return localStorage.getItem(`${Pr}_${e}`)}catch{return null}}function ya(e,t){try{const n=`${Pr}_${e}`;t?localStorage.setItem(n,t):localStorage.removeItem(n)}catch{}}function Fr(e){const{sdk:t,onConversationChange:n}=e,r=t.botCode,[i,s]=y.useState([]),[a,o]=y.useState(()=>Mn(r)),[l,u]=y.useState(!1),[p,c]=y.useState(!0),h=y.useRef(!0),f=y.useRef(1),m=y.useRef(!1);y.useEffect(()=>()=>{h.current=!1},[]);const w=y.useCallback(N=>{o(N),ya(r,N),N&&(n==null||n(N))},[r,n]),C=y.useCallback(async()=>{if(!m.current){m.current=!0,u(!0);try{f.current=1;const N=await t.listConversations({page:1,size:Pt});if(!h.current)return;s(N.items),c(N.items.length<N.total);const _=Mn(r);_&&!N.items.find(O=>O.sessionId===_)&&w(null)}catch{}finally{m.current=!1,h.current&&u(!1)}}},[t,w]),b=y.useCallback(async()=>{if(!(m.current||!p)){m.current=!0,u(!0);try{const N=f.current+1,_=await t.listConversations({page:N,size:Pt});if(!h.current)return;f.current=N,s(v=>{const D=new Set(v.map(E=>E.sessionId)),T=_.items.filter(E=>!D.has(E.sessionId));return[...v,...T]});const O=f.current*Pt;c(O<_.total)}catch{}finally{m.current=!1,h.current&&u(!1)}}},[t,p]),S=y.useCallback(async(N,_)=>(w(N),(_==null?void 0:_.fetchHistory)===!1?[]:await t.getMessages(N)),[t,w]),j=y.useCallback(async()=>{try{const N=await t.createSession(),_=new Date().toISOString();s(O=>[{sessionId:N,title:"新对话",createTime:_,updateTime:_},...O]),w(N)}catch{w(null)}},[t,w]),L=y.useCallback(async N=>{s(_=>_.filter(O=>O.sessionId!==N)),a===N&&w(null);try{await t.deleteConversation(N)}catch{}},[t,a,w]),A=y.useCallback(async(N,_)=>{await t.renameConversation(N,_),s(O=>O.map(v=>v.sessionId===N?{...v,title:_}:v))},[t]),{enabled:k=!0}=e;return y.useEffect(()=>{k&&C()},[k,C]),{conversations:i,activeConversationId:a,loading:l,hasMore:p,loadConversations:C,loadMore:b,switchConversation:S,newConversation:j,deleteConversation:L,renameConversation:A,setActiveConversationId:w}}function _r(e){return!e&&e!==0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Or(e){return e==="pdf"?"PDF":e==="docx"?"DOC":e==="html"?"HTM":e==="md"?"MD":e.slice(0,3).toUpperCase()||"FILE"}function ka(e,t){var i;const n=(e||"").toLowerCase();if(n.includes("html"))return"html";if(n.includes("markdown"))return"md";if(n.includes("pdf"))return"pdf";if(n.includes("wordprocessingml")||n==="application/msword")return"docx";const r=((i=(t||"").split(".").pop())==null?void 0:i.toLowerCase())??"";return r==="htm"||r==="html"?"html":r==="md"||r==="markdown"?"md":r==="pdf"?"pdf":r==="doc"||r==="docx"?"docx":r}function Br(e){if(!e)return[];const t=[];for(const n of e)if(n.type==="file"&&n.data){const r=n.data.name??n.data.filename??"",i=n.data.mime??n.data.mime_type??n.data.mimeType;t.push({id:n.data.id??"",type:n.data.fileType??n.data.type??ka(i,r),filename:r,url:n.data.url??"",mime:i,size:n.data.size,summary:n.data.summary})}return t}async function kt(e){try{const t=await fetch(e.url);if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=await t.blob(),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=e.filename,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),4e3)}catch{const t=document.createElement("a");t.href=e.url,t.download=e.filename,t.target="_blank",document.body.appendChild(t),t.click(),t.remove()}}const $r=y.createContext(null);function ze(){const e=y.useContext($r);if(!e)throw new Error("useChatContext must be used within ChatProvider");return e}function Jt({sdk:e,hooks:t,attachmentUploader:n,nosUpload:r,children:i}){const[s,a]=y.useState(!1),[o,l]=y.useState(!1),[u,p]=y.useState(null),[c,h]=y.useState(null),[f,m]=y.useState(!1),[w,C]=y.useState(!1);y.useEffect(()=>{e.getToken().then(()=>{m(!0)}).catch(()=>{m(!0)})},[e]);const b=Fr({sdk:e,onConversationChange:t==null?void 0:t.onConversationChange,enabled:f}),S=Rr({sdk:e,sessionId:b.activeConversationId,onSessionCreated:P=>{b.setActiveConversationId(P)},onStreamStart:t==null?void 0:t.onStreamStart,onStreamEnd:P=>{var B;(B=t==null?void 0:t.onStreamEnd)==null||B.call(t,P),b.loadConversations()},onError:t==null?void 0:t.onError,onMessageSend:t==null?void 0:t.onMessageSend}),j=y.useCallback(P=>{if(P.type==="link"){window.open(P.url,P.target??"_blank","noopener");return}h(P)},[]),L=y.useCallback(()=>h(null),[]),A=y.useRef(0),k=y.useCallback(async P=>{h(null);const B=++A.current;if(S.getLiveMessages(P)){await b.switchConversation(P,{fetchHistory:!1}),S.showSession(P),C(!1);return}C(!0);try{const x=await b.switchConversation(P);if(A.current!==B)return;S.showSession(P,x)}finally{A.current===B&&C(!1)}},[b,S]),N=y.useCallback(async()=>{h(null),S.setMessages([]),await b.newConversation()},[b,S]),_=y.useCallback(async P=>{b.activeConversationId===P&&S.setMessages([]),await b.deleteConversation(P)},[b,S]);y.useEffect(()=>{b.activeConversationId&&S.messages.length===0&&(C(!0),e.getMessages(b.activeConversationId).then(P=>{S.setMessages(P)}).catch(()=>{}).finally(()=>C(!1)))},[]);const O=y.useCallback(()=>{a(P=>!P)},[]),v=y.useCallback(P=>{a(P)},[]),D=y.useCallback(()=>{l(P=>!P),p(P=>null)},[]),T=y.useCallback(P=>{p(P),l(!0)},[]),E=y.useMemo(()=>{const P=new Set,B=[];for(const x of S.messages)if(x.role==="assistant"&&x.artifacts)for(const H of Br(x.artifacts)){const $=H.id||`${H.url}:${H.filename}`;P.has($)||(P.add($),B.push(H))}return B},[S.messages]),I=y.useCallback(async()=>{const P=b.activeConversationId;if(!P)return null;try{const B=await e.getMessages(P);S.setMessages(B);const x=B.findLast(H=>H.role==="assistant");return(x==null?void 0:x.id)??null}catch{return null}},[e,b.activeConversationId,S]),F=y.useCallback((P,B,x)=>{if(/^\d+$/.test(P)){e.feedback(P,B,x).catch(()=>{});return}I().then(H=>{H&&e.feedback(H,B,x).catch(()=>{})})},[e,I]),q=y.useCallback(P=>{if(/^\d+$/.test(P)){e.cancelFeedback(P).catch(()=>{});return}I().then(B=>{B&&e.cancelFeedback(B).catch(()=>{})})},[e,I]),U=y.useMemo(()=>({sdk:e,status:S.status,error:S.error,messages:S.messages,conversations:b.conversations,activeConversationId:b.activeConversationId,isThreadListOpen:s,isArtifactDrawerOpen:o,allArtifacts:E,activePreviewArtifact:u,activePanel:c,hasMore:b.hasMore,conversationsLoading:b.loading,messagesLoading:w,sendMessage:S.sendMessage,attachmentUploader:n??null,nosUpload:r??null,stop:S.stop,regenerate:S.regenerate,switchConversation:k,newConversation:N,deleteConversation:_,renameConversation:b.renameConversation,loadMoreConversations:b.loadMore,toggleThreadList:O,setThreadListOpen:v,toggleArtifactDrawer:D,openArtifactPreview:T,openPanel:j,closePanel:L,feedback:F,cancelFeedback:q,respondToInterrupt:S.respondToInterrupt}),[e,S.status,S.error,S.messages,S.sendMessage,S.stop,S.regenerate,S.respondToInterrupt,n,r,b.conversations,b.activeConversationId,b.renameConversation,b.hasMore,b.loadMore,b.loading,s,o,E,u,c,w,k,N,_,O,v,D,T,j,L,F,q]);return d.jsx($r.Provider,{value:U,children:i})}const ce="https://ehr-web.netease.com/ehr-web/erh-super-agent",pe={recently:`${ce}/recently.svg`,home:`${ce}/home.svg`,mergeWindow:`${ce}/merge_window.svg`,spiltWindow:`${ce}/spilt_window.svg`,close:`${ce}/close.svg`,message:`${ce}/message.svg`,messageCreate:`${ce}/message_create.svg`,customerService:`${ce}/customer_service.svg`,sendSolid:`${ce}/send_solid.svg`,capabilityIcons:[`${ce}/icon1.png`,`${ce}/icon2.png`,`${ce}/icon3.png`],triggerLogo:`${ce}/HRlogo.png`,logo:`${ce}/HRlogo2.png`,assistantAvatarGenerating:`${ce}/profile0.gif`,assistantAvatar:`${ce}/profile1.png`},de={TRIGGER_SIZE:56,TRIGGER_RIGHT:20,TRIGGER_BOTTOM:80,DEFAULT_WIDTH:400,DEFAULT_HEIGHT:648,MIN_WIDTH:360,MAX_WIDTH:800,MAX_HEIGHT_RATIO:.95};function va({defaultWidth:e=de.DEFAULT_WIDTH,defaultHeight:t=de.DEFAULT_HEIGHT,sidebarWidth:n=0}={}){const[r,i]=y.useState(e),[s,a]=y.useState({x:0,y:0}),[o,l]=y.useState(!1),[u,p]=y.useState(!1),[c,h]=y.useState(null),[f,m]=y.useState(()=>typeof window>"u"?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight}),w=y.useRef(!1),C=y.useRef(0),b=y.useRef(r),S=y.useRef(!1),j=y.useRef({x:0,y:0}),L=y.useRef({x:0,y:0}),A=y.useRef(!1),k=y.useRef(null);y.useEffect(()=>{const I=()=>m({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[]),y.useEffect(()=>()=>{var I;(I=k.current)==null||I.call(k)},[]);const N=Math.floor(f.height*de.MAX_HEIGHT_RATIO),_=Math.min(c||t,N),O=r+n;y.useEffect(()=>{if(!o){const I=f.width-O-20,F=f.height-_-20;a(q=>q.x===I&&q.y===F?q:{x:I,y:F})}},[o,O,_,f]);const v=y.useCallback(I=>{if(u||I.target.closest("button, input, textarea"))return;S.current=!0,A.current=!1,j.current={x:I.clientX,y:I.clientY},L.current={...s};const F=P=>{if(!S.current)return;const B=P.clientX-j.current.x,x=P.clientY-j.current.y;(Math.abs(B)>3||Math.abs(x)>3)&&(A.current=!0),A.current&&(l(!0),a({x:Math.max(-200,Math.min(L.current.x+B,window.innerWidth-100)),y:Math.max(0,Math.min(L.current.y+x,window.innerHeight-48))}))},q=()=>{S.current=!1,U()},U=()=>{document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",q),k.current=null};document.addEventListener("mousemove",F),document.addEventListener("mouseup",q),k.current=U},[u,s]),D=y.useCallback(I=>{I.preventDefault(),I.stopPropagation(),w.current=!0,C.current=I.clientX,b.current=r;const F=s.x+r,q=s.y,U=x=>{if(!w.current)return;const H=x.clientX-C.current;let $=b.current-H;if($>de.MAX_WIDTH){w.current=!1,p(!0),B();return}$=Math.max(de.MIN_WIDTH,$),i($),a({x:F-$,y:q})},P=()=>{w.current=!1,B()},B=()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",P),k.current=null};document.addEventListener("mousemove",U),document.addEventListener("mouseup",P),k.current=B},[r,s]),T=y.useCallback(()=>{u&&i(e),p(I=>!I)},[u,e]),E=y.useCallback(()=>{p(!1),i(e),l(!1),h(null)},[e]);return{width:r,position:s,hasCustomPosition:o,isMaximized:u,lockedHeight:c,viewport:f,defaultHeight:t,totalWidth:O,windowHeight:_,startWindowDrag:v,startResize:D,toggleMaximize:T,setIsMaximized:p,setLockedHeight:h,setHasCustomPosition:l,reset:E}}function Ca(e){const{enabled:t,contentSelector:n,defaultHeight:r,onHeightChange:i}=e,s=y.useRef(null);return y.useEffect(()=>{if(!t||!s.current)return;const o=s.current.querySelector(n);if(!o)return;const l=()=>{const c=s.current;if(!c)return;const h=c.querySelector(n);if(!h)return;const f=c.offsetHeight-h.clientHeight,m=h.scrollHeight+f,w=Math.floor(window.innerHeight*de.MAX_HEIGHT_RATIO),C=Math.max(r,Math.min(m,w));i(b=>b===C?b:C)};l();const u=new ResizeObserver(()=>l());Array.from(o.children).forEach(c=>u.observe(c));const p=new MutationObserver(()=>{Array.from(o.children).forEach(c=>u.observe(c)),l()});return p.observe(o,{childList:!0,subtree:!0,characterData:!0}),()=>{u.disconnect(),p.disconnect()}},[t,n,r,i]),s}function Sa(e,t){const n=de.TRIGGER_SIZE;return{x:Math.max(8,Math.min(e,window.innerWidth-n-8)),y:Math.max(8,Math.min(t,window.innerHeight-n-8))}}function Hr({isOpen:e,onClick:t,triggerLogo:n}){const[r,i]=y.useState(null),s=y.useRef(!1),a=y.useRef(!1),o=y.useRef({x:0,y:0}),l=y.useRef({x:0,y:0}),u=y.useRef(null);y.useEffect(()=>()=>{var f;(f=u.current)==null||f.call(u)},[]);const p=y.useCallback(f=>{if(f.button!==0)return;s.current=!0,a.current=!1,o.current={x:f.clientX,y:f.clientY};const m=f.currentTarget.getBoundingClientRect();l.current={x:m.left,y:m.top};const w=b=>{if(!s.current)return;const S=b.clientX-o.current.x,j=b.clientY-o.current.y;(Math.abs(S)>4||Math.abs(j)>4)&&(a.current=!0),a.current&&i(Sa(l.current.x+S,l.current.y+j))},C=()=>{s.current=!1,document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",C),u.current=null};document.addEventListener("mousemove",w),document.addEventListener("mouseup",C),u.current=C},[]),c=y.useCallback(()=>{if(a.current){a.current=!1;return}t()},[t]),h=r?{left:r.x,top:r.y,width:de.TRIGGER_SIZE,height:de.TRIGGER_SIZE}:{right:de.TRIGGER_RIGHT,bottom:de.TRIGGER_BOTTOM,width:de.TRIGGER_SIZE,height:de.TRIGGER_SIZE};return d.jsx("button",{type:"button",className:`fixed z-[10000] flex items-center justify-center border-none bg-transparent p-0 transition-transform duration-200 ease-out hover:scale-[1.08] active:scale-95 ${e?"pointer-events-none scale-50 opacity-0":"opacity-100"}`,style:h,onMouseDown:p,onClick:c,"aria-label":"打开 AI 助手",title:"AI 助手",children:d.jsx("img",{src:n||pe.triggerLogo,alt:"AI 助手",className:"block h-full w-full",draggable:!1})})}function nt({tooltip:e,onClick:t,children:n}){return d.jsx("button",{type:"button",className:"sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white active:bg-[#F5F5F5]","data-tooltip":e,"aria-label":e,onClick:t,children:n})}function Ur({onClose:e,onToggleThreadList:t,isMaximized:n=!1,onToggleMaximize:r,showHome:i=!1,onHome:s,showClose:a=!0,artifactCount:o=0,onToggleArtifactDrawer:l,panelTitle:u}){return d.jsxs("div",{className:"relative z-20 flex h-9 shrink-0 select-none items-center px-[15px]",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(nt,{tooltip:"历史记录",onClick:t,children:d.jsx("img",{src:pe.recently,alt:"",width:20,height:20})}),i&&s&&d.jsx(nt,{tooltip:u?"返回聊天":"回到首页",onClick:s,children:d.jsx("img",{src:pe.home,alt:"",width:20,height:20})})]}),u&&d.jsx("div",{className:"pointer-events-none absolute inset-x-0 flex justify-center",children:d.jsx("span",{className:"max-w-[50%] truncate text-[15px] font-semibold text-[#18181b]",children:u})}),d.jsxs("div",{className:"ml-auto flex items-center gap-2.5",children:[o>0&&l&&d.jsx(nt,{tooltip:"会话产物",onClick:l,children:d.jsxs("span",{className:"relative flex items-center gap-1",children:[d.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),d.jsx("polyline",{points:"14 2 14 8 20 8"})]}),o>0&&d.jsx("span",{className:"absolute -right-2 -top-1.5 min-w-[14px] rounded-full bg-[var(--sa-primary)] px-0.5 text-center text-[9px] font-medium leading-[14px] text-white",children:o>99?"99+":o})]})}),r&&d.jsx(nt,{tooltip:n?"小窗":"大窗",onClick:r,children:d.jsx("img",{src:n?pe.spiltWindow:pe.mergeWindow,alt:"",width:20,height:20})}),a&&d.jsx(nt,{tooltip:"关闭",onClick:e,children:d.jsx("img",{src:pe.close,alt:"",width:20,height:20})})]})]})}const rt=e=>String(e).padStart(2,"0");function ja(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?"":`${t.getFullYear()}-${rt(t.getMonth()+1)}-${rt(t.getDate())} ${rt(t.getHours())}:${rt(t.getMinutes())}:${rt(t.getSeconds())}`}function Vr(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=n-6*864e5,i=[],s=[],a=[];for(const l of e){const u=new Date(l.updateTime).getTime();u>=n?i.push(l):u>=r?s.push(l):a.push(l)}const o=[];return i.length&&o.push({label:"今天",items:i}),s.length&&o.push({label:"最近 7 天",items:s}),a.length&&o.push({label:"更早",items:a}),o}function Zt({width:e}){const{conversations:t,activeConversationId:n,switchConversation:r,newConversation:i,deleteConversation:s,renameConversation:a,hasMore:o,loadMoreConversations:l,conversationsLoading:u}=ze(),[p,c]=y.useState(null),[h,f]=y.useState(""),[m,w]=y.useState(null),C=y.useRef(null),b=y.useCallback((A,k)=>{c(A),f(k??"")},[]),S=y.useCallback(A=>{h.trim()&&a(A,h.trim()),c(null)},[h,a]),j=y.useCallback(()=>{const A=C.current;!A||!o||A.scrollHeight-A.scrollTop-A.clientHeight<50&&l()},[o,l]),L=y.useMemo(()=>Vr(t),[t]);return d.jsxs("div",{className:"relative z-[5] flex h-full shrink-0 flex-col overflow-visible border-r border-[#ECECEC] bg-[#FAFAFA] p-3 animate-sa-history-in",style:{width:e??200},children:[d.jsxs("button",{type:"button",className:"sa-new-chat mb-4 flex h-8 w-full shrink-0 items-center justify-center gap-2 rounded-md text-[14px] font-medium transition-colors",onClick:i,children:[d.jsx("img",{src:pe.messageCreate,alt:"",width:18,height:18}),d.jsx("span",{className:"sa-new-chat-text whitespace-nowrap",children:"新建对话"})]}),d.jsxs("div",{className:"px-1 pb-2.5",children:[d.jsx("div",{className:"mb-1 text-[14px] font-semibold text-[#333]",children:"历史对话"}),d.jsx("div",{className:"text-[11px] text-[#999]",children:"展示最近的会话记录"})]}),d.jsxs("div",{ref:C,className:"flex-1 overflow-y-auto",onScroll:j,children:[u&&t.length===0&&d.jsx("div",{className:"px-0.5 py-2 text-[12px] text-[#999]",children:"加载中..."}),!u&&t.length===0&&d.jsx("div",{className:"px-0.5 py-2 text-[12px] text-[#999]",children:"暂无记录"}),L.map(A=>d.jsxs("div",{className:"mb-1",children:[d.jsx("div",{className:"px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]",children:A.label}),A.items.map(k=>d.jsx("div",{className:`group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${k.sessionId===n?"bg-[#E8F1FE]":"hover:bg-[#E8F1FE]"}`,onClick:()=>{p!==k.sessionId&&r(k.sessionId)},onMouseEnter:N=>{if(p===k.sessionId)return;const _=N.currentTarget.getBoundingClientRect();w({text:k.title||"新会话",x:_.right+8,y:_.top+_.height/2})},onMouseLeave:()=>w(null),children:p===k.sessionId?d.jsx("input",{className:"w-full rounded border border-[var(--sa-primary)] bg-white px-1.5 py-0.5 text-[12px] outline-none",value:h,onChange:N=>f(N.target.value),onBlur:()=>S(k.sessionId),onKeyDown:N=>{N.key==="Enter"&&S(k.sessionId),N.key==="Escape"&&c(null)},onClick:N=>N.stopPropagation(),autoFocus:!0}):d.jsxs(d.Fragment,{children:[d.jsx("img",{src:pe.message,alt:"",width:16,height:16,className:"shrink-0 opacity-60"}),d.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]",children:k.title||"新会话"}),d.jsxs("span",{className:"hidden shrink-0 items-center gap-0.5 group-hover:flex",children:[d.jsx("button",{type:"button",className:"flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[var(--sa-primary)]",onClick:N=>{N.stopPropagation(),b(k.sessionId,k.title)},title:"重命名",children:d.jsx("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"})})}),d.jsx("button",{type:"button",className:"flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[#ef4444]",onClick:N=>{N.stopPropagation(),s(k.sessionId)},title:"删除",children:d.jsx("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})})})]})]})},k.sessionId))]},A.label)),u&&t.length>0&&d.jsx("div",{className:"px-0.5 py-2 text-[12px] text-[#999]",children:o?"加载更多...":"加载中..."}),!u&&o&&d.jsx("div",{className:"px-0.5 py-2 text-center text-[11px] text-[#C0C0C0]",children:"向下滚动加载更多"})]}),m&&d.jsx("div",{className:"pointer-events-none fixed z-[10001] whitespace-nowrap rounded border border-[#E8E8E8] bg-white px-2.5 py-1.5 text-[12px] leading-[1.4] text-[#333] shadow-[0_2px_8px_rgba(0,0,0,0.12)]",style:{left:m.x,top:m.y,transform:"translateY(-50%)"},children:m.text})]})}function qr(e){const t=y.useRef(null),n=y.useRef(!1),r=y.useRef(0),i=y.useCallback(()=>{const a=t.current;if(!a)return;const{scrollTop:o,scrollHeight:l,clientHeight:u}=a,p=l-o-u<40;o<r.current&&!p&&(n.current=!0),p&&(n.current=!1),r.current=o},[]);y.useEffect(()=>{const a=t.current;if(a)return a.addEventListener("scroll",i,{passive:!0}),()=>a.removeEventListener("scroll",i)},[i]),y.useEffect(()=>{if(n.current)return;const a=t.current;a&&requestAnimationFrame(()=>{a.scrollTop=a.scrollHeight})},e);const s=y.useCallback(()=>{n.current=!1;const a=t.current;a&&(a.scrollTop=a.scrollHeight)},[]);return{containerRef:t,scrollToBottom:s}}function Ea(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Ia=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,za=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ta={};function Rn(e,t){return(Ta.jsx?za:Ia).test(e)}const Aa=/[ \t\n\f\r]/g;function Na(e){return typeof e=="object"?e.type==="text"?Pn(e.value):!1:Pn(e)}function Pn(e){return e.replace(Aa,"")===""}class dt{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}dt.prototype.normal={};dt.prototype.property={};dt.prototype.space=void 0;function Wr(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new dt(n,r,t)}function en(e){return e.toLowerCase()}class xe{constructor(t,n){this.attribute=n,this.property=t}}xe.prototype.attribute="";xe.prototype.booleanish=!1;xe.prototype.boolean=!1;xe.prototype.commaOrSpaceSeparated=!1;xe.prototype.commaSeparated=!1;xe.prototype.defined=!1;xe.prototype.mustUseProperty=!1;xe.prototype.number=!1;xe.prototype.overloadedBoolean=!1;xe.prototype.property="";xe.prototype.spaceSeparated=!1;xe.prototype.space=void 0;let La=0;const X=Ue(),oe=Ue(),tn=Ue(),M=Ue(),re=Ue(),$e=Ue(),ye=Ue();function Ue(){return 2**++La}const nn=Object.freeze(Object.defineProperty({__proto__:null,boolean:X,booleanish:oe,commaOrSpaceSeparated:ye,commaSeparated:$e,number:M,overloadedBoolean:tn,spaceSeparated:re},Symbol.toStringTag,{value:"Module"})),Ft=Object.keys(nn);class fn extends xe{constructor(t,n,r,i){let s=-1;if(super(t,n),Fn(this,"space",i),typeof r=="number")for(;++s<Ft.length;){const a=Ft[s];Fn(this,Ft[s],(r&nn[a])===nn[a])}}}fn.prototype.defined=!0;function Fn(e,t,n){n&&(e[t]=n)}function Ge(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new fn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[en(r)]=r,n[en(s.attribute)]=r}return new dt(t,n,e.space)}const Yr=Ge({properties:{ariaActiveDescendant:null,ariaAtomic:oe,ariaAutoComplete:null,ariaBusy:oe,ariaChecked:oe,ariaColCount:M,ariaColIndex:M,ariaColSpan:M,ariaControls:re,ariaCurrent:null,ariaDescribedBy:re,ariaDetails:null,ariaDisabled:oe,ariaDropEffect:re,ariaErrorMessage:null,ariaExpanded:oe,ariaFlowTo:re,ariaGrabbed:oe,ariaHasPopup:null,ariaHidden:oe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:re,ariaLevel:M,ariaLive:null,ariaModal:oe,ariaMultiLine:oe,ariaMultiSelectable:oe,ariaOrientation:null,ariaOwns:re,ariaPlaceholder:null,ariaPosInSet:M,ariaPressed:oe,ariaReadOnly:oe,ariaRelevant:null,ariaRequired:oe,ariaRoleDescription:re,ariaRowCount:M,ariaRowIndex:M,ariaRowSpan:M,ariaSelected:oe,ariaSetSize:M,ariaSort:null,ariaValueMax:M,ariaValueMin:M,ariaValueNow:M,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Gr(e,t){return t in e?e[t]:t}function Xr(e,t){return Gr(e,t.toLowerCase())}const Da=Ge({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$e,acceptCharset:re,accessKey:re,action:null,allow:null,allowFullScreen:X,allowPaymentRequest:X,allowUserMedia:X,alpha:X,alt:null,as:null,async:X,autoCapitalize:null,autoComplete:re,autoFocus:X,autoPlay:X,blocking:re,capture:null,charSet:null,checked:X,cite:null,className:re,closedBy:null,colorSpace:null,cols:M,colSpan:M,command:null,commandFor:null,content:null,contentEditable:oe,controls:X,controlsList:re,coords:M|$e,crossOrigin:null,data:null,dateTime:null,decoding:null,default:X,defer:X,dir:null,dirName:null,disabled:X,download:tn,draggable:oe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:X,formTarget:null,headers:re,height:M,hidden:tn,high:M,href:null,hrefLang:null,htmlFor:re,httpEquiv:re,id:null,imageSizes:null,imageSrcSet:null,inert:X,inputMode:null,integrity:null,is:null,isMap:X,itemId:null,itemProp:re,itemRef:re,itemScope:X,itemType:re,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:X,low:M,manifest:null,max:null,maxLength:M,media:null,method:null,min:null,minLength:M,multiple:X,muted:X,name:null,nonce:null,noModule:X,noValidate:X,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:X,optimum:M,pattern:null,ping:re,placeholder:null,playsInline:X,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:X,referrerPolicy:null,rel:re,required:X,reversed:X,rows:M,rowSpan:M,sandbox:re,scope:null,scoped:X,seamless:X,selected:X,shadowRootClonable:X,shadowRootCustomElementRegistry:X,shadowRootDelegatesFocus:X,shadowRootMode:null,shadowRootSerializable:X,shape:null,size:M,sizes:null,slot:null,span:M,spellCheck:oe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:M,step:null,style:null,tabIndex:M,target:null,title:null,translate:null,type:null,typeMustMatch:X,useMap:null,value:oe,width:M,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:re,axis:null,background:null,bgColor:null,border:M,borderColor:null,bottomMargin:M,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:X,declare:X,event:null,face:null,frame:null,frameBorder:null,hSpace:M,leftMargin:M,link:null,longDesc:null,lowSrc:null,marginHeight:M,marginWidth:M,noResize:X,noHref:X,noShade:X,noWrap:X,object:null,profile:null,prompt:null,rev:null,rightMargin:M,rules:null,scheme:null,scrolling:oe,standby:null,summary:null,text:null,topMargin:M,valueType:null,version:null,vAlign:null,vLink:null,vSpace:M,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:X,disablePictureInPicture:X,disableRemotePlayback:X,exportParts:$e,part:re,prefix:null,property:null,results:M,security:null,unselectable:null},space:"html",transform:Xr}),Ma=Ge({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",maskType:"mask-type",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:ye,accentHeight:M,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:M,amplitude:M,arabicForm:null,ascent:M,attributeName:null,attributeType:null,azimuth:M,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:M,by:null,calcMode:null,capHeight:M,className:re,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:M,diffuseConstant:M,direction:null,display:null,dur:null,divisor:M,dominantBaseline:null,download:X,dx:null,dy:null,edgeMode:null,editable:null,elevation:M,enableBackground:null,end:null,event:null,exponent:M,externalResourcesRequired:null,fill:null,fillOpacity:M,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:$e,g2:$e,glyphName:$e,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:M,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:M,horizOriginX:M,horizOriginY:M,id:null,ideographic:M,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:M,k:M,k1:M,k2:M,k3:M,k4:M,kernelMatrix:ye,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:M,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:M,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:M,overlineThickness:M,paintOrder:null,panose1:null,path:null,pathLength:M,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:re,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:M,pointsAtY:M,pointsAtZ:M,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ye,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ye,rev:ye,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ye,requiredFeatures:ye,requiredFonts:ye,requiredFormats:ye,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:M,specularExponent:M,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:M,strikethroughThickness:M,string:null,stroke:null,strokeDashArray:ye,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:M,strokeOpacity:M,strokeWidth:null,style:null,surfaceScale:M,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ye,tabIndex:M,tableValues:null,target:null,targetX:M,targetY:M,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ye,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:M,underlineThickness:M,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:M,values:null,vAlphabetic:M,vMathematical:M,vectorEffect:null,vHanging:M,vIdeographic:M,version:null,vertAdvY:M,vertOriginX:M,vertOriginY:M,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:M,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Gr}),Kr=Ge({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Qr=Ge({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Xr}),Jr=Ge({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Ra={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"},Pa=/[A-Z]/g,_n=/-[a-z]/g,Fa=/^data[-\w.:]+$/i;function _a(e,t){const n=en(t);let r=t,i=xe;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Fa.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(_n,Ba);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!_n.test(s)){let a=s.replace(Pa,Oa);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=fn}return new i(r,t)}function Oa(e){return"-"+e.toLowerCase()}function Ba(e){return e.charAt(1).toUpperCase()}const $a=Wr([Yr,Da,Kr,Qr,Jr],"html"),hn=Wr([Yr,Ma,Kr,Qr,Jr],"svg");function Ha(e){return e.join(" ").trim()}var gn={},On=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ua=/\n/g,Va=/^\s*/,qa=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Wa=/^:\s*/,Ya=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Ga=/^[;\s]*/,Xa=/^\s+|\s+$/g,Ka=`
|
|
2
|
-
`,Bn="/",$n="*",Be="",Qa="comment",Ja="declaration";function Za(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(m){var w=m.match(Ua);w&&(n+=w.length);var C=m.lastIndexOf(Ka);r=~C?m.length-C:r+m.length}function s(){var m={line:n,column:r};return function(w){return w.position=new a(m),u(),w}}function a(m){this.start=m,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(m){var w=new Error(t.source+":"+n+":"+r+": "+m);if(w.reason=m,w.filename=t.source,w.line=n,w.column=r,w.source=e,!t.silent)throw w}function l(m){var w=m.exec(e);if(w){var C=w[0];return i(C),e=e.slice(C.length),w}}function u(){l(Va)}function p(m){var w;for(m=m||[];w=c();)w!==!1&&m.push(w);return m}function c(){var m=s();if(!(Bn!=e.charAt(0)||$n!=e.charAt(1))){for(var w=2;Be!=e.charAt(w)&&($n!=e.charAt(w)||Bn!=e.charAt(w+1));)++w;if(w+=2,Be===e.charAt(w-1))return o("End of comment missing");var C=e.slice(2,w-2);return r+=2,i(C),e=e.slice(w),r+=2,m({type:Qa,comment:C})}}function h(){var m=s(),w=l(qa);if(w){if(c(),!l(Wa))return o("property missing ':'");var C=l(Ya),b=m({type:Ja,property:Hn(w[0].replace(On,Be)),value:C?Hn(C[0].replace(On,Be)):Be});return l(Ga),b}}function f(){var m=[];p(m);for(var w;w=h();)w!==!1&&(m.push(w),p(m));return m}return u(),f()}function Hn(e){return e?e.replace(Xa,Be):Be}var es=Za,ts=Me.commonjsGlobal&&Me.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gn,"__esModule",{value:!0});gn.default=rs;const ns=ts(es);function rs(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,ns.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:a,value:o}=s;i?t(a,o,s):o&&(n=n||{},n[a]=o)}),n}var Et={};Object.defineProperty(Et,"__esModule",{value:!0});Et.camelCase=void 0;var is=/^--[a-zA-Z0-9_-]+$/,as=/-([a-z])/g,ss=/^[^-]+$/,os=/^-(webkit|moz|ms|o|khtml)-/,ls=/^-(ms)-/,us=function(e){return!e||ss.test(e)||is.test(e)},cs=function(e,t){return t.toUpperCase()},Un=function(e,t){return"".concat(t,"-")},ds=function(e,t){return t===void 0&&(t={}),us(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(ls,Un):e=e.replace(os,Un),e.replace(as,cs))};Et.camelCase=ds;var ps=Me.commonjsGlobal&&Me.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},fs=ps(gn),hs=Et;function rn(e,t){var n={};return!e||typeof e!="string"||(0,fs.default)(e,function(r,i){r&&i&&(n[(0,hs.camelCase)(r,t)]=i)}),n}rn.default=rn;var gs=rn;const ms=Me.getDefaultExportFromCjs(gs),Zr=ei("end"),mn=ei("start");function ei(e){return t;function t(n){const r=n&&n.position&&n.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 xs(e){const t=mn(e),n=Zr(e);if(t&&n)return{start:t,end:n}}function st(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Vn(e.position):"start"in e||"end"in e?Vn(e):"line"in e||"column"in e?an(e):""}function an(e){return qn(e&&e.line)+":"+qn(e&&e.column)}function Vn(e){return an(e&&e.start)+"-"+an(e&&e.end)}function qn(e){return e&&typeof e=="number"?e:1}class he extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(a=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const o=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=st(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}he.prototype.file="";he.prototype.name="";he.prototype.reason="";he.prototype.message="";he.prototype.stack="";he.prototype.column=void 0;he.prototype.line=void 0;he.prototype.ancestors=void 0;he.prototype.cause=void 0;he.prototype.fatal=void 0;he.prototype.place=void 0;he.prototype.ruleId=void 0;he.prototype.source=void 0;const xn={}.hasOwnProperty,bs=new Map,ws=/[A-Z]/g,ys=new Set(["table","tbody","thead","tfoot","tr"]),ks=new Set(["td","th"]),ti="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vs(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=As(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Ts(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?hn:$a,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=ni(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function ni(e,t,n){if(t.type==="element")return Cs(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Ss(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Es(e,t,n);if(t.type==="mdxjsEsm")return js(e,t);if(t.type==="root")return Is(e,t,n);if(t.type==="text")return zs(e,t)}function Cs(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=hn,e.schema=i),e.ancestors.push(t);const s=ii(e,t.tagName,!1),a=Ns(e,t);let o=wn(e,t);return ys.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!Na(l):!0})),ri(e,a,s,t),bn(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function Ss(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ut(e,t.position)}function js(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ut(e,t.position)}function Es(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=hn,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:ii(e,t.name,!0),a=Ls(e,t),o=wn(e,t);return ri(e,a,s,t),bn(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function Is(e,t,n){const r={};return bn(r,wn(e,t)),e.create(t,e.Fragment,r,n)}function zs(e,t){return t.value}function ri(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function bn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Ts(e,t,n){return r;function r(i,s,a,o){const u=Array.isArray(a.children)?n:t;return o?u(s,a,o):u(s,a)}}function As(e,t){return n;function n(r,i,s,a){const o=Array.isArray(s.children),l=mn(r);return t(i,s,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function Ns(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&xn.call(t.properties,i)){const s=Ds(e,i,t.properties[i]);if(s){const[a,o]=s;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&ks.has(t.tagName)?r=o:n[a]=o}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Ls(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else ut(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,s=e.evaluater.evaluateExpression(o.expression)}else ut(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function wn(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:bs;for(;++r<t.children.length;){const s=t.children[r];let a;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const u=i.get(l)||0;a=l+"-"+u,i.set(l,u+1)}}const o=ni(e,s,a);o!==void 0&&n.push(o)}return n}function Ds(e,t,n){const r=_a(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ea(n):Ha(n)),r.property==="style"){let i=typeof n=="object"?n:Ms(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Rs(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Ra[r.property]||r.property:r.attribute,n]}}function Ms(e,t){try{return ms(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new he("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=ti+"#cannot-parse-style-attribute",i}}function ii(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,a;for(;++s<i.length;){const o=Rn(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(s&&o.type==="Literal"),optional:!1}:o}r=a}else r=Rn(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return xn.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ut(e)}function ut(e,t){const n=new he("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=ti+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Rs(e){const t={};let n;for(n in e)xn.call(e,n)&&(t[Ps(n)]=e[n]);return t}function Ps(e){let t=e.replace(ws,Fs);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Fs(e){return"-"+e.toLowerCase()}const _t={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"]},_s={};function yn(e,t){const n=_s,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ai(e,r,i)}function ai(e,t,n){if(Os(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Wn(e.children,t,n)}return Array.isArray(e)?Wn(e,t,n):""}function Wn(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=ai(e[i],t,n);return r.join("")}function Os(e){return!!(e&&typeof e=="object")}const Yn=document.createElement("i");function kn(e){const t="&"+e+";";Yn.innerHTML=t;const n=Yn.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ke(e,t,n,r){const i=e.length;let s=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);s<r.length;)a=r.slice(s,s+1e4),a.unshift(t,0),e.splice(...a),s+=1e4,t+=1e4}function Ce(e,t){return e.length>0?(ke(e,e.length,0,t),e):t}const Gn={}.hasOwnProperty;function si(e){const t={};let n=-1;for(;++n<e.length;)Bs(t,e[n]);return t}function Bs(e,t){let n;for(n in t){const i=(Gn.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let a;if(s)for(a in s){Gn.call(i,a)||(i[a]=[]);const o=s[a];$s(i[a],Array.isArray(o)?o:o?[o]:[])}}}function $s(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ke(e,0,0,r)}function oi(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function je(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ge=Re(/[A-Za-z]/),fe=Re(/[\dA-Za-z]/),Hs=Re(/[#-'*+\--9=?A-Z^-~]/);function vt(e){return e!==null&&(e<32||e===127)}const sn=Re(/\d/),Us=Re(/[\dA-Fa-f]/),Vs=Re(/[!-/:-@[-`{-~]/);function V(e){return e!==null&&e<-2}function ie(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}const It=Re(new RegExp("\\p{P}|\\p{S}","u")),He=Re(/\s/);function Re(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Xe(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let a="";if(s===37&&fe(e.charCodeAt(n+1))&&fe(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const o=e.charCodeAt(n+1);s<56320&&o>56319&&o<57344?(a=String.fromCharCode(s,o),i=1):a="�"}else a=String.fromCharCode(s);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Z(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(l){return Q(l)?(e.enter(n),o(l)):t(l)}function o(l){return Q(l)&&s++<i?(e.consume(l),o):(e.exit(n),t(l))}}const qs={tokenize:Ws};function Ws(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Z(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),s(o)}function s(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return V(o)?(e.consume(o),e.exit("chunkText"),s):(e.consume(o),a)}}const Ys={tokenize:Gs},Xn={tokenize:Xs};function Gs(e){const t=this,n=[];let r=0,i,s,a;return o;function o(j){if(r<n.length){const L=n[r];return t.containerState=L[1],e.attempt(L[0].continuation,l,u)(j)}return u(j)}function l(j){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&S();const L=t.events.length;let A=L,k;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){k=t.events[A][1].end;break}b(r);let N=L;for(;N<t.events.length;)t.events[N][1].end={...k},N++;return ke(t.events,A+1,0,t.events.slice(L)),t.events.length=N,u(j)}return o(j)}function u(j){if(r===n.length){if(!i)return h(j);if(i.currentConstruct&&i.currentConstruct.concrete)return m(j);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Xn,p,c)(j)}function p(j){return i&&S(),b(r),h(j)}function c(j){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,m(j)}function h(j){return t.containerState={},e.attempt(Xn,f,m)(j)}function f(j){return r++,n.push([t.currentConstruct,t.containerState]),h(j)}function m(j){if(j===null){i&&S(),b(0),e.consume(j);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),w(j)}function w(j){if(j===null){C(e.exit("chunkFlow"),!0),b(0),e.consume(j);return}return V(j)?(e.consume(j),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(j),w)}function C(j,L){const A=t.sliceStream(j);if(L&&A.push(null),j.previous=s,s&&(s.next=j),s=j,i.defineSkip(j.start),i.write(A),t.parser.lazy[j.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<a&&(!i.events[k][1].end||i.events[k][1].end.offset>a))return;const N=t.events.length;let _=N,O,v;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(O){v=t.events[_][1].end;break}O=!0}for(b(r),k=N;k<t.events.length;)t.events[k][1].end={...v},k++;ke(t.events,_+1,0,t.events.slice(N)),t.events.length=k}}function b(j){let L=n.length;for(;L-- >j;){const A=n[L];t.containerState=A[1],A[0].exit.call(t,e)}n.length=j}function S(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Xs(e,t,n){return Z(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ye(e){if(e===null||ie(e)||He(e))return 1;if(It(e))return 2}function zt(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const on={name:"attention",resolveAll:Ks,tokenize:Qs};function Ks(e,t){let n=-1,r,i,s,a,o,l,u,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},h={...e[n][1].start};Kn(c,-l),Kn(h,l),a={type:l>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Ce(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Ce(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),u=Ce(u,zt(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Ce(u,[["exit",s,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,u=Ce(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,ke(e,r-1,n-r+3,u),n=r+u.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Qs(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ye(r);let s;return a;function a(l){return s=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===s)return e.consume(l),o;const u=e.exit("attentionSequence"),p=Ye(l),c=!p||p===2&&i||n.includes(l),h=!i||i===2&&p||n.includes(r);return u._open=!!(s===42?c:c&&(i||!h)),u._close=!!(s===42?h:h&&(p||!c)),t(l)}}function Kn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Js={name:"autolink",tokenize:Zs};function Zs(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(f){return ge(f)?(e.consume(f),a):f===64?n(f):u(f)}function a(f){return f===43||f===45||f===46||fe(f)?(r=1,o(f)):u(f)}function o(f){return f===58?(e.consume(f),r=0,l):(f===43||f===45||f===46||fe(f))&&r++<32?(e.consume(f),o):(r=0,u(f))}function l(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||vt(f)?n(f):(e.consume(f),l)}function u(f){return f===64?(e.consume(f),p):Hs(f)?(e.consume(f),u):n(f)}function p(f){return fe(f)?c(f):n(f)}function c(f){return f===46?(e.consume(f),r=0,p):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):h(f)}function h(f){if((f===45||fe(f))&&r++<63){const m=f===45?h:c;return e.consume(f),m}return n(f)}}const pt={partial:!0,tokenize:eo};function eo(e,t,n){return r;function r(s){return Q(s)?Z(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||V(s)?t(s):n(s)}}const li={continuation:{tokenize:no},exit:ro,name:"blockQuote",tokenize:to};function to(e,t,n){const r=this;return i;function i(a){if(a===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),s}return n(a)}function s(a){return Q(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function no(e,t,n){const r=this;return i;function i(a){return Q(a)?Z(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return e.attempt(li,t,n)(a)}}function ro(e){e.exit("blockQuote")}const ui={name:"characterEscape",tokenize:io};function io(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return Vs(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const ci={name:"characterReference",tokenize:ao};function ao(e,t,n){const r=this;let i=0,s,a;return o;function o(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),l}function l(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,a=fe,p(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,a=Us,p):(e.enter("characterReferenceValue"),s=7,a=sn,p(c))}function p(c){if(c===59&&i){const h=e.exit("characterReferenceValue");return a===fe&&!kn(r.sliceSerialize(h))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(c)&&i++<s?(e.consume(c),p):n(c)}}const Qn={partial:!0,tokenize:oo},Jn={concrete:!0,name:"codeFenced",tokenize:so};function so(e,t,n){const r=this,i={partial:!0,tokenize:A};let s=0,a=0,o;return l;function l(k){return u(k)}function u(k){const N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,o=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(k)}function p(k){return k===o?(a++,e.consume(k),p):a<3?n(k):(e.exit("codeFencedFenceSequence"),Q(k)?Z(e,c,"whitespace")(k):c(k))}function c(k){return k===null||V(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Qn,w,L)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(k))}function h(k){return k===null||V(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(k)):Q(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Z(e,f,"whitespace")(k)):k===96&&k===o?n(k):(e.consume(k),h)}function f(k){return k===null||V(k)?c(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||V(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(k)):k===96&&k===o?n(k):(e.consume(k),m)}function w(k){return e.attempt(i,L,C)(k)}function C(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),b}function b(k){return s>0&&Q(k)?Z(e,S,"linePrefix",s+1)(k):S(k)}function S(k){return k===null||V(k)?e.check(Qn,w,L)(k):(e.enter("codeFlowValue"),j(k))}function j(k){return k===null||V(k)?(e.exit("codeFlowValue"),S(k)):(e.consume(k),j)}function L(k){return e.exit("codeFenced"),t(k)}function A(k,N,_){let O=0;return v;function v(F){return k.enter("lineEnding"),k.consume(F),k.exit("lineEnding"),D}function D(F){return k.enter("codeFencedFence"),Q(F)?Z(k,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):T(F)}function T(F){return F===o?(k.enter("codeFencedFenceSequence"),E(F)):_(F)}function E(F){return F===o?(O++,k.consume(F),E):O>=a?(k.exit("codeFencedFenceSequence"),Q(F)?Z(k,I,"whitespace")(F):I(F)):_(F)}function I(F){return F===null||V(F)?(k.exit("codeFencedFence"),N(F)):_(F)}}}function oo(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Ot={name:"codeIndented",tokenize:uo},lo={partial:!0,tokenize:co};function uo(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),Z(e,s,"linePrefix",5)(u)}function s(u){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?l(u):V(u)?e.attempt(lo,a,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||V(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function co(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):V(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):Z(e,s,"linePrefix",5)(a)}function s(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):V(a)?i(a):n(a)}}const po={name:"codeText",previous:ho,resolve:fo,tokenize:go};function fo(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function ho(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function go(e,t,n){let r=0,i,s;return a;function a(c){return e.enter("codeText"),e.enter("codeTextSequence"),o(c)}function o(c){return c===96?(e.consume(c),r++,o):(e.exit("codeTextSequence"),l(c))}function l(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),l):c===96?(s=e.enter("codeTextSequence"),i=0,p(c)):V(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||V(c)?(e.exit("codeTextData"),l(c)):(e.consume(c),u)}function p(c){return c===96?(e.consume(c),i++,p):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(s.type="codeTextData",u(c))}}class mo{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&it(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),it(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),it(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);it(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);it(this.left,n.reverse())}}}function it(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function di(e){const t={};let n=-1,r,i,s,a,o,l,u;const p=new mo(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,xo(p,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(a=p.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},o=p.slice(i,n),o.unshift(r),p.splice(i,n-i+1,o))}}return ke(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!u}function xo(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,l=[],u={};let p,c,h=-1,f=n,m=0,w=0;const C=[w];for(;f;){for(;e.get(++i)[1]!==f;);s.push(i),f._tokenizer||(p=r.sliceStream(f),f.next||p.push(null),c&&a.defineSkip(f.start),f._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),f._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),c=f,f=f.next}for(f=n;++h<o.length;)o[h][0]==="exit"&&o[h-1][0]==="enter"&&o[h][1].type===o[h-1][1].type&&o[h][1].start.line!==o[h][1].end.line&&(w=h+1,C.push(w),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(a.events=[],f?(f._tokenizer=void 0,f.previous=void 0):C.pop(),h=C.length;h--;){const b=o.slice(C[h],C[h+1]),S=s.pop();l.push([S,S+b.length-1]),e.splice(S,2,b)}for(l.reverse(),h=-1;++h<l.length;)u[m+l[h][0]]=m+l[h][1],m+=l[h][1]-l[h][0]-1;return u}const bo={resolve:yo,tokenize:ko},wo={partial:!0,tokenize:vo};function yo(e){return di(e),e}function ko(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?s(o):V(o)?e.check(wo,a,s)(o):(e.consume(o),i)}function s(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function vo(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Z(e,s,"linePrefix")}function s(a){if(a===null||V(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function pi(e,t,n,r,i,s,a,o,l){const u=l||Number.POSITIVE_INFINITY;let p=0;return c;function c(b){return b===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(b),e.exit(s),h):b===null||b===32||b===41||vt(b)?n(b):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),w(b))}function h(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===62?(e.exit("chunkString"),e.exit(o),h(b)):b===null||b===60||V(b)?n(b):(e.consume(b),b===92?m:f)}function m(b){return b===60||b===62||b===92?(e.consume(b),f):f(b)}function w(b){return!p&&(b===null||b===41||ie(b))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(b)):p<u&&b===40?(e.consume(b),p++,w):b===41?(e.consume(b),p--,w):b===null||b===32||b===40||vt(b)?n(b):(e.consume(b),b===92?C:w)}function C(b){return b===40||b===41||b===92?(e.consume(b),w):w(b)}}function fi(e,t,n,r,i,s){const a=this;let o=0,l;return u;function u(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(s),p}function p(f){return o>999||f===null||f===91||f===93&&!l||f===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):V(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===null||f===91||f===93||V(f)||o++>999?(e.exit("chunkString"),p(f)):(e.consume(f),l||(l=!Q(f)),f===92?h:c)}function h(f){return f===91||f===92||f===93?(e.consume(f),o++,c):c(f)}}function hi(e,t,n,r,i,s){let a;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),a=h===40?41:h,l):n(h)}function l(h){return h===a?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(s),u(h))}function u(h){return h===a?(e.exit(s),l(a)):h===null?n(h):V(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Z(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(h))}function p(h){return h===a||h===null||V(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?c:p)}function c(h){return h===a||h===92?(e.consume(h),p):p(h)}}function ot(e,t){let n;return r;function r(i){return V(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Q(i)?Z(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Co={name:"definition",tokenize:jo},So={partial:!0,tokenize:Eo};function jo(e,t,n){const r=this;let i;return s;function s(f){return e.enter("definition"),a(f)}function a(f){return fi.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function o(f){return i=je(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),l):n(f)}function l(f){return ie(f)?ot(e,u)(f):u(f)}function u(f){return pi(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function p(f){return e.attempt(So,c,c)(f)}function c(f){return Q(f)?Z(e,h,"whitespace")(f):h(f)}function h(f){return f===null||V(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function Eo(e,t,n){return r;function r(o){return ie(o)?ot(e,i)(o):n(o)}function i(o){return hi(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function s(o){return Q(o)?Z(e,a,"whitespace")(o):a(o)}function a(o){return o===null||V(o)?t(o):n(o)}}const Io={name:"hardBreakEscape",tokenize:zo};function zo(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return V(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const To={name:"headingAtx",resolve:Ao,tokenize:No};function Ao(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ke(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function No(e,t,n){let r=0;return i;function i(p){return e.enter("atxHeading"),s(p)}function s(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||ie(p)?(e.exit("atxHeadingSequence"),o(p)):n(p)}function o(p){return p===35?(e.enter("atxHeadingSequence"),l(p)):p===null||V(p)?(e.exit("atxHeading"),t(p)):Q(p)?Z(e,o,"whitespace")(p):(e.enter("atxHeadingText"),u(p))}function l(p){return p===35?(e.consume(p),l):(e.exit("atxHeadingSequence"),o(p))}function u(p){return p===null||p===35||ie(p)?(e.exit("atxHeadingText"),o(p)):(e.consume(p),u)}}const Lo=["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"],Zn=["pre","script","style","textarea"],Do={concrete:!0,name:"htmlFlow",resolveTo:Po,tokenize:Fo},Mo={partial:!0,tokenize:Oo},Ro={partial:!0,tokenize:_o};function Po(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Fo(e,t,n){const r=this;let i,s,a,o,l;return u;function u(g){return p(g)}function p(g){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(g),c}function c(g){return g===33?(e.consume(g),h):g===47?(e.consume(g),s=!0,w):g===63?(e.consume(g),i=3,r.interrupt?t:x):ge(g)?(e.consume(g),a=String.fromCharCode(g),C):n(g)}function h(g){return g===45?(e.consume(g),i=2,f):g===91?(e.consume(g),i=5,o=0,m):ge(g)?(e.consume(g),i=4,r.interrupt?t:x):n(g)}function f(g){return g===45?(e.consume(g),r.interrupt?t:x):n(g)}function m(g){const Y="CDATA[";return g===Y.charCodeAt(o++)?(e.consume(g),o===Y.length?r.interrupt?t:T:m):n(g)}function w(g){return ge(g)?(e.consume(g),a=String.fromCharCode(g),C):n(g)}function C(g){if(g===null||g===47||g===62||ie(g)){const Y=g===47,te=a.toLowerCase();return!Y&&!s&&Zn.includes(te)?(i=1,r.interrupt?t(g):T(g)):Lo.includes(a.toLowerCase())?(i=6,Y?(e.consume(g),b):r.interrupt?t(g):T(g)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(g):s?S(g):j(g))}return g===45||fe(g)?(e.consume(g),a+=String.fromCharCode(g),C):n(g)}function b(g){return g===62?(e.consume(g),r.interrupt?t:T):n(g)}function S(g){return Q(g)?(e.consume(g),S):v(g)}function j(g){return g===47?(e.consume(g),v):g===58||g===95||ge(g)?(e.consume(g),L):Q(g)?(e.consume(g),j):v(g)}function L(g){return g===45||g===46||g===58||g===95||fe(g)?(e.consume(g),L):A(g)}function A(g){return g===61?(e.consume(g),k):Q(g)?(e.consume(g),A):j(g)}function k(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),l=g,N):Q(g)?(e.consume(g),k):_(g)}function N(g){return g===l?(e.consume(g),l=null,O):g===null||V(g)?n(g):(e.consume(g),N)}function _(g){return g===null||g===34||g===39||g===47||g===60||g===61||g===62||g===96||ie(g)?A(g):(e.consume(g),_)}function O(g){return g===47||g===62||Q(g)?j(g):n(g)}function v(g){return g===62?(e.consume(g),D):n(g)}function D(g){return g===null||V(g)?T(g):Q(g)?(e.consume(g),D):n(g)}function T(g){return g===45&&i===2?(e.consume(g),q):g===60&&i===1?(e.consume(g),U):g===62&&i===4?(e.consume(g),H):g===63&&i===3?(e.consume(g),x):g===93&&i===5?(e.consume(g),B):V(g)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Mo,$,E)(g)):g===null||V(g)?(e.exit("htmlFlowData"),E(g)):(e.consume(g),T)}function E(g){return e.check(Ro,I,$)(g)}function I(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),F}function F(g){return g===null||V(g)?E(g):(e.enter("htmlFlowData"),T(g))}function q(g){return g===45?(e.consume(g),x):T(g)}function U(g){return g===47?(e.consume(g),a="",P):T(g)}function P(g){if(g===62){const Y=a.toLowerCase();return Zn.includes(Y)?(e.consume(g),H):T(g)}return ge(g)&&a.length<8?(e.consume(g),a+=String.fromCharCode(g),P):T(g)}function B(g){return g===93?(e.consume(g),x):T(g)}function x(g){return g===62?(e.consume(g),H):g===45&&i===2?(e.consume(g),x):T(g)}function H(g){return g===null||V(g)?(e.exit("htmlFlowData"),$(g)):(e.consume(g),H)}function $(g){return e.exit("htmlFlow"),t(g)}}function _o(e,t,n){const r=this;return i;function i(a){return V(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Oo(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(pt,t,n)}}const Bo={name:"htmlText",tokenize:$o};function $o(e,t,n){const r=this;let i,s,a;return o;function o(x){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(x),l}function l(x){return x===33?(e.consume(x),u):x===47?(e.consume(x),A):x===63?(e.consume(x),j):ge(x)?(e.consume(x),_):n(x)}function u(x){return x===45?(e.consume(x),p):x===91?(e.consume(x),s=0,m):ge(x)?(e.consume(x),S):n(x)}function p(x){return x===45?(e.consume(x),f):n(x)}function c(x){return x===null?n(x):x===45?(e.consume(x),h):V(x)?(a=c,U(x)):(e.consume(x),c)}function h(x){return x===45?(e.consume(x),f):c(x)}function f(x){return x===62?q(x):x===45?h(x):c(x)}function m(x){const H="CDATA[";return x===H.charCodeAt(s++)?(e.consume(x),s===H.length?w:m):n(x)}function w(x){return x===null?n(x):x===93?(e.consume(x),C):V(x)?(a=w,U(x)):(e.consume(x),w)}function C(x){return x===93?(e.consume(x),b):w(x)}function b(x){return x===62?q(x):x===93?(e.consume(x),b):w(x)}function S(x){return x===null||x===62?q(x):V(x)?(a=S,U(x)):(e.consume(x),S)}function j(x){return x===null?n(x):x===63?(e.consume(x),L):V(x)?(a=j,U(x)):(e.consume(x),j)}function L(x){return x===62?q(x):j(x)}function A(x){return ge(x)?(e.consume(x),k):n(x)}function k(x){return x===45||fe(x)?(e.consume(x),k):N(x)}function N(x){return V(x)?(a=N,U(x)):Q(x)?(e.consume(x),N):q(x)}function _(x){return x===45||fe(x)?(e.consume(x),_):x===47||x===62||ie(x)?O(x):n(x)}function O(x){return x===47?(e.consume(x),q):x===58||x===95||ge(x)?(e.consume(x),v):V(x)?(a=O,U(x)):Q(x)?(e.consume(x),O):q(x)}function v(x){return x===45||x===46||x===58||x===95||fe(x)?(e.consume(x),v):D(x)}function D(x){return x===61?(e.consume(x),T):V(x)?(a=D,U(x)):Q(x)?(e.consume(x),D):O(x)}function T(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),i=x,E):V(x)?(a=T,U(x)):Q(x)?(e.consume(x),T):(e.consume(x),I)}function E(x){return x===i?(e.consume(x),i=void 0,F):x===null?n(x):V(x)?(a=E,U(x)):(e.consume(x),E)}function I(x){return x===null||x===34||x===39||x===60||x===61||x===96?n(x):x===47||x===62||ie(x)?O(x):(e.consume(x),I)}function F(x){return x===47||x===62||ie(x)?O(x):n(x)}function q(x){return x===62?(e.consume(x),e.exit("htmlTextData"),e.exit("htmlText"),t):n(x)}function U(x){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),P}function P(x){return Q(x)?Z(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):B(x)}function B(x){return e.enter("htmlTextData"),a(x)}}const vn={name:"labelEnd",resolveAll:qo,resolveTo:Wo,tokenize:Yo},Ho={tokenize:Go},Uo={tokenize:Xo},Vo={tokenize:Ko};function qo(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&ke(e,0,e.length,n),e}function Wo(e,t){let n=e.length,r=0,i,s,a,o;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[a][1].end}},p={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[a-2][1].start}};return o=[["enter",l,t],["enter",u,t]],o=Ce(o,e.slice(s+1,s+r+3)),o=Ce(o,[["enter",p,t]]),o=Ce(o,zt(t.parser.constructs.insideSpan.null,e.slice(s+r+4,a-3),t)),o=Ce(o,[["exit",p,t],e[a-2],e[a-1],["exit",u,t]]),o=Ce(o,e.slice(a+1)),o=Ce(o,[["exit",l,t]]),ke(e,s,e.length,o),e}function Yo(e,t,n){const r=this;let i=r.events.length,s,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return o;function o(h){return s?s._inactive?c(h):(a=r.parser.defined.includes(je(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(Ho,p,a?p:c)(h):h===91?e.attempt(Uo,p,a?u:c)(h):a?p(h):c(h)}function u(h){return e.attempt(Vo,p,c)(h)}function p(h){return t(h)}function c(h){return s._balanced=!0,n(h)}}function Go(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return ie(c)?ot(e,s)(c):s(c)}function s(c){return c===41?p(c):pi(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function a(c){return ie(c)?ot(e,l)(c):p(c)}function o(c){return n(c)}function l(c){return c===34||c===39||c===40?hi(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):p(c)}function u(c){return ie(c)?ot(e,p)(c):p(c)}function p(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function Xo(e,t,n){const r=this;return i;function i(o){return fi.call(r,e,s,a,"reference","referenceMarker","referenceString")(o)}function s(o){return r.parser.defined.includes(je(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function Ko(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const Qo={name:"labelStartImage",resolveAll:vn.resolveAll,tokenize:Jo};function Jo(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),s}function s(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),a):n(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Zo={name:"labelStartLink",resolveAll:vn.resolveAll,tokenize:el};function el(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Bt={name:"lineEnding",tokenize:tl};function tl(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Z(e,t,"linePrefix")}}const wt={name:"thematicBreak",tokenize:nl};function nl(e,t,n){let r=0,i;return s;function s(u){return e.enter("thematicBreak"),a(u)}function a(u){return i=u,o(u)}function o(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||V(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Q(u)?Z(e,o,"whitespace")(u):o(u))}}const me={continuation:{tokenize:sl},exit:ll,name:"list",tokenize:al},rl={partial:!0,tokenize:ul},il={partial:!0,tokenize:ol};function al(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return o;function o(f){const m=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:sn(f)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(wt,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(f)}return n(f)}function l(f){return sn(f)&&++a<10?(e.consume(f),l):(!r.interrupt||a<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(pt,r.interrupt?n:p,e.attempt(rl,h,c))}function p(f){return r.containerState.initialBlankLine=!0,s++,h(f)}function c(f){return Q(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function sl(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(pt,i,s);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Z(e,t,"listItemIndent",r.containerState.size+1)(o)}function s(o){return r.containerState.furtherBlankLines||!Q(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(il,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Z(e,e.attempt(me,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function ol(e,t,n){const r=this;return Z(e,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(s):n(s)}}function ll(e){e.exit(this.containerState.type)}function ul(e,t,n){const r=this;return Z(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!Q(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const er={name:"setextUnderline",resolveTo:cl,tokenize:dl};function cl(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",a,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function dl(e,t,n){const r=this;let i;return s;function s(u){let p=r.events.length,c;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){c=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===i?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Q(u)?Z(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||V(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const pl={tokenize:fl};function fl(e){const t=this,n=e.attempt(pt,r,e.attempt(this.parser.constructs.flowInitial,i,Z(e,e.attempt(this.parser.constructs.flow,i,e.attempt(bo,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const hl={resolveAll:mi()},gl=gi("string"),ml=gi("text");function gi(e){return{resolveAll:mi(e==="text"?xl:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,a,o);return a;function a(p){return u(p)?s(p):o(p)}function o(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),l}function l(p){return u(p)?(n.exit("data"),s(p)):(n.consume(p),l)}function u(p){if(p===null)return!0;const c=i[p];let h=-1;if(c)for(;++h<c.length;){const f=c[h];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function mi(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function xl(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,a=-1,o=0,l;for(;s--;){const u=i[s];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(u===-2)l=!0,o++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const u={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const bl={42:me,43:me,45:me,48:me,49:me,50:me,51:me,52:me,53:me,54:me,55:me,56:me,57:me,62:li},wl={91:Co},yl={[-2]:Ot,[-1]:Ot,32:Ot},kl={35:To,42:wt,45:[er,wt],60:Do,61:er,95:wt,96:Jn,126:Jn},vl={38:ci,92:ui},Cl={[-5]:Bt,[-4]:Bt,[-3]:Bt,33:Qo,38:ci,42:on,60:[Js,Bo],91:Zo,92:[Io,ui],93:vn,95:on,96:po},Sl={null:[on,hl]},jl={null:[42,95]},El={null:[]},Il=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:jl,contentInitial:wl,disable:El,document:bl,flow:kl,flowInitial:yl,insideSpan:Sl,string:vl,text:Cl},Symbol.toStringTag,{value:"Module"}));function zl(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let a=[],o=[];const l={attempt:N(A),check:N(k),consume:S,enter:j,exit:L,interrupt:N(k,{interrupt:!0})},u={code:null,containerState:{},defineSkip:w,events:[],now:m,parser:e,previous:null,sliceSerialize:h,sliceStream:f,write:c};let p=t.tokenize.call(u,l);return t.resolveAll&&s.push(t),u;function c(D){return a=Ce(a,D),C(),a[a.length-1]!==null?[]:(_(t,0),u.events=zt(s,u.events,u),u.events)}function h(D,T){return Al(f(D),T)}function f(D){return Tl(a,D)}function m(){const{_bufferIndex:D,_index:T,line:E,column:I,offset:F}=r;return{_bufferIndex:D,_index:T,line:E,column:I,offset:F}}function w(D){i[D.line]=D.column,v()}function C(){let D;for(;r._index<a.length;){const T=a[r._index];if(typeof T=="string")for(D=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===D&&r._bufferIndex<T.length;)b(T.charCodeAt(r._bufferIndex));else b(T)}}function b(D){p=p(D)}function S(D){V(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,v()):D!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=D}function j(D,T){const E=T||{};return E.type=D,E.start=m(),u.events.push(["enter",E,u]),o.push(E),E}function L(D){const T=o.pop();return T.end=m(),u.events.push(["exit",T,u]),T}function A(D,T){_(D,T.from)}function k(D,T){T.restore()}function N(D,T){return E;function E(I,F,q){let U,P,B,x;return Array.isArray(I)?$(I):"tokenize"in I?$([I]):H(I);function H(ee){return ue;function ue(ae){const W=ae!==null&&ee[ae],se=ae!==null&&ee.null,le=[...Array.isArray(W)?W:W?[W]:[],...Array.isArray(se)?se:se?[se]:[]];return $(le)(ae)}}function $(ee){return U=ee,P=0,ee.length===0?q:g(ee[P])}function g(ee){return ue;function ue(ae){return x=O(),B=ee,ee.partial||(u.currentConstruct=ee),ee.name&&u.parser.constructs.disable.null.includes(ee.name)?te():ee.tokenize.call(T?Object.assign(Object.create(u),T):u,l,Y,te)(ae)}}function Y(ee){return D(B,x),F}function te(ee){return x.restore(),++P<U.length?g(U[P]):q}}}function _(D,T){D.resolveAll&&!s.includes(D)&&s.push(D),D.resolve&&ke(u.events,T,u.events.length-T,D.resolve(u.events.slice(T),u)),D.resolveTo&&(u.events=D.resolveTo(u.events,u))}function O(){const D=m(),T=u.previous,E=u.currentConstruct,I=u.events.length,F=Array.from(o);return{from:I,restore:q};function q(){r=D,u.previous=T,u.currentConstruct=E,u.events.length=I,o=F,v()}}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Tl(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,s)];else{if(a=e.slice(n,i),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}s>0&&a.push(e[i].slice(0,s))}return a}function Al(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),ka=require("react-dom/client"),d=require("react/jsx-runtime"),Pe=require("./nosUploader-DLX7JsnR.cjs");function Fr(e){const{sdk:t,sessionId:n,onSessionCreated:r,onRoundStart:i,onStreamStart:s,onStreamEnd:a,onError:o,onMessageSend:l}=e,[u,p]=y.useState([]),[c,h]=y.useState("ready"),[f,m]=y.useState(null),w=y.useRef(new Map),S=y.useRef(new Map),b=y.useRef(n),j=y.useRef(!0),E=y.useRef(u);b.current=n,j.current=u.length===0,E.current=u;const R=y.useCallback((k,I)=>{if(k===b.current)p(T=>{const $=S.current.get(k)??T,Y=I($);return S.current.set(k,Y),Y});else{const T=S.current.get(k)??[];S.current.set(k,I(T))}},[]),N=y.useCallback((k,I)=>{const T=w.current.get(k);T!=null&&T.stopTimer&&(clearTimeout(T.stopTimer),T.stopTimer=null),w.current.delete(k),S.current.delete(k),k===b.current&&h(I)},[]);y.useEffect(()=>{const k=n?w.current.get(n):void 0;h(k!=null&&k.busy?"streaming":"ready")},[n]);const v=y.useRef(()=>{}),A=y.useCallback((k,I)=>{var X;const T=b.current;if(T&&((X=w.current.get(T))!=null&&X.busy))return;if(T){const g=va(E.current);if(g){l==null||l(k),v.current(g,{action:"submit",value:k});return}}l==null||l(k);const $={id:`user_${Date.now()}`,role:"user",parts:[...(I??[]).map(g=>({type:"attachment",attachment:g})),{type:"text",content:k}],timestamp:Date.now()},Y=`assistant_${Date.now()}`,M={id:Y,role:"assistant",parts:[],timestamp:Date.now()},U=j.current,x=E.current;p(g=>[...g,$,M]),T&&S.current.set(T,[...x,$,M]),h("submitted"),m(null);const q=g=>{let ae="",_="",V=[],se=!1;const ie=Rn();S.current.has(g)||S.current.set(g,[...x,$,M]);const ue={abortController:null,busy:!0,stopTimer:null};w.current.set(g,ue);const oe=()=>{const W=[...V];if(ae){const ce=W.findIndex(de=>de.type==="thinking");ce>=0?W[ce]={type:"thinking",content:ae,durationMs:ie.ms}:W.unshift({type:"thinking",content:ae,durationMs:ie.ms})}if(_){const ce=W[W.length-1];(ce==null?void 0:ce.type)==="text"?W[W.length-1]={type:"text",content:_}:W.push({type:"text",content:_})}R(g,ce=>ce.map(de=>de.id===Y?{...de,parts:W}:de))};ue.abortController=t.chat({sessionId:g,message:k,attachments:I&&I.length>0?I:void 0,stream:!0,onMessage:W=>{switch(ie.onEvent(W.type),se||(se=!0,g===b.current&&h("streaming")),W.type){case"session.start":W.roundId&&(i==null||i(W.roundId));break;case"thinking":ae+=W.content;break;case"ai":_+=W.content;break;case"tool_call":_&&(V.push({type:"text",content:_}),_=""),V.push({type:"tool_call",toolName:W.toolName,toolCallId:W.toolCallId,args:W.args??"{}"});break;case"tool_result":_&&(V.push({type:"text",content:_}),_=""),V.push({type:"tool_result",toolName:W.toolName??"",toolCallId:W.toolCallId,content:W.content,artifacts:W.artifacts,renderMode:W.renderMode,html:W.html,markdown:W.markdown});break;case"interrupt":_&&(V.push({type:"text",content:_}),_=""),W.interrupt&&V.push({type:"interrupt",interrupt:W.interrupt,resolved:!1}),oe(),N(g,"ready");return;case"stop":W.content&&(_=W.content),oe();return}oe()},onDone:W=>{if((_||V.length>0||ae)&&oe(),W.artifacts&&W.artifacts.length>0){const de=W.artifacts;R(g,ye=>ye.map(Le=>Le.id===Y?{...Le,artifacts:de}:Le))}const ce=()=>{N(g,"ready"),a==null||a(W.sessionId||g)};if(U){const de=k.slice(0,30),ye=W.sessionId||g;t.renameConversation(ye,de).catch(()=>{}).finally(ce)}else ce()},onError:W=>{V.push({type:"error",content:W.message}),oe(),g===b.current&&(m(W),h("error")),o==null||o(W),N(g,"error")}}),s==null||s(g)};T?q(T):t.createSession().then(g=>{b.current==null&&(b.current=g,r==null||r(g)),q(g)}).catch(g=>{b.current==null&&(m(g instanceof Error?g:new Error(String(g))),h("error")),o==null||o(g instanceof Error?g:new Error(String(g)))})},[t,r,s,a,o,l,R,N]),P=y.useCallback(()=>{const k=b.current;if(!k)return;const I=w.current.get(k);I!=null&&I.busy&&(I.stopTimer&&clearTimeout(I.stopTimer),I.stopTimer=setTimeout(()=>{var T;I.stopTimer=null,(T=I.abortController)==null||T.abort(),N(k,"ready")},8e3),t.stopGeneration(k).catch(()=>{}))},[t,N]),B=y.useCallback(()=>{var Y;const k=b.current;if(k&&((Y=w.current.get(k))!=null&&Y.busy))return;const I=u.findLastIndex(M=>M.role==="user");if(I<0)return;const T=u[I].parts.filter(M=>M.type==="text").map(M=>M.content).join(""),$=u[I].parts.filter(M=>M.type==="attachment").map(M=>M.attachment);p(M=>M.slice(0,I)),A(T,$.length>0?$:void 0)},[u,A]),C=y.useCallback((k,I)=>{var ae;const T=b.current;if(!T||(ae=w.current.get(T))!=null&&ae.busy)return;R(T,_=>_.map(V=>({...V,parts:V.parts.map(se=>se.type==="interrupt"&&se.interrupt.interruptId===k?{...se,resolved:!0,response:I}:se)})));const $={abortController:null,busy:!0,stopTimer:null};w.current.set(T,$);const Y=new AbortController;$.abortController=Y;let M=0;R(T,_=>_.length>0&&_[_.length-1].role==="assistant"?(M=_[_.length-1].parts.length,_):(M=0,[..._,{id:`assistant_${Date.now()}`,role:"assistant",parts:[],timestamp:Date.now()}])),h("streaming");let U="",x="",q=[];const X=Rn(),g=()=>{const _=[...q];if(U){const V=_.findIndex(se=>se.type==="thinking");V>=0?_[V]={type:"thinking",content:U,durationMs:X.ms}:_.unshift({type:"thinking",content:U,durationMs:X.ms})}if(x){const V=_[_.length-1];(V==null?void 0:V.type)==="text"?_[_.length-1]={type:"text",content:x}:_.push({type:"text",content:x})}R(T,V=>{const se=V.findLastIndex(ie=>ie.role==="assistant");return se<0?V:V.map((ie,ue)=>ue===se?{...ie,parts:[...ie.parts.slice(0,M),..._]}:ie)})};t.respondInterrupt(k,T,I,_=>{X.onEvent(_.type);let V=!1;switch(_.type){case"thinking":U+=_.content;break;case"ai":x+=_.content;break;case"tool_call":x&&(q.push({type:"text",content:x}),x=""),q.push({type:"tool_call",toolName:_.toolName,toolCallId:_.toolCallId,args:_.args??"{}"});break;case"tool_result":x&&(q.push({type:"text",content:x}),x=""),q.push({type:"tool_result",toolName:_.toolName??"",toolCallId:_.toolCallId,content:_.content,artifacts:_.artifacts,renderMode:_.renderMode,html:_.html,markdown:_.markdown});break;case"interrupt":x&&(q.push({type:"text",content:x}),x=""),_.interrupt&&q.push({type:"interrupt",interrupt:_.interrupt,resolved:!1}),V=!0;break;case"stop":_.content&&(x=_.content),a==null||a(T),V=!0;break;case"done":if(_.artifacts&&_.artifacts.length>0){const se=_.artifacts;R(T,ie=>{const ue=ie.findLastIndex(oe=>oe.role==="assistant");return ue<0?ie:ie.map((oe,W)=>W===ue?{...oe,artifacts:se}:oe)})}a==null||a(T),V=!0;break}g(),V&&N(T,"ready")},_=>{q.push({type:"error",content:_.message}),g(),T===b.current&&(m(_),h("error")),o==null||o(_),N(T,"error")},Y.signal).catch(_=>{if((_==null?void 0:_.name)==="AbortError"){N(T,"ready");return}T===b.current&&(m(_ instanceof Error?_:new Error(String(_))),h("error")),o==null||o(_ instanceof Error?_:new Error(String(_))),N(T,"error")})},[t,o,a,R,N]);v.current=C;const D=y.useCallback((k,I)=>{b.current=k;const T=I??S.current.get(k)??[];S.current.set(k,T),p(T)},[]),O=y.useCallback(k=>w.current.has(k)?S.current.get(k)??null:null,[]);return y.useEffect(()=>{var I;if(!n||c!=="ready"||(I=w.current.get(n))!=null&&I.busy)return;const k=Pe.popPendingChat();k&&k.sessionId===n&&A(k.message)},[n,c]),{messages:u,status:c,error:f,sendMessage:A,stop:P,regenerate:B,setMessages:p,showSession:D,getLiveMessages:O,respondToInterrupt:C}}function va(e){for(let t=e.length-1;t>=0;t--)for(let n=e[t].parts.length-1;n>=0;n--){const r=e[t].parts[n];if(r.type==="interrupt"&&!r.resolved&&r.interrupt.interruptId)return r.interrupt.interruptId}return null}function Rn(){let e=0,t=0;return{onEvent(n){n==="thinking"?t||(t=Date.now()):t&&(e+=Date.now()-t,t=0)},get ms(){return t?e+(Date.now()-t):e}}}const _r="sa_active_conversation",Ft=20;function Pn(e){try{return localStorage.getItem(`${_r}_${e}`)}catch{return null}}function Ca(e,t){try{const n=`${_r}_${e}`;t?localStorage.setItem(n,t):localStorage.removeItem(n)}catch{}}function Or(e){const{sdk:t,onConversationChange:n}=e,r=t.botCode,[i,s]=y.useState([]),[a,o]=y.useState(()=>Pn(r)),[l,u]=y.useState(!1),[p,c]=y.useState(!0),h=y.useRef(!0),f=y.useRef(1),m=y.useRef(!1);y.useEffect(()=>()=>{h.current=!1},[]);const w=y.useCallback(A=>{o(A),Ca(r,A),A&&(n==null||n(A))},[r,n]),S=y.useCallback(async()=>{if(!m.current){m.current=!0,u(!0);try{f.current=1;const A=await t.listConversations({page:1,size:Ft});if(!h.current)return;s(A.items),c(A.items.length<A.total);const P=Pn(r);P&&!A.items.find(B=>B.sessionId===P)&&w(null)}catch{}finally{m.current=!1,h.current&&u(!1)}}},[t,w]),b=y.useCallback(async()=>{if(!(m.current||!p)){m.current=!0,u(!0);try{const A=f.current+1,P=await t.listConversations({page:A,size:Ft});if(!h.current)return;f.current=A,s(C=>{const D=new Set(C.map(k=>k.sessionId)),O=P.items.filter(k=>!D.has(k.sessionId));return[...C,...O]});const B=f.current*Ft;c(B<P.total)}catch{}finally{m.current=!1,h.current&&u(!1)}}},[t,p]),j=y.useCallback(async(A,P)=>(w(A),(P==null?void 0:P.fetchHistory)===!1?[]:await t.getMessages(A)),[t,w]),E=y.useCallback(async()=>{try{const A=await t.createSession(),P=new Date().toISOString();s(B=>[{sessionId:A,title:"新对话",createTime:P,updateTime:P},...B]),w(A)}catch{w(null)}},[t,w]),R=y.useCallback(async A=>{s(P=>P.filter(B=>B.sessionId!==A)),a===A&&w(null);try{await t.deleteConversation(A)}catch{}},[t,a,w]),N=y.useCallback(async(A,P)=>{await t.renameConversation(A,P),s(B=>B.map(C=>C.sessionId===A?{...C,title:P}:C))},[t]),{enabled:v=!0}=e;return y.useEffect(()=>{v&&S()},[v,S]),{conversations:i,activeConversationId:a,loading:l,hasMore:p,loadConversations:S,loadMore:b,switchConversation:j,newConversation:E,deleteConversation:R,renameConversation:N,setActiveConversationId:w}}function Br(e){return!e&&e!==0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function $r(e){return e==="pdf"?"PDF":e==="docx"?"DOC":e==="html"?"HTM":e==="md"?"MD":e.slice(0,3).toUpperCase()||"FILE"}function Sa(e,t){var i;const n=(e||"").toLowerCase();if(n.includes("html"))return"html";if(n.includes("markdown"))return"md";if(n.includes("pdf"))return"pdf";if(n.includes("wordprocessingml")||n==="application/msword")return"docx";const r=((i=(t||"").split(".").pop())==null?void 0:i.toLowerCase())??"";return r==="htm"||r==="html"?"html":r==="md"||r==="markdown"?"md":r==="pdf"?"pdf":r==="doc"||r==="docx"?"docx":r}function Hr(e){if(!e)return[];const t=[];for(const n of e)if(n.type==="file"&&n.data){const r=n.data.name??n.data.filename??"",i=n.data.mime??n.data.mime_type??n.data.mimeType;t.push({id:n.data.id??"",type:n.data.fileType??n.data.type??Sa(i,r),filename:r,url:n.data.url??"",mime:i,size:n.data.size,summary:n.data.summary})}return t}async function jt(e){try{const t=await fetch(e.url);if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=await t.blob(),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=e.filename,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),4e3)}catch{const t=document.createElement("a");t.href=e.url,t.download=e.filename,t.target="_blank",document.body.appendChild(t),t.click(),t.remove()}}const Ur=y.createContext(null);function Te(){const e=y.useContext(Ur);if(!e)throw new Error("useChatContext must be used within ChatProvider");return e}function Zt({sdk:e,hooks:t,attachmentUploader:n,nosUpload:r,children:i}){const[s,a]=y.useState(!1),[o,l]=y.useState(!1),[u,p]=y.useState(null),[c,h]=y.useState(null),[f,m]=y.useState(!1),[w,S]=y.useState(!1);y.useEffect(()=>{e.getToken().then(()=>{m(!0)}).catch(()=>{m(!0)})},[e]);const b=Or({sdk:e,onConversationChange:t==null?void 0:t.onConversationChange,enabled:f}),j=Fr({sdk:e,sessionId:b.activeConversationId,onSessionCreated:M=>{b.setActiveConversationId(M)},onStreamStart:t==null?void 0:t.onStreamStart,onStreamEnd:M=>{var U;(U=t==null?void 0:t.onStreamEnd)==null||U.call(t,M),b.loadConversations()},onError:t==null?void 0:t.onError,onMessageSend:t==null?void 0:t.onMessageSend}),E=y.useCallback(M=>{if(M.type==="link"){window.open(M.url,M.target??"_blank","noopener");return}h(M)},[]),R=y.useCallback(()=>h(null),[]),N=y.useRef(0),v=y.useCallback(async M=>{h(null);const U=++N.current;if(j.getLiveMessages(M)){await b.switchConversation(M,{fetchHistory:!1}),j.showSession(M),S(!1);return}S(!0);try{const x=await b.switchConversation(M);if(N.current!==U)return;j.showSession(M,x)}finally{N.current===U&&S(!1)}},[b,j]),A=y.useCallback(async()=>{h(null),j.setMessages([]),await b.newConversation()},[b,j]),P=y.useCallback(async M=>{b.activeConversationId===M&&j.setMessages([]),await b.deleteConversation(M)},[b,j]);y.useEffect(()=>{b.activeConversationId&&j.messages.length===0&&(S(!0),e.getMessages(b.activeConversationId).then(M=>{j.setMessages(M)}).catch(()=>{}).finally(()=>S(!1)))},[]);const B=y.useCallback(()=>{a(M=>!M)},[]),C=y.useCallback(M=>{a(M)},[]),D=y.useCallback(()=>{l(M=>!M),p(M=>null)},[]),O=y.useCallback(M=>{p(M),l(!0)},[]),k=y.useMemo(()=>{const M=new Set,U=[];for(const x of j.messages)if(x.role==="assistant"&&x.artifacts)for(const q of Hr(x.artifacts)){const X=q.id||`${q.url}:${q.filename}`;M.has(X)||(M.add(X),U.push(q))}return U},[j.messages]),I=y.useCallback(async()=>{const M=b.activeConversationId;if(!M)return null;try{const U=await e.getMessages(M);j.setMessages(U);const x=U.findLast(q=>q.role==="assistant");return(x==null?void 0:x.id)??null}catch{return null}},[e,b.activeConversationId,j]),T=y.useCallback((M,U,x)=>{if(/^\d+$/.test(M)){e.feedback(M,U,x).catch(()=>{});return}I().then(q=>{q&&e.feedback(q,U,x).catch(()=>{})})},[e,I]),$=y.useCallback(M=>{if(/^\d+$/.test(M)){e.cancelFeedback(M).catch(()=>{});return}I().then(U=>{U&&e.cancelFeedback(U).catch(()=>{})})},[e,I]),Y=y.useMemo(()=>({sdk:e,status:j.status,error:j.error,messages:j.messages,conversations:b.conversations,activeConversationId:b.activeConversationId,isThreadListOpen:s,isArtifactDrawerOpen:o,allArtifacts:k,activePreviewArtifact:u,activePanel:c,hasMore:b.hasMore,conversationsLoading:b.loading,messagesLoading:w,sendMessage:j.sendMessage,attachmentUploader:n??null,nosUpload:r??null,stop:j.stop,regenerate:j.regenerate,switchConversation:v,newConversation:A,deleteConversation:P,renameConversation:b.renameConversation,loadMoreConversations:b.loadMore,toggleThreadList:B,setThreadListOpen:C,toggleArtifactDrawer:D,openArtifactPreview:O,openPanel:E,closePanel:R,feedback:T,cancelFeedback:$,respondToInterrupt:j.respondToInterrupt}),[e,j.status,j.error,j.messages,j.sendMessage,j.stop,j.regenerate,j.respondToInterrupt,n,r,b.conversations,b.activeConversationId,b.renameConversation,b.hasMore,b.loadMore,b.loading,s,o,k,u,c,w,v,A,P,B,C,D,O,E,R,T,$]);return d.jsx(Ur.Provider,{value:Y,children:i})}const pe="https://ehr-web.netease.com/ehr-web/erh-super-agent",he={recently:`${pe}/recently.svg`,home:`${pe}/home.svg`,mergeWindow:`${pe}/merge_window.svg`,spiltWindow:`${pe}/spilt_window.svg`,close:`${pe}/close.svg`,message:`${pe}/message.svg`,messageCreate:`${pe}/message_create.svg`,customerService:`${pe}/customer_service.svg`,sendSolid:`${pe}/send_solid.svg`,capabilityIcons:[`${pe}/icon1.png`,`${pe}/icon2.png`,`${pe}/icon3.png`],triggerLogo:`${pe}/HRlogo.png`,logo:`${pe}/HRlogo2.png`,assistantAvatarGenerating:`${pe}/profile0.gif`,assistantAvatar:`${pe}/profile1.png`},fe={TRIGGER_SIZE:56,TRIGGER_RIGHT:20,TRIGGER_BOTTOM:80,DEFAULT_WIDTH:400,DEFAULT_HEIGHT:648,MIN_WIDTH:360,MAX_WIDTH:800,MAX_HEIGHT_RATIO:.95};function ja({defaultWidth:e=fe.DEFAULT_WIDTH,defaultHeight:t=fe.DEFAULT_HEIGHT,sidebarWidth:n=0}={}){const[r,i]=y.useState(e),[s,a]=y.useState({x:0,y:0}),[o,l]=y.useState(!1),[u,p]=y.useState(!1),[c,h]=y.useState(null),[f,m]=y.useState(()=>typeof window>"u"?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight}),w=y.useRef(!1),S=y.useRef(0),b=y.useRef(r),j=y.useRef(!1),E=y.useRef({x:0,y:0}),R=y.useRef({x:0,y:0}),N=y.useRef(!1),v=y.useRef(null);y.useEffect(()=>{const I=()=>m({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[]),y.useEffect(()=>()=>{var I;(I=v.current)==null||I.call(v)},[]);const A=Math.floor(f.height*fe.MAX_HEIGHT_RATIO),P=Math.min(c||t,A),B=r+n;y.useEffect(()=>{if(!o){const I=f.width-B-20,T=f.height-P-20;a($=>$.x===I&&$.y===T?$:{x:I,y:T})}},[o,B,P,f]);const C=y.useCallback(I=>{if(u||I.target.closest("button, input, textarea"))return;j.current=!0,N.current=!1,E.current={x:I.clientX,y:I.clientY},R.current={...s};const T=M=>{if(!j.current)return;const U=M.clientX-E.current.x,x=M.clientY-E.current.y;(Math.abs(U)>3||Math.abs(x)>3)&&(N.current=!0),N.current&&(l(!0),a({x:Math.max(-200,Math.min(R.current.x+U,window.innerWidth-100)),y:Math.max(0,Math.min(R.current.y+x,window.innerHeight-48))}))},$=()=>{j.current=!1,Y()},Y=()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",$),v.current=null};document.addEventListener("mousemove",T),document.addEventListener("mouseup",$),v.current=Y},[u,s]),D=y.useCallback(I=>{I.preventDefault(),I.stopPropagation(),w.current=!0,S.current=I.clientX,b.current=r;const T=s.x+r,$=s.y,Y=x=>{if(!w.current)return;const q=x.clientX-S.current;let X=b.current-q;if(X>fe.MAX_WIDTH){w.current=!1,p(!0),U();return}X=Math.max(fe.MIN_WIDTH,X),i(X),a({x:T-X,y:$})},M=()=>{w.current=!1,U()},U=()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",M),v.current=null};document.addEventListener("mousemove",Y),document.addEventListener("mouseup",M),v.current=U},[r,s]),O=y.useCallback(()=>{u&&i(e),p(I=>!I)},[u,e]),k=y.useCallback(()=>{p(!1),i(e),l(!1),h(null)},[e]);return{width:r,position:s,hasCustomPosition:o,isMaximized:u,lockedHeight:c,viewport:f,defaultHeight:t,totalWidth:B,windowHeight:P,startWindowDrag:C,startResize:D,toggleMaximize:O,setIsMaximized:p,setLockedHeight:h,setHasCustomPosition:l,reset:k}}function Ea(e){const{enabled:t,contentSelector:n,defaultHeight:r,onHeightChange:i}=e,s=y.useRef(null);return y.useEffect(()=>{if(!t||!s.current)return;const o=s.current.querySelector(n);if(!o)return;const l=()=>{const c=s.current;if(!c)return;const h=c.querySelector(n);if(!h)return;const f=c.offsetHeight-h.clientHeight,m=h.scrollHeight+f,w=Math.floor(window.innerHeight*fe.MAX_HEIGHT_RATIO),S=Math.max(r,Math.min(m,w));i(b=>b===S?b:S)};l();const u=new ResizeObserver(()=>l());Array.from(o.children).forEach(c=>u.observe(c));const p=new MutationObserver(()=>{Array.from(o.children).forEach(c=>u.observe(c)),l()});return p.observe(o,{childList:!0,subtree:!0,characterData:!0}),()=>{u.disconnect(),p.disconnect()}},[t,n,r,i]),s}function Ia(e,t){const n=fe.TRIGGER_SIZE;return{x:Math.max(8,Math.min(e,window.innerWidth-n-8)),y:Math.max(8,Math.min(t,window.innerHeight-n-8))}}function Wr({isOpen:e,onClick:t,triggerLogo:n}){const[r,i]=y.useState(null),s=y.useRef(!1),a=y.useRef(!1),o=y.useRef({x:0,y:0}),l=y.useRef({x:0,y:0}),u=y.useRef(null);y.useEffect(()=>()=>{var f;(f=u.current)==null||f.call(u)},[]);const p=y.useCallback(f=>{if(f.button!==0)return;s.current=!0,a.current=!1,o.current={x:f.clientX,y:f.clientY};const m=f.currentTarget.getBoundingClientRect();l.current={x:m.left,y:m.top};const w=b=>{if(!s.current)return;const j=b.clientX-o.current.x,E=b.clientY-o.current.y;(Math.abs(j)>4||Math.abs(E)>4)&&(a.current=!0),a.current&&i(Ia(l.current.x+j,l.current.y+E))},S=()=>{s.current=!1,document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",S),u.current=null};document.addEventListener("mousemove",w),document.addEventListener("mouseup",S),u.current=S},[]),c=y.useCallback(()=>{if(a.current){a.current=!1;return}t()},[t]),h=r?{left:r.x,top:r.y,width:fe.TRIGGER_SIZE,height:fe.TRIGGER_SIZE}:{right:fe.TRIGGER_RIGHT,bottom:fe.TRIGGER_BOTTOM,width:fe.TRIGGER_SIZE,height:fe.TRIGGER_SIZE};return d.jsx("button",{type:"button",className:`fixed z-[10000] flex items-center justify-center border-none bg-transparent p-0 transition-transform duration-200 ease-out hover:scale-[1.08] active:scale-95 ${e?"pointer-events-none scale-50 opacity-0":"opacity-100"}`,style:h,onMouseDown:p,onClick:c,"aria-label":"打开 AI 助手",title:"AI 助手",children:d.jsx("img",{src:n||he.triggerLogo,alt:"AI 助手",className:"block h-full w-full",draggable:!1})})}function rt({tooltip:e,onClick:t,children:n}){return d.jsx("button",{type:"button",className:"sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white active:bg-[#F5F5F5]","data-tooltip":e,"aria-label":e,onClick:t,children:n})}function qr({onClose:e,onToggleThreadList:t,isMaximized:n=!1,onToggleMaximize:r,showHome:i=!1,onHome:s,showClose:a=!0,artifactCount:o=0,onToggleArtifactDrawer:l,panelTitle:u}){return d.jsxs("div",{className:"relative z-20 flex h-9 shrink-0 select-none items-center px-[15px]",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(rt,{tooltip:"历史记录",onClick:t,children:d.jsx("img",{src:he.recently,alt:"",width:20,height:20})}),i&&s&&d.jsx(rt,{tooltip:u?"返回聊天":"回到首页",onClick:s,children:d.jsx("img",{src:he.home,alt:"",width:20,height:20})})]}),u&&d.jsx("div",{className:"pointer-events-none absolute inset-x-0 flex justify-center",children:d.jsx("span",{className:"max-w-[50%] truncate text-[15px] font-semibold text-[#18181b]",children:u})}),d.jsxs("div",{className:"ml-auto flex items-center gap-2.5",children:[o>0&&l&&d.jsx(rt,{tooltip:"会话产物",onClick:l,children:d.jsxs("span",{className:"relative flex items-center gap-1",children:[d.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),d.jsx("polyline",{points:"14 2 14 8 20 8"})]}),o>0&&d.jsx("span",{className:"absolute -right-2 -top-1.5 min-w-[14px] rounded-full bg-[var(--sa-primary)] px-0.5 text-center text-[9px] font-medium leading-[14px] text-white",children:o>99?"99+":o})]})}),r&&d.jsx(rt,{tooltip:n?"小窗":"大窗",onClick:r,children:d.jsx("img",{src:n?he.spiltWindow:he.mergeWindow,alt:"",width:20,height:20})}),a&&d.jsx(rt,{tooltip:"关闭",onClick:e,children:d.jsx("img",{src:he.close,alt:"",width:20,height:20})})]})]})}const it=e=>String(e).padStart(2,"0");function za(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?"":`${t.getFullYear()}-${it(t.getMonth()+1)}-${it(t.getDate())} ${it(t.getHours())}:${it(t.getMinutes())}:${it(t.getSeconds())}`}function Vr(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=n-6*864e5,i=[],s=[],a=[];for(const l of e){const u=new Date(l.updateTime).getTime();u>=n?i.push(l):u>=r?s.push(l):a.push(l)}const o=[];return i.length&&o.push({label:"今天",items:i}),s.length&&o.push({label:"最近 7 天",items:s}),a.length&&o.push({label:"更早",items:a}),o}function en({width:e}){const{conversations:t,activeConversationId:n,switchConversation:r,newConversation:i,deleteConversation:s,renameConversation:a,hasMore:o,loadMoreConversations:l,conversationsLoading:u}=Te(),[p,c]=y.useState(null),[h,f]=y.useState(""),[m,w]=y.useState(null),S=y.useRef(null),b=y.useCallback((N,v)=>{c(N),f(v??"")},[]),j=y.useCallback(N=>{h.trim()&&a(N,h.trim()),c(null)},[h,a]),E=y.useCallback(()=>{const N=S.current;!N||!o||N.scrollHeight-N.scrollTop-N.clientHeight<50&&l()},[o,l]),R=y.useMemo(()=>Vr(t),[t]);return d.jsxs("div",{className:"relative z-[5] flex h-full shrink-0 flex-col overflow-visible border-r border-[#ECECEC] bg-[#FAFAFA] p-3 animate-sa-history-in",style:{width:e??200},children:[d.jsxs("button",{type:"button",className:"sa-new-chat mb-4 flex h-8 w-full shrink-0 items-center justify-center gap-2 rounded-md text-[14px] font-medium transition-colors",onClick:i,children:[d.jsx("img",{src:he.messageCreate,alt:"",width:18,height:18}),d.jsx("span",{className:"sa-new-chat-text whitespace-nowrap",children:"新建对话"})]}),d.jsxs("div",{className:"px-1 pb-2.5",children:[d.jsx("div",{className:"mb-1 text-[14px] font-semibold text-[#333]",children:"历史对话"}),d.jsx("div",{className:"text-[11px] text-[#999]",children:"展示最近的会话记录"})]}),d.jsxs("div",{ref:S,className:"flex-1 overflow-y-auto",onScroll:E,children:[u&&t.length===0&&d.jsx("div",{className:"px-0.5 py-2 text-[12px] text-[#999]",children:"加载中..."}),!u&&t.length===0&&d.jsx("div",{className:"px-0.5 py-2 text-[12px] text-[#999]",children:"暂无记录"}),R.map(N=>d.jsxs("div",{className:"mb-1",children:[d.jsx("div",{className:"px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]",children:N.label}),N.items.map(v=>d.jsx("div",{className:`group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${v.sessionId===n?"bg-[#E8F1FE]":"hover:bg-[#E8F1FE]"}`,onClick:()=>{p!==v.sessionId&&r(v.sessionId)},onMouseEnter:A=>{if(p===v.sessionId)return;const P=A.currentTarget.getBoundingClientRect();w({text:v.title||"新会话",x:P.right+8,y:P.top+P.height/2})},onMouseLeave:()=>w(null),children:p===v.sessionId?d.jsx("input",{className:"w-full rounded border border-[var(--sa-primary)] bg-white px-1.5 py-0.5 text-[12px] outline-none",value:h,onChange:A=>f(A.target.value),onBlur:()=>j(v.sessionId),onKeyDown:A=>{A.key==="Enter"&&j(v.sessionId),A.key==="Escape"&&c(null)},onClick:A=>A.stopPropagation(),autoFocus:!0}):d.jsxs(d.Fragment,{children:[d.jsx("img",{src:he.message,alt:"",width:16,height:16,className:"shrink-0 opacity-60"}),d.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]",children:v.title||"新会话"}),d.jsxs("span",{className:"hidden shrink-0 items-center gap-0.5 group-hover:flex",children:[d.jsx("button",{type:"button",className:"flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[var(--sa-primary)]",onClick:A=>{A.stopPropagation(),b(v.sessionId,v.title)},title:"重命名",children:d.jsx("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"})})}),d.jsx("button",{type:"button",className:"flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[#ef4444]",onClick:A=>{A.stopPropagation(),s(v.sessionId)},title:"删除",children:d.jsx("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})})})]})]})},v.sessionId))]},N.label)),u&&t.length>0&&d.jsx("div",{className:"px-0.5 py-2 text-[12px] text-[#999]",children:o?"加载更多...":"加载中..."}),!u&&o&&d.jsx("div",{className:"px-0.5 py-2 text-center text-[11px] text-[#C0C0C0]",children:"向下滚动加载更多"})]}),m&&d.jsx("div",{className:"pointer-events-none fixed z-[10001] whitespace-nowrap rounded border border-[#E8E8E8] bg-white px-2.5 py-1.5 text-[12px] leading-[1.4] text-[#333] shadow-[0_2px_8px_rgba(0,0,0,0.12)]",style:{left:m.x,top:m.y,transform:"translateY(-50%)"},children:m.text})]})}function Yr(e){const t=y.useRef(null),n=y.useRef(!1),r=y.useRef(0),i=y.useCallback(()=>{const a=t.current;if(!a)return;const{scrollTop:o,scrollHeight:l,clientHeight:u}=a,p=l-o-u<40;o<r.current&&!p&&(n.current=!0),p&&(n.current=!1),r.current=o},[]);y.useEffect(()=>{const a=t.current;if(a)return a.addEventListener("scroll",i,{passive:!0}),()=>a.removeEventListener("scroll",i)},[i]),y.useEffect(()=>{if(n.current)return;const a=t.current;a&&requestAnimationFrame(()=>{a.scrollTop=a.scrollHeight})},e);const s=y.useCallback(()=>{n.current=!1;const a=t.current;a&&(a.scrollTop=a.scrollHeight)},[]);return{containerRef:t,scrollToBottom:s}}function Ta(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Aa=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Na=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Da={};function Fn(e,t){return(Da.jsx?Na:Aa).test(e)}const Ma=/[ \t\n\f\r]/g;function La(e){return typeof e=="object"?e.type==="text"?_n(e.value):!1:_n(e)}function _n(e){return e.replace(Ma,"")===""}class pt{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}pt.prototype.normal={};pt.prototype.property={};pt.prototype.space=void 0;function Gr(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new pt(n,r,t)}function tn(e){return e.toLowerCase()}class we{constructor(t,n){this.attribute=n,this.property=t}}we.prototype.attribute="";we.prototype.booleanish=!1;we.prototype.boolean=!1;we.prototype.commaOrSpaceSeparated=!1;we.prototype.commaSeparated=!1;we.prototype.defined=!1;we.prototype.mustUseProperty=!1;we.prototype.number=!1;we.prototype.overloadedBoolean=!1;we.prototype.property="";we.prototype.spaceSeparated=!1;we.prototype.space=void 0;let Ra=0;const K=We(),le=We(),nn=We(),L=We(),ne=We(),He=We(),ve=We();function We(){return 2**++Ra}const rn=Object.freeze(Object.defineProperty({__proto__:null,boolean:K,booleanish:le,commaOrSpaceSeparated:ve,commaSeparated:He,number:L,overloadedBoolean:nn,spaceSeparated:ne},Symbol.toStringTag,{value:"Module"})),_t=Object.keys(rn);class hn extends we{constructor(t,n,r,i){let s=-1;if(super(t,n),On(this,"space",i),typeof r=="number")for(;++s<_t.length;){const a=_t[s];On(this,_t[s],(r&rn[a])===rn[a])}}}hn.prototype.defined=!0;function On(e,t,n){n&&(e[t]=n)}function Ke(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new hn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[tn(r)]=r,n[tn(s.attribute)]=r}return new pt(t,n,e.space)}const Xr=Ke({properties:{ariaActiveDescendant:null,ariaAtomic:le,ariaAutoComplete:null,ariaBusy:le,ariaChecked:le,ariaColCount:L,ariaColIndex:L,ariaColSpan:L,ariaControls:ne,ariaCurrent:null,ariaDescribedBy:ne,ariaDetails:null,ariaDisabled:le,ariaDropEffect:ne,ariaErrorMessage:null,ariaExpanded:le,ariaFlowTo:ne,ariaGrabbed:le,ariaHasPopup:null,ariaHidden:le,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ne,ariaLevel:L,ariaLive:null,ariaModal:le,ariaMultiLine:le,ariaMultiSelectable:le,ariaOrientation:null,ariaOwns:ne,ariaPlaceholder:null,ariaPosInSet:L,ariaPressed:le,ariaReadOnly:le,ariaRelevant:null,ariaRequired:le,ariaRoleDescription:ne,ariaRowCount:L,ariaRowIndex:L,ariaRowSpan:L,ariaSelected:le,ariaSetSize:L,ariaSort:null,ariaValueMax:L,ariaValueMin:L,ariaValueNow:L,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Kr(e,t){return t in e?e[t]:t}function Qr(e,t){return Kr(e,t.toLowerCase())}const Pa=Ke({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:He,acceptCharset:ne,accessKey:ne,action:null,allow:null,allowFullScreen:K,allowPaymentRequest:K,allowUserMedia:K,alpha:K,alt:null,as:null,async:K,autoCapitalize:null,autoComplete:ne,autoFocus:K,autoPlay:K,blocking:ne,capture:null,charSet:null,checked:K,cite:null,className:ne,closedBy:null,colorSpace:null,cols:L,colSpan:L,command:null,commandFor:null,content:null,contentEditable:le,controls:K,controlsList:ne,coords:L|He,crossOrigin:null,data:null,dateTime:null,decoding:null,default:K,defer:K,dir:null,dirName:null,disabled:K,download:nn,draggable:le,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:K,formTarget:null,headers:ne,height:L,hidden:nn,high:L,href:null,hrefLang:null,htmlFor:ne,httpEquiv:ne,id:null,imageSizes:null,imageSrcSet:null,inert:K,inputMode:null,integrity:null,is:null,isMap:K,itemId:null,itemProp:ne,itemRef:ne,itemScope:K,itemType:ne,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:K,low:L,manifest:null,max:null,maxLength:L,media:null,method:null,min:null,minLength:L,multiple:K,muted:K,name:null,nonce:null,noModule:K,noValidate:K,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:K,optimum:L,pattern:null,ping:ne,placeholder:null,playsInline:K,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:K,referrerPolicy:null,rel:ne,required:K,reversed:K,rows:L,rowSpan:L,sandbox:ne,scope:null,scoped:K,seamless:K,selected:K,shadowRootClonable:K,shadowRootCustomElementRegistry:K,shadowRootDelegatesFocus:K,shadowRootMode:null,shadowRootSerializable:K,shape:null,size:L,sizes:null,slot:null,span:L,spellCheck:le,src:null,srcDoc:null,srcLang:null,srcSet:null,start:L,step:null,style:null,tabIndex:L,target:null,title:null,translate:null,type:null,typeMustMatch:K,useMap:null,value:le,width:L,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ne,axis:null,background:null,bgColor:null,border:L,borderColor:null,bottomMargin:L,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:K,declare:K,event:null,face:null,frame:null,frameBorder:null,hSpace:L,leftMargin:L,link:null,longDesc:null,lowSrc:null,marginHeight:L,marginWidth:L,noResize:K,noHref:K,noShade:K,noWrap:K,object:null,profile:null,prompt:null,rev:null,rightMargin:L,rules:null,scheme:null,scrolling:le,standby:null,summary:null,text:null,topMargin:L,valueType:null,version:null,vAlign:null,vLink:null,vSpace:L,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:K,disablePictureInPicture:K,disableRemotePlayback:K,exportParts:He,part:ne,prefix:null,property:null,results:L,security:null,unselectable:null},space:"html",transform:Qr}),Fa=Ke({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",maskType:"mask-type",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:ve,accentHeight:L,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:L,amplitude:L,arabicForm:null,ascent:L,attributeName:null,attributeType:null,azimuth:L,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:L,by:null,calcMode:null,capHeight:L,className:ne,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:L,diffuseConstant:L,direction:null,display:null,dur:null,divisor:L,dominantBaseline:null,download:K,dx:null,dy:null,edgeMode:null,editable:null,elevation:L,enableBackground:null,end:null,event:null,exponent:L,externalResourcesRequired:null,fill:null,fillOpacity:L,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:He,g2:He,glyphName:He,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:L,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:L,horizOriginX:L,horizOriginY:L,id:null,ideographic:L,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:L,k:L,k1:L,k2:L,k3:L,k4:L,kernelMatrix:ve,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:L,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:L,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:L,overlineThickness:L,paintOrder:null,panose1:null,path:null,pathLength:L,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ne,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:L,pointsAtY:L,pointsAtZ:L,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ve,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ve,rev:ve,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ve,requiredFeatures:ve,requiredFonts:ve,requiredFormats:ve,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:L,specularExponent:L,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:L,strikethroughThickness:L,string:null,stroke:null,strokeDashArray:ve,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:L,strokeOpacity:L,strokeWidth:null,style:null,surfaceScale:L,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ve,tabIndex:L,tableValues:null,target:null,targetX:L,targetY:L,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ve,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:L,underlineThickness:L,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:L,values:null,vAlphabetic:L,vMathematical:L,vectorEffect:null,vHanging:L,vIdeographic:L,version:null,vertAdvY:L,vertOriginX:L,vertOriginY:L,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:L,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Kr}),Jr=Ke({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Zr=Ke({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Qr}),ei=Ke({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),_a={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"},Oa=/[A-Z]/g,Bn=/-[a-z]/g,Ba=/^data[-\w.:]+$/i;function $a(e,t){const n=tn(t);let r=t,i=we;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Ba.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Bn,Ua);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Bn.test(s)){let a=s.replace(Oa,Ha);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=hn}return new i(r,t)}function Ha(e){return"-"+e.toLowerCase()}function Ua(e){return e.charAt(1).toUpperCase()}const Wa=Gr([Xr,Pa,Jr,Zr,ei],"html"),gn=Gr([Xr,Fa,Jr,Zr,ei],"svg");function qa(e){return e.join(" ").trim()}var mn={},$n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Va=/\n/g,Ya=/^\s*/,Ga=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Xa=/^:\s*/,Ka=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Qa=/^[;\s]*/,Ja=/^\s+|\s+$/g,Za=`
|
|
2
|
+
`,Hn="/",Un="*",$e="",es="comment",ts="declaration";function ns(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(m){var w=m.match(Va);w&&(n+=w.length);var S=m.lastIndexOf(Za);r=~S?m.length-S:r+m.length}function s(){var m={line:n,column:r};return function(w){return w.position=new a(m),u(),w}}function a(m){this.start=m,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(m){var w=new Error(t.source+":"+n+":"+r+": "+m);if(w.reason=m,w.filename=t.source,w.line=n,w.column=r,w.source=e,!t.silent)throw w}function l(m){var w=m.exec(e);if(w){var S=w[0];return i(S),e=e.slice(S.length),w}}function u(){l(Ya)}function p(m){var w;for(m=m||[];w=c();)w!==!1&&m.push(w);return m}function c(){var m=s();if(!(Hn!=e.charAt(0)||Un!=e.charAt(1))){for(var w=2;$e!=e.charAt(w)&&(Un!=e.charAt(w)||Hn!=e.charAt(w+1));)++w;if(w+=2,$e===e.charAt(w-1))return o("End of comment missing");var S=e.slice(2,w-2);return r+=2,i(S),e=e.slice(w),r+=2,m({type:es,comment:S})}}function h(){var m=s(),w=l(Ga);if(w){if(c(),!l(Xa))return o("property missing ':'");var S=l(Ka),b=m({type:ts,property:Wn(w[0].replace($n,$e)),value:S?Wn(S[0].replace($n,$e)):$e});return l(Qa),b}}function f(){var m=[];p(m);for(var w;w=h();)w!==!1&&(m.push(w),p(m));return m}return u(),f()}function Wn(e){return e?e.replace(Ja,$e):$e}var rs=ns,is=Pe.commonjsGlobal&&Pe.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mn,"__esModule",{value:!0});mn.default=ss;const as=is(rs);function ss(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,as.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:a,value:o}=s;i?t(a,o,s):o&&(n=n||{},n[a]=o)}),n}var At={};Object.defineProperty(At,"__esModule",{value:!0});At.camelCase=void 0;var os=/^--[a-zA-Z0-9_-]+$/,ls=/-([a-z])/g,us=/^[^-]+$/,cs=/^-(webkit|moz|ms|o|khtml)-/,ds=/^-(ms)-/,ps=function(e){return!e||us.test(e)||os.test(e)},fs=function(e,t){return t.toUpperCase()},qn=function(e,t){return"".concat(t,"-")},hs=function(e,t){return t===void 0&&(t={}),ps(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(ds,qn):e=e.replace(cs,qn),e.replace(ls,fs))};At.camelCase=hs;var gs=Pe.commonjsGlobal&&Pe.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},ms=gs(mn),xs=At;function an(e,t){var n={};return!e||typeof e!="string"||(0,ms.default)(e,function(r,i){r&&i&&(n[(0,xs.camelCase)(r,t)]=i)}),n}an.default=an;var bs=an;const ws=Pe.getDefaultExportFromCjs(bs),ti=ni("end"),xn=ni("start");function ni(e){return t;function t(n){const r=n&&n.position&&n.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 ys(e){const t=xn(e),n=ti(e);if(t&&n)return{start:t,end:n}}function ot(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Vn(e.position):"start"in e||"end"in e?Vn(e):"line"in e||"column"in e?sn(e):""}function sn(e){return Yn(e&&e.line)+":"+Yn(e&&e.column)}function Vn(e){return sn(e&&e.start)+"-"+sn(e&&e.end)}function Yn(e){return e&&typeof e=="number"?e:1}class me extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(a=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const o=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=ot(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}me.prototype.file="";me.prototype.name="";me.prototype.reason="";me.prototype.message="";me.prototype.stack="";me.prototype.column=void 0;me.prototype.line=void 0;me.prototype.ancestors=void 0;me.prototype.cause=void 0;me.prototype.fatal=void 0;me.prototype.place=void 0;me.prototype.ruleId=void 0;me.prototype.source=void 0;const bn={}.hasOwnProperty,ks=new Map,vs=/[A-Z]/g,Cs=new Set(["table","tbody","thead","tfoot","tr"]),Ss=new Set(["td","th"]),ri="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function js(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Ms(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Ds(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?gn:Wa,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=ii(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function ii(e,t,n){if(t.type==="element")return Es(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Is(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ts(e,t,n);if(t.type==="mdxjsEsm")return zs(e,t);if(t.type==="root")return As(e,t,n);if(t.type==="text")return Ns(e,t)}function Es(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=gn,e.schema=i),e.ancestors.push(t);const s=si(e,t.tagName,!1),a=Ls(e,t);let o=yn(e,t);return Cs.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!La(l):!0})),ai(e,a,s,t),wn(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function Is(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ct(e,t.position)}function zs(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ct(e,t.position)}function Ts(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=gn,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:si(e,t.name,!0),a=Rs(e,t),o=yn(e,t);return ai(e,a,s,t),wn(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function As(e,t,n){const r={};return wn(r,yn(e,t)),e.create(t,e.Fragment,r,n)}function Ns(e,t){return t.value}function ai(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function wn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Ds(e,t,n){return r;function r(i,s,a,o){const u=Array.isArray(a.children)?n:t;return o?u(s,a,o):u(s,a)}}function Ms(e,t){return n;function n(r,i,s,a){const o=Array.isArray(s.children),l=xn(r);return t(i,s,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function Ls(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&bn.call(t.properties,i)){const s=Ps(e,i,t.properties[i]);if(s){const[a,o]=s;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&Ss.has(t.tagName)?r=o:n[a]=o}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Rs(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else ct(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,s=e.evaluater.evaluateExpression(o.expression)}else ct(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function yn(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:ks;for(;++r<t.children.length;){const s=t.children[r];let a;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const u=i.get(l)||0;a=l+"-"+u,i.set(l,u+1)}}const o=ii(e,s,a);o!==void 0&&n.push(o)}return n}function Ps(e,t,n){const r=$a(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ta(n):qa(n)),r.property==="style"){let i=typeof n=="object"?n:Fs(e,String(n));return e.stylePropertyNameCase==="css"&&(i=_s(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?_a[r.property]||r.property:r.attribute,n]}}function Fs(e,t){try{return ws(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new me("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=ri+"#cannot-parse-style-attribute",i}}function si(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,a;for(;++s<i.length;){const o=Fn(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(s&&o.type==="Literal"),optional:!1}:o}r=a}else r=Fn(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return bn.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ct(e)}function ct(e,t){const n=new me("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=ri+"#cannot-handle-mdx-estrees-without-createevaluater",n}function _s(e){const t={};let n;for(n in e)bn.call(e,n)&&(t[Os(n)]=e[n]);return t}function Os(e){let t=e.replace(vs,Bs);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Bs(e){return"-"+e.toLowerCase()}const Ot={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"]},$s={};function kn(e,t){const n=$s,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return oi(e,r,i)}function oi(e,t,n){if(Hs(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Gn(e.children,t,n)}return Array.isArray(e)?Gn(e,t,n):""}function Gn(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=oi(e[i],t,n);return r.join("")}function Hs(e){return!!(e&&typeof e=="object")}const Xn=document.createElement("i");function vn(e){const t="&"+e+";";Xn.innerHTML=t;const n=Xn.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ce(e,t,n,r){const i=e.length;let s=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);s<r.length;)a=r.slice(s,s+1e4),a.unshift(t,0),e.splice(...a),s+=1e4,t+=1e4}function je(e,t){return e.length>0?(Ce(e,e.length,0,t),e):t}const Kn={}.hasOwnProperty;function li(e){const t={};let n=-1;for(;++n<e.length;)Us(t,e[n]);return t}function Us(e,t){let n;for(n in t){const i=(Kn.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let a;if(s)for(a in s){Kn.call(i,a)||(i[a]=[]);const o=s[a];Ws(i[a],Array.isArray(o)?o:o?[o]:[])}}}function Ws(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ce(e,0,0,r)}function ui(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ie(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xe=Fe(/[A-Za-z]/),ge=Fe(/[\dA-Za-z]/),qs=Fe(/[#-'*+\--9=?A-Z^-~]/);function Et(e){return e!==null&&(e<32||e===127)}const on=Fe(/\d/),Vs=Fe(/[\dA-Fa-f]/),Ys=Fe(/[!-/:-@[-`{-~]/);function H(e){return e!==null&&e<-2}function re(e){return e!==null&&(e<0||e===32)}function J(e){return e===-2||e===-1||e===32}const Nt=Fe(new RegExp("\\p{P}|\\p{S}","u")),Ue=Fe(/\s/);function Fe(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Qe(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let a="";if(s===37&&ge(e.charCodeAt(n+1))&&ge(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const o=e.charCodeAt(n+1);s<56320&&o>56319&&o<57344?(a=String.fromCharCode(s,o),i=1):a="�"}else a=String.fromCharCode(s);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ee(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(l){return J(l)?(e.enter(n),o(l)):t(l)}function o(l){return J(l)&&s++<i?(e.consume(l),o):(e.exit(n),t(l))}}const Gs={tokenize:Xs};function Xs(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ee(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),s(o)}function s(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return H(o)?(e.consume(o),e.exit("chunkText"),s):(e.consume(o),a)}}const Ks={tokenize:Qs},Qn={tokenize:Js};function Qs(e){const t=this,n=[];let r=0,i,s,a;return o;function o(E){if(r<n.length){const R=n[r];return t.containerState=R[1],e.attempt(R[0].continuation,l,u)(E)}return u(E)}function l(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&j();const R=t.events.length;let N=R,v;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){v=t.events[N][1].end;break}b(r);let A=R;for(;A<t.events.length;)t.events[A][1].end={...v},A++;return Ce(t.events,N+1,0,t.events.slice(R)),t.events.length=A,u(E)}return o(E)}function u(E){if(r===n.length){if(!i)return h(E);if(i.currentConstruct&&i.currentConstruct.concrete)return m(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Qn,p,c)(E)}function p(E){return i&&j(),b(r),h(E)}function c(E){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,m(E)}function h(E){return t.containerState={},e.attempt(Qn,f,m)(E)}function f(E){return r++,n.push([t.currentConstruct,t.containerState]),h(E)}function m(E){if(E===null){i&&j(),b(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),w(E)}function w(E){if(E===null){S(e.exit("chunkFlow"),!0),b(0),e.consume(E);return}return H(E)?(e.consume(E),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(E),w)}function S(E,R){const N=t.sliceStream(E);if(R&&N.push(null),E.previous=s,s&&(s.next=E),s=E,i.defineSkip(E.start),i.write(N),t.parser.lazy[E.start.line]){let v=i.events.length;for(;v--;)if(i.events[v][1].start.offset<a&&(!i.events[v][1].end||i.events[v][1].end.offset>a))return;const A=t.events.length;let P=A,B,C;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(B){C=t.events[P][1].end;break}B=!0}for(b(r),v=A;v<t.events.length;)t.events[v][1].end={...C},v++;Ce(t.events,P+1,0,t.events.slice(A)),t.events.length=v}}function b(E){let R=n.length;for(;R-- >E;){const N=n[R];t.containerState=N[1],N[0].exit.call(t,e)}n.length=E}function j(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Js(e,t,n){return ee(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xe(e){if(e===null||re(e)||Ue(e))return 1;if(Nt(e))return 2}function Dt(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const ln={name:"attention",resolveAll:Zs,tokenize:eo};function Zs(e,t){let n=-1,r,i,s,a,o,l,u,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},h={...e[n][1].start};Jn(c,-l),Jn(h,l),a={type:l>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=je(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=je(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),u=je(u,Dt(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=je(u,[["exit",s,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,u=je(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Ce(e,r-1,n-r+3,u),n=r+u.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function eo(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Xe(r);let s;return a;function a(l){return s=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===s)return e.consume(l),o;const u=e.exit("attentionSequence"),p=Xe(l),c=!p||p===2&&i||n.includes(l),h=!i||i===2&&p||n.includes(r);return u._open=!!(s===42?c:c&&(i||!h)),u._close=!!(s===42?h:h&&(p||!c)),t(l)}}function Jn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const to={name:"autolink",tokenize:no};function no(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(f){return xe(f)?(e.consume(f),a):f===64?n(f):u(f)}function a(f){return f===43||f===45||f===46||ge(f)?(r=1,o(f)):u(f)}function o(f){return f===58?(e.consume(f),r=0,l):(f===43||f===45||f===46||ge(f))&&r++<32?(e.consume(f),o):(r=0,u(f))}function l(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||Et(f)?n(f):(e.consume(f),l)}function u(f){return f===64?(e.consume(f),p):qs(f)?(e.consume(f),u):n(f)}function p(f){return ge(f)?c(f):n(f)}function c(f){return f===46?(e.consume(f),r=0,p):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):h(f)}function h(f){if((f===45||ge(f))&&r++<63){const m=f===45?h:c;return e.consume(f),m}return n(f)}}const ft={partial:!0,tokenize:ro};function ro(e,t,n){return r;function r(s){return J(s)?ee(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||H(s)?t(s):n(s)}}const ci={continuation:{tokenize:ao},exit:so,name:"blockQuote",tokenize:io};function io(e,t,n){const r=this;return i;function i(a){if(a===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),s}return n(a)}function s(a){return J(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function ao(e,t,n){const r=this;return i;function i(a){return J(a)?ee(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return e.attempt(ci,t,n)(a)}}function so(e){e.exit("blockQuote")}const di={name:"characterEscape",tokenize:oo};function oo(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return Ys(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const pi={name:"characterReference",tokenize:lo};function lo(e,t,n){const r=this;let i=0,s,a;return o;function o(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),l}function l(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,a=ge,p(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,a=Vs,p):(e.enter("characterReferenceValue"),s=7,a=on,p(c))}function p(c){if(c===59&&i){const h=e.exit("characterReferenceValue");return a===ge&&!vn(r.sliceSerialize(h))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(c)&&i++<s?(e.consume(c),p):n(c)}}const Zn={partial:!0,tokenize:co},er={concrete:!0,name:"codeFenced",tokenize:uo};function uo(e,t,n){const r=this,i={partial:!0,tokenize:N};let s=0,a=0,o;return l;function l(v){return u(v)}function u(v){const A=r.events[r.events.length-1];return s=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,o=v,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(v)}function p(v){return v===o?(a++,e.consume(v),p):a<3?n(v):(e.exit("codeFencedFenceSequence"),J(v)?ee(e,c,"whitespace")(v):c(v))}function c(v){return v===null||H(v)?(e.exit("codeFencedFence"),r.interrupt?t(v):e.check(Zn,w,R)(v)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===null||H(v)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(v)):J(v)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ee(e,f,"whitespace")(v)):v===96&&v===o?n(v):(e.consume(v),h)}function f(v){return v===null||H(v)?c(v):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===null||H(v)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(v)):v===96&&v===o?n(v):(e.consume(v),m)}function w(v){return e.attempt(i,R,S)(v)}function S(v){return e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),b}function b(v){return s>0&&J(v)?ee(e,j,"linePrefix",s+1)(v):j(v)}function j(v){return v===null||H(v)?e.check(Zn,w,R)(v):(e.enter("codeFlowValue"),E(v))}function E(v){return v===null||H(v)?(e.exit("codeFlowValue"),j(v)):(e.consume(v),E)}function R(v){return e.exit("codeFenced"),t(v)}function N(v,A,P){let B=0;return C;function C(T){return v.enter("lineEnding"),v.consume(T),v.exit("lineEnding"),D}function D(T){return v.enter("codeFencedFence"),J(T)?ee(v,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):O(T)}function O(T){return T===o?(v.enter("codeFencedFenceSequence"),k(T)):P(T)}function k(T){return T===o?(B++,v.consume(T),k):B>=a?(v.exit("codeFencedFenceSequence"),J(T)?ee(v,I,"whitespace")(T):I(T)):P(T)}function I(T){return T===null||H(T)?(v.exit("codeFencedFence"),A(T)):P(T)}}}function co(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Bt={name:"codeIndented",tokenize:fo},po={partial:!0,tokenize:ho};function fo(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),ee(e,s,"linePrefix",5)(u)}function s(u){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?l(u):H(u)?e.attempt(po,a,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||H(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function ho(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):H(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):ee(e,s,"linePrefix",5)(a)}function s(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):H(a)?i(a):n(a)}}const go={name:"codeText",previous:xo,resolve:mo,tokenize:bo};function mo(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function xo(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function bo(e,t,n){let r=0,i,s;return a;function a(c){return e.enter("codeText"),e.enter("codeTextSequence"),o(c)}function o(c){return c===96?(e.consume(c),r++,o):(e.exit("codeTextSequence"),l(c))}function l(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),l):c===96?(s=e.enter("codeTextSequence"),i=0,p(c)):H(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||H(c)?(e.exit("codeTextData"),l(c)):(e.consume(c),u)}function p(c){return c===96?(e.consume(c),i++,p):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(s.type="codeTextData",u(c))}}class wo{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&at(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),at(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),at(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);at(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);at(this.left,n.reverse())}}}function at(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function fi(e){const t={};let n=-1,r,i,s,a,o,l,u;const p=new wo(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,yo(p,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(a=p.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},o=p.slice(i,n),o.unshift(r),p.splice(i,n-i+1,o))}}return Ce(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!u}function yo(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,l=[],u={};let p,c,h=-1,f=n,m=0,w=0;const S=[w];for(;f;){for(;e.get(++i)[1]!==f;);s.push(i),f._tokenizer||(p=r.sliceStream(f),f.next||p.push(null),c&&a.defineSkip(f.start),f._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),f._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),c=f,f=f.next}for(f=n;++h<o.length;)o[h][0]==="exit"&&o[h-1][0]==="enter"&&o[h][1].type===o[h-1][1].type&&o[h][1].start.line!==o[h][1].end.line&&(w=h+1,S.push(w),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(a.events=[],f?(f._tokenizer=void 0,f.previous=void 0):S.pop(),h=S.length;h--;){const b=o.slice(S[h],S[h+1]),j=s.pop();l.push([j,j+b.length-1]),e.splice(j,2,b)}for(l.reverse(),h=-1;++h<l.length;)u[m+l[h][0]]=m+l[h][1],m+=l[h][1]-l[h][0]-1;return u}const ko={resolve:Co,tokenize:So},vo={partial:!0,tokenize:jo};function Co(e){return fi(e),e}function So(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?s(o):H(o)?e.check(vo,a,s)(o):(e.consume(o),i)}function s(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function jo(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ee(e,s,"linePrefix")}function s(a){if(a===null||H(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function hi(e,t,n,r,i,s,a,o,l){const u=l||Number.POSITIVE_INFINITY;let p=0;return c;function c(b){return b===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(b),e.exit(s),h):b===null||b===32||b===41||Et(b)?n(b):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),w(b))}function h(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===62?(e.exit("chunkString"),e.exit(o),h(b)):b===null||b===60||H(b)?n(b):(e.consume(b),b===92?m:f)}function m(b){return b===60||b===62||b===92?(e.consume(b),f):f(b)}function w(b){return!p&&(b===null||b===41||re(b))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(b)):p<u&&b===40?(e.consume(b),p++,w):b===41?(e.consume(b),p--,w):b===null||b===32||b===40||Et(b)?n(b):(e.consume(b),b===92?S:w)}function S(b){return b===40||b===41||b===92?(e.consume(b),w):w(b)}}function gi(e,t,n,r,i,s){const a=this;let o=0,l;return u;function u(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(s),p}function p(f){return o>999||f===null||f===91||f===93&&!l||f===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):H(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===null||f===91||f===93||H(f)||o++>999?(e.exit("chunkString"),p(f)):(e.consume(f),l||(l=!J(f)),f===92?h:c)}function h(f){return f===91||f===92||f===93?(e.consume(f),o++,c):c(f)}}function mi(e,t,n,r,i,s){let a;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),a=h===40?41:h,l):n(h)}function l(h){return h===a?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(s),u(h))}function u(h){return h===a?(e.exit(s),l(a)):h===null?n(h):H(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),ee(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(h))}function p(h){return h===a||h===null||H(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?c:p)}function c(h){return h===a||h===92?(e.consume(h),p):p(h)}}function lt(e,t){let n;return r;function r(i){return H(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):J(i)?ee(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Eo={name:"definition",tokenize:zo},Io={partial:!0,tokenize:To};function zo(e,t,n){const r=this;let i;return s;function s(f){return e.enter("definition"),a(f)}function a(f){return gi.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function o(f){return i=Ie(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),l):n(f)}function l(f){return re(f)?lt(e,u)(f):u(f)}function u(f){return hi(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function p(f){return e.attempt(Io,c,c)(f)}function c(f){return J(f)?ee(e,h,"whitespace")(f):h(f)}function h(f){return f===null||H(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function To(e,t,n){return r;function r(o){return re(o)?lt(e,i)(o):n(o)}function i(o){return mi(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function s(o){return J(o)?ee(e,a,"whitespace")(o):a(o)}function a(o){return o===null||H(o)?t(o):n(o)}}const Ao={name:"hardBreakEscape",tokenize:No};function No(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return H(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const Do={name:"headingAtx",resolve:Mo,tokenize:Lo};function Mo(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ce(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function Lo(e,t,n){let r=0;return i;function i(p){return e.enter("atxHeading"),s(p)}function s(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||re(p)?(e.exit("atxHeadingSequence"),o(p)):n(p)}function o(p){return p===35?(e.enter("atxHeadingSequence"),l(p)):p===null||H(p)?(e.exit("atxHeading"),t(p)):J(p)?ee(e,o,"whitespace")(p):(e.enter("atxHeadingText"),u(p))}function l(p){return p===35?(e.consume(p),l):(e.exit("atxHeadingSequence"),o(p))}function u(p){return p===null||p===35||re(p)?(e.exit("atxHeadingText"),o(p)):(e.consume(p),u)}}const Ro=["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"],tr=["pre","script","style","textarea"],Po={concrete:!0,name:"htmlFlow",resolveTo:Oo,tokenize:Bo},Fo={partial:!0,tokenize:Ho},_o={partial:!0,tokenize:$o};function Oo(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Bo(e,t,n){const r=this;let i,s,a,o,l;return u;function u(g){return p(g)}function p(g){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(g),c}function c(g){return g===33?(e.consume(g),h):g===47?(e.consume(g),s=!0,w):g===63?(e.consume(g),i=3,r.interrupt?t:x):xe(g)?(e.consume(g),a=String.fromCharCode(g),S):n(g)}function h(g){return g===45?(e.consume(g),i=2,f):g===91?(e.consume(g),i=5,o=0,m):xe(g)?(e.consume(g),i=4,r.interrupt?t:x):n(g)}function f(g){return g===45?(e.consume(g),r.interrupt?t:x):n(g)}function m(g){const ae="CDATA[";return g===ae.charCodeAt(o++)?(e.consume(g),o===ae.length?r.interrupt?t:O:m):n(g)}function w(g){return xe(g)?(e.consume(g),a=String.fromCharCode(g),S):n(g)}function S(g){if(g===null||g===47||g===62||re(g)){const ae=g===47,_=a.toLowerCase();return!ae&&!s&&tr.includes(_)?(i=1,r.interrupt?t(g):O(g)):Ro.includes(a.toLowerCase())?(i=6,ae?(e.consume(g),b):r.interrupt?t(g):O(g)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(g):s?j(g):E(g))}return g===45||ge(g)?(e.consume(g),a+=String.fromCharCode(g),S):n(g)}function b(g){return g===62?(e.consume(g),r.interrupt?t:O):n(g)}function j(g){return J(g)?(e.consume(g),j):C(g)}function E(g){return g===47?(e.consume(g),C):g===58||g===95||xe(g)?(e.consume(g),R):J(g)?(e.consume(g),E):C(g)}function R(g){return g===45||g===46||g===58||g===95||ge(g)?(e.consume(g),R):N(g)}function N(g){return g===61?(e.consume(g),v):J(g)?(e.consume(g),N):E(g)}function v(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),l=g,A):J(g)?(e.consume(g),v):P(g)}function A(g){return g===l?(e.consume(g),l=null,B):g===null||H(g)?n(g):(e.consume(g),A)}function P(g){return g===null||g===34||g===39||g===47||g===60||g===61||g===62||g===96||re(g)?N(g):(e.consume(g),P)}function B(g){return g===47||g===62||J(g)?E(g):n(g)}function C(g){return g===62?(e.consume(g),D):n(g)}function D(g){return g===null||H(g)?O(g):J(g)?(e.consume(g),D):n(g)}function O(g){return g===45&&i===2?(e.consume(g),$):g===60&&i===1?(e.consume(g),Y):g===62&&i===4?(e.consume(g),q):g===63&&i===3?(e.consume(g),x):g===93&&i===5?(e.consume(g),U):H(g)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Fo,X,k)(g)):g===null||H(g)?(e.exit("htmlFlowData"),k(g)):(e.consume(g),O)}function k(g){return e.check(_o,I,X)(g)}function I(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),T}function T(g){return g===null||H(g)?k(g):(e.enter("htmlFlowData"),O(g))}function $(g){return g===45?(e.consume(g),x):O(g)}function Y(g){return g===47?(e.consume(g),a="",M):O(g)}function M(g){if(g===62){const ae=a.toLowerCase();return tr.includes(ae)?(e.consume(g),q):O(g)}return xe(g)&&a.length<8?(e.consume(g),a+=String.fromCharCode(g),M):O(g)}function U(g){return g===93?(e.consume(g),x):O(g)}function x(g){return g===62?(e.consume(g),q):g===45&&i===2?(e.consume(g),x):O(g)}function q(g){return g===null||H(g)?(e.exit("htmlFlowData"),X(g)):(e.consume(g),q)}function X(g){return e.exit("htmlFlow"),t(g)}}function $o(e,t,n){const r=this;return i;function i(a){return H(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Ho(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(ft,t,n)}}const Uo={name:"htmlText",tokenize:Wo};function Wo(e,t,n){const r=this;let i,s,a;return o;function o(x){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(x),l}function l(x){return x===33?(e.consume(x),u):x===47?(e.consume(x),N):x===63?(e.consume(x),E):xe(x)?(e.consume(x),P):n(x)}function u(x){return x===45?(e.consume(x),p):x===91?(e.consume(x),s=0,m):xe(x)?(e.consume(x),j):n(x)}function p(x){return x===45?(e.consume(x),f):n(x)}function c(x){return x===null?n(x):x===45?(e.consume(x),h):H(x)?(a=c,Y(x)):(e.consume(x),c)}function h(x){return x===45?(e.consume(x),f):c(x)}function f(x){return x===62?$(x):x===45?h(x):c(x)}function m(x){const q="CDATA[";return x===q.charCodeAt(s++)?(e.consume(x),s===q.length?w:m):n(x)}function w(x){return x===null?n(x):x===93?(e.consume(x),S):H(x)?(a=w,Y(x)):(e.consume(x),w)}function S(x){return x===93?(e.consume(x),b):w(x)}function b(x){return x===62?$(x):x===93?(e.consume(x),b):w(x)}function j(x){return x===null||x===62?$(x):H(x)?(a=j,Y(x)):(e.consume(x),j)}function E(x){return x===null?n(x):x===63?(e.consume(x),R):H(x)?(a=E,Y(x)):(e.consume(x),E)}function R(x){return x===62?$(x):E(x)}function N(x){return xe(x)?(e.consume(x),v):n(x)}function v(x){return x===45||ge(x)?(e.consume(x),v):A(x)}function A(x){return H(x)?(a=A,Y(x)):J(x)?(e.consume(x),A):$(x)}function P(x){return x===45||ge(x)?(e.consume(x),P):x===47||x===62||re(x)?B(x):n(x)}function B(x){return x===47?(e.consume(x),$):x===58||x===95||xe(x)?(e.consume(x),C):H(x)?(a=B,Y(x)):J(x)?(e.consume(x),B):$(x)}function C(x){return x===45||x===46||x===58||x===95||ge(x)?(e.consume(x),C):D(x)}function D(x){return x===61?(e.consume(x),O):H(x)?(a=D,Y(x)):J(x)?(e.consume(x),D):B(x)}function O(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),i=x,k):H(x)?(a=O,Y(x)):J(x)?(e.consume(x),O):(e.consume(x),I)}function k(x){return x===i?(e.consume(x),i=void 0,T):x===null?n(x):H(x)?(a=k,Y(x)):(e.consume(x),k)}function I(x){return x===null||x===34||x===39||x===60||x===61||x===96?n(x):x===47||x===62||re(x)?B(x):(e.consume(x),I)}function T(x){return x===47||x===62||re(x)?B(x):n(x)}function $(x){return x===62?(e.consume(x),e.exit("htmlTextData"),e.exit("htmlText"),t):n(x)}function Y(x){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),M}function M(x){return J(x)?ee(e,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):U(x)}function U(x){return e.enter("htmlTextData"),a(x)}}const Cn={name:"labelEnd",resolveAll:Go,resolveTo:Xo,tokenize:Ko},qo={tokenize:Qo},Vo={tokenize:Jo},Yo={tokenize:Zo};function Go(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Ce(e,0,e.length,n),e}function Xo(e,t){let n=e.length,r=0,i,s,a,o;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[a][1].end}},p={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[a-2][1].start}};return o=[["enter",l,t],["enter",u,t]],o=je(o,e.slice(s+1,s+r+3)),o=je(o,[["enter",p,t]]),o=je(o,Dt(t.parser.constructs.insideSpan.null,e.slice(s+r+4,a-3),t)),o=je(o,[["exit",p,t],e[a-2],e[a-1],["exit",u,t]]),o=je(o,e.slice(a+1)),o=je(o,[["exit",l,t]]),Ce(e,s,e.length,o),e}function Ko(e,t,n){const r=this;let i=r.events.length,s,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return o;function o(h){return s?s._inactive?c(h):(a=r.parser.defined.includes(Ie(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(qo,p,a?p:c)(h):h===91?e.attempt(Vo,p,a?u:c)(h):a?p(h):c(h)}function u(h){return e.attempt(Yo,p,c)(h)}function p(h){return t(h)}function c(h){return s._balanced=!0,n(h)}}function Qo(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return re(c)?lt(e,s)(c):s(c)}function s(c){return c===41?p(c):hi(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function a(c){return re(c)?lt(e,l)(c):p(c)}function o(c){return n(c)}function l(c){return c===34||c===39||c===40?mi(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):p(c)}function u(c){return re(c)?lt(e,p)(c):p(c)}function p(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function Jo(e,t,n){const r=this;return i;function i(o){return gi.call(r,e,s,a,"reference","referenceMarker","referenceString")(o)}function s(o){return r.parser.defined.includes(Ie(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function Zo(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const el={name:"labelStartImage",resolveAll:Cn.resolveAll,tokenize:tl};function tl(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),s}function s(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),a):n(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const nl={name:"labelStartLink",resolveAll:Cn.resolveAll,tokenize:rl};function rl(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const $t={name:"lineEnding",tokenize:il};function il(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ee(e,t,"linePrefix")}}const Ct={name:"thematicBreak",tokenize:al};function al(e,t,n){let r=0,i;return s;function s(u){return e.enter("thematicBreak"),a(u)}function a(u){return i=u,o(u)}function o(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||H(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),J(u)?ee(e,o,"whitespace")(u):o(u))}}const be={continuation:{tokenize:ul},exit:dl,name:"list",tokenize:ll},sl={partial:!0,tokenize:pl},ol={partial:!0,tokenize:cl};function ll(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return o;function o(f){const m=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:on(f)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Ct,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(f)}return n(f)}function l(f){return on(f)&&++a<10?(e.consume(f),l):(!r.interrupt||a<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(ft,r.interrupt?n:p,e.attempt(sl,h,c))}function p(f){return r.containerState.initialBlankLine=!0,s++,h(f)}function c(f){return J(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function ul(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ft,i,s);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ee(e,t,"listItemIndent",r.containerState.size+1)(o)}function s(o){return r.containerState.furtherBlankLines||!J(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ol,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ee(e,e.attempt(be,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function cl(e,t,n){const r=this;return ee(e,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(s):n(s)}}function dl(e){e.exit(this.containerState.type)}function pl(e,t,n){const r=this;return ee(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!J(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const nr={name:"setextUnderline",resolveTo:fl,tokenize:hl};function fl(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",a,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function hl(e,t,n){const r=this;let i;return s;function s(u){let p=r.events.length,c;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){c=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===i?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),J(u)?ee(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||H(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const gl={tokenize:ml};function ml(e){const t=this,n=e.attempt(ft,r,e.attempt(this.parser.constructs.flowInitial,i,ee(e,e.attempt(this.parser.constructs.flow,i,e.attempt(ko,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const xl={resolveAll:bi()},bl=xi("string"),wl=xi("text");function xi(e){return{resolveAll:bi(e==="text"?yl:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,a,o);return a;function a(p){return u(p)?s(p):o(p)}function o(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),l}function l(p){return u(p)?(n.exit("data"),s(p)):(n.consume(p),l)}function u(p){if(p===null)return!0;const c=i[p];let h=-1;if(c)for(;++h<c.length;){const f=c[h];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function bi(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function yl(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,a=-1,o=0,l;for(;s--;){const u=i[s];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(u===-2)l=!0,o++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const u={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const kl={42:be,43:be,45:be,48:be,49:be,50:be,51:be,52:be,53:be,54:be,55:be,56:be,57:be,62:ci},vl={91:Eo},Cl={[-2]:Bt,[-1]:Bt,32:Bt},Sl={35:Do,42:Ct,45:[nr,Ct],60:Po,61:nr,95:Ct,96:er,126:er},jl={38:pi,92:di},El={[-5]:$t,[-4]:$t,[-3]:$t,33:el,38:pi,42:ln,60:[to,Uo],91:nl,92:[Ao,di],93:Cn,95:ln,96:go},Il={null:[ln,xl]},zl={null:[42,95]},Tl={null:[]},Al=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:zl,contentInitial:vl,disable:Tl,document:kl,flow:Sl,flowInitial:Cl,insideSpan:Il,string:jl,text:El},Symbol.toStringTag,{value:"Module"}));function Nl(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let a=[],o=[];const l={attempt:A(N),check:A(v),consume:j,enter:E,exit:R,interrupt:A(v,{interrupt:!0})},u={code:null,containerState:{},defineSkip:w,events:[],now:m,parser:e,previous:null,sliceSerialize:h,sliceStream:f,write:c};let p=t.tokenize.call(u,l);return t.resolveAll&&s.push(t),u;function c(D){return a=je(a,D),S(),a[a.length-1]!==null?[]:(P(t,0),u.events=Dt(s,u.events,u),u.events)}function h(D,O){return Ml(f(D),O)}function f(D){return Dl(a,D)}function m(){const{_bufferIndex:D,_index:O,line:k,column:I,offset:T}=r;return{_bufferIndex:D,_index:O,line:k,column:I,offset:T}}function w(D){i[D.line]=D.column,C()}function S(){let D;for(;r._index<a.length;){const O=a[r._index];if(typeof O=="string")for(D=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===D&&r._bufferIndex<O.length;)b(O.charCodeAt(r._bufferIndex));else b(O)}}function b(D){p=p(D)}function j(D){H(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,C()):D!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=D}function E(D,O){const k=O||{};return k.type=D,k.start=m(),u.events.push(["enter",k,u]),o.push(k),k}function R(D){const O=o.pop();return O.end=m(),u.events.push(["exit",O,u]),O}function N(D,O){P(D,O.from)}function v(D,O){O.restore()}function A(D,O){return k;function k(I,T,$){let Y,M,U,x;return Array.isArray(I)?X(I):"tokenize"in I?X([I]):q(I);function q(V){return se;function se(ie){const ue=ie!==null&&V[ie],oe=ie!==null&&V.null,W=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(oe)?oe:oe?[oe]:[]];return X(W)(ie)}}function X(V){return Y=V,M=0,V.length===0?$:g(V[M])}function g(V){return se;function se(ie){return x=B(),U=V,V.partial||(u.currentConstruct=V),V.name&&u.parser.constructs.disable.null.includes(V.name)?_():V.tokenize.call(O?Object.assign(Object.create(u),O):u,l,ae,_)(ie)}}function ae(V){return D(U,x),T}function _(V){return x.restore(),++M<Y.length?g(Y[M]):$}}}function P(D,O){D.resolveAll&&!s.includes(D)&&s.push(D),D.resolve&&Ce(u.events,O,u.events.length-O,D.resolve(u.events.slice(O),u)),D.resolveTo&&(u.events=D.resolveTo(u.events,u))}function B(){const D=m(),O=u.previous,k=u.currentConstruct,I=u.events.length,T=Array.from(o);return{from:I,restore:$};function $(){r=D,u.previous=O,u.currentConstruct=k,u.events.length=I,o=T,C()}}function C(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Dl(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,s)];else{if(a=e.slice(n,i),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}s>0&&a.push(e[i].slice(0,s))}return a}function Ml(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=`
|
|
3
3
|
`;break}case-3:{a=`\r
|
|
4
|
-
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(s)}i=s===-2,r.push(a)}return r.join("")}function Nl(e){const r={constructs:si([Il,...(e||{}).extensions||[]]),content:i(qs),defined:[],document:i(Ys),flow:i(pl),lazy:{},string:i(gl),text:i(ml)};return r;function i(s){return a;function a(o){return zl(r,s,o)}}}function Ll(e){for(;!di(e););return e}const tr=/[\0\t\n\r]/g;function Dl(){let e=1,t="",n=!0,r;return i;function i(s,a,o){const l=[];let u,p,c,h,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),c=0,t="",n&&(s.charCodeAt(0)===65279&&c++,n=void 0);c<s.length;){if(tr.lastIndex=c,u=tr.exec(s),h=u&&u.index!==void 0?u.index:s.length,f=s.charCodeAt(h),!u){t=s.slice(c);break}if(f===10&&c===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),c<h&&(l.push(s.slice(c,h)),e+=h-c),f){case 0:{l.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,l.push(-2);e++<p;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}c=h+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Ml=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Rl(e){return e.replace(Ml,Pl)}function Pl(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return oi(n.slice(s?2:1),s?16:10)}return kn(n)||e}const xi={}.hasOwnProperty;function Fl(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),_l(n)(Ll(Nl(n).document().write(Dl()(e,t,!0))))}function _l(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Je),autolinkProtocol:O,autolinkEmail:O,atxHeading:s(Ke),blockQuote:s(se),characterEscape:O,characterReference:O,codeFenced:s(le),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(le,a),codeText:s(Ee,a),codeTextData:O,data:O,codeFlowValue:O,definition:s(be),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(Lt),hardBreakEscape:s(Qe),hardBreakTrailing:s(Qe),htmlFlow:s(Pe,a),htmlFlowData:O,htmlText:s(Pe,a),htmlTextData:O,image:s(Dt),label:a,link:s(Je),listItem:s(ve),listItemValue:h,listOrdered:s(Ze,c),listUnordered:s(Ze),paragraph:s(ht),reference:g,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(Ke),strong:s(Mt),thematicBreak:s(Rt)},exit:{atxHeading:l(),atxHeadingSequence:A,autolink:l(),autolinkEmail:W,autolinkProtocol:ae,blockQuote:l(),characterEscapeValue:v,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:ee,characterReference:ue,codeFenced:l(C),codeFencedFence:w,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:v,codeIndented:l(b),codeText:l(F),codeTextData:v,data:v,definition:l(),definitionDestinationString:L,definitionLabelString:S,definitionTitleString:j,emphasis:l(),hardBreakEscape:l(T),hardBreakTrailing:l(T),htmlFlow:l(E),htmlFlowData:v,htmlText:l(I),htmlTextData:v,image:l(U),label:B,labelText:P,lineEnding:D,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Y,resourceDestinationString:x,resourceTitleString:H,resource:$,setextHeading:l(_),setextHeadingLineSequence:N,setextHeadingText:k,strong:l(),thematicBreak:l()}};bi(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(z){let R={type:"root",children:[]};const G={stack:[R],tokenStack:[],config:t,enter:o,exit:u,buffer:a,resume:p,data:n},K=[];let ne=-1;for(;++ne<z.length;)if(z[ne][1].type==="listOrdered"||z[ne][1].type==="listUnordered")if(z[ne][0]==="enter")K.push(ne);else{const Se=K.pop();ne=i(z,Se,ne)}for(ne=-1;++ne<z.length;){const Se=t[z[ne][0]];xi.call(Se,z[ne][1].type)&&Se[z[ne][1].type].call(Object.assign({sliceSerialize:z[ne][2].sliceSerialize},G),z[ne][1])}if(G.tokenStack.length>0){const Se=G.tokenStack[G.tokenStack.length-1];(Se[1]||nr).call(G,void 0,Se[0])}for(R.position={start:De(z.length>0?z[0][1].start:{line:1,column:1,offset:0}),end:De(z.length>0?z[z.length-2][1].end:{line:1,column:1,offset:0})},ne=-1;++ne<t.transforms.length;)R=t.transforms[ne](R)||R;return R}function i(z,R,G){let K=R-1,ne=-1,Se=!1,Fe,Ae,et,tt;for(;++K<=G;){const we=z[K];switch(we[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{we[0]==="enter"?ne++:ne--,tt=void 0;break}case"lineEndingBlank":{we[0]==="enter"&&(Fe&&!tt&&!ne&&!et&&(et=K),tt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:tt=void 0}if(!ne&&we[0]==="enter"&&we[1].type==="listItemPrefix"||ne===-1&&we[0]==="exit"&&(we[1].type==="listUnordered"||we[1].type==="listOrdered")){if(Fe){let qe=K;for(Ae=void 0;qe--;){const Ne=z[qe];if(Ne[1].type==="lineEnding"||Ne[1].type==="lineEndingBlank"){if(Ne[0]==="exit")continue;Ae&&(z[Ae][1].type="lineEndingBlank",Se=!0),Ne[1].type="lineEnding",Ae=qe}else if(!(Ne[1].type==="linePrefix"||Ne[1].type==="blockQuotePrefix"||Ne[1].type==="blockQuotePrefixWhitespace"||Ne[1].type==="blockQuoteMarker"||Ne[1].type==="listItemIndent"))break}et&&(!Ae||et<Ae)&&(Fe._spread=!0),Fe.end=Object.assign({},Ae?z[Ae][1].start:we[1].end),z.splice(Ae||K,0,["exit",Fe,we[2]]),K++,G++}if(we[1].type==="listItemPrefix"){const qe={type:"listItem",_spread:!1,start:Object.assign({},we[1].start),end:void 0};Fe=qe,z.splice(K,0,["enter",qe,we[2]]),K++,G++,et=void 0,tt=!0}}}return z[R][1]._spread=Se,G}function s(z,R){return G;function G(K){o.call(this,z(K),K),R&&R.call(this,K)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(z,R,G){this.stack[this.stack.length-1].children.push(z),this.stack.push(z),this.tokenStack.push([R,G||void 0]),z.position={start:De(R.start),end:void 0}}function l(z){return R;function R(G){z&&z.call(this,G),u.call(this,G)}}function u(z,R){const G=this.stack.pop(),K=this.tokenStack.pop();if(K)K[0].type!==z.type&&(R?R.call(this,z,K[0]):(K[1]||nr).call(this,z,K[0]));else throw new Error("Cannot close `"+z.type+"` ("+st({start:z.start,end:z.end})+"): it’s not open");G.position.end=De(z.end)}function p(){return yn(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function h(z){if(this.data.expectingFirstListItemValue){const R=this.stack[this.stack.length-2];R.start=Number.parseInt(this.sliceSerialize(z),10),this.data.expectingFirstListItemValue=void 0}}function f(){const z=this.resume(),R=this.stack[this.stack.length-1];R.lang=z}function m(){const z=this.resume(),R=this.stack[this.stack.length-1];R.meta=z}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const z=this.resume(),R=this.stack[this.stack.length-1];R.value=z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const z=this.resume(),R=this.stack[this.stack.length-1];R.value=z.replace(/(\r?\n|\r)$/g,"")}function S(z){const R=this.resume(),G=this.stack[this.stack.length-1];G.label=R,G.identifier=je(this.sliceSerialize(z)).toLowerCase()}function j(){const z=this.resume(),R=this.stack[this.stack.length-1];R.title=z}function L(){const z=this.resume(),R=this.stack[this.stack.length-1];R.url=z}function A(z){const R=this.stack[this.stack.length-1];if(!R.depth){const G=this.sliceSerialize(z).length;R.depth=G}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function N(z){const R=this.stack[this.stack.length-1];R.depth=this.sliceSerialize(z).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function O(z){const G=this.stack[this.stack.length-1].children;let K=G[G.length-1];(!K||K.type!=="text")&&(K=Ve(),K.position={start:De(z.start),end:void 0},G.push(K)),this.stack.push(K)}function v(z){const R=this.stack.pop();R.value+=this.sliceSerialize(z),R.position.end=De(z.end)}function D(z){const R=this.stack[this.stack.length-1];if(this.data.atHardBreak){const G=R.children[R.children.length-1];G.position.end=De(z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(R.type)&&(O.call(this,z),v.call(this,z))}function T(){this.data.atHardBreak=!0}function E(){const z=this.resume(),R=this.stack[this.stack.length-1];R.value=z}function I(){const z=this.resume(),R=this.stack[this.stack.length-1];R.value=z}function F(){const z=this.resume(),R=this.stack[this.stack.length-1];R.value=z}function q(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const R=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=R,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function U(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const R=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=R,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function P(z){const R=this.sliceSerialize(z),G=this.stack[this.stack.length-2];G.label=Rl(R),G.identifier=je(R).toLowerCase()}function B(){const z=this.stack[this.stack.length-1],R=this.resume(),G=this.stack[this.stack.length-1];if(this.data.inReference=!0,G.type==="link"){const K=z.children;G.children=K}else G.alt=R}function x(){const z=this.resume(),R=this.stack[this.stack.length-1];R.url=z}function H(){const z=this.resume(),R=this.stack[this.stack.length-1];R.title=z}function $(){this.data.inReference=void 0}function g(){this.data.referenceType="collapsed"}function Y(z){const R=this.resume(),G=this.stack[this.stack.length-1];G.label=R,G.identifier=je(this.sliceSerialize(z)).toLowerCase(),this.data.referenceType="full"}function te(z){this.data.characterReferenceType=z.type}function ee(z){const R=this.sliceSerialize(z),G=this.data.characterReferenceType;let K;G?(K=oi(R,G==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):K=kn(R);const ne=this.stack[this.stack.length-1];ne.value+=K}function ue(z){const R=this.stack.pop();R.position.end=De(z.end)}function ae(z){v.call(this,z);const R=this.stack[this.stack.length-1];R.url=this.sliceSerialize(z)}function W(z){v.call(this,z);const R=this.stack[this.stack.length-1];R.url="mailto:"+this.sliceSerialize(z)}function se(){return{type:"blockquote",children:[]}}function le(){return{type:"code",lang:null,meta:null,value:""}}function Ee(){return{type:"inlineCode",value:""}}function be(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Lt(){return{type:"emphasis",children:[]}}function Ke(){return{type:"heading",depth:0,children:[]}}function Qe(){return{type:"break"}}function Pe(){return{type:"html",value:""}}function Dt(){return{type:"image",title:null,url:"",alt:null}}function Je(){return{type:"link",title:null,url:"",children:[]}}function Ze(z){return{type:"list",ordered:z.type==="listOrdered",start:null,spread:z._spread,children:[]}}function ve(z){return{type:"listItem",spread:z._spread,checked:null,children:[]}}function ht(){return{type:"paragraph",children:[]}}function Mt(){return{type:"strong",children:[]}}function Ve(){return{type:"text",value:""}}function Rt(){return{type:"thematicBreak"}}}function De(e){return{line:e.line,column:e.column,offset:e.offset}}function bi(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?bi(e,r):Ol(e,r)}}function Ol(e,t){let n;for(n in t)if(xi.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function nr(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+st({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+st({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+st({start:t.start,end:t.end})+") is still open")}function Bl(e){const t=this;t.parser=n;function n(r){return Fl(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function $l(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Hl(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
5
|
-
`}]}function
|
|
6
|
-
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function
|
|
4
|
+
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(s)}i=s===-2,r.push(a)}return r.join("")}function Ll(e){const r={constructs:li([Al,...(e||{}).extensions||[]]),content:i(Gs),defined:[],document:i(Ks),flow:i(gl),lazy:{},string:i(bl),text:i(wl)};return r;function i(s){return a;function a(o){return Nl(r,s,o)}}}function Rl(e){for(;!fi(e););return e}const rr=/[\0\t\n\r]/g;function Pl(){let e=1,t="",n=!0,r;return i;function i(s,a,o){const l=[];let u,p,c,h,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),c=0,t="",n&&(s.charCodeAt(0)===65279&&c++,n=void 0);c<s.length;){if(rr.lastIndex=c,u=rr.exec(s),h=u&&u.index!==void 0?u.index:s.length,f=s.charCodeAt(h),!u){t=s.slice(c);break}if(f===10&&c===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),c<h&&(l.push(s.slice(c,h)),e+=h-c),f){case 0:{l.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,l.push(-2);e++<p;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}c=h+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Fl=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function _l(e){return e.replace(Fl,Ol)}function Ol(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return ui(n.slice(s?2:1),s?16:10)}return vn(n)||e}const wi={}.hasOwnProperty;function Bl(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),$l(n)(Rl(Ll(n).document().write(Pl()(e,t,!0))))}function $l(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(mt),autolinkProtocol:B,autolinkEmail:B,atxHeading:s(Le),blockQuote:s(oe),characterEscape:B,characterReference:B,codeFenced:s(W),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(W,a),codeText:s(ce,a),codeTextData:B,data:B,codeFlowValue:B,definition:s(de),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(ye),hardBreakEscape:s(Je),hardBreakTrailing:s(Je),htmlFlow:s(Ze,a),htmlFlowData:B,htmlText:s(Ze,a),htmlTextData:B,image:s(qe),label:a,link:s(mt),listItem:s(xt),listItemValue:h,listOrdered:s(et,c),listUnordered:s(et),paragraph:s(Se),reference:g,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(Le),strong:s(bt),thematicBreak:s(Ve)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:ue,autolinkProtocol:ie,blockQuote:l(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:_,characterReferenceMarkerNumeric:_,characterReferenceValue:V,characterReference:se,codeFenced:l(S),codeFencedFence:w,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:C,codeIndented:l(b),codeText:l(T),codeTextData:C,data:C,definition:l(),definitionDestinationString:R,definitionLabelString:j,definitionTitleString:E,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l(k),htmlFlowData:C,htmlText:l(I),htmlTextData:C,image:l(Y),label:U,labelText:M,lineEnding:D,link:l($),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ae,resourceDestinationString:x,resourceTitleString:q,resource:X,setextHeading:l(P),setextHeadingLineSequence:A,setextHeadingText:v,strong:l(),thematicBreak:l()}};yi(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(z){let F={type:"root",children:[]};const G={stack:[F],tokenStack:[],config:t,enter:o,exit:u,buffer:a,resume:p,data:n},Q=[];let te=-1;for(;++te<z.length;)if(z[te][1].type==="listOrdered"||z[te][1].type==="listUnordered")if(z[te][0]==="enter")Q.push(te);else{const Ee=Q.pop();te=i(z,Ee,te)}for(te=-1;++te<z.length;){const Ee=t[z[te][0]];wi.call(Ee,z[te][1].type)&&Ee[z[te][1].type].call(Object.assign({sliceSerialize:z[te][2].sliceSerialize},G),z[te][1])}if(G.tokenStack.length>0){const Ee=G.tokenStack[G.tokenStack.length-1];(Ee[1]||ir).call(G,void 0,Ee[0])}for(F.position={start:Re(z.length>0?z[0][1].start:{line:1,column:1,offset:0}),end:Re(z.length>0?z[z.length-2][1].end:{line:1,column:1,offset:0})},te=-1;++te<t.transforms.length;)F=t.transforms[te](F)||F;return F}function i(z,F,G){let Q=F-1,te=-1,Ee=!1,_e,Ne,tt,nt;for(;++Q<=G;){const ke=z[Q];switch(ke[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ke[0]==="enter"?te++:te--,nt=void 0;break}case"lineEndingBlank":{ke[0]==="enter"&&(_e&&!nt&&!te&&!tt&&(tt=Q),nt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:nt=void 0}if(!te&&ke[0]==="enter"&&ke[1].type==="listItemPrefix"||te===-1&&ke[0]==="exit"&&(ke[1].type==="listUnordered"||ke[1].type==="listOrdered")){if(_e){let Ye=Q;for(Ne=void 0;Ye--;){const De=z[Ye];if(De[1].type==="lineEnding"||De[1].type==="lineEndingBlank"){if(De[0]==="exit")continue;Ne&&(z[Ne][1].type="lineEndingBlank",Ee=!0),De[1].type="lineEnding",Ne=Ye}else if(!(De[1].type==="linePrefix"||De[1].type==="blockQuotePrefix"||De[1].type==="blockQuotePrefixWhitespace"||De[1].type==="blockQuoteMarker"||De[1].type==="listItemIndent"))break}tt&&(!Ne||tt<Ne)&&(_e._spread=!0),_e.end=Object.assign({},Ne?z[Ne][1].start:ke[1].end),z.splice(Ne||Q,0,["exit",_e,ke[2]]),Q++,G++}if(ke[1].type==="listItemPrefix"){const Ye={type:"listItem",_spread:!1,start:Object.assign({},ke[1].start),end:void 0};_e=Ye,z.splice(Q,0,["enter",Ye,ke[2]]),Q++,G++,tt=void 0,nt=!0}}}return z[F][1]._spread=Ee,G}function s(z,F){return G;function G(Q){o.call(this,z(Q),Q),F&&F.call(this,Q)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(z,F,G){this.stack[this.stack.length-1].children.push(z),this.stack.push(z),this.tokenStack.push([F,G||void 0]),z.position={start:Re(F.start),end:void 0}}function l(z){return F;function F(G){z&&z.call(this,G),u.call(this,G)}}function u(z,F){const G=this.stack.pop(),Q=this.tokenStack.pop();if(Q)Q[0].type!==z.type&&(F?F.call(this,z,Q[0]):(Q[1]||ir).call(this,z,Q[0]));else throw new Error("Cannot close `"+z.type+"` ("+ot({start:z.start,end:z.end})+"): it’s not open");G.position.end=Re(z.end)}function p(){return kn(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function h(z){if(this.data.expectingFirstListItemValue){const F=this.stack[this.stack.length-2];F.start=Number.parseInt(this.sliceSerialize(z),10),this.data.expectingFirstListItemValue=void 0}}function f(){const z=this.resume(),F=this.stack[this.stack.length-1];F.lang=z}function m(){const z=this.resume(),F=this.stack[this.stack.length-1];F.meta=z}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const z=this.resume(),F=this.stack[this.stack.length-1];F.value=z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const z=this.resume(),F=this.stack[this.stack.length-1];F.value=z.replace(/(\r?\n|\r)$/g,"")}function j(z){const F=this.resume(),G=this.stack[this.stack.length-1];G.label=F,G.identifier=Ie(this.sliceSerialize(z)).toLowerCase()}function E(){const z=this.resume(),F=this.stack[this.stack.length-1];F.title=z}function R(){const z=this.resume(),F=this.stack[this.stack.length-1];F.url=z}function N(z){const F=this.stack[this.stack.length-1];if(!F.depth){const G=this.sliceSerialize(z).length;F.depth=G}}function v(){this.data.setextHeadingSlurpLineEnding=!0}function A(z){const F=this.stack[this.stack.length-1];F.depth=this.sliceSerialize(z).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function B(z){const G=this.stack[this.stack.length-1].children;let Q=G[G.length-1];(!Q||Q.type!=="text")&&(Q=Pt(),Q.position={start:Re(z.start),end:void 0},G.push(Q)),this.stack.push(Q)}function C(z){const F=this.stack.pop();F.value+=this.sliceSerialize(z),F.position.end=Re(z.end)}function D(z){const F=this.stack[this.stack.length-1];if(this.data.atHardBreak){const G=F.children[F.children.length-1];G.position.end=Re(z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(F.type)&&(B.call(this,z),C.call(this,z))}function O(){this.data.atHardBreak=!0}function k(){const z=this.resume(),F=this.stack[this.stack.length-1];F.value=z}function I(){const z=this.resume(),F=this.stack[this.stack.length-1];F.value=z}function T(){const z=this.resume(),F=this.stack[this.stack.length-1];F.value=z}function $(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const F=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=F,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function Y(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const F=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=F,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function M(z){const F=this.sliceSerialize(z),G=this.stack[this.stack.length-2];G.label=_l(F),G.identifier=Ie(F).toLowerCase()}function U(){const z=this.stack[this.stack.length-1],F=this.resume(),G=this.stack[this.stack.length-1];if(this.data.inReference=!0,G.type==="link"){const Q=z.children;G.children=Q}else G.alt=F}function x(){const z=this.resume(),F=this.stack[this.stack.length-1];F.url=z}function q(){const z=this.resume(),F=this.stack[this.stack.length-1];F.title=z}function X(){this.data.inReference=void 0}function g(){this.data.referenceType="collapsed"}function ae(z){const F=this.resume(),G=this.stack[this.stack.length-1];G.label=F,G.identifier=Ie(this.sliceSerialize(z)).toLowerCase(),this.data.referenceType="full"}function _(z){this.data.characterReferenceType=z.type}function V(z){const F=this.sliceSerialize(z),G=this.data.characterReferenceType;let Q;G?(Q=ui(F,G==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Q=vn(F);const te=this.stack[this.stack.length-1];te.value+=Q}function se(z){const F=this.stack.pop();F.position.end=Re(z.end)}function ie(z){C.call(this,z);const F=this.stack[this.stack.length-1];F.url=this.sliceSerialize(z)}function ue(z){C.call(this,z);const F=this.stack[this.stack.length-1];F.url="mailto:"+this.sliceSerialize(z)}function oe(){return{type:"blockquote",children:[]}}function W(){return{type:"code",lang:null,meta:null,value:""}}function ce(){return{type:"inlineCode",value:""}}function de(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ye(){return{type:"emphasis",children:[]}}function Le(){return{type:"heading",depth:0,children:[]}}function Je(){return{type:"break"}}function Ze(){return{type:"html",value:""}}function qe(){return{type:"image",title:null,url:"",alt:null}}function mt(){return{type:"link",title:null,url:"",children:[]}}function et(z){return{type:"list",ordered:z.type==="listOrdered",start:null,spread:z._spread,children:[]}}function xt(z){return{type:"listItem",spread:z._spread,checked:null,children:[]}}function Se(){return{type:"paragraph",children:[]}}function bt(){return{type:"strong",children:[]}}function Pt(){return{type:"text",value:""}}function Ve(){return{type:"thematicBreak"}}}function Re(e){return{line:e.line,column:e.column,offset:e.offset}}function yi(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?yi(e,r):Hl(e,r)}}function Hl(e,t){let n;for(n in t)if(wi.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function ir(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ot({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ot({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ot({start:t.start,end:t.end})+") is still open")}function Ul(e){const t=this;t.parser=n;function n(r){return Bl(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Wl(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function ql(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
5
|
+
`}]}function Vl(e,t){const n=t.value?t.value+`
|
|
6
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function Yl(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Gl(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Xl(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Qe(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=s+1,o+=1,e.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function Kl(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ql(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ki(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function Jl(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ki(e,t);const i={src:Qe(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function Zl(e,t){const n={src:Qe(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function eu(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function tu(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ki(e,t);const i={href:Qe(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function nu(e,t){const n={href:Qe(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function ru(e,t,n){const r=e.all(t),i=n?iu(n):vi(t),s={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let c;p&&p.type==="element"&&p.tagName==="p"?c=p:(c={type:"element",tagName:"p",properties:{},children:[]},r.unshift(c)),c.children.length>0&&c.children.unshift({type:"text",value:" "}),c.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const p=r[o];(i||o!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
|
|
7
7
|
`}),p.type==="element"&&p.tagName==="p"&&!i?a.push(...p.children):a.push(p)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
|
|
8
|
-
`});const u={type:"element",tagName:"li",properties:s,children:a};return e.patch(t,u),e.applyData(t,u)}function
|
|
8
|
+
`});const u={type:"element",tagName:"li",properties:s,children:a};return e.patch(t,u),e.applyData(t,u)}function iu(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=vi(n[r])}return t}function vi(e){const t=e.spread;return t??e.children.length>1}function au(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function su(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ou(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function lu(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uu(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=xn(t.children[1]),l=ti(t.children[t.children.length-1]);o&&l&&(a.position={start:o,end:l}),i.push(a)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function cu(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let l=-1;const u=[];for(;++l<o;){const c=t.children[l],h={},f=a?a[l]:void 0;f&&(h.align=f);let m={type:"element",tagName:s,properties:h,children:[]};c&&(m.children=e.all(c),e.patch(c,m),m=e.applyData(c,m)),u.push(m)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,p),e.applyData(t,p)}function du(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ar=9,sr=32;function pu(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(or(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(or(t.slice(i),i>0,!1)),s.join("")}function or(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===ar||s===sr;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===ar||s===sr;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function fu(e,t){const n={type:"text",value:pu(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function hu(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const gu={blockquote:Wl,break:ql,code:Vl,delete:Yl,emphasis:Gl,footnoteReference:Xl,heading:Kl,html:Ql,imageReference:Jl,image:Zl,inlineCode:eu,linkReference:tu,link:nu,listItem:ru,list:au,paragraph:su,root:ou,strong:lu,table:uu,tableCell:du,tableRow:cu,text:fu,thematicBreak:hu,toml:wt,yaml:wt,definition:wt,footnoteDefinition:wt};function wt(){}const Ci=-1,Mt=0,ut=1,It=2,Sn=3,jn=4,En=5,In=6,Si=7,ji=8,{defineProperty:mu}=Object,Ei=typeof self=="object"?self:globalThis,lr=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Ei[e](t)},xu=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,a]=t[i];switch(s){case Mt:case Ci:return n(a,i);case ut:{const o=n([],i);for(const l of a)o.push(r(l));return o}case It:{const o=n({},i);for(const[l,u]of a){const p=r(l),c=r(u);p==="__proto__"?mu(o,p,{value:c,configurable:!0,enumerable:!0,writable:!0}):o[p]=c}return o}case Sn:return n(new Date(a),i);case jn:{const{source:o,flags:l}=a;return n(new RegExp(o,l),i)}case En:{const o=n(new Map,i);for(const[l,u]of a)o.set(r(l),r(u));return o}case In:{const o=n(new Set,i);for(const l of a)o.add(r(l));return o}case Si:{const{name:o,message:l}=a;return n(typeof Ei[o]=="function"?lr(o,l):new Error(l),i)}case ji:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}case"-0":return-0}return n(lr(s,a),i)};return r},ur=e=>xu(new Map,e)(0),Be="",{toString:bu}={},{keys:wu,is:yu}=Object,st=e=>{const t=typeof e;if(t!=="object"||!e)return[Mt,t];const n=bu.call(e).slice(8,-1);switch(n){case"Array":return[ut,Be];case"Object":return[It,Be];case"Date":return[Sn,Be];case"RegExp":return[jn,Be];case"Map":return[En,Be];case"Set":return[In,Be];case"DataView":return[ut,n]}return n.includes("Array")?[ut,n]:e instanceof Error?[Si,e.name||"Error"]:[It,n]},yt=([e,t])=>e===Mt&&(t==="function"||t==="symbol"),ku=(e,t,n,r)=>{const i=(a,o)=>{const l=r.push(a)-1;return n.set(o,l),l},s=a=>{if(n.has(a))return n.get(a);let[o,l]=st(a);switch(o){case Mt:{let p=a;switch(l){case"bigint":o=ji,p=a.toString();break;case"number":if(!a&&yu(a,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);p=null;break;case"undefined":return i([Ci],a)}return i([o,p],a)}case ut:{if(l){let h=a;return l==="DataView"?h=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(a)),i([l,[...h]],a)}const p=[],c=i([o,p],a);for(const h of a)p.push(s(h));return c}case It:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(t&&"toJSON"in a)return s(a.toJSON());const p=[],c=i([o,p],a);for(const h of wu(a))(e||!yt(st(a[h])))&&p.push([s(h),s(a[h])]);return c}case Sn:return i([o,isNaN(a.getTime())?Be:a.toISOString()],a);case jn:{const{source:p,flags:c}=a;return i([o,{source:p,flags:c}],a)}case En:{const p=[],c=i([o,p],a);for(const[h,f]of a)(e||!(yt(st(h))||yt(st(f))))&&p.push([s(h),s(f)]);return c}case In:{const p=[],c=i([o,p],a);for(const h of a)(e||!yt(st(h)))&&p.push(s(h));return c}}const{message:u}=a;return i([o,{name:l,message:u}],a)};return s},cr=(e,{json:t,lossy:n}={})=>{const r=[];return ku(!(t||n),!!t,new Map,r)(e),r},zt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ur(cr(e,t)):structuredClone(e):(e,t)=>ur(cr(e,t));function vu(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Cu(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Su(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||vu,r=e.options.footnoteBackLabel||Cu,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[l]);if(!u)continue;const p=e.all(u),c=String(u.identifier).toUpperCase(),h=Qe(c.toLowerCase());let f=0;const m=[],w=e.footnoteCounts.get(c);for(;w!==void 0&&++f<=w;){m.length>0&&m.push({type:"text",value:" "});let j=typeof n=="string"?n:n(l,f);typeof j=="string"&&(j={type:"text",value:j}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,f),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const S=p[p.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const j=S.children[S.children.length-1];j&&j.type==="text"?j.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...m)}else p.push(...m);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(p,!0)};e.patch(u,b),o.push(b)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...zt(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
9
9
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
|
|
10
|
-
`}]}}const
|
|
10
|
+
`}]}}const Lt=function(e){if(e==null)return zu;if(typeof e=="function")return Rt(e);if(typeof e=="object")return Array.isArray(e)?ju(e):Eu(e);if(typeof e=="string")return Iu(e);throw new Error("Expected function, string, or object as test")};function ju(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Lt(e[n]);return Rt(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function Eu(e){const t=e;return Rt(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function Iu(e){return Rt(t);function t(n){return n&&n.type===e}}function Rt(e){return t;function t(n,r,i){return!!(Tu(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function zu(){return!0}function Tu(e){return e!==null&&typeof e=="object"&&"type"in e}const Ii=[],Au=!0,un=!1,Nu="skip";function zi(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=Lt(i),a=r?-1:1;o(e,void 0,[])();function o(l,u,p){const c=l&&typeof l=="object"?l:{};if(typeof c.type=="string"){const f=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=Ii,m,w,S;if((!t||s(l,u,p[p.length-1]||void 0))&&(f=Du(n(l,p)),f[0]===un))return f;if("children"in l&&l.children){const b=l;if(b.children&&f[0]!==Nu)for(w=(r?b.children.length:-1)+a,S=p.concat(b);w>-1&&w<b.children.length;){const j=b.children[w];if(m=o(j,w,S)(),m[0]===un)return m;w=typeof m[1]=="number"?m[1]:w+a}}return f}}}function Du(e){return Array.isArray(e)?e:typeof e=="number"?[Au,e]:e==null?Ii:[e]}function zn(e,t,n,r){let i,s,a;typeof t=="function"&&typeof n!="function"?(s=void 0,a=t,i=n):(s=t,a=n,i=r),zi(e,s,o,i);function o(l,u){const p=u[u.length-1],c=p?p.children.indexOf(l):void 0;return a(l,c,p)}}const cn={}.hasOwnProperty,Mu={};function Lu(e,t){const n=t||Mu,r=new Map,i=new Map,s=new Map,a={...gu,...n.handlers},o={all:u,applyData:Pu,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:a,one:l,options:n,patch:Ru,wrap:_u};return zn(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const c=p.type==="definition"?r:i,h=String(p.identifier).toUpperCase();c.has(h)||c.set(h,p)}}),o;function l(p,c){const h=p.type,f=o.handlers[h];if(cn.call(o.handlers,h)&&f)return f(o,p,c);if(o.options.passThrough&&o.options.passThrough.includes(h)){if("children"in p){const{children:w,...S}=p,b=zt(S);return b.children=o.all(p),b}return zt(p)}return(o.options.unknownHandler||Fu)(o,p,c)}function u(p){const c=[];if("children"in p){const h=p.children;let f=-1;for(;++f<h.length;){const m=o.one(h[f],p);if(m){if(f&&h[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=dr(m.value)),!Array.isArray(m)&&m.type==="element")){const w=m.children[0];w&&w.type==="text"&&(w.value=dr(w.value))}Array.isArray(m)?c.push(...m):c.push(m)}}}return c}}function Ru(e,t){e.position&&(t.position=ys(e))}function Pu(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&s&&Object.assign(n.properties,zt(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function Fu(e,t){const n=t.data||{},r="value"in t&&!(cn.call(n,"hProperties")||cn.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _u(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
11
11
|
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
12
12
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
13
|
-
`}),n}function
|
|
14
|
-
`},i),s}function Pu(e,t){return e&&"run"in e?async function(n,r){const i=cr(n,{file:r,...t});await e.run(i,r)}:function(n,r){return cr(n,{file:r,...e||t})}}function dr(e){if(e)throw e}var yt=Object.prototype.hasOwnProperty,Ii=Object.prototype.toString,pr=Object.defineProperty,fr=Object.getOwnPropertyDescriptor,hr=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Ii.call(t)==="[object Array]"},gr=function(t){if(!t||Ii.call(t)!=="[object Object]")return!1;var n=yt.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&yt.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||yt.call(t,i)},mr=function(t,n){pr&&n.name==="__proto__"?pr(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},xr=function(t,n){if(n==="__proto__")if(yt.call(t,n)){if(fr)return fr(t,n).value}else return;return t[n]},Fu=function e(){var t,n,r,i,s,a,o=arguments[0],l=1,u=arguments.length,p=!1;for(typeof o=="boolean"&&(p=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=xr(o,n),i=xr(t,n),o!==i&&(p&&i&&(gr(i)||(s=hr(i)))?(s?(s=!1,a=r&&hr(r)?r:[]):a=r&&gr(r)?r:{},mr(o,{name:n,newValue:e(p,a,i)})):typeof i<"u"&&mr(o,{name:n,newValue:i}));return o};const $t=Me.getDefaultExportFromCjs(Fu);function cn(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function _u(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...i);function o(l,...u){const p=e[++s];let c=-1;if(l){a(l);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,p?Ou(p,o)(...u):a(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Ou(e,t){let n;return r;function r(...a){const o=e.length>a.length;let l;o&&a.push(i);try{l=e.apply(this,a)}catch(u){const p=u;if(o&&n)throw p;return i(p)}o||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(a,...o){n||(n=!0,t(a,...o))}function s(a){i(null,a)}}const Ie={basename:Bu,dirname:$u,extname:Hu,join:Uu,sep:"/"};function Bu(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ft(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function $u(e){if(ft(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Hu(e){ft(e);let t=e.length,n=-1,r=0,i=-1,s=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Uu(...e){let t=-1,n;for(;++t<e.length;)ft(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Vu(n)}function Vu(e){ft(e);const t=e.codePointAt(0)===47;let n=qu(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function qu(e,t){let n="",r=0,i=-1,s=0,a=-1,o,l;for(;++a<=e.length;){if(a<e.length)o=e.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||s===1))if(i!==a-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,s=0}else o===46&&s>-1?s++:s=-1}return n}function ft(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Wu={cwd:Yu};function Yu(){return"/"}function dn(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Gu(e){if(typeof e=="string")e=new URL(e);else if(!dn(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Xu(e)}function Xu(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 t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+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(t)}const Ht=["history","path","basename","stem","extname","dirname"];class zi{constructor(t){let n;t?dn(t)?n={path:t}:typeof t=="string"||Ku(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Wu.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ht.length;){const s=Ht[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Ht.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ie.basename(this.path):void 0}set basename(t){Vt(t,"basename"),Ut(t,"basename"),this.path=Ie.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ie.dirname(this.path):void 0}set dirname(t){br(this.basename,"dirname"),this.path=Ie.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ie.extname(this.path):void 0}set extname(t){if(Ut(t,"extname"),br(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ie.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){dn(t)&&(t=Gu(t)),Vt(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ie.basename(this.path,this.extname):void 0}set stem(t){Vt(t,"stem"),Ut(t,"stem"),this.path=Ie.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new he(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ut(e,t){if(e&&e.includes(Ie.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ie.sep+"`")}function Vt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function br(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Ku(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Qu=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},Ju={}.hasOwnProperty;class zn extends Qu{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=_u()}copy(){const t=new zn;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data($t(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Yt("data",this.frozen),this.namespace[t]=n,this):Ju.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Yt("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=xt(t),r=this.parser||this.Parser;return qt("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),qt("process",this.parser||this.Parser),Wt("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const o=xt(t),l=r.parse(o);r.run(l,o,function(p,c,h){if(p||!c||!h)return u(p);const f=c,m=r.stringify(f,h);tc(m)?h.value=m:h.result=m,u(p,h)});function u(p,c){p||!c?a(p):s?s(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),qt("processSync",this.parser||this.Parser),Wt("processSync",this.compiler||this.Compiler),this.process(t,i),yr("processSync","process",n),r;function i(s,a){n=!0,dr(s),r=a}}run(t,n,r){wr(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(a,o){const l=xt(n);i.run(t,l,u);function u(p,c,h){const f=c||t;p?o(p):a?a(f):r(void 0,f,h)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),yr("runSync","run",r),i;function s(a,o){dr(a),i=o,r=!0}}stringify(t,n){this.freeze();const r=xt(n),i=this.compiler||this.Compiler;return Wt("stringify",i),wr(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Yt("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[p,...c]=u;l(p,c)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))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");o(u.plugins),u.settings&&(i.settings=$t(!0,i.settings,u.settings))}function o(u){let p=-1;if(u!=null)if(Array.isArray(u))for(;++p<u.length;){const c=u[p];s(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,p){let c=-1,h=-1;for(;++c<r.length;)if(r[c][0]===u){h=c;break}if(h===-1)r.push([u,...p]);else if(p.length>0){let[f,...m]=p;const w=r[h][1];cn(w)&&cn(f)&&(f=$t(!0,w,f)),r[h]=[u,f,...m]}}}}const Zu=new zn().freeze();function qt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Wt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yt(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function wr(e){if(!cn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function yr(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xt(e){return ec(e)?e:new zi(e)}function ec(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function tc(e){return typeof e=="string"||nc(e)}function nc(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const rc="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kr=[],vr={allowDangerousHtml:!0},ic=/^(https?|ircs?|mailto|xmpp)$/i,ac=[{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 Ti(e){const t=sc(e),n=oc(e);return lc(t.runSync(t.parse(n),n),e)}function sc(e){const t=e.rehypePlugins||kr,n=e.remarkPlugins||kr,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vr}:vr;return Zu().use(Bl).use(n).use(Pu,r).use(t)}function oc(e){const t=e.children||"",n=new zi;return typeof t=="string"&&(n.value=t),n}function lc(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||uc;for(const p of ac)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+rc+p.id,void 0);return In(e,u),vs(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function u(p,c,h){if(p.type==="raw"&&h&&typeof c=="number")return a?h.children.splice(c,1):h.children[c]={type:"text",value:p.value},c;if(p.type==="element"){let f;for(f in _t)if(Object.hasOwn(_t,f)&&Object.hasOwn(p.properties,f)){const m=p.properties[f],w=_t[f];(w===null||w.includes(p.tagName))&&(p.properties[f]=l(String(m||""),f,p))}}if(p.type==="element"){let f=n?!n.includes(p.tagName):s?s.includes(p.tagName):!1;if(!f&&r&&typeof c=="number"&&(f=!r(p,c,h)),f&&h&&typeof c=="number")return o&&p.children?h.children.splice(c,1,...p.children):h.children.splice(c,1),c}}}function uc(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||ic.test(e.slice(0,t))?e:""}function Cr(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function cc(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function dc(e,t,n){const i=At((n||{}).ignore||[]),s=pc(t);let a=-1;for(;++a<s.length;)Ei(e,"text",o);function o(u,p){let c=-1,h;for(;++c<p.length;){const f=p[c],m=h?h.children:void 0;if(i(f,m?m.indexOf(f):void 0,h))return;h=f}if(h)return l(u,p)}function l(u,p){const c=p[p.length-1],h=s[a][0],f=s[a][1];let m=0;const C=c.children.indexOf(u);let b=!1,S=[];h.lastIndex=0;let j=h.exec(u.value);for(;j;){const L=j.index,A={index:j.index,input:j.input,stack:[...p,u]};let k=f(...j,A);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?h.lastIndex=L+1:(m!==L&&S.push({type:"text",value:u.value.slice(m,L)}),Array.isArray(k)?S.push(...k):k&&S.push(k),m=L+j[0].length,b=!0),!h.global)break;j=h.exec(u.value)}return b?(m<u.value.length&&S.push({type:"text",value:u.value.slice(m)}),c.children.splice(C,1,...S)):S=[u],C+S.length}}function pc(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([fc(i[0]),hc(i[1])])}return t}function fc(e){return typeof e=="string"?new RegExp(cc(e),"g"):e}function hc(e){return typeof e=="function"?e:function(){return e}}const Gt="phrasing",Xt=["autolink","link","image","label"];function gc(){return{transforms:[vc],enter:{literalAutolink:xc,literalAutolinkEmail:Kt,literalAutolinkHttp:Kt,literalAutolinkWww:Kt},exit:{literalAutolink:kc,literalAutolinkEmail:yc,literalAutolinkHttp:bc,literalAutolinkWww:wc}}}function mc(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Gt,notInConstruct:Xt},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Gt,notInConstruct:Xt},{character:":",before:"[ps]",after:"\\/",inConstruct:Gt,notInConstruct:Xt}]}}function xc(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Kt(e){this.config.enter.autolinkProtocol.call(this,e)}function bc(e){this.config.exit.autolinkProtocol.call(this,e)}function wc(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function yc(e){this.config.exit.autolinkEmail.call(this,e)}function kc(e){this.exit(e)}function vc(e){dc(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Cc],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Sc]],{ignore:["link","linkReference"]})}function Cc(e,t,n,r,i){let s="";if(!Ai(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!jc(n)))return!1;const a=Ec(n+r);if(!a[0])return!1;const o={type:"link",title:null,url:s+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[o,{type:"text",value:a[1]}]:o}function Sc(e,t,n,r){return!Ai(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function jc(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Ec(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=Cr(e,"(");let s=Cr(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Ai(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||He(n)||It(n))&&(!t||n!==47)}Ni.peek=Rc;function Ic(){this.buffer()}function zc(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Tc(){this.buffer()}function Ac(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Nc(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=je(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Lc(e){this.exit(e)}function Dc(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=je(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Mc(e){this.exit(e)}function Rc(){return"["}function Ni(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),o(),a(),s+=i.move("]"),s}function Pc(){return{enter:{gfmFootnoteCallString:Ic,gfmFootnoteCall:zc,gfmFootnoteDefinitionLabelString:Tc,gfmFootnoteDefinition:Ac},exit:{gfmFootnoteCallString:Nc,gfmFootnoteCall:Lc,gfmFootnoteDefinitionLabelString:Dc,gfmFootnoteDefinition:Mc}}}function Fc(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ni},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,a){const o=s.createTracker(a);let l=o.move("[^");const u=s.enter("footnoteDefinition"),p=s.enter("label");return l+=o.move(s.safe(s.associationId(r),{before:l,after:"]"})),p(),l+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),l+=o.move((t?`
|
|
15
|
-
`:" ")+s.indentLines(s.containerFlow(r,o.current()),t?Li
|
|
16
|
-
`)}function
|
|
17
|
-
`&&
|
|
18
|
-
`}function
|
|
13
|
+
`}),n}function dr(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function pr(e,t){const n=Lu(e,t),r=n.one(e,void 0),i=Su(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
14
|
+
`},i),s}function Ou(e,t){return e&&"run"in e?async function(n,r){const i=pr(n,{file:r,...t});await e.run(i,r)}:function(n,r){return pr(n,{file:r,...e||t})}}function fr(e){if(e)throw e}var St=Object.prototype.hasOwnProperty,Ti=Object.prototype.toString,hr=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,mr=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Ti.call(t)==="[object Array]"},xr=function(t){if(!t||Ti.call(t)!=="[object Object]")return!1;var n=St.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&St.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||St.call(t,i)},br=function(t,n){hr&&n.name==="__proto__"?hr(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},wr=function(t,n){if(n==="__proto__")if(St.call(t,n)){if(gr)return gr(t,n).value}else return;return t[n]},Bu=function e(){var t,n,r,i,s,a,o=arguments[0],l=1,u=arguments.length,p=!1;for(typeof o=="boolean"&&(p=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=wr(o,n),i=wr(t,n),o!==i&&(p&&i&&(xr(i)||(s=mr(i)))?(s?(s=!1,a=r&&mr(r)?r:[]):a=r&&xr(r)?r:{},br(o,{name:n,newValue:e(p,a,i)})):typeof i<"u"&&br(o,{name:n,newValue:i}));return o};const Ht=Pe.getDefaultExportFromCjs(Bu);function dn(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function $u(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...i);function o(l,...u){const p=e[++s];let c=-1;if(l){a(l);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,p?Hu(p,o)(...u):a(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Hu(e,t){let n;return r;function r(...a){const o=e.length>a.length;let l;o&&a.push(i);try{l=e.apply(this,a)}catch(u){const p=u;if(o&&n)throw p;return i(p)}o||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(a,...o){n||(n=!0,t(a,...o))}function s(a){i(null,a)}}const ze={basename:Uu,dirname:Wu,extname:qu,join:Vu,sep:"/"};function Uu(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ht(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function Wu(e){if(ht(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function qu(e){ht(e);let t=e.length,n=-1,r=0,i=-1,s=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Vu(...e){let t=-1,n;for(;++t<e.length;)ht(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Yu(n)}function Yu(e){ht(e);const t=e.codePointAt(0)===47;let n=Gu(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Gu(e,t){let n="",r=0,i=-1,s=0,a=-1,o,l;for(;++a<=e.length;){if(a<e.length)o=e.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||s===1))if(i!==a-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,s=0}else o===46&&s>-1?s++:s=-1}return n}function ht(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Xu={cwd:Ku};function Ku(){return"/"}function pn(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Qu(e){if(typeof e=="string")e=new URL(e);else if(!pn(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Ju(e)}function Ju(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 t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+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(t)}const Ut=["history","path","basename","stem","extname","dirname"];class Ai{constructor(t){let n;t?pn(t)?n={path:t}:typeof t=="string"||Zu(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Xu.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ut.length;){const s=Ut[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Ut.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?ze.basename(this.path):void 0}set basename(t){qt(t,"basename"),Wt(t,"basename"),this.path=ze.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ze.dirname(this.path):void 0}set dirname(t){yr(this.basename,"dirname"),this.path=ze.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ze.extname(this.path):void 0}set extname(t){if(Wt(t,"extname"),yr(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ze.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){pn(t)&&(t=Qu(t)),qt(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ze.basename(this.path,this.extname):void 0}set stem(t){qt(t,"stem"),Wt(t,"stem"),this.path=ze.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new me(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Wt(e,t){if(e&&e.includes(ze.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ze.sep+"`")}function qt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function yr(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Zu(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ec=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},tc={}.hasOwnProperty;class Tn extends ec{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=$u()}copy(){const t=new Tn;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ht(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Gt("data",this.frozen),this.namespace[t]=n,this):tc.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Gt("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=kt(t),r=this.parser||this.Parser;return Vt("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Vt("process",this.parser||this.Parser),Yt("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const o=kt(t),l=r.parse(o);r.run(l,o,function(p,c,h){if(p||!c||!h)return u(p);const f=c,m=r.stringify(f,h);ic(m)?h.value=m:h.result=m,u(p,h)});function u(p,c){p||!c?a(p):s?s(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Vt("processSync",this.parser||this.Parser),Yt("processSync",this.compiler||this.Compiler),this.process(t,i),vr("processSync","process",n),r;function i(s,a){n=!0,fr(s),r=a}}run(t,n,r){kr(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(a,o){const l=kt(n);i.run(t,l,u);function u(p,c,h){const f=c||t;p?o(p):a?a(f):r(void 0,f,h)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),vr("runSync","run",r),i;function s(a,o){fr(a),i=o,r=!0}}stringify(t,n){this.freeze();const r=kt(n),i=this.compiler||this.Compiler;return Yt("stringify",i),kr(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Gt("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[p,...c]=u;l(p,c)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))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");o(u.plugins),u.settings&&(i.settings=Ht(!0,i.settings,u.settings))}function o(u){let p=-1;if(u!=null)if(Array.isArray(u))for(;++p<u.length;){const c=u[p];s(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,p){let c=-1,h=-1;for(;++c<r.length;)if(r[c][0]===u){h=c;break}if(h===-1)r.push([u,...p]);else if(p.length>0){let[f,...m]=p;const w=r[h][1];dn(w)&&dn(f)&&(f=Ht(!0,w,f)),r[h]=[u,f,...m]}}}}const nc=new Tn().freeze();function Vt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Gt(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function kr(e){if(!dn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vr(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function kt(e){return rc(e)?e:new Ai(e)}function rc(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ic(e){return typeof e=="string"||ac(e)}function ac(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const sc="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Cr=[],Sr={allowDangerousHtml:!0},oc=/^(https?|ircs?|mailto|xmpp)$/i,lc=[{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 Ni(e){const t=uc(e),n=cc(e);return dc(t.runSync(t.parse(n),n),e)}function uc(e){const t=e.rehypePlugins||Cr,n=e.remarkPlugins||Cr,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Sr}:Sr;return nc().use(Ul).use(n).use(Ou,r).use(t)}function cc(e){const t=e.children||"",n=new Ai;return typeof t=="string"&&(n.value=t),n}function dc(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||pc;for(const p of lc)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+sc+p.id,void 0);return zn(e,u),js(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function u(p,c,h){if(p.type==="raw"&&h&&typeof c=="number")return a?h.children.splice(c,1):h.children[c]={type:"text",value:p.value},c;if(p.type==="element"){let f;for(f in Ot)if(Object.hasOwn(Ot,f)&&Object.hasOwn(p.properties,f)){const m=p.properties[f],w=Ot[f];(w===null||w.includes(p.tagName))&&(p.properties[f]=l(String(m||""),f,p))}}if(p.type==="element"){let f=n?!n.includes(p.tagName):s?s.includes(p.tagName):!1;if(!f&&r&&typeof c=="number"&&(f=!r(p,c,h)),f&&h&&typeof c=="number")return o&&p.children?h.children.splice(c,1,...p.children):h.children.splice(c,1),c}}}function pc(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||oc.test(e.slice(0,t))?e:""}function jr(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function fc(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function hc(e,t,n){const i=Lt((n||{}).ignore||[]),s=gc(t);let a=-1;for(;++a<s.length;)zi(e,"text",o);function o(u,p){let c=-1,h;for(;++c<p.length;){const f=p[c],m=h?h.children:void 0;if(i(f,m?m.indexOf(f):void 0,h))return;h=f}if(h)return l(u,p)}function l(u,p){const c=p[p.length-1],h=s[a][0],f=s[a][1];let m=0;const S=c.children.indexOf(u);let b=!1,j=[];h.lastIndex=0;let E=h.exec(u.value);for(;E;){const R=E.index,N={index:E.index,input:E.input,stack:[...p,u]};let v=f(...E,N);if(typeof v=="string"&&(v=v.length>0?{type:"text",value:v}:void 0),v===!1?h.lastIndex=R+1:(m!==R&&j.push({type:"text",value:u.value.slice(m,R)}),Array.isArray(v)?j.push(...v):v&&j.push(v),m=R+E[0].length,b=!0),!h.global)break;E=h.exec(u.value)}return b?(m<u.value.length&&j.push({type:"text",value:u.value.slice(m)}),c.children.splice(S,1,...j)):j=[u],S+j.length}}function gc(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([mc(i[0]),xc(i[1])])}return t}function mc(e){return typeof e=="string"?new RegExp(fc(e),"g"):e}function xc(e){return typeof e=="function"?e:function(){return e}}const Xt="phrasing",Kt=["autolink","link","image","label"];function bc(){return{transforms:[jc],enter:{literalAutolink:yc,literalAutolinkEmail:Qt,literalAutolinkHttp:Qt,literalAutolinkWww:Qt},exit:{literalAutolink:Sc,literalAutolinkEmail:Cc,literalAutolinkHttp:kc,literalAutolinkWww:vc}}}function wc(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Xt,notInConstruct:Kt},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Xt,notInConstruct:Kt},{character:":",before:"[ps]",after:"\\/",inConstruct:Xt,notInConstruct:Kt}]}}function yc(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Qt(e){this.config.enter.autolinkProtocol.call(this,e)}function kc(e){this.config.exit.autolinkProtocol.call(this,e)}function vc(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Cc(e){this.config.exit.autolinkEmail.call(this,e)}function Sc(e){this.exit(e)}function jc(e){hc(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ec],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Ic]],{ignore:["link","linkReference"]})}function Ec(e,t,n,r,i){let s="";if(!Di(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!zc(n)))return!1;const a=Tc(n+r);if(!a[0])return!1;const o={type:"link",title:null,url:s+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[o,{type:"text",value:a[1]}]:o}function Ic(e,t,n,r){return!Di(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function zc(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Tc(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=jr(e,"(");let s=jr(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Di(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ue(n)||Nt(n))&&(!t||n!==47)}Mi.peek=_c;function Ac(){this.buffer()}function Nc(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Dc(){this.buffer()}function Mc(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Lc(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ie(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Rc(e){this.exit(e)}function Pc(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ie(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Fc(e){this.exit(e)}function _c(){return"["}function Mi(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),o(),a(),s+=i.move("]"),s}function Oc(){return{enter:{gfmFootnoteCallString:Ac,gfmFootnoteCall:Nc,gfmFootnoteDefinitionLabelString:Dc,gfmFootnoteDefinition:Mc},exit:{gfmFootnoteCallString:Lc,gfmFootnoteCall:Rc,gfmFootnoteDefinitionLabelString:Pc,gfmFootnoteDefinition:Fc}}}function Bc(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Mi},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,a){const o=s.createTracker(a);let l=o.move("[^");const u=s.enter("footnoteDefinition"),p=s.enter("label");return l+=o.move(s.safe(s.associationId(r),{before:l,after:"]"})),p(),l+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),l+=o.move((t?`
|
|
15
|
+
`:" ")+s.indentLines(s.containerFlow(r,o.current()),t?Li:$c))),u(),l}}function $c(e,t,n){return t===0?e:Li(e,t,n)}function Li(e,t,n){return(n?"":" ")+e}const Hc=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ri.peek=Yc;function Uc(){return{canContainEols:["delete"],enter:{strikethrough:qc},exit:{strikethrough:Vc}}}function Wc(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Hc}],handlers:{delete:Ri}}}function qc(e){this.enter({type:"delete",children:[]},e)}function Vc(e){this.exit(e)}function Ri(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),s(),a}function Yc(){return"~"}function Gc(e){return e.length}function Xc(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Gc,s=[],a=[],o=[],l=[];let u=0,p=-1;for(;++p<e.length;){const w=[],S=[];let b=-1;for(e[p].length>u&&(u=e[p].length);++b<e[p].length;){const j=Kc(e[p][b]);if(n.alignDelimiters!==!1){const E=i(j);S[b]=E,(l[b]===void 0||E>l[b])&&(l[b]=E)}w.push(j)}a[p]=w,o[p]=S}let c=-1;if(typeof r=="object"&&"length"in r)for(;++c<u;)s[c]=Er(r[c]);else{const w=Er(r);for(;++c<u;)s[c]=w}c=-1;const h=[],f=[];for(;++c<u;){const w=s[c];let S="",b="";w===99?(S=":",b=":"):w===108?S=":":w===114&&(b=":");let j=n.alignDelimiters===!1?1:Math.max(1,l[c]-S.length-b.length);const E=S+"-".repeat(j)+b;n.alignDelimiters!==!1&&(j=S.length+j+b.length,j>l[c]&&(l[c]=j),f[c]=j),h[c]=E}a.splice(1,0,h),o.splice(1,0,f),p=-1;const m=[];for(;++p<a.length;){const w=a[p],S=o[p];c=-1;const b=[];for(;++c<u;){const j=w[c]||"";let E="",R="";if(n.alignDelimiters!==!1){const N=l[c]-(S[c]||0),v=s[c];v===114?E=" ".repeat(N):v===99?N%2?(E=" ".repeat(N/2+.5),R=" ".repeat(N/2-.5)):(E=" ".repeat(N/2),R=E):R=" ".repeat(N)}n.delimiterStart!==!1&&!c&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&j==="")&&(n.delimiterStart!==!1||c)&&b.push(" "),n.alignDelimiters!==!1&&b.push(E),b.push(j),n.alignDelimiters!==!1&&b.push(R),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||c!==u-1)&&b.push("|")}m.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return m.join(`
|
|
16
|
+
`)}function Kc(e){return e==null?"":String(e)}function Er(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Qc(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const a=n.indentLines(n.containerFlow(e,s.current()),Jc);return i(),a}function Jc(e,t,n){return">"+(n?"":" ")+e}function Zc(e,t){return Ir(e,t.inConstruct,!0)&&!Ir(e,t.notInConstruct,!1)}function Ir(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function zr(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
17
|
+
`&&Zc(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
18
|
+
`}function ed(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>a&&(a=s):s=1,i=r+t.length,r=n.indexOf(t,i);return a}function td(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function nd(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function rd(e,t,n,r){const i=nd(n),s=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(td(e,n)){const c=n.enter("codeIndented"),h=n.indentLines(s,id);return c(),h}const o=n.createTracker(r),l=i.repeat(Math.max(ed(s,i)+1,3)),u=n.enter("codeFenced");let p=o.move(l);if(e.lang){const c=n.enter(`codeFencedLang${a}`);p+=o.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...o.current()})),c()}if(e.lang&&e.meta){const c=n.enter(`codeFencedMeta${a}`);p+=o.move(" "),p+=o.move(n.safe(e.meta,{before:p,after:`
|
|
19
19
|
`,encode:["`"],...o.current()})),c()}return p+=o.move(`
|
|
20
20
|
`),s&&(p+=o.move(s+`
|
|
21
|
-
`)),p+=o.move(l),u(),p}function
|
|
22
|
-
`,...l.current()}))),o(),e.title&&(o=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),a(),u}function
|
|
21
|
+
`)),p+=o.move(l),u(),p}function id(e,t,n){return(n?"":" ")+e}function An(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ad(e,t,n,r){const i=An(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":`
|
|
22
|
+
`,...l.current()}))),o(),e.title&&(o=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),a(),u}function sd(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function dt(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Tt(e,t,n){const r=Xe(e),i=Xe(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Pi.peek=od;function Pi(e,t,n,r){const i=sd(n),s=n.enter("emphasis"),a=n.createTracker(r),o=a.move(i);let l=a.move(n.containerPhrasing(e,{after:i,before:o,...a.current()}));const u=l.charCodeAt(0),p=Tt(r.before.charCodeAt(r.before.length-1),u,i);p.inside&&(l=dt(u)+l.slice(1));const c=l.charCodeAt(l.length-1),h=Tt(r.after.charCodeAt(0),c,i);h.inside&&(l=l.slice(0,-1)+dt(c));const f=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:p.outside},o+l+f}function od(e,t,n){return n.options.emphasis||"*"}function ld(e,t){let n=!1;return zn(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,un}),!!((!e.depth||e.depth<3)&&kn(e)&&(t.options.setext||n))}function ud(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(ld(e,n)){const p=n.enter("headingSetext"),c=n.enter("phrasing"),h=n.containerPhrasing(e,{...s.current(),before:`
|
|
23
23
|
`,after:`
|
|
24
24
|
`});return c(),p(),h+`
|
|
25
25
|
`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
|
|
26
26
|
`))+1))}const a="#".repeat(i),o=n.enter("headingAtx"),l=n.enter("phrasing");s.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
|
|
27
|
-
`,...s.current()});return/^[\t ]/.test(u)&&(u=
|
|
28
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:a,tableCell:l,tableRow:o}};function a(f,m,w,
|
|
29
|
-
`))}function l(f,m,w,C){const b=w.enter("tableCell"),S=w.enter("phrasing"),j=w.containerPhrasing(f,{...C,before:s,after:s});return S(),b(),j}function u(f,m){return Wc(f,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function p(f,m,w){const C=f.children;let b=-1;const S=[],j=m.enter("table");for(;++b<C.length;)S[b]=c(C[b],m,w);return j(),S}function c(f,m,w){const C=f.children;let b=-1;const S=[],j=m.enter("tableRow");for(;++b<C.length;)S[b]=l(C[b],f,m,w);return j(),S}function h(f,m,w){let C=Vi.inlineCode(f,m,w);return w.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function Dd(){return{exit:{taskListCheckValueChecked:zr,taskListCheckValueUnchecked:zr,paragraph:Rd}}}function Md(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Pd}}}function zr(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Rd(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,a;for(;++s<i.length;){const o=i[s];if(o.type==="paragraph"){a=o;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Pd(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);s&&o.move(a);let l=Vi.listItem(e,t,n,{...r,...o.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(p){return p+a}}function Fd(){return[gc(),Pc(),Bc(),Ed(),Dd()]}function _d(e){return{extensions:[mc(),Fc(e),$c(),Ld(e),Md()]}}const Od={tokenize:qd,partial:!0},qi={tokenize:Wd,partial:!0},Wi={tokenize:Yd,partial:!0},Yi={tokenize:Gd,partial:!0},Bd={tokenize:Xd,partial:!0},Gi={name:"wwwAutolink",tokenize:Ud,previous:Ki},Xi={name:"protocolAutolink",tokenize:Vd,previous:Qi},Le={name:"emailAutolink",tokenize:Hd,previous:Ji},Te={};function $d(){return{text:Te}}let _e=48;for(;_e<123;)Te[_e]=Le,_e++,_e===58?_e=65:_e===91&&(_e=97);Te[43]=Le;Te[45]=Le;Te[46]=Le;Te[95]=Le;Te[72]=[Le,Xi];Te[104]=[Le,Xi];Te[87]=[Le,Gi];Te[119]=[Le,Gi];function Hd(e,t,n){const r=this;let i,s;return a;function a(c){return!pn(c)||!Ji.call(r,r.previous)||Nn(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(c))}function o(c){return pn(c)?(e.consume(c),o):c===64?(e.consume(c),l):n(c)}function l(c){return c===46?e.check(Bd,p,u)(c):c===45||c===95||fe(c)?(s=!0,e.consume(c),l):p(c)}function u(c){return e.consume(c),i=!0,l}function p(c){return s&&i&&ge(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function Ud(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!Ki.call(r,r.previous)||Nn(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Od,e.attempt(qi,e.attempt(Wi,s),n),n)(a))}function s(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function Vd(e,t,n){const r=this;let i="",s=!1;return a;function a(c){return(c===72||c===104)&&Qi.call(r,r.previous)&&!Nn(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),o):n(c)}function o(c){if(ge(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),o;if(c===58){const h=i.toLowerCase();if(h==="http"||h==="https")return e.consume(c),l}return n(c)}function l(c){return c===47?(e.consume(c),s?u:(s=!0,l)):n(c)}function u(c){return c===null||vt(c)||ie(c)||He(c)||It(c)?n(c):e.attempt(qi,e.attempt(Wi,p),n)(c)}function p(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function qd(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),s):n(a)}function s(a){return a===null?n(a):t(a)}}function Wd(e,t,n){let r,i,s;return a;function a(u){return u===46||u===95?e.check(Yi,l,o)(u):u===null||ie(u)||He(u)||u!==45&&It(u)?l(u):(s=!0,e.consume(u),a)}function o(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),a}function l(u){return i||r||!s?n(u):t(u)}}function Yd(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?s(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(Yi,t,s)(a):a===null||ie(a)||He(a)?t(a):(e.consume(a),i)}function s(a){return a===41&&r++,e.consume(a),i}}function Gd(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),s):o===93?(e.consume(o),i):o===60||o===null||ie(o)||He(o)?t(o):n(o)}function i(o){return o===null||o===40||o===91||ie(o)||He(o)?t(o):r(o)}function s(o){return ge(o)?a(o):n(o)}function a(o){return o===59?(e.consume(o),r):ge(o)?(e.consume(o),a):n(o)}}function Xd(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return fe(s)?n(s):t(s)}}function Ki(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ie(e)}function Qi(e){return!ge(e)}function Ji(e){return!(e===47||pn(e))}function pn(e){return e===43||e===45||e===46||e===95||fe(e)}function Nn(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Kd={tokenize:ip,partial:!0};function Qd(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:tp,continuation:{tokenize:np},exit:rp}},text:{91:{name:"gfmFootnoteCall",tokenize:ep},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Jd,resolveTo:Zd}}}}function Jd(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return n(l);const u=je(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function Zd(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function ep(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return o;function o(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),l}function l(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(s>999||c===93&&!a||c===null||c===91||ie(c))return n(c);if(c===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(je(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return ie(c)||(a=!0),s++,e.consume(c),c===92?p:u}function p(c){return c===91||c===92||c===93?(e.consume(c),s++,u):u(c)}}function tp(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,o;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(m)}function p(m){if(a>999||m===93&&!o||m===null||m===91||ie(m))return n(m);if(m===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return s=je(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return ie(m)||(o=!0),a++,e.consume(m),m===92?c:p}function c(m){return m===91||m===92||m===93?(e.consume(m),a++,p):p(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),Z(e,f,"gfmFootnoteDefinitionWhitespace")):n(m)}function f(m){return t(m)}}function np(e,t,n){return e.check(pt,t,e.attempt(Kd,t,n))}function rp(e){e.exit("gfmFootnoteDefinition")}function ip(e,t,n){const r=this;return Z(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(s):n(s)}}function ap(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,o){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let u=l;for(;u--;)if(a[u][0]==="exit"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[u][1].end.offset-a[u][1].start.offset){a[l][1].type="strikethroughSequence",a[u][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[u][1].start),end:Object.assign({},a[l][1].end)},c={type:"strikethroughText",start:Object.assign({},a[u][1].end),end:Object.assign({},a[l][1].start)},h=[["enter",p,o],["enter",a[u][1],o],["exit",a[u][1],o],["enter",c,o]],f=o.parser.constructs.insideSpan.null;f&&ke(h,h.length,0,zt(f,a.slice(u+1,l),o)),ke(h,h.length,0,[["exit",c,o],["enter",a[l][1],o],["exit",a[l][1],o],["exit",p,o]]),ke(a,u-1,l-u+3,h),l=u+h.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function s(a,o,l){const u=this.previous,p=this.events;let c=0;return h;function h(m){return u===126&&p[p.length-1][1].type!=="characterEscape"?l(m):(a.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const w=Ye(u);if(m===126)return c>1?l(m):(a.consume(m),c++,f);if(c<2&&!n)return l(m);const C=a.exit("strikethroughSequenceTemporary"),b=Ye(m);return C._open=!b||b===2&&!!w,C._close=!w||w===2&&!!b,o(m)}}}class sp{constructor(){this.map=[]}add(t,n,r){op(this,t,n,r)}consume(t){if(this.map.sort(function(s,a){return s[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function op(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function lp(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function up(){return{flow:{null:{name:"table",tokenize:cp,resolveAll:dp}}}}function cp(e,t,n){const r=this;let i=0,s=0,a;return o;function o(v){let D=r.events.length-1;for(;D>-1;){const I=r.events[D][1].type;if(I==="lineEnding"||I==="linePrefix")D--;else break}const T=D>-1?r.events[D][1].type:null,E=T==="tableHead"||T==="tableRow"?k:l;return E===k&&r.parser.lazy[r.now().line]?n(v):E(v)}function l(v){return e.enter("tableHead"),e.enter("tableRow"),u(v)}function u(v){return v===124||(a=!0,s+=1),p(v)}function p(v){return v===null?n(v):V(v)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),f):n(v):Q(v)?Z(e,p,"whitespace")(v):(s+=1,a&&(a=!1,i+=1),v===124?(e.enter("tableCellDivider"),e.consume(v),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),c(v)))}function c(v){return v===null||v===124||ie(v)?(e.exit("data"),p(v)):(e.consume(v),v===92?h:c)}function h(v){return v===92||v===124?(e.consume(v),c):c(v)}function f(v){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(v):(e.enter("tableDelimiterRow"),a=!1,Q(v)?Z(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):m(v))}function m(v){return v===45||v===58?C(v):v===124?(a=!0,e.enter("tableCellDivider"),e.consume(v),e.exit("tableCellDivider"),w):A(v)}function w(v){return Q(v)?Z(e,C,"whitespace")(v):C(v)}function C(v){return v===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(v),e.exit("tableDelimiterMarker"),b):v===45?(s+=1,b(v)):v===null||V(v)?L(v):A(v)}function b(v){return v===45?(e.enter("tableDelimiterFiller"),S(v)):A(v)}function S(v){return v===45?(e.consume(v),S):v===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(v),e.exit("tableDelimiterMarker"),j):(e.exit("tableDelimiterFiller"),j(v))}function j(v){return Q(v)?Z(e,L,"whitespace")(v):L(v)}function L(v){return v===124?m(v):v===null||V(v)?!a||i!==s?A(v):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(v)):A(v)}function A(v){return n(v)}function k(v){return e.enter("tableRow"),N(v)}function N(v){return v===124?(e.enter("tableCellDivider"),e.consume(v),e.exit("tableCellDivider"),N):v===null||V(v)?(e.exit("tableRow"),t(v)):Q(v)?Z(e,N,"whitespace")(v):(e.enter("data"),_(v))}function _(v){return v===null||v===124||ie(v)?(e.exit("data"),N(v)):(e.consume(v),v===92?O:_)}function O(v){return v===92||v===124?(e.consume(v),_):_(v)}}function dp(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,u,p,c;const h=new sp;for(;++n<e.length;){const f=e[n],m=f[1];f[0]==="enter"?m.type==="tableHead"?(o=!1,l!==0&&(Tr(h,t,l,u,p),p=void 0,l=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,c=void 0,s=[0,0,0,0],a=[0,n+1,0,0],o&&(o=!1,p={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",p,t]])),i=m.type==="tableDelimiterRow"?2:p?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(s[1]!==0&&(a[0]=a[1],c=bt(h,t,s,i,void 0,c),s=[0,0,0,0]),a[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(a[0]=a[1],c=bt(h,t,s,i,void 0,c)),s=a,a=[s[1],n,0,0])):m.type==="tableHead"?(o=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,s[1]!==0?(a[0]=a[1],c=bt(h,t,s,i,n,c)):a[1]!==0&&(c=bt(h,t,a,i,n,c)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&Tr(h,t,l,u,p),h.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=lp(t.events,n))}return e}function bt(e,t,n,r,i,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(s.end=Object.assign({},We(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=We(t.events,n[1]);if(s={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const u=We(t.events,n[2]),p=We(t.events,n[3]),c={type:o,start:Object.assign({},u),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",c,t]]),r!==2){const h=t.events[n[2]],f=t.events[n[3]];if(h[1].end=Object.assign({},f[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,w=n[3]-n[2]-1;e.add(m,w,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(s.end=Object.assign({},We(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Tr(e,t,n,r,i){const s=[],a=We(t.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,t])),r.end=Object.assign({},a),s.push(["exit",r,t]),e.add(n+1,0,s)}function We(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const pp={name:"tasklistCheck",tokenize:hp};function fp(){return{text:{91:pp}}}function hp(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return ie(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(l)}function o(l){return V(l)?t(l):Q(l)?e.check({tokenize:gp},t,n)(l):n(l)}}function gp(e,t,n){return Z(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function mp(e){return si([$d(),Qd(),ap(e),up(),fp()])}const xp={};function Zi(e){const t=this,n=e||xp,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(mp(n)),s.push(Fd()),a.push(_d(n))}function ea({content:e}){return d.jsx("div",{className:"sa-text-part",children:d.jsx(Ti,{remarkPlugins:[Zi],children:e})})}const bp="https://at.alicdn.com/t/c/font_5210396_pffyg5g21kn.js";let Ar=!1;function ta(e=bp){if(Ar||typeof document>"u")return;Ar=!0;const t=e.split("?")[0].split("/").pop();if(t&&document.querySelector(`script[src*="${t}"]`))return;const n=document.createElement("script");n.src=e,document.head.appendChild(n)}ta();function J({name:e,size:t=16,color:n="currentColor",className:r,style:i}){return d.jsx("svg",{className:r,style:{width:t,height:t,fill:n,verticalAlign:"middle",...i},"aria-hidden":"true",children:d.jsx("use",{href:`#icon-${e}`})})}function na({content:e}){const[t,n]=y.useState(!1);return d.jsxs("div",{className:"sa-thinking-part",onClick:()=>n(!t),children:[d.jsxs("div",{className:"sa-thinking-header",children:[d.jsx("span",{className:"sa-thinking-icon",children:d.jsx(J,{name:"brain",size:14})}),d.jsx("span",{className:"sa-thinking-label",children:"思考过程"}),d.jsx("span",{className:`sa-thinking-arrow ${t?"expanded":""}`,children:d.jsx(J,{name:"chevron-right",size:12})})]}),t&&d.jsx("div",{className:"sa-thinking-content",children:e})]})}function ra({toolName:e,toolCallId:t,args:n}){const[r,i]=y.useState(!1),[s,a]=y.useState(!1);let o=n;try{o=JSON.stringify(JSON.parse(n),null,2)}catch{}const l=y.useCallback(()=>{var u;(u=navigator.clipboard)==null||u.writeText(o).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)}).catch(()=>{})},[o]);return d.jsxs("div",{className:"sa-tool-call-part",children:[d.jsxs("div",{className:"sa-tool-call-header",onClick:()=>i(!r),children:[d.jsx("span",{className:"sa-tool-icon",children:d.jsx(J,{name:"zap",size:14})}),d.jsxs("span",{className:"sa-tool-name",children:["调用工具: ",e]}),d.jsx("span",{className:`sa-thinking-arrow ${r?"expanded":""}`,children:d.jsx(J,{name:"chevron-right",size:12})})]}),r&&d.jsxs(d.Fragment,{children:[d.jsx("pre",{className:"sa-tool-args",children:o}),d.jsx("div",{className:"sa-tool-result-actions",children:d.jsxs("button",{className:"sa-action-btn",onClick:l,title:"复制",children:[d.jsx(J,{name:s?"circle-check":"copy",size:14})," ",s?"已复制":"复制"]})})]})]})}function Nr({text:e}){const[t,n]=y.useState(!1),r=()=>{var i;(i=navigator.clipboard)==null||i.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})};return d.jsxs("button",{className:"sa-action-btn",onClick:r,title:"复制",children:[d.jsx(J,{name:t?"circle-check":"copy",size:14})," ",t?"已复制":"复制"]})}function wp({html:e}){const[t,n]=y.useState(null);return y.useEffect(()=>{let r=!1;return Promise.resolve().then(()=>require("./purify.es-Dsdnkgrg.cjs")).then(i=>{r||n(i.default.sanitize(e,{FORCE_BODY:!0,ADD_ATTR:["target"]}))}),()=>{r=!0}},[e]),t===null?null:d.jsx("div",{className:"sa-tool-result-html-scroll",children:d.jsx("div",{className:"sa-tool-result-html sa-text-part",dangerouslySetInnerHTML:{__html:t}})})}function ia({toolName:e,content:t,renderMode:n,html:r}){let i=t;if(i)try{i=JSON.stringify(JSON.parse(i),null,2)}catch{}return d.jsxs("div",{className:"sa-tool-result-part",children:[d.jsxs("div",{className:"sa-tool-result-header",children:[d.jsx("span",{className:"sa-tool-icon",children:d.jsx(J,{name:"circle-check",size:14,color:"#10b981"})}),d.jsx("span",{className:"sa-tool-result-label",children:e||"工具返回"})]}),n==="html"&&r?d.jsxs(d.Fragment,{children:[d.jsx(wp,{html:r}),d.jsx("div",{className:"sa-tool-result-actions",children:d.jsx(Nr,{text:r})})]}):i?d.jsxs(d.Fragment,{children:[d.jsx("pre",{className:"sa-tool-result-content",children:i}),d.jsx("div",{className:"sa-tool-result-actions",children:d.jsx(Nr,{text:i})})]}):d.jsx("pre",{className:"sa-tool-result-content",children:"—"})]})}function aa({content:e,onRetry:t}){return d.jsxs("div",{className:"sa-error-part",children:[d.jsxs("div",{className:"sa-error-content",children:[d.jsx("span",{className:"sa-error-icon",children:d.jsx(J,{name:"triangle-alert",size:14})}),d.jsx("span",{children:e||"发生错误"})]}),t&&d.jsx("button",{className:"sa-error-retry",onClick:t,children:"重试"})]})}function sa(e){return e==null||Number.isNaN(e)?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function yp({attachment:e}){const t=d.jsxs(d.Fragment,{children:[d.jsx(J,{name:"file-text",size:14,color:"#6366f1"}),d.jsx("span",{className:"sa-attachment-chip-name",children:e.filename}),e.size!=null&&d.jsx("span",{className:"sa-attachment-chip-size",children:sa(e.size)})]});return e.url?d.jsx("a",{className:"sa-attachment-chip",href:e.url,target:"_blank",rel:"noreferrer",download:e.filename,title:`下载 ${e.filename}`,children:t}):d.jsx("span",{className:"sa-attachment-chip",title:e.filename,children:t})}function kp({interrupt:e,onRespond:t,disabled:n,answeredAction:r}){var o,l;const i=e.options,s=(typeof(i==null?void 0:i[0])=="string"?i[0]:(o=i==null?void 0:i[0])==null?void 0:o.label)||"确认",a=(typeof(i==null?void 0:i[1])=="string"?i[1]:(l=i==null?void 0:i[1])==null?void 0:l.label)||"取消";return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(J,{name:"circle-alert",size:16,color:"#f59e0b"}),d.jsx("span",{children:e.content})]}),d.jsxs("div",{className:"sa-interrupt-actions",children:[d.jsxs("button",{className:`sa-interrupt-btn sa-interrupt-btn-primary ${r==="confirm"?"sa-interrupt-btn-answered":""}`,disabled:n,onClick:()=>t({action:"confirm"}),children:[d.jsx(J,{name:"check",size:14})," ",s]}),d.jsxs("button",{className:`sa-interrupt-btn sa-interrupt-btn-secondary ${r==="cancel"?"sa-interrupt-btn-answered":""}`,disabled:n,onClick:()=>t({action:"cancel"}),children:[d.jsx(J,{name:"x",size:14})," ",a]})]}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function vp({interrupt:e,onRespond:t,disabled:n,answeredAction:r}){var u,p,c,h;const i=e.options,s=(typeof(i==null?void 0:i[0])=="string"?i[0]:(u=i==null?void 0:i[0])==null?void 0:u.label)||"批准",a=(typeof(i==null?void 0:i[1])=="string"?i[1]:(p=i==null?void 0:i[1])==null?void 0:p.label)||"拒绝",o=(typeof(i==null?void 0:i[2])=="string"?i[2]:(c=i==null?void 0:i[2])==null?void 0:c.label)||"跳过",l=((h=e.metadata)==null?void 0:h.showSkip)!==!1;return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(J,{name:"circle-alert",size:16,color:"#f59e0b"}),d.jsx("span",{children:e.content})]}),d.jsxs("div",{className:"sa-interrupt-actions",children:[d.jsxs("button",{className:`sa-interrupt-btn sa-interrupt-btn-primary ${r==="approve"?"sa-interrupt-btn-answered":""}`,disabled:n,onClick:()=>t({action:"approve"}),children:[d.jsx(J,{name:"check",size:14})," ",s]}),d.jsxs("button",{className:`sa-interrupt-btn sa-interrupt-btn-danger ${r==="reject"?"sa-interrupt-btn-answered":""}`,disabled:n,onClick:()=>t({action:"reject"}),children:[d.jsx(J,{name:"x",size:14})," ",a]}),l&&d.jsxs("button",{className:`sa-interrupt-btn sa-interrupt-btn-secondary ${r==="skip"?"sa-interrupt-btn-answered":""}`,disabled:n,onClick:()=>t({action:"skip"}),children:[d.jsx(J,{name:"chevron-right",size:14})," ",o]})]}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function Cp(e){return typeof e=="string"?{value:e,label:e}:e}function Sp({interrupt:e,onRespond:t,disabled:n,initialValue:r}){const i=(e.options??[]).map(Cp);return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(J,{name:"list",size:16,color:"#6366f1"}),d.jsx("span",{children:e.content})]}),d.jsx("div",{className:"sa-interrupt-options",children:i.map(s=>{const a=r===s.value;return d.jsxs("button",{className:`sa-interrupt-option ${s.danger?"sa-interrupt-option-danger":""} ${a?"sa-interrupt-option-selected":""}`,disabled:n,onClick:()=>t({action:"select",value:s.value}),children:[d.jsx(J,{name:a?"circle-check":"circle",size:14}),s.icon&&d.jsx(J,{name:s.icon,size:14}),d.jsx("span",{children:s.label}),s.description&&d.jsx("span",{className:"sa-interrupt-option-desc",children:s.description})]},s.value)})}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function jp(e){return typeof e=="string"?{value:e,label:e}:e}function Ep({interrupt:e,onRespond:t,disabled:n,initialValue:r}){const i=(e.options??[]).map(jp),[s,a]=y.useState(()=>new Set(Array.isArray(r)?r:[])),o=l=>{n||a(u=>{const p=new Set(u);return p.has(l)?p.delete(l):p.add(l),p})};return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(J,{name:"list-checks",size:16,color:"#6366f1"}),d.jsx("span",{children:e.content})]}),d.jsx("div",{className:"sa-interrupt-options",children:i.map(l=>d.jsxs("button",{className:`sa-interrupt-option ${s.has(l.value)?"sa-interrupt-option-selected":""}`,disabled:n,onClick:()=>o(l.value),children:[d.jsx(J,{name:s.has(l.value)?"square-check":"square",size:14}),d.jsx("span",{children:l.label})]},l.value))}),!n&&d.jsx("div",{className:"sa-interrupt-actions",children:d.jsxs("button",{className:"sa-interrupt-btn sa-interrupt-btn-primary",disabled:s.size===0,onClick:()=>t({action:"submit",value:Array.from(s)}),children:[d.jsx(J,{name:"check",size:14})," 确认 (",s.size,")"]})}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function Ip({interrupt:e,onRespond:t,disabled:n,initialValue:r}){const[i,s]=y.useState(r??""),a=e.inputType??"text",o=a==="textarea",l=()=>{n||e.required&&!i.trim()||t({action:"submit",value:i.trim()})};return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(J,{name:"text-cursor-input",size:16,color:"#6366f1"}),d.jsx("span",{children:e.content})]}),d.jsx("div",{className:"sa-interrupt-input-area",children:o?d.jsx("textarea",{className:"sa-interrupt-textarea",value:i,onChange:u=>s(u.target.value),placeholder:e.placeholder,maxLength:e.maxLength,rows:3,disabled:n}):d.jsx("input",{className:"sa-interrupt-input",type:a,value:i,onChange:u=>s(u.target.value),placeholder:e.placeholder,maxLength:e.maxLength,onKeyDown:u=>u.key==="Enter"&&l(),disabled:n})}),!n&&d.jsx("div",{className:"sa-interrupt-actions",children:d.jsxs("button",{className:"sa-interrupt-btn sa-interrupt-btn-primary",disabled:e.required?!i.trim():!1,onClick:l,children:[d.jsx(J,{name:"check",size:14})," 提交"]})}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function zp({interrupt:e,onRespond:t,disabled:n,initialValue:r}){const i=e.fields??[],[s,a]=y.useState(()=>{const p={};for(const c of i)p[c.name]=(r==null?void 0:r[c.name])??c.defaultValue??"";return p}),o=(p,c)=>{n||a(h=>({...h,[p]:c}))},l=!n&&i.every(p=>!p.required||s[p.name]),u=()=>{l&&t({action:"submit",value:s})};return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(J,{name:"file-text",size:16,color:"#6366f1"}),d.jsx("span",{children:e.content})]}),d.jsx("div",{className:"sa-interrupt-form",children:i.map(p=>d.jsxs("div",{className:"sa-interrupt-form-field",children:[d.jsxs("label",{className:"sa-interrupt-form-label",children:[p.label,p.required&&d.jsx("span",{className:"sa-interrupt-form-required",children:"*"})]}),Tp(p,s[p.name],c=>o(p.name,c),n)]},p.name))}),!n&&d.jsxs("div",{className:"sa-interrupt-actions",children:[d.jsxs("button",{className:"sa-interrupt-btn sa-interrupt-btn-primary",disabled:!l,onClick:u,children:[d.jsx(J,{name:"check",size:14})," 提交"]}),d.jsx("button",{className:"sa-interrupt-btn sa-interrupt-btn-secondary",onClick:()=>t({action:"cancel"}),children:"取消"})]}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function Lr(e){return typeof e=="string"?{value:e,label:e}:e}function Tp(e,t,n,r){switch(e.type){case"textarea":return d.jsx("textarea",{className:"sa-interrupt-textarea",value:t,onChange:i=>n(i.target.value),placeholder:e.placeholder,rows:3,disabled:r});case"select":{const i=(e.options??[]).map(Lr);return d.jsxs("select",{className:"sa-interrupt-select",value:t,onChange:s=>n(s.target.value),disabled:r,children:[d.jsx("option",{value:"",children:"请选择"}),i.map(s=>d.jsx("option",{value:s.value,children:s.label},s.value))]})}case"multiSelect":{const i=(e.options??[]).map(Lr),s=Array.isArray(t)?t:[],a=o=>{r||n(s.includes(o)?s.filter(l=>l!==o):[...s,o])};return d.jsx("div",{className:"sa-interrupt-options",children:i.map(o=>d.jsx("button",{type:"button",className:`sa-interrupt-option ${s.includes(o.value)?"sa-interrupt-option-selected":""}`,disabled:r,onClick:()=>a(o.value),children:o.label},o.value))})}case"password":return d.jsx("input",{className:"sa-interrupt-input",type:"password",value:t,onChange:i=>n(i.target.value),placeholder:e.placeholder,disabled:r});default:return d.jsx("input",{className:"sa-interrupt-input",type:e.type==="number"?"number":e.type==="date"?"date":"text",value:t,onChange:i=>n(i.target.value),placeholder:e.placeholder,disabled:r})}}function oa({interrupt:e,resolved:t,response:n,onRespond:r}){const i=t,s=n==null?void 0:n.value;switch(e.interruptType){case"confirm":return d.jsx(kp,{interrupt:e,onRespond:r,disabled:i,answeredAction:n==null?void 0:n.action});case"approve":return d.jsx(vp,{interrupt:e,onRespond:r,disabled:i,answeredAction:n==null?void 0:n.action});case"select":return d.jsx(Sp,{interrupt:e,onRespond:r,disabled:i,initialValue:s});case"multiSelect":return d.jsx(Ep,{interrupt:e,onRespond:r,disabled:i,initialValue:s});case"input":return d.jsx(Ip,{interrupt:e,onRespond:r,disabled:i,initialValue:s});case"form":return d.jsx(zp,{interrupt:e,onRespond:r,disabled:i,initialValue:s});default:return d.jsxs("div",{className:"sa-interrupt-unknown",children:["未知的交互类型: ",e.interruptType]})}}function Ap({files:e,artifactPreview:t}){const{openArtifactPreview:n}=ze();return e.length===0?null:d.jsx("ul",{className:"sa-artifact-file-list",role:"list",children:e.map((r,i)=>d.jsxs("li",{className:"sa-artifact-file-card",onClick:t?()=>n(r):void 0,onKeyDown:t?s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),n(r))}:void 0,tabIndex:t?0:void 0,role:t?"button":void 0,"aria-label":t?`预览 ${r.filename}`:void 0,style:t?{cursor:"pointer"}:void 0,children:[d.jsx("div",{className:"sa-artifact-file-icon",children:d.jsx("span",{className:"sa-artifact-chip-type",children:Or(r.type)})}),d.jsxs("div",{className:"sa-artifact-file-info",children:[d.jsx("span",{className:"sa-artifact-file-name",children:r.filename}),r.size!=null&&d.jsx("span",{className:"sa-artifact-file-size",children:_r(r.size)})]}),t&&d.jsx("button",{className:"sa-artifact-file-download",title:"下载","aria-label":`下载 ${r.filename}`,onClick:s=>{s.stopPropagation(),kt(r)},children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})})})]},r.id||`art-${i}`))})}const Np=[{value:1,label:"事实错误"},{value:2,label:"逻辑问题"},{value:3,label:"不相关"},{value:4,label:"信息过时"},{value:5,label:"冗长啰嗦"},{value:6,label:"难以理解"}];function la({message:e,onCopy:t,onRegenerate:n,onFeedback:r}){const{status:i,cancelFeedback:s}=ze(),[a,o]=y.useState(null),[l,u]=y.useState(!1),[p,c]=y.useState(!1),h=y.useRef(null),f=y.useCallback(()=>{t(),u(!0),setTimeout(()=>u(!1),2e3)},[t]),m=y.useCallback(()=>{a==="like"?(o(null),s(e.id)):(o("like"),c(!1),r==null||r(e.id,"like"))},[a,e.id,r,s]),w=y.useCallback(()=>{a==="dislike"?(o(null),c(!1),s(e.id)):c(!0)},[a,e.id,s]),C=y.useCallback((S,j)=>{o("dislike"),c(!1),r==null||r(e.id,"dislike",{reason:S,remark:(j==null?void 0:j.trim())||void 0})},[e.id,r]),b=y.useCallback(()=>{c(!1)},[]);return y.useEffect(()=>{if(!p)return;const S=L=>{h.current&&!h.current.contains(L.target)&&c(!1)},j=L=>{L.key==="Escape"&&c(!1)};return document.addEventListener("mousedown",S),document.addEventListener("keydown",j),()=>{document.removeEventListener("mousedown",S),document.removeEventListener("keydown",j)}},[p]),i!=="ready"&&i!=="error"?null:d.jsxs("div",{className:"sa-action-bar",children:[d.jsxs("button",{className:"sa-action-btn",onClick:f,title:"复制",children:[d.jsx(J,{name:l?"circle-check":"copy",size:14})," ",l?"已复制":"复制"]}),n&&d.jsxs("button",{className:"sa-action-btn",onClick:n,title:"重新生成",children:[d.jsx(J,{name:"refresh-cw",size:14})," 重新生成"]}),r&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"sa-action-divider"}),d.jsx("button",{className:`sa-action-btn ${a==="like"?"sa-action-btn-active":""}`,onClick:m,title:"有用","aria-label":"点赞",children:d.jsx(J,{name:"thumbs-up",size:14})}),d.jsx("button",{className:`sa-action-btn ${a==="dislike"?"sa-action-btn-active":""}`,onClick:w,title:"无用","aria-label":"踩","aria-expanded":p,"aria-haspopup":"dialog",children:d.jsx(J,{name:"thumbs-down",size:14})})]}),p&&d.jsx("div",{ref:h,children:d.jsx(Lp,{onSubmit:C,onCancel:b})})]})}function Lp({onSubmit:e,onCancel:t}){const[n,r]=y.useState(void 0),[i,s]=y.useState("");return d.jsxs("div",{className:"sa-dislike-panel",children:[d.jsx("div",{className:"sa-dislike-panel-title",children:"请选择不满意的原因(可选)"}),d.jsx("div",{className:"sa-dislike-reasons",children:Np.map(a=>d.jsx("button",{className:`sa-dislike-reason-btn ${n===a.value?"active":""}`,onClick:()=>r(n===a.value?void 0:a.value),children:a.label},a.value))}),d.jsx("textarea",{className:"sa-dislike-remark",placeholder:"补充描述(选填,≤500 字)",maxLength:500,value:i,onChange:a=>s(a.target.value),rows:2}),d.jsxs("div",{className:"sa-dislike-actions",children:[d.jsx("button",{className:"sa-dislike-submit",onClick:()=>e(n,i||void 0),children:"提交"}),d.jsx("button",{className:"sa-dislike-cancel",onClick:t,children:"取消"})]})]})}const Dp=/^(https?:\/\/|data:|blob:|\/\/|\/|\.\/|\.\.\/)/;function Dr({src:e,alt:t}){return e?Dp.test(e)?d.jsx("img",{src:e,alt:t??"",className:"sa-msg-avatar",draggable:!1}):d.jsx("span",{className:"sa-msg-avatar sa-msg-avatar-text",children:e}):null}function ua({message:e,isStreaming:t,isLast:n,slots:r,avatar:i,artifactPreview:s,showTimestamp:a}){const{regenerate:o,feedback:l,respondToInterrupt:u}=ze(),p=y.useCallback(()=>{var A;const L=e.parts.filter(k=>k.type==="text").map(k=>k.content).join(`
|
|
30
|
-
`);(A=navigator.clipboard)==null||A.writeText(L).catch(()=>{})},[e]),c=e.role==="user",h=r.Message;if(h)return d.jsx(h,{message:e,isStreaming:t,isLast:n,avatar:i,slots:r,onCopy:p,onRegenerate:o,onFeedback:l,showTimestamp:a});const f=r.TextPart??ea,m=r.ThinkingPart??na,w=r.ToolCallPart??ra,C=r.ToolResultPart??ia,b=r.ErrorPart??aa,S=r.ActionBar??la,j=!c&&e.parts.some(L=>L.type==="text"&&L.content);return d.jsxs("div",{className:`sa-message ${c?"sa-message-user":"sa-message-assistant"}`,children:[!c&&d.jsx(Dr,{src:(i==null?void 0:i.assistant)||(t&&n?pe.assistantAvatarGenerating:pe.assistantAvatar),alt:"AI"}),d.jsxs("div",{className:"sa-message-content",children:[a&&d.jsx("span",{className:`sa-message-time ${c?"sa-message-time-right":""}`,children:ja(e.timestamp)}),d.jsxs("div",{className:"sa-message-body",children:[e.parts.map((L,A)=>{switch(L.type){case"text":return d.jsx(f,{content:L.content},A);case"attachment":return d.jsx(yp,{attachment:L.attachment},A);case"thinking":return d.jsx(m,{content:L.content},A);case"tool_call":return d.jsx(w,{toolName:L.toolName,toolCallId:L.toolCallId,args:L.args},A);case"tool_result":return d.jsx(C,{toolName:L.toolName,toolCallId:L.toolCallId,content:L.content,artifacts:L.artifacts,renderMode:L.renderMode,html:L.html,artifactPreview:s},A);case"error":return d.jsx(b,{content:L.content,onRetry:o},A);case"interrupt":return d.jsx(oa,{interrupt:L.interrupt,resolved:L.resolved??!1,response:L.response,onRespond:k=>u(L.interrupt.interruptId,k)},A);default:return null}}),t&&n&&!c&&!j&&d.jsx("span",{className:"sa-thinking-indicator",children:"思考中…"}),!c&&e.artifacts&&e.artifacts.length>0&&d.jsx(Ap,{files:Br(e.artifacts),artifactPreview:s}),!c&&!t&&j&&d.jsx(S,{message:e,onCopy:p,onRegenerate:n?o:void 0,onFeedback:l})]})]}),c&&(i==null?void 0:i.user)&&d.jsx(Dr,{src:i.user,alt:"用户"})]})}function ca({message:e,suggestedPrompts:t,onPromptClick:n,capabilities:r,quickLinks:i,logo:s,openPanel:a}){const o=l=>{if(l.onClick){l.onClick();return}const u=l.action;if(!u){l.prompt&&n(l.prompt);return}a==null||a(u.type==="link"?u:{...u,title:u.title??l.label})};return d.jsxs("div",{className:"flex flex-col gap-8 py-2",children:[d.jsxs("div",{className:"flex flex-col items-center gap-1 opacity-0 animate-sa-home-fade-in",children:[d.jsx("img",{src:s||pe.logo,alt:"AI 助手",className:"block max-w-16 shrink-0 animate-sa-logo-float",draggable:!1}),d.jsx("h3",{className:"sa-shimmer-text m-0 mb-1 text-[18px] font-bold leading-[1.3] text-[#333] animate-sa-title-shimmer",children:e||"你好!有什么可以帮你的?"})]}),r&&r.length>0&&d.jsx("div",{className:"flex flex-col items-start gap-4 opacity-0 animate-sa-home-fade-in",style:{animationDelay:"150ms"},children:r.map(l=>d.jsxs("div",{className:"inline-flex w-full max-w-full min-w-0 items-center gap-[7px]",children:[l.icon&&d.jsx("img",{src:l.icon,alt:"",className:"h-[18px] w-[18px] shrink-0 object-contain",draggable:!1}),d.jsx("span",{className:"shrink-0 text-[14px] leading-[1.4] text-[#333]",children:l.label}),l.desc&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"h-[13px] w-px shrink-0 bg-[#DCDCDC]"}),d.jsx("span",{className:"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-[14px] leading-[1.4] text-[#9A9A9A]",children:l.desc})]})]},l.label))}),t&&t.length>0&&d.jsx("div",{className:"flex flex-col items-start gap-3",children:t.map((l,u)=>d.jsxs("button",{type:"button",className:"sa-chip inline-flex h-7 items-center gap-1 rounded-md px-3 text-[14px] leading-none text-[#333] opacity-0 transition-colors animate-sa-chip-in",style:{animationDelay:`${300+u*130}ms`},onClick:()=>n(l),children:[d.jsx("span",{className:"sa-chip-text overflow-hidden text-ellipsis whitespace-nowrap",children:l}),d.jsx("svg",{width:13,height:13,viewBox:"0 0 14 14",fill:"none",className:"shrink-0 text-[#9A9A9A]","aria-hidden":"true",children:d.jsx("path",{d:"M5 3L9 7L5 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]},`${l}-${u}`))}),i&&i.length>0&&d.jsxs("div",{className:"opacity-0 animate-sa-home-fade-in",style:{animationDelay:"420ms"},children:[d.jsx("div",{className:"mb-3 text-[14px] leading-none text-[#A0A0A0]",children:"快速查看"}),d.jsx("div",{className:"flex flex-wrap items-center gap-[22px]",children:i.map(l=>d.jsxs("button",{type:"button",className:"inline-flex items-center gap-[7px] rounded-md px-1 py-1 transition-colors hover:bg-[#F5F5F5]",onClick:()=>o(l),children:[l.icon&&d.jsx("span",{className:"flex h-[18px] w-[18px] shrink-0 items-center justify-center opacity-70",children:d.jsx("img",{src:l.icon,alt:"",width:18,height:18,draggable:!1})}),d.jsx("span",{className:"text-[14px] leading-none text-[#333] transition-colors hover:text-[#1881F0]",children:l.label})]},l.label))})]})]})}function Ln({slots:e,welcomeMessage:t,suggestedPrompts:n,avatar:r,artifactPreview:i,capabilities:s,quickLinks:a,logo:o,showTimestamp:l}){const{messages:u,status:p,sendMessage:c,openPanel:h}=ze(),{containerRef:f}=qr([u]),m=p==="streaming",w=e.WelcomeScreen??ca,C=e.AppendContainer;return u.length===0?d.jsxs("div",{className:"sa-thread",ref:f,children:[d.jsx(w,{message:t,suggestedPrompts:n,onPromptClick:c,capabilities:s,quickLinks:a,logo:o,openPanel:h}),C&&d.jsx(C,{openPanel:h})]}):d.jsx("div",{className:"sa-thread",ref:f,children:u.map((b,S)=>d.jsx(ua,{message:b,isStreaming:m,isLast:S===u.length-1,slots:e,avatar:r,artifactPreview:i,showTimestamp:l},b.id))})}function da({size:e=12}){return d.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:d.jsx("path",{d:"M12 2.5l1.8 5.2a3 3 0 0 0 1.9 1.9l5.2 1.8-5.2 1.8a3 3 0 0 0-1.9 1.9L12 20.3l-1.8-5.2a3 3 0 0 0-1.9-1.9L3.1 11.4l5.2-1.8a3 3 0 0 0 1.9-1.9z"})})}function Mp({items:e,activeIndex:t,onSelect:n}){const r=y.useRef(null);return y.useEffect(()=>{var s;const i=(s=r.current)==null?void 0:s.children[t];i==null||i.scrollIntoView({block:"nearest"})},[t]),d.jsxs("div",{className:"sa-slash-menu",children:[d.jsxs("div",{className:"sa-slash-menu-header",children:["技能 (",e.length,")"]}),d.jsx("div",{className:"sa-slash-menu-body",ref:r,children:e.length===0?d.jsx("div",{className:"sa-slash-menu-empty",children:"没有匹配的技能"}):e.map((i,s)=>{const a=i.displayName||i.name,o=i.owner==="member"&&i.memberName?i.memberName:null,l=!i.selectable;return d.jsxs("div",{className:"sa-slash-menu-item"+(s===t?" sa-slash-menu-item--active":"")+(l?" sa-slash-menu-item--disabled":""),"aria-disabled":l||void 0,title:l?i.disabledReason??void 0:void 0,onMouseDown:u=>{u.preventDefault(),!l&&n(i)},children:[d.jsx("span",{className:"sa-slash-menu-item-icon",children:d.jsx(da,{size:13})}),d.jsx("span",{className:"sa-slash-menu-item-name",children:a}),o&&d.jsx("span",{className:"sa-slash-menu-item-owner",children:o}),l&&i.disabledReason?d.jsx("span",{className:"sa-slash-menu-item-desc",children:i.disabledReason}):i.description&&d.jsx("span",{className:"sa-slash-menu-item-desc",children:i.description})]},i.code)})})]})}function Rp({sdk:e,input:t,onSelect:n}){const[r,i]=y.useState([]),[s,a]=y.useState(!1),[o,l]=y.useState(0),u=y.useRef(!1);y.useEffect(()=>{u.current||(u.current=!0,e.listSkills().then(i).catch(()=>i([])))},[e]);const p=/^\/\S*$/.test(t);y.useEffect(()=>{a(p)},[p]);const c=t.startsWith("/")?t.slice(1).toLowerCase():"",h=y.useMemo(()=>r.filter(A=>!c||A.code.toLowerCase().includes(c)||A.name.toLowerCase().includes(c)||A.displayName&&A.displayName.toLowerCase().includes(c)),[r,c]),f=y.useMemo(()=>h.reduce((A,k,N)=>k.selectable?[...A,N]:A,[]),[h]);y.useEffect(()=>{p&&l(f[0]??0)},[t,p,f]);const m=y.useRef(s),w=y.useRef(h),C=y.useRef(f),b=y.useRef(o),S=y.useRef(n);m.current=s,w.current=h,C.current=f,b.current=o,S.current=n;const j=y.useCallback(A=>{if(!m.current)return!1;const k=C.current;if(k.length===0)return!1;const N=_=>{const O=k.indexOf(b.current),v=O===-1?k[0]:k[(O+_+k.length)%k.length];l(v)};switch(A.key){case"ArrowDown":return A.preventDefault(),N(1),!0;case"ArrowUp":return A.preventDefault(),N(-1),!0;case"Enter":case"Tab":{const _=w.current[b.current];return!_||!_.selectable?!1:(A.preventDefault(),S.current(_),a(!1),!0)}case"Escape":return A.preventDefault(),a(!1),!0;default:return!1}},[]),L=y.useCallback(()=>a(!1),[]);return{isOpen:s,items:h,activeIndex:o,handleKeyDown:j,close:L}}const Pp=10,Fp=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent);function _p({size:e=16}){return d.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}function Op({size:e=12}){return d.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round","aria-hidden":"true",children:d.jsx("path",{d:"M6 6l12 12M18 6L6 18"})})}function Bp({skill:e,onRemove:t}){const n=e.displayName||e.name,r=e.owner==="member"&&e.memberName?`${n}(成员 ${e.memberName} 的技能)`:n;return d.jsxs("span",{className:"sa-skill-chip",title:r,children:[d.jsxs("button",{type:"button",className:"sa-skill-chip-icon","aria-label":`移除技能 ${n}`,onClick:i=>{i.stopPropagation(),t()},children:[d.jsx("span",{className:"sa-skill-chip-icon-skill",children:d.jsx(da,{})}),d.jsx("span",{className:"sa-skill-chip-icon-remove",children:d.jsx(Op,{})})]}),d.jsx("span",{className:"sa-skill-chip-label",children:n})]})}function Dn(){const{status:e,sendMessage:t,stop:n,sdk:r,attachmentUploader:i,nosUpload:s}=ze(),[a,o]=y.useState(""),[l,u]=y.useState(null),[p,c]=y.useState([]),h=y.useRef(null),f=y.useRef(null),m=!!i||!!s,w=e==="streaming"||e==="submitted",C=p.filter(E=>E.attachment),b=p.some(E=>!E.attachment&&E.status==="uploading"),S=!!a.trim()||!!l||p.length>0||w,j=!w&&!b&&(a.trim().length>0||!!l||C.length>0),L=y.useCallback(E=>{u(E),o(""),setTimeout(()=>{var I;return(I=h.current)==null?void 0:I.focus()},0)},[]),A=y.useCallback(()=>{var E;u(null),(E=h.current)==null||E.focus()},[]),k=Rp({sdk:r,input:a,onSelect:L}),N=y.useCallback(E=>{const I=Array.from(E.target.files??[]);if(E.target.value="",!m||I.length===0)return;const F=Pp-p.length,q=I.slice(0,Math.max(0,F));if(q.length===0)return;const U=q.map(P=>({key:`${P.name}_${P.size}_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,file:P,status:"uploading"}));c(P=>[...P,...U]);for(const{key:P,file:B}of U)(i||Me.createNosUploader({baseURL:s.baseURL,headers:s.headers,trunkSize:s.trunkSize,onProgress:H=>c($=>$.map(g=>g.key===P?{...g,percent:H}:g))}))(B).then(H=>{c($=>$.map(g=>g.key===P?{...g,attachment:{...H,filename:H.filename||B.name,size:H.size??B.size,mime:H.mime??B.type}}:g))}).catch(H=>{c($=>$.map(g=>g.key===P?{...g,status:"error",errorMsg:H instanceof Error?H.message:String(H)}:g))})},[i,s,p]),_=y.useCallback(E=>{c(I=>I.filter(F=>F.key!==E))},[]),O=y.useCallback(()=>{if(!j)return;const E=a.trim(),I=C.map(q=>q.attachment),F=l?`/${l.code}${E?` ${E}`:""}`:E;t(F,I.length>0?I:void 0),o(""),u(null),c([]),h.current&&(h.current.style.height="auto")},[j,a,l,C,t]),v=y.useCallback(E=>{if(!k.handleKeyDown(E)){if(E.key==="Backspace"&&l&&a.length===0){E.preventDefault(),u(null);return}E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),O())}},[O,k.handleKeyDown,l,a]),D=y.useCallback(E=>{o(E.target.value);const I=E.target;I.style.height="auto",I.style.height=Math.min(I.scrollHeight,90)+"px"},[]),T=y.useCallback(()=>{var E;w||(E=h.current)==null||E.focus()},[w]);return d.jsxs("div",{className:"relative z-[2] shrink-0 px-[15px] pb-2.5",children:[k.isOpen&&d.jsx(Mp,{items:k.items,activeIndex:k.activeIndex,onSelect:L}),p.length>0&&d.jsx("div",{className:"sa-attachment-tray mb-1.5",onClick:E=>E.stopPropagation(),children:p.map(E=>d.jsxs("span",{className:`sa-attachment-tray-chip ${E.status==="error"?"sa-attachment-tray-chip-error":""}`,title:E.status==="error"?`上传失败:${E.errorMsg??""}`:E.file.name,children:[d.jsx(J,{name:"file-text",size:13,color:E.status==="error"?"#ef4444":"#6366f1"}),d.jsx("span",{className:"sa-attachment-tray-chip-name",children:E.file.name}),d.jsx("span",{className:"sa-attachment-tray-chip-size",children:E.attachment?sa(E.file.size):E.status==="error"?"失败":E.percent!=null?`${Math.min(99,Math.round(E.percent))}%`:"上传中…"}),d.jsx("button",{type:"button",className:"sa-attachment-tray-chip-remove","aria-label":`移除附件 ${E.file.name}`,onClick:()=>_(E.key),children:"✕"})]},E.key))}),d.jsxs("form",{className:`sa-input-form relative flex min-h-[70px] cursor-text flex-col gap-1 rounded-[5px] p-2 ${S?"sa-input-form-active":""} ${w?"sa-input-form-streaming":""}`,onClick:T,onSubmit:E=>{E.preventDefault(),O()},children:[d.jsxs("div",{className:"flex items-start gap-1.5",children:[l&&d.jsx(Bp,{skill:l,onRemove:A}),d.jsx("textarea",{ref:h,className:"sa-input-field min-h-[34px] min-w-0 flex-1 resize-none border-none bg-transparent p-0 text-[14px] leading-[1.5] text-[#333] outline-none placeholder:text-[#B8B8B8]",value:a,onChange:D,onKeyDown:v,placeholder:w?"回答生成中,请稍候…":l?"补充你的需求…":"发消息或创建任务... /使用技能",rows:1,disabled:w})]}),d.jsxs("div",{className:"flex items-center justify-end gap-2",children:[m&&!w&&d.jsx("button",{type:"button",className:"sa-attach-btn mr-auto","aria-label":"添加附件",title:"添加附件",onClick:()=>{var E;return(E=f.current)==null?void 0:E.click()},children:d.jsx(_p,{size:15})}),d.jsx("input",{ref:f,type:"file",multiple:!0,className:"hidden",onChange:N,"aria-label":"选择附件"}),!w&&d.jsxs("span",{className:"sa-send-hint","aria-hidden":"true",children:[d.jsx("kbd",{className:"sa-send-kbd",children:Fp?"⌘":"Ctrl"}),d.jsx("span",{children:"+"}),d.jsx("kbd",{className:"sa-send-kbd",children:"Enter"}),d.jsx("span",{children:"发送"})]}),w?d.jsx("button",{type:"button",className:"sa-send-btn sa-send-btn-active","aria-label":"停止生成",title:"停止生成",onClick:n,children:d.jsx("span",{className:"sa-stop-icon"})}):d.jsx("button",{type:"submit",className:`sa-send-btn ${j?"sa-send-btn-active":""}`,"aria-label":"发送",title:"发送",disabled:!j,children:d.jsx("img",{src:pe.sendSolid,alt:"发送",width:14,height:14,draggable:!1})})]})]}),d.jsx("div",{className:"mt-3 text-center text-[11px] leading-none text-[#B8B8B8]",children:"所有内容均由AI生成仅供参考"})]})}function $p({artifact:e}){const[t,n]=y.useState(null),[r,i]=y.useState(null),[s,a]=y.useState(!0),[o,l]=y.useState(null);return y.useEffect(()=>{let u=!1;a(!0),l(null),n(null),i(null);async function p(){try{if(e.type==="pdf"){u||a(!1);return}if(e.type==="md"){const c=await fetch(e.url);if(!c.ok)throw new Error(`HTTP ${c.status}`);const h=await c.text();u||(i(h),a(!1));return}if(e.type==="html"){const c=await fetch(e.url);if(!c.ok)throw new Error(`HTTP ${c.status}`);const h=await c.text(),f=(await Promise.resolve().then(()=>require("./purify.es-Dsdnkgrg.cjs"))).default;u||(n(f.sanitize(h,{FORCE_BODY:!0,ADD_ATTR:["target"]})),a(!1));return}if(e.type==="docx"){const c=await fetch(e.url);if(!c.ok)throw new Error(`HTTP ${c.status}`);const h=await c.arrayBuffer(),m=await(await Promise.resolve().then(()=>require("./mammoth.browser-CxQENq5Q.cjs")).then(C=>C.mammoth_browser)).convertToHtml({arrayBuffer:h}),w=(await Promise.resolve().then(()=>require("./purify.es-Dsdnkgrg.cjs"))).default;u||(n(w.sanitize(m.value,{FORCE_BODY:!0,ADD_ATTR:["target"]})),a(!1));return}u||(a(!1),l(`不支持预览「${e.type}」类型`))}catch(c){u||(a(!1),l(c instanceof Error?c.message:"加载失败"))}}return p(),()=>{u=!0}},[e]),s?d.jsx("div",{className:"sa-drawer-preview-loading",children:"加载中"}):o?d.jsxs("div",{className:"sa-drawer-preview-error",children:[o,d.jsx("button",{className:"sa-drawer-btn-sm",onClick:()=>void kt(e),children:"下载查看"})]}):e.type==="pdf"?d.jsx("iframe",{src:e.url,title:e.filename,className:"sa-drawer-preview-iframe",sandbox:"allow-scripts"}):r!==null?d.jsx("div",{className:"sa-drawer-preview-html-scroll",children:d.jsx("div",{className:"sa-drawer-preview-html sa-text-part",children:d.jsx(Ti,{remarkPlugins:[Zi],children:r})})}):t!==null?d.jsx("div",{className:"sa-drawer-preview-html-scroll",children:d.jsx("div",{className:"sa-drawer-preview-html sa-text-part",dangerouslySetInnerHTML:{__html:t}})}):null}function Hp({artifacts:e,initialArtifact:t,onClose:n}){const[r,i]=y.useState(t?{mode:"preview",artifact:t}:{mode:"list"}),[s,a]=y.useState(!1),o=y.useRef(null),[l,u]=y.useState(340),p=y.useRef(null);y.useEffect(()=>{t&&(o.current&&(clearTimeout(o.current),o.current=null,a(!1)),i({mode:"preview",artifact:t}))},[t]);const c=y.useCallback(()=>{a(!0),o.current=setTimeout(()=>{o.current=null,n()},240)},[n]);y.useEffect(()=>()=>{var w;o.current&&clearTimeout(o.current),(w=p.current)==null||w.call(p)},[]);const h=y.useCallback(w=>{i({mode:"preview",artifact:w})},[]),f=y.useCallback(()=>{i({mode:"list"})},[]);y.useEffect(()=>{const w=C=>{C.key==="Escape"&&c()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[c]);const m=y.useCallback(w=>{w.preventDefault();const C=w.clientX,b=l,S=L=>{const A=C-L.clientX;u(Math.max(240,Math.min(window.innerWidth*.7,b+A)))},j=()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect="",p.current=null};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",S),document.addEventListener("mouseup",j),p.current=j},[l]);return d.jsxs("div",{className:`sa-artifact-drawer ${s?"sa-drawer-closing":""}`,style:{width:l},children:[d.jsx("div",{className:"sa-drawer-resize-handle",onMouseDown:m}),d.jsxs("div",{className:"sa-artifact-drawer-header",children:[r.mode==="preview"?d.jsxs(d.Fragment,{children:[d.jsx("button",{className:"sa-drawer-btn",onClick:f,title:"返回列表","aria-label":"返回列表",children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d.jsx("path",{d:"M15 18l-6-6 6-6"})})}),d.jsx("span",{className:"sa-artifact-drawer-title",children:r.artifact.filename})]}):d.jsxs(d.Fragment,{children:[d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{flexShrink:0},children:[d.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),d.jsx("polyline",{points:"14 2 14 8 20 8"})]}),d.jsx("span",{className:"sa-artifact-drawer-title",children:"会话产物"})]}),d.jsx("div",{style:{flex:1}}),r.mode==="preview"&&d.jsx("button",{className:"sa-drawer-btn",onClick:()=>void kt(r.artifact),title:"下载","aria-label":"下载",children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})})}),d.jsx("button",{className:"sa-drawer-btn",onClick:c,title:"关闭","aria-label":"关闭",children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),d.jsx("div",{className:"sa-artifact-drawer-body",children:r.mode==="list"?e.length===0?d.jsx("div",{className:"sa-drawer-empty",children:"暂无产物"}):d.jsx("ul",{className:"sa-drawer-file-list",role:"list",children:e.map((w,C)=>d.jsxs("li",{className:"sa-drawer-file-card",onClick:()=>h(w),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),h(w))},tabIndex:0,role:"button","aria-label":`预览 ${w.filename}`,children:[d.jsx("div",{className:"sa-drawer-file-icon",children:d.jsx("span",{className:"sa-artifact-chip-type",children:Or(w.type)})}),d.jsxs("div",{className:"sa-drawer-file-info",children:[d.jsx("span",{className:"sa-drawer-file-name",children:w.filename}),d.jsx("span",{className:"sa-drawer-file-size",children:_r(w.size)})]}),d.jsx("button",{className:"sa-drawer-btn",title:"下载","aria-label":`下载 ${w.filename}`,onClick:b=>{b.stopPropagation(),kt(w)},children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})})})]},w.id||`artifact-${C}`))}):d.jsx("div",{className:"sa-drawer-view-enter",children:d.jsx($p,{artifact:r.artifact})})})]})}function pa({page:e,onBack:t,centered:n}){y.useEffect(()=>{const i=s=>{s.key==="Escape"&&t()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]);const r=y.isValidElement(e.component)?y.cloneElement(e.component,{close:t}):y.createElement(e.component,{close:t});return d.jsx("div",{className:`sa-page-overlay ${n?"sa-page-overlay-centered":""}`,children:d.jsx("div",{className:"sa-page-overlay-body",children:r})})}const Up="mx-auto w-full max-w-[800px]";function fa({contentClassName:e,centered:t,composerClassName:n,thread:r,composer:i,artifactPreview:s}){const{activePanel:a,closePanel:o,messagesLoading:l,isArtifactDrawerOpen:u,allArtifacts:p,activePreviewArtifact:c,toggleArtifactDrawer:h}=ze();if(a)return d.jsx(pa,{page:a,onBack:o,centered:t});const f=t?Up:"";return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`${e} ${f}`,children:[l?d.jsxs("div",{className:"sa-messages-loading",children:[d.jsx("span",{className:"sa-loading-spinner"}),"加载对话..."]}):r,s&&u&&d.jsx(Hp,{artifacts:p,initialArtifact:c,onClose:h})]}),n?d.jsx("div",{className:`${n} ${f}`,children:i}):i]})}function Vp({isOpen:e,onClose:t,title:n,slots:r,welcomeMessage:i,suggestedPrompts:s,avatar:a,artifactPreview:o,capabilities:l,quickLinks:u,logo:p,defaultWidth:c,defaultHeight:h,showTimestamp:f}){const{status:m,sendMessage:w,stop:C,toggleThreadList:b,setThreadListOpen:S,isThreadListOpen:j,toggleArtifactDrawer:L,allArtifacts:A,activePanel:k,closePanel:N,messages:_,messagesLoading:O,conversations:v,activeConversationId:D,switchConversation:T,newConversation:E,deleteConversation:I,renameConversation:F,hasMore:q,loadMoreConversations:U}=ze(),{width:P,position:B,hasCustomPosition:x,isMaximized:H,totalWidth:$,windowHeight:g,startWindowDrag:Y,startResize:te,toggleMaximize:ee,reset:ue,setLockedHeight:ae}=va({defaultWidth:c??de.DEFAULT_WIDTH,defaultHeight:h??de.DEFAULT_HEIGHT,sidebarWidth:0}),W=y.useRef(null),se=y.useRef(null),le=!O&&_.length===0,Ee=!O&&_.length>0,be=!!k;y.useEffect(()=>{e||(ue(),N())},[e,ue,N]),y.useEffect(()=>{S(H?W.current??!0:se.current??!1)},[H,S]),y.useEffect(()=>{Ee||ae(null)},[Ee,ae]);const Lt=Ca({enabled:e&&Ee&&!H&&!be,contentSelector:".sa-panel-content",defaultHeight:h??de.DEFAULT_HEIGHT,onHeightChange:ae});if(!e)return null;const Ke=r.Header,Qe=r.Composer,Pe=r.ThreadList,Dt=()=>{const K=!j;b(),H?W.current=K:se.current=K},Je=200,Ze=j&&!H,ve="var(--sa-radius, 16px)",ht=Ze?`0px ${ve} ${ve} 0px`:`${ve} ${ve} ${ve} ${ve}`,Mt=x?B.x:window.innerWidth-$-20,Ve=Math.min(Je,Math.max(0,Mt-1)),Rt=x?{width:`${$}px`,height:`${g}px`,left:`${B.x}px`,top:`${B.y}px`}:{width:`${$}px`,height:`${g}px`,right:"20px",bottom:"20px"},z={title:n,onClose:t,onToggleThreadList:Dt,isMaximized:H,onToggleMaximize:ee,showHome:Ee||be,onHome:be?N:E,panelTitle:be?k==null?void 0:k.title:void 0,artifactCount:be||!o?0:A.length,onToggleArtifactDrawer:be||!o?void 0:L},R={conversations:v,activeSessionId:D,onSwitch:T,onNew:E,onDelete:I,onRename:F,hasMore:q,onLoadMore:U},G=d.jsxs("div",{className:`relative flex min-w-0 flex-col bg-white ${H?"flex-1":"h-full shrink-0"}`,style:H?void 0:{width:`${P}px`,borderRadius:ht,overflow:"hidden"},children:[le&&!be&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"sa-home-gradient pointer-events-none absolute inset-x-0 top-0 z-0 h-[238px] opacity-10"}),d.jsx("div",{className:"sa-home-gradient-fade pointer-events-none absolute inset-x-0 top-0 z-[1] h-[238px]"})]}),d.jsx("div",{className:`relative z-20 ${le||H?"":"bg-white"} ${H?"cursor-default":"cursor-grab active:cursor-grabbing"}`,onMouseDown:H?void 0:Y,children:Ke?d.jsx(Ke,{...z}):d.jsx(Ur,{...z})}),d.jsx(fa,{contentClassName:`sa-panel-content relative z-[2] ${le?"sa-home-view":""}`,centered:H,composerClassName:"shrink-0",artifactPreview:o,thread:d.jsx(Ln,{slots:r,welcomeMessage:i,suggestedPrompts:s,avatar:a,artifactPreview:o,capabilities:l,quickLinks:u,logo:p,showTimestamp:f}),composer:Qe?d.jsx(Qe,{status:m,onSend:w,onStop:C}):d.jsx(Dn,{})})]});return H?d.jsx("div",{className:"fixed inset-0 z-[var(--sa-z-index,9999)] flex animate-sa-fade-in flex-col justify-end bg-black/30",children:d.jsxs("div",{className:"flex h-[calc(100%_-_48px)] w-full animate-sa-slide-up-full flex-row overflow-hidden bg-[#F5F5F5] shadow-[0_-12px_48px_rgba(0,0,0,0.25)]",style:{borderRadius:"var(--sa-radius, 16px) var(--sa-radius, 16px) 0px 0px"},children:[j&&(Pe?d.jsx(Pe,{...R}):d.jsx(Zt,{width:220})),G]})}):d.jsxs("div",{ref:Lt,className:"fixed z-[var(--sa-z-index,9999)] flex animate-sa-window-in flex-row overflow-visible border border-[#DADADA] bg-white ",style:{...Rt,borderRadius:ht},children:[d.jsx("div",{className:"sa-resize-handle absolute bottom-0 left-[-3px] top-0 z-20 w-[6px] cursor-col-resize",onMouseDown:K=>te(K)}),Ze&&(Pe?d.jsx("div",{className:"absolute -top-px -bottom-px -left-px z-10 overflow-hidden border border-r-0 border-[#DADADA] bg-[#FAFAFA] ",style:{width:Ve,transform:`translateX(-${Ve}px)`,borderRadius:`${ve} 0px 0px ${ve}`},children:d.jsx(Pe,{...R})}):d.jsx("div",{className:"absolute -top-px -bottom-px -left-px z-10 overflow-hidden border border-r-0 border-[#DADADA] bg-[#FAFAFA] ",style:{width:Ve,transform:`translateX(-${Ve}px)`,borderRadius:`${ve} 0px 0px ${ve}`},children:d.jsx(Zt,{width:Je})})),G]})}const Mr=()=>{};function qp({conversations:e,activeSessionId:t,onSwitch:n,onNew:r,onDelete:i,onRename:s,isCollapsed:a,onToggleCollapse:o,hasMore:l,onLoadMore:u,conversationsLoading:p}){const[c,h]=y.useState(null),[f,m]=y.useState(null),[w,C]=y.useState(""),[b,S]=y.useState(null),j=y.useRef(null);y.useEffect(()=>()=>{j.current&&clearTimeout(j.current)},[]);const L=y.useCallback((v,D)=>{D.stopPropagation(),c===v?(i(v),h(null)):(h(v),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>h(null),3e3))},[c,i]),A=y.useCallback((v,D,T)=>{T.stopPropagation(),m(v),C(D??"")},[]),k=y.useCallback(v=>{w.trim()&&s(v,w.trim()),m(null)},[w,s]),N=y.useRef(null),_=y.useCallback(()=>{const v=N.current;!v||!l||!u||v.scrollHeight-v.scrollTop-v.clientHeight<50&&u()},[l,u]),O=y.useMemo(()=>Vr(e),[e]);return a?d.jsxs("div",{className:"flex w-12 shrink-0 flex-col items-center gap-1 border-r border-[#ECECEC] bg-[#FAFAFA] py-3",children:[d.jsx("button",{type:"button",className:"sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white","data-tooltip":"展开",onClick:o,children:d.jsx(J,{name:"panel-left",size:18})}),d.jsx("button",{type:"button",className:"sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white","data-tooltip":"新建对话",onClick:()=>{r(),o()},children:d.jsx("img",{src:pe.messageCreate,alt:"",width:18,height:18})})]}):d.jsxs("div",{className:"relative flex w-[220px] shrink-0 flex-col border-r border-[#ECECEC] bg-[#FAFAFA] p-3",children:[d.jsxs("div",{className:"mb-4 flex shrink-0 items-center gap-1.5",children:[d.jsxs("button",{type:"button",className:"sa-new-chat flex h-8 flex-1 items-center justify-center gap-2 rounded-md text-[14px] font-medium transition-colors",onClick:r,children:[d.jsx("img",{src:pe.messageCreate,alt:"",width:18,height:18}),d.jsx("span",{className:"sa-new-chat-text whitespace-nowrap",children:"新建对话"})]}),d.jsx("button",{type:"button",className:"sa-tip relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white","data-tooltip":"收起侧边栏",onClick:o,children:d.jsx(J,{name:"panel-left-close",size:16})})]}),d.jsxs("div",{className:"px-1 pb-2.5",children:[d.jsx("div",{className:"mb-1 text-[14px] font-semibold text-[#333]",children:"历史对话"}),d.jsx("div",{className:"text-[11px] text-[#999]",children:"展示最近的会话记录"})]}),d.jsxs("div",{ref:N,className:"flex-1 overflow-y-auto",onScroll:_,children:[p&&e.length===0&&d.jsx("div",{className:"px-0.5 py-2 text-[12px] text-[#999]",children:"加载中..."}),!p&&e.length===0&&d.jsx("div",{className:"px-0.5 py-2 text-[12px] text-[#999]",children:"暂无记录"}),O.map(v=>d.jsxs("div",{className:"mb-1",children:[d.jsx("div",{className:"px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]",children:v.label}),v.items.map(D=>{const T=D.sessionId===t,E=c===D.sessionId;return d.jsx("div",{className:`group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${T?"bg-[#E8F1FE]":"hover:bg-[#E8F1FE]"}`,onClick:()=>{f!==D.sessionId&&n(D.sessionId)},onMouseEnter:I=>{if(f===D.sessionId)return;const F=I.currentTarget.getBoundingClientRect();S({text:D.title||"新会话",x:F.right+8,y:F.top+F.height/2})},onMouseLeave:()=>S(null),children:f===D.sessionId?d.jsx("input",{className:"w-full rounded border border-[var(--sa-primary)] bg-white px-1.5 py-0.5 text-[12px] outline-none",value:w,onChange:I=>C(I.target.value),onBlur:()=>k(D.sessionId),onKeyDown:I=>{I.key==="Enter"&&k(D.sessionId),I.key==="Escape"&&m(null)},onClick:I=>I.stopPropagation(),autoFocus:!0}):d.jsxs(d.Fragment,{children:[d.jsx("img",{src:pe.message,alt:"",width:16,height:16,className:"shrink-0 opacity-60"}),d.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]",children:D.title||"新会话"}),d.jsxs("span",{className:"hidden shrink-0 items-center gap-0.5 group-hover:flex",children:[d.jsx("button",{type:"button",className:"flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[var(--sa-primary)]",onClick:I=>A(D.sessionId,D.title,I),title:"重命名",children:d.jsx(J,{name:"pen",size:12})}),d.jsx("button",{type:"button",className:`flex h-5 w-5 items-center justify-center rounded ${E?"bg-[#fee2e2] text-[#ef4444]":"text-[#999] hover:bg-white/70 hover:text-[#ef4444]"}`,onClick:I=>L(D.sessionId,I),title:E?"确认删除":"删除",children:d.jsx(J,{name:E?"x":"trash2",size:12})})]})]})},D.sessionId)})]},v.label)),l&&d.jsx("div",{className:"px-0.5 py-2 text-center text-[11px] text-[#C0C0C0]",children:"向下滚动加载更多"})]}),b&&d.jsx("div",{className:"pointer-events-none fixed z-[10001] whitespace-nowrap rounded border border-[#E8E8E8] bg-white px-2.5 py-1.5 text-[12px] leading-[1.4] text-[#333] shadow-[0_2px_8px_rgba(0,0,0,0.12)]",style:{left:b.x,top:b.y,transform:"translateY(-50%)"},children:b.text})]})}function ha({title:e,slots:t,welcomeMessage:n,suggestedPrompts:r,capabilities:i,quickLinks:s,logo:a,sidebarDefaultOpen:o=!0,onClose:l,avatar:u,artifactPreview:p,showTimestamp:c}){const{status:h,sendMessage:f,stop:m,conversations:w,activeConversationId:C,switchConversation:b,newConversation:S,deleteConversation:j,renameConversation:L,toggleArtifactDrawer:A,allArtifacts:k,activePanel:N,closePanel:_,hasMore:O,loadMoreConversations:v,conversationsLoading:D}=ze(),[T,E]=y.useState(o),I=y.useCallback(()=>E(B=>!B),[]),F=!!N;y.useEffect(()=>()=>_(),[_]);const q=t.ThreadList,U=t.Composer,P=t.Header;return d.jsxs("div",{className:"sa-fullpage",children:[q?d.jsx("div",{className:`sa-fp-sidebar-wrapper ${T?"":"sa-fp-sidebar-wrapper-collapsed"}`,children:d.jsx(q,{conversations:w,activeSessionId:C,onSwitch:b,onNew:S,onDelete:j,onRename:L,hasMore:O,onLoadMore:v})}):d.jsx(qp,{conversations:w,activeSessionId:C,onSwitch:b,onNew:S,onDelete:j,onRename:L,isCollapsed:!T,onToggleCollapse:I,hasMore:O,onLoadMore:v,conversationsLoading:D}),d.jsxs("div",{className:"sa-fp-main",children:[P?d.jsx(P,{title:F?(N==null?void 0:N.title)??e:e,panelTitle:F?N==null?void 0:N.title:void 0,onClose:l??Mr,onToggleThreadList:I,showHome:F,onHome:F?_:Mr,artifactCount:F||!p?0:k.length,onToggleArtifactDrawer:F||!p?void 0:A}):d.jsxs("div",{className:"sa-fp-header",children:[d.jsx("div",{className:"sa-fp-header-title",children:F?(N==null?void 0:N.title)??e:e}),d.jsxs("div",{className:"sa-fp-header-actions",children:[F&&d.jsx("button",{className:"sa-fp-header-btn",onClick:_,title:"返回聊天","aria-label":"返回聊天",children:d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),d.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]})}),!F&&p&&k.length>0&&d.jsxs("button",{className:"sa-fp-header-btn sa-header-btn-artifact",onClick:A,title:"会话产物",children:[d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),d.jsx("polyline",{points:"14 2 14 8 20 8"})]}),d.jsx("span",{children:"产物"})]})]})]}),d.jsx(fa,{contentClassName:"sa-fp-content-row",artifactPreview:p,thread:d.jsx(Ln,{slots:t,welcomeMessage:n,suggestedPrompts:r,capabilities:i,quickLinks:s,logo:a,avatar:u,artifactPreview:p,showTimestamp:c}),composer:U?d.jsx(U,{status:h,onSend:f,onStop:m}):d.jsx(Dn,{})})]})]})}function ga(e){const{sdk:t,mode:n="floating",slots:r={},hooks:i={},welcomeMessage:s,suggestedPrompts:a,title:o="AI Assistant",initialOpen:l=!1,onOpenChange:u,sidebarDefaultOpen:p,avatar:c,artifactPreview:h,capabilities:f,quickLinks:m,logo:w,triggerLogo:C,theme:b,showTimestamp:S,attachmentUploader:j,nosUpload:L}=e,[A,k]=y.useState(l);y.useEffect(()=>{k(l)},[l]);const N=y.useCallback(()=>{var D,T;const v=!A;k(v),u==null||u(v),v?(D=i.onOpen)==null||D.call(i):(T=i.onClose)==null||T.call(i)},[A,i,u]),_=y.useCallback(()=>{var v;k(!1),u==null||u(!1),(v=i.onClose)==null||v.call(i)},[i,u]),O=r.Trigger??Hr;return n==="fullpage"?A?d.jsx(Jt,{sdk:t,hooks:i,attachmentUploader:j,nosUpload:L,children:d.jsx(ha,{title:o,slots:r,welcomeMessage:s,suggestedPrompts:a,capabilities:f,quickLinks:m,logo:w,sidebarDefaultOpen:p,onClose:_,avatar:c,artifactPreview:h,showTimestamp:S})}):null:d.jsxs(Jt,{sdk:t,hooks:i,attachmentUploader:j,nosUpload:L,children:[d.jsx(O,{isOpen:A,onClick:N,triggerLogo:C}),d.jsx(Vp,{isOpen:A,onClose:_,title:o,slots:r,welcomeMessage:s,suggestedPrompts:a,avatar:c,artifactPreview:h,capabilities:f,quickLinks:m,logo:w,defaultWidth:b==null?void 0:b.panelWidth,defaultHeight:b==null?void 0:b.panelHeight,showTimestamp:S})]})}const ma=`
|
|
27
|
+
`,...s.current()});return/^[\t ]/.test(u)&&(u=dt(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),l(),o(),u}Fi.peek=cd;function Fi(e){return e.value||""}function cd(){return"<"}_i.peek=dd;function _i(e,t,n,r){const i=An(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),u+=l.move(")"),a(),u}function dd(){return"!"}Oi.peek=pd;function Oi(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("![");const u=n.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=p,s(),i==="full"||!u||u!==c?l+=o.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function pd(){return"!"}Bi.peek=fd;function Bi(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const a=n.unsafe[s],o=n.compilePattern(a);let l;if(a.atBreak)for(;l=o.exec(r);){let u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return i+r+i}function fd(){return"`"}function $i(e,t){const n=kn(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Hi.peek=hd;function Hi(e,t,n,r){const i=An(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,l;if($i(e,n)){const p=n.stack;n.stack=[],o=n.enter("autolink");let c=a.move("<");return c+=a.move(n.containerPhrasing(e,{before:c,after:">",...a.current()})),c+=a.move(">"),o(),n.stack=p,c}o=n.enter("link"),l=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(l=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),l()),u+=a.move(")"),o(),u}function hd(e,t,n){return $i(e,n)?"<":"["}Ui.peek=gd;function Ui(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=p,s(),i==="full"||!u||u!==c?l+=o.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function gd(){return"["}function Nn(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function md(e){const t=Nn(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function xd(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Wi(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function bd(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=e.ordered?xd(n):Nn(n);const o=e.ordered?a==="."?")":".":md(n);let l=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),Wi(n)===a&&p){let c=-1;for(;++c<e.children.length;){const h=e.children[c];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(a=o),n.bulletCurrent=a;const u=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=s,i(),u}function wd(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function yd(e,t,n,r){const i=wd(n);let s=n.bulletCurrent||Nn(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let a=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(s+" ".repeat(a-s.length)),o.shift(a);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),p);return l(),u;function p(c,h,f){return h?(f?"":" ".repeat(a))+c:(f?s:s+" ".repeat(a-s.length))+c}}function kd(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(e,r);return s(),i(),a}const vd=Lt(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Cd(e,t,n,r){return(e.children.some(function(a){return vd(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Sd(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}qi.peek=jd;function qi(e,t,n,r){const i=Sd(n),s=n.enter("strong"),a=n.createTracker(r),o=a.move(i+i);let l=a.move(n.containerPhrasing(e,{after:i,before:o,...a.current()}));const u=l.charCodeAt(0),p=Tt(r.before.charCodeAt(r.before.length-1),u,i);p.inside&&(l=dt(u)+l.slice(1));const c=l.charCodeAt(l.length-1),h=Tt(r.after.charCodeAt(0),c,i);h.inside&&(l=l.slice(0,-1)+dt(c));const f=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:p.outside},o+l+f}function jd(e,t,n){return n.options.strong||"*"}function Ed(e,t,n,r){return n.safe(e.value,r)}function Id(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function zd(e,t,n){const r=(Wi(n)+(n.options.ruleSpaces?" ":"")).repeat(Id(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Vi={blockquote:Qc,break:zr,code:rd,definition:ad,emphasis:Pi,hardBreak:zr,heading:ud,html:Fi,image:_i,imageReference:Oi,inlineCode:Bi,link:Hi,linkReference:Ui,list:bd,listItem:yd,paragraph:kd,root:Cd,strong:qi,text:Ed,thematicBreak:zd};function Td(){return{enter:{table:Ad,tableData:Tr,tableHeader:Tr,tableRow:Dd},exit:{codeText:Md,table:Nd,tableData:Jt,tableHeader:Jt,tableRow:Jt}}}function Ad(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Nd(e){this.exit(e),this.data.inTable=void 0}function Dd(e){this.enter({type:"tableRow",children:[]},e)}function Jt(e){this.exit(e)}function Tr(e){this.enter({type:"tableCell",children:[]},e)}function Md(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Ld));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Ld(e,t){return t==="|"?t:e}function Rd(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
28
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:a,tableCell:l,tableRow:o}};function a(f,m,w,S){return u(p(f,w,S),f.align)}function o(f,m,w,S){const b=c(f,w,S),j=u([b]);return j.slice(0,j.indexOf(`
|
|
29
|
+
`))}function l(f,m,w,S){const b=w.enter("tableCell"),j=w.enter("phrasing"),E=w.containerPhrasing(f,{...S,before:s,after:s});return j(),b(),E}function u(f,m){return Xc(f,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function p(f,m,w){const S=f.children;let b=-1;const j=[],E=m.enter("table");for(;++b<S.length;)j[b]=c(S[b],m,w);return E(),j}function c(f,m,w){const S=f.children;let b=-1;const j=[],E=m.enter("tableRow");for(;++b<S.length;)j[b]=l(S[b],f,m,w);return E(),j}function h(f,m,w){let S=Vi.inlineCode(f,m,w);return w.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function Pd(){return{exit:{taskListCheckValueChecked:Ar,taskListCheckValueUnchecked:Ar,paragraph:_d}}}function Fd(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Od}}}function Ar(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function _d(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,a;for(;++s<i.length;){const o=i[s];if(o.type==="paragraph"){a=o;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Od(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);s&&o.move(a);let l=Vi.listItem(e,t,n,{...r,...o.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(p){return p+a}}function Bd(){return[bc(),Oc(),Uc(),Td(),Pd()]}function $d(e){return{extensions:[wc(),Bc(e),Wc(),Rd(e),Fd()]}}const Hd={tokenize:Gd,partial:!0},Yi={tokenize:Xd,partial:!0},Gi={tokenize:Kd,partial:!0},Xi={tokenize:Qd,partial:!0},Ud={tokenize:Jd,partial:!0},Ki={name:"wwwAutolink",tokenize:Vd,previous:Ji},Qi={name:"protocolAutolink",tokenize:Yd,previous:Zi},Me={name:"emailAutolink",tokenize:qd,previous:ea},Ae={};function Wd(){return{text:Ae}}let Oe=48;for(;Oe<123;)Ae[Oe]=Me,Oe++,Oe===58?Oe=65:Oe===91&&(Oe=97);Ae[43]=Me;Ae[45]=Me;Ae[46]=Me;Ae[95]=Me;Ae[72]=[Me,Qi];Ae[104]=[Me,Qi];Ae[87]=[Me,Ki];Ae[119]=[Me,Ki];function qd(e,t,n){const r=this;let i,s;return a;function a(c){return!fn(c)||!ea.call(r,r.previous)||Dn(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(c))}function o(c){return fn(c)?(e.consume(c),o):c===64?(e.consume(c),l):n(c)}function l(c){return c===46?e.check(Ud,p,u)(c):c===45||c===95||ge(c)?(s=!0,e.consume(c),l):p(c)}function u(c){return e.consume(c),i=!0,l}function p(c){return s&&i&&xe(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function Vd(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!Ji.call(r,r.previous)||Dn(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Hd,e.attempt(Yi,e.attempt(Gi,s),n),n)(a))}function s(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function Yd(e,t,n){const r=this;let i="",s=!1;return a;function a(c){return(c===72||c===104)&&Zi.call(r,r.previous)&&!Dn(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),o):n(c)}function o(c){if(xe(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),o;if(c===58){const h=i.toLowerCase();if(h==="http"||h==="https")return e.consume(c),l}return n(c)}function l(c){return c===47?(e.consume(c),s?u:(s=!0,l)):n(c)}function u(c){return c===null||Et(c)||re(c)||Ue(c)||Nt(c)?n(c):e.attempt(Yi,e.attempt(Gi,p),n)(c)}function p(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function Gd(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),s):n(a)}function s(a){return a===null?n(a):t(a)}}function Xd(e,t,n){let r,i,s;return a;function a(u){return u===46||u===95?e.check(Xi,l,o)(u):u===null||re(u)||Ue(u)||u!==45&&Nt(u)?l(u):(s=!0,e.consume(u),a)}function o(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),a}function l(u){return i||r||!s?n(u):t(u)}}function Kd(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?s(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(Xi,t,s)(a):a===null||re(a)||Ue(a)?t(a):(e.consume(a),i)}function s(a){return a===41&&r++,e.consume(a),i}}function Qd(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),s):o===93?(e.consume(o),i):o===60||o===null||re(o)||Ue(o)?t(o):n(o)}function i(o){return o===null||o===40||o===91||re(o)||Ue(o)?t(o):r(o)}function s(o){return xe(o)?a(o):n(o)}function a(o){return o===59?(e.consume(o),r):xe(o)?(e.consume(o),a):n(o)}}function Jd(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return ge(s)?n(s):t(s)}}function Ji(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||re(e)}function Zi(e){return!xe(e)}function ea(e){return!(e===47||fn(e))}function fn(e){return e===43||e===45||e===46||e===95||ge(e)}function Dn(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Zd={tokenize:op,partial:!0};function ep(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ip,continuation:{tokenize:ap},exit:sp}},text:{91:{name:"gfmFootnoteCall",tokenize:rp},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:tp,resolveTo:np}}}}function tp(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return n(l);const u=Ie(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function np(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function rp(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return o;function o(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),l}function l(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(s>999||c===93&&!a||c===null||c===91||re(c))return n(c);if(c===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(Ie(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return re(c)||(a=!0),s++,e.consume(c),c===92?p:u}function p(c){return c===91||c===92||c===93?(e.consume(c),s++,u):u(c)}}function ip(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,o;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(m)}function p(m){if(a>999||m===93&&!o||m===null||m===91||re(m))return n(m);if(m===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return s=Ie(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return re(m)||(o=!0),a++,e.consume(m),m===92?c:p}function c(m){return m===91||m===92||m===93?(e.consume(m),a++,p):p(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),ee(e,f,"gfmFootnoteDefinitionWhitespace")):n(m)}function f(m){return t(m)}}function ap(e,t,n){return e.check(ft,t,e.attempt(Zd,t,n))}function sp(e){e.exit("gfmFootnoteDefinition")}function op(e,t,n){const r=this;return ee(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(s):n(s)}}function lp(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,o){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let u=l;for(;u--;)if(a[u][0]==="exit"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[u][1].end.offset-a[u][1].start.offset){a[l][1].type="strikethroughSequence",a[u][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[u][1].start),end:Object.assign({},a[l][1].end)},c={type:"strikethroughText",start:Object.assign({},a[u][1].end),end:Object.assign({},a[l][1].start)},h=[["enter",p,o],["enter",a[u][1],o],["exit",a[u][1],o],["enter",c,o]],f=o.parser.constructs.insideSpan.null;f&&Ce(h,h.length,0,Dt(f,a.slice(u+1,l),o)),Ce(h,h.length,0,[["exit",c,o],["enter",a[l][1],o],["exit",a[l][1],o],["exit",p,o]]),Ce(a,u-1,l-u+3,h),l=u+h.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function s(a,o,l){const u=this.previous,p=this.events;let c=0;return h;function h(m){return u===126&&p[p.length-1][1].type!=="characterEscape"?l(m):(a.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const w=Xe(u);if(m===126)return c>1?l(m):(a.consume(m),c++,f);if(c<2&&!n)return l(m);const S=a.exit("strikethroughSequenceTemporary"),b=Xe(m);return S._open=!b||b===2&&!!w,S._close=!w||w===2&&!!b,o(m)}}}class up{constructor(){this.map=[],this.index=new Map}add(t,n,r){cp(this,t,n,r)}consume(t){if(this.map.sort(function(s,a){return s[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0,this.index.clear()}}function cp(e,t,n,r){if(n===0&&r.length===0)return;const i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}const s=[t,n,r];e.map.push(s),e.index.set(t,s)}function dp(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function pp(){return{flow:{null:{name:"table",tokenize:fp,resolveAll:hp}}}}function fp(e,t,n){const r=this;let i=0,s=0,a;return o;function o(C){let D=r.events.length-1;for(;D>-1;){const{type:I}=r.events[D][1];if(I==="lineEnding"||I==="linePrefix")D--;else break}const O=D>-1?r.events[D][1].type:null,k=O==="tableHead"||O==="tableRow"?v:l;return k===v&&r.parser.lazy[r.now().line]?n(C):k(C)}function l(C){return e.enter("tableHead"),e.enter("tableRow"),u(C)}function u(C){return C===124||(a=!0,s+=1),p(C)}function p(C){return C===null?n(C):H(C)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),f):n(C):J(C)?ee(e,p,"whitespace")(C):(s+=1,a&&(a=!1,i+=1),C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),c(C)))}function c(C){return C===null||C===124||re(C)?(e.exit("data"),p(C)):(e.consume(C),C===92?h:c)}function h(C){return C===92||C===124?(e.consume(C),c):c(C)}function f(C){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(C):(e.enter("tableDelimiterRow"),a=!1,J(C)?ee(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):m(C))}function m(C){return C===45||C===58?S(C):C===124?(a=!0,e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),w):N(C)}function w(C){return J(C)?ee(e,S,"whitespace")(C):S(C)}function S(C){return C===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),b):C===45?(s+=1,b(C)):C===null||H(C)?R(C):N(C)}function b(C){return C===45?(e.enter("tableDelimiterFiller"),j(C)):N(C)}function j(C){return C===45?(e.consume(C),j):C===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(C))}function E(C){return J(C)?ee(e,R,"whitespace")(C):R(C)}function R(C){return C===124?m(C):C===null||H(C)?!a||i!==s?N(C):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(C)):N(C)}function N(C){return n(C)}function v(C){return e.enter("tableRow"),A(C)}function A(C){return C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),A):C===null||H(C)?(e.exit("tableRow"),t(C)):J(C)?ee(e,A,"whitespace")(C):(e.enter("data"),P(C))}function P(C){return C===null||C===124||re(C)?(e.exit("data"),A(C)):(e.consume(C),C===92?B:P)}function B(C){return C===92||C===124?(e.consume(C),P):P(C)}}function hp(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,u,p,c;const h=new up;for(;++n<e.length;){const f=e[n],m=f[1];f[0]==="enter"?m.type==="tableHead"?(o=!1,l!==0&&(Nr(h,t,l,u,p),p=void 0,l=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,c=void 0,s=[0,0,0,0],a=[0,n+1,0,0],o&&(o=!1,p={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",p,t]])),i=m.type==="tableDelimiterRow"?2:p?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(s[1]!==0&&(a[0]=a[1],c=vt(h,t,s,i,void 0,c),s=[0,0,0,0]),a[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(a[0]=a[1],c=vt(h,t,s,i,void 0,c)),s=a,a=[s[1],n,0,0])):m.type==="tableHead"?(o=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,s[1]!==0?(a[0]=a[1],c=vt(h,t,s,i,n,c)):a[1]!==0&&(c=vt(h,t,a,i,n,c)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&Nr(h,t,l,u,p),h.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=dp(t.events,n))}return e}function vt(e,t,n,r,i,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(s.end=Object.assign({},Ge(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=Ge(t.events,n[1]);if(s={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const u=Ge(t.events,n[2]),p=Ge(t.events,n[3]),c={type:o,start:Object.assign({},u),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",c,t]]),r!==2){const h=t.events[n[2]],f=t.events[n[3]];if(h[1].end=Object.assign({},f[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,w=n[3]-n[2]-1;e.add(m,w,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(s.end=Object.assign({},Ge(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Nr(e,t,n,r,i){const s=[],a=Ge(t.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,t])),r.end=Object.assign({},a),s.push(["exit",r,t]),e.add(n+1,0,s)}function Ge(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const gp={name:"tasklistCheck",tokenize:xp};function mp(){return{text:{91:gp}}}function xp(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return re(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(l)}function o(l){return H(l)?t(l):J(l)?e.check({tokenize:bp},t,n)(l):n(l)}}function bp(e,t,n){return ee(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function wp(e){return li([Wd(),ep(),lp(e),pp(),mp()])}const yp={};function ta(e){const t=this,n=e||yp,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(wp(n)),s.push(Bd()),a.push($d(n))}function na({content:e}){return d.jsx("div",{className:"sa-text-part",children:d.jsx(Ni,{remarkPlugins:[ta],children:e})})}const kp="https://at.alicdn.com/t/c/font_5210396_pffyg5g21kn.js";let Dr=!1;function ra(e=kp){if(Dr||typeof document>"u")return;Dr=!0;const t=e.split("?")[0].split("/").pop();if(t&&document.querySelector(`script[src*="${t}"]`))return;const n=document.createElement("script");n.src=e,document.head.appendChild(n)}ra();function Z({name:e,size:t=16,color:n="currentColor",className:r,style:i}){return d.jsx("svg",{className:r,style:{width:t,height:t,fill:n,verticalAlign:"middle",...i},"aria-hidden":"true",children:d.jsx("use",{href:`#icon-${e}`})})}function vp(e){const t=e/1e3;return t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function ia({content:e,isStreaming:t,durationMs:n,expandWhileStreaming:r,showDuration:i}){const[s,a]=y.useState(!1),o=t&&r||s,l=!t&&i&&n!=null&&n>0?vp(n):null;return d.jsxs("div",{className:"sa-thinking-part",onClick:()=>a(!s),children:[d.jsxs("div",{className:"sa-thinking-header",children:[d.jsx("span",{className:"sa-thinking-icon",children:d.jsx(Z,{name:"brain",size:14})}),d.jsxs("span",{className:"sa-thinking-label",children:[t?"思考中…":"已深度思考",l&&d.jsxs("span",{className:"sa-thinking-duration",children:[" · 用时 ",l]})]}),d.jsx("span",{className:`sa-thinking-arrow ${o?"expanded":""}`,children:d.jsx(Z,{name:"chevron-right",size:12})})]}),o&&d.jsx("div",{className:"sa-thinking-content",children:e})]})}function aa({toolName:e,toolCallId:t,args:n,pending:r,expandWhileStreaming:i}){const[s,a]=y.useState(!1),[o,l]=y.useState(!1),u=r&&i||s;let p=n;try{p=JSON.stringify(JSON.parse(n),null,2)}catch{}const c=y.useCallback(()=>{var h;(h=navigator.clipboard)==null||h.writeText(p).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)}).catch(()=>{})},[p]);return d.jsxs("div",{className:"sa-tool-call-part",children:[d.jsxs("div",{className:"sa-tool-call-header",onClick:()=>a(!s),children:[d.jsx("span",{className:"sa-tool-icon",children:d.jsx(Z,{name:"zap",size:14})}),d.jsxs("span",{className:"sa-tool-name",children:[r?"正在调用":"调用工具",": ",e]}),d.jsx("span",{className:`sa-thinking-arrow ${u?"expanded":""}`,children:d.jsx(Z,{name:"chevron-right",size:12})})]}),u&&d.jsxs(d.Fragment,{children:[d.jsx("pre",{className:"sa-tool-args",children:p}),d.jsx("div",{className:"sa-tool-result-actions",children:d.jsxs("button",{className:"sa-action-btn",onClick:c,title:"复制",children:[d.jsx(Z,{name:o?"circle-check":"copy",size:14})," ",o?"已复制":"复制"]})})]})]})}function Mr({text:e}){const[t,n]=y.useState(!1),r=()=>{var i;(i=navigator.clipboard)==null||i.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})};return d.jsxs("button",{className:"sa-action-btn",onClick:r,title:"复制",children:[d.jsx(Z,{name:t?"circle-check":"copy",size:14})," ",t?"已复制":"复制"]})}function Cp({html:e}){const[t,n]=y.useState(null);return y.useEffect(()=>{let r=!1;return Promise.resolve().then(()=>require("./purify.es-BnmCBz16.cjs")).then(i=>{r||n(i.default.sanitize(e,{FORCE_BODY:!0,ADD_ATTR:["target"]}))}),()=>{r=!0}},[e]),t===null?null:d.jsx("div",{className:"sa-tool-result-html-scroll",children:d.jsx("div",{className:"sa-tool-result-html sa-text-part",dangerouslySetInnerHTML:{__html:t}})})}function sa({toolName:e,content:t,renderMode:n,html:r}){let i=t;if(i)try{i=JSON.stringify(JSON.parse(i),null,2)}catch{}return d.jsxs("div",{className:"sa-tool-result-part",children:[d.jsxs("div",{className:"sa-tool-result-header",children:[d.jsx("span",{className:"sa-tool-icon",children:d.jsx(Z,{name:"circle-check",size:14,color:"#10b981"})}),d.jsx("span",{className:"sa-tool-result-label",children:e||"工具返回"})]}),n==="html"&&r?d.jsxs(d.Fragment,{children:[d.jsx(Cp,{html:r}),d.jsx("div",{className:"sa-tool-result-actions",children:d.jsx(Mr,{text:r})})]}):i?d.jsxs(d.Fragment,{children:[d.jsx("pre",{className:"sa-tool-result-content",children:i}),d.jsx("div",{className:"sa-tool-result-actions",children:d.jsx(Mr,{text:i})})]}):d.jsx("pre",{className:"sa-tool-result-content",children:"—"})]})}function oa({content:e,onRetry:t}){return d.jsxs("div",{className:"sa-error-part",children:[d.jsxs("div",{className:"sa-error-content",children:[d.jsx("span",{className:"sa-error-icon",children:d.jsx(Z,{name:"triangle-alert",size:14})}),d.jsx("span",{children:e||"发生错误"})]}),t&&d.jsx("button",{className:"sa-error-retry",onClick:t,children:"重试"})]})}function la(e){return e==null||Number.isNaN(e)?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Sp({attachment:e}){const t=d.jsxs(d.Fragment,{children:[d.jsx(Z,{name:"file-text",size:14,color:"#6366f1"}),d.jsx("span",{className:"sa-attachment-chip-name",children:e.filename}),e.size!=null&&d.jsx("span",{className:"sa-attachment-chip-size",children:la(e.size)})]});return e.url?d.jsx("a",{className:"sa-attachment-chip",href:e.url,target:"_blank",rel:"noreferrer",download:e.filename,title:`下载 ${e.filename}`,children:t}):d.jsx("span",{className:"sa-attachment-chip",title:e.filename,children:t})}function jp(e){if(e==null)return null;if(typeof e=="string")return e.trim()?e:null;if(Array.isArray(e))return e.length===0?null:e.map(t=>typeof t=="object"?JSON.stringify(t):String(t)).join("、");if(typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function gt({value:e}){const t=jp(e);return t==null?null:d.jsxs("div",{className:"sa-interrupt-answer",children:[d.jsx(Z,{name:"text-cursor-input",size:14,color:"#6366f1"}),d.jsxs("span",{children:["你的回答:",t]})]})}function Ep({interrupt:e,onRespond:t,disabled:n,answeredAction:r,answerValue:i}){var l,u;const s=e.options,a=(typeof(s==null?void 0:s[0])=="string"?s[0]:(l=s==null?void 0:s[0])==null?void 0:l.label)||"确认",o=(typeof(s==null?void 0:s[1])=="string"?s[1]:(u=s==null?void 0:s[1])==null?void 0:u.label)||"取消";return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(Z,{name:"circle-alert",size:16,color:"#f59e0b"}),d.jsx("span",{children:e.content})]}),d.jsxs("div",{className:"sa-interrupt-actions",children:[d.jsxs("button",{className:`sa-interrupt-btn sa-interrupt-btn-primary ${r==="confirm"?"sa-interrupt-btn-answered":""}`,disabled:n,onClick:()=>t({action:"confirm"}),children:[d.jsx(Z,{name:"check",size:14})," ",a]}),d.jsxs("button",{className:`sa-interrupt-btn sa-interrupt-btn-secondary ${r==="cancel"?"sa-interrupt-btn-answered":""}`,disabled:n,onClick:()=>t({action:"cancel"}),children:[d.jsx(Z,{name:"x",size:14})," ",o]})]}),n&&d.jsx(gt,{value:i}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function Ip({interrupt:e,onRespond:t,disabled:n,answeredAction:r,answerValue:i}){var p,c,h,f;const s=e.options,a=(typeof(s==null?void 0:s[0])=="string"?s[0]:(p=s==null?void 0:s[0])==null?void 0:p.label)||"批准",o=(typeof(s==null?void 0:s[1])=="string"?s[1]:(c=s==null?void 0:s[1])==null?void 0:c.label)||"拒绝",l=(typeof(s==null?void 0:s[2])=="string"?s[2]:(h=s==null?void 0:s[2])==null?void 0:h.label)||"跳过",u=((f=e.metadata)==null?void 0:f.showSkip)!==!1;return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(Z,{name:"circle-alert",size:16,color:"#f59e0b"}),d.jsx("span",{children:e.content})]}),d.jsxs("div",{className:"sa-interrupt-actions",children:[d.jsxs("button",{className:`sa-interrupt-btn sa-interrupt-btn-primary ${r==="approve"?"sa-interrupt-btn-answered":""}`,disabled:n,onClick:()=>t({action:"approve"}),children:[d.jsx(Z,{name:"check",size:14})," ",a]}),d.jsxs("button",{className:`sa-interrupt-btn sa-interrupt-btn-danger ${r==="reject"?"sa-interrupt-btn-answered":""}`,disabled:n,onClick:()=>t({action:"reject"}),children:[d.jsx(Z,{name:"x",size:14})," ",o]}),u&&d.jsxs("button",{className:`sa-interrupt-btn sa-interrupt-btn-secondary ${r==="skip"?"sa-interrupt-btn-answered":""}`,disabled:n,onClick:()=>t({action:"skip"}),children:[d.jsx(Z,{name:"chevron-right",size:14})," ",l]})]}),n&&d.jsx(gt,{value:i}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function zp(e){return typeof e=="string"?{value:e,label:e}:e}function Tp({interrupt:e,onRespond:t,disabled:n,initialValue:r}){const i=(e.options??[]).map(zp),s=n&&r!=null&&!i.some(a=>a.value===r);return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(Z,{name:"list",size:16,color:"#6366f1"}),d.jsx("span",{children:e.content})]}),d.jsx("div",{className:"sa-interrupt-options",children:i.map(a=>{const o=r===a.value;return d.jsxs("button",{className:`sa-interrupt-option ${a.danger?"sa-interrupt-option-danger":""} ${o?"sa-interrupt-option-selected":""}`,disabled:n,onClick:()=>t({action:"select",value:a.value}),children:[d.jsx(Z,{name:o?"circle-check":"circle",size:14}),a.icon&&d.jsx(Z,{name:a.icon,size:14}),d.jsx("span",{children:a.label}),a.description&&d.jsx("span",{className:"sa-interrupt-option-desc",children:a.description})]},a.value)})}),s&&d.jsx(gt,{value:r}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function Ap(e){return typeof e=="string"?{value:e,label:e}:e}function Np({interrupt:e,onRespond:t,disabled:n,initialValue:r}){const i=(e.options??[]).map(Ap),s=Array.isArray(r)?r:r!=null?[String(r)]:[],[a,o]=y.useState(()=>new Set(s)),l=n?new Set(s):a,u=c=>{n||o(h=>{const f=new Set(h);return f.has(c)?f.delete(c):f.add(c),f})},p=n?s.filter(c=>!i.some(h=>h.value===c)):[];return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(Z,{name:"list-checks",size:16,color:"#6366f1"}),d.jsx("span",{children:e.content})]}),d.jsx("div",{className:"sa-interrupt-options",children:i.map(c=>d.jsxs("button",{className:`sa-interrupt-option ${l.has(c.value)?"sa-interrupt-option-selected":""}`,disabled:n,onClick:()=>u(c.value),children:[d.jsx(Z,{name:l.has(c.value)?"square-check":"square",size:14}),d.jsx("span",{children:c.label})]},c.value))}),p.length>0&&d.jsx(gt,{value:p}),!n&&d.jsx("div",{className:"sa-interrupt-actions",children:d.jsxs("button",{className:"sa-interrupt-btn sa-interrupt-btn-primary",disabled:a.size===0,onClick:()=>t({action:"submit",value:Array.from(a)}),children:[d.jsx(Z,{name:"check",size:14})," 确认 (",a.size,")"]})}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function Dp({interrupt:e,onRespond:t,disabled:n,initialValue:r}){const[i,s]=y.useState(r??""),a=n&&r!=null?String(r):i,o=e.inputType??"text",l=o==="textarea",u=()=>{n||e.required&&!a.trim()||t({action:"submit",value:a.trim()})};return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(Z,{name:"text-cursor-input",size:16,color:"#6366f1"}),d.jsx("span",{children:e.content})]}),d.jsx("div",{className:"sa-interrupt-input-area",children:l?d.jsx("textarea",{className:"sa-interrupt-textarea",value:a,onChange:p=>s(p.target.value),placeholder:e.placeholder,maxLength:e.maxLength,rows:3,disabled:n}):d.jsx("input",{className:"sa-interrupt-input",type:o,value:a,onChange:p=>s(p.target.value),placeholder:e.placeholder,maxLength:e.maxLength,onKeyDown:p=>p.key==="Enter"&&u(),disabled:n})}),!n&&d.jsx("div",{className:"sa-interrupt-actions",children:d.jsxs("button",{className:"sa-interrupt-btn sa-interrupt-btn-primary",disabled:e.required?!a.trim():!1,onClick:u,children:[d.jsx(Z,{name:"check",size:14})," 提交"]})}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function Mp({interrupt:e,onRespond:t,disabled:n,initialValue:r}){const i=e.fields??[],s=typeof r=="object"&&r!=null&&!Array.isArray(r)?r:{},[a,o]=y.useState(()=>{const h={};for(const f of i)h[f.name]=s[f.name]??f.defaultValue??"";return h}),l=n&&r!=null&&typeof r=="object"&&!Array.isArray(r)?r:a,u=(h,f)=>{n||o(m=>({...m,[h]:f}))},p=!n&&i.every(h=>!h.required||a[h.name]),c=()=>{p&&t({action:"submit",value:a})};return d.jsxs("div",{className:"sa-interrupt-card",children:[d.jsxs("div",{className:"sa-interrupt-content",children:[d.jsx(Z,{name:"file-text",size:16,color:"#6366f1"}),d.jsx("span",{children:e.content})]}),d.jsx("div",{className:"sa-interrupt-form",children:i.map(h=>d.jsxs("div",{className:"sa-interrupt-form-field",children:[d.jsxs("label",{className:"sa-interrupt-form-label",children:[h.label,h.required&&d.jsx("span",{className:"sa-interrupt-form-required",children:"*"})]}),Lp(h,l[h.name],f=>u(h.name,f),n)]},h.name))}),n&&typeof r=="string"&&d.jsx(gt,{value:r}),!n&&d.jsxs("div",{className:"sa-interrupt-actions",children:[d.jsxs("button",{className:"sa-interrupt-btn sa-interrupt-btn-primary",disabled:!p,onClick:c,children:[d.jsx(Z,{name:"check",size:14})," 提交"]}),d.jsx("button",{className:"sa-interrupt-btn sa-interrupt-btn-secondary",onClick:()=>t({action:"cancel"}),children:"取消"})]}),n&&d.jsx("div",{className:"sa-interrupt-submitted",children:"已提交"})]})}function Lr(e){return typeof e=="string"?{value:e,label:e}:e}function Lp(e,t,n,r){switch(e.type){case"textarea":return d.jsx("textarea",{className:"sa-interrupt-textarea",value:t,onChange:i=>n(i.target.value),placeholder:e.placeholder,rows:3,disabled:r});case"select":{const i=(e.options??[]).map(Lr);return d.jsxs("select",{className:"sa-interrupt-select",value:t,onChange:s=>n(s.target.value),disabled:r,children:[d.jsx("option",{value:"",children:"请选择"}),i.map(s=>d.jsx("option",{value:s.value,children:s.label},s.value))]})}case"multiSelect":{const i=(e.options??[]).map(Lr),s=Array.isArray(t)?t:[],a=o=>{r||n(s.includes(o)?s.filter(l=>l!==o):[...s,o])};return d.jsx("div",{className:"sa-interrupt-options",children:i.map(o=>d.jsx("button",{type:"button",className:`sa-interrupt-option ${s.includes(o.value)?"sa-interrupt-option-selected":""}`,disabled:r,onClick:()=>a(o.value),children:o.label},o.value))})}case"password":return d.jsx("input",{className:"sa-interrupt-input",type:"password",value:t,onChange:i=>n(i.target.value),placeholder:e.placeholder,disabled:r});default:return d.jsx("input",{className:"sa-interrupt-input",type:e.type==="number"?"number":e.type==="date"?"date":"text",value:t,onChange:i=>n(i.target.value),placeholder:e.placeholder,disabled:r})}}function ua({interrupt:e,resolved:t,response:n,onRespond:r}){const i=t,s=n==null?void 0:n.value;switch(e.interruptType){case"confirm":return d.jsx(Ep,{interrupt:e,onRespond:r,disabled:i,answeredAction:n==null?void 0:n.action,answerValue:n==null?void 0:n.value});case"approve":return d.jsx(Ip,{interrupt:e,onRespond:r,disabled:i,answeredAction:n==null?void 0:n.action,answerValue:n==null?void 0:n.value});case"select":return d.jsx(Tp,{interrupt:e,onRespond:r,disabled:i,initialValue:s});case"multiSelect":return d.jsx(Np,{interrupt:e,onRespond:r,disabled:i,initialValue:s});case"input":return d.jsx(Dp,{interrupt:e,onRespond:r,disabled:i,initialValue:s});case"form":return d.jsx(Mp,{interrupt:e,onRespond:r,disabled:i,initialValue:s});default:return d.jsxs("div",{className:"sa-interrupt-unknown",children:["未知的交互类型: ",e.interruptType]})}}function Rp({files:e,artifactPreview:t}){const{openArtifactPreview:n}=Te();return e.length===0?null:d.jsx("ul",{className:"sa-artifact-file-list",role:"list",children:e.map((r,i)=>d.jsxs("li",{className:"sa-artifact-file-card",onClick:t?()=>n(r):void 0,onKeyDown:t?s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),n(r))}:void 0,tabIndex:t?0:void 0,role:t?"button":void 0,"aria-label":t?`预览 ${r.filename}`:void 0,style:t?{cursor:"pointer"}:void 0,children:[d.jsx("div",{className:"sa-artifact-file-icon",children:d.jsx("span",{className:"sa-artifact-chip-type",children:$r(r.type)})}),d.jsxs("div",{className:"sa-artifact-file-info",children:[d.jsx("span",{className:"sa-artifact-file-name",children:r.filename}),r.size!=null&&d.jsx("span",{className:"sa-artifact-file-size",children:Br(r.size)})]}),t&&d.jsx("button",{className:"sa-artifact-file-download",title:"下载","aria-label":`下载 ${r.filename}`,onClick:s=>{s.stopPropagation(),jt(r)},children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})})})]},r.id||`art-${i}`))})}const Pp=[{value:1,label:"事实错误"},{value:2,label:"逻辑问题"},{value:3,label:"不相关"},{value:4,label:"信息过时"},{value:5,label:"冗长啰嗦"},{value:6,label:"难以理解"}];function ca({message:e,onCopy:t,onRegenerate:n,onFeedback:r}){const{status:i,cancelFeedback:s}=Te(),[a,o]=y.useState(null),[l,u]=y.useState(!1),[p,c]=y.useState(!1),h=y.useRef(null),f=y.useCallback(()=>{t(),u(!0),setTimeout(()=>u(!1),2e3)},[t]),m=y.useCallback(()=>{a==="like"?(o(null),s(e.id)):(o("like"),c(!1),r==null||r(e.id,"like"))},[a,e.id,r,s]),w=y.useCallback(()=>{a==="dislike"?(o(null),c(!1),s(e.id)):c(!0)},[a,e.id,s]),S=y.useCallback((j,E)=>{o("dislike"),c(!1),r==null||r(e.id,"dislike",{reason:j,remark:(E==null?void 0:E.trim())||void 0})},[e.id,r]),b=y.useCallback(()=>{c(!1)},[]);return y.useEffect(()=>{if(!p)return;const j=R=>{h.current&&!h.current.contains(R.target)&&c(!1)},E=R=>{R.key==="Escape"&&c(!1)};return document.addEventListener("mousedown",j),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",j),document.removeEventListener("keydown",E)}},[p]),i!=="ready"&&i!=="error"?null:d.jsxs("div",{className:"sa-action-bar",children:[d.jsxs("button",{className:"sa-action-btn",onClick:f,title:"复制",children:[d.jsx(Z,{name:l?"circle-check":"copy",size:14})," ",l?"已复制":"复制"]}),n&&d.jsxs("button",{className:"sa-action-btn",onClick:n,title:"重新生成",children:[d.jsx(Z,{name:"refresh-cw",size:14})," 重新生成"]}),r&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"sa-action-divider"}),d.jsx("button",{className:`sa-action-btn ${a==="like"?"sa-action-btn-active":""}`,onClick:m,title:"有用","aria-label":"点赞",children:d.jsx(Z,{name:"thumbs-up",size:14})}),d.jsx("button",{className:`sa-action-btn ${a==="dislike"?"sa-action-btn-active":""}`,onClick:w,title:"无用","aria-label":"踩","aria-expanded":p,"aria-haspopup":"dialog",children:d.jsx(Z,{name:"thumbs-down",size:14})})]}),p&&d.jsx("div",{ref:h,children:d.jsx(Fp,{onSubmit:S,onCancel:b})})]})}function Fp({onSubmit:e,onCancel:t}){const[n,r]=y.useState(void 0),[i,s]=y.useState("");return d.jsxs("div",{className:"sa-dislike-panel",children:[d.jsx("div",{className:"sa-dislike-panel-title",children:"请选择不满意的原因(可选)"}),d.jsx("div",{className:"sa-dislike-reasons",children:Pp.map(a=>d.jsx("button",{className:`sa-dislike-reason-btn ${n===a.value?"active":""}`,onClick:()=>r(n===a.value?void 0:a.value),children:a.label},a.value))}),d.jsx("textarea",{className:"sa-dislike-remark",placeholder:"补充描述(选填,≤500 字)",maxLength:500,value:i,onChange:a=>s(a.target.value),rows:2}),d.jsxs("div",{className:"sa-dislike-actions",children:[d.jsx("button",{className:"sa-dislike-submit",onClick:()=>e(n,i||void 0),children:"提交"}),d.jsx("button",{className:"sa-dislike-cancel",onClick:t,children:"取消"})]})]})}const _p=/^(https?:\/\/|data:|blob:|\/\/|\/|\.\/|\.\.\/)/;function Rr({src:e,alt:t}){return e?_p.test(e)?d.jsx("img",{src:e,alt:t??"",className:"sa-msg-avatar",draggable:!1}):d.jsx("span",{className:"sa-msg-avatar sa-msg-avatar-text",children:e}):null}function da({message:e,isStreaming:t,isLast:n,slots:r,avatar:i,artifactPreview:s,showTimestamp:a,collapse:o}){const{regenerate:l,feedback:u,respondToInterrupt:p}=Te(),c=y.useCallback(()=>{var I;const k=e.parts.filter(T=>T.type==="text").map(T=>T.content).join(`
|
|
30
|
+
`);(I=navigator.clipboard)==null||I.writeText(k).catch(()=>{})},[e]),h=e.role==="user",f=r.Message;if(f)return d.jsx(f,{message:e,isStreaming:t,isLast:n,avatar:i,slots:r,onCopy:c,onRegenerate:l,onFeedback:u,showTimestamp:a,collapse:o});const m=r.TextPart??na,w=r.ThinkingPart??ia,S=r.ToolCallPart??aa,b=r.ToolResultPart??sa,j=r.ErrorPart??oa,E=r.ActionBar??ca,R=o==null?void 0:o.thinking,N=o==null?void 0:o.toolCall,v=o?(R==null?void 0:R.expandWhileStreaming)??!0:!1,A=o?(R==null?void 0:R.showDuration)??!0:!1,P=o?(N==null?void 0:N.expandWhileStreaming)??!0:!1,B=new Set(e.parts.filter(k=>k.type==="tool_result").map(k=>k.toolCallId)),C=t&&n,D=!h&&e.parts.some(k=>k.type==="text"&&k.content),O=!h&&e.parts.some(k=>k.type==="thinking");return d.jsxs("div",{className:`sa-message ${h?"sa-message-user":"sa-message-assistant"}`,children:[!h&&d.jsx(Rr,{src:(i==null?void 0:i.assistant)||(t&&n?he.assistantAvatarGenerating:he.assistantAvatar),alt:"AI"}),d.jsxs("div",{className:"sa-message-content",children:[a&&d.jsx("span",{className:`sa-message-time ${h?"sa-message-time-right":""}`,children:za(e.timestamp)}),d.jsxs("div",{className:"sa-message-body",children:[e.parts.map((k,I)=>{switch(k.type){case"text":return d.jsx(m,{content:k.content},I);case"attachment":return d.jsx(Sp,{attachment:k.attachment},I);case"thinking":return d.jsx(w,{content:k.content,durationMs:k.durationMs,isStreaming:t&&n,expandWhileStreaming:v,showDuration:A},I);case"tool_call":return d.jsx(S,{toolName:k.toolName,toolCallId:k.toolCallId,args:k.args,pending:C&&!B.has(k.toolCallId),expandWhileStreaming:P},I);case"tool_result":return d.jsx(b,{toolName:k.toolName,toolCallId:k.toolCallId,content:k.content,artifacts:k.artifacts,renderMode:k.renderMode,html:k.html,artifactPreview:s},I);case"error":return d.jsx(j,{content:k.content,onRetry:l},I);case"interrupt":return d.jsx(ua,{interrupt:k.interrupt,resolved:k.resolved??!1,response:k.response,onRespond:T=>p(k.interrupt.interruptId,T)},I);default:return null}}),t&&n&&!h&&!D&&!O&&d.jsx("span",{className:"sa-thinking-indicator",children:"思考中…"}),!h&&e.artifacts&&e.artifacts.length>0&&d.jsx(Rp,{files:Hr(e.artifacts),artifactPreview:s}),!h&&!t&&D&&d.jsx(E,{message:e,onCopy:c,onRegenerate:n?l:void 0,onFeedback:u})]})]}),h&&(i==null?void 0:i.user)&&d.jsx(Rr,{src:i.user,alt:"用户"})]})}function pa({message:e,suggestedPrompts:t,onPromptClick:n,capabilities:r,quickLinks:i,logo:s,openPanel:a}){const o=l=>{if(l.onClick){l.onClick();return}const u=l.action;if(!u){l.prompt&&n(l.prompt);return}a==null||a(u.type==="link"?u:{...u,title:u.title??l.label})};return d.jsxs("div",{className:"flex flex-col gap-8 py-2",children:[d.jsxs("div",{className:"flex flex-col items-center gap-1 opacity-0 animate-sa-home-fade-in",children:[d.jsx("img",{src:s||he.logo,alt:"AI 助手",className:"block max-w-16 shrink-0 animate-sa-logo-float",draggable:!1}),d.jsx("h3",{className:"sa-shimmer-text m-0 mb-1 text-[18px] font-bold leading-[1.3] text-[#333] animate-sa-title-shimmer",children:e||"你好!有什么可以帮你的?"})]}),r&&r.length>0&&d.jsx("div",{className:"flex flex-col items-start gap-4 opacity-0 animate-sa-home-fade-in",style:{animationDelay:"150ms"},children:r.map(l=>d.jsxs("div",{className:"inline-flex w-full max-w-full min-w-0 items-center gap-[7px]",children:[l.icon&&d.jsx("img",{src:l.icon,alt:"",className:"h-[18px] w-[18px] shrink-0 object-contain",draggable:!1}),d.jsx("span",{className:"shrink-0 text-[14px] leading-[1.4] text-[#333]",children:l.label}),l.desc&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"h-[13px] w-px shrink-0 bg-[#DCDCDC]"}),d.jsx("span",{className:"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-[14px] leading-[1.4] text-[#9A9A9A]",children:l.desc})]})]},l.label))}),t&&t.length>0&&d.jsx("div",{className:"flex flex-col items-start gap-3",children:t.map((l,u)=>d.jsxs("button",{type:"button",className:"sa-chip inline-flex h-7 items-center gap-1 rounded-md px-3 text-[14px] leading-none text-[#333] opacity-0 transition-colors animate-sa-chip-in",style:{animationDelay:`${300+u*130}ms`},onClick:()=>n(l),children:[d.jsx("span",{className:"sa-chip-text overflow-hidden text-ellipsis whitespace-nowrap",children:l}),d.jsx("svg",{width:13,height:13,viewBox:"0 0 14 14",fill:"none",className:"shrink-0 text-[#9A9A9A]","aria-hidden":"true",children:d.jsx("path",{d:"M5 3L9 7L5 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]},`${l}-${u}`))}),i&&i.length>0&&d.jsxs("div",{className:"opacity-0 animate-sa-home-fade-in",style:{animationDelay:"420ms"},children:[d.jsx("div",{className:"mb-3 text-[14px] leading-none text-[#A0A0A0]",children:"快速查看"}),d.jsx("div",{className:"flex flex-wrap items-center gap-[22px]",children:i.map(l=>d.jsxs("button",{type:"button",className:"inline-flex items-center gap-[7px] rounded-md px-1 py-1 transition-colors hover:bg-[#F5F5F5]",onClick:()=>o(l),children:[l.icon&&d.jsx("span",{className:"flex h-[18px] w-[18px] shrink-0 items-center justify-center opacity-70",children:d.jsx("img",{src:l.icon,alt:"",width:18,height:18,draggable:!1})}),d.jsx("span",{className:"text-[14px] leading-none text-[#333] transition-colors hover:text-[#1881F0]",children:l.label})]},l.label))})]})]})}function Mn({slots:e,welcomeMessage:t,suggestedPrompts:n,avatar:r,artifactPreview:i,capabilities:s,quickLinks:a,logo:o,showTimestamp:l,collapse:u}){const{messages:p,status:c,sendMessage:h,openPanel:f}=Te(),{containerRef:m}=Yr([p]),w=c==="streaming",S=e.WelcomeScreen??pa,b=e.AppendContainer;return p.length===0?d.jsxs("div",{className:"sa-thread",ref:m,children:[d.jsx(S,{message:t,suggestedPrompts:n,onPromptClick:h,capabilities:s,quickLinks:a,logo:o,openPanel:f}),b&&d.jsx(b,{openPanel:f})]}):d.jsx("div",{className:"sa-thread",ref:m,children:p.map((j,E)=>d.jsx(da,{message:j,isStreaming:w,isLast:E===p.length-1,slots:e,avatar:r,artifactPreview:i,showTimestamp:l,collapse:u},j.id))})}function fa({size:e=12}){return d.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:d.jsx("path",{d:"M12 2.5l1.8 5.2a3 3 0 0 0 1.9 1.9l5.2 1.8-5.2 1.8a3 3 0 0 0-1.9 1.9L12 20.3l-1.8-5.2a3 3 0 0 0-1.9-1.9L3.1 11.4l5.2-1.8a3 3 0 0 0 1.9-1.9z"})})}function Op({items:e,activeIndex:t,onSelect:n}){const r=y.useRef(null);return y.useEffect(()=>{var s;const i=(s=r.current)==null?void 0:s.children[t];i==null||i.scrollIntoView({block:"nearest"})},[t]),d.jsxs("div",{className:"sa-slash-menu",children:[d.jsxs("div",{className:"sa-slash-menu-header",children:["技能 (",e.length,")"]}),d.jsx("div",{className:"sa-slash-menu-body",ref:r,children:e.length===0?d.jsx("div",{className:"sa-slash-menu-empty",children:"没有匹配的技能"}):e.map((i,s)=>{const a=i.displayName||i.name,o=i.owner==="member"&&i.memberName?i.memberName:null,l=!i.selectable;return d.jsxs("div",{className:"sa-slash-menu-item"+(s===t?" sa-slash-menu-item--active":"")+(l?" sa-slash-menu-item--disabled":""),"aria-disabled":l||void 0,title:l?i.disabledReason??void 0:void 0,onMouseDown:u=>{u.preventDefault(),!l&&n(i)},children:[d.jsx("span",{className:"sa-slash-menu-item-icon",children:d.jsx(fa,{size:13})}),d.jsx("span",{className:"sa-slash-menu-item-name",children:a}),o&&d.jsx("span",{className:"sa-slash-menu-item-owner",children:o}),l&&i.disabledReason?d.jsx("span",{className:"sa-slash-menu-item-desc",children:i.disabledReason}):i.description&&d.jsx("span",{className:"sa-slash-menu-item-desc",children:i.description})]},i.code)})})]})}function Bp({sdk:e,input:t,onSelect:n}){const[r,i]=y.useState([]),[s,a]=y.useState(!1),[o,l]=y.useState(0),u=y.useRef(!1);y.useEffect(()=>{u.current||(u.current=!0,e.listSkills().then(i).catch(()=>i([])))},[e]);const p=/^\/\S*$/.test(t);y.useEffect(()=>{a(p)},[p]);const c=t.startsWith("/")?t.slice(1).toLowerCase():"",h=y.useMemo(()=>r.filter(N=>!c||N.code.toLowerCase().includes(c)||N.name.toLowerCase().includes(c)||N.displayName&&N.displayName.toLowerCase().includes(c)),[r,c]),f=y.useMemo(()=>h.reduce((N,v,A)=>v.selectable?[...N,A]:N,[]),[h]);y.useEffect(()=>{p&&l(f[0]??0)},[t,p,f]);const m=y.useRef(s),w=y.useRef(h),S=y.useRef(f),b=y.useRef(o),j=y.useRef(n);m.current=s,w.current=h,S.current=f,b.current=o,j.current=n;const E=y.useCallback(N=>{if(!m.current)return!1;const v=S.current;if(v.length===0)return!1;const A=P=>{const B=v.indexOf(b.current),C=B===-1?v[0]:v[(B+P+v.length)%v.length];l(C)};switch(N.key){case"ArrowDown":return N.preventDefault(),A(1),!0;case"ArrowUp":return N.preventDefault(),A(-1),!0;case"Enter":case"Tab":{const P=w.current[b.current];return!P||!P.selectable?!1:(N.preventDefault(),j.current(P),a(!1),!0)}case"Escape":return N.preventDefault(),a(!1),!0;default:return!1}},[]),R=y.useCallback(()=>a(!1),[]);return{isOpen:s,items:h,activeIndex:o,handleKeyDown:E,close:R}}const $p=10,Hp=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent);function Up({size:e=16}){return d.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}function Wp({size:e=12}){return d.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round","aria-hidden":"true",children:d.jsx("path",{d:"M6 6l12 12M18 6L6 18"})})}function qp({skill:e,onRemove:t}){const n=e.displayName||e.name,r=e.owner==="member"&&e.memberName?`${n}(成员 ${e.memberName} 的技能)`:n;return d.jsxs("span",{className:"sa-skill-chip",title:r,children:[d.jsxs("button",{type:"button",className:"sa-skill-chip-icon","aria-label":`移除技能 ${n}`,onClick:i=>{i.stopPropagation(),t()},children:[d.jsx("span",{className:"sa-skill-chip-icon-skill",children:d.jsx(fa,{})}),d.jsx("span",{className:"sa-skill-chip-icon-remove",children:d.jsx(Wp,{})})]}),d.jsx("span",{className:"sa-skill-chip-label",children:n})]})}function Ln(){const{status:e,sendMessage:t,stop:n,sdk:r,attachmentUploader:i,nosUpload:s}=Te(),[a,o]=y.useState(""),[l,u]=y.useState(null),[p,c]=y.useState([]),h=y.useRef(null),f=y.useRef(null),m=!!i||!!s,w=e==="streaming"||e==="submitted",S=p.filter(k=>k.attachment),b=p.some(k=>!k.attachment&&k.status==="uploading"),j=!!a.trim()||!!l||p.length>0||w,E=!w&&!b&&(a.trim().length>0||!!l||S.length>0),R=y.useCallback(k=>{u(k),o(""),setTimeout(()=>{var I;return(I=h.current)==null?void 0:I.focus()},0)},[]),N=y.useCallback(()=>{var k;u(null),(k=h.current)==null||k.focus()},[]),v=Bp({sdk:r,input:a,onSelect:R}),A=y.useCallback(k=>{const I=Array.from(k.target.files??[]);if(k.target.value="",!m||I.length===0)return;const T=$p-p.length,$=I.slice(0,Math.max(0,T));if($.length===0)return;const Y=$.map(M=>({key:`${M.name}_${M.size}_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,file:M,status:"uploading"}));c(M=>[...M,...Y]);for(const{key:M,file:U}of Y)(i||Pe.createNosUploader({baseURL:s.baseURL,headers:s.headers,trunkSize:s.trunkSize,onProgress:q=>c(X=>X.map(g=>g.key===M?{...g,percent:q}:g))}))(U).then(q=>{c(X=>X.map(g=>g.key===M?{...g,attachment:{...q,filename:q.filename||U.name,size:q.size??U.size,mime:q.mime??U.type}}:g))}).catch(q=>{c(X=>X.map(g=>g.key===M?{...g,status:"error",errorMsg:q instanceof Error?q.message:String(q)}:g))})},[i,s,p]),P=y.useCallback(k=>{c(I=>I.filter(T=>T.key!==k))},[]),B=y.useCallback(()=>{if(!E)return;const k=a.trim(),I=S.map($=>$.attachment),T=l?`/${l.code}${k?` ${k}`:""}`:k;t(T,I.length>0?I:void 0),o(""),u(null),c([]),h.current&&(h.current.style.height="auto")},[E,a,l,S,t]),C=y.useCallback(k=>{if(!v.handleKeyDown(k)){if(k.key==="Backspace"&&l&&a.length===0){k.preventDefault(),u(null);return}k.key==="Enter"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),B())}},[B,v.handleKeyDown,l,a]),D=y.useCallback(k=>{o(k.target.value);const I=k.target;I.style.height="auto",I.style.height=Math.min(I.scrollHeight,90)+"px"},[]),O=y.useCallback(()=>{var k;w||(k=h.current)==null||k.focus()},[w]);return d.jsxs("div",{className:"relative z-[2] shrink-0 px-[15px] pb-2.5",children:[v.isOpen&&d.jsx(Op,{items:v.items,activeIndex:v.activeIndex,onSelect:R}),p.length>0&&d.jsx("div",{className:"sa-attachment-tray mb-1.5",onClick:k=>k.stopPropagation(),children:p.map(k=>d.jsxs("span",{className:`sa-attachment-tray-chip ${k.status==="error"?"sa-attachment-tray-chip-error":""}`,title:k.status==="error"?`上传失败:${k.errorMsg??""}`:k.file.name,children:[d.jsx(Z,{name:"file-text",size:13,color:k.status==="error"?"#ef4444":"#6366f1"}),d.jsx("span",{className:"sa-attachment-tray-chip-name",children:k.file.name}),d.jsx("span",{className:"sa-attachment-tray-chip-size",children:k.attachment?la(k.file.size):k.status==="error"?"失败":k.percent!=null?`${Math.min(99,Math.round(k.percent))}%`:"上传中…"}),d.jsx("button",{type:"button",className:"sa-attachment-tray-chip-remove","aria-label":`移除附件 ${k.file.name}`,onClick:()=>P(k.key),children:"✕"})]},k.key))}),d.jsxs("form",{className:`sa-input-form relative flex min-h-[70px] cursor-text flex-col gap-1 rounded-[5px] p-2 ${j?"sa-input-form-active":""} ${w?"sa-input-form-streaming":""}`,onClick:O,onSubmit:k=>{k.preventDefault(),B()},children:[d.jsxs("div",{className:"flex items-start gap-1.5",children:[l&&d.jsx(qp,{skill:l,onRemove:N}),d.jsx("textarea",{ref:h,className:"sa-input-field min-h-[34px] min-w-0 flex-1 resize-none border-none bg-transparent p-0 text-[14px] leading-[1.5] text-[#333] outline-none placeholder:text-[#B8B8B8]",value:a,onChange:D,onKeyDown:C,placeholder:w?"回答生成中,请稍候…":l?"补充你的需求…":"发消息或创建任务... /使用技能",rows:1,disabled:w})]}),d.jsxs("div",{className:"flex items-center justify-end gap-2",children:[m&&!w&&d.jsx("button",{type:"button",className:"sa-attach-btn mr-auto","aria-label":"添加附件",title:"添加附件",onClick:()=>{var k;return(k=f.current)==null?void 0:k.click()},children:d.jsx(Up,{size:15})}),d.jsx("input",{ref:f,type:"file",multiple:!0,className:"hidden",onChange:A,"aria-label":"选择附件"}),!w&&d.jsxs("span",{className:"sa-send-hint","aria-hidden":"true",children:[d.jsx("kbd",{className:"sa-send-kbd",children:Hp?"⌘":"Ctrl"}),d.jsx("span",{children:"+"}),d.jsx("kbd",{className:"sa-send-kbd",children:"Enter"}),d.jsx("span",{children:"发送"})]}),w?d.jsx("button",{type:"button",className:"sa-send-btn sa-send-btn-active","aria-label":"停止生成",title:"停止生成",onClick:n,children:d.jsx("span",{className:"sa-stop-icon"})}):d.jsx("button",{type:"submit",className:`sa-send-btn ${E?"sa-send-btn-active":""}`,"aria-label":"发送",title:"发送",disabled:!E,children:d.jsx("img",{src:he.sendSolid,alt:"发送",width:14,height:14,draggable:!1})})]})]}),d.jsx("div",{className:"mt-3 text-center text-[11px] leading-none text-[#B8B8B8]",children:"所有内容均由AI生成仅供参考"})]})}function Vp({artifact:e}){const[t,n]=y.useState(null),[r,i]=y.useState(null),[s,a]=y.useState(!0),[o,l]=y.useState(null);return y.useEffect(()=>{let u=!1;a(!0),l(null),n(null),i(null);async function p(){try{if(e.type==="pdf"){u||a(!1);return}if(e.type==="md"){const c=await fetch(e.url);if(!c.ok)throw new Error(`HTTP ${c.status}`);const h=await c.text();u||(i(h),a(!1));return}if(e.type==="html"){const c=await fetch(e.url);if(!c.ok)throw new Error(`HTTP ${c.status}`);const h=await c.text(),f=(await Promise.resolve().then(()=>require("./purify.es-BnmCBz16.cjs"))).default;u||(n(f.sanitize(h,{FORCE_BODY:!0,ADD_ATTR:["target"]})),a(!1));return}if(e.type==="docx"){const c=await fetch(e.url);if(!c.ok)throw new Error(`HTTP ${c.status}`);const h=await c.arrayBuffer(),m=await(await Promise.resolve().then(()=>require("./mammoth.browser-BWTaSUmQ.cjs")).then(S=>S.mammoth_browser)).convertToHtml({arrayBuffer:h}),w=(await Promise.resolve().then(()=>require("./purify.es-BnmCBz16.cjs"))).default;u||(n(w.sanitize(m.value,{FORCE_BODY:!0,ADD_ATTR:["target"]})),a(!1));return}u||(a(!1),l(`不支持预览「${e.type}」类型`))}catch(c){u||(a(!1),l(c instanceof Error?c.message:"加载失败"))}}return p(),()=>{u=!0}},[e]),s?d.jsx("div",{className:"sa-drawer-preview-loading",children:"加载中"}):o?d.jsxs("div",{className:"sa-drawer-preview-error",children:[o,d.jsx("button",{className:"sa-drawer-btn-sm",onClick:()=>void jt(e),children:"下载查看"})]}):e.type==="pdf"?d.jsx("iframe",{src:e.url,title:e.filename,className:"sa-drawer-preview-iframe",sandbox:"allow-scripts"}):r!==null?d.jsx("div",{className:"sa-drawer-preview-html-scroll",children:d.jsx("div",{className:"sa-drawer-preview-html sa-text-part",children:d.jsx(Ni,{remarkPlugins:[ta],children:r})})}):t!==null?d.jsx("div",{className:"sa-drawer-preview-html-scroll",children:d.jsx("div",{className:"sa-drawer-preview-html sa-text-part",dangerouslySetInnerHTML:{__html:t}})}):null}function Yp({artifacts:e,initialArtifact:t,onClose:n}){const[r,i]=y.useState(t?{mode:"preview",artifact:t}:{mode:"list"}),[s,a]=y.useState(!1),o=y.useRef(null),[l,u]=y.useState(340),p=y.useRef(null);y.useEffect(()=>{t&&(o.current&&(clearTimeout(o.current),o.current=null,a(!1)),i({mode:"preview",artifact:t}))},[t]);const c=y.useCallback(()=>{a(!0),o.current=setTimeout(()=>{o.current=null,n()},240)},[n]);y.useEffect(()=>()=>{var w;o.current&&clearTimeout(o.current),(w=p.current)==null||w.call(p)},[]);const h=y.useCallback(w=>{i({mode:"preview",artifact:w})},[]),f=y.useCallback(()=>{i({mode:"list"})},[]);y.useEffect(()=>{const w=S=>{S.key==="Escape"&&c()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[c]);const m=y.useCallback(w=>{w.preventDefault();const S=w.clientX,b=l,j=R=>{const N=S-R.clientX;u(Math.max(240,Math.min(window.innerWidth*.7,b+N)))},E=()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",E),document.body.style.cursor="",document.body.style.userSelect="",p.current=null};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",j),document.addEventListener("mouseup",E),p.current=E},[l]);return d.jsxs("div",{className:`sa-artifact-drawer ${s?"sa-drawer-closing":""}`,style:{width:l},children:[d.jsx("div",{className:"sa-drawer-resize-handle",onMouseDown:m}),d.jsxs("div",{className:"sa-artifact-drawer-header",children:[r.mode==="preview"?d.jsxs(d.Fragment,{children:[d.jsx("button",{className:"sa-drawer-btn",onClick:f,title:"返回列表","aria-label":"返回列表",children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d.jsx("path",{d:"M15 18l-6-6 6-6"})})}),d.jsx("span",{className:"sa-artifact-drawer-title",children:r.artifact.filename})]}):d.jsxs(d.Fragment,{children:[d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{flexShrink:0},children:[d.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),d.jsx("polyline",{points:"14 2 14 8 20 8"})]}),d.jsx("span",{className:"sa-artifact-drawer-title",children:"会话产物"})]}),d.jsx("div",{style:{flex:1}}),r.mode==="preview"&&d.jsx("button",{className:"sa-drawer-btn",onClick:()=>void jt(r.artifact),title:"下载","aria-label":"下载",children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})})}),d.jsx("button",{className:"sa-drawer-btn",onClick:c,title:"关闭","aria-label":"关闭",children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),d.jsx("div",{className:"sa-artifact-drawer-body",children:r.mode==="list"?e.length===0?d.jsx("div",{className:"sa-drawer-empty",children:"暂无产物"}):d.jsx("ul",{className:"sa-drawer-file-list",role:"list",children:e.map((w,S)=>d.jsxs("li",{className:"sa-drawer-file-card",onClick:()=>h(w),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),h(w))},tabIndex:0,role:"button","aria-label":`预览 ${w.filename}`,children:[d.jsx("div",{className:"sa-drawer-file-icon",children:d.jsx("span",{className:"sa-artifact-chip-type",children:$r(w.type)})}),d.jsxs("div",{className:"sa-drawer-file-info",children:[d.jsx("span",{className:"sa-drawer-file-name",children:w.filename}),d.jsx("span",{className:"sa-drawer-file-size",children:Br(w.size)})]}),d.jsx("button",{className:"sa-drawer-btn",title:"下载","aria-label":`下载 ${w.filename}`,onClick:b=>{b.stopPropagation(),jt(w)},children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})})})]},w.id||`artifact-${S}`))}):d.jsx("div",{className:"sa-drawer-view-enter",children:d.jsx(Vp,{artifact:r.artifact})})})]})}function ha({page:e,onBack:t,centered:n}){y.useEffect(()=>{const i=s=>{s.key==="Escape"&&t()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]);const r=y.isValidElement(e.component)?y.cloneElement(e.component,{close:t}):y.createElement(e.component,{close:t});return d.jsx("div",{className:`sa-page-overlay ${n?"sa-page-overlay-centered":""}`,children:d.jsx("div",{className:"sa-page-overlay-body",children:r})})}const Gp="mx-auto w-full max-w-[800px]";function ga({contentClassName:e,centered:t,composerClassName:n,thread:r,composer:i,artifactPreview:s}){const{activePanel:a,closePanel:o,messagesLoading:l,isArtifactDrawerOpen:u,allArtifacts:p,activePreviewArtifact:c,toggleArtifactDrawer:h}=Te();if(a)return d.jsx(ha,{page:a,onBack:o,centered:t});const f=t?Gp:"";return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`${e} ${f}`,children:[l?d.jsxs("div",{className:"sa-messages-loading",children:[d.jsx("span",{className:"sa-loading-spinner"}),"加载对话..."]}):r,s&&u&&d.jsx(Yp,{artifacts:p,initialArtifact:c,onClose:h})]}),n?d.jsx("div",{className:`${n} ${f}`,children:i}):i]})}function Xp({isOpen:e,onClose:t,title:n,slots:r,welcomeMessage:i,suggestedPrompts:s,avatar:a,artifactPreview:o,capabilities:l,quickLinks:u,logo:p,defaultWidth:c,defaultHeight:h,showTimestamp:f,collapse:m}){const{status:w,sendMessage:S,stop:b,toggleThreadList:j,setThreadListOpen:E,isThreadListOpen:R,toggleArtifactDrawer:N,allArtifacts:v,activePanel:A,closePanel:P,messages:B,messagesLoading:C,conversations:D,activeConversationId:O,switchConversation:k,newConversation:I,deleteConversation:T,renameConversation:$,hasMore:Y,loadMoreConversations:M}=Te(),{width:U,position:x,hasCustomPosition:q,isMaximized:X,totalWidth:g,windowHeight:ae,startWindowDrag:_,startResize:V,toggleMaximize:se,reset:ie,setLockedHeight:ue}=ja({defaultWidth:c??fe.DEFAULT_WIDTH,defaultHeight:h??fe.DEFAULT_HEIGHT,sidebarWidth:0}),oe=y.useRef(null),W=y.useRef(null),ce=!C&&B.length===0,de=!C&&B.length>0,ye=!!A;y.useEffect(()=>{e||(ie(),P())},[e,ie,P]),y.useEffect(()=>{E(X?oe.current??!0:W.current??!1)},[X,E]),y.useEffect(()=>{de||ue(null)},[de,ue]);const Le=Ea({enabled:e&&de&&!X&&!ye,contentSelector:".sa-panel-content",defaultHeight:h??fe.DEFAULT_HEIGHT,onHeightChange:ue});if(!e)return null;const Je=r.Header,Ze=r.Composer,qe=r.ThreadList,mt=()=>{const te=!R;j(),X?oe.current=te:W.current=te},et=200,xt=R&&!X,Se="var(--sa-radius, 16px)",bt=xt?`0px ${Se} ${Se} 0px`:`${Se} ${Se} ${Se} ${Se}`,Pt=q?x.x:window.innerWidth-g-20,Ve=Math.min(et,Math.max(0,Pt-1)),z=q?{width:`${g}px`,height:`${ae}px`,left:`${x.x}px`,top:`${x.y}px`}:{width:`${g}px`,height:`${ae}px`,right:"20px",bottom:"20px"},F={title:n,onClose:t,onToggleThreadList:mt,isMaximized:X,onToggleMaximize:se,showHome:de||ye,onHome:ye?P:I,panelTitle:ye?A==null?void 0:A.title:void 0,artifactCount:ye||!o?0:v.length,onToggleArtifactDrawer:ye||!o?void 0:N},G={conversations:D,activeSessionId:O,onSwitch:k,onNew:I,onDelete:T,onRename:$,hasMore:Y,onLoadMore:M},Q=d.jsxs("div",{className:`relative flex min-w-0 flex-col bg-white ${X?"flex-1":"h-full shrink-0"}`,style:X?void 0:{width:`${U}px`,borderRadius:bt,overflow:"hidden"},children:[ce&&!ye&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"sa-home-gradient pointer-events-none absolute inset-x-0 top-0 z-0 h-[238px] opacity-10"}),d.jsx("div",{className:"sa-home-gradient-fade pointer-events-none absolute inset-x-0 top-0 z-[1] h-[238px]"})]}),d.jsx("div",{className:`relative z-20 ${ce||X?"":"bg-white"} ${X?"cursor-default":"cursor-grab active:cursor-grabbing"}`,onMouseDown:X?void 0:_,children:Je?d.jsx(Je,{...F}):d.jsx(qr,{...F})}),d.jsx(ga,{contentClassName:`sa-panel-content relative z-[2] ${ce?"sa-home-view":""}`,centered:X,composerClassName:"shrink-0",artifactPreview:o,thread:d.jsx(Mn,{slots:r,welcomeMessage:i,suggestedPrompts:s,avatar:a,artifactPreview:o,capabilities:l,quickLinks:u,logo:p,showTimestamp:f,collapse:m}),composer:Ze?d.jsx(Ze,{status:w,onSend:S,onStop:b}):d.jsx(Ln,{})})]});return X?d.jsx("div",{className:"fixed inset-0 z-[var(--sa-z-index,9999)] flex animate-sa-fade-in flex-col justify-end bg-black/30",children:d.jsxs("div",{className:"flex h-[calc(100%_-_48px)] w-full animate-sa-slide-up-full flex-row overflow-hidden bg-[#F5F5F5] shadow-[0_-12px_48px_rgba(0,0,0,0.25)]",style:{borderRadius:"var(--sa-radius, 16px) var(--sa-radius, 16px) 0px 0px"},children:[R&&(qe?d.jsx(qe,{...G}):d.jsx(en,{width:220})),Q]})}):d.jsxs("div",{ref:Le,className:"fixed z-[var(--sa-z-index,9999)] flex animate-sa-window-in flex-row overflow-visible border border-[#DADADA] bg-white ",style:{...z,borderRadius:bt},children:[d.jsx("div",{className:"sa-resize-handle absolute bottom-0 left-[-3px] top-0 z-20 w-[6px] cursor-col-resize",onMouseDown:te=>V(te)}),xt&&(qe?d.jsx("div",{className:"absolute -top-px -bottom-px -left-px z-10 overflow-hidden border border-r-0 border-[#DADADA] bg-[#FAFAFA] ",style:{width:Ve,transform:`translateX(-${Ve}px)`,borderRadius:`${Se} 0px 0px ${Se}`},children:d.jsx(qe,{...G})}):d.jsx("div",{className:"absolute -top-px -bottom-px -left-px z-10 overflow-hidden border border-r-0 border-[#DADADA] bg-[#FAFAFA] ",style:{width:Ve,transform:`translateX(-${Ve}px)`,borderRadius:`${Se} 0px 0px ${Se}`},children:d.jsx(en,{width:et})})),Q]})}const Pr=()=>{};function Kp({conversations:e,activeSessionId:t,onSwitch:n,onNew:r,onDelete:i,onRename:s,isCollapsed:a,onToggleCollapse:o,hasMore:l,onLoadMore:u,conversationsLoading:p}){const[c,h]=y.useState(null),[f,m]=y.useState(null),[w,S]=y.useState(""),[b,j]=y.useState(null),E=y.useRef(null);y.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]);const R=y.useCallback((C,D)=>{D.stopPropagation(),c===C?(i(C),h(null)):(h(C),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>h(null),3e3))},[c,i]),N=y.useCallback((C,D,O)=>{O.stopPropagation(),m(C),S(D??"")},[]),v=y.useCallback(C=>{w.trim()&&s(C,w.trim()),m(null)},[w,s]),A=y.useRef(null),P=y.useCallback(()=>{const C=A.current;!C||!l||!u||C.scrollHeight-C.scrollTop-C.clientHeight<50&&u()},[l,u]),B=y.useMemo(()=>Vr(e),[e]);return a?d.jsxs("div",{className:"flex w-12 shrink-0 flex-col items-center gap-1 border-r border-[#ECECEC] bg-[#FAFAFA] py-3",children:[d.jsx("button",{type:"button",className:"sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white","data-tooltip":"展开",onClick:o,children:d.jsx(Z,{name:"panel-left",size:18})}),d.jsx("button",{type:"button",className:"sa-tip relative flex h-7 w-7 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white","data-tooltip":"新建对话",onClick:()=>{r(),o()},children:d.jsx("img",{src:he.messageCreate,alt:"",width:18,height:18})})]}):d.jsxs("div",{className:"relative flex w-[220px] shrink-0 flex-col border-r border-[#ECECEC] bg-[#FAFAFA] p-3",children:[d.jsxs("div",{className:"mb-4 flex shrink-0 items-center gap-1.5",children:[d.jsxs("button",{type:"button",className:"sa-new-chat flex h-8 flex-1 items-center justify-center gap-2 rounded-md text-[14px] font-medium transition-colors",onClick:r,children:[d.jsx("img",{src:he.messageCreate,alt:"",width:18,height:18}),d.jsx("span",{className:"sa-new-chat-text whitespace-nowrap",children:"新建对话"})]}),d.jsx("button",{type:"button",className:"sa-tip relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[#666] transition-colors hover:bg-white","data-tooltip":"收起侧边栏",onClick:o,children:d.jsx(Z,{name:"panel-left-close",size:16})})]}),d.jsxs("div",{className:"px-1 pb-2.5",children:[d.jsx("div",{className:"mb-1 text-[14px] font-semibold text-[#333]",children:"历史对话"}),d.jsx("div",{className:"text-[11px] text-[#999]",children:"展示最近的会话记录"})]}),d.jsxs("div",{ref:A,className:"flex-1 overflow-y-auto",onScroll:P,children:[p&&e.length===0&&d.jsx("div",{className:"px-0.5 py-2 text-[12px] text-[#999]",children:"加载中..."}),!p&&e.length===0&&d.jsx("div",{className:"px-0.5 py-2 text-[12px] text-[#999]",children:"暂无记录"}),B.map(C=>d.jsxs("div",{className:"mb-1",children:[d.jsx("div",{className:"px-1 pb-1 pt-2 text-[11px] text-[#A0A0A0]",children:C.label}),C.items.map(D=>{const O=D.sessionId===t,k=c===D.sessionId;return d.jsx("div",{className:`group relative mb-0.5 flex h-8 w-full cursor-pointer items-center gap-1 rounded-md px-0.5 text-[13px] transition-colors ${O?"bg-[#E8F1FE]":"hover:bg-[#E8F1FE]"}`,onClick:()=>{f!==D.sessionId&&n(D.sessionId)},onMouseEnter:I=>{if(f===D.sessionId)return;const T=I.currentTarget.getBoundingClientRect();j({text:D.title||"新会话",x:T.right+8,y:T.top+T.height/2})},onMouseLeave:()=>j(null),children:f===D.sessionId?d.jsx("input",{className:"w-full rounded border border-[var(--sa-primary)] bg-white px-1.5 py-0.5 text-[12px] outline-none",value:w,onChange:I=>S(I.target.value),onBlur:()=>v(D.sessionId),onKeyDown:I=>{I.key==="Enter"&&v(D.sessionId),I.key==="Escape"&&m(null)},onClick:I=>I.stopPropagation(),autoFocus:!0}):d.jsxs(d.Fragment,{children:[d.jsx("img",{src:he.message,alt:"",width:16,height:16,className:"shrink-0 opacity-60"}),d.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-[#333]",children:D.title||"新会话"}),d.jsxs("span",{className:"hidden shrink-0 items-center gap-0.5 group-hover:flex",children:[d.jsx("button",{type:"button",className:"flex h-5 w-5 items-center justify-center rounded text-[#999] hover:bg-white/70 hover:text-[var(--sa-primary)]",onClick:I=>N(D.sessionId,D.title,I),title:"重命名",children:d.jsx(Z,{name:"pen",size:12})}),d.jsx("button",{type:"button",className:`flex h-5 w-5 items-center justify-center rounded ${k?"bg-[#fee2e2] text-[#ef4444]":"text-[#999] hover:bg-white/70 hover:text-[#ef4444]"}`,onClick:I=>R(D.sessionId,I),title:k?"确认删除":"删除",children:d.jsx(Z,{name:k?"x":"trash2",size:12})})]})]})},D.sessionId)})]},C.label)),l&&d.jsx("div",{className:"px-0.5 py-2 text-center text-[11px] text-[#C0C0C0]",children:"向下滚动加载更多"})]}),b&&d.jsx("div",{className:"pointer-events-none fixed z-[10001] whitespace-nowrap rounded border border-[#E8E8E8] bg-white px-2.5 py-1.5 text-[12px] leading-[1.4] text-[#333] shadow-[0_2px_8px_rgba(0,0,0,0.12)]",style:{left:b.x,top:b.y,transform:"translateY(-50%)"},children:b.text})]})}function ma({title:e,slots:t,welcomeMessage:n,suggestedPrompts:r,capabilities:i,quickLinks:s,logo:a,sidebarDefaultOpen:o=!0,onClose:l,avatar:u,artifactPreview:p,showTimestamp:c,collapse:h}){const{status:f,sendMessage:m,stop:w,conversations:S,activeConversationId:b,switchConversation:j,newConversation:E,deleteConversation:R,renameConversation:N,toggleArtifactDrawer:v,allArtifacts:A,activePanel:P,closePanel:B,hasMore:C,loadMoreConversations:D,conversationsLoading:O}=Te(),[k,I]=y.useState(o),T=y.useCallback(()=>I(x=>!x),[]),$=!!P;y.useEffect(()=>()=>B(),[B]);const Y=t.ThreadList,M=t.Composer,U=t.Header;return d.jsxs("div",{className:"sa-fullpage",children:[Y?d.jsx("div",{className:`sa-fp-sidebar-wrapper ${k?"":"sa-fp-sidebar-wrapper-collapsed"}`,children:d.jsx(Y,{conversations:S,activeSessionId:b,onSwitch:j,onNew:E,onDelete:R,onRename:N,hasMore:C,onLoadMore:D})}):d.jsx(Kp,{conversations:S,activeSessionId:b,onSwitch:j,onNew:E,onDelete:R,onRename:N,isCollapsed:!k,onToggleCollapse:T,hasMore:C,onLoadMore:D,conversationsLoading:O}),d.jsxs("div",{className:"sa-fp-main",children:[U?d.jsx(U,{title:$?(P==null?void 0:P.title)??e:e,panelTitle:$?P==null?void 0:P.title:void 0,onClose:l??Pr,onToggleThreadList:T,showHome:$,onHome:$?B:Pr,artifactCount:$||!p?0:A.length,onToggleArtifactDrawer:$||!p?void 0:v}):d.jsxs("div",{className:"sa-fp-header",children:[d.jsx("div",{className:"sa-fp-header-title",children:$?(P==null?void 0:P.title)??e:e}),d.jsxs("div",{className:"sa-fp-header-actions",children:[$&&d.jsx("button",{className:"sa-fp-header-btn",onClick:B,title:"返回聊天","aria-label":"返回聊天",children:d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),d.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]})}),!$&&p&&A.length>0&&d.jsxs("button",{className:"sa-fp-header-btn sa-header-btn-artifact",onClick:v,title:"会话产物",children:[d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),d.jsx("polyline",{points:"14 2 14 8 20 8"})]}),d.jsx("span",{children:"产物"})]})]})]}),d.jsx(ga,{contentClassName:"sa-fp-content-row",artifactPreview:p,thread:d.jsx(Mn,{slots:t,welcomeMessage:n,suggestedPrompts:r,capabilities:i,quickLinks:s,logo:a,avatar:u,artifactPreview:p,showTimestamp:c,collapse:h}),composer:M?d.jsx(M,{status:f,onSend:m,onStop:w}):d.jsx(Ln,{})})]})]})}function xa(e){const{sdk:t,mode:n="floating",slots:r={},hooks:i={},welcomeMessage:s,suggestedPrompts:a,title:o="AI Assistant",initialOpen:l=!1,onOpenChange:u,sidebarDefaultOpen:p,avatar:c,artifactPreview:h,capabilities:f,quickLinks:m,logo:w,triggerLogo:S,theme:b,showTimestamp:j,attachmentUploader:E,nosUpload:R,collapse:N}=e,[v,A]=y.useState(l);y.useEffect(()=>{A(l)},[l]);const P=y.useCallback(()=>{var O,k;const D=!v;A(D),u==null||u(D),D?(O=i.onOpen)==null||O.call(i):(k=i.onClose)==null||k.call(i)},[v,i,u]),B=y.useCallback(()=>{var D;A(!1),u==null||u(!1),(D=i.onClose)==null||D.call(i)},[i,u]),C=r.Trigger??Wr;return n==="fullpage"?v?d.jsx(Zt,{sdk:t,hooks:i,attachmentUploader:E,nosUpload:R,children:d.jsx(ma,{title:o,slots:r,welcomeMessage:s,suggestedPrompts:a,capabilities:f,quickLinks:m,logo:w,sidebarDefaultOpen:p,onClose:B,avatar:c,artifactPreview:h,showTimestamp:j,collapse:N})}):null:d.jsxs(Zt,{sdk:t,hooks:i,attachmentUploader:E,nosUpload:R,children:[d.jsx(C,{isOpen:v,onClick:P,triggerLogo:S}),d.jsx(Xp,{isOpen:v,onClose:B,title:o,slots:r,welcomeMessage:s,suggestedPrompts:a,avatar:c,artifactPreview:h,capabilities:f,quickLinks:m,logo:w,defaultWidth:b==null?void 0:b.panelWidth,defaultHeight:b==null?void 0:b.panelHeight,showTimestamp:j,collapse:N})]})}const ba=`
|
|
31
31
|
[data-super-agent-widget] {
|
|
32
32
|
--sa-primary-dark: color-mix(in srgb, var(--sa-primary) 82%, #000);
|
|
33
33
|
--sa-primary-light: color-mix(in srgb, var(--sa-primary) 10%, #fff);
|
|
@@ -439,6 +439,12 @@
|
|
|
439
439
|
flex: 1;
|
|
440
440
|
}
|
|
441
441
|
|
|
442
|
+
/* DeepSeek 式收起条耗时后缀(已深度思考 · 用时 3.2s) */
|
|
443
|
+
.sa-thinking-duration {
|
|
444
|
+
color: #9ca3af;
|
|
445
|
+
font-weight: 400;
|
|
446
|
+
}
|
|
447
|
+
|
|
442
448
|
.sa-thinking-arrow {
|
|
443
449
|
font-size: 12px;
|
|
444
450
|
transition: transform 0.2s ease;
|
|
@@ -1001,6 +1007,26 @@
|
|
|
1001
1007
|
color: #9ca3af;
|
|
1002
1008
|
}
|
|
1003
1009
|
|
|
1010
|
+
/* 已提交卡片的答案兜底回显(自由文本作答不匹配选项/按钮时) */
|
|
1011
|
+
.sa-interrupt-answer {
|
|
1012
|
+
margin-top: 8px;
|
|
1013
|
+
display: flex;
|
|
1014
|
+
align-items: flex-start;
|
|
1015
|
+
gap: 4px;
|
|
1016
|
+
font-size: 12px;
|
|
1017
|
+
line-height: 1.5;
|
|
1018
|
+
color: #4b5563;
|
|
1019
|
+
background: #f3f4f6;
|
|
1020
|
+
border-radius: 4px;
|
|
1021
|
+
padding: 6px 8px;
|
|
1022
|
+
word-break: break-all;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
.sa-interrupt-answer svg {
|
|
1026
|
+
flex-shrink: 0;
|
|
1027
|
+
margin-top: 1px;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1004
1030
|
.sa-interrupt-btn-answered {
|
|
1005
1031
|
background: var(--sa-primary) !important;
|
|
1006
1032
|
color: #fff !important;
|
|
@@ -1313,5 +1339,5 @@
|
|
|
1313
1339
|
from { opacity: 0; transform: translateY(10px); }
|
|
1314
1340
|
to { opacity: 1; transform: translateY(0); }
|
|
1315
1341
|
}
|
|
1316
|
-
`,Wp='[data-super-agent-widget] .pointer-events-none{pointer-events:none}[data-super-agent-widget] .visible{visibility:visible}[data-super-agent-widget] .collapse{visibility:collapse}[data-super-agent-widget] .fixed{position:fixed}[data-super-agent-widget] .absolute{position:absolute}[data-super-agent-widget] .relative{position:relative}[data-super-agent-widget] .inset-0{top:0;right:0;bottom:0;left:0}[data-super-agent-widget] .inset-x-0{left:0;right:0}[data-super-agent-widget] .-bottom-px{bottom:-1px}[data-super-agent-widget] .-left-px{left:-1px}[data-super-agent-widget] .-right-2{right:-.5rem}[data-super-agent-widget] .-top-1\\.5{top:-.375rem}[data-super-agent-widget] .-top-px{top:-1px}[data-super-agent-widget] .bottom-0{bottom:0}[data-super-agent-widget] .left-\\[-3px\\]{left:-3px}[data-super-agent-widget] .top-0{top:0}[data-super-agent-widget] .z-0{z-index:0}[data-super-agent-widget] .z-10{z-index:10}[data-super-agent-widget] .z-20{z-index:20}[data-super-agent-widget] .z-\\[10000\\]{z-index:10000}[data-super-agent-widget] .z-\\[10001\\]{z-index:10001}[data-super-agent-widget] .z-\\[1\\]{z-index:1}[data-super-agent-widget] .z-\\[2\\]{z-index:2}[data-super-agent-widget] .z-\\[5\\]{z-index:5}[data-super-agent-widget] .z-\\[var\\(--sa-z-index\\,9999\\)\\]{z-index:var(--sa-z-index,9999)}[data-super-agent-widget] .m-0{margin:0}[data-super-agent-widget] .mx-auto{margin-left:auto;margin-right:auto}[data-super-agent-widget] .mb-0\\.5{margin-bottom:.125rem}[data-super-agent-widget] .mb-1{margin-bottom:.25rem}[data-super-agent-widget] .mb-1\\.5{margin-bottom:.375rem}[data-super-agent-widget] .mb-3{margin-bottom:.75rem}[data-super-agent-widget] .mb-4{margin-bottom:1rem}[data-super-agent-widget] .ml-auto{margin-left:auto}[data-super-agent-widget] .mr-auto{margin-right:auto}[data-super-agent-widget] .mt-3{margin-top:.75rem}[data-super-agent-widget] .block{display:block}[data-super-agent-widget] .inline{display:inline}[data-super-agent-widget] .flex{display:flex}[data-super-agent-widget] .inline-flex{display:inline-flex}[data-super-agent-widget] .table{display:table}[data-super-agent-widget] .hidden{display:none}[data-super-agent-widget] .h-5{height:1.25rem}[data-super-agent-widget] .h-7{height:1.75rem}[data-super-agent-widget] .h-8{height:2rem}[data-super-agent-widget] .h-9{height:2.25rem}[data-super-agent-widget] .h-\\[13px\\]{height:13px}[data-super-agent-widget] .h-\\[18px\\]{height:18px}[data-super-agent-widget] .h-\\[238px\\]{height:238px}[data-super-agent-widget] .h-\\[calc\\(100\\%_-_48px\\)\\]{height:calc(100% - 48px)}[data-super-agent-widget] .h-full{height:100%}[data-super-agent-widget] .min-h-\\[34px\\]{min-height:34px}[data-super-agent-widget] .min-h-\\[70px\\]{min-height:70px}[data-super-agent-widget] .w-12{width:3rem}[data-super-agent-widget] .w-5{width:1.25rem}[data-super-agent-widget] .w-7{width:1.75rem}[data-super-agent-widget] .w-\\[18px\\]{width:18px}[data-super-agent-widget] .w-\\[220px\\]{width:220px}[data-super-agent-widget] .w-\\[6px\\]{width:6px}[data-super-agent-widget] .w-full{width:100%}[data-super-agent-widget] .w-px{width:1px}[data-super-agent-widget] .min-w-0{min-width:0px}[data-super-agent-widget] .min-w-\\[14px\\]{min-width:14px}[data-super-agent-widget] .max-w-16{max-width:4rem}[data-super-agent-widget] .max-w-\\[50\\%\\]{max-width:50%}[data-super-agent-widget] .max-w-\\[800px\\]{max-width:800px}[data-super-agent-widget] .max-w-full{max-width:100%}[data-super-agent-widget] .flex-1{flex:1 1 0%}[data-super-agent-widget] .flex-shrink{flex-shrink:1}[data-super-agent-widget] .shrink-0{flex-shrink:0}[data-super-agent-widget] .border-collapse{border-collapse:collapse}[data-super-agent-widget] .scale-50{--tw-scale-x: .5;--tw-scale-y: .5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .cursor-col-resize{cursor:col-resize}[data-super-agent-widget] .cursor-default{cursor:default}[data-super-agent-widget] .cursor-grab{cursor:grab}[data-super-agent-widget] .cursor-pointer{cursor:pointer}[data-super-agent-widget] .cursor-text{cursor:text}[data-super-agent-widget] .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-super-agent-widget] .resize-none{resize:none}[data-super-agent-widget] .resize{resize:both}[data-super-agent-widget] .flex-row{flex-direction:row}[data-super-agent-widget] .flex-col{flex-direction:column}[data-super-agent-widget] .flex-wrap{flex-wrap:wrap}[data-super-agent-widget] .items-start{align-items:flex-start}[data-super-agent-widget] .items-center{align-items:center}[data-super-agent-widget] .justify-end{justify-content:flex-end}[data-super-agent-widget] .justify-center{justify-content:center}[data-super-agent-widget] .gap-0\\.5{gap:.125rem}[data-super-agent-widget] .gap-1{gap:.25rem}[data-super-agent-widget] .gap-1\\.5{gap:.375rem}[data-super-agent-widget] .gap-2{gap:.5rem}[data-super-agent-widget] .gap-2\\.5{gap:.625rem}[data-super-agent-widget] .gap-3{gap:.75rem}[data-super-agent-widget] .gap-4{gap:1rem}[data-super-agent-widget] .gap-8{gap:2rem}[data-super-agent-widget] .gap-\\[22px\\]{gap:22px}[data-super-agent-widget] .gap-\\[7px\\]{gap:7px}[data-super-agent-widget] .overflow-hidden{overflow:hidden}[data-super-agent-widget] .overflow-visible{overflow:visible}[data-super-agent-widget] .overflow-y-auto{overflow-y:auto}[data-super-agent-widget] .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[data-super-agent-widget] .text-ellipsis{text-overflow:ellipsis}[data-super-agent-widget] .whitespace-nowrap{white-space:nowrap}[data-super-agent-widget] .rounded{border-radius:.25rem}[data-super-agent-widget] .rounded-\\[5px\\]{border-radius:5px}[data-super-agent-widget] .rounded-full{border-radius:9999px}[data-super-agent-widget] .rounded-md{border-radius:.375rem}[data-super-agent-widget] .border{border-width:1px}[data-super-agent-widget] .border-r{border-right-width:1px}[data-super-agent-widget] .border-r-0{border-right-width:0px}[data-super-agent-widget] .border-none{border-style:none}[data-super-agent-widget] .border-\\[\\#DADADA\\]{--tw-border-opacity: 1;border-color:rgb(218 218 218 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#E8E8E8\\]{--tw-border-opacity: 1;border-color:rgb(232 232 232 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#ECECEC\\]{--tw-border-opacity: 1;border-color:rgb(236 236 236 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[var\\(--sa-primary\\)\\]{border-color:var(--sa-primary)}[data-super-agent-widget] .bg-\\[\\#DCDCDC\\]{--tw-bg-opacity: 1;background-color:rgb(220 220 220 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#E8F1FE\\]{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#F5F5F5\\]{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#FAFAFA\\]{--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#fee2e2\\]{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[var\\(--sa-primary\\)\\]{background-color:var(--sa-primary)}[data-super-agent-widget] .bg-black\\/30{background-color:#0000004d}[data-super-agent-widget] .bg-transparent{background-color:transparent}[data-super-agent-widget] .bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .object-contain{-o-object-fit:contain;object-fit:contain}[data-super-agent-widget] .p-0{padding:0}[data-super-agent-widget] .p-2{padding:.5rem}[data-super-agent-widget] .p-3{padding:.75rem}[data-super-agent-widget] .px-0\\.5{padding-left:.125rem;padding-right:.125rem}[data-super-agent-widget] .px-1{padding-left:.25rem;padding-right:.25rem}[data-super-agent-widget] .px-1\\.5{padding-left:.375rem;padding-right:.375rem}[data-super-agent-widget] .px-2\\.5{padding-left:.625rem;padding-right:.625rem}[data-super-agent-widget] .px-3{padding-left:.75rem;padding-right:.75rem}[data-super-agent-widget] .px-\\[15px\\]{padding-left:15px;padding-right:15px}[data-super-agent-widget] .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}[data-super-agent-widget] .py-1{padding-top:.25rem;padding-bottom:.25rem}[data-super-agent-widget] .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}[data-super-agent-widget] .py-2{padding-top:.5rem;padding-bottom:.5rem}[data-super-agent-widget] .py-3{padding-top:.75rem;padding-bottom:.75rem}[data-super-agent-widget] .pb-1{padding-bottom:.25rem}[data-super-agent-widget] .pb-2\\.5{padding-bottom:.625rem}[data-super-agent-widget] .pt-2{padding-top:.5rem}[data-super-agent-widget] .text-left{text-align:left}[data-super-agent-widget] .text-center{text-align:center}[data-super-agent-widget] .text-\\[11px\\]{font-size:11px}[data-super-agent-widget] .text-\\[12px\\]{font-size:12px}[data-super-agent-widget] .text-\\[13px\\]{font-size:13px}[data-super-agent-widget] .text-\\[14px\\]{font-size:14px}[data-super-agent-widget] .text-\\[15px\\]{font-size:15px}[data-super-agent-widget] .text-\\[18px\\]{font-size:18px}[data-super-agent-widget] .text-\\[9px\\]{font-size:9px}[data-super-agent-widget] .font-bold{font-weight:700}[data-super-agent-widget] .font-medium{font-weight:500}[data-super-agent-widget] .font-semibold{font-weight:600}[data-super-agent-widget] .italic{font-style:italic}[data-super-agent-widget] .leading-\\[1\\.3\\]{line-height:1.3}[data-super-agent-widget] .leading-\\[1\\.4\\]{line-height:1.4}[data-super-agent-widget] .leading-\\[1\\.5\\]{line-height:1.5}[data-super-agent-widget] .leading-\\[14px\\]{line-height:14px}[data-super-agent-widget] .leading-none{line-height:1}[data-super-agent-widget] .text-\\[\\#18181b\\]{--tw-text-opacity: 1;color:rgb(24 24 27 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#333\\]{--tw-text-opacity: 1;color:rgb(51 51 51 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#666\\]{--tw-text-opacity: 1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#999\\]{--tw-text-opacity: 1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#9A9A9A\\]{--tw-text-opacity: 1;color:rgb(154 154 154 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#A0A0A0\\]{--tw-text-opacity: 1;color:rgb(160 160 160 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#B8B8B8\\]{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#C0C0C0\\]{--tw-text-opacity: 1;color:rgb(192 192 192 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#ef4444\\]{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .underline{text-decoration-line:underline}[data-super-agent-widget] .antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[data-super-agent-widget] .opacity-0{opacity:0}[data-super-agent-widget] .opacity-10{opacity:.1}[data-super-agent-widget] .opacity-100{opacity:1}[data-super-agent-widget] .opacity-60{opacity:.6}[data-super-agent-widget] .opacity-70{opacity:.7}[data-super-agent-widget] .shadow-\\[0_-12px_48px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: 0 -12px 48px rgba(0,0,0,.25);--tw-shadow-colored: 0 -12px 48px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .shadow-\\[0_2px_8px_rgba\\(0\\,0\\,0\\,0\\.12\\)\\]{--tw-shadow: 0 2px 8px rgba(0,0,0,.12);--tw-shadow-colored: 0 2px 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .outline-none{outline:2px solid transparent;outline-offset:2px}[data-super-agent-widget] .outline{outline-style:solid}[data-super-agent-widget] .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .duration-200{transition-duration:.2s}[data-super-agent-widget] .ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}[data-super-agent-widget] .ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes sa-window-in{0%{opacity:0;transform:translateY(20px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes sa-slide-up-full{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes sa-home-fade-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-chip-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-logo-float{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}@keyframes sa-title-shimmer{0%{background-position:100% 0}to{background-position:-100% 0}}@keyframes sa-history-in{0%{opacity:0;transform:translate(-10px)}to{opacity:1;transform:translate(0)}}[data-super-agent-widget] .animate-sa-window-in{animation:sa-window-in .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-slide-up-full{animation:sa-slide-up-full .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-fade-in{animation:sa-fade-in .2s ease}[data-super-agent-widget] .animate-sa-home-fade-in{animation:sa-home-fade-in .4s ease forwards}[data-super-agent-widget] .animate-sa-chip-in{animation:sa-chip-in .4s cubic-bezier(.22,1,.36,1) forwards}[data-super-agent-widget] .animate-sa-logo-float{animation:sa-logo-float 3s ease-in-out infinite}[data-super-agent-widget] .animate-sa-title-shimmer{animation:sa-title-shimmer 2.5s ease forwards}[data-super-agent-widget] .animate-sa-history-in{animation:sa-history-in .2s ease}[data-super-agent-widget] .sa-tip{position:relative}[data-super-agent-widget] .sa-tip:before,[data-super-agent-widget] .sa-tip:after{position:absolute;top:100%;left:50%;pointer-events:none;opacity:0;transition:opacity .15s ease;z-index:100}[data-super-agent-widget] .sa-tip:before{content:attr(data-tooltip);transform:translate(-50%);margin-top:6px;padding:4px 8px;background:#fff;color:#333;font-size:12px;line-height:1.4;white-space:nowrap;border-radius:4px;box-shadow:0 2px 8px #0000001f;border:1px solid #e8e8e8}[data-super-agent-widget] .sa-tip:after{content:"";transform:translate(-50%);margin-top:2px;border:4px solid transparent;border-bottom-color:#fff;filter:drop-shadow(0 -1px 1px rgba(0,0,0,.06))}[data-super-agent-widget] .sa-tip:hover:before,[data-super-agent-widget] .sa-tip:hover:after{opacity:1}[data-super-agent-widget] .sa-chip{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(#e0e0e0,#e0e0e0) border-box;border:1px solid transparent}[data-super-agent-widget] .sa-chip:hover{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7) border-box}[data-super-agent-widget] .sa-chip:hover .sa-chip-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-shimmer-text{background:linear-gradient(90deg,#333,#333 35%,#00d4ff 40%,#1881f0,#2b52ee,#d116ea,#ff2e7e 56%,#333 61%,#333);background-size:300% 100%;background-position:100% 0;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-new-chat{background:linear-gradient(258deg,#ff2e7e1a -4%,#d116ea1a 16%,#2b52ee1a 53%,#1881f01a 81%,#00d4ff1a 106%)}[data-super-agent-widget] .sa-new-chat:hover{background:linear-gradient(258deg,#ff2e7e29 -4%,#d116ea29 16%,#2b52ee29 53%,#1881f029 81%,#00d4ff29 106%)}[data-super-agent-widget] .sa-new-chat .sa-new-chat-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-home-gradient{background:linear-gradient(239deg,#ff2e7e -3%,#d116ea 17%,#2b52ee 54%,#1881f0 82%,#00d4ff 107%)}[data-super-agent-widget] .sa-home-gradient-fade{background:linear-gradient(180deg,#fff0,#fff)}[data-super-agent-widget] .sa-home-view .sa-thread{background:transparent}[data-super-agent-widget] .sa-resize-handle:hover{background:color-mix(in srgb,var(--sa-primary) 30%,transparent)}[data-super-agent-widget] .sa-input-form{border:1px solid transparent;background-color:#fff;background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);background-origin:border-box;background-clip:padding-box,border-box;transition:background .15s ease}[data-super-agent-widget] .sa-input-form-active,[data-super-agent-widget] .sa-input-form:focus-within{background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-input-form-streaming,[data-super-agent-widget] .sa-input-form-streaming:focus-within{background-image:linear-gradient(#f5f5f7,#f5f5f7),linear-gradient(#e5e7eb,#e5e7eb);cursor:not-allowed}[data-super-agent-widget] .sa-input-form-streaming .sa-input-field{cursor:not-allowed}[data-super-agent-widget] .sa-input-field:disabled::-moz-placeholder{color:#b8b8b8}[data-super-agent-widget] .sa-input-field:disabled::placeholder{color:#b8b8b8}[data-super-agent-widget] .sa-send-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border:none;border-radius:9999px;background:linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);cursor:pointer;flex-shrink:0;transition:background .15s ease,opacity .15s ease}[data-super-agent-widget] .sa-send-btn-active,[data-super-agent-widget] .sa-input-form:focus-within .sa-send-btn{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-send-btn:hover{opacity:.9}[data-super-agent-widget] .sa-send-btn:active{opacity:.7}[data-super-agent-widget] .sa-send-btn img{display:block;width:14px;height:14px;filter:brightness(0) invert(1)}[data-super-agent-widget] .sa-stop-icon{display:block;width:8px;height:8px;border-radius:2px;background:#fff}[data-super-agent-widget] .sa-send-hint{display:flex;align-items:center;gap:3px;flex-shrink:0;font-size:11px;line-height:1;color:#9ca3af;-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-super-agent-widget] .sa-send-kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 4px;border:1px solid #e5e7eb;border-radius:4px;background:#f5f5f7;font-family:inherit;font-size:11px;line-height:1;color:#6b7280}[data-super-agent-widget] .sa-attach-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border:none;border-radius:9999px;background:linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);color:#fff;cursor:pointer;flex-shrink:0;transition:background .15s ease,opacity .15s ease}[data-super-agent-widget] .sa-attach-btn:hover{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);opacity:.9}[data-super-agent-widget] .sa-attach-btn:active{opacity:.7}[data-super-agent-widget] .sa-attachment-tray{display:flex;flex-wrap:wrap;gap:6px;padding:2px 0}[data-super-agent-widget] .sa-attachment-tray-chip{display:inline-flex;align-items:center;gap:4px;max-width:220px;padding:4px 8px;border:1px solid rgba(40,92,255,.25);border-radius:6px;background:#285cff0d;font-size:12px;line-height:1;color:#333}[data-super-agent-widget] .sa-attachment-tray-chip-error{border-color:#ef444459;background:#ef44440f}[data-super-agent-widget] .sa-attachment-tray-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}[data-super-agent-widget] .sa-attachment-tray-chip-size{color:#b8b8b8;flex-shrink:0}[data-super-agent-widget] .sa-attachment-tray-chip-remove{display:flex;align-items:center;justify-content:center;width:14px;height:14px;border:none;border-radius:9999px;background:transparent;color:#b8b8b8;font-size:10px;line-height:1;cursor:pointer;flex-shrink:0;padding:0}[data-super-agent-widget] .sa-attachment-tray-chip-remove:hover{background:#00000014;color:#666}[data-super-agent-widget] .sa-skill-chip{display:inline-flex;align-items:center;gap:3px;flex-shrink:0;height:21px;padding:0 7px 0 5px;border-radius:5px;background:#f2f3f5;font-size:12px;line-height:1;color:#333;-moz-user-select:none;user-select:none;-webkit-user-select:none;max-width:180px}[data-super-agent-widget] .sa-skill-chip-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[data-super-agent-widget] .sa-skill-chip-icon{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;padding:0;border:none;border-radius:3px;background:transparent;color:#8a8f99;cursor:pointer}[data-super-agent-widget] .sa-skill-chip-icon:hover{color:#333}[data-super-agent-widget] .sa-skill-chip-icon-skill{display:none}[data-super-agent-widget] .sa-skill-chip-icon-remove{display:inline-flex}@media (hover: hover){[data-super-agent-widget] .sa-skill-chip-icon-skill{display:inline-flex}[data-super-agent-widget] .sa-skill-chip-icon-remove{display:none}[data-super-agent-widget] .sa-skill-chip:hover .sa-skill-chip-icon-skill,[data-super-agent-widget] .sa-skill-chip:focus-within .sa-skill-chip-icon-skill{display:none}[data-super-agent-widget] .sa-skill-chip:hover .sa-skill-chip-icon-remove,[data-super-agent-widget] .sa-skill-chip:focus-within .sa-skill-chip-icon-remove{display:inline-flex}}[data-super-agent-widget] .sa-attachment-chip{display:inline-flex;align-items:center;gap:4px;max-width:240px;margin:2px 0;padding:5px 10px;border-radius:8px;background:#ffffff59;font-size:12px;line-height:1;color:inherit}[data-super-agent-widget] .sa-attachment-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}[data-super-agent-widget] .sa-attachment-chip-size{color:#00000073;flex-shrink:0}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:scale-\\[1\\.08\\]:hover{--tw-scale-x: 1.08;--tw-scale-y: 1.08;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .hover\\:bg-\\[\\#E8F1FE\\]:hover{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-\\[\\#F5F5F5\\]:hover{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white\\/70:hover{background-color:#ffffffb3}[data-super-agent-widget] .hover\\:text-\\[\\#1881F0\\]:hover{--tw-text-opacity: 1;color:rgb(24 129 240 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[\\#ef4444\\]:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[var\\(--sa-primary\\)\\]:hover{color:var(--sa-primary)}[data-super-agent-widget] .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .active\\:cursor-grabbing:active{cursor:grabbing}[data-super-agent-widget] .active\\:bg-\\[\\#F5F5F5\\]:active{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] :is(.group:hover .group-hover\\:flex){display:flex}',xa={primaryColor:"#6366f1",backgroundColor:"#ffffff",fontFamily:"system-ui, -apple-system, sans-serif",borderRadius:16,panelWidth:400,panelHeight:648,zIndex:9999};function Yp(e,t){const n=parseInt(e.slice(1,3),16),r=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16),s=1-t;return`#${Math.round(n*s).toString(16).padStart(2,"0")}${Math.round(r*s).toString(16).padStart(2,"0")}${Math.round(i*s).toString(16).padStart(2,"0")}`}function Gp(e,t){const n=parseInt(e.slice(1,3),16),r=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return`#${Math.round(n+(255-n)*t).toString(16).padStart(2,"0")}${Math.round(r+(255-r)*t).toString(16).padStart(2,"0")}${Math.round(i+(255-i)*t).toString(16).padStart(2,"0")}`}function ba(e){const t={...xa,...e},n=t.primaryColor,r=t.backgroundColor;return[`--sa-primary: ${n}`,`--sa-bg: ${r}`,`--sa-font: ${t.fontFamily}`,`--sa-radius: ${t.borderRadius}px`,`--sa-panel-width: ${t.panelWidth}px`,`--sa-panel-height: ${t.panelHeight}px`,`--sa-z-index: ${t.zIndex}`,`--sa-primary-dark: ${Yp(n,.15)}`,`--sa-primary-light: ${Gp(n,.9)}`,`--sa-surface: ${r}`,"--sa-border: #e5e7eb","--sa-hover: #f4f4f5","--sa-text: #374151","--sa-text-muted: #9ca3af","--sa-text-light: #6b7280"].join("; ")}function Xp(e,t){const n=typeof e=="string"?document.querySelector(e):e;if(!n)throw new Error(`Target element not found: ${e}`);const r=document.createElement("div");r.setAttribute("data-super-agent-widget","");const i=ba(t.theme??{});if(r.setAttribute("style",`${i}; height: 100%;`),n.appendChild(r),!document.getElementById("sa-widget-styles")){const l=document.createElement("style");l.id="sa-widget-styles",l.textContent=`${ma}
|
|
1317
|
-
${
|
|
1342
|
+
`,Qp='[data-super-agent-widget] .pointer-events-none{pointer-events:none}[data-super-agent-widget] .visible{visibility:visible}[data-super-agent-widget] .collapse{visibility:collapse}[data-super-agent-widget] .fixed{position:fixed}[data-super-agent-widget] .absolute{position:absolute}[data-super-agent-widget] .relative{position:relative}[data-super-agent-widget] .inset-0{top:0;right:0;bottom:0;left:0}[data-super-agent-widget] .inset-x-0{left:0;right:0}[data-super-agent-widget] .-bottom-px{bottom:-1px}[data-super-agent-widget] .-left-px{left:-1px}[data-super-agent-widget] .-right-2{right:-.5rem}[data-super-agent-widget] .-top-1\\.5{top:-.375rem}[data-super-agent-widget] .-top-px{top:-1px}[data-super-agent-widget] .bottom-0{bottom:0}[data-super-agent-widget] .left-\\[-3px\\]{left:-3px}[data-super-agent-widget] .top-0{top:0}[data-super-agent-widget] .z-0{z-index:0}[data-super-agent-widget] .z-10{z-index:10}[data-super-agent-widget] .z-20{z-index:20}[data-super-agent-widget] .z-\\[10000\\]{z-index:10000}[data-super-agent-widget] .z-\\[10001\\]{z-index:10001}[data-super-agent-widget] .z-\\[1\\]{z-index:1}[data-super-agent-widget] .z-\\[2\\]{z-index:2}[data-super-agent-widget] .z-\\[5\\]{z-index:5}[data-super-agent-widget] .z-\\[var\\(--sa-z-index\\,9999\\)\\]{z-index:var(--sa-z-index,9999)}[data-super-agent-widget] .m-0{margin:0}[data-super-agent-widget] .mx-auto{margin-left:auto;margin-right:auto}[data-super-agent-widget] .mb-0\\.5{margin-bottom:.125rem}[data-super-agent-widget] .mb-1{margin-bottom:.25rem}[data-super-agent-widget] .mb-1\\.5{margin-bottom:.375rem}[data-super-agent-widget] .mb-3{margin-bottom:.75rem}[data-super-agent-widget] .mb-4{margin-bottom:1rem}[data-super-agent-widget] .ml-auto{margin-left:auto}[data-super-agent-widget] .mr-auto{margin-right:auto}[data-super-agent-widget] .mt-3{margin-top:.75rem}[data-super-agent-widget] .block{display:block}[data-super-agent-widget] .inline{display:inline}[data-super-agent-widget] .flex{display:flex}[data-super-agent-widget] .inline-flex{display:inline-flex}[data-super-agent-widget] .table{display:table}[data-super-agent-widget] .hidden{display:none}[data-super-agent-widget] .h-5{height:1.25rem}[data-super-agent-widget] .h-7{height:1.75rem}[data-super-agent-widget] .h-8{height:2rem}[data-super-agent-widget] .h-9{height:2.25rem}[data-super-agent-widget] .h-\\[13px\\]{height:13px}[data-super-agent-widget] .h-\\[18px\\]{height:18px}[data-super-agent-widget] .h-\\[238px\\]{height:238px}[data-super-agent-widget] .h-\\[calc\\(100\\%_-_48px\\)\\]{height:calc(100% - 48px)}[data-super-agent-widget] .h-full{height:100%}[data-super-agent-widget] .min-h-\\[34px\\]{min-height:34px}[data-super-agent-widget] .min-h-\\[70px\\]{min-height:70px}[data-super-agent-widget] .w-12{width:3rem}[data-super-agent-widget] .w-5{width:1.25rem}[data-super-agent-widget] .w-7{width:1.75rem}[data-super-agent-widget] .w-\\[18px\\]{width:18px}[data-super-agent-widget] .w-\\[220px\\]{width:220px}[data-super-agent-widget] .w-\\[6px\\]{width:6px}[data-super-agent-widget] .w-full{width:100%}[data-super-agent-widget] .w-px{width:1px}[data-super-agent-widget] .min-w-0{min-width:0px}[data-super-agent-widget] .min-w-\\[14px\\]{min-width:14px}[data-super-agent-widget] .max-w-16{max-width:4rem}[data-super-agent-widget] .max-w-\\[50\\%\\]{max-width:50%}[data-super-agent-widget] .max-w-\\[800px\\]{max-width:800px}[data-super-agent-widget] .max-w-full{max-width:100%}[data-super-agent-widget] .flex-1{flex:1 1 0%}[data-super-agent-widget] .flex-shrink{flex-shrink:1}[data-super-agent-widget] .shrink-0{flex-shrink:0}[data-super-agent-widget] .border-collapse{border-collapse:collapse}[data-super-agent-widget] .scale-50{--tw-scale-x: .5;--tw-scale-y: .5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .cursor-col-resize{cursor:col-resize}[data-super-agent-widget] .cursor-default{cursor:default}[data-super-agent-widget] .cursor-grab{cursor:grab}[data-super-agent-widget] .cursor-pointer{cursor:pointer}[data-super-agent-widget] .cursor-text{cursor:text}[data-super-agent-widget] .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-super-agent-widget] .resize-none{resize:none}[data-super-agent-widget] .resize{resize:both}[data-super-agent-widget] .flex-row{flex-direction:row}[data-super-agent-widget] .flex-col{flex-direction:column}[data-super-agent-widget] .flex-wrap{flex-wrap:wrap}[data-super-agent-widget] .items-start{align-items:flex-start}[data-super-agent-widget] .items-center{align-items:center}[data-super-agent-widget] .justify-end{justify-content:flex-end}[data-super-agent-widget] .justify-center{justify-content:center}[data-super-agent-widget] .gap-0\\.5{gap:.125rem}[data-super-agent-widget] .gap-1{gap:.25rem}[data-super-agent-widget] .gap-1\\.5{gap:.375rem}[data-super-agent-widget] .gap-2{gap:.5rem}[data-super-agent-widget] .gap-2\\.5{gap:.625rem}[data-super-agent-widget] .gap-3{gap:.75rem}[data-super-agent-widget] .gap-4{gap:1rem}[data-super-agent-widget] .gap-8{gap:2rem}[data-super-agent-widget] .gap-\\[22px\\]{gap:22px}[data-super-agent-widget] .gap-\\[7px\\]{gap:7px}[data-super-agent-widget] .overflow-hidden{overflow:hidden}[data-super-agent-widget] .overflow-visible{overflow:visible}[data-super-agent-widget] .overflow-y-auto{overflow-y:auto}[data-super-agent-widget] .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[data-super-agent-widget] .text-ellipsis{text-overflow:ellipsis}[data-super-agent-widget] .whitespace-nowrap{white-space:nowrap}[data-super-agent-widget] .rounded{border-radius:.25rem}[data-super-agent-widget] .rounded-\\[5px\\]{border-radius:5px}[data-super-agent-widget] .rounded-full{border-radius:9999px}[data-super-agent-widget] .rounded-md{border-radius:.375rem}[data-super-agent-widget] .border{border-width:1px}[data-super-agent-widget] .border-r{border-right-width:1px}[data-super-agent-widget] .border-r-0{border-right-width:0px}[data-super-agent-widget] .border-none{border-style:none}[data-super-agent-widget] .border-\\[\\#DADADA\\]{--tw-border-opacity: 1;border-color:rgb(218 218 218 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#E8E8E8\\]{--tw-border-opacity: 1;border-color:rgb(232 232 232 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[\\#ECECEC\\]{--tw-border-opacity: 1;border-color:rgb(236 236 236 / var(--tw-border-opacity, 1))}[data-super-agent-widget] .border-\\[var\\(--sa-primary\\)\\]{border-color:var(--sa-primary)}[data-super-agent-widget] .bg-\\[\\#DCDCDC\\]{--tw-bg-opacity: 1;background-color:rgb(220 220 220 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#E8F1FE\\]{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#F5F5F5\\]{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#FAFAFA\\]{--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[\\#fee2e2\\]{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .bg-\\[var\\(--sa-primary\\)\\]{background-color:var(--sa-primary)}[data-super-agent-widget] .bg-black\\/30{background-color:#0000004d}[data-super-agent-widget] .bg-transparent{background-color:transparent}[data-super-agent-widget] .bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .object-contain{-o-object-fit:contain;object-fit:contain}[data-super-agent-widget] .p-0{padding:0}[data-super-agent-widget] .p-2{padding:.5rem}[data-super-agent-widget] .p-3{padding:.75rem}[data-super-agent-widget] .px-0\\.5{padding-left:.125rem;padding-right:.125rem}[data-super-agent-widget] .px-1{padding-left:.25rem;padding-right:.25rem}[data-super-agent-widget] .px-1\\.5{padding-left:.375rem;padding-right:.375rem}[data-super-agent-widget] .px-2\\.5{padding-left:.625rem;padding-right:.625rem}[data-super-agent-widget] .px-3{padding-left:.75rem;padding-right:.75rem}[data-super-agent-widget] .px-\\[15px\\]{padding-left:15px;padding-right:15px}[data-super-agent-widget] .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}[data-super-agent-widget] .py-1{padding-top:.25rem;padding-bottom:.25rem}[data-super-agent-widget] .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}[data-super-agent-widget] .py-2{padding-top:.5rem;padding-bottom:.5rem}[data-super-agent-widget] .py-3{padding-top:.75rem;padding-bottom:.75rem}[data-super-agent-widget] .pb-1{padding-bottom:.25rem}[data-super-agent-widget] .pb-2\\.5{padding-bottom:.625rem}[data-super-agent-widget] .pt-2{padding-top:.5rem}[data-super-agent-widget] .text-left{text-align:left}[data-super-agent-widget] .text-center{text-align:center}[data-super-agent-widget] .text-\\[11px\\]{font-size:11px}[data-super-agent-widget] .text-\\[12px\\]{font-size:12px}[data-super-agent-widget] .text-\\[13px\\]{font-size:13px}[data-super-agent-widget] .text-\\[14px\\]{font-size:14px}[data-super-agent-widget] .text-\\[15px\\]{font-size:15px}[data-super-agent-widget] .text-\\[18px\\]{font-size:18px}[data-super-agent-widget] .text-\\[9px\\]{font-size:9px}[data-super-agent-widget] .font-bold{font-weight:700}[data-super-agent-widget] .font-medium{font-weight:500}[data-super-agent-widget] .font-semibold{font-weight:600}[data-super-agent-widget] .italic{font-style:italic}[data-super-agent-widget] .leading-\\[1\\.3\\]{line-height:1.3}[data-super-agent-widget] .leading-\\[1\\.4\\]{line-height:1.4}[data-super-agent-widget] .leading-\\[1\\.5\\]{line-height:1.5}[data-super-agent-widget] .leading-\\[14px\\]{line-height:14px}[data-super-agent-widget] .leading-none{line-height:1}[data-super-agent-widget] .text-\\[\\#18181b\\]{--tw-text-opacity: 1;color:rgb(24 24 27 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#333\\]{--tw-text-opacity: 1;color:rgb(51 51 51 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#666\\]{--tw-text-opacity: 1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#999\\]{--tw-text-opacity: 1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#9A9A9A\\]{--tw-text-opacity: 1;color:rgb(154 154 154 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#A0A0A0\\]{--tw-text-opacity: 1;color:rgb(160 160 160 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#B8B8B8\\]{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#C0C0C0\\]{--tw-text-opacity: 1;color:rgb(192 192 192 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-\\[\\#ef4444\\]{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .underline{text-decoration-line:underline}[data-super-agent-widget] .antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[data-super-agent-widget] .opacity-0{opacity:0}[data-super-agent-widget] .opacity-10{opacity:.1}[data-super-agent-widget] .opacity-100{opacity:1}[data-super-agent-widget] .opacity-60{opacity:.6}[data-super-agent-widget] .opacity-70{opacity:.7}[data-super-agent-widget] .shadow-\\[0_-12px_48px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: 0 -12px 48px rgba(0,0,0,.25);--tw-shadow-colored: 0 -12px 48px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .shadow-\\[0_2px_8px_rgba\\(0\\,0\\,0\\,0\\.12\\)\\]{--tw-shadow: 0 2px 8px rgba(0,0,0,.12);--tw-shadow-colored: 0 2px 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-super-agent-widget] .outline-none{outline:2px solid transparent;outline-offset:2px}[data-super-agent-widget] .outline{outline-style:solid}[data-super-agent-widget] .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-super-agent-widget] .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-super-agent-widget] .duration-200{transition-duration:.2s}[data-super-agent-widget] .ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}[data-super-agent-widget] .ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes sa-window-in{0%{opacity:0;transform:translateY(20px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes sa-slide-up-full{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes sa-home-fade-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-chip-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes sa-logo-float{0%,to{transform:translateY(0)}50%{transform:translateY(-3px)}}@keyframes sa-title-shimmer{0%{background-position:100% 0}to{background-position:-100% 0}}@keyframes sa-history-in{0%{opacity:0;transform:translate(-10px)}to{opacity:1;transform:translate(0)}}[data-super-agent-widget] .animate-sa-window-in{animation:sa-window-in .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-slide-up-full{animation:sa-slide-up-full .3s cubic-bezier(.16,1,.3,1)}[data-super-agent-widget] .animate-sa-fade-in{animation:sa-fade-in .2s ease}[data-super-agent-widget] .animate-sa-home-fade-in{animation:sa-home-fade-in .4s ease forwards}[data-super-agent-widget] .animate-sa-chip-in{animation:sa-chip-in .4s cubic-bezier(.22,1,.36,1) forwards}[data-super-agent-widget] .animate-sa-logo-float{animation:sa-logo-float 3s ease-in-out infinite}[data-super-agent-widget] .animate-sa-title-shimmer{animation:sa-title-shimmer 2.5s ease forwards}[data-super-agent-widget] .animate-sa-history-in{animation:sa-history-in .2s ease}[data-super-agent-widget] .sa-tip{position:relative}[data-super-agent-widget] .sa-tip:before,[data-super-agent-widget] .sa-tip:after{position:absolute;top:100%;left:50%;pointer-events:none;opacity:0;transition:opacity .15s ease;z-index:100}[data-super-agent-widget] .sa-tip:before{content:attr(data-tooltip);transform:translate(-50%);margin-top:6px;padding:4px 8px;background:#fff;color:#333;font-size:12px;line-height:1.4;white-space:nowrap;border-radius:4px;box-shadow:0 2px 8px #0000001f;border:1px solid #e8e8e8}[data-super-agent-widget] .sa-tip:after{content:"";transform:translate(-50%);margin-top:2px;border:4px solid transparent;border-bottom-color:#fff;filter:drop-shadow(0 -1px 1px rgba(0,0,0,.06))}[data-super-agent-widget] .sa-tip:hover:before,[data-super-agent-widget] .sa-tip:hover:after{opacity:1}[data-super-agent-widget] .sa-chip{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(#e0e0e0,#e0e0e0) border-box;border:1px solid transparent}[data-super-agent-widget] .sa-chip:hover{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7) border-box}[data-super-agent-widget] .sa-chip:hover .sa-chip-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-shimmer-text{background:linear-gradient(90deg,#333,#333 35%,#00d4ff 40%,#1881f0,#2b52ee,#d116ea,#ff2e7e 56%,#333 61%,#333);background-size:300% 100%;background-position:100% 0;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-new-chat{background:linear-gradient(258deg,#ff2e7e1a -4%,#d116ea1a 16%,#2b52ee1a 53%,#1881f01a 81%,#00d4ff1a 106%)}[data-super-agent-widget] .sa-new-chat:hover{background:linear-gradient(258deg,#ff2e7e29 -4%,#d116ea29 16%,#2b52ee29 53%,#1881f029 81%,#00d4ff29 106%)}[data-super-agent-widget] .sa-new-chat .sa-new-chat-text{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}[data-super-agent-widget] .sa-home-gradient{background:linear-gradient(239deg,#ff2e7e -3%,#d116ea 17%,#2b52ee 54%,#1881f0 82%,#00d4ff 107%)}[data-super-agent-widget] .sa-home-gradient-fade{background:linear-gradient(180deg,#fff0,#fff)}[data-super-agent-widget] .sa-home-view .sa-thread{background:transparent}[data-super-agent-widget] .sa-resize-handle:hover{background:color-mix(in srgb,var(--sa-primary) 30%,transparent)}[data-super-agent-widget] .sa-input-form{border:1px solid transparent;background-color:#fff;background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);background-origin:border-box;background-clip:padding-box,border-box;transition:background .15s ease}[data-super-agent-widget] .sa-input-form-active,[data-super-agent-widget] .sa-input-form:focus-within{background-image:linear-gradient(#fff,#fff),linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-input-form-streaming,[data-super-agent-widget] .sa-input-form-streaming:focus-within{background-image:linear-gradient(#f5f5f7,#f5f5f7),linear-gradient(#e5e7eb,#e5e7eb);cursor:not-allowed}[data-super-agent-widget] .sa-input-form-streaming .sa-input-field{cursor:not-allowed}[data-super-agent-widget] .sa-input-field:disabled::-moz-placeholder{color:#b8b8b8}[data-super-agent-widget] .sa-input-field:disabled::placeholder{color:#b8b8b8}[data-super-agent-widget] .sa-send-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border:none;border-radius:9999px;background:linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);cursor:pointer;flex-shrink:0;transition:background .15s ease,opacity .15s ease}[data-super-agent-widget] .sa-send-btn-active,[data-super-agent-widget] .sa-input-form:focus-within .sa-send-btn{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7)}[data-super-agent-widget] .sa-send-btn:hover{opacity:.9}[data-super-agent-widget] .sa-send-btn:active{opacity:.7}[data-super-agent-widget] .sa-send-btn img{display:block;width:14px;height:14px;filter:brightness(0) invert(1)}[data-super-agent-widget] .sa-stop-icon{display:block;width:8px;height:8px;border-radius:2px;background:#fff}[data-super-agent-widget] .sa-send-hint{display:flex;align-items:center;gap:3px;flex-shrink:0;font-size:11px;line-height:1;color:#9ca3af;-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-super-agent-widget] .sa-send-kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 4px;border:1px solid #e5e7eb;border-radius:4px;background:#f5f5f7;font-family:inherit;font-size:11px;line-height:1;color:#6b7280}[data-super-agent-widget] .sa-attach-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border:none;border-radius:9999px;background:linear-gradient(110deg,#03b5ff80,#285cff80 47%,#ff28a780);color:#fff;cursor:pointer;flex-shrink:0;transition:background .15s ease,opacity .15s ease}[data-super-agent-widget] .sa-attach-btn:hover{background:linear-gradient(110deg,#03b5ff,#285cff 47%,#ff28a7);opacity:.9}[data-super-agent-widget] .sa-attach-btn:active{opacity:.7}[data-super-agent-widget] .sa-attachment-tray{display:flex;flex-wrap:wrap;gap:6px;padding:2px 0}[data-super-agent-widget] .sa-attachment-tray-chip{display:inline-flex;align-items:center;gap:4px;max-width:220px;padding:4px 8px;border:1px solid rgba(40,92,255,.25);border-radius:6px;background:#285cff0d;font-size:12px;line-height:1;color:#333}[data-super-agent-widget] .sa-attachment-tray-chip-error{border-color:#ef444459;background:#ef44440f}[data-super-agent-widget] .sa-attachment-tray-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}[data-super-agent-widget] .sa-attachment-tray-chip-size{color:#b8b8b8;flex-shrink:0}[data-super-agent-widget] .sa-attachment-tray-chip-remove{display:flex;align-items:center;justify-content:center;width:14px;height:14px;border:none;border-radius:9999px;background:transparent;color:#b8b8b8;font-size:10px;line-height:1;cursor:pointer;flex-shrink:0;padding:0}[data-super-agent-widget] .sa-attachment-tray-chip-remove:hover{background:#00000014;color:#666}[data-super-agent-widget] .sa-skill-chip{display:inline-flex;align-items:center;gap:3px;flex-shrink:0;height:21px;padding:0 7px 0 5px;border-radius:5px;background:#f2f3f5;font-size:12px;line-height:1;color:#333;-moz-user-select:none;user-select:none;-webkit-user-select:none;max-width:180px}[data-super-agent-widget] .sa-skill-chip-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[data-super-agent-widget] .sa-skill-chip-icon{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;padding:0;border:none;border-radius:3px;background:transparent;color:#8a8f99;cursor:pointer}[data-super-agent-widget] .sa-skill-chip-icon:hover{color:#333}[data-super-agent-widget] .sa-skill-chip-icon-skill{display:none}[data-super-agent-widget] .sa-skill-chip-icon-remove{display:inline-flex}@media (hover: hover){[data-super-agent-widget] .sa-skill-chip-icon-skill{display:inline-flex}[data-super-agent-widget] .sa-skill-chip-icon-remove{display:none}[data-super-agent-widget] .sa-skill-chip:hover .sa-skill-chip-icon-skill,[data-super-agent-widget] .sa-skill-chip:focus-within .sa-skill-chip-icon-skill{display:none}[data-super-agent-widget] .sa-skill-chip:hover .sa-skill-chip-icon-remove,[data-super-agent-widget] .sa-skill-chip:focus-within .sa-skill-chip-icon-remove{display:inline-flex}}[data-super-agent-widget] .sa-attachment-chip{display:inline-flex;align-items:center;gap:4px;max-width:240px;margin:2px 0;padding:5px 10px;border-radius:8px;background:#ffffff59;font-size:12px;line-height:1;color:inherit}[data-super-agent-widget] .sa-attachment-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}[data-super-agent-widget] .sa-attachment-chip-size{color:#00000073;flex-shrink:0}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .placeholder\\:text-\\[\\#B8B8B8\\]::placeholder{--tw-text-opacity: 1;color:rgb(184 184 184 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:scale-\\[1\\.08\\]:hover{--tw-scale-x: 1.08;--tw-scale-y: 1.08;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .hover\\:bg-\\[\\#E8F1FE\\]:hover{--tw-bg-opacity: 1;background-color:rgb(232 241 254 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-\\[\\#F5F5F5\\]:hover{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] .hover\\:bg-white\\/70:hover{background-color:#ffffffb3}[data-super-agent-widget] .hover\\:text-\\[\\#1881F0\\]:hover{--tw-text-opacity: 1;color:rgb(24 129 240 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[\\#ef4444\\]:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}[data-super-agent-widget] .hover\\:text-\\[var\\(--sa-primary\\)\\]:hover{color:var(--sa-primary)}[data-super-agent-widget] .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-super-agent-widget] .active\\:cursor-grabbing:active{cursor:grabbing}[data-super-agent-widget] .active\\:bg-\\[\\#F5F5F5\\]:active{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}[data-super-agent-widget] :is(.group:hover .group-hover\\:flex){display:flex}',wa={primaryColor:"#6366f1",backgroundColor:"#ffffff",fontFamily:"system-ui, -apple-system, sans-serif",borderRadius:16,panelWidth:400,panelHeight:648,zIndex:9999};function Jp(e,t){const n=parseInt(e.slice(1,3),16),r=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16),s=1-t;return`#${Math.round(n*s).toString(16).padStart(2,"0")}${Math.round(r*s).toString(16).padStart(2,"0")}${Math.round(i*s).toString(16).padStart(2,"0")}`}function Zp(e,t){const n=parseInt(e.slice(1,3),16),r=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return`#${Math.round(n+(255-n)*t).toString(16).padStart(2,"0")}${Math.round(r+(255-r)*t).toString(16).padStart(2,"0")}${Math.round(i+(255-i)*t).toString(16).padStart(2,"0")}`}function ya(e){const t={...wa,...e},n=t.primaryColor,r=t.backgroundColor;return[`--sa-primary: ${n}`,`--sa-bg: ${r}`,`--sa-font: ${t.fontFamily}`,`--sa-radius: ${t.borderRadius}px`,`--sa-panel-width: ${t.panelWidth}px`,`--sa-panel-height: ${t.panelHeight}px`,`--sa-z-index: ${t.zIndex}`,`--sa-primary-dark: ${Jp(n,.15)}`,`--sa-primary-light: ${Zp(n,.9)}`,`--sa-surface: ${r}`,"--sa-border: #e5e7eb","--sa-hover: #f4f4f5","--sa-text: #374151","--sa-text-muted: #9ca3af","--sa-text-light: #6b7280"].join("; ")}function ef(e,t){const n=typeof e=="string"?document.querySelector(e):e;if(!n)throw new Error(`Target element not found: ${e}`);const r=document.createElement("div");r.setAttribute("data-super-agent-widget","");const i=ya(t.theme??{});if(r.setAttribute("style",`${i}; height: 100%;`),n.appendChild(r),!document.getElementById("sa-widget-styles")){const l=document.createElement("style");l.id="sa-widget-styles",l.textContent=`${ba}
|
|
1343
|
+
${Qp}`,document.head.appendChild(l)}let s=ka.createRoot(r),a=!1;const o=l=>{s&&s.render(y.createElement(xa,{...t,initialOpen:l??a,onOpenChange:u=>{a=u}}))};return o(!1),{open(){a=!0,o(!0)},close(){a=!1,o(!1)},destroy(){s&&(s.unmount(),s=null),r.remove()}}}exports.ASSETS=he;exports.ActionBar=ca;exports.ChatProvider=Zt;exports.ChatWidget=xa;exports.Composer=Ln;exports.ErrorPart=oa;exports.FullpageLayout=ma;exports.Header=qr;exports.Icon=Z;exports.InterruptCard=ua;exports.Message=da;exports.PageOverlay=ha;exports.TextPart=na;exports.ThinkingPart=ia;exports.Thread=Mn;exports.ThreadList=en;exports.ToolCallPart=aa;exports.ToolResultPart=sa;exports.Trigger=Wr;exports.WelcomeScreen=pa;exports.defaultTheme=wa;exports.ensureIconFont=ra;exports.mount=ef;exports.themeToCSSVars=ya;exports.useAutoScroll=Yr;exports.useChat=Fr;exports.useChatContext=Te;exports.useConversations=Or;exports.widgetStyles=ba;
|