import{j as r,r as k,t as yr,v as di}from"./index-DzNKzXrc.js";function en({steps:e,currentStepIndex:t,onStepClick:n}){return r.jsxs("div",{className:"relative w-full",children:[r.jsx("div",{className:"absolute top-5 left-0 right-0 h-1 bg-gray-300 mr-9 ml-9",children:r.jsx("div",{className:"h-full bg-solace-green transition-all duration-300 ease-in-out",style:{width:t===0?"0%":`${t/(e.length-1)*100}%`}})}),r.jsx("div",{className:"flex items-center justify-between w-full relative z-10",children:e.map((i,s)=>{const a=s===t,o=s<t;return r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx("button",{onClick:()=>n==null?void 0:n(s),disabled:!n,className:`
                  w-10 h-10 rounded-full flex items-center justify-center
                  font-bold transition-colors duration-300
                  ${a?"bg-solace-green text-white":""}
                  ${o?"bg-solace-dark-green text-white":""}
                  ${!a&&!o?"bg-gray-200 text-gray-600":""}
                  ${n?"cursor-pointer":"cursor-default"}
                `,children:o?r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):s+1}),r.jsx("span",{className:`
                  mt-2 text-xs font-medium text-center
                  ${a?"text-solace-green":""}
                  ${o?"text-solace-dark-green":""}
                  ${!a&&!o?"text-gray-500":""}
                `,children:i.title})]},i.id)})})]})}function Y({children:e,onClick:t,disabled:n=!1,variant:i="primary",type:s="button",className:a=""}){const o="py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2",l={primary:"bg-solace-green hover:bg-solace-dark-green text-white focus:ring-solace-green disabled:bg-solace-green/50",secondary:"bg-gray-200 hover:bg-gray-300 text-gray-800 focus:ring-gray-500 disabled:bg-gray-100 disabled:text-gray-400",outline:"border border-gray-300 hover:bg-gray-50 text-gray-700 focus:ring-solace-green disabled:text-gray-400"};return r.jsx("button",{type:s,className:`${o} ${l[i]} ${a}`,onClick:t,disabled:n,children:e})}const br=()=>r.jsx("svg",{className:"w-4 h-4 mr-1.5 text-green-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),_r={quick:{title:"Get Started Quickly",timeEstimate:"2 minutes",timeColor:"green",description:"Simple setup with recommended defaults",features:["Connect AI provider","Uses sensible defaults for everything else"]},advanced:{title:"Advanced Setup",timeEstimate:"10 minutes",timeColor:"blue",description:"Full control over all configuration options",features:["Set namespace for topic prefixes","Specify broker settings","Connect AI provider","Configure main orchestrator","Configure Web UI Gateway"]}},mi=["Ready-to-use Solace Agent Mesh with basic capabilities","Chat interface for immediate testing","Foundation for adding more agents later"],pi=({pathType:e,isSelected:t,onSelect:n})=>{const i=_r[e];return r.jsxs("div",{role:"button",tabIndex:0,className:`
        border rounded-lg p-6 cursor-pointer transition-all
        ${t?"border-solace-blue bg-solace-light-blue/10 shadow-md":"border-gray-200 hover:border-solace-blue/50 hover:bg-gray-50"}
      `,onClick:n,onKeyDown:s=>s.key==="Enter"&&n(),children:[r.jsxs("div",{className:"flex justify-between items-start mb-4",children:[r.jsx("h3",{className:"text-xl font-bold text-solace-blue",children:i.title}),r.jsx("span",{className:`bg-${i.timeColor}-100 text-${i.timeColor}-800 text-xs font-medium px-2.5 py-0.5 rounded`,children:i.timeEstimate})]}),r.jsx("p",{className:"text-gray-600 mb-4",children:i.description}),r.jsx("div",{children:r.jsx("ul",{className:"space-y-2 text-sm text-gray-600",children:i.features.map(s=>r.jsxs("li",{className:"flex items-center",children:[r.jsx(br,{}),s]},s))})})]})};function hi({data:e,updateData:t,onNext:n}){const{setupPath:i}=e,[s,a]=k.useState(i??null),o=u=>{a(u),t({setupPath:u})},l=()=>{s&&n()};return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:Object.keys(_r).map(u=>r.jsx(pi,{pathType:u,isSelected:s===u,onSelect:()=>o(u)},u))}),r.jsxs("div",{className:"mt-6 p-4 border rounded-lg",children:[r.jsx("h3",{className:"text-lg font-semibold text-solace-blue mb-3",children:"What you'll get after setup:"}),r.jsx("ul",{className:"space-y-2 text-gray-700",children:mi.map(u=>r.jsxs("li",{className:"flex items-center",children:[r.jsx(br,{}),u]},u))})]}),r.jsx("div",{className:"mt-8 flex justify-end",children:r.jsx(Y,{onClick:l,disabled:!s,children:"Continue"})})]})}function P({label:e,htmlFor:t,helpText:n,error:i,required:s=!1,children:a}){return r.jsxs("div",{className:"mb-4",children:[r.jsxs("label",{htmlFor:t,className:"block text-sm font-medium text-gray-700 mb-1",children:[e,s&&r.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),r.jsx("div",{className:"mt-1",children:a}),n&&r.jsx("p",{className:"mt-1 text-sm text-gray-500",children:n}),i&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:i})]})}function G({id:e,name:t,value:n,onChange:i,placeholder:s="",required:a=!1,disabled:o=!1,type:l="text",className:u="",onKeyDown:c}){return r.jsx("input",{id:e,name:t||e,type:l,value:n,onChange:i,onKeyDown:c,placeholder:s,required:a,disabled:o,className:`
        w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm 
        focus:outline-none focus:ring-blue-500 focus:border-blue-500
        disabled:bg-gray-100 disabled:text-gray-500
        ${u}
      `})}function Ee({children:e,className:t=""}){return r.jsx("div",{className:`p-4 bg-blue-50 rounded-md ${t}`,children:r.jsx("p",{className:"text-sm text-blue-800",children:e})})}function vr({children:e,className:t=""}){return r.jsx("div",{className:`p-4 bg-yellow-50 rounded-md ${t}`,children:r.jsx("p",{className:"text-sm text-yellow-800",children:e})})}function fi({children:e,variant:t="info",className:n=""}){const i={info:"bg-blue-50 text-blue-800",success:"bg-green-50 text-green-800",error:"bg-red-50 text-red-800",loading:"bg-blue-50 text-blue-800"};return r.jsx("div",{className:`p-3 rounded-md ${i[t]} ${n}`,children:r.jsx("p",{className:"text-sm",children:e})})}function gi({data:e,updateData:t,onNext:n,onPrevious:i}){const{namespace:s}=e,a=l=>{t({[l.target.name]:l.target.value})},o=l=>{l.preventDefault(),n()};return r.jsxs("form",{onSubmit:o,children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ee,{className:"mb-4",children:"The namespace is a unique identifier that will be prefixed to all your event topics in the Solace Agent Mesh. Choose something meaningful to your organization or project."}),r.jsx(P,{label:"Project Namespace",htmlFor:"namespace",helpText:"Any simple text identifier that makes sense for your project (e.g., 'my-project', 'acme-corp')",required:!0,children:r.jsx(G,{id:"namespace",name:"namespace",value:s||"",onChange:a,placeholder:"Enter a namespace (e.g., my-project)",required:!0})})]}),r.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[r.jsx(Y,{onClick:i,variant:"outline",children:"Previous"}),r.jsx(Y,{type:"submit",disabled:!(s!=null&&s.trim()),children:"Next"})]})]})}function se({id:e,options:t,value:n,onChange:i,name:s,required:a=!1,disabled:o=!1,className:l=""}){return r.jsxs("div",{className:"relative",children:[r.jsx("select",{id:e,name:s||e,value:n,onChange:i,required:a,disabled:o,className:`
          w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm 
          focus:outline-none focus:ring-blue-500 focus:border-blue-500 
          disabled:bg-gray-100 disabled:text-gray-500
          appearance-none
          pr-10
          ${l}
        `,children:t.map(u=>r.jsx("option",{value:u.value,children:u.label},u.value))}),r.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-2",children:r.jsx("svg",{className:"h-6 w-6 text-gray-500",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:r.jsx("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})}const xi=[{value:"solace",label:"Existing Solace Pub/Sub+ broker"},{value:"container",label:"New local Solace PubSub+ broker container"},{value:"dev_mode",label:"Dev mode (simplified setup)"}],yi=[{value:"podman",label:"Podman"},{value:"docker",label:"Docker"}],gn=({message:e})=>{const t=/(https?:\/\/[^\s]+)/g,n=e.split(t);return r.jsx("span",{children:n.map((i,s)=>i.match(t)?r.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 underline",children:i},s):i)})};function bi({data:e,updateData:t,onNext:n,onPrevious:i}){const{broker_type:s,broker_url:a,broker_vpn:o,broker_username:l,broker_password:u,container_engine:c,container_started:d}=e,[m,h]=k.useState({}),[p,w]=k.useState(!1),[b,C]=k.useState({isRunning:!1,success:d===!0,message:d?"Container already started successfully":""});k.useEffect(()=>{!c&&s==="container"&&t({container_engine:"podman"}),c&&s!=="container"&&t({container_engine:""}),s!=="dev_mode"?t({dev_mode:!1}):s==="dev_mode"&&t({dev_mode:!0})},[s,c,t]);const g=N=>{t({[N.target.name]:N.target.value})},_=()=>{const N={};let z=!0;return s==="solace"&&(a||(N.broker_url="Broker URL is required",z=!1),o||(N.broker_vpn="VPN name is required",z=!1),l||(N.broker_username="Username is required",z=!1)),s==="container"&&!b.success&&(N.container="You must successfully run the container before proceeding",z=!1),h(N),z},A=async()=>{w(!0),C({isRunning:!0,success:!1,message:"Starting container..."});try{const z=await(await fetch("api/runcontainer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({container_engine:c})})).json();if(z.status==="success")C({isRunning:!1,success:!0,message:z.message??"Container started successfully!"}),t({container_engine:c,container_started:!0});else{const S=z.message??"Failed to start container. Please try again.";C({isRunning:!1,success:!1,message:r.jsx(gn,{message:S})}),t({container_started:!1})}}catch(N){const z=N instanceof Error?N.message:"An unexpected error occurred";C({isRunning:!1,success:!1,message:r.jsx(gn,{message:z})}),t({container_started:!1})}finally{w(!1)}},R=N=>{N.preventDefault(),_()&&(s==="container"&&(e.broker_url="ws://localhost:8008",e.broker_vpn="default",e.broker_username="default",e.broker_password="default"),n())},L=s==="solace",y=s==="container",I=()=>b.isRunning?"loading":b.success?"success":"error",v=()=>p?r.jsxs(r.Fragment,{children:[r.jsxs("svg",{className:"animate-spin h-4 w-4 mr-2",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Starting Container..."]}):b.success?r.jsxs(r.Fragment,{children:[r.jsx("svg",{className:"h-4 w-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Container Running"]}):r.jsxs(r.Fragment,{children:[r.jsx("svg",{className:"h-4 w-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download and Run Container"]});return r.jsxs("form",{onSubmit:R,children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(P,{label:"Broker Type",htmlFor:"broker_type",required:!0,children:r.jsx(se,{id:"broker_type",name:"broker_type",options:xi,value:s||"",onChange:g,disabled:b.success&&e.broker_type==="container"})}),L&&r.jsxs("div",{className:"space-y-4 p-4 border border-gray-200 rounded-md",children:[r.jsx(Ee,{className:"mb-4",children:"Connect to an existing Solace PubSub+ broker running locally or in the cloud. You will need your broker credentials."}),r.jsx(P,{label:"Broker URL",htmlFor:"broker_url",error:m.broker_url,required:!0,children:r.jsx(G,{id:"broker_url",name:"broker_url",value:a||"",onChange:g,placeholder:"ws://localhost:8008"})}),r.jsx(P,{label:"VPN Name",htmlFor:"broker_vpn",error:m.broker_vpn,required:!0,children:r.jsx(G,{id:"broker_vpn",name:"broker_vpn",value:o||"",onChange:g,placeholder:"default"})}),r.jsx(P,{label:"Username",htmlFor:"broker_username",error:m.broker_username,required:!0,children:r.jsx(G,{id:"broker_username",name:"broker_username",value:l||"",onChange:g,placeholder:"default"})}),r.jsx(P,{label:"Password",htmlFor:"broker_password",error:m.broker_password,children:r.jsx(G,{id:"broker_password",name:"broker_password",type:"password",value:u||"",onChange:g,placeholder:"Enter password"})})]}),y&&r.jsxs("div",{className:"space-y-4 p-4 border border-gray-200 rounded-md",children:[r.jsx(Ee,{className:"mb-4",children:"This option will download and run a local Solace PubSub+ broker container on your machine using Docker or Podman. You need to have Docker or Podman installed on your system."}),r.jsx(P,{label:"Container Engine",htmlFor:"container_engine",helpText:"Select the container engine installed on your system",required:!0,children:r.jsx(se,{id:"container_engine",name:"container_engine",options:yi,value:c??"",onChange:g,disabled:b.isRunning||b.success})}),m.container&&r.jsx("div",{className:"text-sm text-red-600 mt-1 bg-red-50 p-2 border-l-4 border-red-500",children:m.container}),b.message&&r.jsx(fi,{variant:I(),children:b.message}),r.jsx("div",{className:"relative",children:r.jsxs("div",{className:"flex flex-col",children:[r.jsx(Y,{onClick:A,disabled:p||b.success,variant:"primary",type:"button",className:"flex items-center justify-center gap-2",children:v()}),b.success&&r.jsxs("div",{className:"mt-2 flex items-center text-sm text-green-600",children:[r.jsx("svg",{className:"h-4 w-4 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Container is running. You may proceed to the next step."]}),!b.success&&!p&&!b.message&&r.jsxs("div",{className:"mt-2 flex items-center text-sm text-blue-600",children:[r.jsxs("svg",{className:"h-4 w-4 mr-1",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),r.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"8"})]}),"You must start the container before proceeding to the next step"]})]})})]}),s==="dev_mode"&&r.jsxs(vr,{children:[r.jsx("strong",{children:"Warning:"})," Dev mode runs everything in a single process and is not recommended for production use."]})]}),r.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[r.jsx(Y,{onClick:i,variant:"outline",type:"button",children:"Previous"}),r.jsxs(Y,{type:"submit",disabled:p||s==="container"&&!b.success,variant:s==="container"&&!b.success?"secondary":"primary",children:[s==="container"&&!b.success&&!p&&r.jsxs("span",{className:"flex items-center",children:[r.jsx("svg",{className:"h-4 w-4 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),"Run Container First"]}),!(s==="container"&&!b.success&&!p)&&"Next"]})]})]})}function _i({title:e="Confirmation Required",message:t,onConfirm:n,onCancel:i}){return r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white rounded-lg p-6 max-w-md w-full",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:e}),r.jsx("p",{className:"mb-6 text-gray-700",children:t}),r.jsxs("div",{className:"flex justify-end space-x-3",children:[r.jsx(Y,{variant:"outline",onClick:i,children:"Cancel"}),r.jsx(Y,{onClick:n,children:"Continue"})]})]})})}function wr({id:e,name:t,value:n,onChange:i,placeholder:s="",required:a=!1,disabled:o=!1,className:l="",suggestions:u,onFocus:c,fetchSuggestions:d,showLoadingIndicator:m=!1}){const[h,p]=k.useState(!1),[w,b]=k.useState([]),[C,g]=k.useState(!1),_=k.useRef(null),A=k.useRef(null);k.useEffect(()=>{if(u&&u.length>0){const I=u.filter(v=>v!=null).filter(v=>v.toLowerCase().includes((n||"").toLowerCase()));b(I)}else b([])},[n,u]),k.useEffect(()=>{const I=v=>{_.current&&!_.current.contains(v.target)&&A.current&&!A.current.contains(v.target)&&p(!1)};return document.addEventListener("mousedown",I),()=>{document.removeEventListener("mousedown",I)}},[]);const R=async()=>{if(c&&c(),d)try{g(!0);const I=await d();I&&I.length>0&&b(I)}catch(I){console.error("Error fetching suggestions:",I)}finally{g(!1)}},L=()=>{p(!0)},y=I=>{var N;i({target:{name:t||e,value:I}}),p(!1),(N=_.current)==null||N.focus()};return r.jsxs("div",{className:"relative w-full",children:[r.jsx("input",{ref:_,id:e,name:t||e,type:"text",value:n||"",onChange:i,onFocus:R,onClick:L,placeholder:s,required:a,disabled:o,className:`
          w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm
          focus:outline-none focus:ring-blue-500 focus:border-blue-500
          disabled:bg-gray-100 disabled:text-gray-500
          ${l}
        `,autoComplete:"off"}),C&&m&&r.jsx("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-solace-green"})}),h&&w.length>0&&r.jsx("div",{ref:A,className:"absolute z-10 w-full mt-1 border bg-white border-gray-300 rounded-md shadow-lg max-h-60 overflow-auto",children:r.jsx("ul",{children:w.map((I,v)=>r.jsx("li",{onClick:()=>y(I),onKeyDown:N=>N.key==="Enter"&&y(I),className:"px-3 py-2 cursor-pointer hover:bg-stone-300",tabIndex:0,children:I},v))})})]})}const xn={openai:"https://api.openai.com/v1",anthropic:"https://api.anthropic.com",google:"https://generativelanguage.googleapis.com/v1beta/openai",aws:"https://bedrock-runtime.us-east-1.amazonaws.com",cohere:"https://api.cohere.ai/compatibility/v1"},vi=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"google",label:"Google Gemini"},{value:"azure",label:"Azure"},{value:"openai_compatible",label:"OpenAI Compatible Provider"}],kr={openai:"openai",anthropic:"anthropic",google:"openai",openai_compatible:"openai",azure:"azure"},wi={openai:["o3-mini","o3-mini-high","o3-mini-low","o1","o1-preview","o1-mini","gpt-4.5-preview","gpt-4o","gpt-4o-mini"],anthropic:["claude-3-7-sonnet-20250219","claude-3-5-sonnet-20241022","claude-3-5-haiku-20241022","claude-3-opus-20240229","claude-3-haiku-20240307"],google:["gemini-2.0-flash-001","gemini-2.0-pro-exp-02-05","gemini-2.0-flash-lite-001","gemini-2.0-flash-thinking-exp-01-21","gemini-1.5-flash-002","gemini-1.5-pro-002"],bedrock:["amazon.nova-pro-v1:0","amazon.nova-pro-latency-optimized-v1:0","amazon.nova-lite-v1:0","amazon.nova-micro-v1:0","anthropic.claude-3-7-sonnet-20250219-v1:0","anthropic.claude-3-5-sonnet-20241022-v2:0","anthropic.claude-3-5-haiku-20241022-v1:0","anthropic.claude-3-5-sonnet-20240620-v1:0","anthropic.claude-3-opus-20240229-v1:0","anthropic.claude-3-sonnet-20240229-v1:0","anthropic.claude-3-haiku-20240307-v1:0"],custom:[]};async function ki(e,t){try{const n=e.endsWith("/")?e:`${e}/`,i=await fetch(`${n}v1/models`,{method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});if(!i.ok)throw new Error(`Failed to fetch models: ${i.status}`);const s=await i.json();return s.data&&Array.isArray(s.data)?s.data.filter(a=>a.id).map(a=>a.id):s.models&&Array.isArray(s.models)?s.models.filter(a=>a.id??a.name).map(a=>a.id??a.name):Array.isArray(s)?s.filter(a=>a.id??a.name).map(a=>a.id??a.name):[]}catch(n){return console.error("Error fetching models:",n),[]}}const jr=(e,t)=>e.includes("/")?e:`${kr[t]||t}/${e}`;function Sr({data:e,updateData:t,onNext:n,onPrevious:i}){const{llm_provider:s,llm_endpoint_url:a,llm_api_key:o,llm_model_name:l}=e,[u,c]=k.useState({}),[d,m]=k.useState(!1),[h,p]=k.useState(null),[w,b]=k.useState(!1),[C,g]=k.useState([]),[_,A]=k.useState(!1),[R,L]=k.useState(null);k.useEffect(()=>{const S={};s||(S.llm_provider="openai"),Object.keys(S).length>0&&t(S)},[e,t]),k.useEffect(()=>{if(s){const S={};if(R!==null&&R!==s){if(S.llm_model_name="",s!=="openai_compatible"){const F=xn[s]||"";S.llm_endpoint_url=F}else S.llm_endpoint_url="";Object.keys(S).length>0&&t(S)}L(s)}},[s,R,t]),k.useEffect(()=>{g(s&&s!=="openai_compatible"?wi[s]||[]:[])},[s]);const y=S=>{t({[S.target.name]:S.target.value})},I=k.useCallback(async()=>{if(s==="openai_compatible"&&a&&o){A(!0);try{const S=await ki(a,o);g(S)}catch(S){console.error("Error fetching models:",S)}finally{A(!1)}}return[]},[s,a,o]),v=()=>{const S={};let F=!0;return s||(S.llm_provider="LLM provider is required",F=!1),s==="openai_compatible"&&!a&&(S.llm_endpoint_url="LLM endpoint is required for OpenAI compatible endpoint}",F=!1),l||(S.llm_model_name="LLM model name is required",F=!1),o||(S.llm_api_key="LLM API key is required",F=!1),c(S),F},N=async()=>{m(!0),p(null);try{const S=s!=="openai_compatible"&&xn[s]||a,F=jr(l||"",s||""),O=await(await fetch("/api/test_llm_config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:F,api_key:o,base_url:S})})).json();O.status==="success"?(m(!1),n()):(p(O.message??"Failed to test LLM configuration"),b(!0),m(!1))}catch(S){p(S instanceof Error?`Error: ${S.message}`:"An unexpected error occurred while testing the LLM configuration"),b(!0),m(!1)}},z=S=>{S.preventDefault(),v()&&N()};return r.jsxs("form",{onSubmit:z,children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ee,{className:"mb-4",children:'Configure your AI service provider for language models. To use a LLM provider not in the dropdown choose "OpenAI Compatible Provider" and enter your base URL, API key and model name.'}),r.jsxs("div",{className:"border-b border-gray-200 pb-4 mb-4",children:[r.jsx("h3",{className:"text-lg font-medium mb-4 text-gray-700 font-semibold",children:"Language Model Configuration"}),r.jsx(P,{label:"LLM Provider",htmlFor:"llm_provider",error:u.llm_provider,required:!0,children:r.jsx(se,{id:"llm_provider",name:"llm_provider",value:s||"",onChange:y,options:vi})}),(s==="openai_compatible"||s==="azure")&&r.jsx(P,{label:"LLM Endpoint URL",htmlFor:"llm_endpoint_url",error:u.llm_endpoint_url,required:!0,children:r.jsx(G,{id:"llm_endpoint_url",name:"llm_endpoint_url",value:a||"",onChange:y,placeholder:"https://api.example.com/v1"})}),r.jsx(P,{label:"LLM API Key",htmlFor:"llm_api_key",error:u.llm_api_key,required:!0,children:r.jsx(G,{id:"llm_api_key",name:"llm_api_key",type:"password",value:o||"",onChange:y,placeholder:"Enter your API key"})}),s==="azure"&&r.jsxs(vr,{className:"mb-4",children:[r.jsx("strong",{children:"Important:"}),' For Azure, in the "LLM Model Name" field, enter your ',r.jsx("strong",{children:"deployment name"})," (not the underlying model name). Your Azure deployment name is the name you assigned when you deployed the model in Azure OpenAI Service. For more details, refer to the"," ",r.jsx("a",{href:"https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal#deploy-a-model",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Azure documentation"}),"."]}),r.jsx(P,{label:"LLM Model Name",htmlFor:"llm_model_name",error:u.llm_model_name,helpText:"Select or type a model name",required:!0,children:r.jsx(wr,{id:"llm_model_name",name:"llm_model_name",value:l||"",onChange:y,placeholder:"Select or type a model name",suggestions:C,onFocus:s==="openai_compatible"?I:void 0,showLoadingIndicator:_})})]})]}),r.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[r.jsx(Y,{onClick:i,disabled:e.setupPath==="quick",variant:"outline",children:"Previous"}),r.jsx(Y,{type:"submit",children:"Next"})]}),d&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white rounded-lg p-6 max-w-md w-full text-center",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Testing LLM Configuration"}),r.jsx("div",{className:"flex justify-center mb-4",children:r.jsx("div",{className:"animate-spin rounded-full h-10 w-10 border-b-2 border-solace-green"})}),r.jsx("p",{children:"Please wait while we test your LLM configuration..."})]})}),w&&r.jsx(_i,{title:"Connection Test Failed",message:`We couldn't connect to your AI provider: ${h}
          Please check your API key, model name, and endpoint URL (if applicable).
          Do you want to skip this check and continue anyway?`,onConfirm:()=>{b(!1),n()},onCancel:()=>{b(!1)}})]})}const Ae=({id:e,label:t,values:n,onChange:i,placeholder:s,helpText:a,error:o,required:l,inputButtonText:u="Add",inputPlaceholder:c="Type and press Add..."})=>{const[d,m]=k.useState(""),h=C=>{m(C.target.value)},p=()=>{if(d.trim()!==""){if(n.includes(d.trim())){m("");return}i([...n,d.trim()]),m("")}},w=C=>{i(n.filter(g=>g!==C))},b=C=>{C.key==="Enter"&&(C.preventDefault(),p())};return r.jsxs(P,{label:t,htmlFor:e,helpText:a,error:o,required:l,children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[r.jsx(G,{id:e,name:e,value:d,onChange:h,onKeyDown:b,placeholder:c,className:"flex-grow"}),r.jsx(Y,{onClick:p,variant:"secondary",type:"button",children:u})]}),n.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 mt-2 p-2 border border-gray-200 rounded-md min-h-[40px]",children:n.map((C,g)=>r.jsxs("div",{className:"flex items-center bg-gray-100 text-gray-700 text-sm font-medium px-3 py-1 rounded-full",children:[r.jsx("span",{children:C}),r.jsx("button",{type:"button",onClick:()=>w(C),className:"ml-2 text-gray-500 hover:text-gray-700 focus:outline-none","aria-label":`Remove ${C}`,children:"×"})]},g))}),n.length===0&&s&&r.jsx("div",{className:"mt-2 p-2 border border-dashed border-gray-300 rounded-md min-h-[40px] flex items-center justify-center",children:r.jsx("p",{className:"text-sm text-gray-400",children:s})})]})};function be({id:e,checked:t,onChange:n,label:i,disabled:s=!1,className:a=""}){const o=l=>{n(l.target.checked)};return r.jsxs("div",{className:`flex items-center ${a}`,children:[r.jsx("input",{id:e,type:"checkbox",checked:t,onChange:o,disabled:s,className:"h-4 w-4 text-solace-green focus:ring-solace-green border-gray-300 rounded"}),i&&r.jsx("label",{htmlFor:e,className:"ml-2 block text-sm text-gray-700",children:i})]})}const ji=[{value:"memory",label:"Memory: Store session data in memory"},{value:"vertex_rag",label:"Vertex RAG: Use Google Vertex AI for RAG capabilities"}],Si=[{value:"PERSISTENT",label:"Persistent: Keep session history indefinitely"},{value:"RUN_BASED",label:"Run-based: Clear session history after each run"}],Ni=[{value:"memory",label:"Memory: Store artifacts in memory (temporary)"},{value:"filesystem",label:"Filesystem: Store artifacts on disk"},{value:"gcs",label:"GCS: Store artifacts in Google Cloud Storage"}],Ci=[{value:"namespace",label:"Namespace: Share artifacts within the namespace"},{value:"app",label:"App: Isolate artifacts by app name"},{value:"custom",label:"Custom: Use a custom scope identifier"}],Ai=[{value:"ignore",label:"Ignore: Do not include artifacts in messages"},{value:"embed",label:"Embed: Include base64 data in messages"},{value:"reference",label:"Reference: Include fetch URI in messages"}];function Ei({data:e,updateData:t,onNext:n,onPrevious:i}){const[s,a]=k.useState({}),[o,l]=k.useState(!1),u=(M,ie)=>{if(M==null)return ie;if(Array.isArray(M))return M.map(he=>String(he).trim()).filter(he=>he.length>0);const Te=String(M).trim();return Te===""?[]:Te.split(",").map(he=>he.trim()).filter(he=>he.length>0)},c=e,[d,m]=k.useState(c.agent_name||"OrchestratorAgent"),[h,p]=k.useState(c.supports_streaming!==!1),[w,b]=k.useState(c.session_service_type||"memory"),[C,g]=k.useState(c.orchestrator_database_url||""),[_,A]=k.useState(c.session_service_behavior||"PERSISTENT"),[R,L]=k.useState(c.artifact_service_type||"filesystem"),[y,I]=k.useState(c.artifact_service_base_path||"/tmp/samv2"),[v,N]=k.useState(c.artifact_service_scope||"namespace"),[z,S]=k.useState(c.artifact_handling_mode||"reference"),[F,D]=k.useState(c.enable_embed_resolution!==!1),[O,U]=k.useState(c.enable_artifact_content_instruction!==!1),[ee,B]=k.useState(c.agent_card_description||"The Orchestrator component. It manages tasks, and coordinating multi-agent workflows."),[q,X]=k.useState(u(c.agent_card_default_input_modes,["text"])),[f,ne]=k.useState(u(c.agent_card_default_output_modes,["text","file"])),[le,x]=k.useState(c.agent_discovery_enabled!==!1),[ae,_e]=k.useState(c.agent_card_publishing_interval||10),[re,Ie]=k.useState(u(c.inter_agent_communication_allow_list,["*"])),[ve,Ne]=k.useState(u(c.inter_agent_communication_deny_list,[])),[we,Fe]=k.useState(c.inter_agent_communication_timeout||180);k.useEffect(()=>{o||(c.agent_name&&m(c.agent_name),c.supports_streaming!==void 0&&p(c.supports_streaming),c.session_service_type&&b(c.session_service_type),c.session_service_behavior&&A(c.session_service_behavior),c.artifact_service_type&&L(c.artifact_service_type),c.artifact_service_base_path&&I(c.artifact_service_base_path),c.artifact_service_scope&&N(c.artifact_service_scope),c.artifact_handling_mode&&S(c.artifact_handling_mode),c.enable_embed_resolution!==void 0&&D(c.enable_embed_resolution),c.enable_artifact_content_instruction!==void 0&&U(c.enable_artifact_content_instruction),c.agent_card_description&&B(c.agent_card_description),c.agent_card_default_input_modes!==void 0&&X(u(c.agent_card_default_input_modes,["text"])),c.agent_card_default_output_modes!==void 0&&ne(u(c.agent_card_default_output_modes,["text","file"])),c.agent_discovery_enabled!==void 0&&x(c.agent_discovery_enabled),c.agent_card_publishing_interval&&_e(c.agent_card_publishing_interval),c.inter_agent_communication_allow_list!==void 0&&Ie(u(c.inter_agent_communication_allow_list,["*"])),c.inter_agent_communication_deny_list!==void 0&&Ne(u(c.inter_agent_communication_deny_list,[])),c.inter_agent_communication_timeout&&Fe(c.inter_agent_communication_timeout),l(!0))},[e,o]);const bt=M=>{m(M.target.value),t({agent_name:M.target.value})},_t=M=>{p(M),t({supports_streaming:M})},vt=M=>{b(M.target.value),t({session_service_type:M.target.value})},nt=M=>{A(M.target.value),t({session_service_behavior:M.target.value})},rt=M=>{L(M.target.value),t({artifact_service_type:M.target.value})},it=M=>{I(M.target.value),t({artifact_service_base_path:M.target.value})},wt=M=>{N(M.target.value),t({artifact_service_scope:M.target.value})},st=M=>{S(M.target.value),t({artifact_handling_mode:M.target.value})},at=M=>{D(M),t({enable_embed_resolution:M})},kt=M=>{U(M),t({enable_artifact_content_instruction:M})},jt=M=>{B(M.target.value),t({agent_card_description:M.target.value})},St=M=>{X(M),t({agent_card_default_input_modes:M})},Nt=M=>{ne(M),t({agent_card_default_output_modes:M})},Ct=M=>{x(M),t({agent_discovery_enabled:M})},j=M=>{_e(Number(M.target.value)),t({agent_card_publishing_interval:Number(M.target.value)})},T=M=>{Ie(M),t({inter_agent_communication_allow_list:M})},V=M=>{Ne(M),t({inter_agent_communication_deny_list:M})},J=M=>{Fe(Number(M.target.value)),t({inter_agent_communication_timeout:Number(M.target.value)})},Q=()=>{const M={};let ie=!0;return d?/^[a-zA-Z0-9_]+$/.test(d)||(M.agentName="Agent name can only contain letters, numbers, and underscores.",ie=!1):(M.agentName="Agent name is required",ie=!1),R==="filesystem"&&!y&&(M.artifactBasePath="Artifact base path is required for filesystem service",ie=!1),(!ae||ae<=0)&&(M.cardPublishingInterval="Publishing interval must be a positive number",ie=!1),(!we||we<=0)&&(M.communicationTimeout="Communication timeout must be a positive number",ie=!1),a(M),ie},pe=M=>{M.preventDefault(),Q()&&n()};return r.jsxs("form",{onSubmit:pe,children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ee,{className:"mb-4",children:"Configure the main orchestrator for your Solace Agent Mesh system. This will set up the agent that orchestrates communication between components."}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx("div",{className:"col-span-2",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Basic Configuration"})}),r.jsx(P,{label:"Agent Name",htmlFor:"agent_name",error:s.agentName,required:!0,helpText:"The name can only contain letters, numbers, and underscores.",children:r.jsx(G,{id:"agent_name",value:d,onChange:bt,placeholder:"OrchestratorAgent",required:!0})}),r.jsx(P,{label:"Supports Streaming",htmlFor:"supports_streaming",helpText:"Enable streaming support for the agent",children:r.jsx(be,{id:"supports_streaming",checked:h,onChange:_t,label:"Enable streaming support"})}),r.jsx("div",{className:"col-span-2 mt-4",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Session Service"})}),r.jsx(P,{label:"Session Service Type",htmlFor:"session_service_type",required:!0,children:r.jsx(se,{id:"session_service_type",options:ji,value:w,onChange:vt})}),r.jsx(P,{label:"Session Behavior",htmlFor:"session_behavior",required:!0,children:r.jsx(se,{id:"session_behavior",options:Si,value:_,onChange:nt})}),r.jsx("div",{className:"col-span-2 mt-4",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Artifact Service"})}),r.jsx(P,{label:"Artifact Service Type",htmlFor:"artifact_service_type",required:!0,children:r.jsx(se,{id:"artifact_service_type",options:Ni,value:R,onChange:rt})}),R==="filesystem"&&r.jsx(P,{label:"Artifact Base Path",htmlFor:"artifact_base_path",error:s.artifactBasePath,required:!0,children:r.jsx(G,{id:"artifact_base_path",value:y,onChange:it,placeholder:"/tmp/samv2"})}),r.jsx(P,{label:"Artifact Scope",htmlFor:"artifact_scope",required:!0,children:r.jsx(se,{id:"artifact_scope",options:Ci,value:v,onChange:wt})}),r.jsx(P,{label:"Artifact Handling Mode",htmlFor:"artifact_handling_mode",required:!0,children:r.jsx(se,{id:"artifact_handling_mode",options:Ai,value:z,onChange:st})}),r.jsx("div",{className:"col-span-2 mt-4",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Feature Flags"})}),r.jsx(P,{label:"Enable Embed Resolution",htmlFor:"enable_embed_resolution",children:r.jsx(be,{id:"enable_embed_resolution",checked:F,onChange:at,label:"Enable embed resolution"})}),r.jsx(P,{label:"Enable Artifact Content Instruction",htmlFor:"enable_artifact_content_instruction",children:r.jsx(be,{id:"enable_artifact_content_instruction",checked:O,onChange:kt,label:"Enable artifact content instruction"})}),r.jsx("div",{className:"col-span-2 mt-4",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Agent Card"})}),r.jsx("div",{className:"col-span-2",children:r.jsx(P,{label:"Agent Card Description",htmlFor:"agent_card_description",required:!0,children:r.jsx(G,{id:"agent_card_description",value:ee,onChange:jt,placeholder:"A helpful assistant accessed via a custom endpoint, capable of delegating tasks."})})}),r.jsx(Ae,{id:"default_input_modes",label:"Default Input Modes",values:q,onChange:St,helpText:"Enter input modes (e.g., text). Press Enter or comma to add.",placeholder:"No input modes added yet.",inputPlaceholder:"e.g., text"}),r.jsx(Ae,{id:"default_output_modes",label:"Default Output Modes",values:f,onChange:Nt,helpText:"Enter output modes (e.g., text, file). Press Enter or comma to add.",placeholder:"No output modes added yet.",inputPlaceholder:"e.g., text, file"}),r.jsx("div",{className:"col-span-2 mt-4",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Agent Discovery"})}),r.jsx(P,{label:"Enable Agent Discovery",htmlFor:"agent_discovery_enabled",children:r.jsx(be,{id:"agent_discovery_enabled",checked:le,onChange:Ct,label:"Enable agent discovery"})}),r.jsx(P,{label:"Card Publishing Interval",htmlFor:"card_publishing_interval",error:s.cardPublishingInterval,helpText:"Interval in seconds for publishing agent card",required:!0,children:r.jsx(G,{id:"card_publishing_interval",type:"number",value:ae.toString(),onChange:j,placeholder:"10"})}),r.jsx("div",{className:"col-span-2 mt-4",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Inter-Agent Communication"})}),r.jsx(Ae,{id:"allow_list",label:"Allow List",values:re,onChange:T,helpText:"Agent name patterns to allow delegation to (e.g., *, SpecificAgent*). Press Enter or comma to add.",placeholder:"No allow list patterns added.",inputPlaceholder:"e.g., *"}),r.jsx(Ae,{id:"deny_list",label:"Deny List",values:ve,onChange:V,helpText:"Agent name patterns to deny delegation to. Press Enter or comma to add.",placeholder:"No deny list patterns added.",inputPlaceholder:"e.g., RiskyAgent*"}),r.jsx(P,{label:"Communication Timeout",htmlFor:"communication_timeout",error:s.communicationTimeout,helpText:"Timeout in seconds for inter-agent communication",required:!0,children:r.jsx(G,{id:"communication_timeout",type:"number",value:we.toString(),onChange:J,placeholder:"30"})})]})]}),r.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[r.jsx(Y,{onClick:i,variant:"outline",children:"Previous"}),r.jsx(Y,{type:"submit",children:"Next"})]})]})}function Ii({data:e,updateData:t,onNext:n,onPrevious:i}){const[s,a]=k.useState({}),o=e;k.useEffect(()=>{const m={add_webui_gateway:o.add_webui_gateway??!1,webui_session_secret_key:o.webui_session_secret_key??"",webui_fastapi_host:o.webui_fastapi_host??"127.0.0.1",webui_fastapi_port:o.webui_fastapi_port??8e3,webui_enable_embed_resolution:o.webui_enable_embed_resolution??!0,webui_frontend_welcome_message:o.webui_frontend_welcome_message??"",webui_frontend_bot_name:o.webui_frontend_bot_name??"Solace Agent Mesh",webui_frontend_collect_feedback:o.webui_frontend_collect_feedback??!1},h={};for(const p in m)o[p]===void 0&&m[p]!==void 0&&(h[p]=m[p]);Object.keys(h).length>0&&t(h)},[]);const l=m=>{const{name:h,value:p,type:w}=m.target;t(w==="number"?{[h]:p===""?"":Number(p)}:{[h]:p})},u=(m,h)=>{t({[m]:h})},c=()=>{const m={};let h=!0;return o.add_webui_gateway&&(o.webui_session_secret_key||(m.webui_session_secret_key="Session Secret Key is required.",h=!1),o.webui_fastapi_host||(m.webui_fastapi_host="FastAPI Host is required.",h=!1),o.webui_fastapi_port===void 0?(m.webui_fastapi_port="FastAPI Port is required.",h=!1):(isNaN(Number(o.webui_fastapi_port))||Number(o.webui_fastapi_port)<=0)&&(m.webui_fastapi_port="FastAPI Port must be a positive number.",h=!1)),a(m),h},d=m=>{m.preventDefault(),c()&&n()};return r.jsxs("form",{onSubmit:d,children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ee,{className:"mb-4",children:"Optionally, configure a Web UI Gateway to interact with your Solace Agent Mesh. This provides a Web UI chat interface."}),r.jsx(P,{label:"",htmlFor:"add_webui_gateway",children:r.jsx(be,{id:"add_webui_gateway",checked:o.add_webui_gateway||!1,onChange:m=>u("add_webui_gateway",m),label:"Add Web UI Gateway"})}),o.add_webui_gateway&&r.jsxs("div",{className:"space-y-4 p-4 border border-gray-200 rounded-md mt-4",children:[r.jsx("h3",{className:"text-md font-medium text-gray-800 mb-3",children:"Web UI Gateway Configuration"}),r.jsx(P,{label:"Session Secret Key",htmlFor:"webui_session_secret_key",error:s.webui_session_secret_key,required:!0,children:r.jsx(G,{id:"webui_session_secret_key",name:"webui_session_secret_key",type:"password",value:o.webui_session_secret_key||"",onChange:l,placeholder:"Enter a strong secret key"})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(P,{label:"FastAPI Host",htmlFor:"webui_fastapi_host",error:s.webui_fastapi_host,required:!0,children:r.jsx(G,{id:"webui_fastapi_host",name:"webui_fastapi_host",value:o.webui_fastapi_host||"127.0.0.1",onChange:l,placeholder:"127.0.0.1"})}),r.jsx(P,{label:"FastAPI Port",htmlFor:"webui_fastapi_port",error:s.webui_fastapi_port,required:!0,children:r.jsx(G,{id:"webui_fastapi_port",name:"webui_fastapi_port",type:"number",value:o.webui_fastapi_port===void 0?"":String(o.webui_fastapi_port),onChange:l,placeholder:"8000"})})]}),r.jsx(P,{label:"",htmlFor:"webui_enable_embed_resolution",children:r.jsx(be,{id:"webui_enable_embed_resolution",checked:o.webui_enable_embed_resolution||!1,onChange:m=>u("webui_enable_embed_resolution",m),label:"Enable Embed Resolution in Web UI"})}),r.jsx("h4",{className:"text-sm font-medium text-gray-700 mt-3 mb-2",children:"Frontend Customization"}),r.jsx(P,{label:"Frontend Welcome Message",htmlFor:"webui_frontend_welcome_message",error:s.webui_frontend_welcome_message,children:r.jsx(G,{id:"webui_frontend_welcome_message",name:"webui_frontend_welcome_message",value:o.webui_frontend_welcome_message||"",onChange:l,placeholder:"Welcome to the Solace Agent Mesh!"})}),r.jsx(P,{label:"Frontend Bot Name",htmlFor:"webui_frontend_bot_name",error:s.webui_frontend_bot_name,children:r.jsx(G,{id:"webui_frontend_bot_name",name:"webui_frontend_bot_name",value:o.webui_frontend_bot_name||"Solace Agent Mesh",onChange:l,placeholder:"Solace Agent Mesh"})}),r.jsx(P,{label:"",htmlFor:"webui_frontend_collect_feedback",children:r.jsx(be,{id:"webui_frontend_collect_feedback",checked:o.webui_frontend_collect_feedback||!1,onChange:m=>u("webui_frontend_collect_feedback",m),label:"Enable Feedback Collection in Frontend"})})]})]}),r.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[r.jsx(Y,{onClick:i,variant:"outline",type:"button",children:"Previous"}),r.jsx(Y,{type:"submit",children:"Next"})]})]})}const Ti=["llm","ai","api","url","vpn"],Pi=["broker_password","llm_api_key","webui_session_secret_key"],yn={Project:["namespace"],Broker:["dev_mode","broker_type","broker_url","broker_vpn","broker_username","broker_password"],"AI Provider":["llm_model_name","llm_endpoint_url","llm_api_key"],Orchestrator:["agent_name","supports_streaming","session_service_type","session_service_behavior","artifact_service_type","artifact_service_base_path","artifact_service_scope","artifact_handling_mode","enable_embed_resolution","enable_artifact_content_instruction","agent_card_description","agent_card_default_input_modes","agent_card_default_output_modes","agent_discovery_enabled","agent_card_publishing_interval","inter_agent_communication_allow_list","inter_agent_communication_deny_list","inter_agent_communication_timeout"],"Web UI":["add_webui_gateway","webui_frontend_welcome_message","webui_frontend_bot_name","webui_frontend_collect_feedback","webui_session_secret_key","webui_fastapi_host","webui_fastapi_port","webui_enable_embed_resolution"]};function Nr({data:e,updateData:t,onPrevious:n}){const[i,s]=k.useState(!1),[a,o]=k.useState(null),l=g=>g===void 0||g===""||Array.isArray(g)&&g.length===0,u=g=>g.split("_").map(_=>Ti.includes(_.toLowerCase())?_.toUpperCase():_.charAt(0).toUpperCase()+_.slice(1)).join(" "),c=(g,_)=>Pi.includes(g)||g.toUpperCase().includes("API_KEY")?_?"••••••••":"Not provided":typeof _=="boolean"?_?"Yes":"No":Array.isArray(_)?_.join(", "):_?String(_):"Not provided",d=g=>{switch(g){case"solace":return"Existing Solace Pub/Sub+ broker";case"container":return"New local Solace PubSub+ broker container (podman/docker)";case"dev_mode":return"Run in 'dev mode' - all in one process (not recommended for production)";default:return g}},m=()=>{const g=e.broker_type;return e.dev_mode?r.jsx("div",{children:r.jsxs("div",{className:"mb-1",children:[r.jsx("span",{className:"text-gray-600",children:"Type:"}),r.jsx("span",{className:"font-medium text-gray-900 ml-2",children:d("dev_mode")})]})}):r.jsxs("div",{children:[r.jsxs("div",{className:"mb-1",children:[r.jsx("span",{className:"text-gray-600",children:"Type:"}),r.jsx("span",{className:"font-medium text-gray-900 ml-2",children:d(g)})]}),g==="container"&&r.jsx("div",{className:"pl-4 border-l-2 border-gray-300 mb-2",children:r.jsxs("div",{className:"flex mb-1",children:[r.jsx("span",{className:"text-gray-600",children:"Container Engine:"}),r.jsx("span",{className:"font-medium text-gray-900 ml-2",children:String(e.container_engine)??"Docker"})]})}),(g==="solace"||g==="container")&&r.jsxs("div",{className:"pl-4 border-l-2 border-gray-300",children:[r.jsxs("div",{className:"flex mb-1",children:[r.jsx("span",{className:"text-gray-600",children:"Broker URL:"}),r.jsx("span",{className:"font-medium text-gray-900 ml-2",children:String(e.broker_url)})]}),r.jsxs("div",{className:"flex mb-1",children:[r.jsx("span",{className:"text-gray-600",children:"Broker VPN:"}),r.jsx("span",{className:"font-medium text-gray-900 ml-2",children:String(e.broker_vpn)})]}),r.jsxs("div",{className:"flex mb-1",children:[r.jsx("span",{className:"text-gray-600",children:"Username:"}),r.jsx("span",{className:"font-medium text-gray-900 ml-2",children:String(e.broker_username)})]}),r.jsxs("div",{className:"flex mb-1",children:[r.jsx("span",{className:"text-gray-600",children:"Password:"}),r.jsx("span",{className:"font-medium text-gray-900 ml-2",children:c("broker_password",e.broker_password)})]})]})]})},h=(g,_)=>_.some(R=>!l(e[R]))?r.jsxs("div",{className:"pb-4 mb-4 border-b border-gray-300 last:border-0 last:mb-0 last:pb-0",children:[r.jsx("h4",{className:"font-semibold text-solace-blue mb-3",children:g}),r.jsx("div",{className:"space-y-3",children:_.map(R=>l(e[R])?null:R==="dev_mode"?r.jsx("div",{children:m()},R):r.jsxs("div",{className:"flex mb-1",children:[r.jsxs("span",{className:"text-gray-600",children:[u(R),":"]}),r.jsx("span",{className:"font-medium text-gray-900 ml-2",children:c(R,e[R])})]},R))})]},g):null,p=g=>{const _={...g};return _.namespace&&!String(_.namespace).endsWith("/")&&(_.namespace+="/"),_.container_started&&delete _.container_started,_.llm_provider&&(_.llm_provider=kr[_.llm_provider]),_.llm_model_name&&_.llm_provider&&(_.llm_model_name=jr(String(_.llm_model_name),String(_.llm_provider)),delete _.llm_provider),e.broker_type==="container"&&(e.broker_type="solace"),_},w=async(g=!0)=>{const _=p(e);console.log("Submitting configuration:",_);try{const A=await fetch("api/save_config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g?{..._,force:!0}:_)}),R=await A.json();if(!A.ok)throw new Error(`HTTP error ${A.status}: ${R.message??"Unknown error"}`);if(R.status==="success"){console.log("Configuration sent successfully!"),t({showSuccess:!0});try{const L=await fetch("api/shutdown",{method:"POST"});L.ok?console.log("Shutdown request sent successfully"):console.warn("Shutdown request failed:",L.status)}catch(L){console.error("Error sending shutdown request:",L)}}else throw new Error(R.message??"Failed to save configuration")}catch(A){o(A instanceof Error?A.message:"An unknown error occurred"),console.error("Error saving configuration:",A)}finally{s(!1)}},b=async()=>{s(!0),o(null),await w()},C=g=>{g.preventDefault(),b()};return r.jsx("div",{className:"space-y-6",children:r.jsxs("form",{onSubmit:C,children:[r.jsx("div",{className:"bg-gray-100 border border-gray-300 rounded-md p-5 space-y-4",children:e.setupPath==="quick"?h("AI Provider",yn["AI Provider"]):Object.entries(yn).map(([g,_])=>h(g,_))}),a&&r.jsxs("div",{className:"p-4 bg-red-50 text-red-700 rounded-md border border-red-200",children:[r.jsx("p",{className:"font-medium",children:"Error initializing project"}),r.jsx("p",{children:a})]}),r.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[r.jsx(Y,{onClick:n,variant:"outline",type:"button",children:"Previous"}),r.jsx(Y,{type:"submit",disabled:i,children:i?r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r.jsx("span",{children:"Initializing..."})]}):"Initialize Project"})]})]})})}const Mi=({icon:e,title:t,description:n,time:i,link:s})=>r.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"block bg-white rounded-lg shadow-sm border border-gray-100 hover:shadow-md transition-all duration-200 hover:border-solace-blue/30 group h-full",children:r.jsxs("div",{className:"p-5 flex flex-col h-full",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("span",{className:"text-2xl mr-3",children:e}),r.jsx("h4",{className:"text-lg font-medium text-gray-800 group-hover:text-solace-blue transition-colors",children:t})]}),r.jsx("div",{className:"bg-gray-100 text-gray-600 px-3 py-1 rounded-full text-xs font-medium",children:i})]}),r.jsx("p",{className:"text-gray-600 text-sm flex-grow mb-4",children:n}),r.jsx("div",{className:"mt-auto flex justify-end",children:r.jsxs("span",{className:"text-solace-blue text-sm font-medium flex items-center group-hover:translate-x-1 transition-transform",children:["View Tutorial",r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 ml-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})})]})}),Fi=({icon:e,title:t,description:n,link:i})=>r.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"flex p-4 bg-gray-50 hover:bg-gray-100 rounded-lg border border-gray-200 transition-colors group",children:[r.jsx("div",{className:"mr-4 bg-solace-blue bg-opacity-10 p-3 rounded-lg text-solace-blue group-hover:bg-opacity-20",children:e}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-gray-800",children:t}),r.jsx("p",{className:"text-sm text-gray-600",children:n})]})]});function Li({text:e}){const[t,n]=k.useState(!1),i=async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}catch(a){console.error("Failed to copy text:",a)}},s=()=>t?r.jsx("svg",{className:"w-5 h-5 text-green-500 transition-all duration-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):r.jsx("svg",{className:"w-5 h-5 transition-all duration-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})});return r.jsx("button",{onClick:i,className:"text-white transition-colors opacity-100","aria-label":t?"Copied":"Copy to clipboard",children:s()})}function tn({title:e,message:t,initTab:n}){const[i,s]=k.useState(n??"getting-started"),a=3,o=i==="getting-started"?0:i==="tutorials"?1:2,l="Operation Successful!",u="Your configuration has been saved. You're now ready to proceed.",c=g=>g===0?"tutorials":g===1?"documentation":"getting-started",d=g=>g===1?"getting-started":g===2?"tutorials":"documentation",m=()=>{if(o<a-1){const g=c(o);s(g)}},h=()=>{if(o>0){const g=d(o);s(g)}},p=g=>{const _="px-4 py-3 text-sm font-medium ";return i===g?_+"text-solace-blue border-b-2 border-solace-blue":_+"text-gray-500 hover:text-solace-blue"},w=[{icon:"🌤️",title:"Weather Agent",description:"Build an agent that gives Solace Agent Mesh the ability to access real-time weather information.",time:"~5 min",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/tutorials/custom-agent"},{icon:"🗃️",title:"SQL Database Integration",description:"Enable Solace Agent Mesh to answer company-specific questions using a sample coffee company database.",time:"~10-15 min",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/tutorials/sql-database"},{icon:"🧠",title:"MCP Integration",description:"Integrating a Model Context Protocol (MCP) Server into Solace Agent Mesh.",time:"~10-15 min",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/tutorials/mcp-integration"},{icon:"💬",title:"Slack Integration",description:"Chat with Solace Agent Mesh directly from Slack.",time:"~20-30 min",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/tutorials/slack-integration"}],b=[{icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),title:"Getting Started",description:"Introduction and basic concepts",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/getting-started/introduction/"},{icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"})}),title:"Architecture",description:"System architecture and design",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/getting-started/component-overview"},{icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122"})}),title:"Tutorials",description:"Step-by-step guides",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/tutorials/event-mesh-gateway"},{icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),title:"User Guides",description:"User Guides for various components",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/user-guide/solace-ai-connector"}],C=()=>i==="getting-started"?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"p-6 bg-white rounded-lg shadow-sm border border-gray-100",children:[r.jsxs("h3",{className:"text-lg font-medium text-gray-800 mb-4 flex items-center",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2 text-solace-blue",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{d:"M11 3a1 1 0 10-2 0v1a1 1 0 102 0V3zM15.657 5.757a1 1 0 00-1.414-1.414l-.707.707a1 1 0 001.414 1.414l.707-.707zM18 10a1 1 0 01-1 1h-1a1 1 0 110-2h1a1 1 0 011 1zM5.05 6.464A1 1 0 106.464 5.05l-.707-.707a1 1 0 00-1.414 1.414l.707.707zM5 10a1 1 0 01-1 1H3a1 1 0 110-2h1a1 1 0 011 1zM8 16v-1h4v1a2 2 0 11-4 0zM12 14c.015-.34.208-.646.477-.859a4 4 0 10-4.954 0c.27.213.462.519.476.859h4.002z"})}),"Your Configuration Files"]}),r.jsx("p",{className:"text-gray-600 mb-4",children:"Your configurations have been saved in the following files:"}),r.jsxs("div",{className:"flex space-x-4 mb-4",children:[r.jsxs("div",{className:"bg-gray-50 px-4 py-3 rounded-md border border-gray-200 flex-1 flex items-center",children:[r.jsx("code",{className:"text-solace-blue font-mono",children:".env"}),r.jsx("span",{className:"ml-3 text-gray-500 text-sm",children:"Environment variables"})]}),r.jsxs("div",{className:"bg-gray-50 px-4 py-3 rounded-md border border-gray-200 flex-1 flex items-center",children:[r.jsx("code",{className:"text-solace-blue font-mono",children:"configs/shared_config.yaml"}),r.jsx("span",{className:"ml-3 text-gray-500 text-sm",children:"Config file"})]})]})]}),r.jsxs("div",{className:"p-6 bg-white rounded-lg shadow-sm border border-gray-100",children:[r.jsxs("h3",{className:"text-lg font-medium text-gray-800 mb-4 flex items-center",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2 text-solace-blue",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M12.316 3.051a1 1 0 01.633 1.265l-4 12a1 1 0 11-1.898-.632l4-12a1 1 0 011.265-.633zM5.707 6.293a1 1 0 010 1.414L3.414 10l2.293 2.293a1 1 0 11-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0zm8.586 0a1 1 0 011.414 0l3 3a1 1 0 010 1.414l-3 3a1 1 0 11-1.414-1.414L16.586 10l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"})}),"Start the Service"]}),r.jsx("p",{className:"text-gray-600 mb-4",children:"To start Solace Agent Mesh directly, run:"}),r.jsxs("div",{className:"bg-gray-800 text-gray-200 p-4 rounded-md font-mono text-sm mb-4 flex items-center justify-between group relative",children:[r.jsx("code",{children:"sam run"}),r.jsx(Li,{text:"sam run"})]}),r.jsxs("p",{className:"text-gray-600",children:["You can use"," ",r.jsx("code",{className:"bg-gray-100 px-1 py-0.5 rounded",children:"sam"})," as a shorthand for"," ",r.jsx("code",{className:"bg-gray-100 px-1 py-0.5 rounded",children:"solace-agent-mesh"})," ","in all commands."]})]})]}):i==="tutorials"?r.jsxs("div",{children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-800 mb-2",children:"Hands-on Tutorials"}),r.jsx("p",{className:"text-gray-600",children:"Ready to go further? Here are some practical tutorials to help you leverage the full potential of Solace Agent Mesh."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:w.map(g=>r.jsx(Mi,{icon:g.icon,title:g.title,description:g.description,time:g.time,link:g.link},g.title))})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"p-6 bg-white rounded-lg shadow-sm border border-gray-100",children:[r.jsxs("h3",{className:"text-lg font-medium text-gray-800 mb-4 flex items-center",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2 text-solace-blue",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),"Documentation Resources"]}),r.jsx("p",{className:"text-gray-600 mb-6",children:"Explore our comprehensive documentation to get the most out of Solace Agent Mesh:"}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:b.map(g=>r.jsx(Fi,{icon:g.icon,title:g.title,description:g.description,link:g.link},g.title))}),r.jsx("div",{className:"mt-6 text-center",children:r.jsxs("a",{href:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/getting-started/introduction/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-5 py-2 rounded-md bg-solace-blue text-white hover:bg-solace-blue-dark transition-colors",children:["View Documentation",r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 ml-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})})]})})]}),r.jsxs("div",{className:"p-6 bg-gradient-to-b from-solace-blue-light to-blue-50 rounded-lg text-center",children:[r.jsx("h3",{className:"text-lg font-medium text-solace-blue mb-2",children:"Connect with the Community"}),r.jsx("p",{className:"text-gray-600 mb-4",children:"Solace Agent Mesh is open source! We welcome contributions and discussions from the community."}),r.jsxs("div",{className:"mt-6 flex flex-col sm:flex-row justify-center items-stretch gap-4",children:[r.jsxs("a",{href:"https://github.com/SolaceLabs/solace-agent-mesh",target:"_blank",rel:"noopener noreferrer",className:"w-full sm:w-1/2 p-4 rounded-md bg-white text-solace-blue border border-solace-blue hover:bg-solace-blue hover:text-white transition-colors flex flex-col items-center justify-center group",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24",className:"mb-2 text-solace-blue group-hover:text-white transition-colors",children:r.jsx("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z",fill:"currentColor"})}),r.jsx("span",{className:"font-medium",children:"GitHub Repository"})]}),r.jsxs("a",{href:"https://solace.community/c/solace-agent-mesh/16",target:"_blank",rel:"noopener noreferrer",className:"w-full sm:w-1/2 p-4 rounded-md bg-white text-solace-blue border border-solace-blue hover:bg-solace-blue hover:text-white transition-colors flex flex-col items-center justify-center group",children:[r.jsx("img",{src:"data:image/png;data:image/png;base64,[encoded data, 7860 characters]",alt:"Solace Community Forum Logo",className:"max-h-8 mb-2 object-contain"}),r.jsx("span",{className:"font-medium",children:"Community Forum"})]})]})]})]});return r.jsxs("div",{className:"max-w-5xl mx-auto",children:[r.jsxs("div",{className:"p-8 bg-gradient-to-br from-green-50 to-blue-50 rounded-xl mb-8 text-center relative overflow-hidden",children:[r.jsxs("div",{className:"relative z-10",children:[r.jsx("div",{className:"inline-block bg-green-100 p-3 rounded-full mb-4",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 w-10 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),r.jsx("h2",{className:"text-2xl font-bold text-gray-800 mb-2",children:e||l}),r.jsx("p",{className:"text-gray-600 mb-6 max-w-2xl mx-auto",children:t||u}),r.jsxs("div",{className:"inline-flex items-center px-4 py-2 bg-solace-blue text-white rounded-full shadow-sm",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v3.586L7.707 9.293a1 1 0 00-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 10.586V7z",clipRule:"evenodd"})}),"Configuration saved successfully"]})]}),r.jsx("div",{className:"absolute top-0 right-0 -mt-10 -mr-10 h-40 w-40 bg-green-200 opacity-50 rounded-full"}),r.jsx("div",{className:"absolute bottom-0 left-0 -mb-10 -ml-10 h-32 w-32 bg-green-200 opacity-50 rounded-full"})]}),r.jsxs("div",{className:"flex items-center mb-6 border-b",children:[r.jsxs("div",{className:"flex-1 flex",children:[r.jsx("button",{onClick:()=>s("getting-started"),className:p("getting-started"),children:"Getting Started"}),r.jsx("button",{onClick:()=>s("tutorials"),className:p("tutorials"),children:"Tutorials"}),r.jsx("button",{onClick:()=>s("documentation"),className:p("documentation"),children:"Documentation"})]}),r.jsxs("div",{className:"text-gray-500 text-sm mr-4 flex items-center",children:["Page ",o+1," of ",a]})]}),C(),r.jsxs("div",{className:"mt-8 flex justify-between items-center",children:[r.jsx("div",{className:"text-sm text-gray-500",children:r.jsxs("span",{className:"md:hidden",children:["Page ",o+1," of ",a]})}),r.jsxs("div",{className:"flex space-x-4",children:[r.jsx(Y,{onClick:h,variant:"outline",type:"button",disabled:o===0,children:"Previous"}),r.jsx(Y,{onClick:m,type:"button",disabled:o===a-1,children:"Next"})]})]})]})}const At={id:"path-selection",title:"Setup Path",description:"Choose your setup path",component:hi},bn=[{id:"project-setup",title:"Project Structure",description:"Set up your project namespace",component:gi},{id:"broker-setup",title:"Broker Setup",description:"Configure your Solace PubSub+ broker connection",component:bi},{id:"ai-provider-setup",title:"AI Provider",description:"Configure your AI services",component:Sr},{id:"orchestrator-setup",title:"Orchestrator",description:"Configure your main orchestrator",component:Ei},{id:"webui-gateway-setup",title:"Web UI Gateway",description:"Configure the optional Web UI Gateway",component:Ii},{id:"completion",title:"Review & Submit",description:"Finalize your configuration",component:Nr}],_n=[{id:"ai-provider-setup",title:"AI Provider",description:"Configure your AI services",component:Sr},{id:"completion",title:"Review & Submit",description:"Finalize your configuration",component:Nr}];function Ri(){const[e,t]=k.useState(0),[n,i]=k.useState({}),[s,a]=k.useState(!1),[o,l]=k.useState(null),[u,c]=k.useState(null),[d,m]=k.useState(!1),[h,p]=k.useState([At]);k.useEffect(()=>{u&&(a(!0),fetch(`/api/default_options?path=${u}`).then(L=>{if(!L.ok)throw new Error("Failed to fetch default options");return L.json()}).then(L=>{if(L!=null&&L.default_options){const y=L.default_options;i(I=>({...I,...y})),a(!1)}else throw new Error("Invalid response format")}).catch(L=>{console.error("Error fetching default options:",L),l("Failed to connect to server, is the init process still running?"),a(!1)}))},[u]),k.useEffect(()=>{u==="quick"?p([At,..._n]):u==="advanced"&&p([At,...bn])},[u]);const w=h[e],b=L=>{L.setupPath&&typeof L.setupPath=="string"&&L.setupPath!==u&&c(L.setupPath),L.showSuccess&&m(!0),i(y=>({...y,...L}))},C=()=>{e<h.length-1&&t(e+1)},g=()=>{e>0&&t(e-1)};if(s&&e>0)return r.jsxs("div",{className:"max-w-4xl mx-auto p-6 flex flex-col items-center justify-center min-h-[400px]",children:[r.jsx("h1",{className:"text-3xl font-bold mb-8 text-solace-blue",children:"Solace Agent Mesh Initialization"}),r.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 w-full text-center",children:[r.jsxs("div",{className:"animate-pulse flex flex-col items-center",children:[r.jsx("div",{className:"h-4 w-1/2 bg-gray-200 rounded mb-4"}),r.jsx("div",{className:"h-10 w-3/4 bg-gray-200 rounded"})]}),r.jsx("p",{className:"mt-4",children:"Loading configuration options..."})]})]});if(o)return r.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[r.jsx("h1",{className:"text-3xl font-bold mb-8 text-center text-solace-blue",children:"Solace Agent Mesh Initialization"}),r.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 mb-6",children:[r.jsxs("div",{className:"bg-red-100 border-l-4 border-red-500 text-red-700 p-4",role:"alert",children:[r.jsx("p",{className:"font-bold",children:"Error"}),r.jsx("p",{children:o})]}),r.jsx("div",{className:"mt-4 flex justify-center",children:r.jsx("button",{onClick:()=>window.location.reload(),className:"bg-solace-blue hover:bg-blue-700 text-white font-bold py-2 px-4 rounded",children:"Retry"})})]})]});if(d)return r.jsx("div",{className:"max-w-4xl mx-auto p-6",children:r.jsx(tn,{title:"Solace Agent Mesh Initialized Successfully!",message:"Your project configuration has been saved. You are now ready to start building and running agents."})});const _=w==null?void 0:w.component;if(!_)return r.jsx("div",{className:"text-center p-10 text-red-600",children:"Error: Setup step not found."});const A=e>0,R=()=>u==="quick"?_n:u==="advanced"?bn:[];return r.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[r.jsx("h1",{className:"text-3xl font-bold mb-8 text-center text-solace-blue",children:"Solace Agent Mesh Initialization"}),A&&r.jsx("div",{className:"mb-8",children:r.jsx(en,{steps:R(),currentStepIndex:e>0?e-1:0,onStepClick:()=>{}})}),r.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 mb-6",children:[r.jsx("h2",{className:"text-xl font-bold mb-2 text-solace-blue",children:w.title}),r.jsx("p",{className:"text-gray-600 mb-6",children:w.description}),r.jsx(_,{data:n,updateData:b,onNext:C,onPrevious:g})]})]})}const Oi=[{value:"planning",label:"Planning Model (*planning_model)"},{value:"general",label:"General Model (*general_model)"},{value:"image_gen",label:"Image Generation Model (*image_gen_model)"},{value:"report_gen",label:"Report Generation Model (*report_gen_model)"},{value:"multimodal",label:"Multimodal Model (*multimodal_model)"},{value:"gemini_pro",label:"Gemini Pro Model (*gemini_pro_model)"}],zi=({data:e,updateData:t,onNext:n,onPrevious:i})=>{const s=l=>{const{name:u,value:c,type:d}=l.target,m=d==="checkbox"?l.target.checked:c;t({[u]:m})},a=()=>{if(!e.agent_name||e.agent_name.trim()===""){alert("Agent Name is required.");return}let l=e.instruction;if(typeof l=="string"&&l.includes("__AGENT_NAME__")){const u=e.agent_name;l=l.replace(/__AGENT_NAME__/g,u),t({instruction:l})}n()},o=e.instruction||`You are a helpful assistant named ${e.agent_name||"NewAgent"}, accessed via a custom endpoint.`;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(P,{label:"Agent Name",htmlFor:"agent_name",required:!0,helpText:"Unique name for this agent (will be PascalCase by the system).",children:r.jsx(G,{id:"agent_name",name:"agent_name",value:e.agent_name||"",onChange:s,placeholder:"MyNewAgent",required:!0})}),r.jsx(P,{label:"A2A Namespace",htmlFor:"namespace",helpText:"A2A topic namespace (e.g., myorg/dev). Can use ${NAMESPACE} for environment variable.",children:r.jsx(G,{id:"namespace",name:"namespace",value:e.namespace||"",onChange:s,placeholder:"${NAMESPACE}"})}),r.jsx(P,{label:"Model Type",htmlFor:"model_type",required:!0,children:r.jsx(se,{id:"model_type",name:"model_type",value:e.model_type||"planning",onChange:s,options:Oi})}),r.jsx(P,{label:"Instruction",htmlFor:"instruction",helpText:"System instruction for the agent. Use __AGENT_NAME__ to refer to the agent's name.",children:r.jsx("textarea",{id:"instruction",name:"instruction",value:e.instruction!==void 0?e.instruction:o.replace("__AGENT_NAME__",e.agent_name||"NewAgent"),onChange:s,rows:4,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm",placeholder:"You are a helpful assistant..."})}),r.jsx(P,{label:"",htmlFor:"supports_streaming",children:r.jsx(be,{id:"supports_streaming",checked:e.supports_streaming===void 0?!0:!!e.supports_streaming,onChange:l=>t({supports_streaming:l}),label:"Supports Streaming (host capability for A2A tasks/sendSubscribe)"})}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[r.jsx("button",{type:"button",onClick:i,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue-dark",disabled:!0,children:"Previous"}),r.jsx("button",{type:"button",onClick:a,className:"px-4 py-2 text-sm font-medium text-white bg-solace-blue rounded-md shadow-sm hover:bg-solace-blue-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue",children:"Next"})]})]})},dt="use_default_shared_session",mt="use_default_shared_artifact",Di=[{value:dt,label:"Use Default (from shared_config.yaml)"},{value:"memory",label:"Memory (In-Process)"},{value:"vertex_rag",label:"Vertex RAG (Google Cloud)"}],Bi=[{value:"PERSISTENT",label:"Persistent (Retains history across runs)"},{value:"RUN_BASED",label:"Run-based (Clears history after each run)"}],qi=[{value:mt,label:"Use Default (from shared_config.yaml)"},{value:"memory",label:"Memory (In-Process, temporary)"},{value:"filesystem",label:"Filesystem (Local disk storage)"},{value:"gcs",label:"Google Cloud Storage (GCS)"}],Ui=[{value:"namespace",label:"Namespace (Shared by all agents in namespace)"},{value:"app",label:"App (Isolated to this agent instance)"}],Hi=({data:e,updateData:t,onNext:n,onPrevious:i})=>{const s=c=>{const{name:d,value:m}=c.target,h={[d]:m};d==="session_service_type"?m===dt?h.session_service_behavior=void 0:e.session_service_behavior||(h.session_service_behavior="PERSISTENT"):d==="artifact_service_type"&&(m===mt?(h.artifact_service_base_path=void 0,h.artifact_service_scope=void 0):(e.artifact_service_scope||(h.artifact_service_scope="namespace"),m==="filesystem"&&!e.artifact_service_base_path&&(h.artifact_service_base_path="/tmp/samv2"))),t(h)},a=c=>{t({[c.target.name]:c.target.value})},o=()=>{if(e.artifact_service_type==="filesystem"&&(!e.artifact_service_base_path||e.artifact_service_base_path.trim()==="")){alert("Artifact Service Base Path is required when type is Filesystem and not using default.");return}n()},l=e.session_service_type!==dt,u=e.artifact_service_type!==mt;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ee,{children:"Configure how your agent stores session history and handles artifacts (files). You can use default settings from a shared project configuration or define them specifically for this agent."}),r.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4",children:"Session Service"}),r.jsx(P,{label:"Session Service Configuration",htmlFor:"session_service_type",required:!0,children:r.jsx(se,{id:"session_service_type",name:"session_service_type",value:e.session_service_type||dt,onChange:s,options:Di})}),l&&r.jsx(P,{label:"Session Service Behavior",htmlFor:"session_service_behavior",required:!0,children:r.jsx(se,{id:"session_service_behavior",name:"session_service_behavior",value:e.session_service_behavior||"PERSISTENT",onChange:a,options:Bi})}),r.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4 mt-8",children:"Artifact Service"}),r.jsx(P,{label:"Artifact Service Configuration",htmlFor:"artifact_service_type",required:!0,children:r.jsx(se,{id:"artifact_service_type",name:"artifact_service_type",value:e.artifact_service_type||mt,onChange:s,options:qi})}),u&&e.artifact_service_type==="filesystem"&&r.jsx(P,{label:"Artifact Service Base Path",htmlFor:"artifact_service_base_path",required:!0,helpText:"Base directory path for filesystem artifact storage.",children:r.jsx(G,{id:"artifact_service_base_path",name:"artifact_service_base_path",value:e.artifact_service_base_path||"/tmp/samv2",onChange:a,placeholder:"/tmp/samv2",required:!0})}),u&&r.jsx(P,{label:"Artifact Service Scope",htmlFor:"artifact_service_scope",required:!0,children:r.jsx(se,{id:"artifact_service_scope",name:"artifact_service_scope",value:e.artifact_service_scope||"namespace",onChange:a,options:Ui})}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[r.jsx("button",{type:"button",onClick:i,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue-dark",children:"Previous"}),r.jsx("button",{type:"button",onClick:o,className:"px-4 py-2 text-sm font-medium text-white bg-solace-blue rounded-md shadow-sm hover:bg-solace-blue-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue",children:"Next"})]})]})},Cr=({title:e,onClose:t,children:n})=>r.jsx("div",{className:"fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50 flex justify-center items-center p-4",children:r.jsxs("div",{className:"relative bg-white w-full max-w-2xl mx-auto rounded-lg shadow-xl p-6",children:[r.jsxs("div",{className:"flex justify-between items-center border-b pb-3 mb-4",children:[r.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:e}),r.jsx("button",{onClick:t,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center","aria-label":"Close modal",children:r.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),r.jsx("div",{children:n})]})}),Et={id:void 0,tool_type:"",tool_name:"",tool_description:"",group_name:"",component_module:"",function_name:"",component_base_path:"",connection_params_str:"{}",environment_variables_str:"{}",tool_config_str:"{}",connection_params:void 0,environment_variables:void 0,required_scopes:[],tool_config:void 0},Le=(e,t=void 0)=>{if(e===void 0||e.trim()===""||e.trim()==="{}")return t;try{const n=JSON.parse(e);return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:t}catch(n){return console.warn("Failed to parse JSON string:",e,n),t}},Vi=({data:e,updateData:t,onNext:n,onPrevious:i,availableTools:s})=>{const[a,o]=k.useState(!1),[l,u]=k.useState(Et),[c,d]=k.useState("initial"),[m,h]=k.useState(null),[p,w]=k.useState({}),b=Array.isArray(e.tools)?e.tools:[],C=()=>{u({...Et,id:Date.now().toString()}),h(null),w({}),d("initial"),o(!0)},g=v=>{v.tool_type==="builtin-group"?d("builtin-group"):v.tool_type==="builtin"?d("builtin-tool"):d("custom");const N={...Et,...v,id:v.id||Date.now().toString(),tool_type:v.tool_type||"",connection_params_str:v.connection_params?JSON.stringify(v.connection_params,null,2):"{}",environment_variables_str:v.environment_variables?JSON.stringify(v.environment_variables,null,2):"{}",tool_config_str:v.tool_config?JSON.stringify(v.tool_config,null,2):"{}",required_scopes:Array.isArray(v.required_scopes)?v.required_scopes:[]};u(N),h(v.id||null),w({}),o(!0)},_=v=>{const{name:N,value:z}=v.target;if(u(S=>({...S,[N]:z})),N==="connection_params_str"||N==="environment_variables_str"||N==="tool_config_str")if(z.trim()===""||z.trim()==="{}")w(S=>({...S,[N]:void 0}));else try{const S=JSON.parse(z);typeof S!="object"||S===null||Array.isArray(S)?w(F=>({...F,[N]:"Must be a valid JSON object."})):N==="connection_params_str"&&(!S.type||!S.command||!S.args)?w(F=>({...F,[N]:"Connection parameters must include type, command, and args."})):w(F=>({...F,[N]:void 0}))}catch{w(F=>({...F,[N]:"Invalid JSON format."}))}},A=(v,N)=>{u(z=>({...z,[v]:N}))},R=()=>{const v={};if(l.tool_type||(v.tool_type="Tool type is required."),l.tool_type==="builtin-group"?l.group_name||(v.group_name="Group name is required."):l.tool_type==="builtin"?l.tool_name||(v.tool_name="Tool name is required."):l.tool_type==="python"?(l.component_module||(v.component_module="Component module is required."),l.function_name||(v.function_name="Function name is required.")):l.tool_type==="mcp"&&(!l.connection_params_str||l.connection_params_str.trim()==="{}")&&(v.connection_params_str="Connection parameters are required for MCP tools."),l.connection_params_str)try{Le(l.connection_params_str,void 0)}catch{v.connection_params_str="Invalid JSON format for Connection Parameters."}if(l.environment_variables_str)try{Le(l.environment_variables_str,void 0)}catch{v.environment_variables_str="Invalid JSON format for Environment Variables."}if(l.tool_config_str)try{Le(l.tool_config_str,void 0)}catch{v.tool_config_str="Invalid JSON format for Tool Config."}return w(v),Object.keys(v).length===0},L=()=>{if(!R())return;const v={id:l.id||Date.now().toString(),tool_type:l.tool_type};let N;switch(l.tool_type){case"builtin-group":N={...v,group_name:l.group_name};break;case"builtin":N={...v,tool_name:l.tool_name};break;case"python":N={...v,tool_name:l.tool_name||void 0,tool_description:l.tool_description||void 0,component_module:l.component_module||void 0,function_name:l.function_name||void 0,component_base_path:l.component_base_path||void 0,tool_config:Le(l.tool_config_str,void 0),required_scopes:l.required_scopes||[]};break;case"mcp":N={...v,tool_name:l.tool_name||void 0,connection_params:Le(l.connection_params_str,void 0),environment_variables:Le(l.environment_variables_str,void 0),tool_config:Le(l.tool_config_str,void 0),required_scopes:l.required_scopes||[]};break;default:o(!1);return}let z;m?z=b.map(S=>S.id===m?N:S):z=[...b,N],t({tools:z}),o(!1),h(null)},y=v=>{v&&t({tools:b.filter(N=>N.id!==v)})},I=v=>{const N=[];return v.tool_type==="builtin-group"?N.push(`Group: ${v.group_name}`):v.tool_name?N.push(`Name: ${v.tool_name}`):v.tool_type==="python"&&v.function_name&&N.push(`Func: ${v.function_name}`),v.component_module&&N.push(`Module: ${v.component_module}`),N.join(", ")||"No details"};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ee,{children:"Define custom tools for your agent. Tools can be Python functions, MCP servers, or built-in ADK capabilities. The final tools configuration will be submitted as a list of tool objects."}),r.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4",children:"Custom Tools"}),r.jsx(Y,{onClick:C,variant:"secondary",children:"+ Add Tool"}),b.length>0?r.jsx("div",{className:"mt-4 space-y-3",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200 border",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Details"}),r.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:b.map((v,N)=>r.jsxs("tr",{children:[r.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-sm text-gray-700",children:v.tool_type}),r.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-sm text-gray-500 max-w-xs truncate",title:I(v),children:I(v)}),r.jsxs("td",{className:"px-4 py-2 whitespace-nowrap text-sm space-x-2",children:[r.jsx(Y,{onClick:()=>g(v),variant:"outline",children:"Edit"}),r.jsx(Y,{onClick:()=>y(v.id),variant:"outline",className:"text-red-600 border-red-300 hover:bg-red-50",children:"Delete"})]})]},v.id||N))})]})}):r.jsx("p",{className:"text-gray-500 mt-4",children:"No tools configured yet."}),a&&r.jsx(Cr,{title:m?"Edit Tool":"Add New Tool",onClose:()=>o(!1),children:r.jsxs("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto p-1",children:[c==="initial"&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-sm text-gray-600",children:"What kind of tool do you want to add?"}),r.jsx(Y,{onClick:()=>{u(v=>({...v,tool_type:"builtin-group"})),d("builtin-group")},variant:"secondary",className:"w-full justify-start",children:"Group of Built-in Tools"}),r.jsx(Y,{onClick:()=>{u(v=>({...v,tool_type:"builtin"})),d("builtin-tool")},variant:"secondary",className:"w-full justify-start",children:"Single Built-in Tool"}),r.jsx(Y,{onClick:()=>{u(v=>({...v,tool_type:"python"})),d("custom")},variant:"secondary",className:"w-full justify-start",children:"Python Tool"}),r.jsx(Y,{onClick:()=>{u(v=>({...v,tool_type:"mcp"})),d("custom")},variant:"secondary",className:"w-full justify-start",children:"MCP Tool"})]}),c==="builtin-group"&&r.jsx(P,{label:"Built-in Tool Group",htmlFor:"group_name",error:p.group_name,required:!0,children:r.jsx(se,{id:"group_name",name:"group_name",value:l.group_name||"",onChange:_,options:[{value:"",label:"Select a group..."},...s&&"groups"in s&&s.groups?Object.keys(s.groups).map(v=>({value:v,label:`${v.replace(/_/g," ").replace(/\b\w/g,N=>N.toUpperCase())} - ${s.groups[v].description}`})):[]]})}),c==="builtin-tool"&&r.jsx(P,{label:"Built-in Tool Name",htmlFor:"tool_name",error:p.tool_name,required:!0,children:r.jsx(wr,{id:"tool_name",name:"tool_name",value:l.tool_name||"",onChange:_,suggestions:s&&"tools"in s&&s.tools?Object.keys(s.tools):[],placeholder:"Select a built-in tool..."})}),c==="custom"&&r.jsxs(r.Fragment,{children:[l.tool_type==="python"&&r.jsxs(r.Fragment,{children:[r.jsx(P,{label:"Tool Name (Optional)",htmlFor:"tool_name",error:p.tool_name,helpText:"Optional: A descriptive name for this Python tool. Overwrites the python function name",children:r.jsx(G,{id:"tool_name",name:"tool_name",value:l.tool_name||"",onChange:_})}),r.jsx(P,{label:"Tool Description (Optional)",htmlFor:"tool_description",error:p.tool_description,helpText:"Optional: A brief description of what this tool does. Overwrites the python function docs",children:r.jsx(G,{id:"tool_description",name:"tool_description",value:l.tool_description||"",onChange:_,placeholder:"e.g., Fetch user profile data"})}),r.jsx(P,{label:"Component Module",htmlFor:"component_module",error:p.component_module,required:!0,children:r.jsx(G,{id:"component_module",name:"component_module",value:l.component_module||"",onChange:_,placeholder:"e.g., my_agent.custom_tools"})}),r.jsx(P,{label:"Function Name",htmlFor:"function_name",error:p.function_name,required:!0,children:r.jsx(G,{id:"function_name",name:"function_name",value:l.function_name||"",onChange:_,placeholder:"e.g., my_tool_function"})}),r.jsx(P,{label:"Component Base Path (Optional)",htmlFor:"component_base_path",error:p.component_base_path,helpText:"Base path for module resolution if not in PYTHONPATH.",children:r.jsx(G,{id:"component_base_path",name:"component_base_path",value:l.component_base_path||"",onChange:_,placeholder:"e.g., src/plugins"})})]}),l.tool_type==="mcp"&&r.jsxs(r.Fragment,{children:[r.jsx(P,{label:"MCP Tool Name (Optional)",htmlFor:"tool_name",error:p.tool_name,helpText:"Name of the specific MCP tool (optional if using all tools from MCP server)",children:r.jsx(G,{id:"tool_name",name:"tool_name",value:l.tool_name||"",onChange:_})}),r.jsx(P,{label:"Connection Parameters (JSON)",htmlFor:"connection_params_str",error:p.connection_params_str,helpText:'E.g., {"type": "stdio", "command": "cmd", "args":[]}',children:r.jsx("textarea",{id:"connection_params_str",name:"connection_params_str",rows:4,value:l.connection_params_str||"{}",onChange:_,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm font-mono text-xs"})}),r.jsx(P,{label:"Environment Variables (JSON, Optional)",htmlFor:"environment_variables_str",error:p.environment_variables_str,children:r.jsx("textarea",{id:"environment_variables_str",name:"environment_variables_str",rows:3,value:l.environment_variables_str||"{}",onChange:_,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm font-mono text-xs"})})]})]}),(c==="builtin-tool"||c==="custom")&&r.jsxs(r.Fragment,{children:[r.jsx(Ae,{id:"required_scopes",label:"Required Scopes (Optional)",values:l.required_scopes||[],onChange:v=>A("required_scopes",v),helpText:"Enter required OAuth scopes and press Add.",placeholder:"No scopes added yet.",inputPlaceholder:"e.g., read:profile"}),r.jsx(P,{label:"Tool Config (JSON, Optional)",htmlFor:"tool_config_str",error:p.tool_config_str,helpText:"Tool-specific configuration like API keys, model names etc.",children:r.jsx("textarea",{id:"tool_config_str",name:"tool_config_str",rows:3,value:l.tool_config_str||"{}",onChange:_,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm font-mono text-xs"})})]}),c!=="initial"&&r.jsxs("div",{className:"flex justify-end space-x-2 mt-6 pt-4 border-t",children:[r.jsx(Y,{onClick:()=>o(!1),variant:"outline",children:"Cancel"}),r.jsx(Y,{onClick:L,children:m?"Update Tool":"Add Tool"})]})]})}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[r.jsx(Y,{type:"button",onClick:i,variant:"outline",children:"Previous"}),r.jsx(Y,{type:"button",onClick:n,children:"Next"})]})]})},Wi=[{value:"ignore",label:"Ignore (Do not include artifacts in A2A messages)"},{value:"embed",label:"Embed (Include base64 artifact data in A2A messages)"},{value:"reference",label:"Reference (Include artifact fetch URI in A2A messages)"}],Gi=({data:e,updateData:t,onNext:n,onPrevious:i})=>r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ee,{children:"Configure various features and behaviors for your agent, such as built-in tools and how artifacts are handled."}),r.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4",children:"Built-in Tools & Features"}),r.jsx(P,{label:"Artifact Handling Mode",htmlFor:"artifact_handling_mode",helpText:"How artifacts created by this agent are represented in A2A messages.",children:r.jsx(se,{id:"artifact_handling_mode",name:"artifact_handling_mode",value:e.artifact_handling_mode||"ignore",onChange:s=>t({artifact_handling_mode:s.target.value}),options:Wi})}),r.jsxs("div",{className:"space-y-3 mt-4",children:[r.jsx(P,{label:"",htmlFor:"enable_embed_resolution",children:r.jsx(be,{id:"enable_embed_resolution",checked:e.enable_embed_resolution===void 0?!0:!!e.enable_embed_resolution,onChange:s=>t({enable_embed_resolution:s}),label:"Enable Embed Resolution (for dynamic content like state, math in prompts)"})}),r.jsx(P,{label:"",htmlFor:"enable_artifact_content_instruction",children:r.jsx(be,{id:"enable_artifact_content_instruction",checked:e.enable_artifact_content_instruction===void 0?!0:!!e.enable_artifact_content_instruction,onChange:s=>t({enable_artifact_content_instruction:s}),label:"Enable Artifact Content Instruction (for late-stage artifact content embedding)"})})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[r.jsx("button",{type:"button",onClick:i,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue-dark",children:"Previous"}),r.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium text-white bg-solace-blue rounded-md shadow-sm hover:bg-solace-blue-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue",children:"Next"})]})]}),Ji=()=>r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),Yi=()=>r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),Xi=({data:e,updateData:t,onNext:n,onPrevious:i})=>{const[s,a]=k.useState(!1),[o,l]=k.useState(null),[u,c]=k.useState(null),[d,m]=k.useState({}),[h,p]=k.useState(null);k.useEffect(()=>{s&&(o?(m(o),c(o.id)):(m({}),c(null)),p(null))},[o,s]);const w=y=>{const{name:I,value:v,type:N}=y.target,z=N==="checkbox"?y.target.checked:v;t({[I]:z})},b=y=>{const{name:I,value:v}=y.target;m(N=>({...N,[I]:v}))},C=()=>{if(!d.id||d.id.trim()===""||!d.name||d.name.trim()===""||!d.description||d.description.trim()===""){p("Skill ID, Name, and Description are required and cannot be empty.");return}p(null);const y=Array.isArray(e.agent_card_skills)?[...e.agent_card_skills]:[],I=d.id,v=y.findIndex(N=>N.id===I);if(o){if(u!==I&&v!==-1){p(`Skill ID "${I}" already exists. Please use a unique ID.`);return}const N=y.findIndex(z=>z.id===u);if(N!==-1)y[N]={...d};else{p("Error finding the original skill to update.");return}}else{if(v!==-1){p(`Skill ID "${I}" already exists. Please use a unique ID.`);return}y.push({...d})}t({agent_card_skills:y}),a(!1),l(null),c(null)},g=y=>{l(y),a(!0)},_=()=>{l(null),a(!0)},A=y=>{const I=Array.isArray(e.agent_card_skills)?e.agent_card_skills:[];t({agent_card_skills:I.filter(v=>v.id!==y)})},R=y=>{const{name:I,value:v}=y.target;t({[I]:v===""?void 0:Number(v)})},L="A helpful assistant capable of complex tasks.";return r.jsxs("div",{className:"space-y-6",children:[r.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4",children:"Agent Card & Discovery"}),r.jsx(P,{label:"Agent Card Description",htmlFor:"agent_card_description",helpText:"A concise description of the agent's capabilities.",children:r.jsx("textarea",{id:"agent_card_description",name:"agent_card_description",rows:3,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm",value:e.agent_card_description||L,onChange:w,placeholder:L})}),r.jsx(Ae,{id:"agent_card_default_input_modes",label:"Default Input Modes",values:e.agent_card_default_input_modes||[],onChange:y=>t({agent_card_default_input_modes:y}),helpText:"Enter input modes (e.g., text, file) and press Add.",placeholder:"No input modes added yet.",inputPlaceholder:"e.g., text"}),r.jsx(Ae,{id:"agent_card_default_output_modes",label:"Default Output Modes",values:e.agent_card_default_output_modes||[],onChange:y=>t({agent_card_default_output_modes:y}),helpText:"Enter output modes (e.g., text, file) and press Add.",placeholder:"No output modes added yet.",inputPlaceholder:"e.g., file"}),r.jsxs(P,{label:"Skills",htmlFor:"add_skill_button",children:[r.jsx("div",{className:"mb-2",children:r.jsx(Y,{type:"button",variant:"outline",onClick:_,children:"Add New Skill"})}),e.agent_card_skills&&e.agent_card_skills.length>0?r.jsx("div",{className:"overflow-x-auto border rounded-md",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200 text-sm",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-500 tracking-wider",children:"ID"}),r.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-500 tracking-wider",children:"Name"}),r.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-500 tracking-wider",children:"Description"}),r.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-500 tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:e.agent_card_skills.map(y=>r.jsxs("tr",{children:[r.jsx("td",{className:"px-3 py-2 whitespace-nowrap font-mono text-xs",children:y.id}),r.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:y.name}),r.jsx("td",{className:"px-3 py-2 break-words max-w-xs",children:y.description}),r.jsxs("td",{className:"px-3 py-2 whitespace-nowrap space-x-2",children:[r.jsx(Y,{variant:"secondary",onClick:()=>g(y),"aria-label":"Edit skill",children:r.jsx(Ji,{})}),r.jsx(Y,{variant:"secondary",onClick:()=>A(y.id),className:"text-red-600 hover:text-red-800","aria-label":"Delete skill",children:r.jsx(Yi,{})})]})]},y.id))})]})}):r.jsx("p",{className:"text-gray-500 text-sm mt-2",children:"No skills defined yet."})]}),r.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4 mt-8",children:"Discovery & Communication"}),r.jsx(P,{label:"Agent Card Publishing Interval (seconds)",htmlFor:"agent_card_publishing_interval",helpText:"Set to 0 to disable periodic publishing.",children:r.jsx(G,{id:"agent_card_publishing_interval",name:"agent_card_publishing_interval",type:"number",value:e.agent_card_publishing_interval===void 0?"10":String(e.agent_card_publishing_interval),onChange:R,placeholder:"10"})}),r.jsx(P,{label:"",htmlFor:"agent_discovery_enabled",children:r.jsx(be,{id:"agent_discovery_enabled",checked:e.agent_discovery_enabled===void 0?!1:!!e.agent_discovery_enabled,onChange:y=>t({agent_discovery_enabled:y}),label:"Enable Agent Discovery (allows this agent to find and delegate to peers)"})}),r.jsx(Ae,{id:"inter_agent_communication_allow_list",label:"Inter-Agent Allow List",values:e.inter_agent_communication_allow_list||[],onChange:y=>t({inter_agent_communication_allow_list:y}),helpText:"Agent name patterns to allow delegation to (e.g., *, SpecificAgent*).",placeholder:"No allow list patterns added.",inputPlaceholder:"e.g., *"}),r.jsx(Ae,{id:"inter_agent_communication_deny_list",label:"Inter-Agent Deny List",values:e.inter_agent_communication_deny_list||[],onChange:y=>t({inter_agent_communication_deny_list:y}),helpText:"Agent name patterns to deny delegation to.",placeholder:"No deny list patterns added.",inputPlaceholder:"e.g., RiskyAgent*"}),r.jsx(P,{label:"Inter-Agent Request Timeout (seconds)",htmlFor:"inter_agent_communication_timeout",children:r.jsx(G,{id:"inter_agent_communication_timeout",name:"inter_agent_communication_timeout",type:"number",value:e.inter_agent_communication_timeout===void 0?"30":String(e.inter_agent_communication_timeout),onChange:R,placeholder:"30"})}),s&&r.jsx(Cr,{onClose:()=>{a(!1),l(null),c(null)},title:o?"Edit Skill":"Add New Skill",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(P,{label:"Skill ID (e.g., function_name)",htmlFor:"skill_id",required:!0,helpText:"Unique identifier for the skill.",children:r.jsx(G,{id:"skill_id",name:"id",value:d.id||"",onChange:b,placeholder:"e.g., getWeather",disabled:!1})}),r.jsx(P,{label:"Skill Name (Display Name)",htmlFor:"skill_name",required:!0,children:r.jsx(G,{id:"skill_name",name:"name",value:d.name||"",onChange:b,placeholder:"e.g., Data Analysis"})}),r.jsx(P,{label:"Skill Description",htmlFor:"skill_description",required:!0,children:r.jsx("textarea",{id:"skill_description",name:"description",rows:3,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm",value:d.description||"",onChange:b,placeholder:"e.g., Can analyze CSV data and generate reports."})}),h&&r.jsx("p",{className:"text-sm text-red-600",children:h}),r.jsxs("div",{className:"flex justify-end space-x-2 pt-2",children:[r.jsx(Y,{type:"button",variant:"secondary",onClick:()=>{a(!1),l(null),c(null)},children:"Cancel"}),r.jsx(Y,{type:"button",onClick:C,children:o?"Update Skill":"Add Skill"})]})]})}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[r.jsx("button",{type:"button",onClick:i,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue-dark",children:"Previous"}),r.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium text-white bg-solace-blue rounded-md shadow-sm hover:bg-solace-blue-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue",children:"Next"})]})]})},$i=({data:e,updateData:t,onPrevious:n,serverUrl:i=""})=>{const s=async()=>{console.log("Submitting agent configuration:",e);try{const a=JSON.parse(JSON.stringify(e));if(!Array.isArray(a.agent_card_skills)&&a.agent_card_skills_str)try{const c=JSON.parse(a.agent_card_skills_str);Array.isArray(c)?a.agent_card_skills=c:(console.warn("Parsed agent_card_skills_str was not an array, ensuring agent_card_skills is empty array."),a.agent_card_skills=[])}catch(c){console.warn("Could not parse agent_card_skills_str as JSON, ensuring agent_card_skills is empty array.",c),a.agent_card_skills=[]}else Array.isArray(a.agent_card_skills)||(a.agent_card_skills=[]);delete a.agent_card_skills_str,Array.isArray(a.tools)&&(a.tools=a.tools.map(c=>{const d={};return c.tool_type&&(d.tool_type=c.tool_type),c.tool_name&&(d.tool_name=c.tool_name),c.tool_description&&(d.tool_description=c.tool_description),c.group_name&&(d.group_name=c.group_name),c.component_module&&(d.component_module=c.component_module),c.function_name&&(d.function_name=c.function_name),c.component_base_path&&(d.component_base_path=c.component_base_path),c.connection_params&&(d.connection_params=c.connection_params),c.environment_variables&&(d.environment_variables=c.environment_variables),c.required_scopes&&c.required_scopes.length>0&&(d.required_scopes=c.required_scopes),c.tool_config&&(d.tool_config=c.tool_config),d.tool_type?d:(console.error("Tool is missing tool_type:",c),null)}).filter(c=>c!==null));const o={agent_name_input:e.agent_name,config:a},l=await fetch(`${i}/api/save_agent_config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),u=await l.json();l.ok&&u.status==="success"?(setTimeout(async()=>{try{await fetch(`${i}/api/shutdown`,{method:"POST"})}catch{}},200),t&&t({showSuccessScreen_agent:!0})):alert(`Error saving agent: ${u.message||"Unknown error"}`)}catch(a){alert(`Failed to save agent: ${a instanceof Error?a.message:String(a)}`)}};return r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Review and Submit Agent Configuration"}),r.jsx("pre",{className:"bg-gray-100 p-3 rounded overflow-x-auto text-xs max-h-96",children:JSON.stringify(e,null,2)}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue-dark",children:"Previous"}),r.jsx("button",{onClick:s,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 rounded-md shadow-sm hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500",children:"Save Agent & Finish"})]})]})},ot=[{id:"agent-basic",title:"Basic Info",description:"Name, model, instruction",component:zi},{id:"agent-services",title:"Services",description:"Session & artifact services",component:Hi},{id:"agent-features",title:"Features",description:"Enable built-in features",component:Gi},{id:"agent-tools",title:"Custom Tools",description:"Define custom tools for the agent",component:Vi},{id:"agent-card",title:"Agent Card & Comms",description:"Discovery and communication settings",component:Xi},{id:"agent-review",title:"Review & Submit",description:"Review and save configuration",component:$i}];function Qi(){var b;const[e,t]=k.useState(0),[n,i]=k.useState({}),[s,a]=k.useState(!0),[o,l]=k.useState(null),[u,c]=k.useState([]),d="";k.useEffect(()=>{Promise.all([fetch("/api/form_schema?type=agent"),fetch("/api/available_tools")]).then(async([C,g])=>{if(!C.ok)throw new Error(`Failed to fetch agent form schema (status: ${C.status})`);if(!g.ok)throw new Error(`Failed to fetch available tools (status: ${g.status})`);const _=await C.json(),A=await g.json();if((_==null?void 0:_.status)!=="success"||!(_!=null&&_.defaults))throw new Error((_==null?void 0:_.message)||"Invalid response for agent form schema");if((A==null?void 0:A.status)!=="success")throw new Error((A==null?void 0:A.message)||"Invalid response for available tools");c(A);const R=_.defaults,L={...R,agent_card_default_input_modes:(R.agent_card_default_input_modes_str||"text").split(",").map(y=>y.trim()).filter(Boolean),agent_card_default_output_modes:(R.agent_card_default_output_modes_str||"text,file").split(",").map(y=>y.trim()).filter(Boolean),inter_agent_communication_allow_list:(R.inter_agent_communication_allow_list_str||"*").split(",").map(y=>y.trim()).filter(Boolean),inter_agent_communication_deny_list:(R.inter_agent_communication_deny_list_str||"").split(",").map(y=>y.trim()).filter(Boolean),agent_card_skills_str:R.agent_card_skills_str||"[]",agent_card_skills:[],tools:Array.isArray(R.tools)?R.tools:[],showSuccessScreen_agent:!1};delete L.agent_card_default_input_modes_str,delete L.agent_card_default_output_modes_str,delete L.inter_agent_communication_allow_list_str,delete L.inter_agent_communication_deny_list_str;try{const y=JSON.parse(L.agent_card_skills_str||"[]");Array.isArray(y)&&(L.agent_card_skills=y.filter(I=>typeof I=="object"&&I!==null&&"id"in I&&typeof I.id=="string"&&"name"in I&&typeof I.name=="string"&&"description"in I&&typeof I.description=="string"))}catch(y){console.warn("Could not parse agent_card_skills_str from defaults:",y),L.agent_card_skills=[]}i(L)}).catch(C=>{console.error("Error fetching initial data:",C),l(`Failed to load agent configuration form: ${C instanceof Error?C.message:String(C)}`)}).finally(()=>a(!1))},[]);const m=k.useCallback(C=>{i(g=>({...g,...C}))},[]);k.useEffect(()=>{if(s)return;const C=[];C.push({id:"default-artifact-management",tool_type:"builtin-group",group_name:"artifact_management"}),m({tools:C})},[m,s]);const h=k.useCallback(()=>{e<ot.length-1&&t(C=>C+1)},[e]),p=k.useCallback(()=>{e>0&&t(C=>C-1)},[e]);if(s)return r.jsx("div",{className:"text-center p-10",children:"Loading agent configuration form..."});if(o)return r.jsx("div",{className:"text-center p-10 text-red-600",children:r.jsxs("p",{children:["Error: ",o]})});if(n.showSuccessScreen_agent){let C="Agent Configured Successfully!";return n.agent_name&&(C=`Agent "${n.agent_name}" configured successfully!`),r.jsx("div",{className:"max-w-2xl mx-auto p-6",children:r.jsx(tn,{title:C,message:"Your new agent configuration has been saved.",initTab:"tutorials"})})}const w=(b=ot[e])==null?void 0:b.component;return w?r.jsxs("div",{className:"max-w-2xl mx-auto p-4",children:[r.jsx("h2",{className:"text-2xl font-bold mb-6 text-center text-solace-purple",children:"Add New Agent"}),ot.length>1&&r.jsx("div",{className:"mb-8",children:r.jsx(en,{steps:ot,currentStepIndex:e})}),r.jsx("div",{className:"bg-white rounded-lg shadow-xl p-6 min-h-[500px]",children:r.jsx(w,{data:n,updateData:m,onNext:h,onPrevious:p,serverUrl:d,availableTools:u})})]}):r.jsxs("div",{className:"text-center p-10 text-red-600",children:["Error: Configuration step not found for index ",e,"."]})}/**
 * @license lucide-react v0.542.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zi=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ki=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,i)=>i?i.toUpperCase():n.toLowerCase()),vn=e=>{const t=Ki(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ar=(...e)=>e.filter((t,n,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===n).join(" ").trim(),es=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
 * @license lucide-react v0.542.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var ts={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.542.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ns=k.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:s="",children:a,iconNode:o,...l},u)=>k.createElement("svg",{ref:u,...ts,width:t,height:t,stroke:e,strokeWidth:i?Number(n)*24/Number(t):n,className:Ar("lucide",s),...!a&&!es(l)&&{"aria-hidden":"true"},...l},[...o.map(([c,d])=>k.createElement(c,d)),...Array.isArray(a)?a:[a]]));/**
 * @license lucide-react v0.542.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ue=(e,t)=>{const n=k.forwardRef(({className:i,...s},a)=>k.createElement(ns,{ref:a,iconNode:t,className:Ar(`lucide-${Zi(vn(e))}`,`lucide-${e}`,i),...s}));return n.displayName=vn(e),n};/**
 * @license lucide-react v0.542.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rs=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],is=Ue("box",rs);/**
 * @license lucide-react v0.542.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ss=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],as=Ue("circle-check-big",ss);/**
 * @license lucide-react v0.542.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const os=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],ls=Ue("cpu",os);/**
 * @license lucide-react v0.542.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cs=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],us=Ue("git-merge",cs);/**
 * @license lucide-react v0.542.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ds=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ms=Ue("server",ds);/**
 * @license lucide-react v0.542.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ps=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],hs=Ue("tag",ps),wn=({variant:e="secondary",className:t,children:n,...i})=>r.jsx("button",{...i,className:`px-3 py-1.5 text-xs rounded font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ${e==="primary"?"bg-green-500 hover:bg-green-600 text-white dark:bg-green-600 dark:hover:bg-green-700":"bg-gray-200 hover:bg-gray-300 text-gray-700 dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-gray-200"} ${t||""}`,children:n}),kn=({label:e,value:t,icon:n})=>t==null||typeof t=="string"&&!t.trim()?null:r.jsxs("div",{className:"flex items-center text-xs mb-1",children:[r.jsxs("div",{className:"flex items-center font-medium text-gray-500 dark:text-gray-400 w-20 flex-shrink-0",children:[n&&r.jsx("span",{className:"mr-1.5",children:n}),e,":"]}),r.jsx("div",{className:"text-gray-700 dark:text-gray-200 truncate",title:t,children:t})]}),fs=({plugin:e,onReadMore:t,onInstall:n})=>{const i=e.pyproject.description||"No description available.",s=a=>{switch(a==null?void 0:a.toLowerCase()){case"agent":return r.jsx(ls,{size:12});case"gateway":return r.jsx(ms,{size:12});default:return r.jsx(hs,{size:12})}};return r.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-xl rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden flex flex-col h-[280px]",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700",children:[r.jsxs("div",{className:"flex items-center min-w-0",children:[r.jsx(is,{className:"w-5 h-5 text-blue-500 dark:text-blue-400 mr-2 flex-shrink-0"}),r.jsx("h2",{className:"text-md font-semibold text-gray-800 dark:text-gray-100 truncate",title:e.pyproject.name,children:e.pyproject.name})]}),e.is_official&&r.jsx("span",{title:"Verified Official Plugin",className:"ml-2 flex-shrink-0",children:r.jsx(as,{className:"w-4 h-4 text-green-500 dark:text-green-400"})})]}),r.jsxs("div",{className:"p-3 space-y-2 overflow-y-auto flex-grow scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600 scrollbar-track-gray-100 dark:scrollbar-track-gray-700",children:[r.jsx(kn,{label:"Version",value:e.pyproject.version,icon:r.jsx(us,{size:12})}),r.jsx(kn,{label:"Type",value:e.pyproject.plugin_type||"custom",icon:s(e.pyproject.plugin_type)}),r.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 line-clamp-3",title:i,children:i})]}),r.jsxs("div",{className:"flex justify-end space-x-2 p-2 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700",children:[r.jsx(wn,{onClick:t,variant:"secondary",children:"More"}),r.jsx(wn,{onClick:n,variant:"primary",children:"Install"})]})]})};function gs(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const xs=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ys=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,bs={};function jn(e,t){return(bs.jsx?ys:xs).test(e)}const _s=/[ \t\n\f\r]/g;function vs(e){return typeof e=="object"?e.type==="text"?Sn(e.value):!1:Sn(e)}function Sn(e){return e.replace(_s,"")===""}class et{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}et.prototype.normal={};et.prototype.property={};et.prototype.space=void 0;function Er(e,t){const n={},i={};for(const s of e)Object.assign(n,s.property),Object.assign(i,s.normal);return new et(n,i,t)}function Ht(e){return e.toLowerCase()}class de{constructor(t,n){this.attribute=n,this.property=t}}de.prototype.attribute="";de.prototype.booleanish=!1;de.prototype.boolean=!1;de.prototype.commaOrSpaceSeparated=!1;de.prototype.commaSeparated=!1;de.prototype.defined=!1;de.prototype.mustUseProperty=!1;de.prototype.number=!1;de.prototype.overloadedBoolean=!1;de.prototype.property="";de.prototype.spaceSeparated=!1;de.prototype.space=void 0;let ws=0;const W=Re(),te=Re(),Vt=Re(),E=Re(),Z=Re(),Be=Re(),ge=Re();function Re(){return 2**++ws}const Wt=Object.freeze(Object.defineProperty({__proto__:null,boolean:W,booleanish:te,commaOrSpaceSeparated:ge,commaSeparated:Be,number:E,overloadedBoolean:Vt,spaceSeparated:Z},Symbol.toStringTag,{value:"Module"})),It=Object.keys(Wt);class nn extends de{constructor(t,n,i,s){let a=-1;if(super(t,n),Nn(this,"space",s),typeof i=="number")for(;++a<It.length;){const o=It[a];Nn(this,It[a],(i&Wt[o])===Wt[o])}}}nn.prototype.defined=!0;function Nn(e,t,n){n&&(e[t]=n)}function He(e){const t={},n={};for(const[i,s]of Object.entries(e.properties)){const a=new nn(i,e.transform(e.attributes||{},i),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(a.mustUseProperty=!0),t[i]=a,n[Ht(i)]=i,n[Ht(a.attribute)]=i}return new et(t,n,e.space)}const Ir=He({properties:{ariaActiveDescendant:null,ariaAtomic:te,ariaAutoComplete:null,ariaBusy:te,ariaChecked:te,ariaColCount:E,ariaColIndex:E,ariaColSpan:E,ariaControls:Z,ariaCurrent:null,ariaDescribedBy:Z,ariaDetails:null,ariaDisabled:te,ariaDropEffect:Z,ariaErrorMessage:null,ariaExpanded:te,ariaFlowTo:Z,ariaGrabbed:te,ariaHasPopup:null,ariaHidden:te,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Z,ariaLevel:E,ariaLive:null,ariaModal:te,ariaMultiLine:te,ariaMultiSelectable:te,ariaOrientation:null,ariaOwns:Z,ariaPlaceholder:null,ariaPosInSet:E,ariaPressed:te,ariaReadOnly:te,ariaRelevant:null,ariaRequired:te,ariaRoleDescription:Z,ariaRowCount:E,ariaRowIndex:E,ariaRowSpan:E,ariaSelected:te,ariaSetSize:E,ariaSort:null,ariaValueMax:E,ariaValueMin:E,ariaValueNow:E,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Tr(e,t){return t in e?e[t]:t}function Pr(e,t){return Tr(e,t.toLowerCase())}const ks=He({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Be,acceptCharset:Z,accessKey:Z,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:Z,autoFocus:W,autoPlay:W,blocking:Z,capture:null,charSet:null,checked:W,cite:null,className:Z,cols:E,colSpan:null,content:null,contentEditable:te,controls:W,controlsList:Z,coords:E|Be,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:Vt,draggable:te,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:Z,height:E,hidden:Vt,high:E,href:null,hrefLang:null,htmlFor:Z,httpEquiv:Z,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:Z,itemRef:Z,itemScope:W,itemType:Z,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:E,manifest:null,max:null,maxLength:E,media:null,method:null,min:null,minLength:E,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,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:W,optimum:E,pattern:null,ping:Z,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:Z,required:W,reversed:W,rows:E,rowSpan:E,sandbox:Z,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shape:null,size:E,sizes:null,slot:null,span:E,spellCheck:te,src:null,srcDoc:null,srcLang:null,srcSet:null,start:E,step:null,style:null,tabIndex:E,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:te,width:E,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Z,axis:null,background:null,bgColor:null,border:E,borderColor:null,bottomMargin:E,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:E,leftMargin:E,link:null,longDesc:null,lowSrc:null,marginHeight:E,marginWidth:E,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:E,rules:null,scheme:null,scrolling:te,standby:null,summary:null,text:null,topMargin:E,valueType:null,version:null,vAlign:null,vLink:null,vSpace:E,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:W,disableRemotePlayback:W,prefix:null,property:null,results:E,security:null,unselectable:null},space:"html",transform:Pr}),js=He({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:ge,accentHeight:E,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:E,amplitude:E,arabicForm:null,ascent:E,attributeName:null,attributeType:null,azimuth:E,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:E,by:null,calcMode:null,capHeight:E,className:Z,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:E,diffuseConstant:E,direction:null,display:null,dur:null,divisor:E,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:E,enableBackground:null,end:null,event:null,exponent:E,externalResourcesRequired:null,fill:null,fillOpacity:E,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:Be,g2:Be,glyphName:Be,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:E,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:E,horizOriginX:E,horizOriginY:E,id:null,ideographic:E,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:E,k:E,k1:E,k2:E,k3:E,k4:E,kernelMatrix:ge,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:E,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:E,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:E,overlineThickness:E,paintOrder:null,panose1:null,path:null,pathLength:E,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Z,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:E,pointsAtY:E,pointsAtZ:E,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ge,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ge,rev:ge,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ge,requiredFeatures:ge,requiredFonts:ge,requiredFormats:ge,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:E,specularExponent:E,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:E,strikethroughThickness:E,string:null,stroke:null,strokeDashArray:ge,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:E,strokeOpacity:E,strokeWidth:null,style:null,surfaceScale:E,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ge,tabIndex:E,tableValues:null,target:null,targetX:E,targetY:E,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ge,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:E,underlineThickness:E,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:E,values:null,vAlphabetic:E,vMathematical:E,vectorEffect:null,vHanging:E,vIdeographic:E,version:null,vertAdvY:E,vertOriginX:E,vertOriginY:E,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:E,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Tr}),Mr=He({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Fr=He({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Pr}),Lr=He({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Ss={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"},Ns=/[A-Z]/g,Cn=/-[a-z]/g,Cs=/^data[-\w.:]+$/i;function As(e,t){const n=Ht(t);let i=t,s=de;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Cs.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(Cn,Is);i="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!Cn.test(a)){let o=a.replace(Ns,Es);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=nn}return new s(i,t)}function Es(e){return"-"+e.toLowerCase()}function Is(e){return e.charAt(1).toUpperCase()}const Ts=Er([Ir,ks,Mr,Fr,Lr],"html"),rn=Er([Ir,js,Mr,Fr,Lr],"svg");function Ps(e){return e.join(" ").trim()}var ze={},Tt,An;function Ms(){if(An)return Tt;An=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
`,c="/",d="*",m="",h="comment",p="declaration";Tt=function(b,C){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];C=C||{};var g=1,_=1;function A(D){var O=D.match(t);O&&(g+=O.length);var U=D.lastIndexOf(u);_=~U?D.length-U:_+D.length}function R(){var D={line:g,column:_};return function(O){return O.position=new L(D),v(),O}}function L(D){this.start=D,this.end={line:g,column:_},this.source=C.source}L.prototype.content=b;function y(D){var O=new Error(C.source+":"+g+":"+_+": "+D);if(O.reason=D,O.filename=C.source,O.line=g,O.column=_,O.source=b,!C.silent)throw O}function I(D){var O=D.exec(b);if(O){var U=O[0];return A(U),b=b.slice(U.length),O}}function v(){I(n)}function N(D){var O;for(D=D||[];O=z();)O!==!1&&D.push(O);return D}function z(){var D=R();if(!(c!=b.charAt(0)||d!=b.charAt(1))){for(var O=2;m!=b.charAt(O)&&(d!=b.charAt(O)||c!=b.charAt(O+1));)++O;if(O+=2,m===b.charAt(O-1))return y("End of comment missing");var U=b.slice(2,O-2);return _+=2,A(U),b=b.slice(O),_+=2,D({type:h,comment:U})}}function S(){var D=R(),O=I(i);if(O){if(z(),!I(s))return y("property missing ':'");var U=I(a),ee=D({type:p,property:w(O[0].replace(e,m)),value:U?w(U[0].replace(e,m)):m});return I(o),ee}}function F(){var D=[];N(D);for(var O;O=S();)O!==!1&&(D.push(O),N(D));return D}return v(),F()};function w(b){return b?b.replace(l,m):m}return Tt}var En;function Fs(){if(En)return ze;En=1;var e=ze&&ze.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ze,"__esModule",{value:!0}),ze.default=n;var t=e(Ms());function n(i,s){var a=null;if(!i||typeof i!="string")return a;var o=(0,t.default)(i),l=typeof s=="function";return o.forEach(function(u){if(u.type==="declaration"){var c=u.property,d=u.value;l?s(c,d,u):d&&(a=a||{},a[c]=d)}}),a}return ze}var We={},In;function Ls(){if(In)return We;In=1,Object.defineProperty(We,"__esModule",{value:!0}),We.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,a=function(c){return!c||n.test(c)||e.test(c)},o=function(c,d){return d.toUpperCase()},l=function(c,d){return"".concat(d,"-")},u=function(c,d){return d===void 0&&(d={}),a(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(s,l):c=c.replace(i,l),c.replace(t,o))};return We.camelCase=u,We}var Ge,Tn;function Rs(){if(Tn)return Ge;Tn=1;var e=Ge&&Ge.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(Fs()),n=Ls();function i(s,a){var o={};return!s||typeof s!="string"||(0,t.default)(s,function(l,u){l&&u&&(o[(0,n.camelCase)(l,a)]=u)}),o}return i.default=i,Ge=i,Ge}var Os=Rs();const zs=yr(Os),Ds=Bs("start");function Bs(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};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 qs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Pn(e.position):"start"in e||"end"in e?Pn(e):"line"in e||"column"in e?Gt(e):""}function Gt(e){return Mn(e&&e.line)+":"+Mn(e&&e.column)}function Pn(e){return Gt(e&&e.start)+"-"+Gt(e&&e.end)}function Mn(e){return e&&typeof e=="number"?e:1}let oe=class extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let s="",a={},o=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?s=t:!a.cause&&t&&(o=!0,s=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof i=="string"){const u=i.indexOf(":");u===-1?a.ruleId=i:(a.source=i.slice(0,u),a.ruleId=i.slice(u+1))}if(!a.place&&a.ancestors&&a.ancestors){const u=a.ancestors[a.ancestors.length-1];u&&(a.place=u.position)}const l=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file,this.message=s,this.line=l?l.line:void 0,this.name=qs(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}};oe.prototype.file="";oe.prototype.name="";oe.prototype.reason="";oe.prototype.message="";oe.prototype.stack="";oe.prototype.column=void 0;oe.prototype.line=void 0;oe.prototype.ancestors=void 0;oe.prototype.cause=void 0;oe.prototype.fatal=void 0;oe.prototype.place=void 0;oe.prototype.ruleId=void 0;oe.prototype.source=void 0;const sn={}.hasOwnProperty,Us=new Map,Hs=/[A-Z]/g,Vs=new Set(["table","tbody","thead","tfoot","tr"]),Ws=new Set(["td","th"]),Rr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Gs(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=ea(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=Ks(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?rn:Ts,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Or(s,e,void 0);return a&&typeof a!="string"?a:s.create(e,s.Fragment,{children:a||void 0},void 0)}function Or(e,t,n){if(t.type==="element")return Js(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Ys(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return $s(e,t,n);if(t.type==="mdxjsEsm")return Xs(e,t);if(t.type==="root")return Qs(e,t,n);if(t.type==="text")return Zs(e,t)}function Js(e,t,n){const i=e.schema;let s=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(s=rn,e.schema=s),e.ancestors.push(t);const a=Dr(e,t.tagName,!1),o=ta(e,t);let l=on(e,t);return Vs.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!vs(u):!0})),zr(e,o,a,t),an(o,l),e.ancestors.pop(),e.schema=i,e.create(t,a,o,n)}function Ys(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Ke(e,t.position)}function Xs(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ke(e,t.position)}function $s(e,t,n){const i=e.schema;let s=i;t.name==="svg"&&i.space==="html"&&(s=rn,e.schema=s),e.ancestors.push(t);const a=t.name===null?e.Fragment:Dr(e,t.name,!0),o=na(e,t),l=on(e,t);return zr(e,o,a,t),an(o,l),e.ancestors.pop(),e.schema=i,e.create(t,a,o,n)}function Qs(e,t,n){const i={};return an(i,on(e,t)),e.create(t,e.Fragment,i,n)}function Zs(e,t){return t.value}function zr(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function an(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Ks(e,t,n){return i;function i(s,a,o,l){const c=Array.isArray(o.children)?n:t;return l?c(a,o,l):c(a,o)}}function ea(e,t){return n;function n(i,s,a,o){const l=Array.isArray(a.children),u=Ds(i);return t(s,a,o,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function ta(e,t){const n={};let i,s;for(s in t.properties)if(s!=="children"&&sn.call(t.properties,s)){const a=ra(e,s,t.properties[s]);if(a){const[o,l]=a;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Ws.has(t.tagName)?i=l:n[o]=l}}if(i){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function na(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const a=i.data.estree.body[0];a.type;const o=a.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Ke(e,t.position);else{const s=i.name;let a;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const l=i.value.data.estree.body[0];l.type,a=e.evaluater.evaluateExpression(l.expression)}else Ke(e,t.position);else a=i.value===null?!0:i.value;n[s]=a}return n}function on(e,t){const n=[];let i=-1;const s=e.passKeys?new Map:Us;for(;++i<t.children.length;){const a=t.children[i];let o;if(e.passKeys){const u=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(u){const c=s.get(u)||0;o=u+"-"+c,s.set(u,c+1)}}const l=Or(e,a,o);l!==void 0&&n.push(l)}return n}function ra(e,t,n){const i=As(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?gs(n):Ps(n)),i.property==="style"){let s=typeof n=="object"?n:ia(e,String(n));return e.stylePropertyNameCase==="css"&&(s=sa(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&i.space?Ss[i.property]||i.property:i.attribute,n]}}function ia(e,t){try{return zs(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,s=new oe("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=Rr+"#cannot-parse-style-attribute",s}}function Dr(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let a=-1,o;for(;++a<s.length;){const l=jn(s[a])?{type:"Identifier",name:s[a]}:{type:"Literal",value:s[a]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(a&&l.type==="Literal"),optional:!1}:l}i=o}else i=jn(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const s=i.value;return sn.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(i);Ke(e)}function Ke(e,t){const n=new oe("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Rr+"#cannot-handle-mdx-estrees-without-createevaluater",n}function sa(e){const t={};let n;for(n in e)sn.call(e,n)&&(t[aa(n)]=e[n]);return t}function aa(e){let t=e.replace(Hs,oa);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function oa(e){return"-"+e.toLowerCase()}const Pt={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"]},la={};function ca(e,t){const n=la,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Br(e,i,s)}function Br(e,t,n){if(ua(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Fn(e.children,t,n)}return Array.isArray(e)?Fn(e,t,n):""}function Fn(e,t,n){const i=[];let s=-1;for(;++s<e.length;)i[s]=Br(e[s],t,n);return i.join("")}function ua(e){return!!(e&&typeof e=="object")}const Ln=document.createElement("i");function ln(e){const t="&"+e+";";Ln.innerHTML=t;const n=Ln.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Se(e,t,n,i){const s=e.length;let a=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,i.length<1e4)o=Array.from(i),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<i.length;)o=i.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function ye(e,t){return e.length>0?(Se(e,e.length,0,t),e):t}const Rn={}.hasOwnProperty;function da(e){const t={};let n=-1;for(;++n<e.length;)ma(t,e[n]);return t}function ma(e,t){let n;for(n in t){const s=(Rn.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let o;if(a)for(o in a){Rn.call(s,o)||(s[o]=[]);const l=a[o];pa(s[o],Array.isArray(l)?l:l?[l]:[])}}}function pa(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);Se(e,0,0,i)}function qr(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function qe(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const je=Me(/[A-Za-z]/),xe=Me(/[\dA-Za-z]/),ha=Me(/[#-'*+\--9=?A-Z^-~]/);function Jt(e){return e!==null&&(e<32||e===127)}const Yt=Me(/\d/),fa=Me(/[\dA-Fa-f]/),ga=Me(/[!-/:-@[-`{-~]/);function H(e){return e!==null&&e<-2}function ue(e){return e!==null&&(e<0||e===32)}function $(e){return e===-2||e===-1||e===32}const xa=Me(new RegExp("\\p{P}|\\p{S}","u")),ya=Me(/\s/);function Me(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ve(e){const t=[];let n=-1,i=0,s=0;for(;++n<e.length;){const a=e.charCodeAt(n);let o="";if(a===37&&xe(e.charCodeAt(n+1))&&xe(e.charCodeAt(n+2)))s=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){const l=e.charCodeAt(n+1);a<56320&&l>56319&&l<57344?(o=String.fromCharCode(a,l),s=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(i,n),encodeURIComponent(o)),i=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(i)}function K(e,t,n,i){const s=i?i-1:Number.POSITIVE_INFINITY;let a=0;return o;function o(u){return $(u)?(e.enter(n),l(u)):t(u)}function l(u){return $(u)&&a++<s?(e.consume(u),l):(e.exit(n),t(u))}}const ba={tokenize:_a};function _a(e){const t=e.attempt(this.parser.constructs.contentInitial,i,s);let n;return t;function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),K(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),a(l)}function a(l){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return H(l)?(e.consume(l),e.exit("chunkText"),a):(e.consume(l),o)}}const va={tokenize:wa},On={tokenize:ka};function wa(e){const t=this,n=[];let i=0,s,a,o;return l;function l(A){if(i<n.length){const R=n[i];return t.containerState=R[1],e.attempt(R[0].continuation,u,c)(A)}return c(A)}function u(A){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&_();const R=t.events.length;let L=R,y;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){y=t.events[L][1].end;break}g(i);let I=R;for(;I<t.events.length;)t.events[I][1].end={...y},I++;return Se(t.events,L+1,0,t.events.slice(R)),t.events.length=I,c(A)}return l(A)}function c(A){if(i===n.length){if(!s)return h(A);if(s.currentConstruct&&s.currentConstruct.concrete)return w(A);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(On,d,m)(A)}function d(A){return s&&_(),g(i),h(A)}function m(A){return t.parser.lazy[t.now().line]=i!==n.length,o=t.now().offset,w(A)}function h(A){return t.containerState={},e.attempt(On,p,w)(A)}function p(A){return i++,n.push([t.currentConstruct,t.containerState]),h(A)}function w(A){if(A===null){s&&_(),g(0),e.consume(A);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:a}),b(A)}function b(A){if(A===null){C(e.exit("chunkFlow"),!0),g(0),e.consume(A);return}return H(A)?(e.consume(A),C(e.exit("chunkFlow")),i=0,t.interrupt=void 0,l):(e.consume(A),b)}function C(A,R){const L=t.sliceStream(A);if(R&&L.push(null),A.previous=a,a&&(a.next=A),a=A,s.defineSkip(A.start),s.write(L),t.parser.lazy[A.start.line]){let y=s.events.length;for(;y--;)if(s.events[y][1].start.offset<o&&(!s.events[y][1].end||s.events[y][1].end.offset>o))return;const I=t.events.length;let v=I,N,z;for(;v--;)if(t.events[v][0]==="exit"&&t.events[v][1].type==="chunkFlow"){if(N){z=t.events[v][1].end;break}N=!0}for(g(i),y=I;y<t.events.length;)t.events[y][1].end={...z},y++;Se(t.events,v+1,0,t.events.slice(I)),t.events.length=y}}function g(A){let R=n.length;for(;R-- >A;){const L=n[R];t.containerState=L[1],L[0].exit.call(t,e)}n.length=A}function _(){s.write([null]),a=void 0,s=void 0,t.containerState._closeFlow=void 0}}function ka(e,t,n){return K(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function zn(e){if(e===null||ue(e)||ya(e))return 1;if(xa(e))return 2}function cn(e,t,n){const i=[];let s=-1;for(;++s<e.length;){const a=e[s].resolveAll;a&&!i.includes(a)&&(t=a(t,n),i.push(a))}return t}const Xt={name:"attention",resolveAll:ja,tokenize:Sa};function ja(e,t){let n=-1,i,s,a,o,l,u,c,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[i][1].end},h={...e[n][1].start};Dn(m,-u),Dn(h,u),o={type:u>1?"strongSequence":"emphasisSequence",start:m,end:{...e[i][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},a={type:u>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},s={type:u>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[i][1].end={...o.start},e[n][1].start={...l.end},c=[],e[i][1].end.offset-e[i][1].start.offset&&(c=ye(c,[["enter",e[i][1],t],["exit",e[i][1],t]])),c=ye(c,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",a,t]]),c=ye(c,cn(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),c=ye(c,[["exit",a,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=ye(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Se(e,i-1,n-i+3,c),n=i+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Sa(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,s=zn(i);let a;return o;function o(u){return a=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===a)return e.consume(u),l;const c=e.exit("attentionSequence"),d=zn(u),m=!d||d===2&&s||n.includes(u),h=!s||s===2&&d||n.includes(i);return c._open=!!(a===42?m:m&&(s||!h)),c._close=!!(a===42?h:h&&(d||!m)),t(u)}}function Dn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Na={name:"autolink",tokenize:Ca};function Ca(e,t,n){let i=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(p){return je(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||xe(p)?(i=1,l(p)):c(p)}function l(p){return p===58?(e.consume(p),i=0,u):(p===43||p===45||p===46||xe(p))&&i++<32?(e.consume(p),l):(i=0,c(p))}function u(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Jt(p)?n(p):(e.consume(p),u)}function c(p){return p===64?(e.consume(p),d):ha(p)?(e.consume(p),c):n(p)}function d(p){return xe(p)?m(p):n(p)}function m(p){return p===46?(e.consume(p),i=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||xe(p))&&i++<63){const w=p===45?h:m;return e.consume(p),w}return n(p)}}const gt={partial:!0,tokenize:Aa};function Aa(e,t,n){return i;function i(a){return $(a)?K(e,s,"linePrefix")(a):s(a)}function s(a){return a===null||H(a)?t(a):n(a)}}const Ur={continuation:{tokenize:Ia},exit:Ta,name:"blockQuote",tokenize:Ea};function Ea(e,t,n){const i=this;return s;function s(o){if(o===62){const l=i.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),a}return n(o)}function a(o){return $(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Ia(e,t,n){const i=this;return s;function s(o){return $(o)?K(e,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return e.attempt(Ur,t,n)(o)}}function Ta(e){e.exit("blockQuote")}const Hr={name:"characterEscape",tokenize:Pa};function Pa(e,t,n){return i;function i(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),s}function s(a){return ga(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const Vr={name:"characterReference",tokenize:Ma};function Ma(e,t,n){const i=this;let s=0,a,o;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),u}function u(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),a=31,o=xe,d(m))}function c(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,o=fa,d):(e.enter("characterReferenceValue"),a=7,o=Yt,d(m))}function d(m){if(m===59&&s){const h=e.exit("characterReferenceValue");return o===xe&&!ln(i.sliceSerialize(h))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(m)&&s++<a?(e.consume(m),d):n(m)}}const Bn={partial:!0,tokenize:La},qn={concrete:!0,name:"codeFenced",tokenize:Fa};function Fa(e,t,n){const i=this,s={partial:!0,tokenize:L};let a=0,o=0,l;return u;function u(y){return c(y)}function c(y){const I=i.events[i.events.length-1];return a=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,l=y,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(y)}function d(y){return y===l?(o++,e.consume(y),d):o<3?n(y):(e.exit("codeFencedFenceSequence"),$(y)?K(e,m,"whitespace")(y):m(y))}function m(y){return y===null||H(y)?(e.exit("codeFencedFence"),i.interrupt?t(y):e.check(Bn,b,R)(y)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===null||H(y)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(y)):$(y)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),K(e,p,"whitespace")(y)):y===96&&y===l?n(y):(e.consume(y),h)}function p(y){return y===null||H(y)?m(y):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(y))}function w(y){return y===null||H(y)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(y)):y===96&&y===l?n(y):(e.consume(y),w)}function b(y){return e.attempt(s,R,C)(y)}function C(y){return e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g}function g(y){return a>0&&$(y)?K(e,_,"linePrefix",a+1)(y):_(y)}function _(y){return y===null||H(y)?e.check(Bn,b,R)(y):(e.enter("codeFlowValue"),A(y))}function A(y){return y===null||H(y)?(e.exit("codeFlowValue"),_(y)):(e.consume(y),A)}function R(y){return e.exit("codeFenced"),t(y)}function L(y,I,v){let N=0;return z;function z(U){return y.enter("lineEnding"),y.consume(U),y.exit("lineEnding"),S}function S(U){return y.enter("codeFencedFence"),$(U)?K(y,F,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):F(U)}function F(U){return U===l?(y.enter("codeFencedFenceSequence"),D(U)):v(U)}function D(U){return U===l?(N++,y.consume(U),D):N>=o?(y.exit("codeFencedFenceSequence"),$(U)?K(y,O,"whitespace")(U):O(U)):v(U)}function O(U){return U===null||H(U)?(y.exit("codeFencedFence"),I(U)):v(U)}}}function La(e,t,n){const i=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}const Mt={name:"codeIndented",tokenize:Oa},Ra={partial:!0,tokenize:za};function Oa(e,t,n){const i=this;return s;function s(c){return e.enter("codeIndented"),K(e,a,"linePrefix",5)(c)}function a(c){const d=i.events[i.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?u(c):H(c)?e.attempt(Ra,o,u)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||H(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function u(c){return e.exit("codeIndented"),t(c)}}function za(e,t,n){const i=this;return s;function s(o){return i.parser.lazy[i.now().line]?n(o):H(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):K(e,a,"linePrefix",5)(o)}function a(o){const l=i.events[i.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):H(o)?s(o):n(o)}}const Da={name:"codeText",previous:qa,resolve:Ba,tokenize:Ua};function Ba(e){let t=e.length-4,n=3,i,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)s===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(s=i):(i===t||e[i][1].type==="lineEnding")&&(e[s][1].type="codeTextData",i!==s+2&&(e[s][1].end=e[i-1][1].end,e.splice(s+2,i-s-2),t-=i-s-2,i=s+2),s=void 0);return e}function qa(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Ua(e,t,n){let i=0,s,a;return o;function o(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),i++,l):(e.exit("codeTextSequence"),u(m))}function u(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),u):m===96?(a=e.enter("codeTextSequence"),s=0,d(m)):H(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(m))}function c(m){return m===null||m===32||m===96||H(m)?(e.exit("codeTextData"),u(m)):(e.consume(m),c)}function d(m){return m===96?(e.consume(m),s++,d):s===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(a.type="codeTextData",c(m))}}class Ha{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const s=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return i&&Je(this.left,i),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Je(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Je(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Je(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Je(this.left,n.reverse())}}}function Je(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Wr(e){const t={};let n=-1,i,s,a,o,l,u,c;const d=new Ha(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(i=d.get(n),n&&i[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(u=i[1]._tokenizer.events,a=0,a<u.length&&u[a][1].type==="lineEndingBlank"&&(a+=2),a<u.length&&u[a][1].type==="content"))for(;++a<u.length&&u[a][1].type!=="content";)u[a][1].type==="chunkText"&&(u[a][1]._isInFirstContentOfListItem=!0,a++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,Va(d,n)),n=t[n],c=!0);else if(i[1]._container){for(a=n,s=void 0;a--;)if(o=d.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(d.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=a);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(i[1].end={...d.get(s)[1].start},l=d.slice(s,n),l.unshift(i),d.splice(s,n-s+1,l))}}return Se(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function Va(e,t){const n=e.get(t)[1],i=e.get(t)[2];let s=t-1;const a=[];let o=n._tokenizer;o||(o=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,u=[],c={};let d,m,h=-1,p=n,w=0,b=0;const C=[b];for(;p;){for(;e.get(++s)[1]!==p;);a.push(s),p._tokenizer||(d=i.sliceStream(p),p.next||d.push(null),m&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=p,p=p.next}for(p=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(b=h+1,C.push(b),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):C.pop(),h=C.length;h--;){const g=l.slice(C[h],C[h+1]),_=a.pop();u.push([_,_+g.length-1]),e.splice(_,2,g)}for(u.reverse(),h=-1;++h<u.length;)c[w+u[h][0]]=w+u[h][1],w+=u[h][1]-u[h][0]-1;return c}const Wa={resolve:Ja,tokenize:Ya},Ga={partial:!0,tokenize:Xa};function Ja(e){return Wr(e),e}function Ya(e,t){let n;return i;function i(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?a(l):H(l)?e.check(Ga,o,a)(l):(e.consume(l),s)}function a(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function Xa(e,t,n){const i=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),K(e,a,"linePrefix")}function a(o){if(o===null||H(o))return n(o);const l=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(i.parser.constructs.flow,n,t)(o)}}function Gr(e,t,n,i,s,a,o,l,u){const c=u||Number.POSITIVE_INFINITY;let d=0;return m;function m(g){return g===60?(e.enter(i),e.enter(s),e.enter(a),e.consume(g),e.exit(a),h):g===null||g===32||g===41||Jt(g)?n(g):(e.enter(i),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(g))}function h(g){return g===62?(e.enter(a),e.consume(g),e.exit(a),e.exit(s),e.exit(i),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(l),h(g)):g===null||g===60||H(g)?n(g):(e.consume(g),g===92?w:p)}function w(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function b(g){return!d&&(g===null||g===41||ue(g))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(i),t(g)):d<c&&g===40?(e.consume(g),d++,b):g===41?(e.consume(g),d--,b):g===null||g===32||g===40||Jt(g)?n(g):(e.consume(g),g===92?C:b)}function C(g){return g===40||g===41||g===92?(e.consume(g),b):b(g)}}function Jr(e,t,n,i,s,a){const o=this;let l=0,u;return c;function c(p){return e.enter(i),e.enter(s),e.consume(p),e.exit(s),e.enter(a),d}function d(p){return l>999||p===null||p===91||p===93&&!u||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(a),e.enter(s),e.consume(p),e.exit(s),e.exit(i),t):H(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||H(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),u||(u=!$(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,m):m(p)}}function Yr(e,t,n,i,s,a){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(i),e.enter(s),e.consume(h),e.exit(s),o=h===40?41:h,u):n(h)}function u(h){return h===o?(e.enter(s),e.consume(h),e.exit(s),e.exit(i),t):(e.enter(a),c(h))}function c(h){return h===o?(e.exit(a),u(o)):h===null?n(h):H(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),K(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===o||h===null||H(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?m:d)}function m(h){return h===o||h===92?(e.consume(h),d):d(h)}}function $e(e,t){let n;return i;function i(s){return H(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,i):$(s)?K(e,i,n?"linePrefix":"lineSuffix")(s):t(s)}}const $a={name:"definition",tokenize:Za},Qa={partial:!0,tokenize:Ka};function Za(e,t,n){const i=this;let s;return a;function a(p){return e.enter("definition"),o(p)}function o(p){return Jr.call(i,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=qe(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):n(p)}function u(p){return ue(p)?$e(e,c)(p):c(p)}function c(p){return Gr(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Qa,m,m)(p)}function m(p){return $(p)?K(e,h,"whitespace")(p):h(p)}function h(p){return p===null||H(p)?(e.exit("definition"),i.parser.defined.push(s),t(p)):n(p)}}function Ka(e,t,n){return i;function i(l){return ue(l)?$e(e,s)(l):n(l)}function s(l){return Yr(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function a(l){return $(l)?K(e,o,"whitespace")(l):o(l)}function o(l){return l===null||H(l)?t(l):n(l)}}const eo={name:"hardBreakEscape",tokenize:to};function to(e,t,n){return i;function i(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return H(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const no={name:"headingAtx",resolve:ro,tokenize:io};function ro(e,t){let n=e.length-2,i=3,s,a;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(s={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},a={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},Se(e,i,n-i+1,[["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t]])),e}function io(e,t,n){let i=0;return s;function s(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&i++<6?(e.consume(d),o):d===null||ue(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||H(d)?(e.exit("atxHeading"),t(d)):$(d)?K(e,l,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function u(d){return d===35?(e.consume(d),u):(e.exit("atxHeadingSequence"),l(d))}function c(d){return d===null||d===35||ue(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),c)}}const so=["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"],Un=["pre","script","style","textarea"],ao={concrete:!0,name:"htmlFlow",resolveTo:co,tokenize:uo},oo={partial:!0,tokenize:po},lo={partial:!0,tokenize:mo};function co(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function uo(e,t,n){const i=this;let s,a,o,l,u;return c;function c(x){return d(x)}function d(x){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(x),m}function m(x){return x===33?(e.consume(x),h):x===47?(e.consume(x),a=!0,b):x===63?(e.consume(x),s=3,i.interrupt?t:f):je(x)?(e.consume(x),o=String.fromCharCode(x),C):n(x)}function h(x){return x===45?(e.consume(x),s=2,p):x===91?(e.consume(x),s=5,l=0,w):je(x)?(e.consume(x),s=4,i.interrupt?t:f):n(x)}function p(x){return x===45?(e.consume(x),i.interrupt?t:f):n(x)}function w(x){const ae="CDATA[";return x===ae.charCodeAt(l++)?(e.consume(x),l===ae.length?i.interrupt?t:F:w):n(x)}function b(x){return je(x)?(e.consume(x),o=String.fromCharCode(x),C):n(x)}function C(x){if(x===null||x===47||x===62||ue(x)){const ae=x===47,_e=o.toLowerCase();return!ae&&!a&&Un.includes(_e)?(s=1,i.interrupt?t(x):F(x)):so.includes(o.toLowerCase())?(s=6,ae?(e.consume(x),g):i.interrupt?t(x):F(x)):(s=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(x):a?_(x):A(x))}return x===45||xe(x)?(e.consume(x),o+=String.fromCharCode(x),C):n(x)}function g(x){return x===62?(e.consume(x),i.interrupt?t:F):n(x)}function _(x){return $(x)?(e.consume(x),_):z(x)}function A(x){return x===47?(e.consume(x),z):x===58||x===95||je(x)?(e.consume(x),R):$(x)?(e.consume(x),A):z(x)}function R(x){return x===45||x===46||x===58||x===95||xe(x)?(e.consume(x),R):L(x)}function L(x){return x===61?(e.consume(x),y):$(x)?(e.consume(x),L):A(x)}function y(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),u=x,I):$(x)?(e.consume(x),y):v(x)}function I(x){return x===u?(e.consume(x),u=null,N):x===null||H(x)?n(x):(e.consume(x),I)}function v(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||ue(x)?L(x):(e.consume(x),v)}function N(x){return x===47||x===62||$(x)?A(x):n(x)}function z(x){return x===62?(e.consume(x),S):n(x)}function S(x){return x===null||H(x)?F(x):$(x)?(e.consume(x),S):n(x)}function F(x){return x===45&&s===2?(e.consume(x),ee):x===60&&s===1?(e.consume(x),B):x===62&&s===4?(e.consume(x),ne):x===63&&s===3?(e.consume(x),f):x===93&&s===5?(e.consume(x),X):H(x)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(oo,le,D)(x)):x===null||H(x)?(e.exit("htmlFlowData"),D(x)):(e.consume(x),F)}function D(x){return e.check(lo,O,le)(x)}function O(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),U}function U(x){return x===null||H(x)?D(x):(e.enter("htmlFlowData"),F(x))}function ee(x){return x===45?(e.consume(x),f):F(x)}function B(x){return x===47?(e.consume(x),o="",q):F(x)}function q(x){if(x===62){const ae=o.toLowerCase();return Un.includes(ae)?(e.consume(x),ne):F(x)}return je(x)&&o.length<8?(e.consume(x),o+=String.fromCharCode(x),q):F(x)}function X(x){return x===93?(e.consume(x),f):F(x)}function f(x){return x===62?(e.consume(x),ne):x===45&&s===2?(e.consume(x),f):F(x)}function ne(x){return x===null||H(x)?(e.exit("htmlFlowData"),le(x)):(e.consume(x),ne)}function le(x){return e.exit("htmlFlow"),t(x)}}function mo(e,t,n){const i=this;return s;function s(o){return H(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):n(o)}function a(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}function po(e,t,n){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(gt,t,n)}}const ho={name:"htmlText",tokenize:fo};function fo(e,t,n){const i=this;let s,a,o;return l;function l(f){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(f),u}function u(f){return f===33?(e.consume(f),c):f===47?(e.consume(f),L):f===63?(e.consume(f),A):je(f)?(e.consume(f),v):n(f)}function c(f){return f===45?(e.consume(f),d):f===91?(e.consume(f),a=0,w):je(f)?(e.consume(f),_):n(f)}function d(f){return f===45?(e.consume(f),p):n(f)}function m(f){return f===null?n(f):f===45?(e.consume(f),h):H(f)?(o=m,B(f)):(e.consume(f),m)}function h(f){return f===45?(e.consume(f),p):m(f)}function p(f){return f===62?ee(f):f===45?h(f):m(f)}function w(f){const ne="CDATA[";return f===ne.charCodeAt(a++)?(e.consume(f),a===ne.length?b:w):n(f)}function b(f){return f===null?n(f):f===93?(e.consume(f),C):H(f)?(o=b,B(f)):(e.consume(f),b)}function C(f){return f===93?(e.consume(f),g):b(f)}function g(f){return f===62?ee(f):f===93?(e.consume(f),g):b(f)}function _(f){return f===null||f===62?ee(f):H(f)?(o=_,B(f)):(e.consume(f),_)}function A(f){return f===null?n(f):f===63?(e.consume(f),R):H(f)?(o=A,B(f)):(e.consume(f),A)}function R(f){return f===62?ee(f):A(f)}function L(f){return je(f)?(e.consume(f),y):n(f)}function y(f){return f===45||xe(f)?(e.consume(f),y):I(f)}function I(f){return H(f)?(o=I,B(f)):$(f)?(e.consume(f),I):ee(f)}function v(f){return f===45||xe(f)?(e.consume(f),v):f===47||f===62||ue(f)?N(f):n(f)}function N(f){return f===47?(e.consume(f),ee):f===58||f===95||je(f)?(e.consume(f),z):H(f)?(o=N,B(f)):$(f)?(e.consume(f),N):ee(f)}function z(f){return f===45||f===46||f===58||f===95||xe(f)?(e.consume(f),z):S(f)}function S(f){return f===61?(e.consume(f),F):H(f)?(o=S,B(f)):$(f)?(e.consume(f),S):N(f)}function F(f){return f===null||f===60||f===61||f===62||f===96?n(f):f===34||f===39?(e.consume(f),s=f,D):H(f)?(o=F,B(f)):$(f)?(e.consume(f),F):(e.consume(f),O)}function D(f){return f===s?(e.consume(f),s=void 0,U):f===null?n(f):H(f)?(o=D,B(f)):(e.consume(f),D)}function O(f){return f===null||f===34||f===39||f===60||f===61||f===96?n(f):f===47||f===62||ue(f)?N(f):(e.consume(f),O)}function U(f){return f===47||f===62||ue(f)?N(f):n(f)}function ee(f){return f===62?(e.consume(f),e.exit("htmlTextData"),e.exit("htmlText"),t):n(f)}function B(f){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),q}function q(f){return $(f)?K(e,X,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):X(f)}function X(f){return e.enter("htmlTextData"),o(f)}}const un={name:"labelEnd",resolveAll:bo,resolveTo:_o,tokenize:vo},go={tokenize:wo},xo={tokenize:ko},yo={tokenize:jo};function bo(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const s=i.type==="labelImage"?4:2;i.type="data",t+=s}}return e.length!==n.length&&Se(e,0,e.length,n),e}function _o(e,t){let n=e.length,i=0,s,a,o,l;for(;n--;)if(s=e[n][1],a){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(a=n,s.type!=="labelLink")){i=2;break}}else s.type==="labelEnd"&&(o=n);const u={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[a][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[a+i+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",u,t],["enter",c,t]],l=ye(l,e.slice(a+1,a+i+3)),l=ye(l,[["enter",d,t]]),l=ye(l,cn(t.parser.constructs.insideSpan.null,e.slice(a+i+4,o-3),t)),l=ye(l,[["exit",d,t],e[o-2],e[o-1],["exit",c,t]]),l=ye(l,e.slice(o+1)),l=ye(l,[["exit",u,t]]),Se(e,a,e.length,l),e}function vo(e,t,n){const i=this;let s=i.events.length,a,o;for(;s--;)if((i.events[s][1].type==="labelImage"||i.events[s][1].type==="labelLink")&&!i.events[s][1]._balanced){a=i.events[s][1];break}return l;function l(h){return a?a._inactive?m(h):(o=i.parser.defined.includes(qe(i.sliceSerialize({start:a.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),u):n(h)}function u(h){return h===40?e.attempt(go,d,o?d:m)(h):h===91?e.attempt(xo,d,o?c:m)(h):o?d(h):m(h)}function c(h){return e.attempt(yo,d,m)(h)}function d(h){return t(h)}function m(h){return a._balanced=!0,n(h)}}function wo(e,t,n){return i;function i(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),s}function s(m){return ue(m)?$e(e,a)(m):a(m)}function a(m){return m===41?d(m):Gr(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return ue(m)?$e(e,u)(m):d(m)}function l(m){return n(m)}function u(m){return m===34||m===39||m===40?Yr(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):d(m)}function c(m){return ue(m)?$e(e,d)(m):d(m)}function d(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function ko(e,t,n){const i=this;return s;function s(l){return Jr.call(i,e,a,o,"reference","referenceMarker","referenceString")(l)}function a(l){return i.parser.defined.includes(qe(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function jo(e,t,n){return i;function i(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),s}function s(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const So={name:"labelStartImage",resolveAll:un.resolveAll,tokenize:No};function No(e,t,n){const i=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),a}function a(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(l):t(l)}}const Co={name:"labelStartLink",resolveAll:un.resolveAll,tokenize:Ao};function Ao(e,t,n){const i=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(o):t(o)}}const Ft={name:"lineEnding",tokenize:Eo};function Eo(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),K(e,t,"linePrefix")}}const pt={name:"thematicBreak",tokenize:Io};function Io(e,t,n){let i=0,s;return a;function a(c){return e.enter("thematicBreak"),o(c)}function o(c){return s=c,l(c)}function l(c){return c===s?(e.enter("thematicBreakSequence"),u(c)):i>=3&&(c===null||H(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===s?(e.consume(c),i++,u):(e.exit("thematicBreakSequence"),$(c)?K(e,l,"whitespace")(c):l(c))}}const ce={continuation:{tokenize:Fo},exit:Ro,name:"list",tokenize:Mo},To={partial:!0,tokenize:Oo},Po={partial:!0,tokenize:Lo};function Mo(e,t,n){const i=this,s=i.events[i.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const w=i.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!i.containerState.marker||p===i.containerState.marker:Yt(p)){if(i.containerState.type||(i.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(pt,n,c)(p):c(p);if(!i.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return n(p)}function u(p){return Yt(p)&&++o<10?(e.consume(p),u):(!i.interrupt||o<2)&&(i.containerState.marker?p===i.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||p,e.check(gt,i.interrupt?n:d,e.attempt(To,h,m))}function d(p){return i.containerState.initialBlankLine=!0,a++,h(p)}function m(p){return $(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return i.containerState.size=a+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Fo(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(gt,s,a);function s(l){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,K(e,t,"listItemIndent",i.containerState.size+1)(l)}function a(l){return i.containerState.furtherBlankLines||!$(l)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(l)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(Po,t,o)(l))}function o(l){return i.containerState._closeFlow=!0,i.interrupt=void 0,K(e,e.attempt(ce,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Lo(e,t,n){const i=this;return K(e,s,"listItemIndent",i.containerState.size+1);function s(a){const o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?t(a):n(a)}}function Ro(e){e.exit(this.containerState.type)}function Oo(e,t,n){const i=this;return K(e,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const o=i.events[i.events.length-1];return!$(a)&&o&&o[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Hn={name:"setextUnderline",resolveTo:zo,tokenize:Do};function zo(e,t){let n=e.length,i,s,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const o={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",a?(e.splice(s,0,["enter",o,t]),e.splice(a+1,0,["exit",e[i][1],t]),e[i][1].end={...e[a][1].end}):e[i][1]=o,e.push(["exit",o,t]),e}function Do(e,t,n){const i=this;let s;return a;function a(c){let d=i.events.length,m;for(;d--;)if(i.events[d][1].type!=="lineEnding"&&i.events[d][1].type!=="linePrefix"&&i.events[d][1].type!=="content"){m=i.events[d][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||m)?(e.enter("setextHeadingLine"),s=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===s?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),$(c)?K(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||H(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const Bo={tokenize:qo};function qo(e){const t=this,n=e.attempt(gt,i,e.attempt(this.parser.constructs.flowInitial,s,K(e,e.attempt(this.parser.constructs.flow,s,e.attempt(Wa,s)),"linePrefix")));return n;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Uo={resolveAll:$r()},Ho=Xr("string"),Vo=Xr("text");function Xr(e){return{resolveAll:$r(e==="text"?Wo:void 0),tokenize:t};function t(n){const i=this,s=this.parser.constructs[e],a=n.attempt(s,o,l);return o;function o(d){return c(d)?a(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),u}function u(d){return c(d)?(n.exit("data"),a(d)):(n.consume(d),u)}function c(d){if(d===null)return!0;const m=s[d];let h=-1;if(m)for(;++h<m.length;){const p=m[h];if(!p.previous||p.previous.call(i,i.previous))return!0}return!1}}}function $r(e){return t;function t(n,i){let s=-1,a;for(;++s<=n.length;)a===void 0?n[s]&&n[s][1].type==="data"&&(a=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==a+2&&(n[a][1].end=n[s-1][1].end,n.splice(a+2,s-a-2),s=a+2),a=void 0);return e?e(n,i):n}}function Wo(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],s=t.sliceStream(i);let a=s.length,o=-1,l=0,u;for(;a--;){const c=s[a];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(c===-2)u=!0,l++;else if(c!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const c={type:n===e.length||u||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?o:i.start._bufferIndex+o,_index:i.start._index+a,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...c.start},i.start.offset===i.end.offset?Object.assign(i,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const Go={42:ce,43:ce,45:ce,48:ce,49:ce,50:ce,51:ce,52:ce,53:ce,54:ce,55:ce,56:ce,57:ce,62:Ur},Jo={91:$a},Yo={[-2]:Mt,[-1]:Mt,32:Mt},Xo={35:no,42:pt,45:[Hn,pt],60:ao,61:Hn,95:pt,96:qn,126:qn},$o={38:Vr,92:Hr},Qo={[-5]:Ft,[-4]:Ft,[-3]:Ft,33:So,38:Vr,42:Xt,60:[Na,ho],91:Co,92:[eo,Hr],93:un,95:Xt,96:Da},Zo={null:[Xt,Uo]},Ko={null:[42,95]},el={null:[]},tl=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Ko,contentInitial:Jo,disable:el,document:Go,flow:Xo,flowInitial:Yo,insideSpan:Zo,string:$o,text:Qo},Symbol.toStringTag,{value:"Module"}));function nl(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},a=[];let o=[],l=[];const u={attempt:I(L),check:I(y),consume:_,enter:A,exit:R,interrupt:I(y,{interrupt:!0})},c={code:null,containerState:{},defineSkip:b,events:[],now:w,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:m};let d=t.tokenize.call(c,u);return t.resolveAll&&a.push(t),c;function m(S){return o=ye(o,S),C(),o[o.length-1]!==null?[]:(v(t,0),c.events=cn(a,c.events,c),c.events)}function h(S,F){return il(p(S),F)}function p(S){return rl(o,S)}function w(){const{_bufferIndex:S,_index:F,line:D,column:O,offset:U}=i;return{_bufferIndex:S,_index:F,line:D,column:O,offset:U}}function b(S){s[S.line]=S.column,z()}function C(){let S;for(;i._index<o.length;){const F=o[i._index];if(typeof F=="string")for(S=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===S&&i._bufferIndex<F.length;)g(F.charCodeAt(i._bufferIndex));else g(F)}}function g(S){d=d(S)}function _(S){H(S)?(i.line++,i.column=1,i.offset+=S===-3?2:1,z()):S!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===o[i._index].length&&(i._bufferIndex=-1,i._index++)),c.previous=S}function A(S,F){const D=F||{};return D.type=S,D.start=w(),c.events.push(["enter",D,c]),l.push(D),D}function R(S){const F=l.pop();return F.end=w(),c.events.push(["exit",F,c]),F}function L(S,F){v(S,F.from)}function y(S,F){F.restore()}function I(S,F){return D;function D(O,U,ee){let B,q,X,f;return Array.isArray(O)?le(O):"tokenize"in O?le([O]):ne(O);function ne(re){return Ie;function Ie(ve){const Ne=ve!==null&&re[ve],we=ve!==null&&re.null,Fe=[...Array.isArray(Ne)?Ne:Ne?[Ne]:[],...Array.isArray(we)?we:we?[we]:[]];return le(Fe)(ve)}}function le(re){return B=re,q=0,re.length===0?ee:x(re[q])}function x(re){return Ie;function Ie(ve){return f=N(),X=re,re.partial||(c.currentConstruct=re),re.name&&c.parser.constructs.disable.null.includes(re.name)?_e():re.tokenize.call(F?Object.assign(Object.create(c),F):c,u,ae,_e)(ve)}}function ae(re){return S(X,f),U}function _e(re){return f.restore(),++q<B.length?x(B[q]):ee}}}function v(S,F){S.resolveAll&&!a.includes(S)&&a.push(S),S.resolve&&Se(c.events,F,c.events.length-F,S.resolve(c.events.slice(F),c)),S.resolveTo&&(c.events=S.resolveTo(c.events,c))}function N(){const S=w(),F=c.previous,D=c.currentConstruct,O=c.events.length,U=Array.from(l);return{from:O,restore:ee};function ee(){i=S,c.previous=F,c.currentConstruct=D,c.events.length=O,l=U,z()}}function z(){i.line in s&&i.column<2&&(i.column=s[i.line],i.offset+=s[i.line]-1)}}function rl(e,t){const n=t.start._index,i=t.start._bufferIndex,s=t.end._index,a=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(i,a)];else{if(o=e.slice(n,s),i>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(i):o.shift()}a>0&&o.push(e[s].slice(0,a))}return o}function il(e,t){let n=-1;const i=[];let s;for(;++n<e.length;){const a=e[n];let o;if(typeof a=="string")o=a;else switch(a){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(a)}s=a===-2,i.push(o)}return i.join("")}function sl(e){const i={constructs:da([tl,...(e||{}).extensions||[]]),content:s(ba),defined:[],document:s(va),flow:s(Bo),lazy:{},string:s(Ho),text:s(Vo)};return i;function s(a){return o;function o(l){return nl(i,a,l)}}}function al(e){for(;!Wr(e););return e}const Vn=/[\0\t\n\r]/g;function ol(){let e=1,t="",n=!0,i;return s;function s(a,o,l){const u=[];let c,d,m,h,p;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),m=0,t="",n&&(a.charCodeAt(0)===65279&&m++,n=void 0);m<a.length;){if(Vn.lastIndex=m,c=Vn.exec(a),h=c&&c.index!==void 0?c.index:a.length,p=a.charCodeAt(h),!c){t=a.slice(m);break}if(p===10&&m===h&&i)u.push(-3),i=void 0;else switch(i&&(u.push(-5),i=void 0),m<h&&(u.push(a.slice(m,h)),e+=h-m),p){case 0:{u.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,u.push(-2);e++<d;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:i=!0,e=1}m=h+1}return l&&(i&&u.push(-5),t&&u.push(t),u.push(null)),u}}const ll=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function cl(e){return e.replace(ll,ul)}function ul(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),a=s===120||s===88;return qr(n.slice(a?2:1),a?16:10)}return ln(n)||e}function Qe(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Wn(e.position):"start"in e||"end"in e?Wn(e):"line"in e||"column"in e?$t(e):""}function $t(e){return Gn(e&&e.line)+":"+Gn(e&&e.column)}function Wn(e){return $t(e&&e.start)+"-"+$t(e&&e.end)}function Gn(e){return e&&typeof e=="number"?e:1}const Qr={}.hasOwnProperty;function dl(e,t,n){return typeof t!="string"&&(n=t,t=void 0),ml(n)(al(sl(n).document().write(ol()(e,t,!0))))}function ml(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(st),autolinkProtocol:N,autolinkEmail:N,atxHeading:a(nt),blockQuote:a(we),characterEscape:N,characterReference:N,codeFenced:a(Fe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(Fe,o),codeText:a(bt,o),codeTextData:N,data:N,codeFlowValue:N,definition:a(_t),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(vt),hardBreakEscape:a(rt),hardBreakTrailing:a(rt),htmlFlow:a(it,o),htmlFlowData:N,htmlText:a(it,o),htmlTextData:N,image:a(wt),label:o,link:a(st),listItem:a(kt),listItemValue:h,listOrdered:a(at,m),listUnordered:a(at),paragraph:a(jt),reference:x,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(nt),strong:a(St),thematicBreak:a(Ct)},exit:{atxHeading:u(),atxHeadingSequence:L,autolink:u(),autolinkEmail:Ne,autolinkProtocol:ve,blockQuote:u(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:re,characterReference:Ie,codeFenced:u(C),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:w,codeFlowValue:z,codeIndented:u(g),codeText:u(U),codeTextData:z,data:z,definition:u(),definitionDestinationString:R,definitionLabelString:_,definitionTitleString:A,emphasis:u(),hardBreakEscape:u(F),hardBreakTrailing:u(F),htmlFlow:u(D),htmlFlowData:z,htmlText:u(O),htmlTextData:z,image:u(B),label:X,labelText:q,lineEnding:S,link:u(ee),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ae,resourceDestinationString:f,resourceTitleString:ne,resource:le,setextHeading:u(v),setextHeadingLineSequence:I,setextHeadingText:y,strong:u(),thematicBreak:u()}};Zr(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(j){let T={type:"root",children:[]};const V={stack:[T],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:d,data:n},J=[];let Q=-1;for(;++Q<j.length;)if(j[Q][1].type==="listOrdered"||j[Q][1].type==="listUnordered")if(j[Q][0]==="enter")J.push(Q);else{const pe=J.pop();Q=s(j,pe,Q)}for(Q=-1;++Q<j.length;){const pe=t[j[Q][0]];Qr.call(pe,j[Q][1].type)&&pe[j[Q][1].type].call(Object.assign({sliceSerialize:j[Q][2].sliceSerialize},V),j[Q][1])}if(V.tokenStack.length>0){const pe=V.tokenStack[V.tokenStack.length-1];(pe[1]||Jn).call(V,void 0,pe[0])}for(T.position={start:Pe(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:Pe(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},Q=-1;++Q<t.transforms.length;)T=t.transforms[Q](T)||T;return T}function s(j,T,V){let J=T-1,Q=-1,pe=!1,M,ie,Te,he;for(;++J<=V;){const fe=j[J];switch(fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{fe[0]==="enter"?Q++:Q--,he=void 0;break}case"lineEndingBlank":{fe[0]==="enter"&&(M&&!he&&!Q&&!Te&&(Te=J),he=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:he=void 0}if(!Q&&fe[0]==="enter"&&fe[1].type==="listItemPrefix"||Q===-1&&fe[0]==="exit"&&(fe[1].type==="listUnordered"||fe[1].type==="listOrdered")){if(M){let Oe=J;for(ie=void 0;Oe--;){const Ce=j[Oe];if(Ce[1].type==="lineEnding"||Ce[1].type==="lineEndingBlank"){if(Ce[0]==="exit")continue;ie&&(j[ie][1].type="lineEndingBlank",pe=!0),Ce[1].type="lineEnding",ie=Oe}else if(!(Ce[1].type==="linePrefix"||Ce[1].type==="blockQuotePrefix"||Ce[1].type==="blockQuotePrefixWhitespace"||Ce[1].type==="blockQuoteMarker"||Ce[1].type==="listItemIndent"))break}Te&&(!ie||Te<ie)&&(M._spread=!0),M.end=Object.assign({},ie?j[ie][1].start:fe[1].end),j.splice(ie||J,0,["exit",M,fe[2]]),J++,V++}if(fe[1].type==="listItemPrefix"){const Oe={type:"listItem",_spread:!1,start:Object.assign({},fe[1].start),end:void 0};M=Oe,j.splice(J,0,["enter",Oe,fe[2]]),J++,V++,Te=void 0,he=!0}}}return j[T][1]._spread=pe,V}function a(j,T){return V;function V(J){l.call(this,j(J),J),T&&T.call(this,J)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(j,T,V){this.stack[this.stack.length-1].children.push(j),this.stack.push(j),this.tokenStack.push([T,V||void 0]),j.position={start:Pe(T.start),end:void 0}}function u(j){return T;function T(V){j&&j.call(this,V),c.call(this,V)}}function c(j,T){const V=this.stack.pop(),J=this.tokenStack.pop();if(J)J[0].type!==j.type&&(T?T.call(this,j,J[0]):(J[1]||Jn).call(this,j,J[0]));else throw new Error("Cannot close `"+j.type+"` ("+Qe({start:j.start,end:j.end})+"): it’s not open");V.position.end=Pe(j.end)}function d(){return ca(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(j){if(this.data.expectingFirstListItemValue){const T=this.stack[this.stack.length-2];T.start=Number.parseInt(this.sliceSerialize(j),10),this.data.expectingFirstListItemValue=void 0}}function p(){const j=this.resume(),T=this.stack[this.stack.length-1];T.lang=j}function w(){const j=this.resume(),T=this.stack[this.stack.length-1];T.meta=j}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const j=this.resume(),T=this.stack[this.stack.length-1];T.value=j.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const j=this.resume(),T=this.stack[this.stack.length-1];T.value=j.replace(/(\r?\n|\r)$/g,"")}function _(j){const T=this.resume(),V=this.stack[this.stack.length-1];V.label=T,V.identifier=qe(this.sliceSerialize(j)).toLowerCase()}function A(){const j=this.resume(),T=this.stack[this.stack.length-1];T.title=j}function R(){const j=this.resume(),T=this.stack[this.stack.length-1];T.url=j}function L(j){const T=this.stack[this.stack.length-1];if(!T.depth){const V=this.sliceSerialize(j).length;T.depth=V}}function y(){this.data.setextHeadingSlurpLineEnding=!0}function I(j){const T=this.stack[this.stack.length-1];T.depth=this.sliceSerialize(j).codePointAt(0)===61?1:2}function v(){this.data.setextHeadingSlurpLineEnding=void 0}function N(j){const V=this.stack[this.stack.length-1].children;let J=V[V.length-1];(!J||J.type!=="text")&&(J=Nt(),J.position={start:Pe(j.start),end:void 0},V.push(J)),this.stack.push(J)}function z(j){const T=this.stack.pop();T.value+=this.sliceSerialize(j),T.position.end=Pe(j.end)}function S(j){const T=this.stack[this.stack.length-1];if(this.data.atHardBreak){const V=T.children[T.children.length-1];V.position.end=Pe(j.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(T.type)&&(N.call(this,j),z.call(this,j))}function F(){this.data.atHardBreak=!0}function D(){const j=this.resume(),T=this.stack[this.stack.length-1];T.value=j}function O(){const j=this.resume(),T=this.stack[this.stack.length-1];T.value=j}function U(){const j=this.resume(),T=this.stack[this.stack.length-1];T.value=j}function ee(){const j=this.stack[this.stack.length-1];if(this.data.inReference){const T=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=T,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function B(){const j=this.stack[this.stack.length-1];if(this.data.inReference){const T=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=T,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function q(j){const T=this.sliceSerialize(j),V=this.stack[this.stack.length-2];V.label=cl(T),V.identifier=qe(T).toLowerCase()}function X(){const j=this.stack[this.stack.length-1],T=this.resume(),V=this.stack[this.stack.length-1];if(this.data.inReference=!0,V.type==="link"){const J=j.children;V.children=J}else V.alt=T}function f(){const j=this.resume(),T=this.stack[this.stack.length-1];T.url=j}function ne(){const j=this.resume(),T=this.stack[this.stack.length-1];T.title=j}function le(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function ae(j){const T=this.resume(),V=this.stack[this.stack.length-1];V.label=T,V.identifier=qe(this.sliceSerialize(j)).toLowerCase(),this.data.referenceType="full"}function _e(j){this.data.characterReferenceType=j.type}function re(j){const T=this.sliceSerialize(j),V=this.data.characterReferenceType;let J;V?(J=qr(T,V==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):J=ln(T);const Q=this.stack[this.stack.length-1];Q.value+=J}function Ie(j){const T=this.stack.pop();T.position.end=Pe(j.end)}function ve(j){z.call(this,j);const T=this.stack[this.stack.length-1];T.url=this.sliceSerialize(j)}function Ne(j){z.call(this,j);const T=this.stack[this.stack.length-1];T.url="mailto:"+this.sliceSerialize(j)}function we(){return{type:"blockquote",children:[]}}function Fe(){return{type:"code",lang:null,meta:null,value:""}}function bt(){return{type:"inlineCode",value:""}}function _t(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function vt(){return{type:"emphasis",children:[]}}function nt(){return{type:"heading",depth:0,children:[]}}function rt(){return{type:"break"}}function it(){return{type:"html",value:""}}function wt(){return{type:"image",title:null,url:"",alt:null}}function st(){return{type:"link",title:null,url:"",children:[]}}function at(j){return{type:"list",ordered:j.type==="listOrdered",start:null,spread:j._spread,children:[]}}function kt(j){return{type:"listItem",spread:j._spread,checked:null,children:[]}}function jt(){return{type:"paragraph",children:[]}}function St(){return{type:"strong",children:[]}}function Nt(){return{type:"text",value:""}}function Ct(){return{type:"thematicBreak"}}}function Pe(e){return{line:e.line,column:e.column,offset:e.offset}}function Zr(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?Zr(e,i):pl(e,i)}}function pl(e,t){let n;for(n in t)if(Qr.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function Jn(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Qe({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Qe({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Qe({start:t.start,end:t.end})+") is still open")}function hl(e){const t=this;t.parser=n;function n(i){return dl(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function fl(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function gl(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function xl(e,t){const n=t.value?t.value+`
`:"",i={};t.lang&&(i.className=["language-"+t.lang]);let s={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function yl(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bl(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _l(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),s=Ve(i.toLowerCase()),a=e.footnoteOrder.indexOf(i);let o,l=e.footnoteCounts.get(i);l===void 0?(l=0,e.footnoteOrder.push(i),o=e.footnoteOrder.length):o=a+1,l+=1,e.footnoteCounts.set(i,l);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function vl(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wl(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Kr(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const s=e.all(t),a=s[0];a&&a.type==="text"?a.value="["+a.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=i:s.push({type:"text",value:i}),s}function kl(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Kr(e,t);const s={src:Ve(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(s.title=i.title);const a={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,a),e.applyData(t,a)}function jl(e,t){const n={src:Ve(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function Sl(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function Nl(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Kr(e,t);const s={href:Ve(i.url||"")};i.title!==null&&i.title!==void 0&&(s.title=i.title);const a={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Cl(e,t){const n={href:Ve(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Al(e,t,n){const i=e.all(t),s=n?El(n):ei(t),a={},o=[];if(typeof t.checked=="boolean"){const d=i[0];let m;d&&d.type==="element"&&d.tagName==="p"?m=d:(m={type:"element",tagName:"p",properties:{},children:[]},i.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let l=-1;for(;++l<i.length;){const d=i[l];(s||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!s?o.push(...d.children):o.push(d)}const u=i[i.length-1];u&&(s||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,c),e.applyData(t,c)}function El(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=ei(n[i])}return t}function ei(e){const t=e.spread;return t??e.children.length>1}function Il(e,t){const n={},i=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<i.length;){const o=i[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Tl(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Pl(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Ml(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ti=ri("end"),ni=ri("start");function ri(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};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 Fl(e){const t=ni(e),n=ti(e);if(t&&n)return{start:t,end:n}}function Ll(e,t){const n=e.all(t),i=n.shift(),s=[];if(i){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=ni(t.children[1]),u=ti(t.children[t.children.length-1]);l&&u&&(o.position={start:l,end:u}),s.push(o)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,a),e.applyData(t,a)}function Rl(e,t,n){const i=n?n.children:void 0,a=(i?i.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let u=-1;const c=[];for(;++u<l;){const m=t.children[u],h={},p=o?o[u]:void 0;p&&(h.align=p);let w={type:"element",tagName:a,properties:h,children:[]};m&&(w.children=e.all(m),e.patch(m,w),w=e.applyData(m,w)),c.push(w)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function Ol(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Yn=9,Xn=32;function zl(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),s=0;const a=[];for(;i;)a.push($n(t.slice(s,i.index),s>0,!0),i[0]),s=i.index+i[0].length,i=n.exec(t);return a.push($n(t.slice(s),s>0,!1)),a.join("")}function $n(e,t,n){let i=0,s=e.length;if(t){let a=e.codePointAt(i);for(;a===Yn||a===Xn;)i++,a=e.codePointAt(i)}if(n){let a=e.codePointAt(s-1);for(;a===Yn||a===Xn;)s--,a=e.codePointAt(s-1)}return s>i?e.slice(i,s):""}function Dl(e,t){const n={type:"text",value:zl(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Bl(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const ql={blockquote:fl,break:gl,code:xl,delete:yl,emphasis:bl,footnoteReference:_l,heading:vl,html:wl,imageReference:kl,image:jl,inlineCode:Sl,linkReference:Nl,link:Cl,listItem:Al,list:Il,paragraph:Tl,root:Pl,strong:Ml,table:Ll,tableCell:Ol,tableRow:Rl,text:Dl,thematicBreak:Bl,toml:lt,yaml:lt,definition:lt,footnoteDefinition:lt};function lt(){}const ii=-1,xt=0,Ze=1,ht=2,dn=3,mn=4,pn=5,hn=6,si=7,ai=8,Qn=typeof self=="object"?self:globalThis,Ul=(e,t)=>{const n=(s,a)=>(e.set(a,s),s),i=s=>{if(e.has(s))return e.get(s);const[a,o]=t[s];switch(a){case xt:case ii:return n(o,s);case Ze:{const l=n([],s);for(const u of o)l.push(i(u));return l}case ht:{const l=n({},s);for(const[u,c]of o)l[i(u)]=i(c);return l}case dn:return n(new Date(o),s);case mn:{const{source:l,flags:u}=o;return n(new RegExp(l,u),s)}case pn:{const l=n(new Map,s);for(const[u,c]of o)l.set(i(u),i(c));return l}case hn:{const l=n(new Set,s);for(const u of o)l.add(i(u));return l}case si:{const{name:l,message:u}=o;return n(new Qn[l](u),s)}case ai:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new Qn[a](o),s)};return i},Zn=e=>Ul(new Map,e)(0),De="",{toString:Hl}={},{keys:Vl}=Object,Ye=e=>{const t=typeof e;if(t!=="object"||!e)return[xt,t];const n=Hl.call(e).slice(8,-1);switch(n){case"Array":return[Ze,De];case"Object":return[ht,De];case"Date":return[dn,De];case"RegExp":return[mn,De];case"Map":return[pn,De];case"Set":return[hn,De];case"DataView":return[Ze,n]}return n.includes("Array")?[Ze,n]:n.includes("Error")?[si,n]:[ht,n]},ct=([e,t])=>e===xt&&(t==="function"||t==="symbol"),Wl=(e,t,n,i)=>{const s=(o,l)=>{const u=i.push(o)-1;return n.set(l,u),u},a=o=>{if(n.has(o))return n.get(o);let[l,u]=Ye(o);switch(l){case xt:{let d=o;switch(u){case"bigint":l=ai,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);d=null;break;case"undefined":return s([ii],o)}return s([l,d],o)}case Ze:{if(u){let h=o;return u==="DataView"?h=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(h=new Uint8Array(o)),s([u,[...h]],o)}const d=[],m=s([l,d],o);for(const h of o)d.push(a(h));return m}case ht:{if(u)switch(u){case"BigInt":return s([u,o.toString()],o);case"Boolean":case"Number":case"String":return s([u,o.valueOf()],o)}if(t&&"toJSON"in o)return a(o.toJSON());const d=[],m=s([l,d],o);for(const h of Vl(o))(e||!ct(Ye(o[h])))&&d.push([a(h),a(o[h])]);return m}case dn:return s([l,o.toISOString()],o);case mn:{const{source:d,flags:m}=o;return s([l,{source:d,flags:m}],o)}case pn:{const d=[],m=s([l,d],o);for(const[h,p]of o)(e||!(ct(Ye(h))||ct(Ye(p))))&&d.push([a(h),a(p)]);return m}case hn:{const d=[],m=s([l,d],o);for(const h of o)(e||!ct(Ye(h)))&&d.push(a(h));return m}}const{message:c}=o;return s([l,{name:u,message:c}],o)};return a},Kn=(e,{json:t,lossy:n}={})=>{const i=[];return Wl(!(t||n),!!t,new Map,i)(e),i},ft=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Zn(Kn(e,t)):structuredClone(e):(e,t)=>Zn(Kn(e,t));function Gl(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Jl(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Yl(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Gl,i=e.options.footnoteBackLabel||Jl,s=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[u]);if(!c)continue;const d=e.all(c),m=String(c.identifier).toUpperCase(),h=Ve(m.toLowerCase());let p=0;const w=[],b=e.footnoteCounts.get(m);for(;b!==void 0&&++p<=b;){w.length>0&&w.push({type:"text",value:" "});let _=typeof n=="string"?n:n(u,p);typeof _=="string"&&(_={type:"text",value:_}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(u,p),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const C=d[d.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const _=C.children[C.children.length-1];_&&_.type==="text"?_.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else d.push(...w);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(c,g),l.push(g)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...ft(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
`}]}}const oi=function(e){if(e==null)return Zl;if(typeof e=="function")return yt(e);if(typeof e=="object")return Array.isArray(e)?Xl(e):$l(e);if(typeof e=="string")return Ql(e);throw new Error("Expected function, string, or object as test")};function Xl(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=oi(e[n]);return yt(i);function i(...s){let a=-1;for(;++a<t.length;)if(t[a].apply(this,s))return!0;return!1}}function $l(e){const t=e;return yt(n);function n(i){const s=i;let a;for(a in e)if(s[a]!==t[a])return!1;return!0}}function Ql(e){return yt(t);function t(n){return n&&n.type===e}}function yt(e){return t;function t(n,i,s){return!!(Kl(n)&&e.call(this,n,typeof i=="number"?i:void 0,s||void 0))}}function Zl(){return!0}function Kl(e){return e!==null&&typeof e=="object"&&"type"in e}const li=[],ec=!0,er=!1,tc="skip";function nc(e,t,n,i){let s;typeof t=="function"&&typeof n!="function"?(i=n,n=t):s=t;const a=oi(s),o=i?-1:1;l(e,void 0,[])();function l(u,c,d){const m=u&&typeof u=="object"?u:{};if(typeof m.type=="string"){const p=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(u.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=li,w,b,C;if((!t||a(u,c,d[d.length-1]||void 0))&&(p=rc(n(u,d)),p[0]===er))return p;if("children"in u&&u.children){const g=u;if(g.children&&p[0]!==tc)for(b=(i?g.children.length:-1)+o,C=d.concat(g);b>-1&&b<g.children.length;){const _=g.children[b];if(w=l(_,b,C)(),w[0]===er)return w;b=typeof w[1]=="number"?w[1]:b+o}}return p}}}function rc(e){return Array.isArray(e)?e:typeof e=="number"?[ec,e]:e==null?li:[e]}function ci(e,t,n,i){let s,a,o;typeof t=="function"?(a=void 0,o=t,s=n):(a=t,o=n,s=i),nc(e,a,l,s);function l(u,c){const d=c[c.length-1],m=d?d.children.indexOf(u):void 0;return o(u,m,d)}}const Qt={}.hasOwnProperty,ic={};function sc(e,t){const n=t||ic,i=new Map,s=new Map,a=new Map,o={...ql,...n.handlers},l={all:c,applyData:oc,definitionById:i,footnoteById:s,footnoteCounts:a,footnoteOrder:[],handlers:o,one:u,options:n,patch:ac,wrap:cc};return ci(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const m=d.type==="definition"?i:s,h=String(d.identifier).toUpperCase();m.has(h)||m.set(h,d)}}),l;function u(d,m){const h=d.type,p=l.handlers[h];if(Qt.call(l.handlers,h)&&p)return p(l,d,m);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in d){const{children:b,...C}=d,g=ft(C);return g.children=l.all(d),g}return ft(d)}return(l.options.unknownHandler||lc)(l,d,m)}function c(d){const m=[];if("children"in d){const h=d.children;let p=-1;for(;++p<h.length;){const w=l.one(h[p],d);if(w){if(p&&h[p-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=tr(w.value)),!Array.isArray(w)&&w.type==="element")){const b=w.children[0];b&&b.type==="text"&&(b.value=tr(b.value))}Array.isArray(w)?m.push(...w):m.push(w)}}}return m}}function ac(e,t){e.position&&(t.position=Fl(e))}function oc(e,t){let n=t;if(e&&e.data){const i=e.data.hName,s=e.data.hChildren,a=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const o="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:o}}n.type==="element"&&a&&Object.assign(n.properties,ft(a)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function lc(e,t){const n=t.data||{},i="value"in t&&!(Qt.call(n,"hProperties")||Qt.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function cc(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
`});++i<e.length;)i&&n.push({type:"text",value:`
`}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function tr(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function nr(e,t){const n=sc(e,t),i=n.one(e,void 0),s=Yl(n),a=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return s&&a.children.push({type:"text",value:`
`},s),a}function uc(e,t){return e&&"run"in e?async function(n,i){const s=nr(n,{file:i,...t});await e.run(s,i)}:function(n,i){return nr(n,{file:i,...e||t})}}function rr(e){if(e)throw e}var Lt,ir;function dc(){if(ir)return Lt;ir=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},a=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var d=e.call(c,"constructor"),m=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!d&&!m)return!1;var h;for(h in c);return typeof h>"u"||e.call(c,h)},o=function(c,d){n&&d.name==="__proto__"?n(c,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):c[d.name]=d.newValue},l=function(c,d){if(d==="__proto__")if(e.call(c,d)){if(i)return i(c,d).value}else return;return c[d]};return Lt=function u(){var c,d,m,h,p,w,b=arguments[0],C=1,g=arguments.length,_=!1;for(typeof b=="boolean"&&(_=b,b=arguments[1]||{},C=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});C<g;++C)if(c=arguments[C],c!=null)for(d in c)m=l(b,d),h=l(c,d),b!==h&&(_&&h&&(a(h)||(p=s(h)))?(p?(p=!1,w=m&&s(m)?m:[]):w=m&&a(m)?m:{},o(b,{name:d,newValue:u(_,w,h)})):typeof h<"u"&&o(b,{name:d,newValue:h}));return b},Lt}var mc=dc();const Rt=yr(mc);function Zt(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function pc(){const e=[],t={run:n,use:i};return t;function n(...s){let a=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(u,...c){const d=e[++a];let m=-1;if(u){o(u);return}for(;++m<s.length;)(c[m]===null||c[m]===void 0)&&(c[m]=s[m]);s=c,d?hc(d,l)(...c):o(null,...c)}}function i(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function hc(e,t){let n;return i;function i(...o){const l=e.length>o.length;let u;l&&o.push(s);try{u=e.apply(this,o)}catch(c){const d=c;if(l&&n)throw d;return s(d)}l||(u&&u.then&&typeof u.then=="function"?u.then(a,s):u instanceof Error?s(u):a(u))}function s(o,...l){n||(n=!0,t(o,...l))}function a(o){s(null,o)}}class me extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let s="",a={},o=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?s=t:!a.cause&&t&&(o=!0,s=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof i=="string"){const u=i.indexOf(":");u===-1?a.ruleId=i:(a.source=i.slice(0,u),a.ruleId=i.slice(u+1))}if(!a.place&&a.ancestors&&a.ancestors){const u=a.ancestors[a.ancestors.length-1];u&&(a.place=u.position)}const l=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file,this.message=s,this.line=l?l.line:void 0,this.name=Qe(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}}me.prototype.file="";me.prototype.name="";me.prototype.reason="";me.prototype.message="";me.prototype.stack="";me.prototype.column=void 0;me.prototype.line=void 0;me.prototype.ancestors=void 0;me.prototype.cause=void 0;me.prototype.fatal=void 0;me.prototype.place=void 0;me.prototype.ruleId=void 0;me.prototype.source=void 0;const ke={basename:fc,dirname:gc,extname:xc,join:yc,sep:"/"};function fc(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');tt(e);let n=0,i=-1,s=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else i<0&&(a=!0,i=s+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else o<0&&(a=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(i=s):(l=-1,i=o));return n===i?i=o:i<0&&(i=e.length),e.slice(n,i)}function gc(e){if(tt(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function xc(e){tt(e);let t=e.length,n=-1,i=0,s=-1,a=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){i=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?s<0?s=t:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||n<0||a===0||a===1&&s===n-1&&s===i+1?"":e.slice(s,n)}function yc(...e){let t=-1,n;for(;++t<e.length;)tt(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":bc(n)}function bc(e){tt(e);const t=e.codePointAt(0)===47;let n=_c(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function _c(e,t){let n="",i=0,s=-1,a=0,o=-1,l,u;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||a===1))if(s!==o-1&&a===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",i=0):(n=n.slice(0,u),i=n.length-1-n.lastIndexOf("/")),s=o,a=0;continue}}else if(n.length>0){n="",i=0,s=o,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),i=o-s-1;s=o,a=0}else l===46&&a>-1?a++:a=-1}return n}function tt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const vc={cwd:wc};function wc(){return"/"}function Kt(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function kc(e){if(typeof e=="string")e=new URL(e);else if(!Kt(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return jc(e)}function jc(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Ot=["history","path","basename","stem","extname","dirname"];class ui{constructor(t){let n;t?Kt(t)?n={path:t}:typeof t=="string"||Sc(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":vc.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Ot.length;){const a=Ot[i];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let s;for(s in n)Ot.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ke.basename(this.path):void 0}set basename(t){Dt(t,"basename"),zt(t,"basename"),this.path=ke.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ke.dirname(this.path):void 0}set dirname(t){sr(this.basename,"dirname"),this.path=ke.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ke.extname(this.path):void 0}set extname(t){if(zt(t,"extname"),sr(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ke.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Kt(t)&&(t=kc(t)),Dt(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ke.basename(this.path,this.extname):void 0}set stem(t){Dt(t,"stem"),zt(t,"stem"),this.path=ke.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const s=this.message(t,n,i);throw s.fatal=!0,s}info(t,n,i){const s=this.message(t,n,i);return s.fatal=void 0,s}message(t,n,i){const s=new me(t,n,i);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function zt(e,t){if(e&&e.includes(ke.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ke.sep+"`")}function Dt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function sr(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Sc(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Nc=function(e){const i=this.constructor.prototype,s=i[e],a=function(){return s.apply(a,arguments)};return Object.setPrototypeOf(a,i),a},Cc={}.hasOwnProperty;class fn extends Nc{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=pc()}copy(){const t=new fn;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(Rt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ut("data",this.frozen),this.namespace[t]=n,this):Cc.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ut("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const s=n.call(t,...i);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ut(t),i=this.parser||this.Parser;return Bt("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),Bt("process",this.parser||this.Parser),qt("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(a,o){const l=ut(t),u=i.parse(l);i.run(u,l,function(d,m,h){if(d||!m||!h)return c(d);const p=m,w=i.stringify(p,h);Ic(w)?h.value=w:h.result=w,c(d,h)});function c(d,m){d||!m?o(d):a?a(m):n(void 0,m)}}}processSync(t){let n=!1,i;return this.freeze(),Bt("processSync",this.parser||this.Parser),qt("processSync",this.compiler||this.Compiler),this.process(t,s),or("processSync","process",n),i;function s(a,o){n=!0,rr(a),i=o}}run(t,n,i){ar(t),this.freeze();const s=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?a(void 0,i):new Promise(a);function a(o,l){const u=ut(n);s.run(t,u,c);function c(d,m,h){const p=m||t;d?l(d):o?o(p):i(void 0,p,h)}}}runSync(t,n){let i=!1,s;return this.run(t,n,a),or("runSync","run",i),s;function a(o,l){rr(o),s=l,i=!0}}stringify(t,n){this.freeze();const i=ut(n),s=this.compiler||this.Compiler;return qt("stringify",s),ar(t),s(t,i)}use(t,...n){const i=this.attachers,s=this.namespace;if(Ut("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(c){if(typeof c=="function")u(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...m]=c;u(d,m)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(c.plugins),c.settings&&(s.settings=Rt(!0,s.settings,c.settings))}function l(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const m=c[d];a(m)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,d){let m=-1,h=-1;for(;++m<i.length;)if(i[m][0]===c){h=m;break}if(h===-1)i.push([c,...d]);else if(d.length>0){let[p,...w]=d;const b=i[h][1];Zt(b)&&Zt(p)&&(p=Rt(!0,b,p)),i[h]=[c,p,...w]}}}}const Ac=new fn().freeze();function Bt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function qt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ut(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ar(e){if(!Zt(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function or(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ut(e){return Ec(e)?e:new ui(e)}function Ec(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Ic(e){return typeof e=="string"||Tc(e)}function Tc(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Pc="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",lr=[],cr={allowDangerousHtml:!0},Mc=/^(https?|ircs?|mailto|xmpp)$/i,Fc=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Lc(e){const t=Rc(e),n=Oc(e);return zc(t.runSync(t.parse(n),n),e)}function Rc(e){const t=e.rehypePlugins||lr,n=e.remarkPlugins||lr,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...cr}:cr;return Ac().use(hl).use(n).use(uc,i).use(t)}function Oc(e){const t=e.children||"",n=new ui;return typeof t=="string"&&(n.value=t),n}function zc(e,t){const n=t.allowedElements,i=t.allowElement,s=t.components,a=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||Dc;for(const d of Fc)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Pc+d.id,void 0);return ci(e,c),Gs(e,{Fragment:r.Fragment,components:s,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function c(d,m,h){if(d.type==="raw"&&h&&typeof m=="number")return o?h.children.splice(m,1):h.children[m]={type:"text",value:d.value},m;if(d.type==="element"){let p;for(p in Pt)if(Object.hasOwn(Pt,p)&&Object.hasOwn(d.properties,p)){const w=d.properties[p],b=Pt[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=u(String(w||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):a?a.includes(d.tagName):!1;if(!p&&i&&typeof m=="number"&&(p=!i(d,m,h)),p&&h&&typeof m=="number")return l&&d.children?h.children.splice(m,1,...d.children):h.children.splice(m,1),m}}}function Dc(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||i!==-1&&t>i||Mc.test(e.slice(0,t))?e:""}const ur=({variant:e="default",className:t,children:n,...i})=>{const s="px-4 py-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 disabled:opacity-50 disabled:pointer-events-none",a="bg-green-500 hover:bg-green-600 text-white dark:bg-green-600 dark:hover:bg-green-700",o="bg-indigo-600 hover:bg-indigo-700 text-white dark:bg-indigo-500 dark:hover:bg-indigo-600";let u="bg-gray-200 hover:bg-gray-300 text-gray-800 dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-gray-100";return e==="primary"?u=a:e==="secondary"&&(u=o),r.jsx("button",{...i,className:`${s} ${u} ${t||""}`.trim(),children:n})},Bc=({plugin:e,isOpen:t,onClose:n,onInstall:i})=>{if(!t)return null;const s=a=>!a||a.length===0?r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No skills defined for this plugin."}):r.jsx("ul",{className:"list-disc list-inside space-y-1 pl-1",children:a.map((o,l)=>r.jsxs("li",{className:"text-sm text-gray-700 dark:text-gray-300",children:[r.jsx("strong",{className:"font-semibold text-gray-800 dark:text-gray-200",children:o.name||"Unnamed Skill"}),o.description&&`: ${o.description}`]},l))});return r.jsx("div",{role:"button",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 dark:bg-black/70 backdrop-blur-sm p-4",onClick:n,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&n()},children:r.jsxs("div",{role:"dialog",className:"bg-white dark:bg-gray-800 rounded-lg shadow-2xl border border-gray-200 dark:border-gray-700 max-w-2xl w-full max-h-[90vh] flex flex-col",onClick:a=>a.stopPropagation(),onKeyDown:a=>{a.key==="Escape"&&n(),a.stopPropagation()},children:[r.jsxs("div",{className:"flex justify-between items-center p-4 border-b border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50",children:[r.jsxs("h2",{id:"readMoreModalTitle",className:"text-xl font-semibold text-gray-800 dark:text-gray-100",children:[e.pyproject.name," ",r.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["v",e.pyproject.version]})]}),r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 p-1 rounded-full focus-visible:ring-2 focus-visible:ring-blue-500","aria-label":"Close modal",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),r.jsxs("div",{className:"p-5 space-y-5 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600 scrollbar-track-gray-100 dark:scrollbar-track-gray-700 flex-grow",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1.5",children:"Description"}),r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:e.pyproject.description||"No description provided."})]}),e.pyproject.authors&&e.pyproject.authors.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1.5",children:"Author(s)"}),r.jsx("ul",{className:"list-disc list-inside pl-1",children:e.pyproject.authors.map((a,o)=>r.jsxs("li",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a.name||"N/A"," ",a.email&&r.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:`<${a.email}>`})]},o))})]}),e.pyproject.custom_metadata&&Object.keys(e.pyproject.custom_metadata).length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1.5",children:"Additional Metadata"}),r.jsx("div",{className:"p-4 bg-slate-50 dark:bg-slate-700/50 rounded-lg border border-slate-200 dark:border-slate-600 space-y-2",children:r.jsx("ul",{className:"space-y-1",children:Object.entries(e.pyproject.custom_metadata).map(([a,o])=>r.jsxs("li",{className:"text-sm text-gray-700 dark:text-gray-300 flex",children:[r.jsxs("strong",{className:"font-medium w-1/3 min-w-[100px] flex-shrink-0 text-gray-600 dark:text-gray-200 break-words",children:[a,":"]}),r.jsx("span",{className:"text-gray-600 dark:text-gray-400 break-words",children:String(o)})]},a))})})]}),e.agent_card?r.jsxs("div",{children:[r.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1.5",children:"Agent Card Details"}),r.jsxs("div",{className:"p-4 bg-slate-50 dark:bg-slate-700/50 rounded-lg border border-slate-200 dark:border-slate-600 space-y-2",children:[e.agent_card.displayName&&r.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:[r.jsx("strong",{className:"font-medium text-gray-700 dark:text-gray-200",children:"Display Name:"})," ",e.agent_card.displayName]}),e.agent_card.shortDescription&&r.jsxs("p",{className:"text-sm mt-1 text-gray-600 dark:text-gray-300",children:[r.jsx("strong",{className:"font-medium text-gray-700 dark:text-gray-200",children:"Card Description:"})," ",e.agent_card.shortDescription]}),e.agent_card.Skill&&e.agent_card.Skill.length>0&&r.jsxs("div",{className:"mt-2.5",children:[r.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-1",children:"Skills:"}),s(e.agent_card.Skill)]}),!e.agent_card.displayName&&!e.agent_card.shortDescription&&(!e.agent_card.Skill||e.agent_card.Skill.length===0)&&r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No specific agent card details provided."})]})]}):r.jsxs("div",{className:"p-3 bg-gray-100 dark:bg-gray-700/30 rounded-md border border-gray-200 dark:border-gray-600",children:[r.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1",children:"Agent Card Details"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No agent card data available for this plugin."})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1.5",children:"README"}),e.readme_content?r.jsx("div",{className:"p-4 bg-slate-50 dark:bg-slate-700/50 rounded-lg border border-slate-200 dark:border-slate-600 space-y-2 text-gray-700 dark:text-gray-200",children:r.jsx(Lc,{children:e.readme_content})}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No README content available."})]}),r.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-4 pt-3 border-t border-gray-200 dark:border-gray-600 space-y-1",children:[r.jsxs("p",{children:[r.jsx("strong",{className:"text-gray-600 dark:text-gray-300",children:"Source:"})," ",e.source_registry_name||"Unnamed Registry"," (",e.source_type,")"]}),r.jsxs("p",{children:[r.jsx("strong",{className:"text-gray-600 dark:text-gray-300",children:"Location:"})," ",e.source_type==="git"?r.jsx("a",{href:e.source_registry_location,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:underline break-all",children:e.source_registry_location}):r.jsx("span",{className:"break-all",children:e.source_registry_location})]}),r.jsxs("p",{children:[r.jsx("strong",{className:"text-gray-600 dark:text-gray-300",children:"Plugin Subpath:"})," ",e.plugin_subpath]})]})]}),r.jsxs("div",{className:"mt-auto p-4 border-t border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50 flex justify-end space-x-3",children:[r.jsx(ur,{onClick:n,variant:"default",children:"Close"}),r.jsx(ur,{onClick:()=>i(e),variant:"primary",children:"Install"})]})]})})},dr=({variant:e="default",className:t,children:n,...i})=>{const s="px-4 py-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 disabled:opacity-50 disabled:pointer-events-none",a="bg-green-600 hover:bg-green-700 text-white dark:bg-green-500 dark:hover:bg-green-600";let l="bg-gray-200 hover:bg-gray-300 text-gray-800 dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-gray-100";return e==="primary"&&(l=a),r.jsx("button",{...i,className:`${s} ${l} ${t||""}`.trim(),children:n})},qc=({className:e,...t})=>r.jsx("input",{...t,className:`flex h-10 w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-800 disabled:cursor-not-allowed disabled:opacity-50 ${e||""}`}),Uc=({className:e,children:t,...n})=>r.jsx("label",{...n,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ${e||""}`,children:t}),Hc=({pluginName:e,isOpen:t,onClose:n,onInstall:i,isLoading:s=!1})=>{const[a,o]=k.useState(""),[l,u]=k.useState(null);if(!t)return null;const c=()=>{o(""),u(null),n()},d=async m=>{m.preventDefault();const h=a.trim();if(!h){u("Component name is required.");return}if(!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(h)){u("Component name must start with a letter and can only contain letters, numbers, hyphens (-), and underscores (_).");return}u(null),await i(h)};return r.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"installModalTitle",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 dark:bg-black/70 backdrop-blur-sm p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-2xl border border-gray-200 dark:border-gray-700 max-w-md w-full p-6",children:[r.jsxs("div",{className:"flex justify-between items-center pb-3 border-b border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50 -m-6 p-4 rounded-t-lg mb-4",children:[r.jsxs("h2",{id:"installModalTitle",className:"text-lg font-semibold text-gray-800 dark:text-gray-100",children:["Install Plugin: ",r.jsx("span",{className:"font-bold",children:e})]}),r.jsx("button",{onClick:c,disabled:s,className:"text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 p-1 rounded-full focus-visible:ring-2 focus-visible:ring-blue-500","aria-label":"Close modal",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),r.jsxs("form",{onSubmit:d,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Uc,{htmlFor:"componentName",children:"Component Name:"}),r.jsx(qc,{type:"text",id:"componentName",value:a,onChange:m=>{o(m.target.value),l&&u(null)},placeholder:"e.g., my-new-plugin",disabled:s,required:!0}),l&&r.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:l}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"This name will be used for the component configuration file."})]}),r.jsxs("div",{className:"mt-6 flex justify-end space-x-3 pt-4 border-t border-gray-200 dark:border-gray-600",children:[r.jsx(dr,{type:"button",onClick:c,disabled:s,variant:"default",children:"Cancel"}),r.jsx(dr,{type:"submit",disabled:s||!a.trim(),variant:"primary",children:s?"Installing...":"Install Plugin"})]})]})]})})},mr=({variant:e="default",className:t,children:n,...i})=>{const s="px-4 py-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 disabled:opacity-50 disabled:pointer-events-none",a="bg-blue-600 hover:bg-blue-700 text-white dark:bg-blue-500 dark:hover:bg-blue-600";let l="bg-gray-200 hover:bg-gray-300 text-gray-800 dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-gray-100";return e==="primary"&&(l=a),r.jsx("button",{...i,className:`${s} ${l} ${t||""}`.trim(),children:n})},pr=({className:e,...t})=>r.jsx("input",{...t,className:`flex h-10 w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-800 disabled:cursor-not-allowed disabled:opacity-50 ${e||""}`}),hr=({className:e,children:t,...n})=>r.jsx("label",{...n,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ${e||""}`,children:t}),Vc=({isOpen:e,onClose:t,onAddRegistry:n,isLoading:i=!1})=>{const[s,a]=k.useState(""),[o,l]=k.useState(""),[u,c]=k.useState(null);if(!e)return null;const d=async h=>{h.preventDefault();const p=s.trim(),w=o.trim();if(!p){c("Registry Path or URL is required.");return}c(null),await n(p,w===""?void 0:w)},m=()=>{a(""),l(""),c(null),t()};return r.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"addRegistryModalTitle",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 dark:bg-black/70 backdrop-blur-sm p-4",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-2xl border border-gray-200 dark:border-gray-700 max-w-md w-full p-6",children:[r.jsxs("div",{className:"flex justify-between items-center pb-3 border-b border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50 -m-6 p-4 rounded-t-lg mb-4",children:[r.jsx("h2",{id:"addRegistryModalTitle",className:"text-lg font-semibold text-gray-800 dark:text-gray-100",children:"Add New Plugin Registry"}),r.jsx("button",{onClick:m,disabled:i,className:"text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 p-1 rounded-full focus-visible:ring-2 focus-visible:ring-blue-500","aria-label":"Close modal",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),r.jsxs("form",{onSubmit:d,className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx(hr,{htmlFor:"registryPathOrUrl",children:"Registry Path or URL:"}),r.jsx(pr,{type:"text",id:"registryPathOrUrl",value:s,onChange:h=>{a(h.target.value),u&&c(null)},placeholder:"https://github.com/user/plugins.git or /path/to/local/plugins",disabled:i,required:!0}),u&&r.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:u}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Enter a Git URL (HTTPS/Git) or an absolute local filesystem path."})]}),r.jsxs("div",{children:[r.jsx(hr,{htmlFor:"registryName",children:"Registry Name (Optional):"}),r.jsx(pr,{type:"text",id:"registryName",value:o,onChange:h=>l(h.target.value),placeholder:"My Custom Plugins",disabled:i}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"An optional name for this registry. If blank, a name will be derived."})]}),r.jsxs("div",{className:"mt-6 flex justify-end space-x-3 pt-4 border-t border-gray-200 dark:border-gray-600",children:[r.jsx(mr,{type:"button",onClick:m,disabled:i,variant:"default",children:"Cancel"}),r.jsx(mr,{type:"submit",disabled:i||!s.trim(),variant:"primary",children:i?"Adding...":"Add Registry"})]})]})]})})},fr=({variant:e="default",className:t,children:n,...i})=>{const s="px-4 py-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 disabled:opacity-50 disabled:pointer-events-none",a="bg-green-600 hover:bg-green-700 text-white dark:bg-green-500 dark:hover:bg-green-600",o="bg-indigo-600 hover:bg-indigo-700 text-white dark:bg-indigo-500 dark:hover:bg-indigo-600";let u="bg-gray-200 hover:bg-gray-300 text-gray-800 dark:bg-gray-700 dark:hover:bg-gray-600 dark:text-gray-100";return e==="primary"?u=a:e==="secondary"&&(u=o),r.jsx("button",{...i,className:`${s} ${u} ${t||""}`,children:n})},Wc=({className:e,...t})=>r.jsx("input",{...t,className:`flex h-10 w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-800 disabled:cursor-not-allowed disabled:opacity-50 ${e||""}`}),Gc=({className:e,children:t,...n})=>r.jsx("select",{...n,className:`flex h-10 rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-800 disabled:cursor-not-allowed disabled:opacity-50 ${e||""}`,children:t}),gr=()=>r.jsx("div",{className:"w-5 h-5 border-2 border-current border-t-transparent rounded-full animate-spin"}),xr=({variant:e,title:t,description:n,className:i})=>r.jsxs("div",{role:"alert",className:`relative w-full rounded-lg border p-4 ${e==="destructive"?"bg-red-50 dark:bg-red-900/30 border-red-500/50 text-red-700 dark:text-red-300":"bg-green-50 dark:bg-green-900/30 border-green-500/50 text-green-700 dark:text-green-300"} ${i||""}`,children:[t&&r.jsx("h5",{className:"mb-1 font-semibold leading-none tracking-tight",children:t}),r.jsx("div",{className:"text-sm opacity-90",children:n})]}),Jc=()=>{const[e,t]=k.useState([]),[n,i]=k.useState([]),[,s]=k.useState([]),[a,o]=k.useState(""),[l,u]=k.useState("all"),[c,d]=k.useState(!0),[m,h]=k.useState(null),[p,w]=k.useState(null),[b,C]=k.useState(null),[g,_]=k.useState(!1),[A,R]=k.useState(null),[L,y]=k.useState(!1),[I,v]=k.useState(!1),N=k.useCallback(async(B=!0)=>{B&&d(!0),h(null);try{const q=await fetch("/api/plugin_catalog/plugins");if(!q.ok)throw new Error(`Failed to fetch plugins: ${q.statusText} (${q.status})`);const X=await q.json();t(X),i(X)}catch(q){const X=q instanceof Error?q.message:String(q);h(X),S("destructive",X)}finally{B&&d(!1)}},[]),z=k.useCallback(async()=>{try{const B=await fetch("/api/plugin_catalog/registries");if(!B.ok)throw new Error("Failed to fetch registries");const q=await B.json();s(q)}catch(B){const q=B instanceof Error?B.message:String(B);console.error("Failed to fetch registries:",q)}},[]);k.useEffect(()=>{N(),z()},[N,z]),k.useEffect(()=>{const B=a.toLowerCase();i(e.filter(q=>{var le;const X=q.pyproject.name.toLowerCase().includes(B)||q.pyproject.description&&q.pyproject.description.toLowerCase().includes(B),f=((le=q.pyproject.plugin_type)==null?void 0:le.toLowerCase())||"custom";return X&&(l==="all"||l==="agents"&&f==="agent"||l==="gateways"&&f==="gateway"||l==="custom"&&f==="custom")}))},[a,l,e]);const S=(B,q)=>{w({type:B,message:q}),setTimeout(()=>w(null),7e3)},F=B=>{C(B),_(!0)},D=B=>{R(B),y(!0)},O=async B=>{if(A){d(!0);try{const q=await fetch("/api/plugin_catalog/plugins/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pluginId:A.id,componentName:B})}),X=await q.json();if(!q.ok||X.status==="failure")throw new Error(X.error||"Installation failed");S("success",X.message||"Plugin installed successfully!")}catch(q){const X=q instanceof Error?q.message:String(q);S("destructive",X)}finally{d(!1),y(!1),R(null)}}},U=async()=>{d(!0),h(null);try{const B=await fetch("/api/plugin_catalog/registries/refresh",{method:"POST"}),q=await B.json();if(!B.ok||q.status!=="success")throw new Error(q.message||"Failed to refresh registries");S("success",q.message),await N(!1)}catch(B){const q=B instanceof Error?B.message:String(B);h(q),S("destructive",q)}finally{d(!1)}},ee=async(B,q)=>{d(!0);try{const X={path_or_url:B};q&&q.trim()!==""&&(X.name=q.trim());const f=await fetch("/api/plugin_catalog/registries",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)}),ne=await f.json();if(!f.ok||ne.status!=="success")throw new Error(ne.error||"Failed to add registry");S("success",ne.message),await z(),await N(!1),v(!1)}catch(X){const f=X instanceof Error?X.message:String(X);S("destructive",f)}finally{d(!1)}};return r.jsx("div",{className:"fixed inset-0 bg-gray-100 dark:bg-gray-900 overflow-auto",children:r.jsxs("div",{className:"p-4 md:p-6 lg:p-8",children:[r.jsx("header",{className:"mb-8",children:r.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-gray-800 dark:text-gray-100",children:"SAM Plugin Catalog"})}),p&&r.jsx(xr,{variant:p.type,description:p.message,className:"mb-6"}),m&&!p&&r.jsx(xr,{variant:"destructive",title:"Error",description:m,className:"mb-6"}),r.jsx("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 shadow-md rounded-lg",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full md:flex-grow",children:[r.jsx(Wc,{type:"text",placeholder:"Search plugins by name or description...",value:a,onChange:B=>o(B.target.value),className:"w-full sm:flex-grow"}),r.jsxs(Gc,{value:l,onChange:B=>u(B.target.value),className:"w-full sm:w-auto sm:min-w-[140px]",children:[r.jsx("option",{value:"all",children:"All Types"}),r.jsx("option",{value:"agents",children:"Agents"}),r.jsx("option",{value:"gateways",children:"Gateways"}),r.jsx("option",{value:"custom",children:"Custom"})]})]}),r.jsxs("div",{className:"flex gap-3 flex-shrink-0",children:[r.jsx(fr,{onClick:()=>v(!0),variant:"primary",children:"+ Add Registry"}),r.jsx(fr,{onClick:U,disabled:c&&e.length===0,variant:"secondary",children:c&&e.length===0?r.jsx(gr,{}):"Refresh All"})]})]})}),c&&e.length===0&&r.jsxs("div",{className:"flex flex-col justify-center items-center mt-12 h-64 text-gray-500 dark:text-gray-400",children:[r.jsx(gr,{}),r.jsx("p",{className:"ml-3 mt-3 text-lg",children:"Loading plugins..."})]}),!c&&e.length>0&&n.length===0&&a&&r.jsx("p",{className:"text-center text-gray-600 dark:text-gray-400 mt-12 text-lg",children:"No plugins found matching your search criteria."}),!c&&e.length===0&&!m&&r.jsx("p",{className:"text-center text-gray-600 dark:text-gray-400 mt-12 text-lg",children:'No plugins found. Try adding a new registry or click "Refresh All".'}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:n.map(B=>r.jsx(fs,{plugin:B,onReadMore:()=>F(B),onInstall:()=>D(B)},B.id))}),g&&b&&r.jsx(Bc,{plugin:b,isOpen:g,onClose:()=>_(!1),onInstall:D}),L&&A&&r.jsx(Hc,{pluginName:A.pyproject.name,isOpen:L,onClose:()=>y(!1),onInstall:O,isLoading:c}),I&&r.jsx(Vc,{isOpen:I,onClose:()=>v(!1),onAddRegistry:ee,isLoading:c})]})})},Yc=({data:e,updateData:t,onNext:n})=>{const i=a=>{t({[a.target.name]:a.target.value})},s=e.gateway_name_input&&e.namespace&&e.gateway_id;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(P,{label:"Gateway Name",htmlFor:"gateway_name_input",required:!0,helpText:"A unique name for your gateway. Will be used for directory and class naming (e.g., my_cool_gateway, MyCoolGateway).",children:r.jsx(G,{id:"gateway_name_input",name:"gateway_name_input",value:e.gateway_name_input||"",onChange:i,placeholder:"e.g., custom-monitor",required:!0})}),r.jsx(P,{label:"A2A Namespace",htmlFor:"namespace",required:!0,helpText:"The namespace this gateway will operate under.",children:r.jsx(G,{id:"namespace",name:"namespace",value:e.namespace||"",onChange:i,placeholder:"e.g., myorg/dev or ${NAMESPACE}",required:!0})}),r.jsx(P,{label:"Gateway ID",htmlFor:"gateway_id",required:!0,helpText:"A unique identifier for this gateway instance.",children:r.jsx(G,{id:"gateway_id",name:"gateway_id",value:e.gateway_id||"",onChange:i,placeholder:"e.g., custom-monitor-gateway-gw-01",required:!0})}),r.jsx("div",{className:"flex justify-end mt-8",children:r.jsx("button",{type:"button",onClick:n,disabled:!s,className:"px-6 py-2 bg-solace-blue text-white rounded-md hover:bg-solace-purple-dark focus:outline-none focus:ring-2 focus:ring-solace-purple focus:ring-opacity-50 disabled:opacity-50",children:"Next"})})]})},Xc=[{value:"use_default_shared_artifact",label:"Use Default Shared Artifact Service"},{value:"memory",label:"Memory"},{value:"filesystem",label:"Filesystem"},{value:"gcs",label:"Google Cloud Storage (GCS)"},{value:"s3",label:"Amazon S3 Compatible"}],$c=[{value:"namespace",label:"Namespace"},{value:"app",label:"Application (Gateway ID specific)"},{value:"custom",label:"Custom (requires specific GDK handling)"}],Qc=({data:e,updateData:t,onNext:n,onPrevious:i})=>{const s=c=>{const{name:d,value:m}=c.target;t({[d]:m}),d==="artifact_service_type"&&(m!=="filesystem"&&t({artifact_service_base_path:void 0}),m!=="s3"&&t({s3_bucket_name:void 0,s3_endpoint_url:void 0,s3_region:void 0}))},a=e.artifact_service_type&&e.artifact_service_type!=="use_default_shared_artifact",o=e.artifact_service_type==="filesystem",l=e.artifact_service_type==="s3";let u=!0;return a&&(e.artifact_service_scope||(u=!1),o&&!e.artifact_service_base_path&&(u=!1),l&&(e.s3_bucket_name||(u=!1),e.s3_region||(u=!1))),r.jsxs("div",{className:"space-y-6",children:[r.jsx(P,{label:"Artifact Service Type",htmlFor:"artifact_service_type",helpText:"Determines how gateway artifacts are stored and managed.",children:r.jsx(se,{id:"artifact_service_type",name:"artifact_service_type",value:e.artifact_service_type||"",onChange:s,options:Xc})}),a&&r.jsxs(r.Fragment,{children:[r.jsx(P,{label:"Artifact Service Scope",htmlFor:"artifact_service_scope",required:a,helpText:"Scope for the custom artifact service.",children:r.jsx(se,{id:"artifact_service_scope",name:"artifact_service_scope",value:e.artifact_service_scope||"",onChange:s,options:$c,required:a})}),o&&r.jsx(P,{label:"Artifact Service Base Path",htmlFor:"artifact_service_base_path",required:o,helpText:"Base directory path if 'Filesystem' type is selected.",children:r.jsx(G,{id:"artifact_service_base_path",name:"artifact_service_base_path",value:e.artifact_service_base_path||"",onChange:s,placeholder:"/tmp/samv2",required:o})}),l&&r.jsxs(r.Fragment,{children:[r.jsx(P,{label:"S3 Bucket Name",htmlFor:"s3_bucket_name",required:l,helpText:"Name of the S3 bucket to store artifacts.",children:r.jsx(G,{id:"s3_bucket_name",name:"s3_bucket_name",value:e.s3_bucket_name||"",onChange:s,placeholder:"my-artifacts-bucket",required:l})}),r.jsx(P,{label:"S3 Endpoint URL",htmlFor:"s3_endpoint_url",helpText:"S3 endpoint URL (leave empty for AWS S3, required for S3-compatible services like MinIO).",children:r.jsx(G,{id:"s3_endpoint_url",name:"s3_endpoint_url",value:e.s3_endpoint_url||"",onChange:s,placeholder:"https://s3.amazonaws.com or https://minio.example.com"})}),r.jsx(P,{label:"S3 Region",htmlFor:"s3_region",required:l,helpText:"AWS region or S3-compatible service region.",children:r.jsx(G,{id:"s3_region",name:"s3_region",value:e.s3_region||"",onChange:s,placeholder:"us-east-1",required:l})})]})]}),r.jsxs("div",{className:"flex justify-between mt-8",children:[r.jsx("button",{type:"button",onClick:i,className:"px-6 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-opacity-50",children:"Previous"}),r.jsx("button",{type:"button",onClick:n,disabled:!u,className:"px-6 py-2 bg-solace-blue text-white rounded-md hover:bg-solace-purple-dark focus:outline-none focus:ring-2 focus:ring-solace-purple focus:ring-opacity-50 disabled:opacity-50",children:"Next"})]})]})},Zc=({data:e,updateData:t,onNext:n,onPrevious:i})=>{const s=a=>{t({[a.target.name]:a.target.value})};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(P,{label:"System Purpose",htmlFor:"system_purpose",helpText:"Define the overall purpose and persona of the gateway.",children:r.jsx("textarea",{id:"system_purpose",name:"system_purpose",value:e.system_purpose||"",onChange:s,rows:6,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm",placeholder:"e.g., The system is an AI Chatbot..."})}),r.jsx(P,{label:"Response Format",htmlFor:"response_format",helpText:"Define how the gateway should format its responses.",children:r.jsx("textarea",{id:"response_format",name:"response_format",value:e.response_format||"",onChange:s,rows:4,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm",placeholder:"e.g., Responses should be clear, concise..."})}),r.jsxs("div",{className:"flex justify-between mt-8",children:[r.jsx("button",{type:"button",onClick:i,className:"px-6 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-opacity-50",children:"Previous"}),r.jsx("button",{type:"button",onClick:n,disabled:!1,className:"px-6 py-2 bg-solace-blue text-white rounded-md hover:bg-solace-purple-dark focus:outline-none focus:ring-2 focus:ring-solace-purple focus:ring-opacity-50 disabled:opacity-50",children:"Next"})]})]})},Kc=({data:e,onPrevious:t,onSubmit:n,isLoading:i})=>r.jsxs("div",{className:"space-y-6",children:[r.jsx("h3",{className:"text-xl font-semibold text-gray-700 mb-4",children:"Review Gateway Configuration"}),r.jsx("div",{className:"bg-white shadow-sm rounded-lg p-6 border border-gray-200",children:r.jsxs("dl",{className:"divide-y divide-gray-200",children:[r.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Gateway Name"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.gateway_name_input||"-"})]}),r.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"A2A Namespace"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.namespace||"-"})]}),r.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Gateway ID"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.gateway_id||"-"})]}),r.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Artifact Service Type"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.artifact_service_type||"-"})]}),e.artifact_service_type&&e.artifact_service_type!=="use_default_shared_artifact"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Artifact Service Scope"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.artifact_service_scope||"-"})]}),e.artifact_service_type==="filesystem"&&r.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Artifact Service Base Path"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.artifact_service_base_path||"-"})]})]}),r.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"System Purpose"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:r.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:e.system_purpose||"-"})})]}),r.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[r.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Response Format"}),r.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:r.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:e.response_format||"-"})})]})]})}),r.jsxs("div",{className:"flex justify-between mt-8",children:[r.jsx("button",{type:"button",onClick:t,disabled:i,className:"px-6 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-opacity-50 disabled:opacity-50",children:"Previous"}),r.jsx("button",{type:"button",onClick:n,disabled:i,className:"px-6 py-2 bg-solace-green text-white rounded-md hover:bg-solace-green-dark focus:outline-none focus:ring-2 focus:ring-solace-green focus:ring-opacity-50 disabled:opacity-50",children:i?"Creating Gateway...":"Create Gateway"})]})]}),Xe=[{id:"basicInfo",title:"Basic Information",description:"Enter the core details for your new gateway.",component:Yc},{id:"artifactConfig",title:"Artifact Service",description:"Configure how artifacts are stored and managed.",component:Qc},{id:"responseCustomization",title:"Response Customization",description:"Define the gateway's system purpose and response format.",component:Zc},{id:"review",title:"Review & Create",description:"Review your gateway configuration before creation.",component:Kc}],eu=()=>{var C;const[e,t]=k.useState(0),[n,i]=k.useState({}),[s,a]=k.useState(!0),[o,l]=k.useState(null),[u,c]=k.useState(!1),d="http://localhost:5002";k.useEffect(()=>{a(!0),fetch(`${d}/api/form_schema?type=gateway`).then(g=>{if(!g.ok)throw new Error(`HTTP error! status: ${g.status}`);return g.json()}).then(g=>{if(g.status==="success"&&g.defaults)i({...g.defaults,gateway_name_input:g.defaults.gateway_name_input||""}),l(null);else throw new Error(g.message||"Failed to load gateway defaults.")}).catch(g=>{console.error("Error fetching gateway schema:",g),l(g.message||"Could not fetch gateway configuration defaults."),i({})}).finally(()=>a(!1))},[d]);const m=k.useCallback(g=>{i(_=>({..._,...g}))},[]),h=k.useCallback(()=>{e<Xe.length-1?t(g=>g+1):w()},[e,Xe.length]),p=k.useCallback(()=>{e>0&&t(g=>g-1)},[e]),w=async()=>{a(!0),l(null);try{const g=await fetch(`${d}/api/save_gateway_config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gateway_name_input:n.gateway_name_input||n.name||"DefaultGatewayName",config:n})}),_=await g.json();if(g.ok&&_.status==="success")c(!0),setTimeout(()=>{fetch(`${d}/api/shutdown`,{method:"POST"}).catch(A=>console.error("Error shutting down server:",A))},3e3);else throw new Error(_.message||"Failed to save gateway configuration.")}catch(g){console.error("Error submitting gateway config:",g),g instanceof Error?l(g.message):l("An unexpected error occurred during submission.")}finally{a(!1)}};if(u)return r.jsx(tn,{title:"Gateway Created!",message:"Your new gateway configuration has been saved. The CLI will now generate the necessary files."});if(s&&!Object.keys(n).length)return r.jsx("div",{className:"text-center p-8",children:"Loading gateway configuration..."});if(o)return r.jsxs("div",{className:"text-center p-8 text-red-600",children:["Error: ",o]});const b=(C=Xe[e])==null?void 0:C.component;return r.jsxs("div",{className:"p-4",children:[r.jsx("h2",{className:"text-2xl font-semibold mb-6 text-center text-gray-700",children:"Add New Gateway"}),r.jsx(en,{steps:Xe,currentStepIndex:e}),r.jsx("div",{className:"mt-6 bg-gray-50 p-6 rounded-lg shadow min-h-[300px]",children:b?r.jsx(b,{data:n,updateData:m,onNext:h,onPrevious:p,onSubmit:w,isLoading:s&&e===Xe.length-1}):r.jsx("p",{className:"text-center",children:"End of flow or step not found."})}),o&&r.jsx("p",{className:"mt-4 text-sm text-red-500 text-center",children:o})]})},ru=()=>[{title:"Solace Agent Mesh - Config Portal"},{name:"description",content:"Initialize your Solace Agent Mesh project or add new components."}];function iu(){const[e,t]=k.useState("initialize"),[n]=di();return k.useEffect(()=>{const i=n.get("config_mode");t(i==="addAgent"?"addAgent":i==="pluginCatalog"?"pluginCatalog":i==="addGateway"?"addGateway":"initialize")},[n]),r.jsx("div",{className:"min-h-screen bg-gray-100 py-8 px-4",children:r.jsxs("div",{className:"max-w-5xl mx-auto",children:[r.jsx("div",{className:"mb-8 text-center",children:r.jsx("h1",{className:"text-3xl font-bold text-solace-purple",children:"Solace Agent Mesh Configuration Portal"})}),r.jsxs("div",{className:"bg-white shadow-xl rounded-lg p-6 md:p-8 min-h-[500px]",children:[e==="initialize"&&r.jsx(Ri,{}),e==="addAgent"&&r.jsx(Qi,{}),e==="pluginCatalog"&&r.jsx(Jc,{}),e==="addGateway"&&r.jsx(eu,{})]}),r.jsx("footer",{className:"mt-12 text-center text-sm text-gray-500",children:r.jsxs("p",{children:["© ",new Date().getFullYear()," Solace Agent Mesh. All rights reserved."]})})]})})}export{iu as default,ru as meta};
