import{j as r,r as j,t as yr,v as di}from"./index-CnFykb2v.js";function Kt({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,a)=>{const s=a===t,o=a<t;return r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx("button",{onClick:()=>n==null?void 0:n(a),disabled:!n,className:`
                  w-10 h-10 rounded-full flex items-center justify-center
                  font-bold transition-colors duration-300
                  ${s?"bg-solace-green text-white":""}
                  ${o?"bg-solace-dark-green text-white":""}
                  ${!s&&!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"})}):a+1}),r.jsx("span",{className:`
                  mt-2 text-xs font-medium text-center
                  ${s?"text-solace-green":""}
                  ${o?"text-solace-dark-green":""}
                  ${!s&&!o?"text-gray-500":""}
                `,children:i.title})]},i.id)})})]})}function Y({children:e,onClick:t,disabled:n=!1,variant:i="primary",type:a="button",className:s=""}){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:a,className:`${o} ${l[i]} ${s}`,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:a=>a.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(a=>r.jsxs("li",{className:"flex items-center",children:[r.jsx(br,{}),a]},a))})})]})};function hi({data:e,updateData:t,onNext:n}){const{setupPath:i}=e,[a,s]=j.useState(i??null),o=u=>{s(u),t({setupPath:u})},l=()=>{a&&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:a===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:!a,children:"Continue"})})]})}function M({label:e,htmlFor:t,helpText:n,error:i,required:a=!1,children:s}){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,a&&r.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),r.jsx("div",{className:"mt-1",children:s}),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 H({id:e,name:t,value:n,onChange:i,placeholder:a="",required:s=!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:a,required:s,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 ue({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:a}=e,s=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(ue,{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(M,{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(H,{id:"namespace",name:"namespace",value:a||"",onChange:s,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:!(a!=null&&a.trim()),children:"Next"})]})]})}function oe({id:e,options:t,value:n,onChange:i,name:a,required:s=!1,disabled:o=!1,className:l=""}){return r.jsxs("div",{className:"relative",children:[r.jsx("select",{id:e,name:a||e,value:n,onChange:i,required:s,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 broker container"},{value:"dev_mode",label:"Dev mode (simplified setup)"}],yi=[{value:"podman",label:"Podman"},{value:"docker",label:"Docker"}],hn=({message:e})=>{const t=/(https?:\/\/[^\s]+)/g,n=e.split(t);return r.jsx("span",{children:n.map((i,a)=>i.match(t)?r.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 underline",children:i},a):i)})};function bi({data:e,updateData:t,onNext:n,onPrevious:i}){const{broker_type:a,broker_url:s,broker_vpn:o,broker_username:l,broker_password:u,container_engine:c,container_started:d}=e,[m,h]=j.useState({}),[p,k]=j.useState(!1),[v,N]=j.useState({isRunning:!1,success:d===!0,message:d?"Container already started successfully":""});j.useEffect(()=>{!c&&a==="container"&&t({container_engine:"podman"}),c&&a!=="container"&&t({container_engine:""}),a!=="dev_mode"?t({dev_mode:!1}):a==="dev_mode"&&t({dev_mode:!0})},[a,c,t]);const f=z=>{t({[z.target.name]:z.target.value})},y=()=>{const z={};let U=!0;return a==="solace"&&(s||(z.broker_url="Broker URL is required",U=!1),o||(z.broker_vpn="VPN name is required",U=!1),l||(z.broker_username="Username is required",U=!1)),a==="container"&&!v.success&&(z.container="You must successfully run the container before proceeding",U=!1),h(z),U},w=async()=>{k(!0),N({isRunning:!0,success:!1,message:"Starting container..."});try{const U=await(await fetch("api/runcontainer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({container_engine:c})})).json();if(U.status==="success")N({isRunning:!1,success:!0,message:U.message??"Container started successfully!"}),t({container_engine:c,container_started:!0});else{const A=U.message??"Failed to start container. Please try again.";N({isRunning:!1,success:!1,message:r.jsx(hn,{message:A})}),t({container_started:!1})}}catch(z){const U=z instanceof Error?z.message:"An unexpected error occurred";N({isRunning:!1,success:!1,message:r.jsx(hn,{message:U})}),t({container_started:!1})}finally{k(!1)}},L=z=>{z.preventDefault(),y()&&(a==="container"&&(e.broker_url="ws://localhost:8008",e.broker_vpn="default",e.broker_username="default",e.broker_password="default"),n())},O=a==="solace",b=a==="container",P=()=>v.isRunning?"loading":v.success?"success":"error",q=()=>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..."]}):v.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:L,children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(M,{label:"Broker Type",htmlFor:"broker_type",required:!0,children:r.jsx(oe,{id:"broker_type",name:"broker_type",options:xi,value:a||"",onChange:f,disabled:v.success&&e.broker_type==="container"})}),O&&r.jsxs("div",{className:"space-y-4 p-4 border border-gray-200 rounded-md",children:[r.jsx(ue,{className:"mb-4",children:"Connect to an existing Solace broker running locally or in the cloud. You will need your broker credentials."}),r.jsx(M,{label:"Broker URL",htmlFor:"broker_url",error:m.broker_url,required:!0,children:r.jsx(H,{id:"broker_url",name:"broker_url",value:s||"",onChange:f,placeholder:"ws://localhost:8008"})}),r.jsx(M,{label:"VPN Name",htmlFor:"broker_vpn",error:m.broker_vpn,required:!0,children:r.jsx(H,{id:"broker_vpn",name:"broker_vpn",value:o||"",onChange:f,placeholder:"default"})}),r.jsx(M,{label:"Username",htmlFor:"broker_username",error:m.broker_username,required:!0,children:r.jsx(H,{id:"broker_username",name:"broker_username",value:l||"",onChange:f,placeholder:"default"})}),r.jsx(M,{label:"Password",htmlFor:"broker_password",error:m.broker_password,children:r.jsx(H,{id:"broker_password",name:"broker_password",type:"password",value:u||"",onChange:f,placeholder:"Enter password"})})]}),b&&r.jsxs("div",{className:"space-y-4 p-4 border border-gray-200 rounded-md",children:[r.jsx(ue,{className:"mb-4",children:"This option will download and run a local Solace broker container on your machine using Docker or Podman. You need to have Docker or Podman installed on your system."}),r.jsx(M,{label:"Container Engine",htmlFor:"container_engine",helpText:"Select the container engine installed on your system",required:!0,children:r.jsx(oe,{id:"container_engine",name:"container_engine",options:yi,value:c??"",onChange:f,disabled:v.isRunning||v.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}),v.message&&r.jsx(fi,{variant:P(),children:v.message}),r.jsx("div",{className:"relative",children:r.jsxs("div",{className:"flex flex-col",children:[r.jsx(Y,{onClick:w,disabled:p||v.success,variant:"primary",type:"button",className:"flex items-center justify-center gap-2",children:q()}),v.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."]}),!v.success&&!p&&!v.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"]})]})})]}),a==="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||a==="container"&&!v.success,variant:a==="container"&&!v.success?"secondary":"primary",children:[a==="container"&&!v.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"]}),!(a==="container"&&!v.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:a="",required:s=!1,disabled:o=!1,className:l="",suggestions:u,onFocus:c,fetchSuggestions:d,showLoadingIndicator:m=!1}){const[h,p]=j.useState(!1),[k,v]=j.useState([]),[N,f]=j.useState(!1),y=j.useRef(null),w=j.useRef(null);j.useEffect(()=>{if(u&&u.length>0){const P=u.filter(q=>q!=null).filter(q=>q.toLowerCase().includes((n||"").toLowerCase()));v(P)}else v([])},[n,u]),j.useEffect(()=>{const P=q=>{y.current&&!y.current.contains(q.target)&&w.current&&!w.current.contains(q.target)&&p(!1)};return document.addEventListener("mousedown",P),()=>{document.removeEventListener("mousedown",P)}},[]);const L=async()=>{if(c&&c(),d)try{f(!0);const P=await d();P&&P.length>0&&v(P)}catch(P){console.error("Error fetching suggestions:",P)}finally{f(!1)}},O=()=>{p(!0)},b=P=>{var z;i({target:{name:t||e,value:P}}),p(!1),(z=y.current)==null||z.focus()};return r.jsxs("div",{className:"relative w-full",children:[r.jsx("input",{ref:y,id:e,name:t||e,type:"text",value:n||"",onChange:i,onFocus:L,onClick:O,placeholder:a,required:s,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"}),N&&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&&k.length>0&&r.jsx("div",{ref:w,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:k.map((P,q)=>r.jsx("li",{onClick:()=>b(P),onKeyDown:z=>z.key==="Enter"&&b(P),className:"px-3 py-2 cursor-pointer hover:bg-stone-300",tabIndex:0,children:P},q))})})]})}const fn={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:["gpt-5","gpt-5-mini","gpt-5-nano","gpt-4.1","gpt-4.1-mini","gpt-4.1-nano","o4-mini","o3"],anthropic:["claude-sonnet-4-5-20250929","claude-opus-4-5-20251101","claude-haiku-4-5-20251001","claude-sonnet-4-20250514","claude-opus-4-20250514","claude-3-7-sonnet-20250219","claude-3-5-haiku-20241022"],google:["gemini-3-pro-preview","gemini-3-flash-preview","gemini-2.5-pro","gemini-2.5-flash","gemini-2.5-flash-lite"],bedrock:["amazon.nova-premier-v1:0","amazon.nova-pro-v1:0","amazon.nova-lite-v1:0","amazon.nova-micro-v1:0","amazon.nova-2-lite-v1:0","amazon.nova-2-sonic-v1:0","anthropic.claude-sonnet-4-5-20250929-v1:0","anthropic.claude-opus-4-5-20251101-v1:0","anthropic.claude-haiku-4-5-20251001-v1:0","anthropic.claude-sonnet-4-20250514-v1:0","anthropic.claude-opus-4-1-20250805-v1:0","anthropic.claude-3-5-haiku-20241022-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 a=await i.json();return a.data&&Array.isArray(a.data)?a.data.filter(s=>s.id).map(s=>s.id):a.models&&Array.isArray(a.models)?a.models.filter(s=>s.id??s.name).map(s=>s.id??s.name):Array.isArray(a)?a.filter(s=>s.id??s.name).map(s=>s.id??s.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:a,llm_endpoint_url:s,llm_api_key:o,llm_model_name:l}=e,[u,c]=j.useState({}),[d,m]=j.useState(!1),[h,p]=j.useState(null),[k,v]=j.useState(!1),[N,f]=j.useState([]),[y,w]=j.useState(!1),[L,O]=j.useState(null);j.useEffect(()=>{const A={};a||(A.llm_provider="openai"),Object.keys(A).length>0&&t(A)},[e,t]),j.useEffect(()=>{if(a){const A={};if(L!==null&&L!==a){if(A.llm_model_name="",a!=="openai_compatible"){const _=fn[a]||"";A.llm_endpoint_url=_}else A.llm_endpoint_url="";Object.keys(A).length>0&&t(A)}O(a)}},[a,L,t]),j.useEffect(()=>{f(a&&a!=="openai_compatible"?wi[a]||[]:[])},[a]);const b=A=>{t({[A.target.name]:A.target.value})},P=j.useCallback(async()=>{if(a==="openai_compatible"&&s&&o){w(!0);try{const A=await ki(s,o);f(A)}catch(A){console.error("Error fetching models:",A)}finally{w(!1)}}return[]},[a,s,o]),q=()=>{const A={};let _=!0;return a||(A.llm_provider="LLM provider is required",_=!1),a==="openai_compatible"&&!s&&(A.llm_endpoint_url="LLM endpoint is required for OpenAI compatible endpoint}",_=!1),l||(A.llm_model_name="LLM model name is required",_=!1),o||(A.llm_api_key="LLM API key is required",_=!1),c(A),_},z=async()=>{m(!0),p(null);try{const A=a!=="openai_compatible"&&fn[a]||s,_=jr(l||"",a||""),T=await(await fetch("/api/test_llm_config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:_,api_key:o,base_url:A})})).json();T.status==="success"?(m(!1),n()):(p(T.message??"Failed to test LLM configuration"),v(!0),m(!1))}catch(A){p(A instanceof Error?`Error: ${A.message}`:"An unexpected error occurred while testing the LLM configuration"),v(!0),m(!1)}},U=A=>{A.preventDefault(),q()&&z()};return r.jsxs("form",{onSubmit:U,children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(ue,{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(M,{label:"LLM Provider",htmlFor:"llm_provider",error:u.llm_provider,required:!0,children:r.jsx(oe,{id:"llm_provider",name:"llm_provider",value:a||"",onChange:b,options:vi})}),(a==="openai_compatible"||a==="azure")&&r.jsx(M,{label:"LLM Endpoint URL",htmlFor:"llm_endpoint_url",error:u.llm_endpoint_url,required:!0,children:r.jsx(H,{id:"llm_endpoint_url",name:"llm_endpoint_url",value:s||"",onChange:b,placeholder:"https://api.example.com/v1"})}),r.jsx(M,{label:"LLM API Key",htmlFor:"llm_api_key",error:u.llm_api_key,required:!0,children:r.jsx(H,{id:"llm_api_key",name:"llm_api_key",type:"password",value:o||"",onChange:b,placeholder:"Enter your API key"})}),a==="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(M,{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:b,placeholder:"Select or type a model name",suggestions:N,onFocus:a==="openai_compatible"?P:void 0,showLoadingIndicator:y})})]})]}),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..."})]})}),k&&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:()=>{v(!1),n()},onCancel:()=>{v(!1)}})]})}const Ae=({id:e,label:t,values:n,onChange:i,placeholder:a,helpText:s,error:o,required:l,inputButtonText:u="Add",inputPlaceholder:c="Type and press Add..."})=>{const[d,m]=j.useState(""),h=N=>{m(N.target.value)},p=()=>{if(d.trim()!==""){if(n.includes(d.trim())){m("");return}i([...n,d.trim()]),m("")}},k=N=>{i(n.filter(f=>f!==N))},v=N=>{N.key==="Enter"&&(N.preventDefault(),p())};return r.jsxs(M,{label:t,htmlFor:e,helpText:s,error:o,required:l,children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[r.jsx(H,{id:e,name:e,value:d,onChange:h,onKeyDown:v,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((N,f)=>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:N}),r.jsx("button",{type:"button",onClick:()=>k(N),className:"ml-2 text-gray-500 hover:text-gray-700 focus:outline-none","aria-label":`Remove ${N}`,children:"×"})]},f))}),n.length===0&&a&&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:a})})]})};function ye({id:e,checked:t,onChange:n,label:i,disabled:a=!1,className:s=""}){const o=l=>{n(l.target.checked)};return r.jsxs("div",{className:`flex items-center ${s}`,children:[r.jsx("input",{id:e,type:"checkbox",checked:t,onChange:o,disabled:a,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 artifacts in memory (temporary)"},{value:"filesystem",label:"Filesystem: Store artifacts on disk"},{value:"gcs",label:"GCS: Store artifacts in Google Cloud Storage"}],Si=[{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"}],Ni=[{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 Ci({data:e,updateData:t,onNext:n,onPrevious:i}){const[a,s]=j.useState({}),[o,l]=j.useState(!1),u=(I,ne)=>{if(I==null)return ne;if(Array.isArray(I))return I.map(ae=>String(ae).trim()).filter(ae=>ae.length>0);const we=String(I).trim();return we===""?[]:we.split(",").map(ae=>ae.trim()).filter(ae=>ae.length>0)},c=e,[d,m]=j.useState(c.agent_name||"OrchestratorAgent"),[h,p]=j.useState(c.supports_streaming!==!1),[k,v]=j.useState(c.session_service_type||"sql"),[N,f]=j.useState(c.orchestrator_database_url||""),[y,w]=j.useState(c.session_service_behavior||"PERSISTENT"),[L,O]=j.useState(c.artifact_service_type||"filesystem"),[b,P]=j.useState(c.artifact_service_base_path||"/tmp/samv2"),[q,z]=j.useState(c.artifact_service_scope||"namespace"),[U,A]=j.useState(c.artifact_handling_mode||"reference"),[_,C]=j.useState(c.enable_embed_resolution!==!1),[T,B]=j.useState(c.enable_artifact_content_instruction!==!1),[K,F]=j.useState(c.agent_card_description||"The Orchestrator component. It manages tasks, and coordinating multi-agent workflows."),[D,J]=j.useState(u(c.agent_card_default_input_modes,["text"])),[g,X]=j.useState(u(c.agent_card_default_output_modes,["text","file"])),[te,x]=j.useState(c.agent_discovery_enabled!==!1),[se,be]=j.useState(c.agent_card_publishing_interval||10),[ie,Ee]=j.useState(u(c.inter_agent_communication_allow_list,["*"])),[_e,Ne]=j.useState(u(c.inter_agent_communication_deny_list,[])),[ve,Pe]=j.useState(c.inter_agent_communication_timeout||180);j.useEffect(()=>{o||(c.agent_name&&m(c.agent_name),c.supports_streaming!==void 0&&p(c.supports_streaming),c.session_service_type&&v(c.session_service_type),c.session_service_behavior&&w(c.session_service_behavior),c.artifact_service_type&&O(c.artifact_service_type),c.artifact_service_base_path&&P(c.artifact_service_base_path),c.artifact_service_scope&&z(c.artifact_service_scope),c.artifact_handling_mode&&A(c.artifact_handling_mode),c.enable_embed_resolution!==void 0&&C(c.enable_embed_resolution),c.enable_artifact_content_instruction!==void 0&&B(c.enable_artifact_content_instruction),c.agent_card_description&&F(c.agent_card_description),c.agent_card_default_input_modes!==void 0&&J(u(c.agent_card_default_input_modes,["text"])),c.agent_card_default_output_modes!==void 0&&X(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&&be(c.agent_card_publishing_interval),c.inter_agent_communication_allow_list!==void 0&&Ee(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&&Pe(c.inter_agent_communication_timeout),l(!0))},[e,o]);const xt=I=>{m(I.target.value),t({agent_name:I.target.value})},yt=I=>{p(I),t({supports_streaming:I})},bt=I=>{O(I.target.value),t({artifact_service_type:I.target.value})},tt=I=>{P(I.target.value),t({artifact_service_base_path:I.target.value})},nt=I=>{z(I.target.value),t({artifact_service_scope:I.target.value})},rt=I=>{A(I.target.value),t({artifact_handling_mode:I.target.value})},_t=I=>{C(I),t({enable_embed_resolution:I})},it=I=>{B(I),t({enable_artifact_content_instruction:I})},at=I=>{F(I.target.value),t({agent_card_description:I.target.value})},vt=I=>{J(I),t({agent_card_default_input_modes:I})},wt=I=>{X(I),t({agent_card_default_output_modes:I})},kt=I=>{x(I),t({agent_discovery_enabled:I})},jt=I=>{be(Number(I.target.value)),t({agent_card_publishing_interval:Number(I.target.value)})},St=I=>{Ee(I),t({inter_agent_communication_allow_list:I})},S=I=>{Ne(I),t({inter_agent_communication_deny_list:I})},R=I=>{Pe(Number(I.target.value)),t({inter_agent_communication_timeout:Number(I.target.value)})},W=()=>{const I={};let ne=!0;return d?/^[a-zA-Z0-9_]+$/.test(d)||(I.agentName="Agent name can only contain letters, numbers, and underscores.",ne=!1):(I.agentName="Agent name is required",ne=!1),L==="filesystem"&&!b&&(I.artifactBasePath="Artifact base path is required for filesystem service",ne=!1),(!se||se<=0)&&(I.cardPublishingInterval="Publishing interval must be a positive number",ne=!1),(!ve||ve<=0)&&(I.communicationTimeout="Communication timeout must be a positive number",ne=!1),s(I),ne},G=I=>{I.preventDefault(),W()&&n()};return r.jsxs("form",{onSubmit:G,children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(ue,{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(M,{label:"Agent Name",htmlFor:"agent_name",error:a.agentName,required:!0,helpText:"The name can only contain letters, numbers, and underscores.",children:r.jsx(H,{id:"agent_name",value:d,onChange:xt,placeholder:"OrchestratorAgent",required:!0})}),r.jsx(M,{label:"Supports Streaming",htmlFor:"supports_streaming",helpText:"Enable streaming support for the agent",children:r.jsx(ye,{id:"supports_streaming",checked:h,onChange:yt,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:"Artifact Service"})}),r.jsx(M,{label:"Artifact Service Type",htmlFor:"artifact_service_type",required:!0,children:r.jsx(oe,{id:"artifact_service_type",options:ji,value:L,onChange:bt})}),L==="filesystem"&&r.jsx(M,{label:"Artifact Base Path",htmlFor:"artifact_base_path",error:a.artifactBasePath,required:!0,children:r.jsx(H,{id:"artifact_base_path",value:b,onChange:tt,placeholder:"/tmp/samv2"})}),r.jsx(M,{label:"Artifact Scope",htmlFor:"artifact_scope",required:!0,children:r.jsx(oe,{id:"artifact_scope",options:Si,value:q,onChange:nt})}),r.jsx(M,{label:"Artifact Handling Mode",htmlFor:"artifact_handling_mode",required:!0,children:r.jsx(oe,{id:"artifact_handling_mode",options:Ni,value:U,onChange:rt})}),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(M,{label:"Enable Embed Resolution",htmlFor:"enable_embed_resolution",children:r.jsx(ye,{id:"enable_embed_resolution",checked:_,onChange:_t,label:"Enable embed resolution"})}),r.jsx(M,{label:"Enable Artifact Content Instruction",htmlFor:"enable_artifact_content_instruction",children:r.jsx(ye,{id:"enable_artifact_content_instruction",checked:T,onChange:it,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(M,{label:"Agent Card Description",htmlFor:"agent_card_description",required:!0,children:r.jsx(H,{id:"agent_card_description",value:K,onChange:at,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:D,onChange:vt,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:g,onChange:wt,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(M,{label:"Enable Agent Discovery",htmlFor:"agent_discovery_enabled",children:r.jsx(ye,{id:"agent_discovery_enabled",checked:te,onChange:kt,label:"Enable agent discovery"})}),r.jsx(M,{label:"Card Publishing Interval",htmlFor:"card_publishing_interval",error:a.cardPublishingInterval,helpText:"Interval in seconds for publishing agent card",required:!0,children:r.jsx(H,{id:"card_publishing_interval",type:"number",value:se.toString(),onChange:jt,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:ie,onChange:St,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:_e,onChange:S,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(M,{label:"Communication Timeout",htmlFor:"communication_timeout",error:a.communicationTimeout,helpText:"Timeout in seconds for inter-agent communication",required:!0,children:r.jsx(H,{id:"communication_timeout",type:"number",value:ve.toString(),onChange:R,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 Ai({data:e,updateData:t,onNext:n,onPrevious:i}){const[a,s]=j.useState({}),o=e;j.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_logo_url:o.webui_frontend_logo_url??"",webui_frontend_collect_feedback:o.webui_frontend_collect_feedback??!1,platform_api_host:o.platform_api_host??"127.0.0.1",platform_api_port:o.platform_api_port??8001},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:k}=m.target;t(k==="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),o.platform_api_host||(m.platform_api_host="Platform API Host is required.",h=!1),o.platform_api_port===void 0?(m.platform_api_port="Platform API Port is required.",h=!1):(isNaN(Number(o.platform_api_port))||Number(o.platform_api_port)<=0||Number(o.platform_api_port)>65535)&&(m.platform_api_port="Platform API Port must be between 1 and 65535.",h=!1)),s(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(ue,{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(M,{label:"",htmlFor:"add_webui_gateway",children:r.jsx(ye,{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(M,{label:"Session Secret Key",htmlFor:"webui_session_secret_key",error:a.webui_session_secret_key,required:!0,children:r.jsx(H,{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(M,{label:"FastAPI Host",htmlFor:"webui_fastapi_host",error:a.webui_fastapi_host,required:!0,children:r.jsx(H,{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(M,{label:"FastAPI Port",htmlFor:"webui_fastapi_port",error:a.webui_fastapi_port,required:!0,children:r.jsx(H,{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(M,{label:"",htmlFor:"webui_enable_embed_resolution",children:r.jsx(ye,{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(M,{label:"Frontend Welcome Message",htmlFor:"webui_frontend_welcome_message",error:a.webui_frontend_welcome_message,children:r.jsx(H,{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(M,{label:"Frontend Bot Name",htmlFor:"webui_frontend_bot_name",error:a.webui_frontend_bot_name,children:r.jsx(H,{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(M,{label:"Frontend Logo URL",htmlFor:"webui_frontend_logo_url",error:a.webui_frontend_logo_url,helpText:"URL to a custom logo image (PNG, SVG, JPG) or a data URI",children:r.jsx(H,{id:"webui_frontend_logo_url",name:"webui_frontend_logo_url",value:o.webui_frontend_logo_url||"",onChange:l,placeholder:"https://example.com/logo.png or data:image/svg+xml;base64,..."})}),r.jsx(M,{label:"",htmlFor:"webui_frontend_collect_feedback",children:r.jsx(ye,{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.jsx("h4",{className:"text-sm font-medium text-gray-700 mt-4 mb-2",children:"Platform Service Configuration"}),r.jsx(ue,{className:"mb-3",children:"Configure the Platform Service used for the management of agents, connectors, deployments, and more."}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(M,{label:"Platform API Host",htmlFor:"platform_api_host",error:a.platform_api_host,required:!0,children:r.jsx(H,{id:"platform_api_host",name:"platform_api_host",value:o.platform_api_host||"127.0.0.1",onChange:l,placeholder:"127.0.0.1"})}),r.jsx(M,{label:"Platform API Port",htmlFor:"platform_api_port",error:a.platform_api_port,required:!0,children:r.jsx(H,{id:"platform_api_port",name:"platform_api_port",type:"number",value:o.platform_api_port===void 0?"":String(o.platform_api_port),onChange:l,placeholder:"8001"})})]})]})]}),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 Ei=["llm","ai","api","url","vpn"],Ii=["broker_password","llm_api_key","webui_session_secret_key"],gn={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 & Platform Service":["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","platform_api_host","platform_api_port"]};function Nr({data:e,updateData:t,onPrevious:n}){const[i,a]=j.useState(!1),[s,o]=j.useState(null),l=f=>f===void 0||f===""||Array.isArray(f)&&f.length===0,u=f=>f.split("_").map(y=>Ei.includes(y.toLowerCase())?y.toUpperCase():y.charAt(0).toUpperCase()+y.slice(1)).join(" "),c=(f,y)=>Ii.includes(f)||f.toUpperCase().includes("API_KEY")?y?"••••••••":"Not provided":typeof y=="boolean"?y?"Yes":"No":Array.isArray(y)?y.join(", "):y?String(y):"Not provided",d=f=>{switch(f){case"solace":return"Existing Solace Pub/Sub+ broker";case"container":return"New local Solace broker container (podman/docker)";case"dev_mode":return"Run in 'dev mode' - all in one process (not recommended for production)";default:return f}},m=()=>{const f=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(f)})]}),f==="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"})]})}),(f==="solace"||f==="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=(f,y)=>y.some(L=>!l(e[L]))?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:f}),r.jsx("div",{className:"space-y-3",children:y.map(L=>l(e[L])?null:L==="dev_mode"?r.jsx("div",{children:m()},L):r.jsxs("div",{className:"flex mb-1",children:[r.jsxs("span",{className:"text-gray-600",children:[u(L),":"]}),r.jsx("span",{className:"font-medium text-gray-900 ml-2",children:c(L,e[L])})]},L))})]},f):null,p=f=>{const y={...f};return y.namespace&&!String(y.namespace).endsWith("/")&&(y.namespace+="/"),y.container_started&&delete y.container_started,y.llm_provider&&(y.llm_provider=kr[y.llm_provider]),y.llm_model_name&&y.llm_provider&&(y.llm_model_name=jr(String(y.llm_model_name),String(y.llm_provider)),delete y.llm_provider),e.broker_type==="container"&&(e.broker_type="solace"),y},k=async(f=!0)=>{const y=p(e);console.log("Submitting configuration:",y);try{const w=await fetch("api/save_config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f?{...y,force:!0}:y)}),L=await w.json();if(!w.ok)throw new Error(`HTTP error ${w.status}: ${L.message??"Unknown error"}`);if(L.status==="success"){console.log("Configuration sent successfully!"),t({showSuccess:!0});try{const O=await fetch("api/shutdown",{method:"POST"});O.ok?console.log("Shutdown request sent successfully"):console.warn("Shutdown request failed:",O.status)}catch(O){console.error("Error sending shutdown request:",O)}}else throw new Error(L.message??"Failed to save configuration")}catch(w){o(w instanceof Error?w.message:"An unknown error occurred"),console.error("Error saving configuration:",w)}finally{a(!1)}},v=async()=>{a(!0),o(null),await k()},N=f=>{f.preventDefault(),v()};return r.jsx("div",{className:"space-y-6",children:r.jsxs("form",{onSubmit:N,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",gn["AI Provider"]):Object.entries(gn).map(([f,y])=>h(f,y))}),s&&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:s})]}),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 Ti=({icon:e,title:t,description:n,time:i,link:a})=>r.jsx("a",{href:a,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"})})]})})]})}),Pi=({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 items-center",children:[r.jsx("div",{className:"mr-4 flex-shrink-0 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 Mi({text:e}){const[t,n]=j.useState(!1),i=async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}catch(s){console.error("Failed to copy text:",s)}},a=()=>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:a()})}function Zt({title:e,message:t,initTab:n}){const[i,a]=j.useState(n??"getting-started"),s=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=f=>f===0?"tutorials":f===1?"documentation":"getting-started",d=f=>f===1?"getting-started":f===2?"tutorials":"documentation",m=()=>{if(o<s-1){const f=c(o);a(f)}},h=()=>{if(o>0){const f=d(o);a(f)}},p=f=>{const y="px-4 py-3 text-sm font-medium ";return i===f?y+"text-solace-blue border-b-2 border-solace-blue":y+"text-gray-500 hover:text-solace-blue"},k=[{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/developing/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/developing/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/developing/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/developing/tutorials/slack-integration"}],v=[{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/architecture"},{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/developing/tutorials/custom-agent"},{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:"Developing",description:"Development guides for various components",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/developing/"}],N=()=>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, return to your terminal and 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(Mi,{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:k.map(f=>r.jsx(Ti,{icon:f.icon,title:f.title,description:f.description,time:f.time,link:f.link},f.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:v.map(f=>r.jsx(Pi,{icon:f.icon,title:f.title,description:f.description,link:f.link},f.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:()=>a("getting-started"),className:p("getting-started"),children:"Getting Started"}),r.jsx("button",{onClick:()=>a("tutorials"),className:p("tutorials"),children:"Tutorials"}),r.jsx("button",{onClick:()=>a("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 ",s]})]}),N(),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 ",s]})}),r.jsxs("div",{className:"flex space-x-4",children:[r.jsx("div",{className:"w-24",children:o>0&&r.jsx(Y,{onClick:h,variant:"outline",type:"button",children:"Previous"})}),r.jsx("div",{className:"w-20",children:o<s-1&&r.jsx(Y,{onClick:m,type:"button",children:"Next"})})]})]})]})}const Nt={id:"path-selection",title:"Setup Path",description:"Choose your setup path",component:hi},xn=[{id:"project-setup",title:"Project Structure",description:"Set up your project namespace",component:gi},{id:"broker-setup",title:"Broker Setup",description:"Configure your Solace 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:Ci},{id:"webui-gateway-setup",title:"Web UI & Platform Service",description:"Configure Web UI Gateway and Platform Service",component:Ai},{id:"completion",title:"Review & Submit",description:"Finalize your configuration",component:Nr}],yn=[{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 Fi(){const[e,t]=j.useState(0),[n,i]=j.useState({}),[a,s]=j.useState(!1),[o,l]=j.useState(null),[u,c]=j.useState(null),[d,m]=j.useState(!1),[h,p]=j.useState([Nt]);j.useEffect(()=>{u&&(s(!0),fetch(`/api/default_options?path=${u}`).then(O=>{if(!O.ok)throw new Error("Failed to fetch default options");return O.json()}).then(O=>{if(O!=null&&O.default_options){const b=O.default_options;i(P=>({...P,...b})),s(!1)}else throw new Error("Invalid response format")}).catch(O=>{console.error("Error fetching default options:",O),l("Failed to connect to server, is the init process still running?"),s(!1)}))},[u]),j.useEffect(()=>{u==="quick"?p([Nt,...yn]):u==="advanced"&&p([Nt,...xn])},[u]);const k=h[e],v=O=>{O.setupPath&&typeof O.setupPath=="string"&&O.setupPath!==u&&c(O.setupPath),O.showSuccess&&m(!0),i(b=>({...b,...O}))},N=()=>{e<h.length-1&&t(e+1)},f=()=>{e>0&&t(e-1)};if(a&&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(Zt,{title:"Solace Agent Mesh Initialized Successfully!",message:"Your project configuration has been saved. You are now ready to start building and running agents."})});const y=k==null?void 0:k.component;if(!y)return r.jsx("div",{className:"text-center p-10 text-red-600",children:"Error: Setup step not found."});const w=e>0,L=()=>u==="quick"?yn:u==="advanced"?xn:[];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"}),w&&r.jsx("div",{className:"mb-8",children:r.jsx(Kt,{steps:L(),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:k.title}),r.jsx("p",{className:"text-gray-600 mb-6",children:k.description}),r.jsx(y,{data:n,updateData:v,onNext:N,onPrevious:f})]})]})}const Li=[{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)"}],Ri=({data:e,updateData:t,onNext:n,onPrevious:i})=>{const a=l=>{const{name:u,value:c,type:d}=l.target,m=d==="checkbox"?l.target.checked:c;t({[u]:m})},s=()=>{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(M,{label:"Agent Name",htmlFor:"agent_name",required:!0,helpText:"Unique name for this agent (will be PascalCase by the system).",children:r.jsx(H,{id:"agent_name",name:"agent_name",value:e.agent_name||"",onChange:a,placeholder:"MyNewAgent",required:!0})}),r.jsx(M,{label:"A2A Namespace",htmlFor:"namespace",helpText:"A2A topic namespace (e.g., myorg/dev). Can use ${NAMESPACE} for environment variable.",children:r.jsx(H,{id:"namespace",name:"namespace",value:e.namespace||"",onChange:a,placeholder:"${NAMESPACE}"})}),r.jsx(M,{label:"Model Type",htmlFor:"model_type",required:!0,children:r.jsx(oe,{id:"model_type",name:"model_type",value:e.model_type||"planning",onChange:a,options:Li})}),r.jsx(M,{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:a,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(M,{label:"",htmlFor:"supports_streaming",children:r.jsx(ye,{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:s,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"})]})]})},bn="use_default_shared_session",ut="use_default_shared_artifact",Oi=[{value:ut,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)"}],zi=[{value:"namespace",label:"Namespace (Shared by all agents in namespace)"},{value:"app",label:"App (Isolated to this agent instance)"}],Di=({data:e,updateData:t,onNext:n,onPrevious:i})=>{const a=u=>{const{name:c,value:d}=u.target,m={[c]:d};c==="session_service_type"?(d===bn?m.session_service_behavior=void 0:e.session_service_behavior||(m.session_service_behavior="PERSISTENT"),d==="sql"?m.database_url="default_agent_db":m.database_url=void 0):c==="artifact_service_type"&&(d===ut?(m.artifact_service_base_path=void 0,m.artifact_service_scope=void 0):(e.artifact_service_scope||(m.artifact_service_scope="namespace"),d==="filesystem"&&!e.artifact_service_base_path&&(m.artifact_service_base_path="/tmp/samv2"))),t(m)},s=u=>{t({[u.target.name]:u.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()};e.session_service_type;const l=e.artifact_service_type!==ut;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(ue,{children:"Configure how your agent 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 mt-8",children:"Artifact Service"}),r.jsx(M,{label:"Artifact Service Configuration",htmlFor:"artifact_service_type",required:!0,children:r.jsx(oe,{id:"artifact_service_type",name:"artifact_service_type",value:e.artifact_service_type||ut,onChange:a,options:Oi})}),l&&e.artifact_service_type==="filesystem"&&r.jsx(M,{label:"Artifact Service Base Path",htmlFor:"artifact_service_base_path",required:!0,helpText:"Base directory path for filesystem artifact storage.",children:r.jsx(H,{id:"artifact_service_base_path",name:"artifact_service_base_path",value:e.artifact_service_base_path||"/tmp/samv2",onChange:s,placeholder:"/tmp/samv2",required:!0})}),l&&r.jsx(M,{label:"Artifact Service Scope",htmlFor:"artifact_service_scope",required:!0,children:r.jsx(oe,{id:"artifact_service_scope",name:"artifact_service_scope",value:e.artifact_service_scope||"namespace",onChange:s,options:zi})}),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})]})}),_n=({id:e,label:t,values:n,onChange:i,placeholder:a,helpText:s,error:o,required:l,keyPlaceholder:u="Key",valuePlaceholder:c="Value"})=>{const[d,m]=j.useState(""),[h,p]=j.useState(""),k=()=>{const w=d.trim(),L=h.trim();w===""||L===""||w in n||(i({...n,[w]:L}),m(""),p(""))},v=w=>{const L={...n};delete L[w],i(L)},N=(w,L)=>{i({...n,[w]:L})},f=w=>{w.key==="Enter"&&(w.preventDefault(),k())},y=Object.entries(n);return r.jsx(M,{label:t,htmlFor:e,helpText:s,error:o,required:l,children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(H,{id:`${e}-key`,name:`${e}-key`,value:d,onChange:w=>m(w.target.value),onKeyDown:f,placeholder:u,className:"flex-1"}),r.jsx(H,{id:`${e}-value`,name:`${e}-value`,value:h,onChange:w=>p(w.target.value),onKeyDown:f,placeholder:c,className:"flex-1"}),r.jsx(Y,{onClick:k,variant:"secondary",type:"button",children:"Add"})]}),y.length>0&&r.jsx("div",{className:"border border-gray-200 rounded-md divide-y divide-gray-200",children:y.map(([w,L])=>r.jsxs("div",{className:"flex items-center space-x-2 p-2 hover:bg-gray-50",children:[r.jsx("div",{className:"flex-1 font-mono text-sm text-gray-700 px-2 py-1 bg-gray-100 rounded",children:w}),r.jsx(H,{id:`${e}-value-${w}`,value:L,onChange:O=>N(w,O.target.value),className:"flex-1 text-sm",placeholder:"Value"}),r.jsx("button",{type:"button",onClick:()=>v(w),className:"text-red-500 hover:text-red-700 focus:outline-none px-2","aria-label":`Remove ${w}`,children:"×"})]},w))}),y.length===0&&a&&r.jsx("div",{className:"p-3 border border-dashed border-gray-300 rounded-md flex items-center justify-center",children:r.jsx("p",{className:"text-sm text-gray-400",children:a})})]})})},Bi=({id:e,label:t,values:n,onChange:i,placeholder:a,helpText:s,error:o,required:l,itemPlaceholder:u="Enter value"})=>{const[c,d]=j.useState(""),m=()=>{c.trim()!==""&&(i([...n,c.trim()]),d(""))},h=f=>{i(n.filter((y,w)=>w!==f))},p=(f,y)=>{const w=[...n];w[f]=y,i(w)},k=f=>{f.key==="Enter"&&(f.preventDefault(),m())},v=f=>{if(f===0)return;const y=[...n];[y[f-1],y[f]]=[y[f],y[f-1]],i(y)},N=f=>{if(f===n.length-1)return;const y=[...n];[y[f],y[f+1]]=[y[f+1],y[f]],i(y)};return r.jsx(M,{label:t,htmlFor:e,helpText:s,error:o,required:l,children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(H,{id:e,name:e,value:c,onChange:f=>d(f.target.value),onKeyDown:k,placeholder:u,className:"flex-1"}),r.jsx(Y,{onClick:m,variant:"secondary",type:"button",children:"Add"})]}),n.length>0&&r.jsx("div",{className:"border border-gray-200 rounded-md divide-y divide-gray-200",children:n.map((f,y)=>r.jsxs("div",{className:"flex items-center space-x-2 p-2 hover:bg-gray-50",children:[r.jsxs("div",{className:"flex flex-col space-y-1",children:[r.jsx("button",{type:"button",onClick:()=>v(y),disabled:y===0,className:`text-xs ${y===0?"text-gray-300 cursor-not-allowed":"text-gray-500 hover:text-gray-700"} focus:outline-none`,"aria-label":"Move up",children:"▲"}),r.jsx("button",{type:"button",onClick:()=>N(y),disabled:y===n.length-1,className:`text-xs ${y===n.length-1?"text-gray-300 cursor-not-allowed":"text-gray-500 hover:text-gray-700"} focus:outline-none`,"aria-label":"Move down",children:"▼"})]}),r.jsx("span",{className:"text-sm text-gray-500 w-6",children:y}),r.jsx(H,{id:`${e}-item-${y}`,value:f,onChange:w=>p(y,w.target.value),className:"flex-1 text-sm",placeholder:u}),r.jsx("button",{type:"button",onClick:()=>h(y),className:"text-red-500 hover:text-red-700 focus:outline-none px-2","aria-label":`Remove item ${y}`,children:"×"})]},`${e}-${y}-${f}`))}),n.length===0&&a&&r.jsx("div",{className:"p-3 border border-dashed border-gray-300 rounded-md flex items-center justify-center",children:r.jsx("p",{className:"text-sm text-gray-400",children:a})})]})})},Ct={id:void 0,tool_type:"",tool_name:"",tool_description:"",group_name:"",component_module:"",function_name:"",component_base_path:"",connection_params:void 0,environment_variables:void 0,required_scopes:[],tool_config:void 0,environment_variables_ui:{},tool_config_ui:{},transport_type:"",stdio_command:"",stdio_args:[],sse_url:"",streamable_http_url:"",mcp_timeout:30,auth_type:"",auth_token:"",auth_header_name:"",oauth_client_id:"",oauth_client_secret:""},qi=({data:e,updateData:t,onNext:n,onPrevious:i,availableTools:a})=>{var A;const[s,o]=j.useState(!1),[l,u]=j.useState(Ct),[c,d]=j.useState("initial"),[m,h]=j.useState(null),[p,k]=j.useState({}),v=Array.isArray(e.tools)?e.tools:[],N=()=>{u({...Ct,id:Date.now().toString()}),h(null),k({}),d("initial"),o(!0)},f=_=>{_.tool_type==="builtin-group"?d("builtin-group"):_.tool_type==="builtin"?d("builtin-tool"):d("custom");let C={};const T={};_.environment_variables&&typeof _.environment_variables=="object"&&Object.entries(_.environment_variables).forEach(([F,D])=>{T[F]=String(D)});const B={};if(_.tool_config&&typeof _.tool_config=="object"&&Object.entries(_.tool_config).forEach(([F,D])=>{B[F]=String(D)}),_.tool_type==="mcp"&&_.connection_params){const F=_.connection_params,D=F.type;D==="stdio"?C={transport_type:"stdio",stdio_command:F.command||"",stdio_args:Array.isArray(F.args)?F.args:[],mcp_timeout:F.timeout||30}:D==="sse"?C={transport_type:"sse",sse_url:F.url||"",mcp_timeout:F.timeout||30}:D==="streamable-http"&&(C={transport_type:"streamable-http",streamable_http_url:F.url||"",mcp_timeout:F.timeout||30})}const K={...Ct,..._,...C,id:_.id||Date.now().toString(),tool_type:_.tool_type||"",required_scopes:Array.isArray(_.required_scopes)?_.required_scopes:[],environment_variables_ui:T,tool_config_ui:B};u(K),h(_.id||null),k({}),o(!0)},y=_=>{const{name:C,value:T}=_.target;if(C==="mcp_timeout"){const B=T===""?30:parseInt(T,10);u(K=>({...K,[C]:B}))}else u(B=>({...B,[C]:T}))},w=(_,C)=>{u(T=>({...T,[_]:C}))},L=(_,C)=>{u(T=>({...T,[_]:C}))},O=(_,C)=>{u(T=>({...T,[_]:C}))},b=()=>{const _={};return l.tool_type||(_.tool_type="Tool type is required."),l.tool_type==="builtin-group"?l.group_name||(_.group_name="Group name is required."):l.tool_type==="builtin"?l.tool_name||(_.tool_name="Tool name is required."):l.tool_type==="python"?(l.component_module||(_.component_module="Component module is required."),l.function_name||(_.function_name="Function name is required.")):l.tool_type==="mcp"&&(l.transport_type?l.transport_type==="stdio"?l.stdio_command||(_.stdio_command="Command is required for stdio transport."):l.transport_type==="sse"?l.sse_url||(_.sse_url="URL is required for SSE transport."):l.transport_type==="streamable-http"&&(l.streamable_http_url||(_.streamable_http_url="URL is required for streamable-http transport.")):_.transport_type="Transport type is required for MCP tools.",l.auth_type==="api_key"?(l.auth_header_name||(_.auth_header_name="Header name is required for API key authentication."),l.auth_token||(_.auth_token="API key is required for API key authentication.")):l.auth_type==="bearer"&&(l.auth_token||(_.auth_token="Bearer token is required for bearer authentication."))),k(_),Object.keys(_).length===0},P=()=>{const _={};if(l.auth_type==="oauth2"){const C={type:"oauth2"};l.oauth_client_id&&(C.client_id=l.oauth_client_id),l.oauth_client_secret&&(C.client_secret=l.oauth_client_secret),_.auth=C}else if(l.auth_type==="bearer"||l.auth_type==="api_key"){const C={};l.auth_type==="bearer"&&l.auth_token?C.Authorization=`Bearer ${l.auth_token}`:l.auth_type==="api_key"&&l.auth_token&&l.auth_header_name&&(C[l.auth_header_name]=l.auth_token),Object.keys(C).length>0&&(_.headers=C)}return _},q=()=>{var K;if(!b())return;const _={id:l.id||Date.now().toString(),tool_type:l.tool_type};let C;switch(l.tool_type){case"builtin-group":C={..._,group_name:l.group_name};break;case"builtin":C={..._,tool_name:l.tool_name};break;case"python":C={..._,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:l.tool_config_ui&&Object.keys(l.tool_config_ui).length>0?l.tool_config_ui:void 0,required_scopes:l.required_scopes||[]};break;case"mcp":{let F={},D;if(l.transport_type==="stdio")F={type:"stdio",command:l.stdio_command,args:l.stdio_args||[],timeout:l.mcp_timeout||30};else if(l.transport_type==="sse"){F={type:"sse",url:l.sse_url,timeout:l.mcp_timeout||30};const te=P();te.auth&&(D=te.auth),te.headers&&(F.headers=te.headers)}else if(l.transport_type==="streamable-http"){F={type:"streamable-http",url:l.streamable_http_url,timeout:l.mcp_timeout||30};const te=P();te.auth&&(D=te.auth),te.headers&&(F.headers=te.headers)}const J=l.environment_variables_ui&&Object.keys(l.environment_variables_ui).length>0?l.environment_variables_ui:void 0,g=l.tool_config_ui&&Object.keys(l.tool_config_ui).length>0?l.tool_config_ui:void 0,X={id:_.id,tool_type:_.tool_type};l.tool_name&&(X.tool_name=l.tool_name),X.connection_params=F,D&&(X.auth=D),J&&(X.environment_variables=J),g&&(X.tool_config=g),l.required_scopes&&l.required_scopes.length>0&&(X.required_scopes=l.required_scopes),l.auth_type&&l.auth_type!=="none"&&(X.auth_type=l.auth_type,l.auth_type==="oauth2"?(l.oauth_client_id&&(X.oauth_client_id=l.oauth_client_id),l.oauth_client_secret&&(X.oauth_client_secret=l.oauth_client_secret)):(l.auth_type==="bearer"||l.auth_type==="api_key")&&(l.auth_token&&(X.auth_token=l.auth_token),l.auth_type==="api_key"&&l.auth_header_name&&(X.auth_header_name=l.auth_header_name))),C=X;break}default:o(!1);return}let T;m?T=v.map(F=>F.id===m?C:F):T=[...v,C];const B=((K=C.connection_params)==null?void 0:K.type)??l.transport_type;if(C.tool_type==="mcp"&&(B==="sse"||B==="streamable-http")&&!T.some(D=>D.tool_type==="builtin-group"&&D.group_name==="web"||D.tool_type==="builtin"&&D.tool_name==="web_request")){const D={id:`web_auto_${Date.now()}`,tool_type:"builtin-group",group_name:"web"};T.push(D)}t({tools:T}),o(!1),h(null)},z=_=>{_&&t({tools:v.filter(C=>C.id!==_)})},U=_=>{var T;const C=[];if(_.tool_type==="builtin-group")C.push(`Group: ${_.group_name}`);else if(_.tool_type==="mcp"){const B=(T=_.connection_params)==null?void 0:T.type;B&&C.push(`Transport: ${B}`)}else _.tool_name?C.push(`Name: ${_.tool_name}`):_.tool_type==="python"&&_.function_name&&C.push(`Func: ${_.function_name}`);return _.component_module&&C.push(`Module: ${_.component_module}`),C.join(", ")||"No details"};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(ue,{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:N,variant:"secondary",children:"+ Add Tool"}),v.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:v.map((_,C)=>{var T;return r.jsxs("tr",{children:[r.jsxs("td",{className:"px-4 py-2 whitespace-nowrap text-sm text-gray-700",children:[_.tool_type,((T=_.id)==null?void 0:T.startsWith("web_auto_"))&&r.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800",children:"Auto-added"})]}),r.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-sm text-gray-500 max-w-xs truncate",title:U(_),children:U(_)}),r.jsxs("td",{className:"px-4 py-2 whitespace-nowrap text-sm space-x-2",children:[r.jsx(Y,{onClick:()=>f(_),variant:"outline",children:"Edit"}),r.jsx(Y,{onClick:()=>z(_.id),variant:"outline",className:"text-red-600 border-red-300 hover:bg-red-50",children:"Delete"})]})]},_.id||C)})})]})}):r.jsx("p",{className:"text-gray-500 mt-4",children:"No tools configured yet."}),s&&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(_=>({..._,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(_=>({..._,tool_type:"builtin"})),d("builtin-tool")},variant:"secondary",className:"w-full justify-start",children:"Single Built-in Tool"}),r.jsx(Y,{onClick:()=>{u(_=>({..._,tool_type:"python"})),d("custom")},variant:"secondary",className:"w-full justify-start",children:"Python Tool"}),r.jsx(Y,{onClick:()=>{u(_=>({..._,tool_type:"mcp"})),d("custom")},variant:"secondary",className:"w-full justify-start",children:"MCP Tool"})]}),c==="builtin-group"&&r.jsx(M,{label:"Built-in Tool Group",htmlFor:"group_name",error:p.group_name,required:!0,children:r.jsx(oe,{id:"group_name",name:"group_name",value:l.group_name||"",onChange:y,options:[{value:"",label:"Select a group..."},...a&&"groups"in a&&a.groups?Object.keys(a.groups).map(_=>({value:_,label:`${_.replace(/_/g," ").replace(/\b\w/g,C=>C.toUpperCase())} - ${a.groups[_].description}`})):[]]})}),c==="builtin-tool"&&r.jsx(M,{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:y,suggestions:a&&"tools"in a&&a.tools?Object.keys(a.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(M,{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(H,{id:"tool_name",name:"tool_name",value:l.tool_name||"",onChange:y})}),r.jsx(M,{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(H,{id:"tool_description",name:"tool_description",value:l.tool_description||"",onChange:y,placeholder:"e.g., Fetch user profile data"})}),r.jsx(M,{label:"Component Module",htmlFor:"component_module",error:p.component_module,required:!0,children:r.jsx(H,{id:"component_module",name:"component_module",value:l.component_module||"",onChange:y,placeholder:"e.g., my_agent.custom_tools"})}),r.jsx(M,{label:"Function Name",htmlFor:"function_name",error:p.function_name,required:!0,children:r.jsx(H,{id:"function_name",name:"function_name",value:l.function_name||"",onChange:y,placeholder:"e.g., my_tool_function"})}),r.jsx(M,{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(H,{id:"component_base_path",name:"component_base_path",value:l.component_base_path||"",onChange:y,placeholder:"e.g., src/plugins"})})]}),l.tool_type==="mcp"&&r.jsxs(r.Fragment,{children:[r.jsx(M,{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(H,{id:"tool_name",name:"tool_name",value:l.tool_name||"",onChange:y})}),r.jsx(M,{label:"Transport Type",htmlFor:"transport_type",error:p.transport_type,required:!0,children:r.jsx(oe,{id:"transport_type",name:"transport_type",value:l.transport_type||"",onChange:y,options:[{value:"",label:"Select transport type..."},{value:"stdio",label:"stdio - Standard Input/Output"},{value:"sse",label:"sse - Server-Sent Events"},{value:"streamable-http",label:"streamable-http - Streamable HTTP"}]})}),l.transport_type==="stdio"&&r.jsxs(r.Fragment,{children:[r.jsxs(ue,{children:[r.jsx("strong",{children:"Example stdio configuration:"}),r.jsx("br",{}),"Command: ",r.jsx("code",{children:"npx"}),r.jsx("br",{}),"Arguments (in order):",r.jsx("br",{}),"  1. ",r.jsx("code",{children:"-y"}),r.jsx("br",{}),"  2. ",r.jsx("code",{children:"@modelcontextprotocol/server-filesystem"}),r.jsx("br",{}),"  3. ",r.jsx("code",{children:"/path/to/allowed/directory"}),r.jsx("br",{}),r.jsx("em",{children:"Do not include quotation marks when entering arguments."})]}),r.jsx(M,{label:"Command",htmlFor:"stdio_command",error:p.stdio_command,required:!0,helpText:"The command to execute (e.g., 'python', 'node', 'npx')",children:r.jsx(H,{id:"stdio_command",name:"stdio_command",value:l.stdio_command||"",onChange:y,placeholder:"e.g., npx"})}),r.jsx(Bi,{id:"stdio_args",label:"Arguments",values:l.stdio_args||[],onChange:_=>L("stdio_args",_),error:p.stdio_args,helpText:"Command line arguments in order. Enter each argument separately without quotes.",placeholder:"No arguments added yet",itemPlaceholder:"e.g., -y or /path/to/directory"})]}),l.transport_type==="sse"&&r.jsxs(r.Fragment,{children:[r.jsxs(ue,{children:[r.jsx("strong",{children:"📡 Remote MCP Server"}),r.jsx("br",{}),"SSE transport connects to remote servers over HTTP. The ",r.jsx("strong",{children:"web"})," builtin tool group will be automatically included in your agent configuration to enable network access."]}),r.jsx(M,{label:"URL",htmlFor:"sse_url",error:p.sse_url,required:!0,helpText:"The SSE endpoint URL",children:r.jsx(H,{id:"sse_url",name:"sse_url",value:l.sse_url||"",onChange:y,placeholder:"https://mcp.example.com/v1/sse"})})]}),l.transport_type==="streamable-http"&&r.jsxs(r.Fragment,{children:[r.jsxs(ue,{children:[r.jsx("strong",{children:"📡 Remote MCP Server"}),r.jsx("br",{}),"Streamable HTTP transport connects to remote servers over HTTP. The ",r.jsx("strong",{children:"web"})," builtin tool group will be automatically included in your agent configuration to enable network access."]}),r.jsx(M,{label:"URL",htmlFor:"streamable_http_url",error:p.streamable_http_url,required:!0,helpText:"The streamable HTTP endpoint URL",children:r.jsx(H,{id:"streamable_http_url",name:"streamable_http_url",value:l.streamable_http_url||"",onChange:y,placeholder:"https://mcp.example.com:port/mcp/message"})})]}),l.transport_type==="stdio"&&r.jsx(_n,{id:"environment_variables_ui",label:"Environment Variables (Optional)",values:l.environment_variables_ui||{},onChange:_=>O("environment_variables_ui",_),error:p.environment_variables_ui,helpText:"Environment variables passed to the MCP server process (e.g., API keys, paths). Can use ${VAR} syntax.",placeholder:"No environment variables added",keyPlaceholder:"Variable name (e.g., CONFLUENCE_URL)",valuePlaceholder:"Variable value (e.g., ${CONFLUENCE_URL})"}),(l.transport_type==="sse"||l.transport_type==="streamable-http")&&r.jsx(M,{label:"Authentication Type (Optional)",htmlFor:"auth_type",helpText:"Configure authentication for the MCP server",children:r.jsx(oe,{id:"auth_type",name:"auth_type",value:l.auth_type||"",onChange:y,options:[{value:"",label:"No authentication"},{value:"api_key",label:"API Key"},{value:"bearer",label:"Bearer Token"},{value:"oauth2",label:"OAuth 2.0 (Requires Enterprise License)"}]})}),(l.transport_type==="sse"||l.transport_type==="streamable-http")&&l.auth_type==="api_key"&&r.jsxs(r.Fragment,{children:[r.jsx(M,{label:"Header Name",htmlFor:"auth_header_name",required:!0,error:p.auth_header_name,helpText:"The HTTP header name for the API key",children:r.jsx(H,{id:"auth_header_name",name:"auth_header_name",value:l.auth_header_name||"",onChange:y,placeholder:"e.g., X-API-Key"})}),r.jsx(M,{label:"API Key",htmlFor:"auth_token",required:!0,error:p.auth_token,helpText:"The API key value (can use environment variables like ${API_KEY})",children:r.jsx(H,{id:"auth_token",name:"auth_token",value:l.auth_token||"",onChange:y,placeholder:"e.g., ${MCP_API_KEY}"})})]}),(l.transport_type==="sse"||l.transport_type==="streamable-http")&&l.auth_type==="bearer"&&r.jsx(M,{label:"Bearer Token",htmlFor:"auth_token",required:!0,error:p.auth_token,helpText:"The bearer token value (can use environment variables like ${TOKEN})",children:r.jsx(H,{id:"auth_token",name:"auth_token",value:l.auth_token||"",onChange:y,placeholder:"e.g., ${MCP_BEARER_TOKEN}"})}),(l.transport_type==="sse"||l.transport_type==="streamable-http")&&l.auth_type==="oauth2"&&r.jsxs(r.Fragment,{children:[r.jsxs(ue,{children:[r.jsx("strong",{children:"⚠️ Enterprise Feature"}),r.jsx("br",{}),"OAuth 2.0 authentication requires a Solace Agent Mesh Enterprise license.",r.jsx("br",{}),r.jsx("br",{}),r.jsx("strong",{children:"Note:"})," After generating the agent YAML, you will need to manually add a manifest section to define the tools. Example:",r.jsx("br",{}),r.jsx("br",{}),r.jsx("code",{style:{display:"block",whiteSpace:"pre",fontSize:"0.85em",background:"#f5f5f5",padding:"8px",borderRadius:"4px"},children:`tools:
  - tool_type: mcp
    connection_params:
      type: sse
      url: https://mcp.example.com/v1/sse
    auth:
      type: oauth2
    manifest:
      - id: searchDocuments
        name: searchDocuments
        description: Search through documents
        inputSchema:
          type: object
          properties:
            query:
              type: string
            maxResults:
              type: number
          required: [query]`})]}),r.jsx(M,{label:"Client ID (Optional)",htmlFor:"oauth_client_id",error:p.oauth_client_id,helpText:"OAuth 2.0 client ID (can use environment variables like ${OAUTH_CLIENT_ID})",children:r.jsx(H,{id:"oauth_client_id",name:"oauth_client_id",value:l.oauth_client_id||"",onChange:y,placeholder:"e.g., ${OAUTH_CLIENT_ID}"})}),r.jsx(M,{label:"Client Secret (Optional)",htmlFor:"oauth_client_secret",error:p.oauth_client_secret,helpText:"OAuth 2.0 client secret (can use environment variables like ${OAUTH_CLIENT_SECRET})",children:r.jsx(H,{id:"oauth_client_secret",name:"oauth_client_secret",value:l.oauth_client_secret||"",onChange:y,placeholder:"e.g., ${OAUTH_CLIENT_SECRET}"})})]}),r.jsx(M,{label:"Connection Timeout (seconds)",htmlFor:"mcp_timeout",helpText:"Timeout for MCP server connections (default: 30 seconds)",children:r.jsx(H,{id:"mcp_timeout",name:"mcp_timeout",type:"number",value:((A=l.mcp_timeout)==null?void 0:A.toString())||"30",onChange:y,placeholder:"30"})})]})]}),(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:_=>w("required_scopes",_),helpText:"Enter required OAuth scopes and press Add.",placeholder:"No scopes added yet.",inputPlaceholder:"e.g., read:profile"}),r.jsx(_n,{id:"tool_config_ui",label:"Tool Config (Optional)",values:l.tool_config_ui||{},onChange:_=>O("tool_config_ui",_),error:p.tool_config_ui,helpText:"Tool-specific configuration like API keys, model names etc.",placeholder:"No configuration added",keyPlaceholder:"Config key (e.g., api_key)",valuePlaceholder:"Config value"})]}),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:q,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"})]})]})},Ui=[{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)"}],Hi=({data:e,updateData:t,onNext:n,onPrevious:i})=>r.jsxs("div",{className:"space-y-6",children:[r.jsx(ue,{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(M,{label:"Artifact Handling Mode",htmlFor:"artifact_handling_mode",helpText:"How artifacts created by this agent are represented in A2A messages.",children:r.jsx(oe,{id:"artifact_handling_mode",name:"artifact_handling_mode",value:e.artifact_handling_mode||"ignore",onChange:a=>t({artifact_handling_mode:a.target.value}),options:Ui})}),r.jsxs("div",{className:"space-y-3 mt-4",children:[r.jsx(M,{label:"",htmlFor:"enable_embed_resolution",children:r.jsx(ye,{id:"enable_embed_resolution",checked:e.enable_embed_resolution===void 0?!0:!!e.enable_embed_resolution,onChange:a=>t({enable_embed_resolution:a}),label:"Enable Embed Resolution (for dynamic content like state, math in prompts)"})}),r.jsx(M,{label:"",htmlFor:"enable_artifact_content_instruction",children:r.jsx(ye,{id:"enable_artifact_content_instruction",checked:e.enable_artifact_content_instruction===void 0?!0:!!e.enable_artifact_content_instruction,onChange:a=>t({enable_artifact_content_instruction:a}),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"})]})]}),Vi=()=>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"})}),Wi=()=>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"})}),$i=({data:e,updateData:t,onNext:n,onPrevious:i})=>{const[a,s]=j.useState(!1),[o,l]=j.useState(null),[u,c]=j.useState(null),[d,m]=j.useState({}),[h,p]=j.useState(null);j.useEffect(()=>{a&&(o?(m(o),c(o.id)):(m({}),c(null)),p(null))},[o,a]);const k=b=>{const{name:P,value:q,type:z}=b.target,U=z==="checkbox"?b.target.checked:q;t({[P]:U})},v=b=>{const{name:P,value:q}=b.target;m(z=>({...z,[P]:q}))},N=()=>{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 b=Array.isArray(e.agent_card_skills)?[...e.agent_card_skills]:[],P=d.id,q=b.findIndex(z=>z.id===P);if(o){if(u!==P&&q!==-1){p(`Skill ID "${P}" already exists. Please use a unique ID.`);return}const z=b.findIndex(U=>U.id===u);if(z!==-1)b[z]={...d};else{p("Error finding the original skill to update.");return}}else{if(q!==-1){p(`Skill ID "${P}" already exists. Please use a unique ID.`);return}b.push({...d})}t({agent_card_skills:b}),s(!1),l(null),c(null)},f=b=>{l(b),s(!0)},y=()=>{l(null),s(!0)},w=b=>{const P=Array.isArray(e.agent_card_skills)?e.agent_card_skills:[];t({agent_card_skills:P.filter(q=>q.id!==b)})},L=b=>{const{name:P,value:q}=b.target;t({[P]:q===""?void 0:Number(q)})},O="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(M,{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||O,onChange:k,placeholder:O})}),r.jsx(Ae,{id:"agent_card_default_input_modes",label:"Default Input Modes",values:e.agent_card_default_input_modes||[],onChange:b=>t({agent_card_default_input_modes:b}),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:b=>t({agent_card_default_output_modes:b}),helpText:"Enter output modes (e.g., text, file) and press Add.",placeholder:"No output modes added yet.",inputPlaceholder:"e.g., file"}),r.jsxs(M,{label:"Skills",htmlFor:"add_skill_button",children:[r.jsx("div",{className:"mb-2",children:r.jsx(Y,{type:"button",variant:"outline",onClick:y,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(b=>r.jsxs("tr",{children:[r.jsx("td",{className:"px-3 py-2 whitespace-nowrap font-mono text-xs",children:b.id}),r.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:b.name}),r.jsx("td",{className:"px-3 py-2 break-words max-w-xs",children:b.description}),r.jsxs("td",{className:"px-3 py-2 whitespace-nowrap space-x-2",children:[r.jsx(Y,{variant:"secondary",onClick:()=>f(b),"aria-label":"Edit skill",children:r.jsx(Vi,{})}),r.jsx(Y,{variant:"secondary",onClick:()=>w(b.id),className:"text-red-600 hover:text-red-800","aria-label":"Delete skill",children:r.jsx(Wi,{})})]})]},b.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(M,{label:"Agent Card Publishing Interval (seconds)",htmlFor:"agent_card_publishing_interval",helpText:"Set to 0 to disable periodic publishing.",children:r.jsx(H,{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:L,placeholder:"10"})}),r.jsx(M,{label:"",htmlFor:"agent_discovery_enabled",children:r.jsx(ye,{id:"agent_discovery_enabled",checked:e.agent_discovery_enabled===void 0?!1:!!e.agent_discovery_enabled,onChange:b=>t({agent_discovery_enabled:b}),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:b=>t({inter_agent_communication_allow_list:b}),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:b=>t({inter_agent_communication_deny_list:b}),helpText:"Agent name patterns to deny delegation to.",placeholder:"No deny list patterns added.",inputPlaceholder:"e.g., RiskyAgent*"}),r.jsx(M,{label:"Inter-Agent Request Timeout (seconds)",htmlFor:"inter_agent_communication_timeout",children:r.jsx(H,{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:L,placeholder:"30"})}),a&&r.jsx(Cr,{onClose:()=>{s(!1),l(null),c(null)},title:o?"Edit Skill":"Add New Skill",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(M,{label:"Skill ID (e.g., function_name)",htmlFor:"skill_id",required:!0,helpText:"Unique identifier for the skill.",children:r.jsx(H,{id:"skill_id",name:"id",value:d.id||"",onChange:v,placeholder:"e.g., getWeather",disabled:!1})}),r.jsx(M,{label:"Skill Name (Display Name)",htmlFor:"skill_name",required:!0,children:r.jsx(H,{id:"skill_name",name:"name",value:d.name||"",onChange:v,placeholder:"e.g., Data Analysis"})}),r.jsx(M,{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:v,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:()=>{s(!1),l(null),c(null)},children:"Cancel"}),r.jsx(Y,{type:"button",onClick:N,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"})]})]})},Gi=({data:e,updateData:t,onPrevious:n,serverUrl:i=""})=>{const a=async()=>{console.log("Submitting agent configuration:",e);try{const s=JSON.parse(JSON.stringify(e));if(!Array.isArray(s.agent_card_skills)&&s.agent_card_skills_str)try{const c=JSON.parse(s.agent_card_skills_str);Array.isArray(c)?s.agent_card_skills=c:(console.warn("Parsed agent_card_skills_str was not an array, ensuring agent_card_skills is empty array."),s.agent_card_skills=[])}catch(c){console.warn("Could not parse agent_card_skills_str as JSON, ensuring agent_card_skills is empty array.",c),s.agent_card_skills=[]}else Array.isArray(s.agent_card_skills)||(s.agent_card_skills=[]);delete s.agent_card_skills_str,Array.isArray(s.tools)&&(s.tools=s.tools.map(c=>{if(!c.tool_type)return console.error("Tool is missing tool_type:",c),null;const d={tool_type:c.tool_type};return 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.auth&&(d.auth=c.auth),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}).filter(c=>c!==null));const o={agent_name_input:e.agent_name,config:s},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(s){alert(`Failed to save agent: ${s instanceof Error?s.message:String(s)}`)}};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:a,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"})]})]})},st=[{id:"agent-basic",title:"Basic Info",description:"Name, model, instruction",component:Ri},{id:"agent-services",title:"Services",description:"Session & artifact services",component:Di},{id:"agent-features",title:"Features",description:"Enable built-in features",component:Hi},{id:"agent-tools",title:"Custom Tools",description:"Define custom tools for the agent",component:qi},{id:"agent-card",title:"Agent Card & Comms",description:"Discovery and communication settings",component:$i},{id:"agent-review",title:"Review & Submit",description:"Review and save configuration",component:Gi}];function Yi(){var v;const[e,t]=j.useState(0),[n,i]=j.useState({}),[a,s]=j.useState(!0),[o,l]=j.useState(null),[u,c]=j.useState([]),d="";j.useEffect(()=>{Promise.all([fetch("/api/form_schema?type=agent"),fetch("/api/available_tools")]).then(async([N,f])=>{if(!N.ok)throw new Error(`Failed to fetch agent form schema (status: ${N.status})`);if(!f.ok)throw new Error(`Failed to fetch available tools (status: ${f.status})`);const y=await N.json(),w=await f.json();if((y==null?void 0:y.status)!=="success"||!(y!=null&&y.defaults))throw new Error((y==null?void 0:y.message)||"Invalid response for agent form schema");if((w==null?void 0:w.status)!=="success")throw new Error((w==null?void 0:w.message)||"Invalid response for available tools");c(w);const L=y.defaults,O={...L,agent_card_default_input_modes:(L.agent_card_default_input_modes_str||"text").split(",").map(b=>b.trim()).filter(Boolean),agent_card_default_output_modes:(L.agent_card_default_output_modes_str||"text,file").split(",").map(b=>b.trim()).filter(Boolean),inter_agent_communication_allow_list:(L.inter_agent_communication_allow_list_str||"*").split(",").map(b=>b.trim()).filter(Boolean),inter_agent_communication_deny_list:(L.inter_agent_communication_deny_list_str||"").split(",").map(b=>b.trim()).filter(Boolean),agent_card_skills_str:L.agent_card_skills_str||"[]",agent_card_skills:[],tools:Array.isArray(L.tools)?L.tools:[],showSuccessScreen_agent:!1};delete O.agent_card_default_input_modes_str,delete O.agent_card_default_output_modes_str,delete O.inter_agent_communication_allow_list_str,delete O.inter_agent_communication_deny_list_str;try{const b=JSON.parse(O.agent_card_skills_str||"[]");Array.isArray(b)&&(O.agent_card_skills=b.filter(P=>typeof P=="object"&&P!==null&&"id"in P&&typeof P.id=="string"&&"name"in P&&typeof P.name=="string"&&"description"in P&&typeof P.description=="string"))}catch(b){console.warn("Could not parse agent_card_skills_str from defaults:",b),O.agent_card_skills=[]}i(O)}).catch(N=>{console.error("Error fetching initial data:",N),l(`Failed to load agent configuration form: ${N instanceof Error?N.message:String(N)}`)}).finally(()=>s(!1))},[]);const m=j.useCallback(N=>{i(f=>({...f,...N}))},[]);j.useEffect(()=>{if(a)return;const N=[];N.push({id:"default-artifact-management",tool_type:"builtin-group",group_name:"artifact_management"}),m({tools:N})},[m,a]);const h=j.useCallback(()=>{e<st.length-1&&t(N=>N+1)},[e]),p=j.useCallback(()=>{e>0&&t(N=>N-1)},[e]);if(a)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 N="Agent Configured Successfully!";return n.agent_name&&(N=`Agent "${n.agent_name}" configured successfully!`),r.jsx("div",{className:"max-w-2xl mx-auto p-6",children:r.jsx(Zt,{title:N,message:"Your new agent configuration has been saved.",initTab:"tutorials"})})}const k=(v=st[e])==null?void 0:v.component;return k?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"}),st.length>1&&r.jsx("div",{className:"mb-8",children:r.jsx(Kt,{steps:st,currentStepIndex:e})}),r.jsx("div",{className:"bg-white rounded-lg shadow-xl p-6 min-h-[500px]",children:r.jsx(k,{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 Ji=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Xi=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,i)=>i?i.toUpperCase():n.toLowerCase()),vn=e=>{const t=Xi(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(),Qi=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 Ki={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 Zi=j.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:a="",children:s,iconNode:o,...l},u)=>j.createElement("svg",{ref:u,...Ki,width:t,height:t,stroke:e,strokeWidth:i?Number(n)*24/Number(t):n,className:Ar("lucide",a),...!s&&!Qi(l)&&{"aria-hidden":"true"},...l},[...o.map(([c,d])=>j.createElement(c,d)),...Array.isArray(s)?s:[s]]));/**
 * @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 Me=(e,t)=>{const n=j.forwardRef(({className:i,...a},s)=>j.createElement(Zi,{ref:s,iconNode:t,className:Ar(`lucide-${Ji(vn(e))}`,`lucide-${e}`,i),...a}));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 ea=[["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"}]],ta=Me("box",ea);/**
 * @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 na=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ra=Me("circle-check-big",na);/**
 * @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 ia=[["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"}]],aa=Me("cpu",ia);/**
 * @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 sa=[["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"}]],oa=Me("git-merge",sa);/**
 * @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 la=[["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"}]],ca=Me("server",la);/**
 * @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 ua=[["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"}]],da=Me("tag",ua);/**
 * @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 ma=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],pa=Me("wrench",ma),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})]}),ha=({plugin:e,onReadMore:t,onInstall:n})=>{const i=e.pyproject.description||"No description available.",a=s=>{switch(s==null?void 0:s.toLowerCase()){case"agent":return r.jsx(aa,{size:12});case"gateway":return r.jsx(ca,{size:12});case"tool":return r.jsx(pa,{size:12});default:return r.jsx(da,{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(ta,{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(ra,{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(oa,{size:12})}),r.jsx(kn,{label:"Type",value:e.pyproject.plugin_type||"custom",icon:a(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 fa(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const ga=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xa=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ya={};function jn(e,t){return(ya.jsx?xa:ga).test(e)}const ba=/[ \t\n\f\r]/g;function _a(e){return typeof e=="object"?e.type==="text"?Sn(e.value):!1:Sn(e)}function Sn(e){return e.replace(ba,"")===""}class Ze{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}Ze.prototype.normal={};Ze.prototype.property={};Ze.prototype.space=void 0;function Er(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new Ze(n,i,t)}function qt(e){return e.toLowerCase()}class me{constructor(t,n){this.attribute=n,this.property=t}}me.prototype.attribute="";me.prototype.booleanish=!1;me.prototype.boolean=!1;me.prototype.commaOrSpaceSeparated=!1;me.prototype.commaSeparated=!1;me.prototype.defined=!1;me.prototype.mustUseProperty=!1;me.prototype.number=!1;me.prototype.overloadedBoolean=!1;me.prototype.property="";me.prototype.spaceSeparated=!1;me.prototype.space=void 0;let va=0;const $=Fe(),re=Fe(),Ut=Fe(),E=Fe(),Z=Fe(),ze=Fe(),fe=Fe();function Fe(){return 2**++va}const Ht=Object.freeze(Object.defineProperty({__proto__:null,boolean:$,booleanish:re,commaOrSpaceSeparated:fe,commaSeparated:ze,number:E,overloadedBoolean:Ut,spaceSeparated:Z},Symbol.toStringTag,{value:"Module"})),At=Object.keys(Ht);class en extends me{constructor(t,n,i,a){let s=-1;if(super(t,n),Nn(this,"space",a),typeof i=="number")for(;++s<At.length;){const o=At[s];Nn(this,At[s],(i&Ht[o])===Ht[o])}}}en.prototype.defined=!0;function Nn(e,t,n){n&&(e[t]=n)}function Be(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const s=new en(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(s.mustUseProperty=!0),t[i]=s,n[qt(i)]=i,n[qt(s.attribute)]=i}return new Ze(t,n,e.space)}const Ir=Be({properties:{ariaActiveDescendant:null,ariaAtomic:re,ariaAutoComplete:null,ariaBusy:re,ariaChecked:re,ariaColCount:E,ariaColIndex:E,ariaColSpan:E,ariaControls:Z,ariaCurrent:null,ariaDescribedBy:Z,ariaDetails:null,ariaDisabled:re,ariaDropEffect:Z,ariaErrorMessage:null,ariaExpanded:re,ariaFlowTo:Z,ariaGrabbed:re,ariaHasPopup:null,ariaHidden:re,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Z,ariaLevel:E,ariaLive:null,ariaModal:re,ariaMultiLine:re,ariaMultiSelectable:re,ariaOrientation:null,ariaOwns:Z,ariaPlaceholder:null,ariaPosInSet:E,ariaPressed:re,ariaReadOnly:re,ariaRelevant:null,ariaRequired:re,ariaRoleDescription:Z,ariaRowCount:E,ariaRowIndex:E,ariaRowSpan:E,ariaSelected:re,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 wa=Be({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ze,acceptCharset:Z,accessKey:Z,action:null,allow:null,allowFullScreen:$,allowPaymentRequest:$,allowUserMedia:$,alt:null,as:null,async:$,autoCapitalize:null,autoComplete:Z,autoFocus:$,autoPlay:$,blocking:Z,capture:null,charSet:null,checked:$,cite:null,className:Z,cols:E,colSpan:null,content:null,contentEditable:re,controls:$,controlsList:Z,coords:E|ze,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$,defer:$,dir:null,dirName:null,disabled:$,download:Ut,draggable:re,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$,formTarget:null,headers:Z,height:E,hidden:Ut,high:E,href:null,hrefLang:null,htmlFor:Z,httpEquiv:Z,id:null,imageSizes:null,imageSrcSet:null,inert:$,inputMode:null,integrity:null,is:null,isMap:$,itemId:null,itemProp:Z,itemRef:Z,itemScope:$,itemType:Z,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$,low:E,manifest:null,max:null,maxLength:E,media:null,method:null,min:null,minLength:E,multiple:$,muted:$,name:null,nonce:null,noModule:$,noValidate:$,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:$,optimum:E,pattern:null,ping:Z,placeholder:null,playsInline:$,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$,referrerPolicy:null,rel:Z,required:$,reversed:$,rows:E,rowSpan:E,sandbox:Z,scope:null,scoped:$,seamless:$,selected:$,shadowRootClonable:$,shadowRootDelegatesFocus:$,shadowRootMode:null,shape:null,size:E,sizes:null,slot:null,span:E,spellCheck:re,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:$,useMap:null,value:re,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:$,declare:$,event:null,face:null,frame:null,frameBorder:null,hSpace:E,leftMargin:E,link:null,longDesc:null,lowSrc:null,marginHeight:E,marginWidth:E,noResize:$,noHref:$,noShade:$,noWrap:$,object:null,profile:null,prompt:null,rev:null,rightMargin:E,rules:null,scheme:null,scrolling:re,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:$,disableRemotePlayback:$,prefix:null,property:null,results:E,security:null,unselectable:null},space:"html",transform:Pr}),ka=Be({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:fe,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:$,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:ze,g2:ze,glyphName:ze,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:fe,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:fe,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fe,rev:fe,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fe,requiredFeatures:fe,requiredFonts:fe,requiredFormats:fe,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:fe,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:fe,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:fe,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=Be({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=Be({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Pr}),Lr=Be({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),ja={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"},Sa=/[A-Z]/g,Cn=/-[a-z]/g,Na=/^data[-\w.:]+$/i;function Ca(e,t){const n=qt(t);let i=t,a=me;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Na.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Cn,Ea);i="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Cn.test(s)){let o=s.replace(Sa,Aa);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=en}return new a(i,t)}function Aa(e){return"-"+e.toLowerCase()}function Ea(e){return e.charAt(1).toUpperCase()}const Ia=Er([Ir,wa,Mr,Fr,Lr],"html"),tn=Er([Ir,ka,Mr,Fr,Lr],"svg");function Ta(e){return e.join(" ").trim()}var Re={},Et,An;function Pa(){if(An)return Et;An=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
`,c="/",d="*",m="",h="comment",p="declaration";Et=function(v,N){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];N=N||{};var f=1,y=1;function w(C){var T=C.match(t);T&&(f+=T.length);var B=C.lastIndexOf(u);y=~B?C.length-B:y+C.length}function L(){var C={line:f,column:y};return function(T){return T.position=new O(C),q(),T}}function O(C){this.start=C,this.end={line:f,column:y},this.source=N.source}O.prototype.content=v;function b(C){var T=new Error(N.source+":"+f+":"+y+": "+C);if(T.reason=C,T.filename=N.source,T.line=f,T.column=y,T.source=v,!N.silent)throw T}function P(C){var T=C.exec(v);if(T){var B=T[0];return w(B),v=v.slice(B.length),T}}function q(){P(n)}function z(C){var T;for(C=C||[];T=U();)T!==!1&&C.push(T);return C}function U(){var C=L();if(!(c!=v.charAt(0)||d!=v.charAt(1))){for(var T=2;m!=v.charAt(T)&&(d!=v.charAt(T)||c!=v.charAt(T+1));)++T;if(T+=2,m===v.charAt(T-1))return b("End of comment missing");var B=v.slice(2,T-2);return y+=2,w(B),v=v.slice(T),y+=2,C({type:h,comment:B})}}function A(){var C=L(),T=P(i);if(T){if(U(),!P(a))return b("property missing ':'");var B=P(s),K=C({type:p,property:k(T[0].replace(e,m)),value:B?k(B[0].replace(e,m)):m});return P(o),K}}function _(){var C=[];z(C);for(var T;T=A();)T!==!1&&(C.push(T),z(C));return C}return q(),_()};function k(v){return v?v.replace(l,m):m}return Et}var En;function Ma(){if(En)return Re;En=1;var e=Re&&Re.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Re,"__esModule",{value:!0}),Re.default=n;var t=e(Pa());function n(i,a){var s=null;if(!i||typeof i!="string")return s;var o=(0,t.default)(i),l=typeof a=="function";return o.forEach(function(u){if(u.type==="declaration"){var c=u.property,d=u.value;l?a(c,d,u):d&&(s=s||{},s[c]=d)}}),s}return Re}var Ve={},In;function Fa(){if(In)return Ve;In=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,s=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={}),s(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(a,l):c=c.replace(i,l),c.replace(t,o))};return Ve.camelCase=u,Ve}var We,Tn;function La(){if(Tn)return We;Tn=1;var e=We&&We.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(Ma()),n=Fa();function i(a,s){var o={};return!a||typeof a!="string"||(0,t.default)(a,function(l,u){l&&u&&(o[(0,n.camelCase)(l,s)]=u)}),o}return i.default=i,We=i,We}var Ra=La();const Oa=yr(Ra),za=Da("start");function Da(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 Ba(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?Vt(e):""}function Vt(e){return Mn(e&&e.line)+":"+Mn(e&&e.column)}function Pn(e){return Vt(e&&e.start)+"-"+Vt(e&&e.end)}function Mn(e){return e&&typeof e=="number"?e:1}let le=class extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?a=t:!s.cause&&t&&(o=!0,a=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof i=="string"){const u=i.indexOf(":");u===-1?s.ruleId=i:(s.source=i.slice(0,u),s.ruleId=i.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=l?l.line:void 0,this.name=Ba(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}};le.prototype.file="";le.prototype.name="";le.prototype.reason="";le.prototype.message="";le.prototype.stack="";le.prototype.column=void 0;le.prototype.line=void 0;le.prototype.ancestors=void 0;le.prototype.cause=void 0;le.prototype.fatal=void 0;le.prototype.place=void 0;le.prototype.ruleId=void 0;le.prototype.source=void 0;const nn={}.hasOwnProperty,qa=new Map,Ua=/[A-Z]/g,Ha=new Set(["table","tbody","thead","tfoot","tr"]),Va=new Set(["td","th"]),Rr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Wa(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=Za(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=Ka(n,t.jsx,t.jsxs)}const a={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"?tn:Ia,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Or(a,e,void 0);return s&&typeof s!="string"?s:a.create(e,a.Fragment,{children:s||void 0},void 0)}function Or(e,t,n){if(t.type==="element")return $a(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Ga(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ja(e,t,n);if(t.type==="mdxjsEsm")return Ya(e,t);if(t.type==="root")return Xa(e,t,n);if(t.type==="text")return Qa(e,t)}function $a(e,t,n){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=tn,e.schema=a),e.ancestors.push(t);const s=Dr(e,t.tagName,!1),o=es(e,t);let l=an(e,t);return Ha.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!_a(u):!0})),zr(e,o,s,t),rn(o,l),e.ancestors.pop(),e.schema=i,e.create(t,s,o,n)}function Ga(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 Ya(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ke(e,t.position)}function Ja(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=tn,e.schema=a),e.ancestors.push(t);const s=t.name===null?e.Fragment:Dr(e,t.name,!0),o=ts(e,t),l=an(e,t);return zr(e,o,s,t),rn(o,l),e.ancestors.pop(),e.schema=i,e.create(t,s,o,n)}function Xa(e,t,n){const i={};return rn(i,an(e,t)),e.create(t,e.Fragment,i,n)}function Qa(e,t){return t.value}function zr(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function rn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Ka(e,t,n){return i;function i(a,s,o,l){const c=Array.isArray(o.children)?n:t;return l?c(s,o,l):c(s,o)}}function Za(e,t){return n;function n(i,a,s,o){const l=Array.isArray(s.children),u=za(i);return t(a,s,o,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function es(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&nn.call(t.properties,a)){const s=ns(e,a,t.properties[a]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Va.has(t.tagName)?i=l:n[o]=l}}if(i){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function ts(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const s=i.data.estree.body[0];s.type;const o=s.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 a=i.name;let s;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,s=e.evaluater.evaluateExpression(l.expression)}else Ke(e,t.position);else s=i.value===null?!0:i.value;n[a]=s}return n}function an(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:qa;for(;++i<t.children.length;){const s=t.children[i];let o;if(e.passKeys){const u=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(u){const c=a.get(u)||0;o=u+"-"+c,a.set(u,c+1)}}const l=Or(e,s,o);l!==void 0&&n.push(l)}return n}function ns(e,t,n){const i=Ca(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?fa(n):Ta(n)),i.property==="style"){let a=typeof n=="object"?n:rs(e,String(n));return e.stylePropertyNameCase==="css"&&(a=is(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?ja[i.property]||i.property:i.attribute,n]}}function rs(e,t){try{return Oa(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new le("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Rr+"#cannot-parse-style-attribute",a}}function Dr(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let s=-1,o;for(;++s<a.length;){const l=jn(a[s])?{type:"Identifier",name:a[s]}:{type:"Literal",value:a[s]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(s&&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 a=i.value;return nn.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Ke(e)}function Ke(e,t){const n=new le("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 is(e){const t={};let n;for(n in e)nn.call(e,n)&&(t[as(n)]=e[n]);return t}function as(e){let t=e.replace(Ua,ss);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function ss(e){return"-"+e.toLowerCase()}const It={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"]},os={};function ls(e,t){const n=os,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Br(e,i,a)}function Br(e,t,n){if(cs(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 a=-1;for(;++a<e.length;)i[a]=Br(e[a],t,n);return i.join("")}function cs(e){return!!(e&&typeof e=="object")}const Ln=document.createElement("i");function sn(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 a=e.length;let s=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a: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);s<i.length;)o=i.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function xe(e,t){return e.length>0?(Se(e,e.length,0,t),e):t}const Rn={}.hasOwnProperty;function us(e){const t={};let n=-1;for(;++n<e.length;)ds(t,e[n]);return t}function ds(e,t){let n;for(n in t){const a=(Rn.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){Rn.call(a,o)||(a[o]=[]);const l=s[o];ms(a[o],Array.isArray(l)?l:l?[l]:[])}}}function ms(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 De(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const je=Te(/[A-Za-z]/),ge=Te(/[\dA-Za-z]/),ps=Te(/[#-'*+\--9=?A-Z^-~]/);function Wt(e){return e!==null&&(e<32||e===127)}const $t=Te(/\d/),hs=Te(/[\dA-Fa-f]/),fs=Te(/[!-/:-@[-`{-~]/);function V(e){return e!==null&&e<-2}function de(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}const gs=Te(new RegExp("\\p{P}|\\p{S}","u")),xs=Te(/\s/);function Te(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function qe(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&ge(e.charCodeAt(n+1))&&ge(e.charCodeAt(n+2)))a=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),a=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(i,n),encodeURIComponent(o)),i=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(i)}function ee(e,t,n,i){const a=i?i-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(u){return Q(u)?(e.enter(n),l(u)):t(u)}function l(u){return Q(u)&&s++<a?(e.consume(u),l):(e.exit(n),t(u))}}const ys={tokenize:bs};function bs(e){const t=e.attempt(this.parser.constructs.contentInitial,i,a);let n;return t;function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),ee(e,t,"linePrefix")}function a(l){return e.enter("paragraph"),s(l)}function s(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 V(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const _s={tokenize:vs},On={tokenize:ws};function vs(e){const t=this,n=[];let i=0,a,s,o;return l;function l(w){if(i<n.length){const L=n[i];return t.containerState=L[1],e.attempt(L[0].continuation,u,c)(w)}return c(w)}function u(w){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&y();const L=t.events.length;let O=L,b;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){b=t.events[O][1].end;break}f(i);let P=L;for(;P<t.events.length;)t.events[P][1].end={...b},P++;return Se(t.events,O+1,0,t.events.slice(L)),t.events.length=P,c(w)}return l(w)}function c(w){if(i===n.length){if(!a)return h(w);if(a.currentConstruct&&a.currentConstruct.concrete)return k(w);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(On,d,m)(w)}function d(w){return a&&y(),f(i),h(w)}function m(w){return t.parser.lazy[t.now().line]=i!==n.length,o=t.now().offset,k(w)}function h(w){return t.containerState={},e.attempt(On,p,k)(w)}function p(w){return i++,n.push([t.currentConstruct,t.containerState]),h(w)}function k(w){if(w===null){a&&y(),f(0),e.consume(w);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:s}),v(w)}function v(w){if(w===null){N(e.exit("chunkFlow"),!0),f(0),e.consume(w);return}return V(w)?(e.consume(w),N(e.exit("chunkFlow")),i=0,t.interrupt=void 0,l):(e.consume(w),v)}function N(w,L){const O=t.sliceStream(w);if(L&&O.push(null),w.previous=s,s&&(s.next=w),s=w,a.defineSkip(w.start),a.write(O),t.parser.lazy[w.start.line]){let b=a.events.length;for(;b--;)if(a.events[b][1].start.offset<o&&(!a.events[b][1].end||a.events[b][1].end.offset>o))return;const P=t.events.length;let q=P,z,U;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if(z){U=t.events[q][1].end;break}z=!0}for(f(i),b=P;b<t.events.length;)t.events[b][1].end={...U},b++;Se(t.events,q+1,0,t.events.slice(P)),t.events.length=b}}function f(w){let L=n.length;for(;L-- >w;){const O=n[L];t.containerState=O[1],O[0].exit.call(t,e)}n.length=w}function y(){a.write([null]),s=void 0,a=void 0,t.containerState._closeFlow=void 0}}function ws(e,t,n){return ee(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function zn(e){if(e===null||de(e)||xs(e))return 1;if(gs(e))return 2}function on(e,t,n){const i=[];let a=-1;for(;++a<e.length;){const s=e[a].resolveAll;s&&!i.includes(s)&&(t=s(t,n),i.push(s))}return t}const Gt={name:"attention",resolveAll:ks,tokenize:js};function ks(e,t){let n=-1,i,a,s,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},s={type:u>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},a={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=xe(c,[["enter",e[i][1],t],["exit",e[i][1],t]])),c=xe(c,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=xe(c,on(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),c=xe(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=xe(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 js(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=zn(i);let s;return o;function o(u){return s=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===s)return e.consume(u),l;const c=e.exit("attentionSequence"),d=zn(u),m=!d||d===2&&a||n.includes(u),h=!a||a===2&&d||n.includes(i);return c._open=!!(s===42?m:m&&(a||!h)),c._close=!!(s===42?h:h&&(d||!m)),t(u)}}function Dn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Ss={name:"autolink",tokenize:Ns};function Ns(e,t,n){let i=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return je(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||ge(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||ge(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||Wt(p)?n(p):(e.consume(p),u)}function c(p){return p===64?(e.consume(p),d):ps(p)?(e.consume(p),c):n(p)}function d(p){return ge(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||ge(p))&&i++<63){const k=p===45?h:m;return e.consume(p),k}return n(p)}}const ht={partial:!0,tokenize:Cs};function Cs(e,t,n){return i;function i(s){return Q(s)?ee(e,a,"linePrefix")(s):a(s)}function a(s){return s===null||V(s)?t(s):n(s)}}const Ur={continuation:{tokenize:Es},exit:Is,name:"blockQuote",tokenize:As};function As(e,t,n){const i=this;return a;function a(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"),s}return n(o)}function s(o){return Q(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Es(e,t,n){const i=this;return a;function a(o){return Q(o)?ee(e,s,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(Ur,t,n)(o)}}function Is(e){e.exit("blockQuote")}const Hr={name:"characterEscape",tokenize:Ts};function Ts(e,t,n){return i;function i(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),a}function a(s){return fs(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Vr={name:"characterReference",tokenize:Ps};function Ps(e,t,n){const i=this;let a=0,s,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"),s=31,o=ge,d(m))}function c(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=hs,d):(e.enter("characterReferenceValue"),s=7,o=$t,d(m))}function d(m){if(m===59&&a){const h=e.exit("characterReferenceValue");return o===ge&&!sn(i.sliceSerialize(h))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(m)&&a++<s?(e.consume(m),d):n(m)}}const Bn={partial:!0,tokenize:Fs},qn={concrete:!0,name:"codeFenced",tokenize:Ms};function Ms(e,t,n){const i=this,a={partial:!0,tokenize:O};let s=0,o=0,l;return u;function u(b){return c(b)}function c(b){const P=i.events[i.events.length-1];return s=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,l=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(b)}function d(b){return b===l?(o++,e.consume(b),d):o<3?n(b):(e.exit("codeFencedFenceSequence"),Q(b)?ee(e,m,"whitespace")(b):m(b))}function m(b){return b===null||V(b)?(e.exit("codeFencedFence"),i.interrupt?t(b):e.check(Bn,v,L)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(b))}function h(b){return b===null||V(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(b)):Q(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ee(e,p,"whitespace")(b)):b===96&&b===l?n(b):(e.consume(b),h)}function p(b){return b===null||V(b)?m(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(b))}function k(b){return b===null||V(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(b)):b===96&&b===l?n(b):(e.consume(b),k)}function v(b){return e.attempt(a,L,N)(b)}function N(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),f}function f(b){return s>0&&Q(b)?ee(e,y,"linePrefix",s+1)(b):y(b)}function y(b){return b===null||V(b)?e.check(Bn,v,L)(b):(e.enter("codeFlowValue"),w(b))}function w(b){return b===null||V(b)?(e.exit("codeFlowValue"),y(b)):(e.consume(b),w)}function L(b){return e.exit("codeFenced"),t(b)}function O(b,P,q){let z=0;return U;function U(B){return b.enter("lineEnding"),b.consume(B),b.exit("lineEnding"),A}function A(B){return b.enter("codeFencedFence"),Q(B)?ee(b,_,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):_(B)}function _(B){return B===l?(b.enter("codeFencedFenceSequence"),C(B)):q(B)}function C(B){return B===l?(z++,b.consume(B),C):z>=o?(b.exit("codeFencedFenceSequence"),Q(B)?ee(b,T,"whitespace")(B):T(B)):q(B)}function T(B){return B===null||V(B)?(b.exit("codeFencedFence"),P(B)):q(B)}}}function Fs(e,t,n){const i=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}const Tt={name:"codeIndented",tokenize:Rs},Ls={partial:!0,tokenize:Os};function Rs(e,t,n){const i=this;return a;function a(c){return e.enter("codeIndented"),ee(e,s,"linePrefix",5)(c)}function s(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):V(c)?e.attempt(Ls,o,u)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||V(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function u(c){return e.exit("codeIndented"),t(c)}}function Os(e,t,n){const i=this;return a;function a(o){return i.parser.lazy[i.now().line]?n(o):V(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):ee(e,s,"linePrefix",5)(o)}function s(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):V(o)?a(o):n(o)}}const zs={name:"codeText",previous:Bs,resolve:Ds,tokenize:qs};function Ds(e){let t=e.length-4,n=3,i,a;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;)a===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(a=i):(i===t||e[i][1].type==="lineEnding")&&(e[a][1].type="codeTextData",i!==a+2&&(e[a][1].end=e[i-1][1].end,e.splice(a+2,i-a-2),t-=i-a-2,i=a+2),a=void 0);return e}function Bs(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function qs(e,t,n){let i=0,a,s;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?(s=e.enter("codeTextSequence"),a=0,d(m)):V(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||V(m)?(e.exit("codeTextData"),u(m)):(e.consume(m),c)}function d(m){return m===96?(e.consume(m),a++,d):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(s.type="codeTextData",c(m))}}class Us{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 a=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&$e(this.left,i),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),$e(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),$e(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);$e(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);$e(this.left,n.reverse())}}}function $e(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,a,s,o,l,u,c;const d=new Us(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,s=0,s<u.length&&u[s][1].type==="lineEndingBlank"&&(s+=2),s<u.length&&u[s][1].type==="content"))for(;++s<u.length&&u[s][1].type!=="content";)u[s][1].type==="chunkText"&&(u[s][1]._isInFirstContentOfListItem=!0,s++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,Hs(d,n)),n=t[n],c=!0);else if(i[1]._container){for(s=n,a=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(i[1].end={...d.get(a)[1].start},l=d.slice(a,n),l.unshift(i),d.splice(a,n-a+1,l))}}return Se(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function Hs(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const s=[];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,k=0,v=0;const N=[v];for(;p;){for(;e.get(++a)[1]!==p;);s.push(a),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&&(v=h+1,N.push(v),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):N.pop(),h=N.length;h--;){const f=l.slice(N[h],N[h+1]),y=s.pop();u.push([y,y+f.length-1]),e.splice(y,2,f)}for(u.reverse(),h=-1;++h<u.length;)c[k+u[h][0]]=k+u[h][1],k+=u[h][1]-u[h][0]-1;return c}const Vs={resolve:$s,tokenize:Gs},Ws={partial:!0,tokenize:Ys};function $s(e){return Wr(e),e}function Gs(e,t){let n;return i;function i(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?s(l):V(l)?e.check(Ws,o,s)(l):(e.consume(l),a)}function s(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,a}}function Ys(e,t,n){const i=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ee(e,s,"linePrefix")}function s(o){if(o===null||V(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 $r(e,t,n,i,a,s,o,l,u){const c=u||Number.POSITIVE_INFINITY;let d=0;return m;function m(f){return f===60?(e.enter(i),e.enter(a),e.enter(s),e.consume(f),e.exit(s),h):f===null||f===32||f===41||Wt(f)?n(f):(e.enter(i),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),v(f))}function h(f){return f===62?(e.enter(s),e.consume(f),e.exit(s),e.exit(a),e.exit(i),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(f))}function p(f){return f===62?(e.exit("chunkString"),e.exit(l),h(f)):f===null||f===60||V(f)?n(f):(e.consume(f),f===92?k:p)}function k(f){return f===60||f===62||f===92?(e.consume(f),p):p(f)}function v(f){return!d&&(f===null||f===41||de(f))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(i),t(f)):d<c&&f===40?(e.consume(f),d++,v):f===41?(e.consume(f),d--,v):f===null||f===32||f===40||Wt(f)?n(f):(e.consume(f),f===92?N:v)}function N(f){return f===40||f===41||f===92?(e.consume(f),v):v(f)}}function Gr(e,t,n,i,a,s){const o=this;let l=0,u;return c;function c(p){return e.enter(i),e.enter(a),e.consume(p),e.exit(a),e.enter(s),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(s),e.enter(a),e.consume(p),e.exit(a),e.exit(i),t):V(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||V(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),u||(u=!Q(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,a,s){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(i),e.enter(a),e.consume(h),e.exit(a),o=h===40?41:h,u):n(h)}function u(h){return h===o?(e.enter(a),e.consume(h),e.exit(a),e.exit(i),t):(e.enter(s),c(h))}function c(h){return h===o?(e.exit(s),u(o)):h===null?n(h):V(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),ee(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===o||h===null||V(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 Je(e,t){let n;return i;function i(a){return V(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):Q(a)?ee(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const Js={name:"definition",tokenize:Qs},Xs={partial:!0,tokenize:Ks};function Qs(e,t,n){const i=this;let a;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return Gr.call(i,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return a=De(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 de(p)?Je(e,c)(p):c(p)}function c(p){return $r(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Xs,m,m)(p)}function m(p){return Q(p)?ee(e,h,"whitespace")(p):h(p)}function h(p){return p===null||V(p)?(e.exit("definition"),i.parser.defined.push(a),t(p)):n(p)}}function Ks(e,t,n){return i;function i(l){return de(l)?Je(e,a)(l):n(l)}function a(l){return Yr(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Q(l)?ee(e,o,"whitespace")(l):o(l)}function o(l){return l===null||V(l)?t(l):n(l)}}const Zs={name:"hardBreakEscape",tokenize:eo};function eo(e,t,n){return i;function i(s){return e.enter("hardBreakEscape"),e.consume(s),a}function a(s){return V(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const to={name:"headingAtx",resolve:no,tokenize:ro};function no(e,t){let n=e.length-2,i=3,a,s;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&&(a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},s={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},Se(e,i,n-i+1,[["enter",a,t],["enter",s,t],["exit",s,t],["exit",a,t]])),e}function ro(e,t,n){let i=0;return a;function a(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&i++<6?(e.consume(d),o):d===null||de(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||V(d)?(e.exit("atxHeading"),t(d)):Q(d)?ee(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||de(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),c)}}const io=["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:lo,tokenize:co},so={partial:!0,tokenize:mo},oo={partial:!0,tokenize:uo};function lo(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 co(e,t,n){const i=this;let a,s,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),s=!0,v):x===63?(e.consume(x),a=3,i.interrupt?t:g):je(x)?(e.consume(x),o=String.fromCharCode(x),N):n(x)}function h(x){return x===45?(e.consume(x),a=2,p):x===91?(e.consume(x),a=5,l=0,k):je(x)?(e.consume(x),a=4,i.interrupt?t:g):n(x)}function p(x){return x===45?(e.consume(x),i.interrupt?t:g):n(x)}function k(x){const se="CDATA[";return x===se.charCodeAt(l++)?(e.consume(x),l===se.length?i.interrupt?t:_:k):n(x)}function v(x){return je(x)?(e.consume(x),o=String.fromCharCode(x),N):n(x)}function N(x){if(x===null||x===47||x===62||de(x)){const se=x===47,be=o.toLowerCase();return!se&&!s&&Un.includes(be)?(a=1,i.interrupt?t(x):_(x)):io.includes(o.toLowerCase())?(a=6,se?(e.consume(x),f):i.interrupt?t(x):_(x)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(x):s?y(x):w(x))}return x===45||ge(x)?(e.consume(x),o+=String.fromCharCode(x),N):n(x)}function f(x){return x===62?(e.consume(x),i.interrupt?t:_):n(x)}function y(x){return Q(x)?(e.consume(x),y):U(x)}function w(x){return x===47?(e.consume(x),U):x===58||x===95||je(x)?(e.consume(x),L):Q(x)?(e.consume(x),w):U(x)}function L(x){return x===45||x===46||x===58||x===95||ge(x)?(e.consume(x),L):O(x)}function O(x){return x===61?(e.consume(x),b):Q(x)?(e.consume(x),O):w(x)}function b(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),u=x,P):Q(x)?(e.consume(x),b):q(x)}function P(x){return x===u?(e.consume(x),u=null,z):x===null||V(x)?n(x):(e.consume(x),P)}function q(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||de(x)?O(x):(e.consume(x),q)}function z(x){return x===47||x===62||Q(x)?w(x):n(x)}function U(x){return x===62?(e.consume(x),A):n(x)}function A(x){return x===null||V(x)?_(x):Q(x)?(e.consume(x),A):n(x)}function _(x){return x===45&&a===2?(e.consume(x),K):x===60&&a===1?(e.consume(x),F):x===62&&a===4?(e.consume(x),X):x===63&&a===3?(e.consume(x),g):x===93&&a===5?(e.consume(x),J):V(x)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(so,te,C)(x)):x===null||V(x)?(e.exit("htmlFlowData"),C(x)):(e.consume(x),_)}function C(x){return e.check(oo,T,te)(x)}function T(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),B}function B(x){return x===null||V(x)?C(x):(e.enter("htmlFlowData"),_(x))}function K(x){return x===45?(e.consume(x),g):_(x)}function F(x){return x===47?(e.consume(x),o="",D):_(x)}function D(x){if(x===62){const se=o.toLowerCase();return Un.includes(se)?(e.consume(x),X):_(x)}return je(x)&&o.length<8?(e.consume(x),o+=String.fromCharCode(x),D):_(x)}function J(x){return x===93?(e.consume(x),g):_(x)}function g(x){return x===62?(e.consume(x),X):x===45&&a===2?(e.consume(x),g):_(x)}function X(x){return x===null||V(x)?(e.exit("htmlFlowData"),te(x)):(e.consume(x),X)}function te(x){return e.exit("htmlFlow"),t(x)}}function uo(e,t,n){const i=this;return a;function a(o){return V(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return i.parser.lazy[i.now().line]?n(o):t(o)}}function mo(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ht,t,n)}}const po={name:"htmlText",tokenize:ho};function ho(e,t,n){const i=this;let a,s,o;return l;function l(g){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(g),u}function u(g){return g===33?(e.consume(g),c):g===47?(e.consume(g),O):g===63?(e.consume(g),w):je(g)?(e.consume(g),q):n(g)}function c(g){return g===45?(e.consume(g),d):g===91?(e.consume(g),s=0,k):je(g)?(e.consume(g),y):n(g)}function d(g){return g===45?(e.consume(g),p):n(g)}function m(g){return g===null?n(g):g===45?(e.consume(g),h):V(g)?(o=m,F(g)):(e.consume(g),m)}function h(g){return g===45?(e.consume(g),p):m(g)}function p(g){return g===62?K(g):g===45?h(g):m(g)}function k(g){const X="CDATA[";return g===X.charCodeAt(s++)?(e.consume(g),s===X.length?v:k):n(g)}function v(g){return g===null?n(g):g===93?(e.consume(g),N):V(g)?(o=v,F(g)):(e.consume(g),v)}function N(g){return g===93?(e.consume(g),f):v(g)}function f(g){return g===62?K(g):g===93?(e.consume(g),f):v(g)}function y(g){return g===null||g===62?K(g):V(g)?(o=y,F(g)):(e.consume(g),y)}function w(g){return g===null?n(g):g===63?(e.consume(g),L):V(g)?(o=w,F(g)):(e.consume(g),w)}function L(g){return g===62?K(g):w(g)}function O(g){return je(g)?(e.consume(g),b):n(g)}function b(g){return g===45||ge(g)?(e.consume(g),b):P(g)}function P(g){return V(g)?(o=P,F(g)):Q(g)?(e.consume(g),P):K(g)}function q(g){return g===45||ge(g)?(e.consume(g),q):g===47||g===62||de(g)?z(g):n(g)}function z(g){return g===47?(e.consume(g),K):g===58||g===95||je(g)?(e.consume(g),U):V(g)?(o=z,F(g)):Q(g)?(e.consume(g),z):K(g)}function U(g){return g===45||g===46||g===58||g===95||ge(g)?(e.consume(g),U):A(g)}function A(g){return g===61?(e.consume(g),_):V(g)?(o=A,F(g)):Q(g)?(e.consume(g),A):z(g)}function _(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),a=g,C):V(g)?(o=_,F(g)):Q(g)?(e.consume(g),_):(e.consume(g),T)}function C(g){return g===a?(e.consume(g),a=void 0,B):g===null?n(g):V(g)?(o=C,F(g)):(e.consume(g),C)}function T(g){return g===null||g===34||g===39||g===60||g===61||g===96?n(g):g===47||g===62||de(g)?z(g):(e.consume(g),T)}function B(g){return g===47||g===62||de(g)?z(g):n(g)}function K(g){return g===62?(e.consume(g),e.exit("htmlTextData"),e.exit("htmlText"),t):n(g)}function F(g){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),D}function D(g){return Q(g)?ee(e,J,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):J(g)}function J(g){return e.enter("htmlTextData"),o(g)}}const ln={name:"labelEnd",resolveAll:yo,resolveTo:bo,tokenize:_o},fo={tokenize:vo},go={tokenize:wo},xo={tokenize:ko};function yo(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 a=i.type==="labelImage"?4:2;i.type="data",t+=a}}return e.length!==n.length&&Se(e,0,e.length,n),e}function bo(e,t){let n=e.length,i=0,a,s,o,l;for(;n--;)if(a=e[n][1],s){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(s=n,a.type!=="labelLink")){i=2;break}}else a.type==="labelEnd"&&(o=n);const u={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[s+i+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",u,t],["enter",c,t]],l=xe(l,e.slice(s+1,s+i+3)),l=xe(l,[["enter",d,t]]),l=xe(l,on(t.parser.constructs.insideSpan.null,e.slice(s+i+4,o-3),t)),l=xe(l,[["exit",d,t],e[o-2],e[o-1],["exit",c,t]]),l=xe(l,e.slice(o+1)),l=xe(l,[["exit",u,t]]),Se(e,s,e.length,l),e}function _o(e,t,n){const i=this;let a=i.events.length,s,o;for(;a--;)if((i.events[a][1].type==="labelImage"||i.events[a][1].type==="labelLink")&&!i.events[a][1]._balanced){s=i.events[a][1];break}return l;function l(h){return s?s._inactive?m(h):(o=i.parser.defined.includes(De(i.sliceSerialize({start:s.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(fo,d,o?d:m)(h):h===91?e.attempt(go,d,o?c:m)(h):o?d(h):m(h)}function c(h){return e.attempt(xo,d,m)(h)}function d(h){return t(h)}function m(h){return s._balanced=!0,n(h)}}function vo(e,t,n){return i;function i(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return de(m)?Je(e,s)(m):s(m)}function s(m){return m===41?d(m):$r(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return de(m)?Je(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 de(m)?Je(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 wo(e,t,n){const i=this;return a;function a(l){return Gr.call(i,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return i.parser.defined.includes(De(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function ko(e,t,n){return i;function i(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),a}function a(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const jo={name:"labelStartImage",resolveAll:ln.resolveAll,tokenize:So};function So(e,t,n){const i=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(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 No={name:"labelStartLink",resolveAll:ln.resolveAll,tokenize:Co};function Co(e,t,n){const i=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(o):t(o)}}const Pt={name:"lineEnding",tokenize:Ao};function Ao(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),ee(e,t,"linePrefix")}}const dt={name:"thematicBreak",tokenize:Eo};function Eo(e,t,n){let i=0,a;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return a=c,l(c)}function l(c){return c===a?(e.enter("thematicBreakSequence"),u(c)):i>=3&&(c===null||V(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===a?(e.consume(c),i++,u):(e.exit("thematicBreakSequence"),Q(c)?ee(e,l,"whitespace")(c):l(c))}}const ce={continuation:{tokenize:Mo},exit:Lo,name:"list",tokenize:Po},Io={partial:!0,tokenize:Ro},To={partial:!0,tokenize:Fo};function Po(e,t,n){const i=this,a=i.events[i.events.length-1];let s=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return l;function l(p){const k=i.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!i.containerState.marker||p===i.containerState.marker:$t(p)){if(i.containerState.type||(i.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(dt,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 $t(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(ht,i.interrupt?n:d,e.attempt(Io,h,m))}function d(p){return i.containerState.initialBlankLine=!0,s++,h(p)}function m(p){return Q(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return i.containerState.size=s+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Mo(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(ht,a,s);function a(l){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,ee(e,t,"listItemIndent",i.containerState.size+1)(l)}function s(l){return i.containerState.furtherBlankLines||!Q(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(To,t,o)(l))}function o(l){return i.containerState._closeFlow=!0,i.interrupt=void 0,ee(e,e.attempt(ce,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Fo(e,t,n){const i=this;return ee(e,a,"listItemIndent",i.containerState.size+1);function a(s){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(s):n(s)}}function Lo(e){e.exit(this.containerState.type)}function Ro(e,t,n){const i=this;return ee(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(s){const o=i.events[i.events.length-1];return!Q(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Hn={name:"setextUnderline",resolveTo:Oo,tokenize:zo};function Oo(e,t){let n=e.length,i,a,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",s?(e.splice(a,0,["enter",o,t]),e.splice(s+1,0,["exit",e[i][1],t]),e[i][1].end={...e[s][1].end}):e[i][1]=o,e.push(["exit",o,t]),e}function zo(e,t,n){const i=this;let a;return s;function s(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"),a=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===a?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),Q(c)?ee(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||V(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const Do={tokenize:Bo};function Bo(e){const t=this,n=e.attempt(ht,i,e.attempt(this.parser.constructs.flowInitial,a,ee(e,e.attempt(this.parser.constructs.flow,a,e.attempt(Vs,a)),"linePrefix")));return n;function i(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const qo={resolveAll:Xr()},Uo=Jr("string"),Ho=Jr("text");function Jr(e){return{resolveAll:Xr(e==="text"?Vo:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],s=n.attempt(a,o,l);return o;function o(d){return c(d)?s(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"),s(d)):(n.consume(d),u)}function c(d){if(d===null)return!0;const m=a[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 Xr(e){return t;function t(n,i){let a=-1,s;for(;++a<=n.length;)s===void 0?n[a]&&n[a][1].type==="data"&&(s=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==s+2&&(n[s][1].end=n[a-1][1].end,n.splice(s+2,a-s-2),a=s+2),s=void 0);return e?e(n,i):n}}function Vo(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],a=t.sliceStream(i);let s=a.length,o=-1,l=0,u;for(;s--;){const c=a[s];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){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const c={type:n===e.length||u||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:i.start._bufferIndex+o,_index:i.start._index+s,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 Wo={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},$o={91:Js},Go={[-2]:Tt,[-1]:Tt,32:Tt},Yo={35:to,42:dt,45:[Hn,dt],60:ao,61:Hn,95:dt,96:qn,126:qn},Jo={38:Vr,92:Hr},Xo={[-5]:Pt,[-4]:Pt,[-3]:Pt,33:jo,38:Vr,42:Gt,60:[Ss,po],91:No,92:[Zs,Hr],93:ln,95:Gt,96:zs},Qo={null:[Gt,qo]},Ko={null:[42,95]},Zo={null:[]},el=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Ko,contentInitial:$o,disable:Zo,document:Wo,flow:Yo,flowInitial:Go,insideSpan:Qo,string:Jo,text:Xo},Symbol.toStringTag,{value:"Module"}));function tl(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 a={},s=[];let o=[],l=[];const u={attempt:P(O),check:P(b),consume:y,enter:w,exit:L,interrupt:P(b,{interrupt:!0})},c={code:null,containerState:{},defineSkip:v,events:[],now:k,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:m};let d=t.tokenize.call(c,u);return t.resolveAll&&s.push(t),c;function m(A){return o=xe(o,A),N(),o[o.length-1]!==null?[]:(q(t,0),c.events=on(s,c.events,c),c.events)}function h(A,_){return rl(p(A),_)}function p(A){return nl(o,A)}function k(){const{_bufferIndex:A,_index:_,line:C,column:T,offset:B}=i;return{_bufferIndex:A,_index:_,line:C,column:T,offset:B}}function v(A){a[A.line]=A.column,U()}function N(){let A;for(;i._index<o.length;){const _=o[i._index];if(typeof _=="string")for(A=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===A&&i._bufferIndex<_.length;)f(_.charCodeAt(i._bufferIndex));else f(_)}}function f(A){d=d(A)}function y(A){V(A)?(i.line++,i.column=1,i.offset+=A===-3?2:1,U()):A!==-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=A}function w(A,_){const C=_||{};return C.type=A,C.start=k(),c.events.push(["enter",C,c]),l.push(C),C}function L(A){const _=l.pop();return _.end=k(),c.events.push(["exit",_,c]),_}function O(A,_){q(A,_.from)}function b(A,_){_.restore()}function P(A,_){return C;function C(T,B,K){let F,D,J,g;return Array.isArray(T)?te(T):"tokenize"in T?te([T]):X(T);function X(ie){return Ee;function Ee(_e){const Ne=_e!==null&&ie[_e],ve=_e!==null&&ie.null,Pe=[...Array.isArray(Ne)?Ne:Ne?[Ne]:[],...Array.isArray(ve)?ve:ve?[ve]:[]];return te(Pe)(_e)}}function te(ie){return F=ie,D=0,ie.length===0?K:x(ie[D])}function x(ie){return Ee;function Ee(_e){return g=z(),J=ie,ie.partial||(c.currentConstruct=ie),ie.name&&c.parser.constructs.disable.null.includes(ie.name)?be():ie.tokenize.call(_?Object.assign(Object.create(c),_):c,u,se,be)(_e)}}function se(ie){return A(J,g),B}function be(ie){return g.restore(),++D<F.length?x(F[D]):K}}}function q(A,_){A.resolveAll&&!s.includes(A)&&s.push(A),A.resolve&&Se(c.events,_,c.events.length-_,A.resolve(c.events.slice(_),c)),A.resolveTo&&(c.events=A.resolveTo(c.events,c))}function z(){const A=k(),_=c.previous,C=c.currentConstruct,T=c.events.length,B=Array.from(l);return{from:T,restore:K};function K(){i=A,c.previous=_,c.currentConstruct=C,c.events.length=T,l=B,U()}}function U(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function nl(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,s=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(i,s)];else{if(o=e.slice(n,a),i>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(i):o.shift()}s>0&&o.push(e[a].slice(0,s))}return o}function rl(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(s)}a=s===-2,i.push(o)}return i.join("")}function il(e){const i={constructs:us([el,...(e||{}).extensions||[]]),content:a(ys),defined:[],document:a(_s),flow:a(Do),lazy:{},string:a(Uo),text:a(Ho)};return i;function a(s){return o;function o(l){return tl(i,s,l)}}}function al(e){for(;!Wr(e););return e}const Vn=/[\0\t\n\r]/g;function sl(){let e=1,t="",n=!0,i;return a;function a(s,o,l){const u=[];let c,d,m,h,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),m=0,t="",n&&(s.charCodeAt(0)===65279&&m++,n=void 0);m<s.length;){if(Vn.lastIndex=m,c=Vn.exec(s),h=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(h),!c){t=s.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(s.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 ol=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ll(e){return e.replace(ol,cl)}function cl(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),s=a===120||a===88;return qr(n.slice(s?2:1),s?16:10)}return sn(n)||e}function Xe(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?Yt(e):""}function Yt(e){return $n(e&&e.line)+":"+$n(e&&e.column)}function Wn(e){return Yt(e&&e.start)+"-"+Yt(e&&e.end)}function $n(e){return e&&typeof e=="number"?e:1}const Qr={}.hasOwnProperty;function ul(e,t,n){return typeof t!="string"&&(n=t,t=void 0),dl(n)(al(il(n).document().write(sl()(e,t,!0))))}function dl(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(it),autolinkProtocol:z,autolinkEmail:z,atxHeading:s(tt),blockQuote:s(ve),characterEscape:z,characterReference:z,codeFenced:s(Pe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Pe,o),codeText:s(xt,o),codeTextData:z,data:z,codeFlowValue:z,definition:s(yt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(bt),hardBreakEscape:s(nt),hardBreakTrailing:s(nt),htmlFlow:s(rt,o),htmlFlowData:z,htmlText:s(rt,o),htmlTextData:z,image:s(_t),label:o,link:s(it),listItem:s(vt),listItemValue:h,listOrdered:s(at,m),listUnordered:s(at),paragraph:s(wt),reference:x,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(tt),strong:s(kt),thematicBreak:s(St)},exit:{atxHeading:u(),atxHeadingSequence:O,autolink:u(),autolinkEmail:Ne,autolinkProtocol:_e,blockQuote:u(),characterEscapeValue:U,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:ie,characterReference:Ee,codeFenced:u(N),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:k,codeFlowValue:U,codeIndented:u(f),codeText:u(B),codeTextData:U,data:U,definition:u(),definitionDestinationString:L,definitionLabelString:y,definitionTitleString:w,emphasis:u(),hardBreakEscape:u(_),hardBreakTrailing:u(_),htmlFlow:u(C),htmlFlowData:U,htmlText:u(T),htmlTextData:U,image:u(F),label:J,labelText:D,lineEnding:A,link:u(K),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:se,resourceDestinationString:g,resourceTitleString:X,resource:te,setextHeading:u(q),setextHeadingLineSequence:P,setextHeadingText:b,strong:u(),thematicBreak:u()}};Kr(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(S){let R={type:"root",children:[]};const W={stack:[R],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:d,data:n},G=[];let I=-1;for(;++I<S.length;)if(S[I][1].type==="listOrdered"||S[I][1].type==="listUnordered")if(S[I][0]==="enter")G.push(I);else{const ne=G.pop();I=a(S,ne,I)}for(I=-1;++I<S.length;){const ne=t[S[I][0]];Qr.call(ne,S[I][1].type)&&ne[S[I][1].type].call(Object.assign({sliceSerialize:S[I][2].sliceSerialize},W),S[I][1])}if(W.tokenStack.length>0){const ne=W.tokenStack[W.tokenStack.length-1];(ne[1]||Gn).call(W,void 0,ne[0])}for(R.position={start:Ie(S.length>0?S[0][1].start:{line:1,column:1,offset:0}),end:Ie(S.length>0?S[S.length-2][1].end:{line:1,column:1,offset:0})},I=-1;++I<t.transforms.length;)R=t.transforms[I](R)||R;return R}function a(S,R,W){let G=R-1,I=-1,ne=!1,we,ae,Ue,He;for(;++G<=W;){const he=S[G];switch(he[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{he[0]==="enter"?I++:I--,He=void 0;break}case"lineEndingBlank":{he[0]==="enter"&&(we&&!He&&!I&&!Ue&&(Ue=G),He=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:He=void 0}if(!I&&he[0]==="enter"&&he[1].type==="listItemPrefix"||I===-1&&he[0]==="exit"&&(he[1].type==="listUnordered"||he[1].type==="listOrdered")){if(we){let Le=G;for(ae=void 0;Le--;){const Ce=S[Le];if(Ce[1].type==="lineEnding"||Ce[1].type==="lineEndingBlank"){if(Ce[0]==="exit")continue;ae&&(S[ae][1].type="lineEndingBlank",ne=!0),Ce[1].type="lineEnding",ae=Le}else if(!(Ce[1].type==="linePrefix"||Ce[1].type==="blockQuotePrefix"||Ce[1].type==="blockQuotePrefixWhitespace"||Ce[1].type==="blockQuoteMarker"||Ce[1].type==="listItemIndent"))break}Ue&&(!ae||Ue<ae)&&(we._spread=!0),we.end=Object.assign({},ae?S[ae][1].start:he[1].end),S.splice(ae||G,0,["exit",we,he[2]]),G++,W++}if(he[1].type==="listItemPrefix"){const Le={type:"listItem",_spread:!1,start:Object.assign({},he[1].start),end:void 0};we=Le,S.splice(G,0,["enter",Le,he[2]]),G++,W++,Ue=void 0,He=!0}}}return S[R][1]._spread=ne,W}function s(S,R){return W;function W(G){l.call(this,S(G),G),R&&R.call(this,G)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(S,R,W){this.stack[this.stack.length-1].children.push(S),this.stack.push(S),this.tokenStack.push([R,W||void 0]),S.position={start:Ie(R.start),end:void 0}}function u(S){return R;function R(W){S&&S.call(this,W),c.call(this,W)}}function c(S,R){const W=this.stack.pop(),G=this.tokenStack.pop();if(G)G[0].type!==S.type&&(R?R.call(this,S,G[0]):(G[1]||Gn).call(this,S,G[0]));else throw new Error("Cannot close `"+S.type+"` ("+Xe({start:S.start,end:S.end})+"): it’s not open");W.position.end=Ie(S.end)}function d(){return ls(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(S){if(this.data.expectingFirstListItemValue){const R=this.stack[this.stack.length-2];R.start=Number.parseInt(this.sliceSerialize(S),10),this.data.expectingFirstListItemValue=void 0}}function p(){const S=this.resume(),R=this.stack[this.stack.length-1];R.lang=S}function k(){const S=this.resume(),R=this.stack[this.stack.length-1];R.meta=S}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const S=this.resume(),R=this.stack[this.stack.length-1];R.value=S.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function f(){const S=this.resume(),R=this.stack[this.stack.length-1];R.value=S.replace(/(\r?\n|\r)$/g,"")}function y(S){const R=this.resume(),W=this.stack[this.stack.length-1];W.label=R,W.identifier=De(this.sliceSerialize(S)).toLowerCase()}function w(){const S=this.resume(),R=this.stack[this.stack.length-1];R.title=S}function L(){const S=this.resume(),R=this.stack[this.stack.length-1];R.url=S}function O(S){const R=this.stack[this.stack.length-1];if(!R.depth){const W=this.sliceSerialize(S).length;R.depth=W}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function P(S){const R=this.stack[this.stack.length-1];R.depth=this.sliceSerialize(S).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function z(S){const W=this.stack[this.stack.length-1].children;let G=W[W.length-1];(!G||G.type!=="text")&&(G=jt(),G.position={start:Ie(S.start),end:void 0},W.push(G)),this.stack.push(G)}function U(S){const R=this.stack.pop();R.value+=this.sliceSerialize(S),R.position.end=Ie(S.end)}function A(S){const R=this.stack[this.stack.length-1];if(this.data.atHardBreak){const W=R.children[R.children.length-1];W.position.end=Ie(S.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(R.type)&&(z.call(this,S),U.call(this,S))}function _(){this.data.atHardBreak=!0}function C(){const S=this.resume(),R=this.stack[this.stack.length-1];R.value=S}function T(){const S=this.resume(),R=this.stack[this.stack.length-1];R.value=S}function B(){const S=this.resume(),R=this.stack[this.stack.length-1];R.value=S}function K(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const R=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=R,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function F(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const R=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=R,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function D(S){const R=this.sliceSerialize(S),W=this.stack[this.stack.length-2];W.label=ll(R),W.identifier=De(R).toLowerCase()}function J(){const S=this.stack[this.stack.length-1],R=this.resume(),W=this.stack[this.stack.length-1];if(this.data.inReference=!0,W.type==="link"){const G=S.children;W.children=G}else W.alt=R}function g(){const S=this.resume(),R=this.stack[this.stack.length-1];R.url=S}function X(){const S=this.resume(),R=this.stack[this.stack.length-1];R.title=S}function te(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function se(S){const R=this.resume(),W=this.stack[this.stack.length-1];W.label=R,W.identifier=De(this.sliceSerialize(S)).toLowerCase(),this.data.referenceType="full"}function be(S){this.data.characterReferenceType=S.type}function ie(S){const R=this.sliceSerialize(S),W=this.data.characterReferenceType;let G;W?(G=qr(R,W==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):G=sn(R);const I=this.stack[this.stack.length-1];I.value+=G}function Ee(S){const R=this.stack.pop();R.position.end=Ie(S.end)}function _e(S){U.call(this,S);const R=this.stack[this.stack.length-1];R.url=this.sliceSerialize(S)}function Ne(S){U.call(this,S);const R=this.stack[this.stack.length-1];R.url="mailto:"+this.sliceSerialize(S)}function ve(){return{type:"blockquote",children:[]}}function Pe(){return{type:"code",lang:null,meta:null,value:""}}function xt(){return{type:"inlineCode",value:""}}function yt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function bt(){return{type:"emphasis",children:[]}}function tt(){return{type:"heading",depth:0,children:[]}}function nt(){return{type:"break"}}function rt(){return{type:"html",value:""}}function _t(){return{type:"image",title:null,url:"",alt:null}}function it(){return{type:"link",title:null,url:"",children:[]}}function at(S){return{type:"list",ordered:S.type==="listOrdered",start:null,spread:S._spread,children:[]}}function vt(S){return{type:"listItem",spread:S._spread,checked:null,children:[]}}function wt(){return{type:"paragraph",children:[]}}function kt(){return{type:"strong",children:[]}}function jt(){return{type:"text",value:""}}function St(){return{type:"thematicBreak"}}}function Ie(e){return{line:e.line,column:e.column,offset:e.offset}}function Kr(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?Kr(e,i):ml(e,i)}}function ml(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 Gn(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Xe({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Xe({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Xe({start:t.start,end:t.end})+") is still open")}function pl(e){const t=this;t.parser=n;function n(i){return ul(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function hl(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 fl(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function gl(e,t){const n=t.value?t.value+`
`:"",i={};t.lang&&(i.className=["language-"+t.lang]);let a={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function xl(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yl(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bl(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=qe(i.toLowerCase()),s=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=s+1,l+=1,e.footnoteCounts.set(i,l);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(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 _l(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 vl(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Zr(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 a=e.all(t),s=a[0];s&&s.type==="text"?s.value="["+s.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&o.type==="text"?o.value+=i:a.push({type:"text",value:i}),a}function wl(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Zr(e,t);const a={src:qe(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const s={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,s),e.applyData(t,s)}function kl(e,t){const n={src:qe(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function jl(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 Sl(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Zr(e,t);const a={href:qe(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const s={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Nl(e,t){const n={href:qe(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 Cl(e,t,n){const i=e.all(t),a=n?Al(n):ei(t),s={},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:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<i.length;){const d=i[l];(a||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!a?o.push(...d.children):o.push(d)}const u=i[i.length-1];u&&(a||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function Al(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 El(e,t){const n={},i=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<i.length;){const o=i[a];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 s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function Il(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Tl(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Pl(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 Ml(e){const t=ni(e),n=ti(e);if(t&&n)return{start:t,end:n}}function Fl(e,t){const n=e.all(t),i=n.shift(),a=[];if(i){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],o),a.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}),a.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,s),e.applyData(t,s)}function Ll(e,t,n){const i=n?n.children:void 0,s=(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 k={type:"element",tagName:s,properties:h,children:[]};m&&(k.children=e.all(m),e.patch(m,k),k=e.applyData(m,k)),c.push(k)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function Rl(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,Jn=32;function Ol(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),a=0;const s=[];for(;i;)s.push(Xn(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=n.exec(t);return s.push(Xn(t.slice(a),a>0,!1)),s.join("")}function Xn(e,t,n){let i=0,a=e.length;if(t){let s=e.codePointAt(i);for(;s===Yn||s===Jn;)i++,s=e.codePointAt(i)}if(n){let s=e.codePointAt(a-1);for(;s===Yn||s===Jn;)a--,s=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function zl(e,t){const n={type:"text",value:Ol(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Dl(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Bl={blockquote:hl,break:fl,code:gl,delete:xl,emphasis:yl,footnoteReference:bl,heading:_l,html:vl,imageReference:wl,image:kl,inlineCode:jl,linkReference:Sl,link:Nl,listItem:Cl,list:El,paragraph:Il,root:Tl,strong:Pl,table:Fl,tableCell:Rl,tableRow:Ll,text:zl,thematicBreak:Dl,toml:ot,yaml:ot,definition:ot,footnoteDefinition:ot};function ot(){}const ii=-1,ft=0,Qe=1,mt=2,cn=3,un=4,dn=5,mn=6,ai=7,si=8,Qn=typeof self=="object"?self:globalThis,ql=(e,t)=>{const n=(a,s)=>(e.set(s,a),a),i=a=>{if(e.has(a))return e.get(a);const[s,o]=t[a];switch(s){case ft:case ii:return n(o,a);case Qe:{const l=n([],a);for(const u of o)l.push(i(u));return l}case mt:{const l=n({},a);for(const[u,c]of o)l[i(u)]=i(c);return l}case cn:return n(new Date(o),a);case un:{const{source:l,flags:u}=o;return n(new RegExp(l,u),a)}case dn:{const l=n(new Map,a);for(const[u,c]of o)l.set(i(u),i(c));return l}case mn:{const l=n(new Set,a);for(const u of o)l.add(i(u));return l}case ai:{const{name:l,message:u}=o;return n(new Qn[l](u),a)}case si:return n(BigInt(o),a);case"BigInt":return n(Object(BigInt(o)),a);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[s](o),a)};return i},Kn=e=>ql(new Map,e)(0),Oe="",{toString:Ul}={},{keys:Hl}=Object,Ge=e=>{const t=typeof e;if(t!=="object"||!e)return[ft,t];const n=Ul.call(e).slice(8,-1);switch(n){case"Array":return[Qe,Oe];case"Object":return[mt,Oe];case"Date":return[cn,Oe];case"RegExp":return[un,Oe];case"Map":return[dn,Oe];case"Set":return[mn,Oe];case"DataView":return[Qe,n]}return n.includes("Array")?[Qe,n]:n.includes("Error")?[ai,n]:[mt,n]},lt=([e,t])=>e===ft&&(t==="function"||t==="symbol"),Vl=(e,t,n,i)=>{const a=(o,l)=>{const u=i.push(o)-1;return n.set(l,u),u},s=o=>{if(n.has(o))return n.get(o);let[l,u]=Ge(o);switch(l){case ft:{let d=o;switch(u){case"bigint":l=si,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);d=null;break;case"undefined":return a([ii],o)}return a([l,d],o)}case Qe:{if(u){let h=o;return u==="DataView"?h=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(h=new Uint8Array(o)),a([u,[...h]],o)}const d=[],m=a([l,d],o);for(const h of o)d.push(s(h));return m}case mt:{if(u)switch(u){case"BigInt":return a([u,o.toString()],o);case"Boolean":case"Number":case"String":return a([u,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],m=a([l,d],o);for(const h of Hl(o))(e||!lt(Ge(o[h])))&&d.push([s(h),s(o[h])]);return m}case cn:return a([l,o.toISOString()],o);case un:{const{source:d,flags:m}=o;return a([l,{source:d,flags:m}],o)}case dn:{const d=[],m=a([l,d],o);for(const[h,p]of o)(e||!(lt(Ge(h))||lt(Ge(p))))&&d.push([s(h),s(p)]);return m}case mn:{const d=[],m=a([l,d],o);for(const h of o)(e||!lt(Ge(h)))&&d.push(s(h));return m}}const{message:c}=o;return a([l,{name:u,message:c}],o)};return s},Zn=(e,{json:t,lossy:n}={})=>{const i=[];return Vl(!(t||n),!!t,new Map,i)(e),i},pt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Kn(Zn(e,t)):structuredClone(e):(e,t)=>Kn(Zn(e,t));function Wl(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 $l(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Gl(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Wl,i=e.options.footnoteBackLabel||$l,a=e.options.footnoteLabel||"Footnotes",s=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=qe(m.toLowerCase());let p=0;const k=[],v=e.footnoteCounts.get(m);for(;v!==void 0&&++p<=v;){k.length>0&&k.push({type:"text",value:" "});let y=typeof n=="string"?n:n(u,p);typeof y=="string"&&(y={type:"text",value:y}),k.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(y)?y:[y]})}const N=d[d.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const y=N.children[N.children.length-1];y&&y.type==="text"?y.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(...k)}else d.push(...k);const f={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(c,f),l.push(f)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...pt(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
`}]}}const oi=function(e){if(e==null)return Ql;if(typeof e=="function")return gt(e);if(typeof e=="object")return Array.isArray(e)?Yl(e):Jl(e);if(typeof e=="string")return Xl(e);throw new Error("Expected function, string, or object as test")};function Yl(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=oi(e[n]);return gt(i);function i(...a){let s=-1;for(;++s<t.length;)if(t[s].apply(this,a))return!0;return!1}}function Jl(e){const t=e;return gt(n);function n(i){const a=i;let s;for(s in e)if(a[s]!==t[s])return!1;return!0}}function Xl(e){return gt(t);function t(n){return n&&n.type===e}}function gt(e){return t;function t(n,i,a){return!!(Kl(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function Ql(){return!0}function Kl(e){return e!==null&&typeof e=="object"&&"type"in e}const li=[],Zl=!0,er=!1,ec="skip";function tc(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const s=oi(a),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,k,v,N;if((!t||s(u,c,d[d.length-1]||void 0))&&(p=nc(n(u,d)),p[0]===er))return p;if("children"in u&&u.children){const f=u;if(f.children&&p[0]!==ec)for(v=(i?f.children.length:-1)+o,N=d.concat(f);v>-1&&v<f.children.length;){const y=f.children[v];if(k=l(y,v,N)(),k[0]===er)return k;v=typeof k[1]=="number"?k[1]:v+o}}return p}}}function nc(e){return Array.isArray(e)?e:typeof e=="number"?[Zl,e]:e==null?li:[e]}function ci(e,t,n,i){let a,s,o;typeof t=="function"?(s=void 0,o=t,a=n):(s=t,o=n,a=i),tc(e,s,l,a);function l(u,c){const d=c[c.length-1],m=d?d.children.indexOf(u):void 0;return o(u,m,d)}}const Jt={}.hasOwnProperty,rc={};function ic(e,t){const n=t||rc,i=new Map,a=new Map,s=new Map,o={...Bl,...n.handlers},l={all:c,applyData:sc,definitionById:i,footnoteById:a,footnoteCounts:s,footnoteOrder:[],handlers:o,one:u,options:n,patch:ac,wrap:lc};return ci(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const m=d.type==="definition"?i:a,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(Jt.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:v,...N}=d,f=pt(N);return f.children=l.all(d),f}return pt(d)}return(l.options.unknownHandler||oc)(l,d,m)}function c(d){const m=[];if("children"in d){const h=d.children;let p=-1;for(;++p<h.length;){const k=l.one(h[p],d);if(k){if(p&&h[p-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=tr(k.value)),!Array.isArray(k)&&k.type==="element")){const v=k.children[0];v&&v.type==="text"&&(v.value=tr(v.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function ac(e,t){e.position&&(t.position=Ml(e))}function sc(e,t){let n=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,s=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"&&s&&Object.assign(n.properties,pt(s)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function oc(e,t){const n=t.data||{},i="value"in t&&!(Jt.call(n,"hProperties")||Jt.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 lc(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=ic(e,t),i=n.one(e,void 0),a=Gl(n),s=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&s.children.push({type:"text",value:`
`},a),s}function cc(e,t){return e&&"run"in e?async function(n,i){const a=nr(n,{file:i,...t});await e.run(a,i)}:function(n,i){return nr(n,{file:i,...e||t})}}function rr(e){if(e)throw e}var Mt,ir;function uc(){if(ir)return Mt;ir=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},s=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 Mt=function u(){var c,d,m,h,p,k,v=arguments[0],N=1,f=arguments.length,y=!1;for(typeof v=="boolean"&&(y=v,v=arguments[1]||{},N=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});N<f;++N)if(c=arguments[N],c!=null)for(d in c)m=l(v,d),h=l(c,d),v!==h&&(y&&h&&(s(h)||(p=a(h)))?(p?(p=!1,k=m&&a(m)?m:[]):k=m&&s(m)?m:{},o(v,{name:d,newValue:u(y,k,h)})):typeof h<"u"&&o(v,{name:d,newValue:h}));return v},Mt}var dc=uc();const Ft=yr(dc);function Xt(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 mc(){const e=[],t={run:n,use:i};return t;function n(...a){let s=-1;const o=a.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...a);function l(u,...c){const d=e[++s];let m=-1;if(u){o(u);return}for(;++m<a.length;)(c[m]===null||c[m]===void 0)&&(c[m]=a[m]);a=c,d?pc(d,l)(...c):o(null,...c)}}function i(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function pc(e,t){let n;return i;function i(...o){const l=e.length>o.length;let u;l&&o.push(a);try{u=e.apply(this,o)}catch(c){const d=c;if(l&&n)throw d;return a(d)}l||(u&&u.then&&typeof u.then=="function"?u.then(s,a):u instanceof Error?a(u):s(u))}function a(o,...l){n||(n=!0,t(o,...l))}function s(o){a(null,o)}}class pe extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?a=t:!s.cause&&t&&(o=!0,a=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof i=="string"){const u=i.indexOf(":");u===-1?s.ruleId=i:(s.source=i.slice(0,u),s.ruleId=i.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=l?l.line:void 0,this.name=Xe(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}pe.prototype.file="";pe.prototype.name="";pe.prototype.reason="";pe.prototype.message="";pe.prototype.stack="";pe.prototype.column=void 0;pe.prototype.line=void 0;pe.prototype.ancestors=void 0;pe.prototype.cause=void 0;pe.prototype.fatal=void 0;pe.prototype.place=void 0;pe.prototype.ruleId=void 0;pe.prototype.source=void 0;const ke={basename:hc,dirname:fc,extname:gc,join:xc,sep:"/"};function hc(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');et(e);let n=0,i=-1,a=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(s){n=a+1;break}}else i<0&&(s=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let o=-1,l=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(s){n=a+1;break}}else o<0&&(s=!0,o=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(i=a):(l=-1,i=o));return n===i?i=o:i<0&&(i=e.length),e.slice(n,i)}function fc(e){if(et(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 gc(e){et(e);let t=e.length,n=-1,i=0,a=-1,s=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?a<0?a=t:s!==1&&(s=1):a>-1&&(s=-1)}return a<0||n<0||s===0||s===1&&a===n-1&&a===i+1?"":e.slice(a,n)}function xc(...e){let t=-1,n;for(;++t<e.length;)et(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":yc(n)}function yc(e){et(e);const t=e.codePointAt(0)===47;let n=bc(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function bc(e,t){let n="",i=0,a=-1,s=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(!(a===o-1||s===1))if(a!==o-1&&s===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("/")),a=o,s=0;continue}}else if(n.length>0){n="",i=0,a=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(a+1,o):n=e.slice(a+1,o),i=o-a-1;a=o,s=0}else l===46&&s>-1?s++:s=-1}return n}function et(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const _c={cwd:vc};function vc(){return"/"}function Qt(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function wc(e){if(typeof e=="string")e=new URL(e);else if(!Qt(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 kc(e)}function kc(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 a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Lt=["history","path","basename","stem","extname","dirname"];class ui{constructor(t){let n;t?Qt(t)?n={path:t}:typeof t=="string"||jc(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":_c.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Lt.length;){const s=Lt[i];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let a;for(a in n)Lt.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?ke.basename(this.path):void 0}set basename(t){Ot(t,"basename"),Rt(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){ar(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(Rt(t,"extname"),ar(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){Qt(t)&&(t=wc(t)),Ot(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){Ot(t,"stem"),Rt(t,"stem"),this.path=ke.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const a=this.message(t,n,i);throw a.fatal=!0,a}info(t,n,i){const a=this.message(t,n,i);return a.fatal=void 0,a}message(t,n,i){const a=new pe(t,n,i);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Rt(e,t){if(e&&e.includes(ke.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ke.sep+"`")}function Ot(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ar(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function jc(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Sc=function(e){const i=this.constructor.prototype,a=i[e],s=function(){return a.apply(s,arguments)};return Object.setPrototypeOf(s,i),s},Nc={}.hasOwnProperty;class pn extends Sc{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=mc()}copy(){const t=new pn;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(Ft(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Bt("data",this.frozen),this.namespace[t]=n,this):Nc.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Bt("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 a=n.call(t,...i);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ct(t),i=this.parser||this.Parser;return zt("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),zt("process",this.parser||this.Parser),Dt("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(s,o){const l=ct(t),u=i.parse(l);i.run(u,l,function(d,m,h){if(d||!m||!h)return c(d);const p=m,k=i.stringify(p,h);Ec(k)?h.value=k:h.result=k,c(d,h)});function c(d,m){d||!m?o(d):s?s(m):n(void 0,m)}}}processSync(t){let n=!1,i;return this.freeze(),zt("processSync",this.parser||this.Parser),Dt("processSync",this.compiler||this.Compiler),this.process(t,a),or("processSync","process",n),i;function a(s,o){n=!0,rr(s),i=o}}run(t,n,i){sr(t),this.freeze();const a=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?s(void 0,i):new Promise(s);function s(o,l){const u=ct(n);a.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,a;return this.run(t,n,s),or("runSync","run",i),a;function s(o,l){rr(o),a=l,i=!0}}stringify(t,n){this.freeze();const i=ct(n),a=this.compiler||this.Compiler;return Dt("stringify",a),sr(t),a(t,i)}use(t,...n){const i=this.attachers,a=this.namespace;if(Bt("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 s(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&&(a.settings=Ft(!0,a.settings,c.settings))}function l(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const m=c[d];s(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,...k]=d;const v=i[h][1];Xt(v)&&Xt(p)&&(p=Ft(!0,v,p)),i[h]=[c,p,...k]}}}}const Cc=new pn().freeze();function zt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Dt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Bt(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 sr(e){if(!Xt(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 ct(e){return Ac(e)?e:new ui(e)}function Ac(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Ec(e){return typeof e=="string"||Ic(e)}function Ic(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Tc="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",lr=[],cr={allowDangerousHtml:!0},Pc=/^(https?|ircs?|mailto|xmpp)$/i,Mc=[{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 Fc(e){const t=Lc(e),n=Rc(e);return Oc(t.runSync(t.parse(n),n),e)}function Lc(e){const t=e.rehypePlugins||lr,n=e.remarkPlugins||lr,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...cr}:cr;return Cc().use(pl).use(n).use(cc,i).use(t)}function Rc(e){const t=e.children||"",n=new ui;return typeof t=="string"&&(n.value=t),n}function Oc(e,t){const n=t.allowedElements,i=t.allowElement,a=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||zc;for(const d of Mc)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Tc+d.id,void 0);return ci(e,c),Wa(e,{Fragment:r.Fragment,components:a,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 It)if(Object.hasOwn(It,p)&&Object.hasOwn(d.properties,p)){const k=d.properties[p],v=It[p];(v===null||v.includes(d.tagName))&&(d.properties[p]=u(String(k||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.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 zc(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||i!==-1&&t>i||Pc.test(e.slice(0,t))?e:""}const ur=({variant:e="default",className:t,children:n,...i})=>{const a="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",s="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=s:e==="secondary"&&(u=o),r.jsx("button",{...i,className:`${a} ${u} ${t||""}`.trim(),children:n})},Dc=({plugin:e,isOpen:t,onClose:n,onInstall:i})=>{if(!t)return null;const a=s=>!s||s.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:s.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:s=>{(s.key==="Enter"||s.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:s=>s.stopPropagation(),onKeyDown:s=>{s.key==="Escape"&&n(),s.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((s,o)=>r.jsxs("li",{className:"text-sm text-gray-600 dark:text-gray-400",children:[s.name||"N/A"," ",s.email&&r.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:`<${s.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(([s,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:[s,":"]}),r.jsx("span",{className:"text-gray-600 dark:text-gray-400 break-words",children:String(o)})]},s))})})]}),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:"}),a(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(Fc,{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 a="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",s="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=s),r.jsx("button",{...i,className:`${a} ${l} ${t||""}`.trim(),children:n})},Bc=({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||""}`}),qc=({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}),Uc=({pluginName:e,isOpen:t,onClose:n,onInstall:i,isLoading:a=!1})=>{const[s,o]=j.useState(""),[l,u]=j.useState(null);if(!t)return null;const c=()=>{o(""),u(null),n()},d=async m=>{m.preventDefault();const h=s.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:a,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(qc,{htmlFor:"componentName",children:"Component Name:"}),r.jsx(Bc,{type:"text",id:"componentName",value:s,onChange:m=>{o(m.target.value),l&&u(null)},placeholder:"e.g., my-new-plugin",disabled:a,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:a,variant:"default",children:"Cancel"}),r.jsx(dr,{type:"submit",disabled:a||!s.trim(),variant:"primary",children:a?"Installing...":"Install Plugin"})]})]})]})})},mr=({variant:e="default",className:t,children:n,...i})=>{const a="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",s="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=s),r.jsx("button",{...i,className:`${a} ${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}),Hc=({isOpen:e,onClose:t,onAddRegistry:n,isLoading:i=!1})=>{const[a,s]=j.useState(""),[o,l]=j.useState(""),[u,c]=j.useState(null);if(!e)return null;const d=async h=>{h.preventDefault();const p=a.trim(),k=o.trim();if(!p){c("Registry Path or URL is required.");return}c(null),await n(p,k===""?void 0:k)},m=()=>{s(""),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:a,onChange:h=>{s(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||!a.trim(),variant:"primary",children:i?"Adding...":"Add Registry"})]})]})]})})},fr=({variant:e="default",className:t,children:n,...i})=>{const a="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",s="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=s:e==="secondary"&&(u=o),r.jsx("button",{...i,className:`${a} ${u} ${t||""}`,children:n})},Vc=({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||""}`}),Wc=({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})]}),$c=()=>{const[e,t]=j.useState([]),[n,i]=j.useState([]),[,a]=j.useState([]),[s,o]=j.useState(""),[l,u]=j.useState("all"),[c,d]=j.useState(!0),[m,h]=j.useState(null),[p,k]=j.useState(null),[v,N]=j.useState(null),[f,y]=j.useState(!1),[w,L]=j.useState(null),[O,b]=j.useState(!1),[P,q]=j.useState(!1),z=j.useCallback(async(F=!0)=>{F&&d(!0),h(null);try{const D=await fetch("/api/plugin_catalog/plugins");if(!D.ok)throw new Error(`Failed to fetch plugins: ${D.statusText} (${D.status})`);const J=await D.json();t(J),i(J)}catch(D){const J=D instanceof Error?D.message:String(D);h(J),A("destructive",J)}finally{F&&d(!1)}},[]),U=j.useCallback(async()=>{try{const F=await fetch("/api/plugin_catalog/registries");if(!F.ok)throw new Error("Failed to fetch registries");const D=await F.json();a(D)}catch(F){const D=F instanceof Error?F.message:String(F);console.error("Failed to fetch registries:",D)}},[]);j.useEffect(()=>{z(),U()},[z,U]),j.useEffect(()=>{const F=s.toLowerCase();i(e.filter(D=>{var te;const J=D.pyproject.name.toLowerCase().includes(F)||D.pyproject.description&&D.pyproject.description.toLowerCase().includes(F),g=((te=D.pyproject.plugin_type)==null?void 0:te.toLowerCase())||"custom";return J&&(l==="all"||l==="agents"&&g==="agent"||l==="gateways"&&g==="gateway"||l==="tools"&&g==="tool"||l==="custom"&&g==="custom")}))},[s,l,e]);const A=(F,D)=>{k({type:F,message:D}),setTimeout(()=>k(null),7e3)},_=F=>{N(F),y(!0)},C=F=>{L(F),b(!0)},T=async F=>{if(w){d(!0);try{const D=await fetch("/api/plugin_catalog/plugins/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pluginId:w.id,componentName:F})}),J=await D.json();if(!D.ok||J.status==="failure")throw new Error(J.error||"Installation failed");A("success",J.message||"Plugin installed successfully!")}catch(D){const J=D instanceof Error?D.message:String(D);A("destructive",J)}finally{d(!1),b(!1),L(null)}}},B=async()=>{d(!0),h(null);try{const F=await fetch("/api/plugin_catalog/registries/refresh",{method:"POST"}),D=await F.json();if(!F.ok||D.status!=="success")throw new Error(D.message||"Failed to refresh registries");A("success",D.message),await z(!1)}catch(F){const D=F instanceof Error?F.message:String(F);h(D),A("destructive",D)}finally{d(!1)}},K=async(F,D)=>{d(!0);try{const J={path_or_url:F};D&&D.trim()!==""&&(J.name=D.trim());const g=await fetch("/api/plugin_catalog/registries",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J)}),X=await g.json();if(!g.ok||X.status!=="success")throw new Error(X.error||"Failed to add registry");A("success",X.message),await U(),await z(!1),q(!1)}catch(J){const g=J instanceof Error?J.message:String(J);A("destructive",g)}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(Vc,{type:"text",placeholder:"Search plugins by name or description...",value:s,onChange:F=>o(F.target.value),className:"w-full sm:flex-grow"}),r.jsxs(Wc,{value:l,onChange:F=>u(F.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:"tools",children:"Tools"}),r.jsx("option",{value:"custom",children:"Custom"})]})]}),r.jsxs("div",{className:"flex gap-3 flex-shrink-0",children:[r.jsx(fr,{onClick:()=>q(!0),variant:"primary",children:"+ Add Registry"}),r.jsx(fr,{onClick:B,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&&s&&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(F=>r.jsx(ha,{plugin:F,onReadMore:()=>_(F),onInstall:()=>C(F)},F.id))}),f&&v&&r.jsx(Dc,{plugin:v,isOpen:f,onClose:()=>y(!1),onInstall:C}),O&&w&&r.jsx(Uc,{pluginName:w.pyproject.name,isOpen:O,onClose:()=>b(!1),onInstall:T,isLoading:c}),P&&r.jsx(Hc,{isOpen:P,onClose:()=>q(!1),onAddRegistry:K,isLoading:c})]})})},Gc=({data:e,updateData:t,onNext:n})=>{const i=s=>{t({[s.target.name]:s.target.value})},a=e.gateway_name_input&&e.namespace&&e.gateway_id;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(M,{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(H,{id:"gateway_name_input",name:"gateway_name_input",value:e.gateway_name_input||"",onChange:i,placeholder:"e.g., custom-monitor",required:!0})}),r.jsx(M,{label:"A2A Namespace",htmlFor:"namespace",required:!0,helpText:"The namespace this gateway will operate under.",children:r.jsx(H,{id:"namespace",name:"namespace",value:e.namespace||"",onChange:i,placeholder:"e.g., myorg/dev or ${NAMESPACE}",required:!0})}),r.jsx(M,{label:"Gateway ID",htmlFor:"gateway_id",required:!0,helpText:"A unique identifier for this gateway instance.",children:r.jsx(H,{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:!a,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"})})]})},Yc=[{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"}],Jc=[{value:"namespace",label:"Namespace"},{value:"app",label:"Application (Gateway ID specific)"},{value:"custom",label:"Custom (requires specific GDK handling)"}],Xc=({data:e,updateData:t,onNext:n,onPrevious:i})=>{const a=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}))},s=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 s&&(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(M,{label:"Artifact Service Type",htmlFor:"artifact_service_type",helpText:"Determines how gateway artifacts are stored and managed.",children:r.jsx(oe,{id:"artifact_service_type",name:"artifact_service_type",value:e.artifact_service_type||"",onChange:a,options:Yc})}),s&&r.jsxs(r.Fragment,{children:[r.jsx(M,{label:"Artifact Service Scope",htmlFor:"artifact_service_scope",required:s,helpText:"Scope for the custom artifact service.",children:r.jsx(oe,{id:"artifact_service_scope",name:"artifact_service_scope",value:e.artifact_service_scope||"",onChange:a,options:Jc,required:s})}),o&&r.jsx(M,{label:"Artifact Service Base Path",htmlFor:"artifact_service_base_path",required:o,helpText:"Base directory path if 'Filesystem' type is selected.",children:r.jsx(H,{id:"artifact_service_base_path",name:"artifact_service_base_path",value:e.artifact_service_base_path||"",onChange:a,placeholder:"/tmp/samv2",required:o})}),l&&r.jsxs(r.Fragment,{children:[r.jsx(M,{label:"S3 Bucket Name",htmlFor:"s3_bucket_name",required:l,helpText:"Name of the S3 bucket to store artifacts.",children:r.jsx(H,{id:"s3_bucket_name",name:"s3_bucket_name",value:e.s3_bucket_name||"",onChange:a,placeholder:"my-artifacts-bucket",required:l})}),r.jsx(M,{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(H,{id:"s3_endpoint_url",name:"s3_endpoint_url",value:e.s3_endpoint_url||"",onChange:a,placeholder:"https://s3.amazonaws.com or https://minio.example.com"})}),r.jsx(M,{label:"S3 Region",htmlFor:"s3_region",required:l,helpText:"AWS region or S3-compatible service region.",children:r.jsx(H,{id:"s3_region",name:"s3_region",value:e.s3_region||"",onChange:a,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"})]})]})},Qc=({data:e,updateData:t,onNext:n,onPrevious:i})=>{const a=s=>{t({[s.target.name]:s.target.value})};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(M,{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:a,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(M,{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:a,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"})]})]}),Ye=[{id:"basicInfo",title:"Basic Information",description:"Enter the core details for your new gateway.",component:Gc},{id:"artifactConfig",title:"Artifact Service",description:"Configure how artifacts are stored and managed.",component:Xc},{id:"responseCustomization",title:"Response Customization",description:"Define the gateway's system purpose and response format.",component:Qc},{id:"review",title:"Review & Create",description:"Review your gateway configuration before creation.",component:Kc}],Zc=()=>{var N;const[e,t]=j.useState(0),[n,i]=j.useState({}),[a,s]=j.useState(!0),[o,l]=j.useState(null),[u,c]=j.useState(!1),d="http://localhost:5002";j.useEffect(()=>{s(!0),fetch(`${d}/api/form_schema?type=gateway`).then(f=>{if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);return f.json()}).then(f=>{if(f.status==="success"&&f.defaults)i({...f.defaults,gateway_name_input:f.defaults.gateway_name_input||""}),l(null);else throw new Error(f.message||"Failed to load gateway defaults.")}).catch(f=>{console.error("Error fetching gateway schema:",f),l(f.message||"Could not fetch gateway configuration defaults."),i({})}).finally(()=>s(!1))},[d]);const m=j.useCallback(f=>{i(y=>({...y,...f}))},[]),h=j.useCallback(()=>{e<Ye.length-1?t(f=>f+1):k()},[e,Ye.length]),p=j.useCallback(()=>{e>0&&t(f=>f-1)},[e]),k=async()=>{s(!0),l(null);try{const f=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})}),y=await f.json();if(f.ok&&y.status==="success")c(!0),setTimeout(()=>{fetch(`${d}/api/shutdown`,{method:"POST"}).catch(w=>console.error("Error shutting down server:",w))},3e3);else throw new Error(y.message||"Failed to save gateway configuration.")}catch(f){console.error("Error submitting gateway config:",f),f instanceof Error?l(f.message):l("An unexpected error occurred during submission.")}finally{s(!1)}};if(u)return r.jsx(Zt,{title:"Gateway Created!",message:"Your new gateway configuration has been saved. The CLI will now generate the necessary files."});if(a&&!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 v=(N=Ye[e])==null?void 0:N.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(Kt,{steps:Ye,currentStepIndex:e}),r.jsx("div",{className:"mt-6 bg-gray-50 p-6 rounded-lg shadow min-h-[300px]",children:v?r.jsx(v,{data:n,updateData:m,onNext:h,onPrevious:p,onSubmit:k,isLoading:a&&e===Ye.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})]})},nu=()=>[{title:"Solace Agent Mesh - Config Portal"},{name:"description",content:"Initialize your Solace Agent Mesh project or add new components."}];function ru(){const[e,t]=j.useState("initialize"),[n]=di();return j.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(Fi,{}),e==="addAgent"&&r.jsx(Yi,{}),e==="pluginCatalog"&&r.jsx($c,{}),e==="addGateway"&&r.jsx(Zc,{})]}),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{ru as default,nu as meta};
