@eka-care/medassist-widget 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/medassist-widget.js +1 -1
- package/package.json +1 -1
package/dist/medassist-widget.js
CHANGED
|
@@ -43,7 +43,7 @@ Error generating stack: `+o.message+`
|
|
|
43
43
|
.synapse-chat-widget-container [data-radix-scroll-area-viewport] {
|
|
44
44
|
overscroll-behavior: contain;
|
|
45
45
|
}
|
|
46
|
-
`}),C.jsxs(Dr,{className:EA(Y,"border-0"),"data-text-color":k.textColor,children:[k.backgroundImage&&C.jsx("div",{className:"absolute inset-0 -z-10",style:{backgroundImage:`url(${k.backgroundImage})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",transform:"scale(1.1)"}}),k.backgroundImage&&k.textColor==="black"&&C.jsx("div",{className:"absolute inset-0 -z-10",style:{backgroundColor:"rgba(0, 0, 0, 0.4)"}}),C.jsx("div",{className:EA("flex-shrink-0 sticky top-0 z-50 synapse-chat-widget-header",k.backgroundImage?"":"bg-popover"),style:{...!E&&{cursor:A?"grab":"default"}},children:C.jsx(K4,{onClose:n,showCloseButton:r,title:c,titleImg:f,iconUrl:i,startNewConversation:l})}),C.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col relative",children:u}),B&&C.jsxs("div",{className:EA("flex-shrink-0 sticky bottom-0 z-50 synapse-chat-widget-footer",k.backgroundImage?"":"bg-popover",s&&"synapse-chat-widget-footer--no-border"),children:[C.jsx(S.Suspense,{fallback:null,children:C.jsx(AQ,{value:B.value,onChange:B.onChange,onSend:J?x:B.onSend,onFileChange:B.onFileChange,onRemoveFile:B.onRemoveFile,onRecording:B.onRecording,isRecording:B.isRecording,hasAttachment:B.hasAttachment,attachmentFiles:B.attachmentFiles,isDisabled:B.isDisabled||J&&F,isMobile:E,placeholder:B.placeholder,recordingStatus:B.recordingStatus,theme:k,onStartNewChat:l,showStartNewChatButton:s,allowed:B.allowed})}),h&&p==="development"&&C.jsx("div",{className:"px-6 flex justify-center items-center",children:C.jsxs("p",{className:"text-[8px] text-text-secondary font-mono opacity-50",children:["Session ID: ",h]})}),C.jsxs("div",{className:"px-6 py-2 flex justify-center items-center gap-1.5 text-foreground opacity-90",children:[C.jsx("span",{className:"text-[10px] leading-[14px]",style:{fontFamily:"Inter, system-ui, -apple-system, sans-serif",fontWeight:400,fontStyle:"normal",letterSpacing:"0%"},children:"Powered by"}),C.jsx($4,{})]})]})]})]})}function HB(){const[A,n]=S.useState(typeof navigator<"u"?navigator.onLine:!0);return S.useEffect(()=>{const r=()=>n(!0),i=()=>n(!1);return window.addEventListener("online",r),window.addEventListener("offline",i),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i)}},[]),{isOnline:A}}const Qc=5,eQ=10*1024*1024,tQ=({environment:A,baseUrl:n,context:r,auth:i})=>{const[l,s]=S.useState([]),u=S.useRef([]),[c,f]=S.useState(!1),h=S.useRef(0),[B,p]=S.useState(!1),[m,w]=S.useState([]),E=S.useRef(null),v=S.useRef(null),{isOnline:F}=HB(),U=S.useRef(!1),{agentId:N,setSessionId:k,setSessionToken:$,sessionId:J,sessionToken:x,setError:H,setConnectionStatus:L,setShowRetryButton:D,setStartNewConnection:Y,setIsStreaming:R,setIsWaitingForResponse:j,isStreaming:AA,initialMessage:nA,isWaitingForResponse:rA,setProgressMessage:K,setRecordingStatus:q,clearSession:eA,addMessageToSession:sA,getMessagesForSession:T,updateMessageInSession:I,setInitialMessage:X,userId:b,setUserId:lA,fileUploadPerSession:fA,setFileUploadPerSession:gA,setElicitationState:hA,elicitationState:OA}=Ge();S.useEffect(()=>{F?B?qA()&&(L(Ve.CONNECTED),ht()):L(Ve.CONNECTING):L(Ve.NOT_CONNECTED)},[F,B]),S.useEffect(()=>{if(J){const cA=T(J)||[];cA.length<=0&&nA?.text?s([{id:Date.now().toString(),content:nA.text,role:ot.ASSISTANT,timestamp:Mr(Date.now()),isStored:!1,...nA.suggestions?.length&&{toolEscalationData:{tool_id:nA.suggestions[0].value??null,tool_name:"elicitation",details:{component:wA.SYNAPSE_COMPONENTS.PILL,input:{options:nA.suggestions.map(O=>({id:O.value||"",label:O.label||"",value:O.value||""}))}},isResponded:!1}}}]):s(cA),w([])}},[J,nA]),S.useEffect(()=>{if(p(!1),!N)return;const cA=new wA.SynapseSDK({agentId:N,environment:A,userId:b,callbacks:{onError:O=>{if(O instanceof wA.SynapseError)switch(O.code){case wA.SynapseErrorCode.SESSION:const W=O.context;W?.stage==="handleSessionExpiry"||W?.stage==="refreshSession"?F?(H({title:"Something went wrong!",description:"Please try again."}),D(!0)):(H({title:"Your session has ended.",description:"Please start a new Chat."}),D(!0)):(L(Ve.NOT_CONNECTED),H({title:"Something went wrong!",description:"Please try again."}),D(!0));break;case wA.SynapseErrorCode.RECORDING:H({title:"Recording failed",description:O?.displayMessage||"Please try again later"});break;case wA.SynapseErrorCode.CONNECTION:qA()||(L(Ve.NOT_CONNECTED),h.current<2?(h.current=h.current+1,FA(J,x)):(D(!0),H({title:"Trying to connect...",description:"Please wait while we try to connect"})));break;default:H({title:"Something went wrong",description:"Please try again later from onError callback"}),D(!0);break}},onSessionRefreshed:O=>{O?.session_id&&O?.session_token&&(k(O.session_id),$(O.session_token),FA(O.session_id,O.session_token))}},...n&&{serverUrl:n},...r&&{context:r},...i&&{auth:i}});return E.current=cA,p(!0),()=>{p(!1),E.current?.endSession(),E.current=null,v.current&&(clearTimeout(v.current),v.current=null)}},[N,A,i]),S.useEffect(()=>{u.current=l},[l]),S.useEffect(()=>{const cA=l[l.length-1];!cA?.role||!J||(cA?.role===ot.USER?sA(J,cA):!AA&&!cA.isStored&&(s(O=>{const W=[...O];return W[W.length-1]={...cA,isStored:!0},W}),sA(J,{...cA,isStored:!0})))},[l,AA]),S.useEffect(()=>{const cA=l[l.length-1];return()=>{cA&&!cA?.isStored&&J&&sA(J,{...cA,isStored:!0})}},[]),S.useEffect(()=>(v.current&&(clearTimeout(v.current),v.current=null),rA&&!AA?v.current=setTimeout(()=>{j(!1),v.current=null},3e4):AA&&v.current&&(clearTimeout(v.current),v.current=null),()=>{v.current&&(clearTimeout(v.current),v.current=null)}),[rA,AA,j]);const FA=async(cA,O,W=!1)=>{try{const uA=await E.current?.startSession({session_id:cA||"",session_token:O||""});uA?.session_id&&uA?.session_token&&(k(uA.session_id),$(uA.session_token)),(uA?.initial_message?.text||uA?.initial_message?.suggestions?.length)&&X(uA.initial_message),uA?.user_id&&lA(uA.user_id),Ut()}catch(uA){const vA=uA.context,bA=vA?.stage==="handleSessionExpiry"||vA?.stage==="refreshSession"||uA instanceof wA.APIError&&uA.status===404,ee=uA instanceof wA.APIError&&uA.status===403;bA?(H(null),L(Ve.NOT_CONNECTED),Y(!0)):ee&&!W?(eA(),ht(),await FA(void 0,void 0,!0)):(H({title:"Something went wrong!",description:"Please try again later."}),D(!0))}},me=async(cA=!1)=>{try{if(!E.current){H({title:"SDK not initialized",description:"Please ensure agentId is configured"}),f(!1);return}if(f(!0),cA){await eA(),await E?.current?.endSession(),ht(),await FA();return}const{sessionId:O,sessionToken:W}=Ge.getState();await FA(O,W)}catch{}finally{f(!1)}},qA=()=>E.current?.isConnected()??!1,nt=()=>{E.current?.endSession()},ht=()=>{h.current=0,D(!1),Y(!1),H(null)},Ut=()=>{E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.MESSAGE_CHUNK,cA=>{const O=cA;if(O.data?.text&&O.messageId){AA||(j(!1),R(!0)),qA()&&L(Ve.CONNECTED);const W=O.data.text,uA=O.messageId,vA=U.current;U.current=!1,s(bA=>{const ee=bA[bA.length-1];if(ee&&ee.id===uA&&ee.role===ot.ASSISTANT){const te=[...bA],PA=vA&&ee.content.length>0&&!/\s$/.test(ee.content)&&!/^\s/.test(W)?" ":"";return te[te.length-1]={...ee,content:ee.content+PA+W},te}else return[...bA,{id:uA,content:W,role:ot.ASSISTANT,timestamp:Mr(Date.now()),isStored:!1}]})}}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.END_OF_STREAM,()=>{U.current=!1,R(!1),K(null),j(!1)}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.CONNECTED,()=>{ht(),L(Ve.CONNECTED)}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.TOOL_CALL,cA=>{U.current=!0;const O=cA;if(!O?.messageId||!O?.data||!O?.data?.details?.component||!O?.data?.tool_id)return;rA&&j(!1);const W=O.messageId,uA=O.timestamp??Date.now();switch(O?.data?.details?.status){case wA.SYNAPSE_EICITATION_STATUS.PROGRESS:{const te=O?.data?.details?._meta?.schema?.required||[],PA=O?.data?.details?.input||{},JA=te.reduce((Oe,tn)=>(PA[tn]!==void 0&&(Oe[tn]=PA[tn]),Oe),{}),Be={...Ge.getState().elicitationState.input||{},...JA},KA=te.find(Oe=>!Be[Oe]),rt=O.data.details?._meta?.mcp_meta_fields||[];hA({active:!0,input:Be,required:te,component:O.data.details?.component,toolId:O.data.tool_id??void 0,toolSelectionName:KA,messageId:W,pattern:O.data.details?._meta?.schema?.properties?.[O.data.details?.component]?.pattern,minLength:O.data.details?._meta?.schema?.properties?.[O.data.details?.component]?.minLength,maxLength:O.data.details?._meta?.schema?.properties?.[O.data.details?.component]?.maxLength,type:O.data.details?._meta?.schema?.properties?.[O.data.details?.component]?.type,disp_toast_msg:O.data.details?._meta?.disp_toast_msg,description:O.data.details?._meta?.schema?.properties?.[O.data.details?.component]?.description,...rt.length&&{mcp_meta_fields:rt}});break}case wA.SYNAPSE_EICITATION_STATUS.FAILURE:{hA({active:!1});break}case wA.SYNAPSE_EICITATION_STATUS.SUCCESS:{hA({active:!1,disp_toast_msg:O?.data?.details?._meta?.disp_toast_msg});break}}s(te=>{const PA=te[te.length-1];if(PA&&PA.id===W&&PA.role===ot.ASSISTANT){const JA=[...te],Be={...PA,content:PA.content,toolEscalationData:{...O.data,isResponded:!1},isResponseFromTool:!0};return JA[te.length-1]=Be,I(J,W,Be),JA}else{const JA={id:W,content:O.data?.details?.input?.text||"",role:ot.ASSISTANT,toolEscalationData:{...O.data,isResponded:!1},isResponseFromTool:!0,timestamp:Mr(uA),isStored:!1};return[...te,JA]}});const vA=O.data?.details?._meta,bA=vA?.disp_message,ee=vA?.tool_result;if(bA||Object.keys(ee||{}).length)try{lt({message:bA||"",tool_result:ee})}catch{}}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.DISCONNECTED,cA=>{cA?.reason!==wA.DisconnectionReason.CLIENT_CLOSED&&(h.current<2?(L(Ve.NOT_CONNECTED),h.current=h.current+1,D(!0),H({title:"Something went wrong!",description:"Please try again."})):(L(Ve.NOT_CONNECTED),H({title:"Something went wrong!",description:"Please start a new Chat."}),Y(!0)))}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.ERROR,cA=>{switch(cA?.data?.code){case wA.SYNAPSE_REALTIME_ERROR_CODES.SESSION_INACTIVE:H({title:"Session not found",description:"Please start a new session"}),Y(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.SESSION_TOKEN_MISMATCH:H({title:"Session not found",description:"Please start a new chat from onError callback"}),Y(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.INVALID_EVENT:return;case wA.SYNAPSE_REALTIME_ERROR_CODES.INVALID_CONTENT_TYPE:return;case wA.SYNAPSE_REALTIME_ERROR_CODES.PARSING_ERROR:if(h.current<1){h.current++,GA();return}H({title:"Error parsing request",description:"please try again"}),D(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.TIMEOUT:H({title:"Request timed out",description:"please try again"}),D(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.PROMPT_FETCH_ERROR:H({title:"Something went wrong",description:"please try again"}),D(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.INVALID_FILE_REQUEST:H({title:"Something went wrong",description:"please try again"}),D(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.SERVER_ERROR:H({title:"Something went wrong",description:"please try again"}),D(!0),q(de.IDLE);return;default:H({title:"Something went wrong",description:"please try again"}),D(!0),q(de.IDLE);return}}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.AUDIO_TRANSCRIPT,async cA=>{const O=cA;O?.data?.text&&(s(W=>[...W,{id:Date.now().toString(),content:O.data.text||"",role:ot.USER,timestamp:Mr(Date.now()),isStored:!0}]),q(de.IDLE)),R(!1),j(!1),K(null)}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.PROGRESS_MESSAGE,cA=>{U.current=!0;const O=cA;O.data?.text&&(j(!1),K(O.data.text))}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.TOOL_START,cA=>{U.current=!0;const O=cA;if(O.data?.name&&O.messageId){const W=O.messageId;s(uA=>{const vA=uA[uA.length-1];if(vA&&vA.id===W&&vA.role===ot.ASSISTANT){const bA=[...uA];return bA[bA.length-1]={...vA,toolCallStatus:`Calling tool: ${O.data.name}...`},J&&I(J,W,{toolCallStatus:`Calling tool: ${O.data.name}...`}),bA}return uA})}}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.TOOL_END,cA=>{U.current=!0;const O=cA;if(O.data?.name&&O.messageId){const W=O.messageId;s(uA=>{const vA=uA[uA.length-1];if(vA&&vA.id===W&&vA.role===ot.ASSISTANT){const bA=[...uA];return bA[bA.length-1]={...vA,toolCallStatus:"Tool call completed."},J&&I(J,W,{toolCallStatus:"Tool call completed."}),bA}return uA})}})},lt=async({message:cA,messageId:O,files:W,audio:uA,toolCalled:vA,hidden:bA,selectedCard:ee,selectedComponent:te,resend:PA,tool_declined:JA,tool_result:Be})=>{if(!qA()){D(!0),H({title:"Please try again."});return}if(W&&W.length===0&&cA?.trim()===""&&!uA?.audio&&!te&&!OA.active&&!Be&&!Object.keys(Be||{}).length)return;if(W&&W.length>3){H({title:"Maximum 3 files are allowed to be sent at a time",description:"Please try again"});return}if(W&&W.length>0&&W.reduce((Me,Qe)=>Me+Qe.size,0)>10*1024*1024){H({title:"Total file size limit of 10MB exceeded",description:"Please reduce the size of the files or try again with less files"});return}if(W&&W.length>0&&W.length+fA>Qc){const Me=Qc-fA;H({title:`You can only upload up to ${Qc} files per session`,description:`${Me<=0?"Maximum file upload limit reached":`You have ${Me} file${Me===1?"":"s"} upload${Me===1?"":"s"} left`}`});return}else W&&W.length&&gA(fA+W.length);H(null),D(!1),qA()&&L(Ve.CONNECTED);const KA=l.length==2&&m.length==2?m:null;let rt=null;const Oe=l.length-1,tn=Oe>=0?l[Oe]:null,qr=tn?tn?.isResponseFromTool||tn.role===ot.ASSISTANT&&tn.toolEscalationData:null,Ce=Ge.getState().elicitationState;if(Ce?.active&&Ce?.toolId&&Ce?.messageId&&!JA){const Me=Ce.toolSelectionName??Ce.required?.find(Fe=>!Ce.input?.[Fe])??"",Qe=te?te[Me]:cA,it=Ce.mcp_meta_fields?.reduce((Fe,Ke)=>(Me===Ke?Fe[Ke]=Qe:Ce.input?.[Ke]&&(Fe[Ke]=Ce.input[Ke]),PA&&!Fe.is_resend&&(Fe.is_resend=PA),Fe),{}),Fn={...Object.keys(Ce.input||{})?.reduce((Fe,Ke)=>{const pn=!Object.keys(it||{})?.includes(Ke),So=!!Ce.input?.[Ke];return(PA?pn&&So:pn&&Ce.required?.includes(Ke)&&So)&&(Fe[Ke]=Ce.input?.[Ke]),Fe},{})||{},...!PA&&Me&&!Object.keys(it||{})?.includes(Me)?{[Me]:Qe}:{},...Object.keys(it||{}).length&&{mcp_meta_fields:it}};hA({...Ce,input:{...Ce.input||{},...Fn}});try{await en(Ce.toolId,Ce.messageId,Fn),rt=!0}catch{cA&&await E.current?.sendMessage({message:cA}),hA({active:!1})}}else await E.current?.sendMessage({message:cA,files:W,audio:uA,tool_result:Be,...KA&&{initial_prompts:KA},...JA||qr&&!vA?{tool_declined:!0,tool_id:tn?.toolEscalationData?.tool_id||""}:{}});(cA||W&&W.length>0)&&(s(Me=>{const Qe=[...Me],it=Qe.length-1,kt=Qe[it].toolEscalationData||null;if(qr&&it>=0&&kt&&Object.keys(kt).length>0){let Fn;const Fe=kt.details;if(Fe?.component===wA.SYNAPSE_COMPONENTS.CARD&&Fe?.input?.cards){const Ke=Fe.input.cards.find(pn=>pn.title===ee)||null;Ke&&(Fn={...kt,isResponded:!0,tool_id:null,details:{...Fe,input:{...Fe.input,cards:[Ke]}}})}Fn||(Fn={...kt,isResponded:!OA.active,tool_id:null}),Qe[it]={...Qe[it],toolEscalationData:Fn},I(J,Qe[it]?.id||Date.now().toString(),Qe[it])}return bA||rt?Qe:[...Qe,{id:O||Date.now().toString(),content:cA||"",files:W||[],role:ot.USER,timestamp:Mr(Date.now()),isStored:!0}]}),rt||j(!0),rt=null)},gn=cA=>cA.type.toLowerCase()&&!["application/pdf","image/jpeg","image/jpg","image/png"].includes(cA.type)?(H({title:`File type not supported: ${cA.name}`,description:"Only PDF, images (JPG, JPEG, PNG) are allowed."}),!1):cA.size>3*1024*1024?(H({title:"File size limit of 3MB exceeded",description:"Please reduce the size of the file or try again with a smaller file"}),!1):!0,cr=async()=>{if(!qA())throw new Error("Not connected to the server");try{await E.current?.startRecording({onChunks:async cA=>{q(de.PROCESSING),await lt({audio:cA}),q(de.TRANSCRIBING)},onError(cA){q(de.IDLE)}}),q(de.LISTENING)}catch(cA){throw q(de.IDLE),cA}},fr=()=>{qA()&&E.current?.endRecording()},en=async(cA,O,W)=>{try{if(!qA())throw new Error("Not connected to the server");await E.current?.callTool(cA,O,W)}catch(uA){throw uA}},Bn=async()=>{ht(),await eA(),await me(!0)},GA=async()=>{if(qA()){L(Ve.CONNECTED);const cA=u.current[u.current.length-1];cA&&cA.role===ot.USER&&E.current?.sendMessage({message:cA.content,files:cA.files||[],messageId:cA.id})}else if(L(Ve.NOT_CONNECTED),h.current<2){h.current++;const{sessionId:cA,sessionToken:O}=Ge.getState();await FA(cA,O)}else h.current===2?(h.current++,D(!0),H({title:"Trying to connect..."})):(H({title:"Something went wrong!",description:"Please start a new chat."}),Y(!0))};return{sendMessage:lt,startSession:me,incomingMessages:l,loading:c,endSession:nt,isReady:B,startRecording:cr,stopRecording:fr,handleRetry:GA,isValidFile:gn,handleStartNewConnection:Bn,callTool:en,handleInitialTaskClick:async cA=>{if(!nA?.suggestions?.length||!cA)return;const O=nA.suggestions.find(W=>W.value===cA);if(!O||!O.response){await lt({message:cA});return}s(W=>[...W,{id:Date.now().toString(),content:cA,role:ot.USER,timestamp:Mr(Date.now()),isStored:!0}]),j(!0),await N2(1e3),j(!1),s(W=>[...W,{id:Date.now().toString(),content:O.response||"Please try again",role:ot.ASSISTANT,timestamp:Mr(Date.now()),isStored:!1}]),w([{role:"user",text:cA},{role:"assistant",text:O.response}])},handleToggleFeedback:async(cA,O,W)=>{if(qA())try{await E.current?.sendFeedback(O,cA,W)}catch{}},clearElicitationState:async()=>{try{await lt({message:`User aborted elicitation :tool id ${OA.toolId}, message id ${OA.messageId}, ${OA.component}`,hidden:!0})}catch{}finally{hA({active:!1})}}}},nQ=S.lazy(()=>Promise.resolve().then(()=>c3)),rQ=S.lazy(()=>Promise.resolve().then(()=>h3)),iQ=S.lazy(()=>Promise.resolve().then(()=>B3).then(A=>({default:A.ConnectionStatus})));function aQ({isOpen:A,agentId:n,config:r}){const[i,l]=S.useState(""),[s,u]=S.useState(!1),[c,f]=S.useState(!1),[h,B]=S.useState([]),p=S.useRef(!1),m=S.useRef(null),w=S.useRef(null),[E,v]=S.useState(!1),F=S.useRef(null),U=S.useRef(!1),N=S.useRef("auto"),{setAgentId:k,startNewConnection:$,showRetryButton:J,clearError:x,error:H,connectionStatus:L,recordingStatus:D,isWaitingForResponse:Y,isStreaming:R,setError:j,sessionId:AA,agentId:nA,setContext:rA}=Ge(),{incomingMessages:K,loading:q,sendMessage:eA,startSession:sA,isReady:T,startRecording:I,stopRecording:X,handleRetry:b,isValidFile:lA,handleToggleFeedback:fA,clearElicitationState:gA}=tQ({environment:"production",baseUrl:r.environment==="development"&&r.baseUrl?r.baseUrl:void 0,context:r?.context,...r?.auth&&{auth:r.auth}});S.useEffect(()=>{n&&(D4(n),k4(n),k(n),r?.context&&Object.keys(r?.context||{}).length&&rA(r.context),A&&T&&!p.current&&(p.current=!0,sA(!1)))},[A,T,nA]);const hA=()=>m.current?.querySelector("[data-radix-scroll-area-viewport]")||null,OA=GA=>{const ge=hA();ge&&(ge.scrollTo({top:ge.scrollHeight,behavior:GA}),v(!1))},FA=GA=>{U.current=!0,N.current=GA,F.current===null&&(F.current=requestAnimationFrame(()=>{F.current=null,U.current&&(U.current=!1,OA(N.current))}))};S.useEffect(()=>()=>{F.current!==null&&(cancelAnimationFrame(F.current),F.current=null),U.current=!1},[]);const me=K.length>0,qA=K.length===1;S.useEffect(()=>{if(!K.length)return;FA(R||qA?"auto":"smooth")},[K,R,qA]);const nt=L===wA.ConnectionStatus.CONNECTED,ht=q||!nt||Y||R,Ut=q||!nt,lt=S.useMemo(()=>D===de.IDLE?null:D===de.LISTENING?"Listening...":D===de.PROCESSING?"Processing...":D===de.TRANSCRIBING?"Transcribing...":null,[D]),gn=Ut?"Connecting...":lt&&D!==de.IDLE?lt:Y||R?"Please wait for the response...":"Type a reply…",cr=async GA=>{if(ht)return;const ge=GA?.message??i;if(ge.trim()||s||c||GA?.resend){const gt=Date.now().toString();h.length>0?(await eA({files:h,message:ge.trim(),messageId:gt}),B([]),f(!1)):ge.trim()?await eA({message:ge.trim(),messageId:gt,resend:GA?.resend,tool_declined:GA?.tool_declined}):GA?.resend&&await eA({resend:GA?.resend}),l(""),u(!1),f(!1),setTimeout(()=>{FA("auto")},100)}},fr=GA=>{if(GA&&GA.length>0){const ge=GA.filter(gt=>!!lA(gt));if(ge?.length+h.length>3){j({title:"You can only upload up to 3 files at a time",description:"Please remove some files and try again."});return}if(ge?.length>0&&ge.reduce((gt,Re)=>gt+Re.size,0)>10*1024*1024){j({title:`Total file size limit of ${eQ} MB exceeded`,description:"Please reduce the size of the files or try again with less files"});return}if(ge?.length>0)GA=ge;else return}B(ge=>(f((ge?.length??0)+(GA?.length??0)>0),[...ge,...GA]))},en=GA=>{B(ge=>{const gt=ge.filter((Re,cA)=>cA!==GA);return f(gt.length>0),gt})},Bn=async()=>{if(s)await X(),u(!1);else{if(ht)return;try{await I(),u(!0)}catch{}}};return C.jsx(TB,{isOpen:A,onClose:r.onClose,showCloseButton:r.showCloseButton,title:r.title,showStartNewChatButton:$,titleImg:r.theme?.titleImg,iconUrl:r.iconUrl,onStartNewSession:()=>sA(!0),sessionId:AA,environment:r.environment,displayMode:r.displayMode??"widget",theme:r.theme,chatComposer:{value:i,onChange:l,onSend:cr,onFileChange:fr,onRemoveFile:en,onRecording:Bn,isRecording:s,hasAttachment:c,attachmentFiles:h,isDisabled:ht,placeholder:gn,recordingStatus:D,allowed:r.allowed},children:!q&&C.jsx(S.Suspense,{fallback:C.jsx(lQ,{}),children:C.jsxs("div",{className:EA("flex-1 flex flex-col min-h-0 overflow-hidden relative synapse-chat-window",r.theme?.backgroundImage?"":"bg-surface"),children:[C.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[C.jsxs(g0,{ref:m,className:"flex-1 min-h-0 [&>[data-radix-scroll-area-viewport]>div]:!flex [&>[data-radix-scroll-area-viewport]>div]:flex-col [&>[data-radix-scroll-area-viewport]>div]:min-h-full",children:[C.jsx("div",{className:"flex-1"}),C.jsxs("div",{className:EA("transition-all duration-300 min-w-0 overflow-x-hidden",me?"p-4 space-y-3":"p-4 space-y-4"),children:[qA&&C.jsx("div",{className:"text-xs text-[var(--color-muted-foreground)] text-center mb-2",children:"Just now"}),!qA&&C.jsx("div",{className:"text-xs text-[var(--color-muted-foreground)] text-center",children:new Date().toLocaleString("en-US",{weekday:"long",hour:"2-digit",minute:"2-digit",hour12:!0})}),C.jsx(nQ,{messages:K,onSendMessage:eA,iconUrl:r.iconUrl,onToggleFeedback:fA,onClearElicitationState:gA}),C.jsx("div",{ref:w})]})]}),C.jsx(S.Suspense,{fallback:null,children:C.jsx(rQ,{})})]}),E&&C.jsx("div",{className:"absolute bottom-[10px] left-1/2 transform -translate-x-1/2 z-10",children:C.jsx($A,{onClick:()=>OA("smooth"),size:"icon",className:"h-10 w-10 rounded-full bg-surface/90 backdrop-blur-sm shadow-lg border border-border-subtle hover:bg-surface hover:shadow-xl transition-all duration-200",children:C.jsx(ps,{className:"w-5 h-5 text-text-primary"})})}),C.jsx(iQ,{className:"mt-2",onRetry:b,showRetryButton:J,startNewConnection:$,clearError:x,error:H,isConnected:nt})]})})})}function lQ(){return C.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-surface backdrop-blur-2xl animate-pulse",children:[C.jsxs("div",{className:"flex-1 p-6 space-y-4",children:[C.jsx("div",{className:"h-16 bg-surface/80 rounded-2xl border border-border-subtle/50"}),C.jsx("div",{className:"h-16 bg-surface/80 rounded-2xl border border-border-subtle/50"}),C.jsx("div",{className:"h-16 bg-surface/80 rounded-2xl border border-border-subtle/50"})]}),C.jsx("div",{className:"h-24 border-t border-border-subtle bg-surface/80"})]})}function bc(A){if(A instanceof Error)return A;if(typeof A=="string")return new Error(A);try{return new Error(JSON.stringify(A))}catch{return new Error("Unknown error")}}class sQ extends S.Component{state={error:null};static getDerivedStateFromError(n){return{error:bc(n)}}componentDidCatch(n,r){this.setState({componentStack:r?.componentStack})}render(){return this.state.error?C.jsx(cQ,{error:this.state.error,componentStack:this.state.componentStack,title:this.props.title,titleImg:this.props.titleImg,iconUrl:this.props.iconUrl,onClose:this.props.onClose,showCloseButton:this.props.showCloseButton,environment:this.props.environment,displayMode:this.props.displayMode,theme:this.props.theme}):this.props.children}}function oQ({error:A}){throw A}function uQ(A){const[n,r]=S.useState(null);return S.useEffect(()=>{if(typeof window>"u")return;const i=s=>{!s?.error&&!s?.filename&&s?.message==="Script error."||(s?.error?r(bc(s.error)):s?.message&&r(new Error(s.message)))},l=s=>{r(bc(s.reason))};return window.addEventListener("error",i),window.addEventListener("unhandledrejection",l),()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",l)}},[]),C.jsx(sQ,{...A,children:n?C.jsx(oQ,{error:n}):A.children})}function cQ({error:A,title:n,titleImg:r,iconUrl:i,onClose:l,showCloseButton:s,environment:u,displayMode:c,theme:f}){const h=()=>{typeof window<"u"&&window.location.reload()},B=n??"Medi Clinic",p=u??"production",m=S.useMemo(()=>f?.textColor==="white"?"text-white/60":"text-[var(--color-muted-foreground)]",[f?.textColor]);return C.jsx(TB,{isOpen:!0,onClose:l??(()=>{}),showCloseButton:s??!1,onStartNewSession:h,title:B,titleImg:r,iconUrl:i,environment:p,displayMode:c,theme:f,children:C.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:C.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center p-6",children:C.jsxs("div",{className:"w-full max-w-[320px] text-center",children:[C.jsx("div",{className:"mx-auto mb-4 grid place-items-center",children:C.jsx("div",{className:"h-16 w-16 rounded-3xl bg-popover backdrop-blur border border-border-subtle grid place-items-center",children:C.jsx(s4,{className:"h-8 w-8",style:{color:f?.primary??"hsl(var(--primary))"}})})}),C.jsx("div",{className:"text-2xl font-semibold text-text-primary",children:"Uh-oh!"}),C.jsx("div",{className:["mt-2 text-sm",m].join(" "),children:"Something went wrong. Please try again."}),C.jsx("div",{className:["mt-4 rounded-2xl border border-border-subtle/60 bg-surface/60 backdrop-blur px-4 py-3","text-left text-[11px] leading-relaxed font-mono whitespace-pre-wrap break-words",m].join(" "),children:A?.message||String(A)}),C.jsx("div",{className:"mt-5 flex items-center justify-center gap-3",children:C.jsxs($A,{type:"button",onClick:h,className:"rounded-2xl",style:{backgroundColor:f?.primary??void 0},children:[C.jsx(i4,{className:"h-4 w-4 mr-2"}),"Retry"]})})]})})})})}function fQ({agentId:A,config:n}){const[r,i]=S.useState(!1);S.useEffect(()=>{i(!0)},[]);const l=()=>{i(!1),n?.onClose?.()};return C.jsx(uQ,{title:n.title??"Medi Clinic",titleImg:n.theme?.titleImg,iconUrl:n.iconUrl??"https://cdn.eka.care/bot-icon.svg",onClose:l,showCloseButton:n.showCloseButton,environment:n.environment??"production",displayMode:n.displayMode,theme:n.theme,children:C.jsx(aQ,{isOpen:r,agentId:A,config:{...n,environment:n.environment??"production",onClose:l,title:n.title??"Medi Clinic",iconUrl:n.iconUrl??"https://cdn.eka.care/bot-icon.svg",theme:n.theme}})})}const IB=(A,n,r)=>{const i=r||{},l=mv.createRoot(A);return l.render(C.jsx(S.StrictMode,{children:C.jsx(fQ,{agentId:n,config:i})})),l};typeof window<"u"&&(window.renderMedAssist=IB);const NB=S.forwardRef(({className:A,...n},r)=>C.jsx("textarea",{className:EA("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",A),ref:r,...n}));NB.displayName="Textarea";function _B({file:A,onRemove:n,isPreview:r=!0,className:i=""}){const[l,s]=S.useState(!1),[u,c]=S.useState(""),f=A?.type?.startsWith("image/")??!1,h=A?.type==="application/pdf";S.useEffect(()=>{if(f){const m=URL.createObjectURL(A);return c(m),()=>URL.revokeObjectURL(m)}},[A,f]),S.useEffect(()=>{s(!1)},[A]);const B=()=>f?"text-green-600":"text-text-secondary",p=m=>{if(m===0)return"0 B";const w=1024,E=["B","KB","MB","GB"],v=Math.floor(Math.log(m)/Math.log(w));return`${(m/Math.pow(w,v)).toFixed(1)} ${E[v]}`.toLowerCase()};return!f||l?C.jsxs("div",{className:`relative group inline-flex flex-shrink-0 bg-white border border-neutral-300 rounded-lg flex items-center gap-3 px-3 py-2.5 max-w-full ${r?"hover:bg-neutral-50":""} ${i}`,children:[C.jsx("div",{className:`flex-shrink-0 ${B()}`,children:C.jsx(A4,{className:"h-5 w-5"})}),C.jsxs("div",{className:"flex-1 min-w-0 max-w-[200px]",children:[A?.name&&C.jsx("div",{className:"text-sm font-medium text-[var(--color-foreground)] truncate",children:A.name}),A?.size&&C.jsx("div",{className:"text-xs text-[var(--color-muted-foreground)]",children:p(A.size)})]}),r&&n&&C.jsx("button",{onClick:n,"aria-label":`Remove ${A.name}`,className:"flex-shrink-0 flex items-center justify-center w-5 h-5 text-[var(--color-muted-foreground)] hover:text-[var(--color-foreground)] transition-colors",children:C.jsx(ms,{className:"h-4 w-4"})})]}):C.jsxs("div",{className:`relative group flex-shrink-0 ${i}`,children:[C.jsx("div",{className:`w-20 h-20 bg-white border border-neutral-300 rounded-lg flex items-center justify-center overflow-hidden ${r?"hover:bg-neutral-100 cursor-pointer":""}`,children:u&&C.jsx("img",{src:u,alt:A.name,className:"w-full h-full object-cover",onError:()=>s(!0)})}),r&&n&&C.jsx("button",{onClick:n,"aria-label":`Remove ${A.name}`,className:"absolute top-0 right-0 bg-[var(--color-muted)] text-black rounded-full w-5 h-5 flex items-center justify-center hover:bg-[var(--color-muted-foreground)] transition-colors z-10 transform translate-x-1 -translate-y-1",children:C.jsx(ms,{className:"h-3 w-3 text-black"})})]})}function LB({files:A,onRemoveFile:n,isPreview:r=!0,className:i=""}){if(A.length===0)return null;const l=A.filter(u=>u.type?.startsWith("image/")),s=A.filter(u=>!u.type?.startsWith("image/"));return C.jsxs("div",{className:`flex flex-wrap justify-end gap-2 max-w-full ${i}`,children:[s.map(u=>{const c=A.indexOf(u);return C.jsx(_B,{file:u,onRemove:n?()=>n(c):void 0,isPreview:r},`${u.name}-${u.size}-${c}`)}),l.length>0&&C.jsx("div",{className:"flex gap-2 overflow-x-auto max-w-full p-1 scrollbar-hide",children:l.map(u=>{const c=A.indexOf(u);return C.jsx(_B,{file:u,onRemove:n?()=>n(c):void 0,isPreview:r},`${u.name}-${u.size}-${c}`)})})]})}const Uc=({className:A})=>C.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:A,children:C.jsx("path",{d:"M1.46875 0.09375L16.3125 6.9375C16.75 7.125 17 7.53125 17 8C17 8.46875 16.75 8.875 16.3125 9.0625L1.46875 15.9062C1.3125 15.9688 1.1875 16 1.03125 16C0.46875 16 0 15.5312 0 14.9688C0 14.8125 0.03125 14.6875 0.09375 14.5625L2.34375 9.5C2.5 9.15625 2.8125 8.9375 3.15625 8.90625L8.0625 8.46875C8.3125 8.46875 8.5 8.25 8.5 8C8.5 7.75 8.3125 7.5625 8.0625 7.53125L3.15625 7.09375C2.8125 7.0625 2.5 6.84375 2.34375 6.5L0.09375 1.4375C0.03125 1.3125 0 1.1875 0 1.03125C0 0.46875 0.46875 0 1.03125 0C1.1875 0 1.3125 0.03125 1.46875 0.09375Z",fill:"currentColor"})}),RB=S.forwardRef(({className:A,type:n,...r},i)=>{const l=A&&typeof A=="string"&&A.includes("placeholder:");return C.jsx("input",{type:n,className:EA("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",!l&&"placeholder:text-muted-foreground",A),ref:i,...r})});RB.displayName="Input";const dQ=()=>C.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"},"aria-hidden":"true",children:[C.jsx("g",{clipPath:"url(#circleClip)",children:C.jsxs("g",{children:[C.jsx("path",{d:"M15.9766 0.0234375V5.31055H0.0234375V0.0234375H15.9766Z",fill:"#FF9933",stroke:"#1A1A1A","stroke-width":"0.046875"}),C.jsx("path",{d:"M15.9766 5.35779V10.642H0.0234375V5.35779H15.9766Z",fill:"white",stroke:"#1A1A1A","stroke-width":"0.046875"}),C.jsx("path",{d:"M0 10.6656H16V16H0V10.6656Z",fill:"#128807"}),C.jsx("path",{d:"M8.00101 10.1334C9.17921 10.1334 10.1343 9.17824 10.1343 8.00003C10.1343 6.82182 9.17921 5.8667 8.00101 5.8667C6.8228 5.8667 5.86768 6.82182 5.86768 8.00003C5.86768 9.17824 6.8228 10.1334 8.00101 10.1334Z",fill:"#000088"}),C.jsx("path",{d:"M8.00143 9.86663C9.03236 9.86663 9.8681 9.0309 9.8681 7.99997C9.8681 6.96904 9.03236 6.1333 8.00143 6.1333C6.9705 6.1333 6.13477 6.96904 6.13477 7.99997C6.13477 9.0309 6.9705 9.86663 8.00143 9.86663Z",fill:"white"}),C.jsx("path",{d:"M8.00126 8.37325C8.20745 8.37325 8.3746 8.20611 8.3746 7.99992C8.3746 7.79373 8.20745 7.62659 8.00126 7.62659C7.79508 7.62659 7.62793 7.79373 7.62793 7.99992C7.62793 8.20611 7.79508 8.37325 8.00126 8.37325Z",fill:"#000088"}),C.jsx("path",{d:"M9.84014 8.33936C9.8927 8.34628 9.94093 8.30928 9.94785 8.25671C9.95477 8.20415 9.91776 8.15593 9.8652 8.14901C9.81263 8.14208 9.76441 8.17909 9.75749 8.23165C9.75057 8.28422 9.78757 8.33244 9.84014 8.33936Z",fill:"#000088"}),C.jsx("path",{d:"M8.00199 9.86647L8.06599 8.74647L8.00199 8.21313L7.93799 8.74647L8.00199 9.86647Z",fill:"#000088"}),C.jsx("path",{d:"M9.69246 8.8036C9.74145 8.82389 9.7976 8.80063 9.81789 8.75165C9.83818 8.70266 9.81492 8.6465 9.76594 8.62622C9.71696 8.60593 9.6608 8.62919 9.64051 8.67817C9.62022 8.72715 9.64348 8.78331 9.69246 8.8036Z",fill:"#000088"}),C.jsx("path",{d:"M7.52209 9.80289L7.87379 8.73762L7.95 8.2059L7.75015 8.70449L7.52209 9.80289Z",fill:"#000088"}),C.jsx("path",{d:"M9.4251 9.21296C9.46716 9.24524 9.52743 9.2373 9.5597 9.19524C9.59198 9.15318 9.58405 9.09291 9.54198 9.06064C9.49992 9.02836 9.43966 9.0363 9.40738 9.07836C9.3751 9.12042 9.38304 9.18069 9.4251 9.21296Z",fill:"#000088"}),C.jsx("path",{d:"M7.06958 9.61654L7.68501 8.67859L7.89625 8.18471L7.57415 8.61459L7.06958 9.61654Z",fill:"#000088"}),C.jsx("path",{d:"M9.06041 9.53972C9.09269 9.58179 9.15295 9.58972 9.19502 9.55744C9.23708 9.52517 9.24501 9.4649 9.21274 9.42284C9.18046 9.38078 9.1202 9.37284 9.07814 9.40512C9.03607 9.4374 9.02814 9.49766 9.06041 9.53972Z",fill:"#000088"}),C.jsx("path",{d:"M6.68086 9.31981L7.51807 8.5731L7.84994 8.15072L7.42756 8.48259L6.68086 9.31981Z",fill:"#000088"}),C.jsx("path",{d:"M8.6284 9.76153C8.64869 9.81052 8.70484 9.83378 8.75383 9.81349C8.80281 9.7932 8.82607 9.73704 8.80578 9.68806C8.78549 9.63907 8.72933 9.61581 8.68035 9.6361C8.63137 9.65639 8.60811 9.71255 8.6284 9.76153Z",fill:"#000088"}),C.jsx("path",{d:"M6.38679 8.93324L7.38874 8.42867L7.81862 8.10657L7.32474 8.31781L6.38679 8.93324Z",fill:"#000088"}),C.jsx("path",{d:"M8.14737 9.86316C8.15429 9.91573 8.20251 9.95273 8.25508 9.94581C8.30764 9.93889 8.34465 9.89066 8.33773 9.8381C8.33081 9.78553 8.28258 9.74853 8.23002 9.75545C8.17745 9.76237 8.14045 9.81059 8.14737 9.86316Z",fill:"#000088"}),C.jsx("path",{d:"M6.19642 8.4829L7.29482 8.25484L7.79342 8.05498L7.2617 8.1312L6.19642 8.4829Z",fill:"#000088"}),C.jsx("path",{d:"M7.66381 9.83806C7.65689 9.89063 7.69389 9.93885 7.74646 9.94577C7.79903 9.95269 7.84725 9.91569 7.85417 9.86312C7.86109 9.81056 7.82409 9.76233 7.77152 9.75541C7.71895 9.74849 7.67073 9.7855 7.66381 9.83806Z",fill:"#000088"}),C.jsx("path",{d:"M6.13671 7.99991L7.25671 8.06391L7.79004 7.99991L7.25671 7.93591L6.13671 7.99991Z",fill:"#000088"}),C.jsx("path",{d:"M7.20092 9.68758C7.18063 9.73656 7.20389 9.79272 7.25287 9.81301C7.30185 9.8333 7.35801 9.81004 7.3783 9.76106C7.39859 9.71207 7.37533 9.65592 7.32635 9.63563C7.27736 9.61534 7.22121 9.6386 7.20092 9.68758Z",fill:"#000088"}),C.jsx("path",{d:"M6.20138 7.51684L7.26665 7.86854L7.79838 7.94475L7.29978 7.7449L6.20138 7.51684Z",fill:"#000088"}),C.jsx("path",{d:"M6.79363 9.42217C6.76135 9.46423 6.76929 9.5245 6.81135 9.55677C6.85341 9.58905 6.91368 9.58112 6.94595 9.53905C6.97823 9.49699 6.9703 9.43673 6.92823 9.40445C6.88617 9.37217 6.82591 9.38011 6.79363 9.42217Z",fill:"#000088"}),C.jsx("path",{d:"M6.39018 7.06677L7.32812 7.6822L7.822 7.89344L7.39212 7.57135L6.39018 7.06677Z",fill:"#000088"}),C.jsx("path",{d:"M6.46467 9.05968C6.42261 9.09196 6.41467 9.15222 6.44695 9.19428C6.47923 9.23635 6.53949 9.24428 6.58155 9.21201C6.62362 9.17973 6.63155 9.11947 6.59927 9.0774C6.567 9.03534 6.50673 9.02741 6.46467 9.05968Z",fill:"#000088"}),C.jsx("path",{d:"M6.68459 6.68013L7.43129 7.51734L7.85367 7.84921L7.5218 7.42683L6.68459 6.68013Z",fill:"#000088"}),C.jsx("path",{d:"M6.24115 8.6251C6.19217 8.64539 6.16891 8.70155 6.1892 8.75053C6.20949 8.79951 6.26564 8.82277 6.31463 8.80248C6.36361 8.7822 6.38687 8.72604 6.36658 8.67705C6.34629 8.62807 6.29014 8.60481 6.24115 8.6251Z",fill:"#000088"}),C.jsx("path",{d:"M7.06908 6.38338L7.57365 7.38532L7.89575 7.8152L7.68451 7.32132L7.06908 6.38338Z",fill:"#000088"}),C.jsx("path",{d:"M6.14294 8.14786C6.09038 8.15478 6.05338 8.203 6.0603 8.25557C6.06722 8.30813 6.11544 8.34513 6.168 8.33821C6.22057 8.33129 6.25757 8.28307 6.25065 8.2305C6.24373 8.17794 6.19551 8.14094 6.14294 8.14786Z",fill:"#000088"}),C.jsx("path",{d:"M7.52345 6.19703L7.75151 7.29543L7.95136 7.79403L7.87515 7.26231L7.52345 6.19703Z",fill:"#000088"}),C.jsx("path",{d:"M6.17061 7.66052C6.11804 7.6536 6.06982 7.6906 6.0629 7.74316C6.05598 7.79573 6.09298 7.84395 6.14554 7.85087C6.19811 7.85779 6.24633 7.82079 6.25325 7.76822C6.26017 7.71566 6.22317 7.66744 6.17061 7.66052Z",fill:"#000088"}),C.jsx("path",{d:"M8.00875 6.13341L7.94475 7.25341L8.00875 7.78674L8.07275 7.25341L8.00875 6.13341Z",fill:"#000088"}),C.jsx("path",{d:"M6.32316 7.19628C6.27418 7.17599 6.21802 7.19925 6.19773 7.24823C6.17744 7.29722 6.2007 7.35337 6.24969 7.37366C6.29867 7.39395 6.35483 7.37069 6.37512 7.32171C6.39541 7.27272 6.37215 7.21657 6.32316 7.19628Z",fill:"#000088"}),C.jsx("path",{d:"M8.49354 6.19699L8.14184 7.26226L8.06562 7.79398L8.26548 7.29539L8.49354 6.19699Z",fill:"#000088"}),C.jsx("path",{d:"M6.58174 6.78692C6.53967 6.75464 6.47941 6.76257 6.44713 6.80464C6.41486 6.8467 6.42279 6.90696 6.46485 6.93924C6.50692 6.97152 6.56718 6.96358 6.59946 6.92152C6.63173 6.87946 6.6238 6.81919 6.58174 6.78692Z",fill:"#000088"}),C.jsx("path",{d:"M8.93726 6.38334L8.32183 7.32129L8.11059 7.81517L8.43268 7.38529L8.93726 6.38334Z",fill:"#000088"}),C.jsx("path",{d:"M6.94642 6.46015C6.91415 6.41809 6.85388 6.41016 6.81182 6.44243C6.76976 6.47471 6.76182 6.53497 6.7941 6.57704C6.82637 6.6191 6.88664 6.62703 6.9287 6.59476C6.97076 6.56248 6.9787 6.50222 6.94642 6.46015Z",fill:"#000088"}),C.jsx("path",{d:"M9.32598 6.68007L8.48876 7.42678L8.15689 7.84915L8.57927 7.51729L9.32598 6.68007Z",fill:"#000088"}),C.jsx("path",{d:"M7.37649 6.23847C7.3562 6.18948 7.30004 6.16622 7.25106 6.18651C7.20207 6.2068 7.17881 6.26296 7.1991 6.31194C7.21939 6.36093 7.27555 6.38419 7.32453 6.3639C7.37352 6.34361 7.39678 6.28745 7.37649 6.23847Z",fill:"#000088"}),C.jsx("path",{d:"M9.61809 7.06676L8.61614 7.57133L8.18626 7.89343L8.68014 7.68219L9.61809 7.06676Z",fill:"#000088"}),C.jsx("path",{d:"M7.85751 6.13684C7.85059 6.08427 7.80237 6.04727 7.74981 6.05419C7.69724 6.06111 7.66024 6.10934 7.66716 6.1619C7.67408 6.21447 7.7223 6.25147 7.77487 6.24455C7.82743 6.23763 7.86443 6.18941 7.85751 6.13684Z",fill:"#000088"}),C.jsx("path",{d:"M9.80846 7.5171L8.71006 7.74516L8.21146 7.94502L8.74319 7.8688L9.80846 7.5171Z",fill:"#000088"}),C.jsx("path",{d:"M8.34302 6.16194C8.34994 6.10937 8.31294 6.06115 8.26038 6.05423C8.20781 6.04731 8.15959 6.08431 8.15267 6.13688C8.14575 6.18944 8.18275 6.23767 8.23532 6.24459C8.28788 6.25151 8.3361 6.2145 8.34302 6.16194Z",fill:"#000088"}),C.jsx("path",{d:"M9.87013 8.00009L8.75013 7.93609L8.2168 8.00009L8.75013 8.06409L9.87013 8.00009Z",fill:"#000088"}),C.jsx("path",{d:"M8.80592 6.31242C8.82621 6.26344 8.80295 6.20728 8.75396 6.18699C8.70498 6.1667 8.64882 6.18996 8.62853 6.23894C8.60824 6.28793 8.63151 6.34408 8.68049 6.36437C8.72947 6.38466 8.78563 6.3614 8.80592 6.31242Z",fill:"#000088"}),C.jsx("path",{d:"M9.80545 8.48316L8.74018 8.13146L8.20846 8.05525L8.70705 8.2551L9.80545 8.48316Z",fill:"#000088"}),C.jsx("path",{d:"M9.21614 6.57795C9.24841 6.53589 9.24048 6.47562 9.19842 6.44335C9.15635 6.41107 9.09609 6.41901 9.06381 6.46107C9.03154 6.50313 9.03947 6.5634 9.08153 6.59567C9.1236 6.62795 9.18386 6.62001 9.21614 6.57795Z",fill:"#000088"}),C.jsx("path",{d:"M9.61959 8.93335L8.68164 8.31792L8.18776 8.10668L8.61764 8.42878L9.61959 8.93335Z",fill:"#000088"}),C.jsx("path",{d:"M9.53875 6.94044C9.58081 6.90816 9.58874 6.8479 9.55647 6.80584C9.52419 6.76377 9.46393 6.75584 9.42186 6.78812C9.3798 6.82039 9.37187 6.88066 9.40414 6.92272C9.43642 6.96478 9.49668 6.97272 9.53875 6.94044Z",fill:"#000088"}),C.jsx("path",{d:"M9.31883 9.31999L8.57213 8.48278L8.14975 8.15091L8.48162 8.57329L9.31883 9.31999Z",fill:"#000088"}),C.jsx("path",{d:"M9.76715 7.37502C9.81613 7.35473 9.83939 7.29858 9.8191 7.24959C9.79881 7.20061 9.74266 7.17735 9.69367 7.19764C9.64469 7.21793 9.62143 7.27408 9.64172 7.32307C9.66201 7.37205 9.71816 7.39531 9.76715 7.37502Z",fill:"#000088"}),C.jsx("path",{d:"M8.93922 9.61662L8.43465 8.61468L8.11255 8.1848L8.3238 8.67868L8.93922 9.61662Z",fill:"#000088"}),C.jsx("path",{d:"M9.86682 7.85227C9.91939 7.84534 9.95639 7.79712 9.94947 7.74456C9.94255 7.69199 9.89433 7.65499 9.84176 7.66191C9.78919 7.66883 9.75219 7.71705 9.75911 7.76962C9.76603 7.82218 9.81426 7.85919 9.86682 7.85227Z",fill:"#000088"}),C.jsx("path",{d:"M8.48631 9.80309L8.25826 8.70469L8.0584 8.20609L8.13462 8.73782L8.48631 9.80309Z",fill:"#000088"})]})}),C.jsx("defs",{children:C.jsx("clipPath",{id:"circleClip",children:C.jsx("circle",{cx:"8",cy:"8",r:"8"})})})]}),hQ="+91";function gQ(A){const n=A.replace(/\D/g,""),r=n.slice(0,5),i=n.slice(5,10);return i?`${r} ${i}`:r}function BQ({value:A,onChange:n,onKeyDown:r,disabled:i,theme:l,isMobile:s,maxLength:u,isMobileValid:c,onSend:f}){return C.jsxs("div",{className:"px-2 pt-3 pb-2 space-y-2 w-full",children:[C.jsx("p",{className:"px-1 text-xs font-semibold tracking-wide text-foreground uppercase",children:"Enter your mobile number"}),C.jsxs("div",{className:"flex items-center gap-2 w-full",children:[C.jsxs("div",{className:EA("inline-flex items-center gap-2 rounded-full px-3 shrink-0 py-2 min-h-[56px]",i&&"opacity-60",l?.textColor==="white"?"bg-white-100":"bg-black-100"),style:{fontSize:s?"16px":"14px"},children:[C.jsx(dQ,{}),C.jsx("span",{className:"text-sm font-medium text-foreground",children:hQ}),C.jsx(ps,{className:"h-4 w-4 text-muted-foreground","aria-hidden":!0})]}),C.jsxs("div",{className:EA("flex items-center gap-1 rounded-full px-2 py-2 flex-1 min-w-0",i&&"opacity-60",l?.textColor==="white"?"bg-white-100":"bg-black-100"),children:[C.jsx(RB,{type:"tel",autoComplete:"tel-national",value:gQ(A),onChange:n,onKeyDown:r,placeholder:"88888 88888",className:EA("w-full h-full shadow-none border-0 outline-none focus-visible:ring-0 focus-visible:ring-offset-0","text-sm placeholder:text-muted-foreground bg-transparent","disabled:cursor-not-allowed rounded-none break-words overflow-wrap-anywhere whitespace-pre-wrap","text-foreground px-3 py-2 pr-11 min-h-[40px]"),style:{fontSize:s?"16px":"14px"},maxLength:u?u+1:void 0,inputMode:"numeric",autoFocus:!i,disabled:i}),C.jsx($A,{type:"button",size:"icon",onClick:f,disabled:i||!c,variant:"ghost",className:`h-10 w-10 ${c?"bg-primary":"bg-none"} hover:bg-primary/90 rounded-full transition-all duration-200 shadow-lg hover:shadow-xl hover:scale-105 active:scale-95 shrink-0 disabled:opacity-50 disabled:pointer-events-none disabled:hover:scale-100`,title:c?"Submit mobile number":"Enter a valid mobile number","aria-label":c?"Submit mobile number":"Enter a valid mobile number",children:C.jsx(Uc,{className:`w-4 h-4 ${c?"text-primary-foreground":"text-primary"}`})})]})]})]})}const pQ=6,mQ=30,CQ=(A,n)=>A.disabled===n.disabled&&A.isMobile===n.isMobile&&A.validation?.pattern===n.validation?.pattern&&A.validation?.minLength===n.validation?.minLength&&A.validation?.maxLength===n.validation?.maxLength&&A.serverMessage===n.serverMessage&&A.theme?.textColor===n.theme?.textColor;function wQ({disabled:A,isMobile:n,validation:r,onSubmit:i,onResendOtp:l,serverMessage:s}){const u=S.useRef([]),[c,f]=S.useState(0),[h,B]=S.useState(!1),p=S.useRef(!1),m=S.useRef(i),w=S.useRef(l),E=r?.maxLength??pQ,v=S.useMemo(()=>new RegExp(r?.pattern??`^\\d{${E}}$`),[r?.pattern,E]);S.useEffect(()=>{m.current=i},[i]),S.useEffect(()=>{w.current=l},[l]),S.useEffect(()=>{if(!s)return;const j=s.toLowerCase();j.includes("otp")&&(j.includes("invalid")||j.includes("incorrect")||j.includes("wrong"))&&(p.current=!1,B(!1))},[s]);const F=S.useCallback(()=>u.current.map(j=>j?.value.replace(/\D/g,"").slice(-1)??""),[]),U=S.useCallback(()=>{const j=F().join(""),AA=j.length===E&&v.test(j);p.current!==AA&&(p.current=AA,B(AA))},[E,v,F]),N=S.useCallback(j=>{j<E-1&&u.current[j+1]?.focus()},[E]),k=S.useCallback(j=>{j>0&&u.current[j-1]?.focus()},[]),$=S.useMemo(()=>Array.from({length:E},(j,AA)=>AA),[E]),J=S.useCallback(j=>{for(let nA=0;nA<E;nA++){const rA=u.current[nA];rA&&(rA.value=j[nA]??"")}U();const AA=Math.min(j.length,E-1);u.current[AA]?.focus()},[U,E]),x=S.useCallback((j,AA)=>{const nA=AA.target.value.replace(/\D/g,"");if(nA.length>1){J(nA.slice(0,E));return}const rA=nA.slice(-1);AA.target.value=rA,U(),rA&&N(j)},[U,J,N,E]),H=S.useCallback((j,AA)=>{if(AA.key==="Backspace"&&!u.current[j]?.value){k(j);return}if(AA.key==="Enter"&&!AA.shiftKey&&!A){AA.preventDefault();const nA=F().join("");if(nA.length===E&&v.test(nA))m.current(nA);else{const K=F().findIndex(q=>!q);u.current[K===-1?0:K]?.focus()}}},[A,k,E,v,F]),L=S.useCallback(j=>{j.preventDefault();const AA=j.clipboardData.getData("text").replace(/\D/g,"").slice(0,E);AA&&J(AA)},[J,E]),D=S.useCallback(()=>{if(A)return;const j=F().join("");j.length===E&&v.test(j)&&m.current(j)},[A,E,v,F]),Y=S.useCallback(()=>{if(!(c>0||A)){for(const j of u.current)j&&(j.value="");p.current=!1,B(!1),u.current[0]?.focus(),w.current?.(),f(mQ)}},[A,c]);S.useEffect(()=>{A||u.current[0]?.focus()},[A]),S.useEffect(()=>{if(h){c>0&&f(0);return}if(c<=0)return;const j=setTimeout(()=>f(AA=>AA-1),1e3);return()=>clearTimeout(j)},[h,c]);const R=S.useMemo(()=>$.map(j=>C.jsx("input",{ref:AA=>{u.current[j]=AA},type:"text",inputMode:"numeric",maxLength:n&&j===0?E:1,onChange:AA=>x(j,AA),onKeyDown:AA=>H(j,AA),onPaste:L,disabled:A,tabIndex:0,style:{fontSize:n?"16px":"14px"},className:EA("h-10 w-10 rounded-full border text-center text-lg font-semibold bg-transparent text-foreground","border-border shadow-sm outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 focus-visible:border-transparent","disabled:cursor-not-allowed disabled:opacity-50"),autoComplete:j===0?"one-time-code":"off","aria-label":`Digit ${j+1}`},j)),[A,$,x,H,L,n,E]);return C.jsx("div",{className:"px-4 pt-3 pb-2 space-y-3",children:C.jsxs("div",{className:"flex flex-col gap-3",children:[C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsx("p",{className:"text-xs font-semibold tracking-wide text-foreground uppercase",children:"Please enter the OTP"}),!h&&C.jsxs("button",{type:"button",onClick:Y,disabled:A||c>0,className:EA("text-xs font-medium underline underline-offset-2","text-primary hover:opacity-90 disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed"),children:["Resend OTP",c>0?` (00:${String(c).padStart(2,"0")}s)`:""]})]}),C.jsxs("div",{className:"flex items-center w-full gap-2 justify-between",children:[C.jsx("div",{className:"flex items-center gap-2",children:R}),C.jsx($A,{type:"button",size:"icon",onClick:D,disabled:A,variant:"ghost",className:`h-10 w-10 ${h?"bg-primary":"bg-none"} hover:bg-primary/90 rounded-full transition-all duration-200 shadow-lg hover:shadow-xl hover:scale-105 active:scale-95 shrink-0 disabled:opacity-50 disabled:pointer-events-none disabled:hover:scale-100`,title:h?"Submit OTP":"Enter the full OTP to submit","aria-label":h?"Submit OTP":"Enter the full OTP to submit",children:C.jsx(Uc,{className:`w-4 h-4 ${h?"text-primary-foreground":"text-primary"}`})})]})]})})}const yQ=S.memo(wQ,CQ),OB=10,EQ=10,vQ=/^[6-9][0-9]{9}$/;function QQ({component:A,value:n,onChange:r,isDisabled:i,validation:l,theme:s,isMobile:u,placeholder:c,onSend:f,onResendOtp:h,serverMessage:B}){const p=A===wA.SYNAPSE_COMPONENTS.MOBILE,m=A===wA.SYNAPSE_COMPONENTS.OTP;if(!p&&!m)return null;const w=U=>{const N=U.target.value.replace(/\D/g,""),k=l?.maxLength??OB;r(N.slice(0,k))},E=n.length===(l?.minLength??EQ)&&(l?.pattern?new RegExp(l.pattern).test(n):vQ.test(n)),v=()=>{!E||i||f()},F=U=>{U.key==="Enter"&&(U.preventDefault(),v())};return C.jsxs(C.Fragment,{children:[p&&C.jsx(BQ,{value:n,onChange:w,onSend:v,onKeyDown:F,placeholder:c??"Enter your mobile number",disabled:i,isMobileValid:E,theme:s,isMobile:u,maxLength:l?.maxLength??OB}),m&&C.jsx(yQ,{disabled:i,isMobile:u,validation:{pattern:l?.pattern,minLength:l?.minLength,maxLength:l?.maxLength},onSubmit:U=>{f({message:U})},onResendOtp:h,serverMessage:B,theme:s})]})}function bQ({value:A,onChange:n,onSend:r,onFileChange:i,onRemoveFile:l,onRecording:s,isRecording:u,hasAttachment:c,attachmentFiles:f,isDisabled:h,placeholder:B,isMobile:p,recordingStatus:m,theme:w,allowed:E,showStartNewChatButton:v,onStartNewChat:F}){const U=S.useRef(null),N=S.useRef(null),k=Ge(sA=>sA.elicitationState),$=k.component===wA.SYNAPSE_COMPONENTS.MOBILE,J=k.component===wA.SYNAPSE_COMPONENTS.OTP,x=k.disp_toast_msg?.trim()??"",H=A.trim().length>0||c,L=E===void 0||E.includes("audio"),D=H||!L,Y=H,R=E===void 0||E.includes("file"),j=(h||m!==de.IDLE)&&!u,AA=EA("rounded-full transition-all duration-200 ",u?"bg-gradient-to-r from-rose-400 via-primary to-indigo-500 text-white ring-2 ring-white/60 animate-pulse shadow-[0_0_20px_rgba(139,92,246,0.45)]":j?"text-primary/50 cursor-not-allowed shadow-none":"text-foreground hover:bg-secondary"),nA=sA=>{const T=Array.from(sA.target.files||[]);T.length>0&&i(T)},rA=()=>{h||U.current?.click()},K=sA=>{sA.key==="Enter"&&!sA.shiftKey&&Y&&!h&&(sA.preventDefault(),r({tool_declined:!0}))},q=sA=>{sA.style.height="auto",sA.style.overflow="hidden";const T=sA.scrollHeight,I=40,X=120,b=Math.max(I,Math.min(T,X));sA.style.height=b+"px",T>X?sA.style.overflow="auto":sA.style.overflow="hidden"},eA=sA=>{q(sA.currentTarget)};return S.useEffect(()=>{N.current&&q(N.current)},[A]),S.useEffect(()=>{!h&&!p&&N.current?.focus()},[h]),v&&F?C.jsx("div",{className:"px-4 py-2 flex justify-unset",children:C.jsxs("button",{type:"button",onClick:F,className:"px-6 py-3 bg-primary text-primary-foreground text-sm font-semibold rounded-lg hover:bg-primary/90 transition-colors flex items-center justify-center gap-2 disabled:opacity-60 disabled:pointer-events-none w-full",children:[C.jsx("span",{children:"Start new chat"}),C.jsx(b0,{className:"w-5 h-5","aria-hidden":!0})]})}):C.jsx(C.Fragment,{children:$||J?C.jsx(QQ,{component:k.component,value:A,onChange:n,isDisabled:h,placeholder:k.description,validation:{pattern:k.pattern,minLength:k.minLength,maxLength:k.maxLength,type:k.type},theme:w,isMobile:p,onSend:r,onResendOtp:()=>r({resend:!0}),serverMessage:J?x:""}):C.jsxs("div",{className:"px-2 py-2",children:[c&&f.length>0&&C.jsx("div",{className:"mb-2 pb-2 border-b border-border-subtle",children:C.jsx(LB,{files:f,onRemoveFile:l,isPreview:!0})}),C.jsx("input",{ref:U,type:"file",multiple:!0,max:3,accept:"image/jpeg, image/png, image/jpg, application/pdf",className:"hidden",onChange:nA,disabled:h,title:"Attach file","aria-label":"Attach file"}),C.jsxs("div",{className:"flex items-center gap-2 w-full",children:[R&&m===de.IDLE&&C.jsx($A,{type:"button",variant:"ghost",size:"icon",onClick:rA,disabled:h,className:EA("rounded-full transition-all shrink-0",c?"bg-primary text-foreground hover:bg-primary/15":"hover:bg-secondary text-foreground"),title:"Attach file","aria-label":"Attach file",children:C.jsx(t4,{className:"w-5 h-5"})}),C.jsx("div",{className:EA("flex items-center gap-1 rounded-full px-2 py-2 flex-1 min-w-0",h&&"opacity-60",w?.textColor==="white"?"bg-white-100":"bg-black-100"),children:C.jsxs("div",{className:"flex-1 relative min-w-0",children:[C.jsx(NB,{ref:N,onInput:eA,placeholder:B,value:A,onChange:sA=>n(sA.target.value),rows:1,maxLength:1e3,autoFocus:!h&&!p,style:{wordBreak:"break-word",overflowWrap:"anywhere",minHeight:"40px",maxHeight:"120px",fontSize:p?"16px":"14px",lineHeight:"1.5"},onKeyPress:K,disabled:h,title:"Enter your message","aria-label":"Enter your message",className:"w-full shadow-none border-0 outline-none focus-visible:ring-0 focus-visible:ring-offset-0 text-sm placeholder:text-muted-foreground bg-transparent disabled:cursor-not-allowed rounded-none break-words overflow-wrap-anywhere whitespace-pre-wrap text-foreground resize-none pr-11"}),u?C.jsx($A,{type:"button",variant:"ghost",size:"icon",onClick:s,className:"absolute right-0.5 top-1/2 -translate-y-1/2 rounded-full bg-gradient-to-r from-red-400 to-rose-500 text-white hover:from-red-500 hover:to-rose-600 shadow-lg transition-all duration-200 hover:scale-105 active:scale-95 shrink-0",title:"Stop recording","aria-label":"Stop recording",children:C.jsx(a4,{className:"w-4 h-4"})}):L&&!D&&C.jsx($A,{type:"button",variant:"ghost",size:"icon",onClick:s,disabled:j,className:EA("absolute right-0.5 top-1/2 -translate-y-1/2 shrink-0",AA),title:"Start recording","aria-label":"Start recording",children:C.jsx(r4,{className:"w-5 h-5"})},u?"recording":"idle"),D&&C.jsx($A,{type:"button",size:"icon",onClick:()=>r({tool_declined:!0}),disabled:h||!Y,variant:"ghost",className:`absolute right-0.5 top-1/2 -translate-y-1/2 h-10 w-10 ${Y?"bg-primary":"bg-none"} hover:bg-primary/90 rounded-full transition-all duration-200 shadow-lg hover:shadow-xl hover:scale-105 active:scale-95 shrink-0 disabled:opacity-50 disabled:pointer-events-none disabled:hover:scale-100`,title:Y?"Send message":"Type a message to send","aria-label":Y?"Send message":"Type a message to send",children:C.jsx(Uc,{className:`w-4 h-4 ${Y?"text-primary-foreground":"text-primary"}`})})]})})]})]})})}const UQ=Object.freeze(Object.defineProperty({__proto__:null,default:bQ},Symbol.toStringTag,{value:"Module"}));function SQ(A,n){const r={};return(A[A.length-1]===""?[...A,""]:A).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const xQ=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FQ=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TQ={};function MB(A,n){return(TQ.jsx?FQ:xQ).test(A)}const HQ=/[ \t\n\f\r]/g;function IQ(A){return typeof A=="object"?A.type==="text"?DB(A.value):!1:DB(A)}function DB(A){return A.replace(HQ,"")===""}class ka{constructor(n,r,i){this.normal=r,this.property=n,i&&(this.space=i)}}ka.prototype.normal={},ka.prototype.property={},ka.prototype.space=void 0;function kB(A,n){const r={},i={};for(const l of A)Object.assign(r,l.property),Object.assign(i,l.normal);return new ka(r,i,n)}function Sc(A){return A.toLowerCase()}class ut{constructor(n,r){this.attribute=r,this.property=n}}ut.prototype.attribute="",ut.prototype.booleanish=!1,ut.prototype.boolean=!1,ut.prototype.commaOrSpaceSeparated=!1,ut.prototype.commaSeparated=!1,ut.prototype.defined=!1,ut.prototype.mustUseProperty=!1,ut.prototype.number=!1,ut.prototype.overloadedBoolean=!1,ut.prototype.property="",ut.prototype.spaceSeparated=!1,ut.prototype.space=void 0;let NQ=0;const HA=zr(),Se=zr(),xc=zr(),oA=zr(),le=zr(),Ci=zr(),vt=zr();function zr(){return 2**++NQ}const Fc=Object.freeze(Object.defineProperty({__proto__:null,boolean:HA,booleanish:Se,commaOrSpaceSeparated:vt,commaSeparated:Ci,number:oA,overloadedBoolean:xc,spaceSeparated:le},Symbol.toStringTag,{value:"Module"})),Tc=Object.keys(Fc);class Hc extends ut{constructor(n,r,i,l){let s=-1;if(super(n,r),KB(this,"space",l),typeof i=="number")for(;++s<Tc.length;){const u=Tc[s];KB(this,Tc[s],(i&Fc[u])===Fc[u])}}}Hc.prototype.defined=!0;function KB(A,n,r){r&&(A[n]=r)}function wi(A){const n={},r={};for(const[i,l]of Object.entries(A.properties)){const s=new Hc(i,A.transform(A.attributes||{},i),l,A.space);A.mustUseProperty&&A.mustUseProperty.includes(i)&&(s.mustUseProperty=!0),n[i]=s,r[Sc(i)]=i,r[Sc(s.attribute)]=i}return new ka(n,r,A.space)}const jB=wi({properties:{ariaActiveDescendant:null,ariaAtomic:Se,ariaAutoComplete:null,ariaBusy:Se,ariaChecked:Se,ariaColCount:oA,ariaColIndex:oA,ariaColSpan:oA,ariaControls:le,ariaCurrent:null,ariaDescribedBy:le,ariaDetails:null,ariaDisabled:Se,ariaDropEffect:le,ariaErrorMessage:null,ariaExpanded:Se,ariaFlowTo:le,ariaGrabbed:Se,ariaHasPopup:null,ariaHidden:Se,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:le,ariaLevel:oA,ariaLive:null,ariaModal:Se,ariaMultiLine:Se,ariaMultiSelectable:Se,ariaOrientation:null,ariaOwns:le,ariaPlaceholder:null,ariaPosInSet:oA,ariaPressed:Se,ariaReadOnly:Se,ariaRelevant:null,ariaRequired:Se,ariaRoleDescription:le,ariaRowCount:oA,ariaRowIndex:oA,ariaRowSpan:oA,ariaSelected:Se,ariaSetSize:oA,ariaSort:null,ariaValueMax:oA,ariaValueMin:oA,ariaValueNow:oA,ariaValueText:null,role:null},transform(A,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function zB(A,n){return n in A?A[n]:n}function VB(A,n){return zB(A,n.toLowerCase())}const _Q=wi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ci,acceptCharset:le,accessKey:le,action:null,allow:null,allowFullScreen:HA,allowPaymentRequest:HA,allowUserMedia:HA,alt:null,as:null,async:HA,autoCapitalize:null,autoComplete:le,autoFocus:HA,autoPlay:HA,blocking:le,capture:null,charSet:null,checked:HA,cite:null,className:le,cols:oA,colSpan:null,content:null,contentEditable:Se,controls:HA,controlsList:le,coords:oA|Ci,crossOrigin:null,data:null,dateTime:null,decoding:null,default:HA,defer:HA,dir:null,dirName:null,disabled:HA,download:xc,draggable:Se,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:HA,formTarget:null,headers:le,height:oA,hidden:xc,high:oA,href:null,hrefLang:null,htmlFor:le,httpEquiv:le,id:null,imageSizes:null,imageSrcSet:null,inert:HA,inputMode:null,integrity:null,is:null,isMap:HA,itemId:null,itemProp:le,itemRef:le,itemScope:HA,itemType:le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:HA,low:oA,manifest:null,max:null,maxLength:oA,media:null,method:null,min:null,minLength:oA,multiple:HA,muted:HA,name:null,nonce:null,noModule:HA,noValidate:HA,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:HA,optimum:oA,pattern:null,ping:le,placeholder:null,playsInline:HA,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:HA,referrerPolicy:null,rel:le,required:HA,reversed:HA,rows:oA,rowSpan:oA,sandbox:le,scope:null,scoped:HA,seamless:HA,selected:HA,shadowRootClonable:HA,shadowRootDelegatesFocus:HA,shadowRootMode:null,shape:null,size:oA,sizes:null,slot:null,span:oA,spellCheck:Se,src:null,srcDoc:null,srcLang:null,srcSet:null,start:oA,step:null,style:null,tabIndex:oA,target:null,title:null,translate:null,type:null,typeMustMatch:HA,useMap:null,value:Se,width:oA,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:le,axis:null,background:null,bgColor:null,border:oA,borderColor:null,bottomMargin:oA,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:HA,declare:HA,event:null,face:null,frame:null,frameBorder:null,hSpace:oA,leftMargin:oA,link:null,longDesc:null,lowSrc:null,marginHeight:oA,marginWidth:oA,noResize:HA,noHref:HA,noShade:HA,noWrap:HA,object:null,profile:null,prompt:null,rev:null,rightMargin:oA,rules:null,scheme:null,scrolling:Se,standby:null,summary:null,text:null,topMargin:oA,valueType:null,version:null,vAlign:null,vLink:null,vSpace:oA,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:HA,disableRemotePlayback:HA,prefix:null,property:null,results:oA,security:null,unselectable:null},space:"html",transform:VB}),LQ=wi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vt,accentHeight:oA,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:oA,amplitude:oA,arabicForm:null,ascent:oA,attributeName:null,attributeType:null,azimuth:oA,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:oA,by:null,calcMode:null,capHeight:oA,className:le,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:oA,diffuseConstant:oA,direction:null,display:null,dur:null,divisor:oA,dominantBaseline:null,download:HA,dx:null,dy:null,edgeMode:null,editable:null,elevation:oA,enableBackground:null,end:null,event:null,exponent:oA,externalResourcesRequired:null,fill:null,fillOpacity:oA,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:Ci,g2:Ci,glyphName:Ci,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:oA,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:oA,horizOriginX:oA,horizOriginY:oA,id:null,ideographic:oA,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:oA,k:oA,k1:oA,k2:oA,k3:oA,k4:oA,kernelMatrix:vt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:oA,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:oA,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:oA,overlineThickness:oA,paintOrder:null,panose1:null,path:null,pathLength:oA,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:oA,pointsAtY:oA,pointsAtZ:oA,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vt,rev:vt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vt,requiredFeatures:vt,requiredFonts:vt,requiredFormats:vt,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:oA,specularExponent:oA,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:oA,strikethroughThickness:oA,string:null,stroke:null,strokeDashArray:vt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:oA,strokeOpacity:oA,strokeWidth:null,style:null,surfaceScale:oA,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vt,tabIndex:oA,tableValues:null,target:null,targetX:oA,targetY:oA,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:oA,underlineThickness:oA,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:oA,values:null,vAlphabetic:oA,vMathematical:oA,vectorEffect:null,vHanging:oA,vIdeographic:oA,version:null,vertAdvY:oA,vertOriginX:oA,vertOriginY:oA,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:oA,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:zB}),GB=wi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(A,n){return"xlink:"+n.slice(5).toLowerCase()}}),PB=wi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:VB}),YB=wi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(A,n){return"xml:"+n.slice(3).toLowerCase()}}),RQ={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"},OQ=/[A-Z]/g,XB=/-[a-z]/g,MQ=/^data[-\w.:]+$/i;function DQ(A,n){const r=Sc(n);let i=n,l=ut;if(r in A.normal)return A.property[A.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&MQ.test(n)){if(n.charAt(4)==="-"){const s=n.slice(5).replace(XB,KQ);i="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=n.slice(4);if(!XB.test(s)){let u=s.replace(OQ,kQ);u.charAt(0)!=="-"&&(u="-"+u),n="data"+u}}l=Hc}return new l(i,n)}function kQ(A){return"-"+A.toLowerCase()}function KQ(A){return A.charAt(1).toUpperCase()}const jQ=kB([jB,_Q,GB,PB,YB],"html"),Ic=kB([jB,LQ,GB,PB,YB],"svg");function zQ(A){return A.join(" ").trim()}var yi={},Nc,qB;function VQ(){if(qB)return Nc;qB=1;var A=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g,f=`
|
|
46
|
+
`}),C.jsxs(Dr,{className:EA(Y,"border-0"),"data-text-color":k.textColor,children:[k.backgroundImage&&C.jsx("div",{className:"absolute inset-0 -z-10",style:{backgroundImage:`url(${k.backgroundImage})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",transform:"scale(1.1)"}}),k.backgroundImage&&k.textColor==="black"&&C.jsx("div",{className:"absolute inset-0 -z-10",style:{backgroundColor:"rgba(0, 0, 0, 0.4)"}}),C.jsx("div",{className:EA("flex-shrink-0 sticky top-0 z-50 synapse-chat-widget-header",k.backgroundImage?"":"bg-popover"),style:{...!E&&{cursor:A?"grab":"default"}},children:C.jsx(K4,{onClose:n,showCloseButton:r,title:c,titleImg:f,iconUrl:i,startNewConversation:l})}),C.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col relative",children:u}),B&&C.jsxs("div",{className:EA("flex-shrink-0 sticky bottom-0 z-50 synapse-chat-widget-footer",k.backgroundImage?"":"bg-popover",s&&"synapse-chat-widget-footer--no-border"),children:[C.jsx(S.Suspense,{fallback:null,children:C.jsx(AQ,{value:B.value,onChange:B.onChange,onSend:J?x:B.onSend,onFileChange:B.onFileChange,onRemoveFile:B.onRemoveFile,onRecording:B.onRecording,isRecording:B.isRecording,hasAttachment:B.hasAttachment,attachmentFiles:B.attachmentFiles,isDisabled:B.isDisabled||J&&F,isMobile:E,placeholder:B.placeholder,recordingStatus:B.recordingStatus,theme:k,onStartNewChat:l,showStartNewChatButton:s,allowed:B.allowed})}),h&&p==="development"&&C.jsx("div",{className:"px-6 flex justify-center items-center",children:C.jsxs("p",{className:"text-[8px] text-text-secondary font-mono opacity-50",children:["Session ID: ",h]})}),C.jsxs("div",{className:"px-6 py-2 flex justify-center items-center gap-1.5 text-foreground opacity-90",children:[C.jsx("span",{className:"text-[10px] leading-[14px]",style:{fontFamily:"Inter, system-ui, -apple-system, sans-serif",fontWeight:400,fontStyle:"normal",letterSpacing:"0%"},children:"Powered by"}),C.jsx($4,{})]})]})]})]})}function HB(){const[A,n]=S.useState(typeof navigator<"u"?navigator.onLine:!0);return S.useEffect(()=>{const r=()=>n(!0),i=()=>n(!1);return window.addEventListener("online",r),window.addEventListener("offline",i),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i)}},[]),{isOnline:A}}const Qc=5,eQ=10*1024*1024,tQ=({environment:A,baseUrl:n,context:r,auth:i})=>{const[l,s]=S.useState([]),u=S.useRef([]),[c,f]=S.useState(!1),h=S.useRef(0),[B,p]=S.useState(!1),[m,w]=S.useState([]),E=S.useRef(null),v=S.useRef(null),{isOnline:F}=HB(),U=S.useRef(!1),{agentId:N,setSessionId:k,setSessionToken:$,sessionId:J,sessionToken:x,setError:H,setConnectionStatus:L,setShowRetryButton:D,setStartNewConnection:Y,setIsStreaming:R,setIsWaitingForResponse:j,isStreaming:AA,initialMessage:nA,isWaitingForResponse:rA,setProgressMessage:K,setRecordingStatus:q,clearSession:eA,addMessageToSession:sA,getMessagesForSession:T,updateMessageInSession:I,setInitialMessage:X,userId:b,setUserId:lA,fileUploadPerSession:fA,setFileUploadPerSession:gA,setElicitationState:hA,elicitationState:OA}=Ge();S.useEffect(()=>{F?B?qA()&&(L(Ve.CONNECTED),ht()):L(Ve.CONNECTING):L(Ve.NOT_CONNECTED)},[F,B]),S.useEffect(()=>{if(J){const cA=T(J)||[];cA.length<=0&&nA?.text?s([{id:Date.now().toString(),content:nA.text,role:ot.ASSISTANT,timestamp:Mr(Date.now()),isStored:!1,...nA.suggestions?.length&&{toolEscalationData:{tool_id:nA.suggestions[0].value??null,tool_name:"elicitation",details:{component:wA.SYNAPSE_COMPONENTS.PILL,input:{options:nA.suggestions.map(O=>({id:O.value||"",label:O.label||"",value:O.value||""}))}},isResponded:!1}}}]):s(cA),w([])}},[J,nA]),S.useEffect(()=>{if(p(!1),!N)return;const cA=new wA.SynapseSDK({agentId:N,environment:A,userId:b,callbacks:{onError:O=>{if(O instanceof wA.SynapseError)switch(O.code){case wA.SynapseErrorCode.SESSION:const W=O.context;W?.stage==="handleSessionExpiry"||W?.stage==="refreshSession"?F?(H({title:"Something went wrong!",description:"Please try again."}),D(!0)):(H({title:"Your session has ended.",description:"Please start a new Chat."}),D(!0)):(L(Ve.NOT_CONNECTED),H({title:"Something went wrong!",description:"Please try again."}),D(!0));break;case wA.SynapseErrorCode.RECORDING:H({title:"Recording failed",description:O?.displayMessage||"Please try again later"});break;case wA.SynapseErrorCode.CONNECTION:qA()||(L(Ve.NOT_CONNECTED),h.current<2?(h.current=h.current+1,FA(J,x)):(D(!0),H({title:"Trying to connect...",description:"Please wait while we try to connect"})));break;default:H({title:"Something went wrong",description:"Please try again later from onError callback"}),D(!0);break}},onSessionRefreshed:O=>{O?.session_id&&O?.session_token&&(k(O.session_id),$(O.session_token),FA(O.session_id,O.session_token))}},...n&&{serverUrl:n},...r&&{context:r},...i&&{auth:i}});return E.current=cA,p(!0),()=>{p(!1),E.current?.endSession(),E.current=null,v.current&&(clearTimeout(v.current),v.current=null)}},[N,A,i]),S.useEffect(()=>{u.current=l},[l]),S.useEffect(()=>{const cA=l[l.length-1];!cA?.role||!J||(cA?.role===ot.USER?sA(J,cA):!AA&&!cA.isStored&&(s(O=>{const W=[...O];return W[W.length-1]={...cA,isStored:!0},W}),sA(J,{...cA,isStored:!0})))},[l,AA]),S.useEffect(()=>{const cA=l[l.length-1];return()=>{cA&&!cA?.isStored&&J&&sA(J,{...cA,isStored:!0})}},[]),S.useEffect(()=>(v.current&&(clearTimeout(v.current),v.current=null),rA&&!AA?v.current=setTimeout(()=>{j(!1),v.current=null},3e4):AA&&v.current&&(clearTimeout(v.current),v.current=null),()=>{v.current&&(clearTimeout(v.current),v.current=null)}),[rA,AA,j]);const FA=async(cA,O,W=!1)=>{try{const uA=await E.current?.startSession({session_id:cA||"",session_token:O||""});uA?.session_id&&uA?.session_token&&(k(uA.session_id),$(uA.session_token)),(uA?.initial_message?.text||uA?.initial_message?.suggestions?.length)&&X(uA.initial_message),uA?.user_id&&lA(uA.user_id),Ut()}catch(uA){const vA=uA.context,bA=vA?.stage==="handleSessionExpiry"||vA?.stage==="refreshSession"||uA instanceof wA.APIError&&uA.status===404,ee=uA instanceof wA.APIError&&uA.status===403;bA?(H(null),L(Ve.NOT_CONNECTED),Y(!0)):ee&&!W?(eA(),ht(),await FA(void 0,void 0,!0)):(H({title:"Something went wrong!",description:"Please try again later."}),D(!0))}},me=async(cA=!1)=>{try{if(!E.current){H({title:"SDK not initialized",description:"Please ensure agentId is configured"}),f(!1);return}if(f(!0),cA){await eA(),await E?.current?.endSession(),ht(),await FA();return}const{sessionId:O,sessionToken:W}=Ge.getState();await FA(O,W)}catch{}finally{f(!1)}},qA=()=>E.current?.isConnected()??!1,nt=()=>{E.current?.endSession()},ht=()=>{h.current=0,D(!1),Y(!1),H(null)},Ut=()=>{E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.MESSAGE_CHUNK,cA=>{const O=cA;if(O.data?.text&&O.messageId){AA||(j(!1),R(!0)),qA()&&L(Ve.CONNECTED);const W=O.data.text,uA=O.messageId,vA=U.current;U.current=!1,s(bA=>{const ee=bA[bA.length-1];if(ee&&ee.id===uA&&ee.role===ot.ASSISTANT){const te=[...bA],PA=vA&&ee.content.length>0&&!/\s$/.test(ee.content)&&!/^\s/.test(W)?" ":"";return te[te.length-1]={...ee,content:ee.content+PA+W},te}else return[...bA,{id:uA,content:W,role:ot.ASSISTANT,timestamp:Mr(Date.now()),isStored:!1}]})}}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.END_OF_STREAM,()=>{U.current=!1,R(!1),K(null),j(!1)}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.CONNECTED,()=>{ht(),L(Ve.CONNECTED)}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.TOOL_CALL,cA=>{U.current=!0;const O=cA;if(!O?.messageId||!O?.data||!O?.data?.details?.component||!O?.data?.tool_id)return;rA&&j(!1);const W=O.messageId,uA=O.timestamp??Date.now();switch(O?.data?.details?.status){case wA.SYNAPSE_EICITATION_STATUS.PROGRESS:{const te=O?.data?.details?._meta?.schema?.required||[],PA=O?.data?.details?.input||{},JA=te.reduce((Oe,tn)=>(PA[tn]!==void 0&&(Oe[tn]=PA[tn]),Oe),{}),Be={...Ge.getState().elicitationState.input||{},...JA},KA=te.find(Oe=>!Be[Oe]),rt=O.data.details?._meta?.mcp_meta_fields||[];hA({active:!0,input:Be,required:te,component:O.data.details?.component,toolId:O.data.tool_id??void 0,toolSelectionName:KA,messageId:W,pattern:O.data.details?._meta?.schema?.properties?.[O.data.details?.component]?.pattern,minLength:O.data.details?._meta?.schema?.properties?.[O.data.details?.component]?.minLength,maxLength:O.data.details?._meta?.schema?.properties?.[O.data.details?.component]?.maxLength,type:O.data.details?._meta?.schema?.properties?.[O.data.details?.component]?.type,disp_toast_msg:O.data.details?._meta?.disp_toast_msg,description:O.data.details?._meta?.schema?.properties?.[O.data.details?.component]?.description,...rt.length&&{mcp_meta_fields:rt}});break}case wA.SYNAPSE_EICITATION_STATUS.FAILURE:{hA({active:!1});break}case wA.SYNAPSE_EICITATION_STATUS.SUCCESS:{hA({active:!1,disp_toast_msg:O?.data?.details?._meta?.disp_toast_msg});break}}s(te=>{const PA=te[te.length-1];if(PA&&PA.id===W&&PA.role===ot.ASSISTANT){const JA=[...te],Be={...PA,content:PA.content,toolEscalationData:{...O.data,isResponded:!1},isResponseFromTool:!0};return JA[te.length-1]=Be,I(J,W,Be),JA}else{const JA={id:W,content:O.data?.details?.input?.text||"",role:ot.ASSISTANT,toolEscalationData:{...O.data,isResponded:!1},isResponseFromTool:!0,timestamp:Mr(uA),isStored:!1};return[...te,JA]}});const vA=O.data?.details?._meta,bA=vA?.disp_message,ee=vA?.tool_result;if(bA||Object.keys(ee||{}).length)try{lt({message:bA||"",tool_result:ee,tool_declined:!0})}catch{}}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.DISCONNECTED,cA=>{cA?.reason!==wA.DisconnectionReason.CLIENT_CLOSED&&(h.current<2?(L(Ve.NOT_CONNECTED),h.current=h.current+1,D(!0),H({title:"Something went wrong!",description:"Please try again."})):(L(Ve.NOT_CONNECTED),H({title:"Something went wrong!",description:"Please start a new Chat."}),Y(!0)))}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.ERROR,cA=>{switch(cA?.data?.code){case wA.SYNAPSE_REALTIME_ERROR_CODES.SESSION_INACTIVE:H({title:"Session not found",description:"Please start a new session"}),Y(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.SESSION_TOKEN_MISMATCH:H({title:"Session not found",description:"Please start a new chat from onError callback"}),Y(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.INVALID_EVENT:return;case wA.SYNAPSE_REALTIME_ERROR_CODES.INVALID_CONTENT_TYPE:return;case wA.SYNAPSE_REALTIME_ERROR_CODES.PARSING_ERROR:if(h.current<1){h.current++,GA();return}H({title:"Error parsing request",description:"please try again"}),D(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.TIMEOUT:H({title:"Request timed out",description:"please try again"}),D(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.PROMPT_FETCH_ERROR:H({title:"Something went wrong",description:"please try again"}),D(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.INVALID_FILE_REQUEST:H({title:"Something went wrong",description:"please try again"}),D(!0),q(de.IDLE);return;case wA.SYNAPSE_REALTIME_ERROR_CODES.SERVER_ERROR:H({title:"Something went wrong",description:"please try again"}),D(!0),q(de.IDLE);return;default:H({title:"Something went wrong",description:"please try again"}),D(!0),q(de.IDLE);return}}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.AUDIO_TRANSCRIPT,async cA=>{const O=cA;O?.data?.text&&(s(W=>[...W,{id:Date.now().toString(),content:O.data.text||"",role:ot.USER,timestamp:Mr(Date.now()),isStored:!0}]),q(de.IDLE)),R(!1),j(!1),K(null)}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.PROGRESS_MESSAGE,cA=>{U.current=!0;const O=cA;O.data?.text&&(j(!1),K(O.data.text))}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.TOOL_START,cA=>{U.current=!0;const O=cA;if(O.data?.name&&O.messageId){const W=O.messageId;s(uA=>{const vA=uA[uA.length-1];if(vA&&vA.id===W&&vA.role===ot.ASSISTANT){const bA=[...uA];return bA[bA.length-1]={...vA,toolCallStatus:`Calling tool: ${O.data.name}...`},J&&I(J,W,{toolCallStatus:`Calling tool: ${O.data.name}...`}),bA}return uA})}}),E.current?.on(wA.SYNAPSE_REALTIME_EVENTS.TOOL_END,cA=>{U.current=!0;const O=cA;if(O.data?.name&&O.messageId){const W=O.messageId;s(uA=>{const vA=uA[uA.length-1];if(vA&&vA.id===W&&vA.role===ot.ASSISTANT){const bA=[...uA];return bA[bA.length-1]={...vA,toolCallStatus:"Tool call completed."},J&&I(J,W,{toolCallStatus:"Tool call completed."}),bA}return uA})}})},lt=async({message:cA,messageId:O,files:W,audio:uA,toolCalled:vA,hidden:bA,selectedCard:ee,selectedComponent:te,resend:PA,tool_declined:JA,tool_result:Be})=>{if(!qA()){D(!0),H({title:"Please try again."});return}if(W&&W.length===0&&cA?.trim()===""&&!uA?.audio&&!te&&!OA.active&&!Be&&!Object.keys(Be||{}).length)return;if(W&&W.length>3){H({title:"Maximum 3 files are allowed to be sent at a time",description:"Please try again"});return}if(W&&W.length>0&&W.reduce((Me,Qe)=>Me+Qe.size,0)>10*1024*1024){H({title:"Total file size limit of 10MB exceeded",description:"Please reduce the size of the files or try again with less files"});return}if(W&&W.length>0&&W.length+fA>Qc){const Me=Qc-fA;H({title:`You can only upload up to ${Qc} files per session`,description:`${Me<=0?"Maximum file upload limit reached":`You have ${Me} file${Me===1?"":"s"} upload${Me===1?"":"s"} left`}`});return}else W&&W.length&&gA(fA+W.length);H(null),D(!1),qA()&&L(Ve.CONNECTED);const KA=l.length==2&&m.length==2?m:null;let rt=null;const Oe=l.length-1,tn=Oe>=0?l[Oe]:null,qr=tn?tn?.isResponseFromTool||tn.role===ot.ASSISTANT&&tn.toolEscalationData:null,Ce=Ge.getState().elicitationState;if(Ce?.active&&Ce?.toolId&&Ce?.messageId&&!JA){const Me=Ce.toolSelectionName??Ce.required?.find(Fe=>!Ce.input?.[Fe])??"",Qe=te?te[Me]:cA,it=Ce.mcp_meta_fields?.reduce((Fe,Ke)=>(Me===Ke?Fe[Ke]=Qe:Ce.input?.[Ke]&&(Fe[Ke]=Ce.input[Ke]),PA&&!Fe.is_resend&&(Fe.is_resend=PA),Fe),{}),Fn={...Object.keys(Ce.input||{})?.reduce((Fe,Ke)=>{const pn=!Object.keys(it||{})?.includes(Ke),So=!!Ce.input?.[Ke];return(PA?pn&&So:pn&&Ce.required?.includes(Ke)&&So)&&(Fe[Ke]=Ce.input?.[Ke]),Fe},{})||{},...!PA&&Me&&!Object.keys(it||{})?.includes(Me)?{[Me]:Qe}:{},...Object.keys(it||{}).length&&{mcp_meta_fields:it}};hA({...Ce,input:{...Ce.input||{},...Fn}});try{await en(Ce.toolId,Ce.messageId,Fn),rt=!0}catch{cA&&await E.current?.sendMessage({message:cA}),hA({active:!1})}}else await E.current?.sendMessage({message:cA,files:W,audio:uA,tool_result:Be,...KA&&{initial_prompts:KA},...JA||qr&&!vA?{tool_declined:!0,tool_id:tn?.toolEscalationData?.tool_id||""}:{}});(cA||W&&W.length>0)&&(s(Me=>{const Qe=[...Me],it=Qe.length-1,kt=Qe[it].toolEscalationData||null;if(qr&&it>=0&&kt&&Object.keys(kt).length>0){let Fn;const Fe=kt.details;if(Fe?.component===wA.SYNAPSE_COMPONENTS.CARD&&Fe?.input?.cards){const Ke=Fe.input.cards.find(pn=>pn.title===ee)||null;Ke&&(Fn={...kt,isResponded:!0,tool_id:null,details:{...Fe,input:{...Fe.input,cards:[Ke]}}})}Fn||(Fn={...kt,isResponded:!OA.active,tool_id:null}),Qe[it]={...Qe[it],toolEscalationData:Fn},I(J,Qe[it]?.id||Date.now().toString(),Qe[it])}return bA||rt?Qe:[...Qe,{id:O||Date.now().toString(),content:cA||"",files:W||[],role:ot.USER,timestamp:Mr(Date.now()),isStored:!0}]}),rt||j(!0),rt=null)},gn=cA=>cA.type.toLowerCase()&&!["application/pdf","image/jpeg","image/jpg","image/png"].includes(cA.type)?(H({title:`File type not supported: ${cA.name}`,description:"Only PDF, images (JPG, JPEG, PNG) are allowed."}),!1):cA.size>3*1024*1024?(H({title:"File size limit of 3MB exceeded",description:"Please reduce the size of the file or try again with a smaller file"}),!1):!0,cr=async()=>{if(!qA())throw new Error("Not connected to the server");try{await E.current?.startRecording({onChunks:async cA=>{q(de.PROCESSING),await lt({audio:cA}),q(de.TRANSCRIBING)},onError(cA){q(de.IDLE)}}),q(de.LISTENING)}catch(cA){throw q(de.IDLE),cA}},fr=()=>{qA()&&E.current?.endRecording()},en=async(cA,O,W)=>{try{if(!qA())throw new Error("Not connected to the server");await E.current?.callTool(cA,O,W)}catch(uA){throw uA}},Bn=async()=>{ht(),await eA(),await me(!0)},GA=async()=>{if(qA()){L(Ve.CONNECTED);const cA=u.current[u.current.length-1];cA&&cA.role===ot.USER&&E.current?.sendMessage({message:cA.content,files:cA.files||[],messageId:cA.id})}else if(L(Ve.NOT_CONNECTED),h.current<2){h.current++;const{sessionId:cA,sessionToken:O}=Ge.getState();await FA(cA,O)}else h.current===2?(h.current++,D(!0),H({title:"Trying to connect..."})):(H({title:"Something went wrong!",description:"Please start a new chat."}),Y(!0))};return{sendMessage:lt,startSession:me,incomingMessages:l,loading:c,endSession:nt,isReady:B,startRecording:cr,stopRecording:fr,handleRetry:GA,isValidFile:gn,handleStartNewConnection:Bn,callTool:en,handleInitialTaskClick:async cA=>{if(!nA?.suggestions?.length||!cA)return;const O=nA.suggestions.find(W=>W.value===cA);if(!O||!O.response){await lt({message:cA});return}s(W=>[...W,{id:Date.now().toString(),content:cA,role:ot.USER,timestamp:Mr(Date.now()),isStored:!0}]),j(!0),await N2(1e3),j(!1),s(W=>[...W,{id:Date.now().toString(),content:O.response||"Please try again",role:ot.ASSISTANT,timestamp:Mr(Date.now()),isStored:!1}]),w([{role:"user",text:cA},{role:"assistant",text:O.response}])},handleToggleFeedback:async(cA,O,W)=>{if(qA())try{await E.current?.sendFeedback(O,cA,W)}catch{}},clearElicitationState:async()=>{try{await lt({message:`User aborted elicitation :tool id ${OA.toolId}, message id ${OA.messageId}, ${OA.component}`,hidden:!0})}catch{}finally{hA({active:!1})}}}},nQ=S.lazy(()=>Promise.resolve().then(()=>c3)),rQ=S.lazy(()=>Promise.resolve().then(()=>h3)),iQ=S.lazy(()=>Promise.resolve().then(()=>B3).then(A=>({default:A.ConnectionStatus})));function aQ({isOpen:A,agentId:n,config:r}){const[i,l]=S.useState(""),[s,u]=S.useState(!1),[c,f]=S.useState(!1),[h,B]=S.useState([]),p=S.useRef(!1),m=S.useRef(null),w=S.useRef(null),[E,v]=S.useState(!1),F=S.useRef(null),U=S.useRef(!1),N=S.useRef("auto"),{setAgentId:k,startNewConnection:$,showRetryButton:J,clearError:x,error:H,connectionStatus:L,recordingStatus:D,isWaitingForResponse:Y,isStreaming:R,setError:j,sessionId:AA,agentId:nA,setContext:rA}=Ge(),{incomingMessages:K,loading:q,sendMessage:eA,startSession:sA,isReady:T,startRecording:I,stopRecording:X,handleRetry:b,isValidFile:lA,handleToggleFeedback:fA,clearElicitationState:gA}=tQ({environment:"production",baseUrl:r.environment==="development"&&r.baseUrl?r.baseUrl:void 0,context:r?.context,...r?.auth&&{auth:r.auth}});S.useEffect(()=>{n&&(D4(n),k4(n),k(n),r?.context&&Object.keys(r?.context||{}).length&&rA(r.context),A&&T&&!p.current&&(p.current=!0,sA(!1)))},[A,T,nA]);const hA=()=>m.current?.querySelector("[data-radix-scroll-area-viewport]")||null,OA=GA=>{const ge=hA();ge&&(ge.scrollTo({top:ge.scrollHeight,behavior:GA}),v(!1))},FA=GA=>{U.current=!0,N.current=GA,F.current===null&&(F.current=requestAnimationFrame(()=>{F.current=null,U.current&&(U.current=!1,OA(N.current))}))};S.useEffect(()=>()=>{F.current!==null&&(cancelAnimationFrame(F.current),F.current=null),U.current=!1},[]);const me=K.length>0,qA=K.length===1;S.useEffect(()=>{if(!K.length)return;FA(R||qA?"auto":"smooth")},[K,R,qA]);const nt=L===wA.ConnectionStatus.CONNECTED,ht=q||!nt||Y||R,Ut=q||!nt,lt=S.useMemo(()=>D===de.IDLE?null:D===de.LISTENING?"Listening...":D===de.PROCESSING?"Processing...":D===de.TRANSCRIBING?"Transcribing...":null,[D]),gn=Ut?"Connecting...":lt&&D!==de.IDLE?lt:Y||R?"Please wait for the response...":"Type a reply…",cr=async GA=>{if(ht)return;const ge=GA?.message??i;if(ge.trim()||s||c||GA?.resend){const gt=Date.now().toString();h.length>0?(await eA({files:h,message:ge.trim(),messageId:gt}),B([]),f(!1)):ge.trim()?await eA({message:ge.trim(),messageId:gt,resend:GA?.resend,tool_declined:GA?.tool_declined}):GA?.resend&&await eA({resend:GA?.resend}),l(""),u(!1),f(!1),setTimeout(()=>{FA("auto")},100)}},fr=GA=>{if(GA&&GA.length>0){const ge=GA.filter(gt=>!!lA(gt));if(ge?.length+h.length>3){j({title:"You can only upload up to 3 files at a time",description:"Please remove some files and try again."});return}if(ge?.length>0&&ge.reduce((gt,Re)=>gt+Re.size,0)>10*1024*1024){j({title:`Total file size limit of ${eQ} MB exceeded`,description:"Please reduce the size of the files or try again with less files"});return}if(ge?.length>0)GA=ge;else return}B(ge=>(f((ge?.length??0)+(GA?.length??0)>0),[...ge,...GA]))},en=GA=>{B(ge=>{const gt=ge.filter((Re,cA)=>cA!==GA);return f(gt.length>0),gt})},Bn=async()=>{if(s)await X(),u(!1);else{if(ht)return;try{await I(),u(!0)}catch{}}};return C.jsx(TB,{isOpen:A,onClose:r.onClose,showCloseButton:r.showCloseButton,title:r.title,showStartNewChatButton:$,titleImg:r.theme?.titleImg,iconUrl:r.iconUrl,onStartNewSession:()=>sA(!0),sessionId:AA,environment:r.environment,displayMode:r.displayMode??"widget",theme:r.theme,chatComposer:{value:i,onChange:l,onSend:cr,onFileChange:fr,onRemoveFile:en,onRecording:Bn,isRecording:s,hasAttachment:c,attachmentFiles:h,isDisabled:ht,placeholder:gn,recordingStatus:D,allowed:r.allowed},children:!q&&C.jsx(S.Suspense,{fallback:C.jsx(lQ,{}),children:C.jsxs("div",{className:EA("flex-1 flex flex-col min-h-0 overflow-hidden relative synapse-chat-window",r.theme?.backgroundImage?"":"bg-surface"),children:[C.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[C.jsxs(g0,{ref:m,className:"flex-1 min-h-0 [&>[data-radix-scroll-area-viewport]>div]:!flex [&>[data-radix-scroll-area-viewport]>div]:flex-col [&>[data-radix-scroll-area-viewport]>div]:min-h-full",children:[C.jsx("div",{className:"flex-1"}),C.jsxs("div",{className:EA("transition-all duration-300 min-w-0 overflow-x-hidden",me?"p-4 space-y-3":"p-4 space-y-4"),children:[qA&&C.jsx("div",{className:"text-xs text-[var(--color-muted-foreground)] text-center mb-2",children:"Just now"}),!qA&&C.jsx("div",{className:"text-xs text-[var(--color-muted-foreground)] text-center",children:new Date().toLocaleString("en-US",{weekday:"long",hour:"2-digit",minute:"2-digit",hour12:!0})}),C.jsx(nQ,{messages:K,onSendMessage:eA,iconUrl:r.iconUrl,onToggleFeedback:fA,onClearElicitationState:gA}),C.jsx("div",{ref:w})]})]}),C.jsx(S.Suspense,{fallback:null,children:C.jsx(rQ,{})})]}),E&&C.jsx("div",{className:"absolute bottom-[10px] left-1/2 transform -translate-x-1/2 z-10",children:C.jsx($A,{onClick:()=>OA("smooth"),size:"icon",className:"h-10 w-10 rounded-full bg-surface/90 backdrop-blur-sm shadow-lg border border-border-subtle hover:bg-surface hover:shadow-xl transition-all duration-200",children:C.jsx(ps,{className:"w-5 h-5 text-text-primary"})})}),C.jsx(iQ,{className:"mt-2",onRetry:b,showRetryButton:J,startNewConnection:$,clearError:x,error:H,isConnected:nt})]})})})}function lQ(){return C.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-surface backdrop-blur-2xl animate-pulse",children:[C.jsxs("div",{className:"flex-1 p-6 space-y-4",children:[C.jsx("div",{className:"h-16 bg-surface/80 rounded-2xl border border-border-subtle/50"}),C.jsx("div",{className:"h-16 bg-surface/80 rounded-2xl border border-border-subtle/50"}),C.jsx("div",{className:"h-16 bg-surface/80 rounded-2xl border border-border-subtle/50"})]}),C.jsx("div",{className:"h-24 border-t border-border-subtle bg-surface/80"})]})}function bc(A){if(A instanceof Error)return A;if(typeof A=="string")return new Error(A);try{return new Error(JSON.stringify(A))}catch{return new Error("Unknown error")}}class sQ extends S.Component{state={error:null};static getDerivedStateFromError(n){return{error:bc(n)}}componentDidCatch(n,r){this.setState({componentStack:r?.componentStack})}render(){return this.state.error?C.jsx(cQ,{error:this.state.error,componentStack:this.state.componentStack,title:this.props.title,titleImg:this.props.titleImg,iconUrl:this.props.iconUrl,onClose:this.props.onClose,showCloseButton:this.props.showCloseButton,environment:this.props.environment,displayMode:this.props.displayMode,theme:this.props.theme}):this.props.children}}function oQ({error:A}){throw A}function uQ(A){const[n,r]=S.useState(null);return S.useEffect(()=>{if(typeof window>"u")return;const i=s=>{!s?.error&&!s?.filename&&s?.message==="Script error."||(s?.error?r(bc(s.error)):s?.message&&r(new Error(s.message)))},l=s=>{r(bc(s.reason))};return window.addEventListener("error",i),window.addEventListener("unhandledrejection",l),()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",l)}},[]),C.jsx(sQ,{...A,children:n?C.jsx(oQ,{error:n}):A.children})}function cQ({error:A,title:n,titleImg:r,iconUrl:i,onClose:l,showCloseButton:s,environment:u,displayMode:c,theme:f}){const h=()=>{typeof window<"u"&&window.location.reload()},B=n??"Medi Clinic",p=u??"production",m=S.useMemo(()=>f?.textColor==="white"?"text-white/60":"text-[var(--color-muted-foreground)]",[f?.textColor]);return C.jsx(TB,{isOpen:!0,onClose:l??(()=>{}),showCloseButton:s??!1,onStartNewSession:h,title:B,titleImg:r,iconUrl:i,environment:p,displayMode:c,theme:f,children:C.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:C.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center p-6",children:C.jsxs("div",{className:"w-full max-w-[320px] text-center",children:[C.jsx("div",{className:"mx-auto mb-4 grid place-items-center",children:C.jsx("div",{className:"h-16 w-16 rounded-3xl bg-popover backdrop-blur border border-border-subtle grid place-items-center",children:C.jsx(s4,{className:"h-8 w-8",style:{color:f?.primary??"hsl(var(--primary))"}})})}),C.jsx("div",{className:"text-2xl font-semibold text-text-primary",children:"Uh-oh!"}),C.jsx("div",{className:["mt-2 text-sm",m].join(" "),children:"Something went wrong. Please try again."}),C.jsx("div",{className:["mt-4 rounded-2xl border border-border-subtle/60 bg-surface/60 backdrop-blur px-4 py-3","text-left text-[11px] leading-relaxed font-mono whitespace-pre-wrap break-words",m].join(" "),children:A?.message||String(A)}),C.jsx("div",{className:"mt-5 flex items-center justify-center gap-3",children:C.jsxs($A,{type:"button",onClick:h,className:"rounded-2xl",style:{backgroundColor:f?.primary??void 0},children:[C.jsx(i4,{className:"h-4 w-4 mr-2"}),"Retry"]})})]})})})})}function fQ({agentId:A,config:n}){const[r,i]=S.useState(!1);S.useEffect(()=>{i(!0)},[]);const l=()=>{i(!1),n?.onClose?.()};return C.jsx(uQ,{title:n.title??"Medi Clinic",titleImg:n.theme?.titleImg,iconUrl:n.iconUrl??"https://cdn.eka.care/bot-icon.svg",onClose:l,showCloseButton:n.showCloseButton,environment:n.environment??"production",displayMode:n.displayMode,theme:n.theme,children:C.jsx(aQ,{isOpen:r,agentId:A,config:{...n,environment:n.environment??"production",onClose:l,title:n.title??"Medi Clinic",iconUrl:n.iconUrl??"https://cdn.eka.care/bot-icon.svg",theme:n.theme}})})}const IB=(A,n,r)=>{const i=r||{},l=mv.createRoot(A);return l.render(C.jsx(S.StrictMode,{children:C.jsx(fQ,{agentId:n,config:i})})),l};typeof window<"u"&&(window.renderMedAssist=IB);const NB=S.forwardRef(({className:A,...n},r)=>C.jsx("textarea",{className:EA("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",A),ref:r,...n}));NB.displayName="Textarea";function _B({file:A,onRemove:n,isPreview:r=!0,className:i=""}){const[l,s]=S.useState(!1),[u,c]=S.useState(""),f=A?.type?.startsWith("image/")??!1,h=A?.type==="application/pdf";S.useEffect(()=>{if(f){const m=URL.createObjectURL(A);return c(m),()=>URL.revokeObjectURL(m)}},[A,f]),S.useEffect(()=>{s(!1)},[A]);const B=()=>f?"text-green-600":"text-text-secondary",p=m=>{if(m===0)return"0 B";const w=1024,E=["B","KB","MB","GB"],v=Math.floor(Math.log(m)/Math.log(w));return`${(m/Math.pow(w,v)).toFixed(1)} ${E[v]}`.toLowerCase()};return!f||l?C.jsxs("div",{className:`relative group inline-flex flex-shrink-0 bg-white border border-neutral-300 rounded-lg flex items-center gap-3 px-3 py-2.5 max-w-full ${r?"hover:bg-neutral-50":""} ${i}`,children:[C.jsx("div",{className:`flex-shrink-0 ${B()}`,children:C.jsx(A4,{className:"h-5 w-5"})}),C.jsxs("div",{className:"flex-1 min-w-0 max-w-[200px]",children:[A?.name&&C.jsx("div",{className:"text-sm font-medium text-[var(--color-foreground)] truncate",children:A.name}),A?.size&&C.jsx("div",{className:"text-xs text-[var(--color-muted-foreground)]",children:p(A.size)})]}),r&&n&&C.jsx("button",{onClick:n,"aria-label":`Remove ${A.name}`,className:"flex-shrink-0 flex items-center justify-center w-5 h-5 text-[var(--color-muted-foreground)] hover:text-[var(--color-foreground)] transition-colors",children:C.jsx(ms,{className:"h-4 w-4"})})]}):C.jsxs("div",{className:`relative group flex-shrink-0 ${i}`,children:[C.jsx("div",{className:`w-20 h-20 bg-white border border-neutral-300 rounded-lg flex items-center justify-center overflow-hidden ${r?"hover:bg-neutral-100 cursor-pointer":""}`,children:u&&C.jsx("img",{src:u,alt:A.name,className:"w-full h-full object-cover",onError:()=>s(!0)})}),r&&n&&C.jsx("button",{onClick:n,"aria-label":`Remove ${A.name}`,className:"absolute top-0 right-0 bg-[var(--color-muted)] text-black rounded-full w-5 h-5 flex items-center justify-center hover:bg-[var(--color-muted-foreground)] transition-colors z-10 transform translate-x-1 -translate-y-1",children:C.jsx(ms,{className:"h-3 w-3 text-black"})})]})}function LB({files:A,onRemoveFile:n,isPreview:r=!0,className:i=""}){if(A.length===0)return null;const l=A.filter(u=>u.type?.startsWith("image/")),s=A.filter(u=>!u.type?.startsWith("image/"));return C.jsxs("div",{className:`flex flex-wrap justify-end gap-2 max-w-full ${i}`,children:[s.map(u=>{const c=A.indexOf(u);return C.jsx(_B,{file:u,onRemove:n?()=>n(c):void 0,isPreview:r},`${u.name}-${u.size}-${c}`)}),l.length>0&&C.jsx("div",{className:"flex gap-2 overflow-x-auto max-w-full p-1 scrollbar-hide",children:l.map(u=>{const c=A.indexOf(u);return C.jsx(_B,{file:u,onRemove:n?()=>n(c):void 0,isPreview:r},`${u.name}-${u.size}-${c}`)})})]})}const Uc=({className:A})=>C.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:A,children:C.jsx("path",{d:"M1.46875 0.09375L16.3125 6.9375C16.75 7.125 17 7.53125 17 8C17 8.46875 16.75 8.875 16.3125 9.0625L1.46875 15.9062C1.3125 15.9688 1.1875 16 1.03125 16C0.46875 16 0 15.5312 0 14.9688C0 14.8125 0.03125 14.6875 0.09375 14.5625L2.34375 9.5C2.5 9.15625 2.8125 8.9375 3.15625 8.90625L8.0625 8.46875C8.3125 8.46875 8.5 8.25 8.5 8C8.5 7.75 8.3125 7.5625 8.0625 7.53125L3.15625 7.09375C2.8125 7.0625 2.5 6.84375 2.34375 6.5L0.09375 1.4375C0.03125 1.3125 0 1.1875 0 1.03125C0 0.46875 0.46875 0 1.03125 0C1.1875 0 1.3125 0.03125 1.46875 0.09375Z",fill:"currentColor"})}),RB=S.forwardRef(({className:A,type:n,...r},i)=>{const l=A&&typeof A=="string"&&A.includes("placeholder:");return C.jsx("input",{type:n,className:EA("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",!l&&"placeholder:text-muted-foreground",A),ref:i,...r})});RB.displayName="Input";const dQ=()=>C.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"},"aria-hidden":"true",children:[C.jsx("g",{clipPath:"url(#circleClip)",children:C.jsxs("g",{children:[C.jsx("path",{d:"M15.9766 0.0234375V5.31055H0.0234375V0.0234375H15.9766Z",fill:"#FF9933",stroke:"#1A1A1A","stroke-width":"0.046875"}),C.jsx("path",{d:"M15.9766 5.35779V10.642H0.0234375V5.35779H15.9766Z",fill:"white",stroke:"#1A1A1A","stroke-width":"0.046875"}),C.jsx("path",{d:"M0 10.6656H16V16H0V10.6656Z",fill:"#128807"}),C.jsx("path",{d:"M8.00101 10.1334C9.17921 10.1334 10.1343 9.17824 10.1343 8.00003C10.1343 6.82182 9.17921 5.8667 8.00101 5.8667C6.8228 5.8667 5.86768 6.82182 5.86768 8.00003C5.86768 9.17824 6.8228 10.1334 8.00101 10.1334Z",fill:"#000088"}),C.jsx("path",{d:"M8.00143 9.86663C9.03236 9.86663 9.8681 9.0309 9.8681 7.99997C9.8681 6.96904 9.03236 6.1333 8.00143 6.1333C6.9705 6.1333 6.13477 6.96904 6.13477 7.99997C6.13477 9.0309 6.9705 9.86663 8.00143 9.86663Z",fill:"white"}),C.jsx("path",{d:"M8.00126 8.37325C8.20745 8.37325 8.3746 8.20611 8.3746 7.99992C8.3746 7.79373 8.20745 7.62659 8.00126 7.62659C7.79508 7.62659 7.62793 7.79373 7.62793 7.99992C7.62793 8.20611 7.79508 8.37325 8.00126 8.37325Z",fill:"#000088"}),C.jsx("path",{d:"M9.84014 8.33936C9.8927 8.34628 9.94093 8.30928 9.94785 8.25671C9.95477 8.20415 9.91776 8.15593 9.8652 8.14901C9.81263 8.14208 9.76441 8.17909 9.75749 8.23165C9.75057 8.28422 9.78757 8.33244 9.84014 8.33936Z",fill:"#000088"}),C.jsx("path",{d:"M8.00199 9.86647L8.06599 8.74647L8.00199 8.21313L7.93799 8.74647L8.00199 9.86647Z",fill:"#000088"}),C.jsx("path",{d:"M9.69246 8.8036C9.74145 8.82389 9.7976 8.80063 9.81789 8.75165C9.83818 8.70266 9.81492 8.6465 9.76594 8.62622C9.71696 8.60593 9.6608 8.62919 9.64051 8.67817C9.62022 8.72715 9.64348 8.78331 9.69246 8.8036Z",fill:"#000088"}),C.jsx("path",{d:"M7.52209 9.80289L7.87379 8.73762L7.95 8.2059L7.75015 8.70449L7.52209 9.80289Z",fill:"#000088"}),C.jsx("path",{d:"M9.4251 9.21296C9.46716 9.24524 9.52743 9.2373 9.5597 9.19524C9.59198 9.15318 9.58405 9.09291 9.54198 9.06064C9.49992 9.02836 9.43966 9.0363 9.40738 9.07836C9.3751 9.12042 9.38304 9.18069 9.4251 9.21296Z",fill:"#000088"}),C.jsx("path",{d:"M7.06958 9.61654L7.68501 8.67859L7.89625 8.18471L7.57415 8.61459L7.06958 9.61654Z",fill:"#000088"}),C.jsx("path",{d:"M9.06041 9.53972C9.09269 9.58179 9.15295 9.58972 9.19502 9.55744C9.23708 9.52517 9.24501 9.4649 9.21274 9.42284C9.18046 9.38078 9.1202 9.37284 9.07814 9.40512C9.03607 9.4374 9.02814 9.49766 9.06041 9.53972Z",fill:"#000088"}),C.jsx("path",{d:"M6.68086 9.31981L7.51807 8.5731L7.84994 8.15072L7.42756 8.48259L6.68086 9.31981Z",fill:"#000088"}),C.jsx("path",{d:"M8.6284 9.76153C8.64869 9.81052 8.70484 9.83378 8.75383 9.81349C8.80281 9.7932 8.82607 9.73704 8.80578 9.68806C8.78549 9.63907 8.72933 9.61581 8.68035 9.6361C8.63137 9.65639 8.60811 9.71255 8.6284 9.76153Z",fill:"#000088"}),C.jsx("path",{d:"M6.38679 8.93324L7.38874 8.42867L7.81862 8.10657L7.32474 8.31781L6.38679 8.93324Z",fill:"#000088"}),C.jsx("path",{d:"M8.14737 9.86316C8.15429 9.91573 8.20251 9.95273 8.25508 9.94581C8.30764 9.93889 8.34465 9.89066 8.33773 9.8381C8.33081 9.78553 8.28258 9.74853 8.23002 9.75545C8.17745 9.76237 8.14045 9.81059 8.14737 9.86316Z",fill:"#000088"}),C.jsx("path",{d:"M6.19642 8.4829L7.29482 8.25484L7.79342 8.05498L7.2617 8.1312L6.19642 8.4829Z",fill:"#000088"}),C.jsx("path",{d:"M7.66381 9.83806C7.65689 9.89063 7.69389 9.93885 7.74646 9.94577C7.79903 9.95269 7.84725 9.91569 7.85417 9.86312C7.86109 9.81056 7.82409 9.76233 7.77152 9.75541C7.71895 9.74849 7.67073 9.7855 7.66381 9.83806Z",fill:"#000088"}),C.jsx("path",{d:"M6.13671 7.99991L7.25671 8.06391L7.79004 7.99991L7.25671 7.93591L6.13671 7.99991Z",fill:"#000088"}),C.jsx("path",{d:"M7.20092 9.68758C7.18063 9.73656 7.20389 9.79272 7.25287 9.81301C7.30185 9.8333 7.35801 9.81004 7.3783 9.76106C7.39859 9.71207 7.37533 9.65592 7.32635 9.63563C7.27736 9.61534 7.22121 9.6386 7.20092 9.68758Z",fill:"#000088"}),C.jsx("path",{d:"M6.20138 7.51684L7.26665 7.86854L7.79838 7.94475L7.29978 7.7449L6.20138 7.51684Z",fill:"#000088"}),C.jsx("path",{d:"M6.79363 9.42217C6.76135 9.46423 6.76929 9.5245 6.81135 9.55677C6.85341 9.58905 6.91368 9.58112 6.94595 9.53905C6.97823 9.49699 6.9703 9.43673 6.92823 9.40445C6.88617 9.37217 6.82591 9.38011 6.79363 9.42217Z",fill:"#000088"}),C.jsx("path",{d:"M6.39018 7.06677L7.32812 7.6822L7.822 7.89344L7.39212 7.57135L6.39018 7.06677Z",fill:"#000088"}),C.jsx("path",{d:"M6.46467 9.05968C6.42261 9.09196 6.41467 9.15222 6.44695 9.19428C6.47923 9.23635 6.53949 9.24428 6.58155 9.21201C6.62362 9.17973 6.63155 9.11947 6.59927 9.0774C6.567 9.03534 6.50673 9.02741 6.46467 9.05968Z",fill:"#000088"}),C.jsx("path",{d:"M6.68459 6.68013L7.43129 7.51734L7.85367 7.84921L7.5218 7.42683L6.68459 6.68013Z",fill:"#000088"}),C.jsx("path",{d:"M6.24115 8.6251C6.19217 8.64539 6.16891 8.70155 6.1892 8.75053C6.20949 8.79951 6.26564 8.82277 6.31463 8.80248C6.36361 8.7822 6.38687 8.72604 6.36658 8.67705C6.34629 8.62807 6.29014 8.60481 6.24115 8.6251Z",fill:"#000088"}),C.jsx("path",{d:"M7.06908 6.38338L7.57365 7.38532L7.89575 7.8152L7.68451 7.32132L7.06908 6.38338Z",fill:"#000088"}),C.jsx("path",{d:"M6.14294 8.14786C6.09038 8.15478 6.05338 8.203 6.0603 8.25557C6.06722 8.30813 6.11544 8.34513 6.168 8.33821C6.22057 8.33129 6.25757 8.28307 6.25065 8.2305C6.24373 8.17794 6.19551 8.14094 6.14294 8.14786Z",fill:"#000088"}),C.jsx("path",{d:"M7.52345 6.19703L7.75151 7.29543L7.95136 7.79403L7.87515 7.26231L7.52345 6.19703Z",fill:"#000088"}),C.jsx("path",{d:"M6.17061 7.66052C6.11804 7.6536 6.06982 7.6906 6.0629 7.74316C6.05598 7.79573 6.09298 7.84395 6.14554 7.85087C6.19811 7.85779 6.24633 7.82079 6.25325 7.76822C6.26017 7.71566 6.22317 7.66744 6.17061 7.66052Z",fill:"#000088"}),C.jsx("path",{d:"M8.00875 6.13341L7.94475 7.25341L8.00875 7.78674L8.07275 7.25341L8.00875 6.13341Z",fill:"#000088"}),C.jsx("path",{d:"M6.32316 7.19628C6.27418 7.17599 6.21802 7.19925 6.19773 7.24823C6.17744 7.29722 6.2007 7.35337 6.24969 7.37366C6.29867 7.39395 6.35483 7.37069 6.37512 7.32171C6.39541 7.27272 6.37215 7.21657 6.32316 7.19628Z",fill:"#000088"}),C.jsx("path",{d:"M8.49354 6.19699L8.14184 7.26226L8.06562 7.79398L8.26548 7.29539L8.49354 6.19699Z",fill:"#000088"}),C.jsx("path",{d:"M6.58174 6.78692C6.53967 6.75464 6.47941 6.76257 6.44713 6.80464C6.41486 6.8467 6.42279 6.90696 6.46485 6.93924C6.50692 6.97152 6.56718 6.96358 6.59946 6.92152C6.63173 6.87946 6.6238 6.81919 6.58174 6.78692Z",fill:"#000088"}),C.jsx("path",{d:"M8.93726 6.38334L8.32183 7.32129L8.11059 7.81517L8.43268 7.38529L8.93726 6.38334Z",fill:"#000088"}),C.jsx("path",{d:"M6.94642 6.46015C6.91415 6.41809 6.85388 6.41016 6.81182 6.44243C6.76976 6.47471 6.76182 6.53497 6.7941 6.57704C6.82637 6.6191 6.88664 6.62703 6.9287 6.59476C6.97076 6.56248 6.9787 6.50222 6.94642 6.46015Z",fill:"#000088"}),C.jsx("path",{d:"M9.32598 6.68007L8.48876 7.42678L8.15689 7.84915L8.57927 7.51729L9.32598 6.68007Z",fill:"#000088"}),C.jsx("path",{d:"M7.37649 6.23847C7.3562 6.18948 7.30004 6.16622 7.25106 6.18651C7.20207 6.2068 7.17881 6.26296 7.1991 6.31194C7.21939 6.36093 7.27555 6.38419 7.32453 6.3639C7.37352 6.34361 7.39678 6.28745 7.37649 6.23847Z",fill:"#000088"}),C.jsx("path",{d:"M9.61809 7.06676L8.61614 7.57133L8.18626 7.89343L8.68014 7.68219L9.61809 7.06676Z",fill:"#000088"}),C.jsx("path",{d:"M7.85751 6.13684C7.85059 6.08427 7.80237 6.04727 7.74981 6.05419C7.69724 6.06111 7.66024 6.10934 7.66716 6.1619C7.67408 6.21447 7.7223 6.25147 7.77487 6.24455C7.82743 6.23763 7.86443 6.18941 7.85751 6.13684Z",fill:"#000088"}),C.jsx("path",{d:"M9.80846 7.5171L8.71006 7.74516L8.21146 7.94502L8.74319 7.8688L9.80846 7.5171Z",fill:"#000088"}),C.jsx("path",{d:"M8.34302 6.16194C8.34994 6.10937 8.31294 6.06115 8.26038 6.05423C8.20781 6.04731 8.15959 6.08431 8.15267 6.13688C8.14575 6.18944 8.18275 6.23767 8.23532 6.24459C8.28788 6.25151 8.3361 6.2145 8.34302 6.16194Z",fill:"#000088"}),C.jsx("path",{d:"M9.87013 8.00009L8.75013 7.93609L8.2168 8.00009L8.75013 8.06409L9.87013 8.00009Z",fill:"#000088"}),C.jsx("path",{d:"M8.80592 6.31242C8.82621 6.26344 8.80295 6.20728 8.75396 6.18699C8.70498 6.1667 8.64882 6.18996 8.62853 6.23894C8.60824 6.28793 8.63151 6.34408 8.68049 6.36437C8.72947 6.38466 8.78563 6.3614 8.80592 6.31242Z",fill:"#000088"}),C.jsx("path",{d:"M9.80545 8.48316L8.74018 8.13146L8.20846 8.05525L8.70705 8.2551L9.80545 8.48316Z",fill:"#000088"}),C.jsx("path",{d:"M9.21614 6.57795C9.24841 6.53589 9.24048 6.47562 9.19842 6.44335C9.15635 6.41107 9.09609 6.41901 9.06381 6.46107C9.03154 6.50313 9.03947 6.5634 9.08153 6.59567C9.1236 6.62795 9.18386 6.62001 9.21614 6.57795Z",fill:"#000088"}),C.jsx("path",{d:"M9.61959 8.93335L8.68164 8.31792L8.18776 8.10668L8.61764 8.42878L9.61959 8.93335Z",fill:"#000088"}),C.jsx("path",{d:"M9.53875 6.94044C9.58081 6.90816 9.58874 6.8479 9.55647 6.80584C9.52419 6.76377 9.46393 6.75584 9.42186 6.78812C9.3798 6.82039 9.37187 6.88066 9.40414 6.92272C9.43642 6.96478 9.49668 6.97272 9.53875 6.94044Z",fill:"#000088"}),C.jsx("path",{d:"M9.31883 9.31999L8.57213 8.48278L8.14975 8.15091L8.48162 8.57329L9.31883 9.31999Z",fill:"#000088"}),C.jsx("path",{d:"M9.76715 7.37502C9.81613 7.35473 9.83939 7.29858 9.8191 7.24959C9.79881 7.20061 9.74266 7.17735 9.69367 7.19764C9.64469 7.21793 9.62143 7.27408 9.64172 7.32307C9.66201 7.37205 9.71816 7.39531 9.76715 7.37502Z",fill:"#000088"}),C.jsx("path",{d:"M8.93922 9.61662L8.43465 8.61468L8.11255 8.1848L8.3238 8.67868L8.93922 9.61662Z",fill:"#000088"}),C.jsx("path",{d:"M9.86682 7.85227C9.91939 7.84534 9.95639 7.79712 9.94947 7.74456C9.94255 7.69199 9.89433 7.65499 9.84176 7.66191C9.78919 7.66883 9.75219 7.71705 9.75911 7.76962C9.76603 7.82218 9.81426 7.85919 9.86682 7.85227Z",fill:"#000088"}),C.jsx("path",{d:"M8.48631 9.80309L8.25826 8.70469L8.0584 8.20609L8.13462 8.73782L8.48631 9.80309Z",fill:"#000088"})]})}),C.jsx("defs",{children:C.jsx("clipPath",{id:"circleClip",children:C.jsx("circle",{cx:"8",cy:"8",r:"8"})})})]}),hQ="+91";function gQ(A){const n=A.replace(/\D/g,""),r=n.slice(0,5),i=n.slice(5,10);return i?`${r} ${i}`:r}function BQ({value:A,onChange:n,onKeyDown:r,disabled:i,theme:l,isMobile:s,maxLength:u,isMobileValid:c,onSend:f}){return C.jsxs("div",{className:"px-2 pt-3 pb-2 space-y-2 w-full",children:[C.jsx("p",{className:"px-1 text-xs font-semibold tracking-wide text-foreground uppercase",children:"Enter your mobile number"}),C.jsxs("div",{className:"flex items-center gap-2 w-full",children:[C.jsxs("div",{className:EA("inline-flex items-center gap-2 rounded-full px-3 shrink-0 py-2 min-h-[56px]",i&&"opacity-60",l?.textColor==="white"?"bg-white-100":"bg-black-100"),style:{fontSize:s?"16px":"14px"},children:[C.jsx(dQ,{}),C.jsx("span",{className:"text-sm font-medium text-foreground",children:hQ}),C.jsx(ps,{className:"h-4 w-4 text-muted-foreground","aria-hidden":!0})]}),C.jsxs("div",{className:EA("flex items-center gap-1 rounded-full px-2 py-2 flex-1 min-w-0",i&&"opacity-60",l?.textColor==="white"?"bg-white-100":"bg-black-100"),children:[C.jsx(RB,{type:"tel",autoComplete:"tel-national",value:gQ(A),onChange:n,onKeyDown:r,placeholder:"88888 88888",className:EA("w-full h-full shadow-none border-0 outline-none focus-visible:ring-0 focus-visible:ring-offset-0","text-sm placeholder:text-muted-foreground bg-transparent","disabled:cursor-not-allowed rounded-none break-words overflow-wrap-anywhere whitespace-pre-wrap","text-foreground px-3 py-2 pr-11 min-h-[40px]"),style:{fontSize:s?"16px":"14px"},maxLength:u?u+1:void 0,inputMode:"numeric",autoFocus:!i,disabled:i}),C.jsx($A,{type:"button",size:"icon",onClick:f,disabled:i||!c,variant:"ghost",className:`h-10 w-10 ${c?"bg-primary":"bg-none"} hover:bg-primary/90 rounded-full transition-all duration-200 shadow-lg hover:shadow-xl hover:scale-105 active:scale-95 shrink-0 disabled:opacity-50 disabled:pointer-events-none disabled:hover:scale-100`,title:c?"Submit mobile number":"Enter a valid mobile number","aria-label":c?"Submit mobile number":"Enter a valid mobile number",children:C.jsx(Uc,{className:`w-4 h-4 ${c?"text-primary-foreground":"text-primary"}`})})]})]})]})}const pQ=6,mQ=30,CQ=(A,n)=>A.disabled===n.disabled&&A.isMobile===n.isMobile&&A.validation?.pattern===n.validation?.pattern&&A.validation?.minLength===n.validation?.minLength&&A.validation?.maxLength===n.validation?.maxLength&&A.serverMessage===n.serverMessage&&A.theme?.textColor===n.theme?.textColor;function wQ({disabled:A,isMobile:n,validation:r,onSubmit:i,onResendOtp:l,serverMessage:s}){const u=S.useRef([]),[c,f]=S.useState(0),[h,B]=S.useState(!1),p=S.useRef(!1),m=S.useRef(i),w=S.useRef(l),E=r?.maxLength??pQ,v=S.useMemo(()=>new RegExp(r?.pattern??`^\\d{${E}}$`),[r?.pattern,E]);S.useEffect(()=>{m.current=i},[i]),S.useEffect(()=>{w.current=l},[l]),S.useEffect(()=>{if(!s)return;const j=s.toLowerCase();j.includes("otp")&&(j.includes("invalid")||j.includes("incorrect")||j.includes("wrong"))&&(p.current=!1,B(!1))},[s]);const F=S.useCallback(()=>u.current.map(j=>j?.value.replace(/\D/g,"").slice(-1)??""),[]),U=S.useCallback(()=>{const j=F().join(""),AA=j.length===E&&v.test(j);p.current!==AA&&(p.current=AA,B(AA))},[E,v,F]),N=S.useCallback(j=>{j<E-1&&u.current[j+1]?.focus()},[E]),k=S.useCallback(j=>{j>0&&u.current[j-1]?.focus()},[]),$=S.useMemo(()=>Array.from({length:E},(j,AA)=>AA),[E]),J=S.useCallback(j=>{for(let nA=0;nA<E;nA++){const rA=u.current[nA];rA&&(rA.value=j[nA]??"")}U();const AA=Math.min(j.length,E-1);u.current[AA]?.focus()},[U,E]),x=S.useCallback((j,AA)=>{const nA=AA.target.value.replace(/\D/g,"");if(nA.length>1){J(nA.slice(0,E));return}const rA=nA.slice(-1);AA.target.value=rA,U(),rA&&N(j)},[U,J,N,E]),H=S.useCallback((j,AA)=>{if(AA.key==="Backspace"&&!u.current[j]?.value){k(j);return}if(AA.key==="Enter"&&!AA.shiftKey&&!A){AA.preventDefault();const nA=F().join("");if(nA.length===E&&v.test(nA))m.current(nA);else{const K=F().findIndex(q=>!q);u.current[K===-1?0:K]?.focus()}}},[A,k,E,v,F]),L=S.useCallback(j=>{j.preventDefault();const AA=j.clipboardData.getData("text").replace(/\D/g,"").slice(0,E);AA&&J(AA)},[J,E]),D=S.useCallback(()=>{if(A)return;const j=F().join("");j.length===E&&v.test(j)&&m.current(j)},[A,E,v,F]),Y=S.useCallback(()=>{if(!(c>0||A)){for(const j of u.current)j&&(j.value="");p.current=!1,B(!1),u.current[0]?.focus(),w.current?.(),f(mQ)}},[A,c]);S.useEffect(()=>{A||u.current[0]?.focus()},[A]),S.useEffect(()=>{if(h){c>0&&f(0);return}if(c<=0)return;const j=setTimeout(()=>f(AA=>AA-1),1e3);return()=>clearTimeout(j)},[h,c]);const R=S.useMemo(()=>$.map(j=>C.jsx("input",{ref:AA=>{u.current[j]=AA},type:"text",inputMode:"numeric",maxLength:n&&j===0?E:1,onChange:AA=>x(j,AA),onKeyDown:AA=>H(j,AA),onPaste:L,disabled:A,tabIndex:0,style:{fontSize:n?"16px":"14px"},className:EA("h-10 w-10 rounded-full border text-center text-lg font-semibold bg-transparent text-foreground","border-border shadow-sm outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 focus-visible:border-transparent","disabled:cursor-not-allowed disabled:opacity-50"),autoComplete:j===0?"one-time-code":"off","aria-label":`Digit ${j+1}`},j)),[A,$,x,H,L,n,E]);return C.jsx("div",{className:"px-4 pt-3 pb-2 space-y-3",children:C.jsxs("div",{className:"flex flex-col gap-3",children:[C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsx("p",{className:"text-xs font-semibold tracking-wide text-foreground uppercase",children:"Please enter the OTP"}),!h&&C.jsxs("button",{type:"button",onClick:Y,disabled:A||c>0,className:EA("text-xs font-medium underline underline-offset-2","text-primary hover:opacity-90 disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed"),children:["Resend OTP",c>0?` (00:${String(c).padStart(2,"0")}s)`:""]})]}),C.jsxs("div",{className:"flex items-center w-full gap-2 justify-between",children:[C.jsx("div",{className:"flex items-center gap-2",children:R}),C.jsx($A,{type:"button",size:"icon",onClick:D,disabled:A,variant:"ghost",className:`h-10 w-10 ${h?"bg-primary":"bg-none"} hover:bg-primary/90 rounded-full transition-all duration-200 shadow-lg hover:shadow-xl hover:scale-105 active:scale-95 shrink-0 disabled:opacity-50 disabled:pointer-events-none disabled:hover:scale-100`,title:h?"Submit OTP":"Enter the full OTP to submit","aria-label":h?"Submit OTP":"Enter the full OTP to submit",children:C.jsx(Uc,{className:`w-4 h-4 ${h?"text-primary-foreground":"text-primary"}`})})]})]})})}const yQ=S.memo(wQ,CQ),OB=10,EQ=10,vQ=/^[6-9][0-9]{9}$/;function QQ({component:A,value:n,onChange:r,isDisabled:i,validation:l,theme:s,isMobile:u,placeholder:c,onSend:f,onResendOtp:h,serverMessage:B}){const p=A===wA.SYNAPSE_COMPONENTS.MOBILE,m=A===wA.SYNAPSE_COMPONENTS.OTP;if(!p&&!m)return null;const w=U=>{const N=U.target.value.replace(/\D/g,""),k=l?.maxLength??OB;r(N.slice(0,k))},E=n.length===(l?.minLength??EQ)&&(l?.pattern?new RegExp(l.pattern).test(n):vQ.test(n)),v=()=>{!E||i||f()},F=U=>{U.key==="Enter"&&(U.preventDefault(),v())};return C.jsxs(C.Fragment,{children:[p&&C.jsx(BQ,{value:n,onChange:w,onSend:v,onKeyDown:F,placeholder:c??"Enter your mobile number",disabled:i,isMobileValid:E,theme:s,isMobile:u,maxLength:l?.maxLength??OB}),m&&C.jsx(yQ,{disabled:i,isMobile:u,validation:{pattern:l?.pattern,minLength:l?.minLength,maxLength:l?.maxLength},onSubmit:U=>{f({message:U})},onResendOtp:h,serverMessage:B,theme:s})]})}function bQ({value:A,onChange:n,onSend:r,onFileChange:i,onRemoveFile:l,onRecording:s,isRecording:u,hasAttachment:c,attachmentFiles:f,isDisabled:h,placeholder:B,isMobile:p,recordingStatus:m,theme:w,allowed:E,showStartNewChatButton:v,onStartNewChat:F}){const U=S.useRef(null),N=S.useRef(null),k=Ge(sA=>sA.elicitationState),$=k.component===wA.SYNAPSE_COMPONENTS.MOBILE,J=k.component===wA.SYNAPSE_COMPONENTS.OTP,x=k.disp_toast_msg?.trim()??"",H=A.trim().length>0||c,L=E===void 0||E.includes("audio"),D=H||!L,Y=H,R=E===void 0||E.includes("file"),j=(h||m!==de.IDLE)&&!u,AA=EA("rounded-full transition-all duration-200 ",u?"bg-gradient-to-r from-rose-400 via-primary to-indigo-500 text-white ring-2 ring-white/60 animate-pulse shadow-[0_0_20px_rgba(139,92,246,0.45)]":j?"text-primary/50 cursor-not-allowed shadow-none":"text-foreground hover:bg-secondary"),nA=sA=>{const T=Array.from(sA.target.files||[]);T.length>0&&i(T)},rA=()=>{h||U.current?.click()},K=sA=>{sA.key==="Enter"&&!sA.shiftKey&&Y&&!h&&(sA.preventDefault(),r({tool_declined:!0}))},q=sA=>{sA.style.height="auto",sA.style.overflow="hidden";const T=sA.scrollHeight,I=40,X=120,b=Math.max(I,Math.min(T,X));sA.style.height=b+"px",T>X?sA.style.overflow="auto":sA.style.overflow="hidden"},eA=sA=>{q(sA.currentTarget)};return S.useEffect(()=>{N.current&&q(N.current)},[A]),S.useEffect(()=>{!h&&!p&&N.current?.focus()},[h]),v&&F?C.jsx("div",{className:"px-4 py-2 flex justify-unset",children:C.jsxs("button",{type:"button",onClick:F,className:"px-6 py-3 bg-primary text-primary-foreground text-sm font-semibold rounded-lg hover:bg-primary/90 transition-colors flex items-center justify-center gap-2 disabled:opacity-60 disabled:pointer-events-none w-full",children:[C.jsx("span",{children:"Start new chat"}),C.jsx(b0,{className:"w-5 h-5","aria-hidden":!0})]})}):C.jsx(C.Fragment,{children:$||J?C.jsx(QQ,{component:k.component,value:A,onChange:n,isDisabled:h,placeholder:k.description,validation:{pattern:k.pattern,minLength:k.minLength,maxLength:k.maxLength,type:k.type},theme:w,isMobile:p,onSend:r,onResendOtp:()=>r({resend:!0}),serverMessage:J?x:""}):C.jsxs("div",{className:"px-2 py-2",children:[c&&f.length>0&&C.jsx("div",{className:"mb-2 pb-2 border-b border-border-subtle",children:C.jsx(LB,{files:f,onRemoveFile:l,isPreview:!0})}),C.jsx("input",{ref:U,type:"file",multiple:!0,max:3,accept:"image/jpeg, image/png, image/jpg, application/pdf",className:"hidden",onChange:nA,disabled:h,title:"Attach file","aria-label":"Attach file"}),C.jsxs("div",{className:"flex items-center gap-2 w-full",children:[R&&m===de.IDLE&&C.jsx($A,{type:"button",variant:"ghost",size:"icon",onClick:rA,disabled:h,className:EA("rounded-full transition-all shrink-0",c?"bg-primary text-foreground hover:bg-primary/15":"hover:bg-secondary text-foreground"),title:"Attach file","aria-label":"Attach file",children:C.jsx(t4,{className:"w-5 h-5"})}),C.jsx("div",{className:EA("flex items-center gap-1 rounded-full px-2 py-2 flex-1 min-w-0",h&&"opacity-60",w?.textColor==="white"?"bg-white-100":"bg-black-100"),children:C.jsxs("div",{className:"flex-1 relative min-w-0",children:[C.jsx(NB,{ref:N,onInput:eA,placeholder:B,value:A,onChange:sA=>n(sA.target.value),rows:1,maxLength:1e3,autoFocus:!h&&!p,style:{wordBreak:"break-word",overflowWrap:"anywhere",minHeight:"40px",maxHeight:"120px",fontSize:p?"16px":"14px",lineHeight:"1.5"},onKeyPress:K,disabled:h,title:"Enter your message","aria-label":"Enter your message",className:"w-full shadow-none border-0 outline-none focus-visible:ring-0 focus-visible:ring-offset-0 text-sm placeholder:text-muted-foreground bg-transparent disabled:cursor-not-allowed rounded-none break-words overflow-wrap-anywhere whitespace-pre-wrap text-foreground resize-none pr-11"}),u?C.jsx($A,{type:"button",variant:"ghost",size:"icon",onClick:s,className:"absolute right-0.5 top-1/2 -translate-y-1/2 rounded-full bg-gradient-to-r from-red-400 to-rose-500 text-white hover:from-red-500 hover:to-rose-600 shadow-lg transition-all duration-200 hover:scale-105 active:scale-95 shrink-0",title:"Stop recording","aria-label":"Stop recording",children:C.jsx(a4,{className:"w-4 h-4"})}):L&&!D&&C.jsx($A,{type:"button",variant:"ghost",size:"icon",onClick:s,disabled:j,className:EA("absolute right-0.5 top-1/2 -translate-y-1/2 shrink-0",AA),title:"Start recording","aria-label":"Start recording",children:C.jsx(r4,{className:"w-5 h-5"})},u?"recording":"idle"),D&&C.jsx($A,{type:"button",size:"icon",onClick:()=>r({tool_declined:!0}),disabled:h||!Y,variant:"ghost",className:`absolute right-0.5 top-1/2 -translate-y-1/2 h-10 w-10 ${Y?"bg-primary":"bg-none"} hover:bg-primary/90 rounded-full transition-all duration-200 shadow-lg hover:shadow-xl hover:scale-105 active:scale-95 shrink-0 disabled:opacity-50 disabled:pointer-events-none disabled:hover:scale-100`,title:Y?"Send message":"Type a message to send","aria-label":Y?"Send message":"Type a message to send",children:C.jsx(Uc,{className:`w-4 h-4 ${Y?"text-primary-foreground":"text-primary"}`})})]})})]})]})})}const UQ=Object.freeze(Object.defineProperty({__proto__:null,default:bQ},Symbol.toStringTag,{value:"Module"}));function SQ(A,n){const r={};return(A[A.length-1]===""?[...A,""]:A).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const xQ=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FQ=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TQ={};function MB(A,n){return(TQ.jsx?FQ:xQ).test(A)}const HQ=/[ \t\n\f\r]/g;function IQ(A){return typeof A=="object"?A.type==="text"?DB(A.value):!1:DB(A)}function DB(A){return A.replace(HQ,"")===""}class ka{constructor(n,r,i){this.normal=r,this.property=n,i&&(this.space=i)}}ka.prototype.normal={},ka.prototype.property={},ka.prototype.space=void 0;function kB(A,n){const r={},i={};for(const l of A)Object.assign(r,l.property),Object.assign(i,l.normal);return new ka(r,i,n)}function Sc(A){return A.toLowerCase()}class ut{constructor(n,r){this.attribute=r,this.property=n}}ut.prototype.attribute="",ut.prototype.booleanish=!1,ut.prototype.boolean=!1,ut.prototype.commaOrSpaceSeparated=!1,ut.prototype.commaSeparated=!1,ut.prototype.defined=!1,ut.prototype.mustUseProperty=!1,ut.prototype.number=!1,ut.prototype.overloadedBoolean=!1,ut.prototype.property="",ut.prototype.spaceSeparated=!1,ut.prototype.space=void 0;let NQ=0;const HA=zr(),Se=zr(),xc=zr(),oA=zr(),le=zr(),Ci=zr(),vt=zr();function zr(){return 2**++NQ}const Fc=Object.freeze(Object.defineProperty({__proto__:null,boolean:HA,booleanish:Se,commaOrSpaceSeparated:vt,commaSeparated:Ci,number:oA,overloadedBoolean:xc,spaceSeparated:le},Symbol.toStringTag,{value:"Module"})),Tc=Object.keys(Fc);class Hc extends ut{constructor(n,r,i,l){let s=-1;if(super(n,r),KB(this,"space",l),typeof i=="number")for(;++s<Tc.length;){const u=Tc[s];KB(this,Tc[s],(i&Fc[u])===Fc[u])}}}Hc.prototype.defined=!0;function KB(A,n,r){r&&(A[n]=r)}function wi(A){const n={},r={};for(const[i,l]of Object.entries(A.properties)){const s=new Hc(i,A.transform(A.attributes||{},i),l,A.space);A.mustUseProperty&&A.mustUseProperty.includes(i)&&(s.mustUseProperty=!0),n[i]=s,r[Sc(i)]=i,r[Sc(s.attribute)]=i}return new ka(n,r,A.space)}const jB=wi({properties:{ariaActiveDescendant:null,ariaAtomic:Se,ariaAutoComplete:null,ariaBusy:Se,ariaChecked:Se,ariaColCount:oA,ariaColIndex:oA,ariaColSpan:oA,ariaControls:le,ariaCurrent:null,ariaDescribedBy:le,ariaDetails:null,ariaDisabled:Se,ariaDropEffect:le,ariaErrorMessage:null,ariaExpanded:Se,ariaFlowTo:le,ariaGrabbed:Se,ariaHasPopup:null,ariaHidden:Se,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:le,ariaLevel:oA,ariaLive:null,ariaModal:Se,ariaMultiLine:Se,ariaMultiSelectable:Se,ariaOrientation:null,ariaOwns:le,ariaPlaceholder:null,ariaPosInSet:oA,ariaPressed:Se,ariaReadOnly:Se,ariaRelevant:null,ariaRequired:Se,ariaRoleDescription:le,ariaRowCount:oA,ariaRowIndex:oA,ariaRowSpan:oA,ariaSelected:Se,ariaSetSize:oA,ariaSort:null,ariaValueMax:oA,ariaValueMin:oA,ariaValueNow:oA,ariaValueText:null,role:null},transform(A,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function zB(A,n){return n in A?A[n]:n}function VB(A,n){return zB(A,n.toLowerCase())}const _Q=wi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ci,acceptCharset:le,accessKey:le,action:null,allow:null,allowFullScreen:HA,allowPaymentRequest:HA,allowUserMedia:HA,alt:null,as:null,async:HA,autoCapitalize:null,autoComplete:le,autoFocus:HA,autoPlay:HA,blocking:le,capture:null,charSet:null,checked:HA,cite:null,className:le,cols:oA,colSpan:null,content:null,contentEditable:Se,controls:HA,controlsList:le,coords:oA|Ci,crossOrigin:null,data:null,dateTime:null,decoding:null,default:HA,defer:HA,dir:null,dirName:null,disabled:HA,download:xc,draggable:Se,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:HA,formTarget:null,headers:le,height:oA,hidden:xc,high:oA,href:null,hrefLang:null,htmlFor:le,httpEquiv:le,id:null,imageSizes:null,imageSrcSet:null,inert:HA,inputMode:null,integrity:null,is:null,isMap:HA,itemId:null,itemProp:le,itemRef:le,itemScope:HA,itemType:le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:HA,low:oA,manifest:null,max:null,maxLength:oA,media:null,method:null,min:null,minLength:oA,multiple:HA,muted:HA,name:null,nonce:null,noModule:HA,noValidate:HA,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:HA,optimum:oA,pattern:null,ping:le,placeholder:null,playsInline:HA,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:HA,referrerPolicy:null,rel:le,required:HA,reversed:HA,rows:oA,rowSpan:oA,sandbox:le,scope:null,scoped:HA,seamless:HA,selected:HA,shadowRootClonable:HA,shadowRootDelegatesFocus:HA,shadowRootMode:null,shape:null,size:oA,sizes:null,slot:null,span:oA,spellCheck:Se,src:null,srcDoc:null,srcLang:null,srcSet:null,start:oA,step:null,style:null,tabIndex:oA,target:null,title:null,translate:null,type:null,typeMustMatch:HA,useMap:null,value:Se,width:oA,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:le,axis:null,background:null,bgColor:null,border:oA,borderColor:null,bottomMargin:oA,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:HA,declare:HA,event:null,face:null,frame:null,frameBorder:null,hSpace:oA,leftMargin:oA,link:null,longDesc:null,lowSrc:null,marginHeight:oA,marginWidth:oA,noResize:HA,noHref:HA,noShade:HA,noWrap:HA,object:null,profile:null,prompt:null,rev:null,rightMargin:oA,rules:null,scheme:null,scrolling:Se,standby:null,summary:null,text:null,topMargin:oA,valueType:null,version:null,vAlign:null,vLink:null,vSpace:oA,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:HA,disableRemotePlayback:HA,prefix:null,property:null,results:oA,security:null,unselectable:null},space:"html",transform:VB}),LQ=wi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vt,accentHeight:oA,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:oA,amplitude:oA,arabicForm:null,ascent:oA,attributeName:null,attributeType:null,azimuth:oA,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:oA,by:null,calcMode:null,capHeight:oA,className:le,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:oA,diffuseConstant:oA,direction:null,display:null,dur:null,divisor:oA,dominantBaseline:null,download:HA,dx:null,dy:null,edgeMode:null,editable:null,elevation:oA,enableBackground:null,end:null,event:null,exponent:oA,externalResourcesRequired:null,fill:null,fillOpacity:oA,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:Ci,g2:Ci,glyphName:Ci,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:oA,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:oA,horizOriginX:oA,horizOriginY:oA,id:null,ideographic:oA,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:oA,k:oA,k1:oA,k2:oA,k3:oA,k4:oA,kernelMatrix:vt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:oA,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:oA,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:oA,overlineThickness:oA,paintOrder:null,panose1:null,path:null,pathLength:oA,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:oA,pointsAtY:oA,pointsAtZ:oA,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vt,rev:vt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vt,requiredFeatures:vt,requiredFonts:vt,requiredFormats:vt,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:oA,specularExponent:oA,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:oA,strikethroughThickness:oA,string:null,stroke:null,strokeDashArray:vt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:oA,strokeOpacity:oA,strokeWidth:null,style:null,surfaceScale:oA,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vt,tabIndex:oA,tableValues:null,target:null,targetX:oA,targetY:oA,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:oA,underlineThickness:oA,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:oA,values:null,vAlphabetic:oA,vMathematical:oA,vectorEffect:null,vHanging:oA,vIdeographic:oA,version:null,vertAdvY:oA,vertOriginX:oA,vertOriginY:oA,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:oA,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:zB}),GB=wi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(A,n){return"xlink:"+n.slice(5).toLowerCase()}}),PB=wi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:VB}),YB=wi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(A,n){return"xml:"+n.slice(3).toLowerCase()}}),RQ={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"},OQ=/[A-Z]/g,XB=/-[a-z]/g,MQ=/^data[-\w.:]+$/i;function DQ(A,n){const r=Sc(n);let i=n,l=ut;if(r in A.normal)return A.property[A.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&MQ.test(n)){if(n.charAt(4)==="-"){const s=n.slice(5).replace(XB,KQ);i="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=n.slice(4);if(!XB.test(s)){let u=s.replace(OQ,kQ);u.charAt(0)!=="-"&&(u="-"+u),n="data"+u}}l=Hc}return new l(i,n)}function kQ(A){return"-"+A.toLowerCase()}function KQ(A){return A.charAt(1).toUpperCase()}const jQ=kB([jB,_Q,GB,PB,YB],"html"),Ic=kB([jB,LQ,GB,PB,YB],"svg");function zQ(A){return A.join(" ").trim()}var yi={},Nc,qB;function VQ(){if(qB)return Nc;qB=1;var A=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g,f=`
|
|
47
47
|
`,h="/",B="*",p="",m="comment",w="declaration";function E(F,U){if(typeof F!="string")throw new TypeError("First argument must be a string");if(!F)return[];U=U||{};var N=1,k=1;function $(nA){var rA=nA.match(n);rA&&(N+=rA.length);var K=nA.lastIndexOf(f);k=~K?nA.length-K:k+nA.length}function J(){var nA={line:N,column:k};return function(rA){return rA.position=new x(nA),D(),rA}}function x(nA){this.start=nA,this.end={line:N,column:k},this.source=U.source}x.prototype.content=F;function H(nA){var rA=new Error(U.source+":"+N+":"+k+": "+nA);if(rA.reason=nA,rA.filename=U.source,rA.line=N,rA.column=k,rA.source=F,!U.silent)throw rA}function L(nA){var rA=nA.exec(F);if(rA){var K=rA[0];return $(K),F=F.slice(K.length),rA}}function D(){L(r)}function Y(nA){var rA;for(nA=nA||[];rA=R();)rA!==!1&&nA.push(rA);return nA}function R(){var nA=J();if(!(h!=F.charAt(0)||B!=F.charAt(1))){for(var rA=2;p!=F.charAt(rA)&&(B!=F.charAt(rA)||h!=F.charAt(rA+1));)++rA;if(rA+=2,p===F.charAt(rA-1))return H("End of comment missing");var K=F.slice(2,rA-2);return k+=2,$(K),F=F.slice(rA),k+=2,nA({type:m,comment:K})}}function j(){var nA=J(),rA=L(i);if(rA){if(R(),!L(l))return H("property missing ':'");var K=L(s),q=nA({type:w,property:v(rA[0].replace(A,p)),value:K?v(K[0].replace(A,p)):p});return L(u),q}}function AA(){var nA=[];Y(nA);for(var rA;rA=j();)rA!==!1&&(nA.push(rA),Y(nA));return nA}return D(),AA()}function v(F){return F?F.replace(c,p):p}return Nc=E,Nc}var JB;function GQ(){if(JB)return yi;JB=1;var A=yi&&yi.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(yi,"__esModule",{value:!0}),yi.default=r;const n=A(VQ());function r(i,l){let s=null;if(!i||typeof i!="string")return s;const u=(0,n.default)(i),c=typeof l=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:h,value:B}=f;c?l(h,B,f):B&&(s=s||{},s[h]=B)}),s}return yi}var Ka={},ZB;function PQ(){if(ZB)return Ka;ZB=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.camelCase=void 0;var A=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,s=function(h){return!h||r.test(h)||A.test(h)},u=function(h,B){return B.toUpperCase()},c=function(h,B){return"".concat(B,"-")},f=function(h,B){return B===void 0&&(B={}),s(h)?h:(h=h.toLowerCase(),B.reactCompat?h=h.replace(l,c):h=h.replace(i,c),h.replace(n,u))};return Ka.camelCase=f,Ka}var ja,WB;function YQ(){if(WB)return ja;WB=1;var A=ja&&ja.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=A(GQ()),r=PQ();function i(l,s){var u={};return!l||typeof l!="string"||(0,n.default)(l,function(c,f){c&&f&&(u[(0,r.camelCase)(c,s)]=f)}),u}return i.default=i,ja=i,ja}var XQ=YQ();const qQ=Ku(XQ),$B=Ap("end"),_c=Ap("start");function Ap(A){return n;function n(r){const i=r&&r.position&&r.position[A]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function JQ(A){const n=_c(A),r=$B(A);if(n&&r)return{start:n,end:r}}function za(A){return!A||typeof A!="object"?"":"position"in A||"type"in A?ep(A.position):"start"in A||"end"in A?ep(A):"line"in A||"column"in A?Lc(A):""}function Lc(A){return tp(A&&A.line)+":"+tp(A&&A.column)}function ep(A){return Lc(A&&A.start)+"-"+Lc(A&&A.end)}function tp(A){return A&&typeof A=="number"?A:1}class At extends Error{constructor(n,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let l="",s={},u=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof n=="string"?l=n:!s.cause&&n&&(u=!0,l=n.message,s.cause=n),!s.ruleId&&!s.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?s.ruleId=i:(s.source=i.slice(0,f),s.ruleId=i.slice(f+1))}if(!s.place&&s.ancestors&&s.ancestors){const f=s.ancestors[s.ancestors.length-1];f&&(s.place=f.position)}const c=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=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=c?c.line:void 0,this.name=za(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=u&&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}}At.prototype.file="",At.prototype.name="",At.prototype.reason="",At.prototype.message="",At.prototype.stack="",At.prototype.column=void 0,At.prototype.line=void 0,At.prototype.ancestors=void 0,At.prototype.cause=void 0,At.prototype.fatal=void 0,At.prototype.place=void 0,At.prototype.ruleId=void 0,At.prototype.source=void 0;const Rc={}.hasOwnProperty,ZQ=new Map,WQ=/[A-Z]/g,$Q=new Set(["table","tbody","thead","tfoot","tr"]),Ab=new Set(["td","th"]),np="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function eb(A,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let i;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=ob(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=sb(r,n.jsx,n.jsxs)}const l={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:i,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Ic:jQ,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},s=rp(l,A,void 0);return s&&typeof s!="string"?s:l.create(A,l.Fragment,{children:s||void 0},void 0)}function rp(A,n,r){if(n.type==="element")return tb(A,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return nb(A,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return ib(A,n,r);if(n.type==="mdxjsEsm")return rb(A,n);if(n.type==="root")return ab(A,n,r);if(n.type==="text")return lb(A,n)}function tb(A,n,r){const i=A.schema;let l=i;n.tagName.toLowerCase()==="svg"&&i.space==="html"&&(l=Ic,A.schema=l),A.ancestors.push(n);const s=ap(A,n.tagName,!1),u=ub(A,n);let c=Mc(A,n);return $Q.has(n.tagName)&&(c=c.filter(function(f){return typeof f=="string"?!IQ(f):!0})),ip(A,u,s,n),Oc(u,c),A.ancestors.pop(),A.schema=i,A.create(n,s,u,r)}function nb(A,n){if(n.data&&n.data.estree&&A.evaluater){const i=n.data.estree.body[0];return A.evaluater.evaluateExpression(i.expression)}Va(A,n.position)}function rb(A,n){if(n.data&&n.data.estree&&A.evaluater)return A.evaluater.evaluateProgram(n.data.estree);Va(A,n.position)}function ib(A,n,r){const i=A.schema;let l=i;n.name==="svg"&&i.space==="html"&&(l=Ic,A.schema=l),A.ancestors.push(n);const s=n.name===null?A.Fragment:ap(A,n.name,!0),u=cb(A,n),c=Mc(A,n);return ip(A,u,s,n),Oc(u,c),A.ancestors.pop(),A.schema=i,A.create(n,s,u,r)}function ab(A,n,r){const i={};return Oc(i,Mc(A,n)),A.create(n,A.Fragment,i,r)}function lb(A,n){return n.value}function ip(A,n,r,i){typeof r!="string"&&r!==A.Fragment&&A.passNode&&(n.node=i)}function Oc(A,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(A.children=r)}}function sb(A,n,r){return i;function i(l,s,u,c){const h=Array.isArray(u.children)?r:n;return c?h(s,u,c):h(s,u)}}function ob(A,n){return r;function r(i,l,s,u){const c=Array.isArray(s.children),f=_c(i);return n(l,s,u,c,{columnNumber:f?f.column-1:void 0,fileName:A,lineNumber:f?f.line:void 0},void 0)}}function ub(A,n){const r={};let i,l;for(l in n.properties)if(l!=="children"&&Rc.call(n.properties,l)){const s=fb(A,l,n.properties[l]);if(s){const[u,c]=s;A.tableCellAlignToStyle&&u==="align"&&typeof c=="string"&&Ab.has(n.tagName)?i=c:r[u]=c}}if(i){const s=r.style||(r.style={});s[A.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function cb(A,n){const r={};for(const i of n.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&A.evaluater){const c=i.data.estree.body[0].expression.properties[0];Object.assign(r,A.evaluater.evaluateExpression(c.argument))}else Va(A,n.position);else{const l=i.name;let s;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&A.evaluater){const c=i.value.data.estree.body[0];s=A.evaluater.evaluateExpression(c.expression)}else Va(A,n.position);else s=i.value===null?!0:i.value;r[l]=s}return r}function Mc(A,n){const r=[];let i=-1;const l=A.passKeys?new Map:ZQ;for(;++i<n.children.length;){const s=n.children[i];let u;if(A.passKeys){const f=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(f){const h=l.get(f)||0;u=f+"-"+h,l.set(f,h+1)}}const c=rp(A,s,u);c!==void 0&&r.push(c)}return r}function fb(A,n,r){const i=DQ(A.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?SQ(r):zQ(r)),i.property==="style"){let l=typeof r=="object"?r:db(A,String(r));return A.stylePropertyNameCase==="css"&&(l=hb(l)),["style",l]}return[A.elementAttributeNameCase==="react"&&i.space?RQ[i.property]||i.property:i.attribute,r]}}function db(A,n){try{return qQ(n,{reactCompat:!0})}catch(r){if(A.ignoreInvalidStyle)return{};const i=r,l=new At("Cannot parse `style` attribute",{ancestors:A.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=A.filePath||void 0,l.url=np+"#cannot-parse-style-attribute",l}}function ap(A,n,r){let i;if(!r)i={type:"Literal",value:n};else if(n.includes(".")){const l=n.split(".");let s=-1,u;for(;++s<l.length;){const c=MB(l[s])?{type:"Identifier",name:l[s]}:{type:"Literal",value:l[s]};u=u?{type:"MemberExpression",object:u,property:c,computed:!!(s&&c.type==="Literal"),optional:!1}:c}i=u}else i=MB(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(i.type==="Literal"){const l=i.value;return Rc.call(A.components,l)?A.components[l]:l}if(A.evaluater)return A.evaluater.evaluateExpression(i);Va(A)}function Va(A,n){const r=new At("Cannot handle MDX estrees without `createEvaluater`",{ancestors:A.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=A.filePath||void 0,r.url=np+"#cannot-handle-mdx-estrees-without-createevaluater",r}function hb(A){const n={};let r;for(r in A)Rc.call(A,r)&&(n[gb(r)]=A[r]);return n}function gb(A){let n=A.replace(WQ,Bb);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function Bb(A){return"-"+A.toLowerCase()}const Dc={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"]},pb={};function mb(A,n){const r=pb,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return lp(A,i,l)}function lp(A,n,r){if(Cb(A)){if("value"in A)return A.type==="html"&&!r?"":A.value;if(n&&"alt"in A&&A.alt)return A.alt;if("children"in A)return sp(A.children,n,r)}return Array.isArray(A)?sp(A,n,r):""}function sp(A,n,r){const i=[];let l=-1;for(;++l<A.length;)i[l]=lp(A[l],n,r);return i.join("")}function Cb(A){return!!(A&&typeof A=="object")}const op=document.createElement("i");function kc(A){const n="&"+A+";";op.innerHTML=n;const r=op.textContent;return r.charCodeAt(r.length-1)===59&&A!=="semi"||r===n?!1:r}function on(A,n,r,i){const l=A.length;let s=0,u;if(n<0?n=-n>l?0:l+n:n=n>l?l:n,r=r>0?r:0,i.length<1e4)u=Array.from(i),u.unshift(n,r),A.splice(...u);else for(r&&A.splice(n,r);s<i.length;)u=i.slice(s,s+1e4),u.unshift(n,0),A.splice(...u),s+=1e4,n+=1e4}function Lt(A,n){return A.length>0?(on(A,A.length,0,n),A):n}const up={}.hasOwnProperty;function wb(A){const n={};let r=-1;for(;++r<A.length;)yb(n,A[r]);return n}function yb(A,n){let r;for(r in n){const l=(up.call(A,r)?A[r]:void 0)||(A[r]={}),s=n[r];let u;if(s)for(u in s){up.call(l,u)||(l[u]=[]);const c=s[u];Eb(l[u],Array.isArray(c)?c:c?[c]:[])}}}function Eb(A,n){let r=-1;const i=[];for(;++r<n.length;)(n[r].add==="after"?A:i).push(n[r]);on(A,0,0,i)}function cp(A,n){const r=Number.parseInt(A,n);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Ei(A){return A.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const un=$n(/[A-Za-z]/),Qt=$n(/[\dA-Za-z]/),vb=$n(/[#-'*+\--9=?A-Z^-~]/);function Kc(A){return A!==null&&(A<32||A===127)}const jc=$n(/\d/),Qb=$n(/[\dA-Fa-f]/),bb=$n(/[!-/:-@[-`{-~]/);function SA(A){return A!==null&&A<-2}function ct(A){return A!==null&&(A<0||A===32)}function VA(A){return A===-2||A===-1||A===32}const Ub=$n(new RegExp("\\p{P}|\\p{S}","u")),Sb=$n(/\s/);function $n(A){return n;function n(r){return r!==null&&r>-1&&A.test(String.fromCharCode(r))}}function vi(A){const n=[];let r=-1,i=0,l=0;for(;++r<A.length;){const s=A.charCodeAt(r);let u="";if(s===37&&Qt(A.charCodeAt(r+1))&&Qt(A.charCodeAt(r+2)))l=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(u=String.fromCharCode(s));else if(s>55295&&s<57344){const c=A.charCodeAt(r+1);s<56320&&c>56319&&c<57344?(u=String.fromCharCode(s,c),l=1):u="�"}else u=String.fromCharCode(s);u&&(n.push(A.slice(i,r),encodeURIComponent(u)),i=r+l+1,u=""),l&&(r+=l,l=0)}return n.join("")+A.slice(i)}function se(A,n,r,i){const l=i?i-1:Number.POSITIVE_INFINITY;let s=0;return u;function u(f){return VA(f)?(A.enter(r),c(f)):n(f)}function c(f){return VA(f)&&s++<l?(A.consume(f),c):(A.exit(r),n(f))}}const xb={tokenize:Fb};function Fb(A){const n=A.attempt(this.parser.constructs.contentInitial,i,l);let r;return n;function i(c){if(c===null){A.consume(c);return}return A.enter("lineEnding"),A.consume(c),A.exit("lineEnding"),se(A,n,"linePrefix")}function l(c){return A.enter("paragraph"),s(c)}function s(c){const f=A.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=f),r=f,u(c)}function u(c){if(c===null){A.exit("chunkText"),A.exit("paragraph"),A.consume(c);return}return SA(c)?(A.consume(c),A.exit("chunkText"),s):(A.consume(c),u)}}const Tb={tokenize:Hb},fp={tokenize:Ib};function Hb(A){const n=this,r=[];let i=0,l,s,u;return c;function c(k){if(i<r.length){const $=r[i];return n.containerState=$[1],A.attempt($[0].continuation,f,h)(k)}return h(k)}function f(k){if(i++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&N();const $=n.events.length;let J=$,x;for(;J--;)if(n.events[J][0]==="exit"&&n.events[J][1].type==="chunkFlow"){x=n.events[J][1].end;break}U(i);let H=$;for(;H<n.events.length;)n.events[H][1].end={...x},H++;return on(n.events,J+1,0,n.events.slice($)),n.events.length=H,h(k)}return c(k)}function h(k){if(i===r.length){if(!l)return m(k);if(l.currentConstruct&&l.currentConstruct.concrete)return E(k);n.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return n.containerState={},A.check(fp,B,p)(k)}function B(k){return l&&N(),U(i),m(k)}function p(k){return n.parser.lazy[n.now().line]=i!==r.length,u=n.now().offset,E(k)}function m(k){return n.containerState={},A.attempt(fp,w,E)(k)}function w(k){return i++,r.push([n.currentConstruct,n.containerState]),m(k)}function E(k){if(k===null){l&&N(),U(0),A.consume(k);return}return l=l||n.parser.flow(n.now()),A.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:s}),v(k)}function v(k){if(k===null){F(A.exit("chunkFlow"),!0),U(0),A.consume(k);return}return SA(k)?(A.consume(k),F(A.exit("chunkFlow")),i=0,n.interrupt=void 0,c):(A.consume(k),v)}function F(k,$){const J=n.sliceStream(k);if($&&J.push(null),k.previous=s,s&&(s.next=k),s=k,l.defineSkip(k.start),l.write(J),n.parser.lazy[k.start.line]){let x=l.events.length;for(;x--;)if(l.events[x][1].start.offset<u&&(!l.events[x][1].end||l.events[x][1].end.offset>u))return;const H=n.events.length;let L=H,D,Y;for(;L--;)if(n.events[L][0]==="exit"&&n.events[L][1].type==="chunkFlow"){if(D){Y=n.events[L][1].end;break}D=!0}for(U(i),x=H;x<n.events.length;)n.events[x][1].end={...Y},x++;on(n.events,L+1,0,n.events.slice(H)),n.events.length=x}}function U(k){let $=r.length;for(;$-- >k;){const J=r[$];n.containerState=J[1],J[0].exit.call(n,A)}r.length=k}function N(){l.write([null]),s=void 0,l=void 0,n.containerState._closeFlow=void 0}}function Ib(A,n,r){return se(A,A.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function dp(A){if(A===null||ct(A)||Sb(A))return 1;if(Ub(A))return 2}function zc(A,n,r){const i=[];let l=-1;for(;++l<A.length;){const s=A[l].resolveAll;s&&!i.includes(s)&&(n=s(n,r),i.push(s))}return n}const Vc={name:"attention",resolveAll:Nb,tokenize:_b};function Nb(A,n){let r=-1,i,l,s,u,c,f,h,B;for(;++r<A.length;)if(A[r][0]==="enter"&&A[r][1].type==="attentionSequence"&&A[r][1]._close){for(i=r;i--;)if(A[i][0]==="exit"&&A[i][1].type==="attentionSequence"&&A[i][1]._open&&n.sliceSerialize(A[i][1]).charCodeAt(0)===n.sliceSerialize(A[r][1]).charCodeAt(0)){if((A[i][1]._close||A[r][1]._open)&&(A[r][1].end.offset-A[r][1].start.offset)%3&&!((A[i][1].end.offset-A[i][1].start.offset+A[r][1].end.offset-A[r][1].start.offset)%3))continue;f=A[i][1].end.offset-A[i][1].start.offset>1&&A[r][1].end.offset-A[r][1].start.offset>1?2:1;const p={...A[i][1].end},m={...A[r][1].start};hp(p,-f),hp(m,f),u={type:f>1?"strongSequence":"emphasisSequence",start:p,end:{...A[i][1].end}},c={type:f>1?"strongSequence":"emphasisSequence",start:{...A[r][1].start},end:m},s={type:f>1?"strongText":"emphasisText",start:{...A[i][1].end},end:{...A[r][1].start}},l={type:f>1?"strong":"emphasis",start:{...u.start},end:{...c.end}},A[i][1].end={...u.start},A[r][1].start={...c.end},h=[],A[i][1].end.offset-A[i][1].start.offset&&(h=Lt(h,[["enter",A[i][1],n],["exit",A[i][1],n]])),h=Lt(h,[["enter",l,n],["enter",u,n],["exit",u,n],["enter",s,n]]),h=Lt(h,zc(n.parser.constructs.insideSpan.null,A.slice(i+1,r),n)),h=Lt(h,[["exit",s,n],["enter",c,n],["exit",c,n],["exit",l,n]]),A[r][1].end.offset-A[r][1].start.offset?(B=2,h=Lt(h,[["enter",A[r][1],n],["exit",A[r][1],n]])):B=0,on(A,i-1,r-i+3,h),r=i+h.length-B-2;break}}for(r=-1;++r<A.length;)A[r][1].type==="attentionSequence"&&(A[r][1].type="data");return A}function _b(A,n){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,l=dp(i);let s;return u;function u(f){return s=f,A.enter("attentionSequence"),c(f)}function c(f){if(f===s)return A.consume(f),c;const h=A.exit("attentionSequence"),B=dp(f),p=!B||B===2&&l||r.includes(f),m=!l||l===2&&B||r.includes(i);return h._open=!!(s===42?p:p&&(l||!m)),h._close=!!(s===42?m:m&&(B||!p)),n(f)}}function hp(A,n){A.column+=n,A.offset+=n,A._bufferIndex+=n}const Lb={name:"autolink",tokenize:Rb};function Rb(A,n,r){let i=0;return l;function l(w){return A.enter("autolink"),A.enter("autolinkMarker"),A.consume(w),A.exit("autolinkMarker"),A.enter("autolinkProtocol"),s}function s(w){return un(w)?(A.consume(w),u):w===64?r(w):h(w)}function u(w){return w===43||w===45||w===46||Qt(w)?(i=1,c(w)):h(w)}function c(w){return w===58?(A.consume(w),i=0,f):(w===43||w===45||w===46||Qt(w))&&i++<32?(A.consume(w),c):(i=0,h(w))}function f(w){return w===62?(A.exit("autolinkProtocol"),A.enter("autolinkMarker"),A.consume(w),A.exit("autolinkMarker"),A.exit("autolink"),n):w===null||w===32||w===60||Kc(w)?r(w):(A.consume(w),f)}function h(w){return w===64?(A.consume(w),B):vb(w)?(A.consume(w),h):r(w)}function B(w){return Qt(w)?p(w):r(w)}function p(w){return w===46?(A.consume(w),i=0,B):w===62?(A.exit("autolinkProtocol").type="autolinkEmail",A.enter("autolinkMarker"),A.consume(w),A.exit("autolinkMarker"),A.exit("autolink"),n):m(w)}function m(w){if((w===45||Qt(w))&&i++<63){const E=w===45?m:p;return A.consume(w),E}return r(w)}}const vs={partial:!0,tokenize:Ob};function Ob(A,n,r){return i;function i(s){return VA(s)?se(A,l,"linePrefix")(s):l(s)}function l(s){return s===null||SA(s)?n(s):r(s)}}const gp={continuation:{tokenize:Db},exit:kb,name:"blockQuote",tokenize:Mb};function Mb(A,n,r){const i=this;return l;function l(u){if(u===62){const c=i.containerState;return c.open||(A.enter("blockQuote",{_container:!0}),c.open=!0),A.enter("blockQuotePrefix"),A.enter("blockQuoteMarker"),A.consume(u),A.exit("blockQuoteMarker"),s}return r(u)}function s(u){return VA(u)?(A.enter("blockQuotePrefixWhitespace"),A.consume(u),A.exit("blockQuotePrefixWhitespace"),A.exit("blockQuotePrefix"),n):(A.exit("blockQuotePrefix"),n(u))}}function Db(A,n,r){const i=this;return l;function l(u){return VA(u)?se(A,s,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):s(u)}function s(u){return A.attempt(gp,n,r)(u)}}function kb(A){A.exit("blockQuote")}const Bp={name:"characterEscape",tokenize:Kb};function Kb(A,n,r){return i;function i(s){return A.enter("characterEscape"),A.enter("escapeMarker"),A.consume(s),A.exit("escapeMarker"),l}function l(s){return bb(s)?(A.enter("characterEscapeValue"),A.consume(s),A.exit("characterEscapeValue"),A.exit("characterEscape"),n):r(s)}}const pp={name:"characterReference",tokenize:jb};function jb(A,n,r){const i=this;let l=0,s,u;return c;function c(p){return A.enter("characterReference"),A.enter("characterReferenceMarker"),A.consume(p),A.exit("characterReferenceMarker"),f}function f(p){return p===35?(A.enter("characterReferenceMarkerNumeric"),A.consume(p),A.exit("characterReferenceMarkerNumeric"),h):(A.enter("characterReferenceValue"),s=31,u=Qt,B(p))}function h(p){return p===88||p===120?(A.enter("characterReferenceMarkerHexadecimal"),A.consume(p),A.exit("characterReferenceMarkerHexadecimal"),A.enter("characterReferenceValue"),s=6,u=Qb,B):(A.enter("characterReferenceValue"),s=7,u=jc,B(p))}function B(p){if(p===59&&l){const m=A.exit("characterReferenceValue");return u===Qt&&!kc(i.sliceSerialize(m))?r(p):(A.enter("characterReferenceMarker"),A.consume(p),A.exit("characterReferenceMarker"),A.exit("characterReference"),n)}return u(p)&&l++<s?(A.consume(p),B):r(p)}}const mp={partial:!0,tokenize:Vb},Cp={concrete:!0,name:"codeFenced",tokenize:zb};function zb(A,n,r){const i=this,l={partial:!0,tokenize:J};let s=0,u=0,c;return f;function f(x){return h(x)}function h(x){const H=i.events[i.events.length-1];return s=H&&H[1].type==="linePrefix"?H[2].sliceSerialize(H[1],!0).length:0,c=x,A.enter("codeFenced"),A.enter("codeFencedFence"),A.enter("codeFencedFenceSequence"),B(x)}function B(x){return x===c?(u++,A.consume(x),B):u<3?r(x):(A.exit("codeFencedFenceSequence"),VA(x)?se(A,p,"whitespace")(x):p(x))}function p(x){return x===null||SA(x)?(A.exit("codeFencedFence"),i.interrupt?n(x):A.check(mp,v,$)(x)):(A.enter("codeFencedFenceInfo"),A.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||SA(x)?(A.exit("chunkString"),A.exit("codeFencedFenceInfo"),p(x)):VA(x)?(A.exit("chunkString"),A.exit("codeFencedFenceInfo"),se(A,w,"whitespace")(x)):x===96&&x===c?r(x):(A.consume(x),m)}function w(x){return x===null||SA(x)?p(x):(A.enter("codeFencedFenceMeta"),A.enter("chunkString",{contentType:"string"}),E(x))}function E(x){return x===null||SA(x)?(A.exit("chunkString"),A.exit("codeFencedFenceMeta"),p(x)):x===96&&x===c?r(x):(A.consume(x),E)}function v(x){return A.attempt(l,$,F)(x)}function F(x){return A.enter("lineEnding"),A.consume(x),A.exit("lineEnding"),U}function U(x){return s>0&&VA(x)?se(A,N,"linePrefix",s+1)(x):N(x)}function N(x){return x===null||SA(x)?A.check(mp,v,$)(x):(A.enter("codeFlowValue"),k(x))}function k(x){return x===null||SA(x)?(A.exit("codeFlowValue"),N(x)):(A.consume(x),k)}function $(x){return A.exit("codeFenced"),n(x)}function J(x,H,L){let D=0;return Y;function Y(rA){return x.enter("lineEnding"),x.consume(rA),x.exit("lineEnding"),R}function R(rA){return x.enter("codeFencedFence"),VA(rA)?se(x,j,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(rA):j(rA)}function j(rA){return rA===c?(x.enter("codeFencedFenceSequence"),AA(rA)):L(rA)}function AA(rA){return rA===c?(D++,x.consume(rA),AA):D>=u?(x.exit("codeFencedFenceSequence"),VA(rA)?se(x,nA,"whitespace")(rA):nA(rA)):L(rA)}function nA(rA){return rA===null||SA(rA)?(x.exit("codeFencedFence"),H(rA)):L(rA)}}}function Vb(A,n,r){const i=this;return l;function l(u){return u===null?r(u):(A.enter("lineEnding"),A.consume(u),A.exit("lineEnding"),s)}function s(u){return i.parser.lazy[i.now().line]?r(u):n(u)}}const Gc={name:"codeIndented",tokenize:Pb},Gb={partial:!0,tokenize:Yb};function Pb(A,n,r){const i=this;return l;function l(h){return A.enter("codeIndented"),se(A,s,"linePrefix",5)(h)}function s(h){const B=i.events[i.events.length-1];return B&&B[1].type==="linePrefix"&&B[2].sliceSerialize(B[1],!0).length>=4?u(h):r(h)}function u(h){return h===null?f(h):SA(h)?A.attempt(Gb,u,f)(h):(A.enter("codeFlowValue"),c(h))}function c(h){return h===null||SA(h)?(A.exit("codeFlowValue"),u(h)):(A.consume(h),c)}function f(h){return A.exit("codeIndented"),n(h)}}function Yb(A,n,r){const i=this;return l;function l(u){return i.parser.lazy[i.now().line]?r(u):SA(u)?(A.enter("lineEnding"),A.consume(u),A.exit("lineEnding"),l):se(A,s,"linePrefix",5)(u)}function s(u){const c=i.events[i.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?n(u):SA(u)?l(u):r(u)}}const Xb={name:"codeText",previous:Jb,resolve:qb,tokenize:Zb};function qb(A){let n=A.length-4,r=3,i,l;if((A[r][1].type==="lineEnding"||A[r][1].type==="space")&&(A[n][1].type==="lineEnding"||A[n][1].type==="space")){for(i=r;++i<n;)if(A[i][1].type==="codeTextData"){A[r][1].type="codeTextPadding",A[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(i=r-1,n++;++i<=n;)l===void 0?i!==n&&A[i][1].type!=="lineEnding"&&(l=i):(i===n||A[i][1].type==="lineEnding")&&(A[l][1].type="codeTextData",i!==l+2&&(A[l][1].end=A[i-1][1].end,A.splice(l+2,i-l-2),n-=i-l-2,i=l+2),l=void 0);return A}function Jb(A){return A!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Zb(A,n,r){let i=0,l,s;return u;function u(p){return A.enter("codeText"),A.enter("codeTextSequence"),c(p)}function c(p){return p===96?(A.consume(p),i++,c):(A.exit("codeTextSequence"),f(p))}function f(p){return p===null?r(p):p===32?(A.enter("space"),A.consume(p),A.exit("space"),f):p===96?(s=A.enter("codeTextSequence"),l=0,B(p)):SA(p)?(A.enter("lineEnding"),A.consume(p),A.exit("lineEnding"),f):(A.enter("codeTextData"),h(p))}function h(p){return p===null||p===32||p===96||SA(p)?(A.exit("codeTextData"),f(p)):(A.consume(p),h)}function B(p){return p===96?(A.consume(p),l++,B):l===i?(A.exit("codeTextSequence"),A.exit("codeText"),n(p)):(s.type="codeTextData",h(p))}}class Wb{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const i=r??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(n,i):n>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(n,r,i){const l=r||0;this.setCursor(Math.trunc(n));const s=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return i&&Ga(this.left,i),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),Ga(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),Ga(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const r=this.left.splice(n,Number.POSITIVE_INFINITY);Ga(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);Ga(this.left,r.reverse())}}}function Ga(A,n){let r=0;if(n.length<1e4)A.push(...n);else for(;r<n.length;)A.push(...n.slice(r,r+1e4)),r+=1e4}function wp(A){const n={};let r=-1,i,l,s,u,c,f,h;const B=new Wb(A);for(;++r<B.length;){for(;r in n;)r=n[r];if(i=B.get(r),r&&i[1].type==="chunkFlow"&&B.get(r-1)[1].type==="listItemPrefix"&&(f=i[1]._tokenizer.events,s=0,s<f.length&&f[s][1].type==="lineEndingBlank"&&(s+=2),s<f.length&&f[s][1].type==="content"))for(;++s<f.length&&f[s][1].type!=="content";)f[s][1].type==="chunkText"&&(f[s][1]._isInFirstContentOfListItem=!0,s++);if(i[0]==="enter")i[1].contentType&&(Object.assign(n,$b(B,r)),r=n[r],h=!0);else if(i[1]._container){for(s=r,l=void 0;s--;)if(u=B.get(s),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(l&&(B.get(l)[1].type="lineEndingBlank"),u[1].type="lineEnding",l=s);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;l&&(i[1].end={...B.get(l)[1].start},c=B.slice(l,r),c.unshift(i),B.splice(l,r-l+1,c))}}return on(A,0,Number.POSITIVE_INFINITY,B.slice(0)),!h}function $b(A,n){const r=A.get(n)[1],i=A.get(n)[2];let l=n-1;const s=[];let u=r._tokenizer;u||(u=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const c=u.events,f=[],h={};let B,p,m=-1,w=r,E=0,v=0;const F=[v];for(;w;){for(;A.get(++l)[1]!==w;);s.push(l),w._tokenizer||(B=i.sliceStream(w),w.next||B.push(null),p&&u.defineSkip(w.start),w._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(B),w._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),p=w,w=w.next}for(w=r;++m<c.length;)c[m][0]==="exit"&&c[m-1][0]==="enter"&&c[m][1].type===c[m-1][1].type&&c[m][1].start.line!==c[m][1].end.line&&(v=m+1,F.push(v),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(u.events=[],w?(w._tokenizer=void 0,w.previous=void 0):F.pop(),m=F.length;m--;){const U=c.slice(F[m],F[m+1]),N=s.pop();f.push([N,N+U.length-1]),A.splice(N,2,U)}for(f.reverse(),m=-1;++m<f.length;)h[E+f[m][0]]=E+f[m][1],E+=f[m][1]-f[m][0]-1;return h}const AU={resolve:tU,tokenize:nU},eU={partial:!0,tokenize:rU};function tU(A){return wp(A),A}function nU(A,n){let r;return i;function i(c){return A.enter("content"),r=A.enter("chunkContent",{contentType:"content"}),l(c)}function l(c){return c===null?s(c):SA(c)?A.check(eU,u,s)(c):(A.consume(c),l)}function s(c){return A.exit("chunkContent"),A.exit("content"),n(c)}function u(c){return A.consume(c),A.exit("chunkContent"),r.next=A.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,l}}function rU(A,n,r){const i=this;return l;function l(u){return A.exit("chunkContent"),A.enter("lineEnding"),A.consume(u),A.exit("lineEnding"),se(A,s,"linePrefix")}function s(u){if(u===null||SA(u))return r(u);const c=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?n(u):A.interrupt(i.parser.constructs.flow,r,n)(u)}}function yp(A,n,r,i,l,s,u,c,f){const h=f||Number.POSITIVE_INFINITY;let B=0;return p;function p(U){return U===60?(A.enter(i),A.enter(l),A.enter(s),A.consume(U),A.exit(s),m):U===null||U===32||U===41||Kc(U)?r(U):(A.enter(i),A.enter(u),A.enter(c),A.enter("chunkString",{contentType:"string"}),v(U))}function m(U){return U===62?(A.enter(s),A.consume(U),A.exit(s),A.exit(l),A.exit(i),n):(A.enter(c),A.enter("chunkString",{contentType:"string"}),w(U))}function w(U){return U===62?(A.exit("chunkString"),A.exit(c),m(U)):U===null||U===60||SA(U)?r(U):(A.consume(U),U===92?E:w)}function E(U){return U===60||U===62||U===92?(A.consume(U),w):w(U)}function v(U){return!B&&(U===null||U===41||ct(U))?(A.exit("chunkString"),A.exit(c),A.exit(u),A.exit(i),n(U)):B<h&&U===40?(A.consume(U),B++,v):U===41?(A.consume(U),B--,v):U===null||U===32||U===40||Kc(U)?r(U):(A.consume(U),U===92?F:v)}function F(U){return U===40||U===41||U===92?(A.consume(U),v):v(U)}}function Ep(A,n,r,i,l,s){const u=this;let c=0,f;return h;function h(w){return A.enter(i),A.enter(l),A.consume(w),A.exit(l),A.enter(s),B}function B(w){return c>999||w===null||w===91||w===93&&!f||w===94&&!c&&"_hiddenFootnoteSupport"in u.parser.constructs?r(w):w===93?(A.exit(s),A.enter(l),A.consume(w),A.exit(l),A.exit(i),n):SA(w)?(A.enter("lineEnding"),A.consume(w),A.exit("lineEnding"),B):(A.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||w===91||w===93||SA(w)||c++>999?(A.exit("chunkString"),B(w)):(A.consume(w),f||(f=!VA(w)),w===92?m:p)}function m(w){return w===91||w===92||w===93?(A.consume(w),c++,p):p(w)}}function vp(A,n,r,i,l,s){let u;return c;function c(m){return m===34||m===39||m===40?(A.enter(i),A.enter(l),A.consume(m),A.exit(l),u=m===40?41:m,f):r(m)}function f(m){return m===u?(A.enter(l),A.consume(m),A.exit(l),A.exit(i),n):(A.enter(s),h(m))}function h(m){return m===u?(A.exit(s),f(u)):m===null?r(m):SA(m)?(A.enter("lineEnding"),A.consume(m),A.exit("lineEnding"),se(A,h,"linePrefix")):(A.enter("chunkString",{contentType:"string"}),B(m))}function B(m){return m===u||m===null||SA(m)?(A.exit("chunkString"),h(m)):(A.consume(m),m===92?p:B)}function p(m){return m===u||m===92?(A.consume(m),B):B(m)}}function Pa(A,n){let r;return i;function i(l){return SA(l)?(A.enter("lineEnding"),A.consume(l),A.exit("lineEnding"),r=!0,i):VA(l)?se(A,i,r?"linePrefix":"lineSuffix")(l):n(l)}}const iU={name:"definition",tokenize:lU},aU={partial:!0,tokenize:sU};function lU(A,n,r){const i=this;let l;return s;function s(w){return A.enter("definition"),u(w)}function u(w){return Ep.call(i,A,c,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function c(w){return l=Ei(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),w===58?(A.enter("definitionMarker"),A.consume(w),A.exit("definitionMarker"),f):r(w)}function f(w){return ct(w)?Pa(A,h)(w):h(w)}function h(w){return yp(A,B,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function B(w){return A.attempt(aU,p,p)(w)}function p(w){return VA(w)?se(A,m,"whitespace")(w):m(w)}function m(w){return w===null||SA(w)?(A.exit("definition"),i.parser.defined.push(l),n(w)):r(w)}}function sU(A,n,r){return i;function i(c){return ct(c)?Pa(A,l)(c):r(c)}function l(c){return vp(A,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return VA(c)?se(A,u,"whitespace")(c):u(c)}function u(c){return c===null||SA(c)?n(c):r(c)}}const oU={name:"hardBreakEscape",tokenize:uU};function uU(A,n,r){return i;function i(s){return A.enter("hardBreakEscape"),A.consume(s),l}function l(s){return SA(s)?(A.exit("hardBreakEscape"),n(s)):r(s)}}const cU={name:"headingAtx",resolve:fU,tokenize:dU};function fU(A,n){let r=A.length-2,i=3,l,s;return A[i][1].type==="whitespace"&&(i+=2),r-2>i&&A[r][1].type==="whitespace"&&(r-=2),A[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&A[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(l={type:"atxHeadingText",start:A[i][1].start,end:A[r][1].end},s={type:"chunkText",start:A[i][1].start,end:A[r][1].end,contentType:"text"},on(A,i,r-i+1,[["enter",l,n],["enter",s,n],["exit",s,n],["exit",l,n]])),A}function dU(A,n,r){let i=0;return l;function l(B){return A.enter("atxHeading"),s(B)}function s(B){return A.enter("atxHeadingSequence"),u(B)}function u(B){return B===35&&i++<6?(A.consume(B),u):B===null||ct(B)?(A.exit("atxHeadingSequence"),c(B)):r(B)}function c(B){return B===35?(A.enter("atxHeadingSequence"),f(B)):B===null||SA(B)?(A.exit("atxHeading"),n(B)):VA(B)?se(A,c,"whitespace")(B):(A.enter("atxHeadingText"),h(B))}function f(B){return B===35?(A.consume(B),f):(A.exit("atxHeadingSequence"),c(B))}function h(B){return B===null||B===35||ct(B)?(A.exit("atxHeadingText"),c(B)):(A.consume(B),h)}}const hU=["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"],Qp=["pre","script","style","textarea"],gU={concrete:!0,name:"htmlFlow",resolveTo:mU,tokenize:CU},BU={partial:!0,tokenize:yU},pU={partial:!0,tokenize:wU};function mU(A){let n=A.length;for(;n--&&!(A[n][0]==="enter"&&A[n][1].type==="htmlFlow"););return n>1&&A[n-2][1].type==="linePrefix"&&(A[n][1].start=A[n-2][1].start,A[n+1][1].start=A[n-2][1].start,A.splice(n-2,2)),A}function CU(A,n,r){const i=this;let l,s,u,c,f;return h;function h(b){return B(b)}function B(b){return A.enter("htmlFlow"),A.enter("htmlFlowData"),A.consume(b),p}function p(b){return b===33?(A.consume(b),m):b===47?(A.consume(b),s=!0,v):b===63?(A.consume(b),l=3,i.interrupt?n:T):un(b)?(A.consume(b),u=String.fromCharCode(b),F):r(b)}function m(b){return b===45?(A.consume(b),l=2,w):b===91?(A.consume(b),l=5,c=0,E):un(b)?(A.consume(b),l=4,i.interrupt?n:T):r(b)}function w(b){return b===45?(A.consume(b),i.interrupt?n:T):r(b)}function E(b){const lA="CDATA[";return b===lA.charCodeAt(c++)?(A.consume(b),c===lA.length?i.interrupt?n:j:E):r(b)}function v(b){return un(b)?(A.consume(b),u=String.fromCharCode(b),F):r(b)}function F(b){if(b===null||b===47||b===62||ct(b)){const lA=b===47,fA=u.toLowerCase();return!lA&&!s&&Qp.includes(fA)?(l=1,i.interrupt?n(b):j(b)):hU.includes(u.toLowerCase())?(l=6,lA?(A.consume(b),U):i.interrupt?n(b):j(b)):(l=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(b):s?N(b):k(b))}return b===45||Qt(b)?(A.consume(b),u+=String.fromCharCode(b),F):r(b)}function U(b){return b===62?(A.consume(b),i.interrupt?n:j):r(b)}function N(b){return VA(b)?(A.consume(b),N):Y(b)}function k(b){return b===47?(A.consume(b),Y):b===58||b===95||un(b)?(A.consume(b),$):VA(b)?(A.consume(b),k):Y(b)}function $(b){return b===45||b===46||b===58||b===95||Qt(b)?(A.consume(b),$):J(b)}function J(b){return b===61?(A.consume(b),x):VA(b)?(A.consume(b),J):k(b)}function x(b){return b===null||b===60||b===61||b===62||b===96?r(b):b===34||b===39?(A.consume(b),f=b,H):VA(b)?(A.consume(b),x):L(b)}function H(b){return b===f?(A.consume(b),f=null,D):b===null||SA(b)?r(b):(A.consume(b),H)}function L(b){return b===null||b===34||b===39||b===47||b===60||b===61||b===62||b===96||ct(b)?J(b):(A.consume(b),L)}function D(b){return b===47||b===62||VA(b)?k(b):r(b)}function Y(b){return b===62?(A.consume(b),R):r(b)}function R(b){return b===null||SA(b)?j(b):VA(b)?(A.consume(b),R):r(b)}function j(b){return b===45&&l===2?(A.consume(b),K):b===60&&l===1?(A.consume(b),q):b===62&&l===4?(A.consume(b),I):b===63&&l===3?(A.consume(b),T):b===93&&l===5?(A.consume(b),sA):SA(b)&&(l===6||l===7)?(A.exit("htmlFlowData"),A.check(BU,X,AA)(b)):b===null||SA(b)?(A.exit("htmlFlowData"),AA(b)):(A.consume(b),j)}function AA(b){return A.check(pU,nA,X)(b)}function nA(b){return A.enter("lineEnding"),A.consume(b),A.exit("lineEnding"),rA}function rA(b){return b===null||SA(b)?AA(b):(A.enter("htmlFlowData"),j(b))}function K(b){return b===45?(A.consume(b),T):j(b)}function q(b){return b===47?(A.consume(b),u="",eA):j(b)}function eA(b){if(b===62){const lA=u.toLowerCase();return Qp.includes(lA)?(A.consume(b),I):j(b)}return un(b)&&u.length<8?(A.consume(b),u+=String.fromCharCode(b),eA):j(b)}function sA(b){return b===93?(A.consume(b),T):j(b)}function T(b){return b===62?(A.consume(b),I):b===45&&l===2?(A.consume(b),T):j(b)}function I(b){return b===null||SA(b)?(A.exit("htmlFlowData"),X(b)):(A.consume(b),I)}function X(b){return A.exit("htmlFlow"),n(b)}}function wU(A,n,r){const i=this;return l;function l(u){return SA(u)?(A.enter("lineEnding"),A.consume(u),A.exit("lineEnding"),s):r(u)}function s(u){return i.parser.lazy[i.now().line]?r(u):n(u)}}function yU(A,n,r){return i;function i(l){return A.enter("lineEnding"),A.consume(l),A.exit("lineEnding"),A.attempt(vs,n,r)}}const EU={name:"htmlText",tokenize:vU};function vU(A,n,r){const i=this;let l,s,u;return c;function c(T){return A.enter("htmlText"),A.enter("htmlTextData"),A.consume(T),f}function f(T){return T===33?(A.consume(T),h):T===47?(A.consume(T),J):T===63?(A.consume(T),k):un(T)?(A.consume(T),L):r(T)}function h(T){return T===45?(A.consume(T),B):T===91?(A.consume(T),s=0,E):un(T)?(A.consume(T),N):r(T)}function B(T){return T===45?(A.consume(T),w):r(T)}function p(T){return T===null?r(T):T===45?(A.consume(T),m):SA(T)?(u=p,q(T)):(A.consume(T),p)}function m(T){return T===45?(A.consume(T),w):p(T)}function w(T){return T===62?K(T):T===45?m(T):p(T)}function E(T){const I="CDATA[";return T===I.charCodeAt(s++)?(A.consume(T),s===I.length?v:E):r(T)}function v(T){return T===null?r(T):T===93?(A.consume(T),F):SA(T)?(u=v,q(T)):(A.consume(T),v)}function F(T){return T===93?(A.consume(T),U):v(T)}function U(T){return T===62?K(T):T===93?(A.consume(T),U):v(T)}function N(T){return T===null||T===62?K(T):SA(T)?(u=N,q(T)):(A.consume(T),N)}function k(T){return T===null?r(T):T===63?(A.consume(T),$):SA(T)?(u=k,q(T)):(A.consume(T),k)}function $(T){return T===62?K(T):k(T)}function J(T){return un(T)?(A.consume(T),x):r(T)}function x(T){return T===45||Qt(T)?(A.consume(T),x):H(T)}function H(T){return SA(T)?(u=H,q(T)):VA(T)?(A.consume(T),H):K(T)}function L(T){return T===45||Qt(T)?(A.consume(T),L):T===47||T===62||ct(T)?D(T):r(T)}function D(T){return T===47?(A.consume(T),K):T===58||T===95||un(T)?(A.consume(T),Y):SA(T)?(u=D,q(T)):VA(T)?(A.consume(T),D):K(T)}function Y(T){return T===45||T===46||T===58||T===95||Qt(T)?(A.consume(T),Y):R(T)}function R(T){return T===61?(A.consume(T),j):SA(T)?(u=R,q(T)):VA(T)?(A.consume(T),R):D(T)}function j(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(A.consume(T),l=T,AA):SA(T)?(u=j,q(T)):VA(T)?(A.consume(T),j):(A.consume(T),nA)}function AA(T){return T===l?(A.consume(T),l=void 0,rA):T===null?r(T):SA(T)?(u=AA,q(T)):(A.consume(T),AA)}function nA(T){return T===null||T===34||T===39||T===60||T===61||T===96?r(T):T===47||T===62||ct(T)?D(T):(A.consume(T),nA)}function rA(T){return T===47||T===62||ct(T)?D(T):r(T)}function K(T){return T===62?(A.consume(T),A.exit("htmlTextData"),A.exit("htmlText"),n):r(T)}function q(T){return A.exit("htmlTextData"),A.enter("lineEnding"),A.consume(T),A.exit("lineEnding"),eA}function eA(T){return VA(T)?se(A,sA,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):sA(T)}function sA(T){return A.enter("htmlTextData"),u(T)}}const Pc={name:"labelEnd",resolveAll:SU,resolveTo:xU,tokenize:FU},QU={tokenize:TU},bU={tokenize:HU},UU={tokenize:IU};function SU(A){let n=-1;const r=[];for(;++n<A.length;){const i=A[n][1];if(r.push(A[n]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const l=i.type==="labelImage"?4:2;i.type="data",n+=l}}return A.length!==r.length&&on(A,0,A.length,r),A}function xU(A,n){let r=A.length,i=0,l,s,u,c;for(;r--;)if(l=A[r][1],s){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;A[r][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(u){if(A[r][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(s=r,l.type!=="labelLink")){i=2;break}}else l.type==="labelEnd"&&(u=r);const f={type:A[s][1].type==="labelLink"?"link":"image",start:{...A[s][1].start},end:{...A[A.length-1][1].end}},h={type:"label",start:{...A[s][1].start},end:{...A[u][1].end}},B={type:"labelText",start:{...A[s+i+2][1].end},end:{...A[u-2][1].start}};return c=[["enter",f,n],["enter",h,n]],c=Lt(c,A.slice(s+1,s+i+3)),c=Lt(c,[["enter",B,n]]),c=Lt(c,zc(n.parser.constructs.insideSpan.null,A.slice(s+i+4,u-3),n)),c=Lt(c,[["exit",B,n],A[u-2],A[u-1],["exit",h,n]]),c=Lt(c,A.slice(u+1)),c=Lt(c,[["exit",f,n]]),on(A,s,A.length,c),A}function FU(A,n,r){const i=this;let l=i.events.length,s,u;for(;l--;)if((i.events[l][1].type==="labelImage"||i.events[l][1].type==="labelLink")&&!i.events[l][1]._balanced){s=i.events[l][1];break}return c;function c(m){return s?s._inactive?p(m):(u=i.parser.defined.includes(Ei(i.sliceSerialize({start:s.end,end:i.now()}))),A.enter("labelEnd"),A.enter("labelMarker"),A.consume(m),A.exit("labelMarker"),A.exit("labelEnd"),f):r(m)}function f(m){return m===40?A.attempt(QU,B,u?B:p)(m):m===91?A.attempt(bU,B,u?h:p)(m):u?B(m):p(m)}function h(m){return A.attempt(UU,B,p)(m)}function B(m){return n(m)}function p(m){return s._balanced=!0,r(m)}}function TU(A,n,r){return i;function i(p){return A.enter("resource"),A.enter("resourceMarker"),A.consume(p),A.exit("resourceMarker"),l}function l(p){return ct(p)?Pa(A,s)(p):s(p)}function s(p){return p===41?B(p):yp(A,u,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function u(p){return ct(p)?Pa(A,f)(p):B(p)}function c(p){return r(p)}function f(p){return p===34||p===39||p===40?vp(A,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):B(p)}function h(p){return ct(p)?Pa(A,B)(p):B(p)}function B(p){return p===41?(A.enter("resourceMarker"),A.consume(p),A.exit("resourceMarker"),A.exit("resource"),n):r(p)}}function HU(A,n,r){const i=this;return l;function l(c){return Ep.call(i,A,s,u,"reference","referenceMarker","referenceString")(c)}function s(c){return i.parser.defined.includes(Ei(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?n(c):r(c)}function u(c){return r(c)}}function IU(A,n,r){return i;function i(s){return A.enter("reference"),A.enter("referenceMarker"),A.consume(s),A.exit("referenceMarker"),l}function l(s){return s===93?(A.enter("referenceMarker"),A.consume(s),A.exit("referenceMarker"),A.exit("reference"),n):r(s)}}const NU={name:"labelStartImage",resolveAll:Pc.resolveAll,tokenize:_U};function _U(A,n,r){const i=this;return l;function l(c){return A.enter("labelImage"),A.enter("labelImageMarker"),A.consume(c),A.exit("labelImageMarker"),s}function s(c){return c===91?(A.enter("labelMarker"),A.consume(c),A.exit("labelMarker"),A.exit("labelImage"),u):r(c)}function u(c){return c===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(c):n(c)}}const LU={name:"labelStartLink",resolveAll:Pc.resolveAll,tokenize:RU};function RU(A,n,r){const i=this;return l;function l(u){return A.enter("labelLink"),A.enter("labelMarker"),A.consume(u),A.exit("labelMarker"),A.exit("labelLink"),s}function s(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(u):n(u)}}const Yc={name:"lineEnding",tokenize:OU};function OU(A,n){return r;function r(i){return A.enter("lineEnding"),A.consume(i),A.exit("lineEnding"),se(A,n,"linePrefix")}}const Qs={name:"thematicBreak",tokenize:MU};function MU(A,n,r){let i=0,l;return s;function s(h){return A.enter("thematicBreak"),u(h)}function u(h){return l=h,c(h)}function c(h){return h===l?(A.enter("thematicBreakSequence"),f(h)):i>=3&&(h===null||SA(h))?(A.exit("thematicBreak"),n(h)):r(h)}function f(h){return h===l?(A.consume(h),i++,f):(A.exit("thematicBreakSequence"),VA(h)?se(A,c,"whitespace")(h):c(h))}}const ft={continuation:{tokenize:jU},exit:VU,name:"list",tokenize:KU},DU={partial:!0,tokenize:GU},kU={partial:!0,tokenize:zU};function KU(A,n,r){const i=this,l=i.events[i.events.length-1];let s=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,u=0;return c;function c(w){const E=i.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!i.containerState.marker||w===i.containerState.marker:jc(w)){if(i.containerState.type||(i.containerState.type=E,A.enter(E,{_container:!0})),E==="listUnordered")return A.enter("listItemPrefix"),w===42||w===45?A.check(Qs,r,h)(w):h(w);if(!i.interrupt||w===49)return A.enter("listItemPrefix"),A.enter("listItemValue"),f(w)}return r(w)}function f(w){return jc(w)&&++u<10?(A.consume(w),f):(!i.interrupt||u<2)&&(i.containerState.marker?w===i.containerState.marker:w===41||w===46)?(A.exit("listItemValue"),h(w)):r(w)}function h(w){return A.enter("listItemMarker"),A.consume(w),A.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||w,A.check(vs,i.interrupt?r:B,A.attempt(DU,m,p))}function B(w){return i.containerState.initialBlankLine=!0,s++,m(w)}function p(w){return VA(w)?(A.enter("listItemPrefixWhitespace"),A.consume(w),A.exit("listItemPrefixWhitespace"),m):r(w)}function m(w){return i.containerState.size=s+i.sliceSerialize(A.exit("listItemPrefix"),!0).length,n(w)}}function jU(A,n,r){const i=this;return i.containerState._closeFlow=void 0,A.check(vs,l,s);function l(c){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,se(A,n,"listItemIndent",i.containerState.size+1)(c)}function s(c){return i.containerState.furtherBlankLines||!VA(c)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(c)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,A.attempt(kU,n,u)(c))}function u(c){return i.containerState._closeFlow=!0,i.interrupt=void 0,se(A,A.attempt(ft,n,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function zU(A,n,r){const i=this;return se(A,l,"listItemIndent",i.containerState.size+1);function l(s){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?n(s):r(s)}}function VU(A){A.exit(this.containerState.type)}function GU(A,n,r){const i=this;return se(A,l,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(s){const u=i.events[i.events.length-1];return!VA(s)&&u&&u[1].type==="listItemPrefixWhitespace"?n(s):r(s)}}const bp={name:"setextUnderline",resolveTo:PU,tokenize:YU};function PU(A,n){let r=A.length,i,l,s;for(;r--;)if(A[r][0]==="enter"){if(A[r][1].type==="content"){i=r;break}A[r][1].type==="paragraph"&&(l=r)}else A[r][1].type==="content"&&A.splice(r,1),!s&&A[r][1].type==="definition"&&(s=r);const u={type:"setextHeading",start:{...A[i][1].start},end:{...A[A.length-1][1].end}};return A[l][1].type="setextHeadingText",s?(A.splice(l,0,["enter",u,n]),A.splice(s+1,0,["exit",A[i][1],n]),A[i][1].end={...A[s][1].end}):A[i][1]=u,A.push(["exit",u,n]),A}function YU(A,n,r){const i=this;let l;return s;function s(h){let B=i.events.length,p;for(;B--;)if(i.events[B][1].type!=="lineEnding"&&i.events[B][1].type!=="linePrefix"&&i.events[B][1].type!=="content"){p=i.events[B][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||p)?(A.enter("setextHeadingLine"),l=h,u(h)):r(h)}function u(h){return A.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===l?(A.consume(h),c):(A.exit("setextHeadingLineSequence"),VA(h)?se(A,f,"lineSuffix")(h):f(h))}function f(h){return h===null||SA(h)?(A.exit("setextHeadingLine"),n(h)):r(h)}}const XU={tokenize:qU};function qU(A){const n=this,r=A.attempt(vs,i,A.attempt(this.parser.constructs.flowInitial,l,se(A,A.attempt(this.parser.constructs.flow,l,A.attempt(AU,l)),"linePrefix")));return r;function i(s){if(s===null){A.consume(s);return}return A.enter("lineEndingBlank"),A.consume(s),A.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function l(s){if(s===null){A.consume(s);return}return A.enter("lineEnding"),A.consume(s),A.exit("lineEnding"),n.currentConstruct=void 0,r}}const JU={resolveAll:Sp()},ZU=Up("string"),WU=Up("text");function Up(A){return{resolveAll:Sp(A==="text"?$U:void 0),tokenize:n};function n(r){const i=this,l=this.parser.constructs[A],s=r.attempt(l,u,c);return u;function u(B){return h(B)?s(B):c(B)}function c(B){if(B===null){r.consume(B);return}return r.enter("data"),r.consume(B),f}function f(B){return h(B)?(r.exit("data"),s(B)):(r.consume(B),f)}function h(B){if(B===null)return!0;const p=l[B];let m=-1;if(p)for(;++m<p.length;){const w=p[m];if(!w.previous||w.previous.call(i,i.previous))return!0}return!1}}}function Sp(A){return n;function n(r,i){let l=-1,s;for(;++l<=r.length;)s===void 0?r[l]&&r[l][1].type==="data"&&(s=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==s+2&&(r[s][1].end=r[l-1][1].end,r.splice(s+2,l-s-2),l=s+2),s=void 0);return A?A(r,i):r}}function $U(A,n){let r=0;for(;++r<=A.length;)if((r===A.length||A[r][1].type==="lineEnding")&&A[r-1][1].type==="data"){const i=A[r-1][1],l=n.sliceStream(i);let s=l.length,u=-1,c=0,f;for(;s--;){const h=l[s];if(typeof h=="string"){for(u=h.length;h.charCodeAt(u-1)===32;)c++,u--;if(u)break;u=-1}else if(h===-2)f=!0,c++;else if(h!==-1){s++;break}}if(n._contentTypeTextTrailing&&r===A.length&&(c=0),c){const h={type:r===A.length||f||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?u:i.start._bufferIndex+u,_index:i.start._index+s,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):(A.splice(r,0,["enter",h,n],["exit",h,n]),r+=2)}r++}return A}const AS=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:{91:iU},disable:{null:[]},document:{42:ft,43:ft,45:ft,48:ft,49:ft,50:ft,51:ft,52:ft,53:ft,54:ft,55:ft,56:ft,57:ft,62:gp},flow:{35:cU,42:Qs,45:[bp,Qs],60:gU,61:bp,95:Qs,96:Cp,126:Cp},flowInitial:{[-2]:Gc,[-1]:Gc,32:Gc},insideSpan:{null:[Vc,JU]},string:{38:pp,92:Bp},text:{[-5]:Yc,[-4]:Yc,[-3]:Yc,33:NU,38:pp,42:Vc,60:[Lb,EU],91:LU,92:[oU,Bp],93:Pc,95:Vc,96:Xb}},Symbol.toStringTag,{value:"Module"}));function eS(A,n,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const l={},s=[];let u=[],c=[];const f={attempt:H(J),check:H(x),consume:N,enter:k,exit:$,interrupt:H(x,{interrupt:!0})},h={code:null,containerState:{},defineSkip:v,events:[],now:E,parser:A,previous:null,sliceSerialize:m,sliceStream:w,write:p};let B=n.tokenize.call(h,f);return n.resolveAll&&s.push(n),h;function p(R){return u=Lt(u,R),F(),u[u.length-1]!==null?[]:(L(n,0),h.events=zc(s,h.events,h),h.events)}function m(R,j){return nS(w(R),j)}function w(R){return tS(u,R)}function E(){const{_bufferIndex:R,_index:j,line:AA,column:nA,offset:rA}=i;return{_bufferIndex:R,_index:j,line:AA,column:nA,offset:rA}}function v(R){l[R.line]=R.column,Y()}function F(){let R;for(;i._index<u.length;){const j=u[i._index];if(typeof j=="string")for(R=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===R&&i._bufferIndex<j.length;)U(j.charCodeAt(i._bufferIndex));else U(j)}}function U(R){B=B(R)}function N(R){SA(R)?(i.line++,i.column=1,i.offset+=R===-3?2:1,Y()):R!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===u[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=R}function k(R,j){const AA=j||{};return AA.type=R,AA.start=E(),h.events.push(["enter",AA,h]),c.push(AA),AA}function $(R){const j=c.pop();return j.end=E(),h.events.push(["exit",j,h]),j}function J(R,j){L(R,j.from)}function x(R,j){j.restore()}function H(R,j){return AA;function AA(nA,rA,K){let q,eA,sA,T;return Array.isArray(nA)?X(nA):"tokenize"in nA?X([nA]):I(nA);function I(gA){return hA;function hA(OA){const FA=OA!==null&&gA[OA],me=OA!==null&&gA.null,qA=[...Array.isArray(FA)?FA:FA?[FA]:[],...Array.isArray(me)?me:me?[me]:[]];return X(qA)(OA)}}function X(gA){return q=gA,eA=0,gA.length===0?K:b(gA[eA])}function b(gA){return hA;function hA(OA){return T=D(),sA=gA,gA.partial||(h.currentConstruct=gA),gA.name&&h.parser.constructs.disable.null.includes(gA.name)?fA():gA.tokenize.call(j?Object.assign(Object.create(h),j):h,f,lA,fA)(OA)}}function lA(gA){return R(sA,T),rA}function fA(gA){return T.restore(),++eA<q.length?b(q[eA]):K}}}function L(R,j){R.resolveAll&&!s.includes(R)&&s.push(R),R.resolve&&on(h.events,j,h.events.length-j,R.resolve(h.events.slice(j),h)),R.resolveTo&&(h.events=R.resolveTo(h.events,h))}function D(){const R=E(),j=h.previous,AA=h.currentConstruct,nA=h.events.length,rA=Array.from(c);return{from:nA,restore:K};function K(){i=R,h.previous=j,h.currentConstruct=AA,h.events.length=nA,c=rA,Y()}}function Y(){i.line in l&&i.column<2&&(i.column=l[i.line],i.offset+=l[i.line]-1)}}function tS(A,n){const r=n.start._index,i=n.start._bufferIndex,l=n.end._index,s=n.end._bufferIndex;let u;if(r===l)u=[A[r].slice(i,s)];else{if(u=A.slice(r,l),i>-1){const c=u[0];typeof c=="string"?u[0]=c.slice(i):u.shift()}s>0&&u.push(A[l].slice(0,s))}return u}function nS(A,n){let r=-1;const i=[];let l;for(;++r<A.length;){const s=A[r];let u;if(typeof s=="string")u=s;else switch(s){case-5:{u="\r";break}case-4:{u=`
|
|
48
48
|
`;break}case-3:{u=`\r
|
|
49
49
|
`;break}case-2:{u=n?" ":" ";break}case-1:{if(!n&&l)continue;u=" ";break}default:u=String.fromCharCode(s)}l=s===-2,i.push(u)}return i.join("")}function rS(A){const i={constructs:wb([AS,...(A||{}).extensions||[]]),content:l(xb),defined:[],document:l(Tb),flow:l(XU),lazy:{},string:l(ZU),text:l(WU)};return i;function l(s){return u;function u(c){return eS(i,s,c)}}}function iS(A){for(;!wp(A););return A}const xp=/[\0\t\n\r]/g;function aS(){let A=1,n="",r=!0,i;return l;function l(s,u,c){const f=[];let h,B,p,m,w;for(s=n+(typeof s=="string"?s.toString():new TextDecoder(u||void 0).decode(s)),p=0,n="",r&&(s.charCodeAt(0)===65279&&p++,r=void 0);p<s.length;){if(xp.lastIndex=p,h=xp.exec(s),m=h&&h.index!==void 0?h.index:s.length,w=s.charCodeAt(m),!h){n=s.slice(p);break}if(w===10&&p===m&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),p<m&&(f.push(s.slice(p,m)),A+=m-p),w){case 0:{f.push(65533),A++;break}case 9:{for(B=Math.ceil(A/4)*4,f.push(-2);A++<B;)f.push(-1);break}case 10:{f.push(-4),A=1;break}default:i=!0,A=1}p=m+1}return c&&(i&&f.push(-5),n&&f.push(n),f.push(null)),f}}const lS=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sS(A){return A.replace(lS,oS)}function oS(A,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),s=l===120||l===88;return cp(r.slice(s?2:1),s?16:10)}return kc(r)||A}const Fp={}.hasOwnProperty;function uS(A,n,r){return typeof n!="string"&&(r=n,n=void 0),cS(r)(iS(rS(r).document().write(aS()(A,n,!0))))}function cS(A){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(en),autolinkProtocol:D,autolinkEmail:D,atxHeading:s(lt),blockQuote:s(me),characterEscape:D,characterReference:D,codeFenced:s(qA),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:s(qA,u),codeText:s(nt,u),codeTextData:D,data:D,codeFlowValue:D,definition:s(ht),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:s(Ut),hardBreakEscape:s(gn),hardBreakTrailing:s(gn),htmlFlow:s(cr,u),htmlFlowData:D,htmlText:s(cr,u),htmlTextData:D,image:s(fr),label:u,link:s(en),listItem:s(GA),listItemValue:m,listOrdered:s(Bn,p),listUnordered:s(Bn),paragraph:s(ge),reference:b,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:s(lt),strong:s(gt),thematicBreak:s(cA)},exit:{atxHeading:f(),atxHeadingSequence:J,autolink:f(),autolinkEmail:FA,autolinkProtocol:OA,blockQuote:f(),characterEscapeValue:Y,characterReferenceMarkerHexadecimal:fA,characterReferenceMarkerNumeric:fA,characterReferenceValue:gA,characterReference:hA,codeFenced:f(F),codeFencedFence:v,codeFencedFenceInfo:w,codeFencedFenceMeta:E,codeFlowValue:Y,codeIndented:f(U),codeText:f(rA),codeTextData:Y,data:Y,definition:f(),definitionDestinationString:$,definitionLabelString:N,definitionTitleString:k,emphasis:f(),hardBreakEscape:f(j),hardBreakTrailing:f(j),htmlFlow:f(AA),htmlFlowData:Y,htmlText:f(nA),htmlTextData:Y,image:f(q),label:sA,labelText:eA,lineEnding:R,link:f(K),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:lA,resourceDestinationString:T,resourceTitleString:I,resource:X,setextHeading:f(L),setextHeadingLineSequence:H,setextHeadingText:x,strong:f(),thematicBreak:f()}};Tp(n,(A||{}).mdastExtensions||[]);const r={};return i;function i(O){let W={type:"root",children:[]};const uA={stack:[W],tokenStack:[],config:n,enter:c,exit:h,buffer:u,resume:B,data:r},vA=[];let bA=-1;for(;++bA<O.length;)if(O[bA][1].type==="listOrdered"||O[bA][1].type==="listUnordered")if(O[bA][0]==="enter")vA.push(bA);else{const ee=vA.pop();bA=l(O,ee,bA)}for(bA=-1;++bA<O.length;){const ee=n[O[bA][0]];Fp.call(ee,O[bA][1].type)&&ee[O[bA][1].type].call(Object.assign({sliceSerialize:O[bA][2].sliceSerialize},uA),O[bA][1])}if(uA.tokenStack.length>0){const ee=uA.tokenStack[uA.tokenStack.length-1];(ee[1]||Hp).call(uA,void 0,ee[0])}for(W.position={start:Ar(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:Ar(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},bA=-1;++bA<n.transforms.length;)W=n.transforms[bA](W)||W;return W}function l(O,W,uA){let vA=W-1,bA=-1,ee=!1,te,PA,JA,Be;for(;++vA<=uA;){const KA=O[vA];switch(KA[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{KA[0]==="enter"?bA++:bA--,Be=void 0;break}case"lineEndingBlank":{KA[0]==="enter"&&(te&&!Be&&!bA&&!JA&&(JA=vA),Be=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Be=void 0}if(!bA&&KA[0]==="enter"&&KA[1].type==="listItemPrefix"||bA===-1&&KA[0]==="exit"&&(KA[1].type==="listUnordered"||KA[1].type==="listOrdered")){if(te){let rt=vA;for(PA=void 0;rt--;){const Oe=O[rt];if(Oe[1].type==="lineEnding"||Oe[1].type==="lineEndingBlank"){if(Oe[0]==="exit")continue;PA&&(O[PA][1].type="lineEndingBlank",ee=!0),Oe[1].type="lineEnding",PA=rt}else if(!(Oe[1].type==="linePrefix"||Oe[1].type==="blockQuotePrefix"||Oe[1].type==="blockQuotePrefixWhitespace"||Oe[1].type==="blockQuoteMarker"||Oe[1].type==="listItemIndent"))break}JA&&(!PA||JA<PA)&&(te._spread=!0),te.end=Object.assign({},PA?O[PA][1].start:KA[1].end),O.splice(PA||vA,0,["exit",te,KA[2]]),vA++,uA++}if(KA[1].type==="listItemPrefix"){const rt={type:"listItem",_spread:!1,start:Object.assign({},KA[1].start),end:void 0};te=rt,O.splice(vA,0,["enter",rt,KA[2]]),vA++,uA++,JA=void 0,Be=!0}}}return O[W][1]._spread=ee,uA}function s(O,W){return uA;function uA(vA){c.call(this,O(vA),vA),W&&W.call(this,vA)}}function u(){this.stack.push({type:"fragment",children:[]})}function c(O,W,uA){this.stack[this.stack.length-1].children.push(O),this.stack.push(O),this.tokenStack.push([W,uA||void 0]),O.position={start:Ar(W.start),end:void 0}}function f(O){return W;function W(uA){O&&O.call(this,uA),h.call(this,uA)}}function h(O,W){const uA=this.stack.pop(),vA=this.tokenStack.pop();if(vA)vA[0].type!==O.type&&(W?W.call(this,O,vA[0]):(vA[1]||Hp).call(this,O,vA[0]));else throw new Error("Cannot close `"+O.type+"` ("+za({start:O.start,end:O.end})+"): it’s not open");uA.position.end=Ar(O.end)}function B(){return mb(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(O){if(this.data.expectingFirstListItemValue){const W=this.stack[this.stack.length-2];W.start=Number.parseInt(this.sliceSerialize(O),10),this.data.expectingFirstListItemValue=void 0}}function w(){const O=this.resume(),W=this.stack[this.stack.length-1];W.lang=O}function E(){const O=this.resume(),W=this.stack[this.stack.length-1];W.meta=O}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function F(){const O=this.resume(),W=this.stack[this.stack.length-1];W.value=O.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function U(){const O=this.resume(),W=this.stack[this.stack.length-1];W.value=O.replace(/(\r?\n|\r)$/g,"")}function N(O){const W=this.resume(),uA=this.stack[this.stack.length-1];uA.label=W,uA.identifier=Ei(this.sliceSerialize(O)).toLowerCase()}function k(){const O=this.resume(),W=this.stack[this.stack.length-1];W.title=O}function $(){const O=this.resume(),W=this.stack[this.stack.length-1];W.url=O}function J(O){const W=this.stack[this.stack.length-1];if(!W.depth){const uA=this.sliceSerialize(O).length;W.depth=uA}}function x(){this.data.setextHeadingSlurpLineEnding=!0}function H(O){const W=this.stack[this.stack.length-1];W.depth=this.sliceSerialize(O).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function D(O){const uA=this.stack[this.stack.length-1].children;let vA=uA[uA.length-1];(!vA||vA.type!=="text")&&(vA=Re(),vA.position={start:Ar(O.start),end:void 0},uA.push(vA)),this.stack.push(vA)}function Y(O){const W=this.stack.pop();W.value+=this.sliceSerialize(O),W.position.end=Ar(O.end)}function R(O){const W=this.stack[this.stack.length-1];if(this.data.atHardBreak){const uA=W.children[W.children.length-1];uA.position.end=Ar(O.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(W.type)&&(D.call(this,O),Y.call(this,O))}function j(){this.data.atHardBreak=!0}function AA(){const O=this.resume(),W=this.stack[this.stack.length-1];W.value=O}function nA(){const O=this.resume(),W=this.stack[this.stack.length-1];W.value=O}function rA(){const O=this.resume(),W=this.stack[this.stack.length-1];W.value=O}function K(){const O=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=W,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function q(){const O=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=W,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function eA(O){const W=this.sliceSerialize(O),uA=this.stack[this.stack.length-2];uA.label=sS(W),uA.identifier=Ei(W).toLowerCase()}function sA(){const O=this.stack[this.stack.length-1],W=this.resume(),uA=this.stack[this.stack.length-1];if(this.data.inReference=!0,uA.type==="link"){const vA=O.children;uA.children=vA}else uA.alt=W}function T(){const O=this.resume(),W=this.stack[this.stack.length-1];W.url=O}function I(){const O=this.resume(),W=this.stack[this.stack.length-1];W.title=O}function X(){this.data.inReference=void 0}function b(){this.data.referenceType="collapsed"}function lA(O){const W=this.resume(),uA=this.stack[this.stack.length-1];uA.label=W,uA.identifier=Ei(this.sliceSerialize(O)).toLowerCase(),this.data.referenceType="full"}function fA(O){this.data.characterReferenceType=O.type}function gA(O){const W=this.sliceSerialize(O),uA=this.data.characterReferenceType;let vA;uA?(vA=cp(W,uA==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):vA=kc(W);const bA=this.stack[this.stack.length-1];bA.value+=vA}function hA(O){const W=this.stack.pop();W.position.end=Ar(O.end)}function OA(O){Y.call(this,O);const W=this.stack[this.stack.length-1];W.url=this.sliceSerialize(O)}function FA(O){Y.call(this,O);const W=this.stack[this.stack.length-1];W.url="mailto:"+this.sliceSerialize(O)}function me(){return{type:"blockquote",children:[]}}function qA(){return{type:"code",lang:null,meta:null,value:""}}function nt(){return{type:"inlineCode",value:""}}function ht(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ut(){return{type:"emphasis",children:[]}}function lt(){return{type:"heading",depth:0,children:[]}}function gn(){return{type:"break"}}function cr(){return{type:"html",value:""}}function fr(){return{type:"image",title:null,url:"",alt:null}}function en(){return{type:"link",title:null,url:"",children:[]}}function Bn(O){return{type:"list",ordered:O.type==="listOrdered",start:null,spread:O._spread,children:[]}}function GA(O){return{type:"listItem",spread:O._spread,checked:null,children:[]}}function ge(){return{type:"paragraph",children:[]}}function gt(){return{type:"strong",children:[]}}function Re(){return{type:"text",value:""}}function cA(){return{type:"thematicBreak"}}}function Ar(A){return{line:A.line,column:A.column,offset:A.offset}}function Tp(A,n){let r=-1;for(;++r<n.length;){const i=n[r];Array.isArray(i)?Tp(A,i):fS(A,i)}}function fS(A,n){let r;for(r in n)if(Fp.call(n,r))switch(r){case"canContainEols":{const i=n[r];i&&A[r].push(...i);break}case"transforms":{const i=n[r];i&&A[r].push(...i);break}case"enter":case"exit":{const i=n[r];i&&Object.assign(A[r],i);break}}}function Hp(A,n){throw A?new Error("Cannot close `"+A.type+"` ("+za({start:A.start,end:A.end})+"): a different token (`"+n.type+"`, "+za({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+za({start:n.start,end:n.end})+") is still open")}function dS(A){const n=this;n.parser=r;function r(i){return uS(i,{...n.data("settings"),...A,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function hS(A,n){const r={type:"element",tagName:"blockquote",properties:{},children:A.wrap(A.all(n),!0)};return A.patch(n,r),A.applyData(n,r)}function gS(A,n){const r={type:"element",tagName:"br",properties:{},children:[]};return A.patch(n,r),[A.applyData(n,r),{type:"text",value:`
|