@evoscientist/webui 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -42
- package/dist/.next/BUILD_ID +1 -1
- package/dist/.next/build-manifest.json +3 -3
- package/dist/.next/server/app/_global-error.html +1 -1
- package/dist/.next/server/app/_global-error.rsc +1 -1
- package/dist/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dist/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/_not-found.html +1 -1
- package/dist/.next/server/app/_not-found.rsc +2 -2
- package/dist/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/dist/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/dist/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dist/.next/server/app/api/memory/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/skills/catalog/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/skills/detail/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/skills/install/route.js.nft.json +1 -1
- package/dist/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/dist/.next/server/app/index.html +1 -1
- package/dist/.next/server/app/index.rsc +3 -3
- package/dist/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/dist/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/dist/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dist/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/chunks/ssr/[root-of-the-server]__0wd7vkh._.js +4 -4
- package/dist/.next/server/middleware-build-manifest.js +3 -3
- package/dist/.next/server/pages/404.html +1 -1
- package/dist/.next/server/pages/500.html +1 -1
- package/dist/.next/static/chunks/0njfd4s35t8hg.css +2 -0
- package/dist/.next/static/chunks/{0asw8smw1s7b6.js → 0r0k~7apz1g3~.js} +4 -4
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/.next/static/chunks/0rdhosvewp23o.css +0 -2
- /package/dist/.next/static/{eL_dzoZzQEuRn6ifb6xUZ → _leTiU4W6HEDdB5K1SmTt}/_buildManifest.js +0 -0
- /package/dist/.next/static/{eL_dzoZzQEuRn6ifb6xUZ → _leTiU4W6HEDdB5K1SmTt}/_clientMiddlewareManifest.js +0 -0
- /package/dist/.next/static/{eL_dzoZzQEuRn6ifb6xUZ → _leTiU4W6HEDdB5K1SmTt}/_ssgManifest.js +0 -0
|
@@ -4,7 +4,7 @@ Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpattern
|
|
|
4
4
|
|
|
5
5
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
6
6
|
|
|
7
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return Q.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},rt=({contentRef:e,descriptionId:t})=>{let r=t7("DialogDescriptionWarning"),n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return Q.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null};let rr=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},rn=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim();var ra={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"};let ri=(0,Q.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:o,...s},l)=>(0,Q.createElement)("svg",{ref:l,...ra,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:rn("lucide",a),...!i&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(s)&&{"aria-hidden":"true"},...s},[...o.map(([e,t])=>(0,Q.createElement)(e,t)),...Array.isArray(i)?i:[i]])),ro=(e,t)=>{let r=(0,Q.forwardRef)(({className:r,...n},a)=>(0,Q.createElement)(ri,{ref:a,iconNode:t,className:rn(`lucide-${rr(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...n}));return r.displayName=rr(e),r},rs=ro("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),rl=(e,t)=>{if(0===e.length)return t.classGroupId;let r=e[0],n=t.nextPart.get(r),a=n?rl(e.slice(1),n):void 0;if(a)return a;if(0===t.validators.length)return;let i=e.join("-");return t.validators.find(({validator:e})=>e(i))?.classGroupId},ru=/^\[(.+)\]$/,rc=(e,t,r,n)=>{e.forEach(e=>{if("string"==typeof e){(""===e?t:rd(t,e)).classGroupId=r;return}"function"==typeof e?rp(e)?rc(e(n),t,r,n):t.validators.push({validator:e,classGroupId:r}):Object.entries(e).forEach(([e,a])=>{rc(a,rd(t,e),r,n)})})},rd=(e,t)=>{let r=e;return t.split("-").forEach(e=>{r.nextPart.has(e)||r.nextPart.set(e,{nextPart:new Map,validators:[]}),r=r.nextPart.get(e)}),r},rp=e=>e.isThemeGetter,rf=(e,t)=>t?e.map(([e,r])=>[e,r.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,r])=>[t+e,r])):e)]):e,rm=e=>{if(e.length<=1)return e;let t=[],r=[];return e.forEach(e=>{"["===e[0]?(t.push(...r.sort(),e),r=[]):r.push(e)}),t.push(...r.sort()),t},rh=/\s+/;function rg(){let e,t,r=0,n="";for(;r<arguments.length;)(e=arguments[r++])&&(t=rb(e))&&(n&&(n+=" "),n+=t);return n}let rb=e=>{let t;if("string"==typeof e)return e;let r="";for(let n=0;n<e.length;n++)e[n]&&(t=rb(e[n]))&&(r&&(r+=" "),r+=t);return r},ry=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},rv=/^\[(?:([a-z-]+):)?(.+)\]$/i,r_=/^\d+\/\d+$/,rw=new Set(["px","full","screen"]),rE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rx=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,rS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,rk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rA=e=>rI(e)||rw.has(e)||r_.test(e),rN=e=>rB(e,"length",rH),rI=e=>!!e&&!Number.isNaN(Number(e)),rC=e=>rB(e,"number",rI),rR=e=>!!e&&Number.isInteger(Number(e)),rO=e=>e.endsWith("%")&&rI(e.slice(0,-1)),rL=e=>rv.test(e),rP=e=>rE.test(e),rD=new Set(["length","size","percentage"]),rM=e=>rB(e,rD,rG),rj=e=>rB(e,"position",rG),rF=new Set(["image","url"]),r$=e=>rB(e,rF,rq),rU=e=>rB(e,"",rV),rz=()=>!0,rB=(e,t,r)=>{let n=rv.exec(e);return!!n&&(n[1]?"string"==typeof t?n[1]===t:t.has(n[1]):r(n[2]))},rH=e=>rx.test(e)&&!rS.test(e),rG=()=>!1,rV=e=>rk.test(e),rq=e=>rT.test(e),rW=function(e,...t){let r,n,a,i=function(s){let l;return n=(r={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=new Map,n=new Map,a=(a,i)=>{r.set(a,i),++t>e&&(t=0,n=r,r=new Map)};return{get(e){let t=r.get(e);return void 0!==t?t:void 0!==(t=n.get(e))?(a(e,t),t):void 0},set(e,t){r.has(e)?r.set(e,t):a(e,t)}}})((l=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{separator:t,experimentalParseClassName:r}=e,n=1===t.length,a=t[0],i=t.length,o=e=>{let r,o=[],s=0,l=0;for(let u=0;u<e.length;u++){let c=e[u];if(0===s){if(c===a&&(n||e.slice(u,u+i)===t)){o.push(e.slice(l,u)),l=u+i;continue}if("/"===c){r=u;continue}}"["===c?s++:"]"===c&&s--}let u=0===o.length?e:e.substring(l),c=u.startsWith("!"),d=c?u.substring(1):u;return{modifiers:o,hasImportantModifier:c,baseClassName:d,maybePostfixModifierPosition:r&&r>l?r-l:void 0}};return r?e=>r({className:e,parseClassName:o}):o})(l),...(e=>{let t=(e=>{let{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return rf(Object.entries(e.classGroups),r).forEach(([e,r])=>{rc(r,n,e,t)}),n})(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{let r=e.split("-");return""===r[0]&&1!==r.length&&r.shift(),rl(r,t)||(e=>{if(ru.test(e)){let t=ru.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}})(e)},getConflictingClassGroupIds:(e,t)=>{let a=r[e]||[];return t&&n[e]?[...a,...n[e]]:a}}})(l)}).cache.get,a=r.cache.set,i=o,o(s)};function o(e){let t=n(e);if(t)return t;let i=((e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a}=t,i=[],o=e.trim().split(rh),s="";for(let e=o.length-1;e>=0;e-=1){let t=o[e],{modifiers:l,hasImportantModifier:u,baseClassName:c,maybePostfixModifierPosition:d}=r(t),p=!!d,f=n(p?c.substring(0,d):c);if(!f){if(!p||!(f=n(c))){s=t+(s.length>0?" "+s:s);continue}p=!1}let m=rm(l).join(":"),h=u?m+"!":m,g=h+f;if(i.includes(g))continue;i.push(g);let b=a(f,p);for(let e=0;e<b.length;++e){let t=b[e];i.push(h+t)}s=t+(s.length>0?" "+s:s)}return s})(e,r);return a(e,i),i}return function(){return i(rg.apply(null,arguments))}}(()=>{let e=ry("colors"),t=ry("spacing"),r=ry("blur"),n=ry("brightness"),a=ry("borderColor"),i=ry("borderRadius"),o=ry("borderSpacing"),s=ry("borderWidth"),l=ry("contrast"),u=ry("grayscale"),c=ry("hueRotate"),d=ry("invert"),p=ry("gap"),f=ry("gradientColorStops"),m=ry("gradientColorStopPositions"),h=ry("inset"),g=ry("margin"),b=ry("opacity"),y=ry("padding"),v=ry("saturate"),_=ry("scale"),w=ry("sepia"),E=ry("skew"),x=ry("space"),S=ry("translate"),k=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",rL,t],N=()=>[rL,t],I=()=>["",rA,rN],C=()=>["auto",rI,rL],R=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],O=()=>["solid","dashed","dotted","double","none"],L=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],P=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",rL],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>[rI,rL];return{cacheSize:500,separator:":",theme:{colors:[rz],spacing:[rA,rN],blur:["none","",rP,rL],brightness:j(),borderColor:[e],borderRadius:["none","","full",rP,rL],borderSpacing:N(),borderWidth:I(),contrast:j(),grayscale:D(),hueRotate:j(),invert:D(),gap:N(),gradientColorStops:[e],gradientColorStopPositions:[rO,rN],inset:A(),margin:A(),opacity:j(),padding:N(),saturate:j(),scale:j(),sepia:D(),skew:j(),space:N(),translate:N()},classGroups:{aspect:[{aspect:["auto","square","video",rL]}],container:["container"],columns:[{columns:[rP]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...R(),rL]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",rR,rL]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",rL]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",rR,rL]}],"grid-cols":[{"grid-cols":[rz]}],"col-start-end":[{col:["auto",{span:["full",rR,rL]},rL]}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":[rz]}],"row-start-end":[{row:["auto",{span:[rR,rL]},rL]}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",rL]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",rL]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...P()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...P(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...P(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[x]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[x]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",rL,t]}],"min-w":[{"min-w":[rL,t,"min","max","fit"]}],"max-w":[{"max-w":[rL,t,"none","full","min","max","fit","prose",{screen:[rP]},rP]}],h:[{h:[rL,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[rL,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[rL,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[rL,t,"auto","min","max","fit"]}],"font-size":[{text:["base",rP,rN]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",rC]}],"font-family":[{font:[rz]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",rL]}],"line-clamp":[{"line-clamp":["none",rI,rC]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",rA,rL]}],"list-image":[{"list-image":["none",rL]}],"list-style-type":[{list:["none","disc","decimal",rL]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",rA,rN]}],"underline-offset":[{"underline-offset":["auto",rA,rL]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",rL]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",rL]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...R(),rj]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",rM]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},r$]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...O(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:O()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...O()]}],"outline-offset":[{"outline-offset":[rA,rL]}],"outline-w":[{outline:[rA,rN]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[rA,rN]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",rP,rU]}],"shadow-color":[{shadow:[rz]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...L(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":L()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",rP,rL]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[v]}],sepia:[{sepia:[w]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[w]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",rL]}],duration:[{duration:j()}],ease:[{ease:["linear","in","out","in-out",rL]}],delay:[{delay:j()}],animate:[{animate:["none","spin","ping","pulse","bounce",rL]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[rR,rL]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",rL]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",rL]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",rL]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[rA,rN,rC]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function rZ(...e){return rW(function(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=function e(t){var r,n,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t))for(r=0;r<t.length;r++)t[r]&&(n=e(t[r]))&&(a&&(a+=" "),a+=n);else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}(e))&&(n&&(n+=" "),n+=t);return n}(e))}function rK({...e}){return(0,J.jsx)(t$,{"data-slot":"dialog",...e})}function rY({...e}){return(0,J.jsx)(tG,{"data-slot":"dialog-portal",...e})}function rX({className:e,...t}){return(0,J.jsx)(tq,{"data-slot":"dialog-overlay",className:rZ("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t})}function rJ({className:e,children:t,showCloseButton:r=!0,...n}){return(0,J.jsxs)(rY,{"data-slot":"dialog-portal",children:[(0,J.jsx)(rX,{}),(0,J.jsxs)(tY,{"data-slot":"dialog-content",className:rZ("fixed left-[50%] top-[50%] z-50 grid max-h-[calc(100vh-2rem)] w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto overscroll-contain rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 motion-reduce:transition-none motion-reduce:data-[state=closed]:animate-none motion-reduce:data-[state=open]:animate-none sm:max-w-lg",e),...n,children:[t,r&&(0,J.jsxs)(t5,{"data-slot":"dialog-close",className:"focus:outline-hidden absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",children:[(0,J.jsx)(rs,{}),(0,J.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function rQ({className:e,...t}){return(0,J.jsx)("div",{"data-slot":"dialog-header",className:rZ("flex flex-col gap-2 text-center sm:text-left",e),...t})}function r0({className:e,...t}){return(0,J.jsx)("div",{"data-slot":"dialog-footer",className:rZ("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function r1({className:e,...t}){return(0,J.jsx)(t1,{"data-slot":"dialog-title",className:rZ("text-lg font-semibold leading-none",e),...t})}function r2({className:e,...t}){return(0,J.jsx)(t4,{"data-slot":"dialog-description",className:rZ("text-sm text-muted-foreground",e),...t})}var r4=Symbol.for("react.lazy"),r3=Q[" use ".trim().toString()];function r5(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===r4&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}function r6(e){var t;let r,n=(t=e,(r=Q.forwardRef((e,t)=>{let{children:r,...n}=e;if(r5(r)&&"function"==typeof r3&&(r=r3(r._payload)),Q.isValidElement(r)){var a;let e,i,o=(a=r,(i=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(i=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...e)=>{let t=i(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...i}:"className"===n&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==Q.Fragment&&(s.ref=t?eg(t,o):o),Q.cloneElement(r,s)}return Q.Children.count(r)>1?Q.Children.only(null):null})).displayName=`${t}.SlotClone`,r),a=Q.forwardRef((e,t)=>{let{children:r,...a}=e;r5(r)&&"function"==typeof r3&&(r=r3(r._payload));let i=Q.Children.toArray(r),o=i.find(r7);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null);return(0,J.jsx)(n,{...a,ref:t,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,r):null})}return(0,J.jsx)(n,{...a,ref:t,children:r})});return a.displayName=`${e}.Slot`,a}var r9=r6("Slot"),r8=Symbol("radix.slottable");function r7(e){return Q.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===r8}let ne=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,nt=function(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=function e(t){var r,n,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t)){var i=t.length;for(r=0;r<i;r++)t[r]&&(n=e(t[r]))&&(a&&(a+=" "),a+=n)}else for(n in t)t[n]&&(a&&(a+=" "),a+=n);return a}(e))&&(n&&(n+=" "),n+=t);return n},nr=(e,t)=>r=>{var n;if((null==t?void 0:t.variants)==null)return nt(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(e=>{let t=null==r?void 0:r[e],n=null==i?void 0:i[e];if(null===t)return null;let o=ne(t)||ne(n);return a[e][o]}),s=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return nt(e,o,null==t||null==(n=t.compoundVariants)?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...i,...s}[t]):({...i,...s})[t]===r})?[...e,r,n]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)},nn=nr("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-[var(--brand-solid)] text-[var(--brand-foreground)] shadow-xs hover:opacity-90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:opacity-90",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-[var(--brand)] underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function na({className:e,variant:t,size:r,asChild:n=!1,...a}){return(0,J.jsx)(n?r9:"button",{"data-slot":"button",className:rZ(nn({variant:t,size:r,className:e})),...a})}var ni=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=r6(`Primitive.${t}`),n=Q.forwardRef((e,n)=>{let{asChild:a,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,J.jsx)(a?r:t,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),no=Q.forwardRef((e,t)=>(0,J.jsx)(ni.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));no.displayName="Label";let ns=nr("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),nl=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)(no,{ref:r,className:rZ(ns(),e),...t}));function nu({className:e,type:t,...r}){return(0,J.jsx)("input",{type:t,"data-slot":"input",className:rZ("flex h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none transition-[color,box-shadow] selection:bg-blue-200 selection:text-gray-900 file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 dark:bg-input/30 dark:selection:bg-blue-600 dark:selection:text-white md:text-sm","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}function nc({open:e,onOpenChange:t,onSave:r,initialConfig:n}){let[a,i]=(0,Q.useState)(n?.deploymentUrl||"http://127.0.0.1:6174"),[o,s]=(0,Q.useState)(null),l=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(e){if(s(null),n?.deploymentUrl)return void i(n.deploymentUrl);fetch("/api/evosci-config").then(e=>e.json()).then(e=>{e?.deploymentUrl&&i(e.deploymentUrl)}).catch(()=>{})}},[e,n]);let u=()=>{let e=a.trim();if(!e){s("Enter your deployment URL to continue."),l.current?.focus();return}try{new URL(e)}catch{s("Enter a valid URL, e.g. http://127.0.0.1:6174"),l.current?.focus();return}r({deploymentUrl:e,assistantId:ed}),t(!1)};return(0,J.jsx)(rK,{open:e,onOpenChange:t,children:(0,J.jsxs)(rJ,{className:"sm:max-w-[525px]",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Configuration"}),(0,J.jsxs)(r2,{children:["Enter the URL of your EvoScientist deployment (from"," ",(0,J.jsx)("code",{children:"EvoSci deploy"}),"). This is saved in your browser's local storage."]})]}),(0,J.jsx)("div",{className:"grid gap-4 py-4",children:(0,J.jsxs)("div",{className:"grid gap-2",children:[(0,J.jsx)(nl,{htmlFor:"deploymentUrl",children:"Deployment URL"}),(0,J.jsx)(nu,{ref:l,id:"deploymentUrl",name:"deploymentUrl",type:"url",inputMode:"url",autoComplete:"off",spellCheck:!1,autoFocus:!0,placeholder:"http://127.0.0.1:6174",value:a,onChange:e=>{i(e.target.value),o&&s(null)},onKeyDown:e=>{"Enter"!==e.key||e.nativeEvent.isComposing||u()},"aria-invalid":!!o||void 0,"aria-describedby":o?"deploymentUrl-error":void 0}),o&&(0,J.jsx)("p",{id:"deploymentUrl-error",role:"alert","aria-live":"polite",className:"text-sm text-destructive",children:o})]})}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),(0,J.jsx)(na,{onClick:u,children:"Save"})]})]})})}nl.displayName=no.displayName;let nd=(...e)=>fetch(...e),np=Symbol.for("lg:fetch_implementation");var nf=e.i(57140),nm=e.i(53274);let nh=[400,401,402,403,404,405,406,407,408,409,422];var ng=class e extends Error{status;text;response;constructor(e,t,r){super(`HTTP ${e}: ${t}`),this.status=e,this.text=t,this.response=r}static async fromResponse(t,r){try{return new e(t.status,await t.text(),r?.includeResponse?t:void 0)}catch{return new e(t.status,t.statusText,r?.includeResponse?t:void 0)}}},nb=class{maxConcurrency;maxRetries;queue;onFailedResponseHook;customFetch;constructor(e){this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??4,"default"in nm.default?this.queue=new nm.default.default({concurrency:this.maxConcurrency}):this.queue=new nm.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook,this.customFetch=e.fetch}call(e,...t){let{onFailedResponseHook:r}=this;return this.queue.add(()=>(0,nf.default)(()=>e(...t).catch(async e=>{if(e instanceof Error)throw e;if(null!=e&&"object"==typeof e&&"status"in e&&"statusText"in e&&"text"in e)throw await ng.fromResponse(e,{includeResponse:!!r});throw Error(e)}),{async onFailedAttempt(e){if(e.message.startsWith("Cancel")||e.message.startsWith("TimeoutError")||e.message.startsWith("AbortError")||e?.code==="ECONNABORTED")throw e;if(e instanceof ng){if(nh.includes(e.status))throw e;r&&e.response&&await r(e.response)}},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,t,...r){return e.signal?Promise.race([this.call(t,...r),new Promise((t,r)=>{e.signal?.addEventListener("abort",()=>{r(Error("AbortError"))})})]):this.call(t,...r)}fetch(...e){let t=this.customFetch??globalThis[np]??nd;return this.call(()=>t(...e).then(e=>e.ok?e:Promise.reject(e)))}};let ny=[13,10];function nv(){let e=[],t=!1;return new TransformStream({start(){e=[],t=!1},transform(r,n){let a=r;if(t&&(a=nw([[13],a]),t=!1),a.length>0&&13===a.at(-1)&&(t=!0,a=a.subarray(0,-1)),!a.length)return;let i=ny.includes(a.at(-1)),o=a.length-1,{lines:s}=a.reduce((e,t,r)=>(e.from>r||((13===t||10===t)&&(e.lines.push(a.subarray(e.from,r)),13===t&&10===a[r+1]?e.from=r+2:e.from=r+1),r===o&&e.from<=o&&e.lines.push(a.subarray(e.from))),e),{lines:[],from:0});if(1===s.length&&!i)return void e.push(s[0]);for(let t of(e.length&&(e.push(s[0]),s[0]=nw(e),e=[]),!i&&s.length&&(e=[s.pop()]),s))n.enqueue(t)},flush(t){e.length&&t.enqueue(nw(e))}})}function n_(){let e="",t=[],r="",n=null,a=new TextDecoder;return new TransformStream({transform(i,o){if(!i.length){if(!e&&!t.length&&!r&&null==n)return;let i={id:r||void 0,event:e,data:t.length?nE(a,t):null};e="",t=[],n=null,o.enqueue(i);return}if(58===i[0])return;let s=i.indexOf(58);if(-1===s)return;let l=a.decode(i.subarray(0,s)),u=i.subarray(s+1);if(32===u[0]&&(u=u.subarray(1)),"event"===l)e=a.decode(u);else if("data"===l)t.push(u);else if("id"===l)-1===u.indexOf(0)&&(r=a.decode(u));else if("retry"===l){let e=Number.parseInt(a.decode(u),10);Number.isNaN(e)||(n=e)}},flush(n){e&&n.enqueue({id:r||void 0,event:e,data:t.length?nE(a,t):null})}})}function nw(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}function nE(e,t){return JSON.parse(e.decode(nw(t)))}var nx=class e extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();if(e.done)return this.reader.releaseLock(),{done:!0,value:void 0};return{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}throw e}async [Symbol.asyncDispose](){await this.return()}[Symbol.asyncIterator](){return this}static fromReadableStream(t){let r=t.getReader();return new e({start:e=>(function t(){return r.read().then(({done:r,value:n})=>r?void e.close():(e.enqueue(n),t()))})(),cancel(){r.releaseLock()}})}static fromAsyncGenerator(t){return new e({async pull(e){let{value:r,done:n}=await t.next();n&&e.close(),e.enqueue(r)},async cancel(e){await t.return(e)}})}};function nS(...e){let t=new Headers;for(let r of e)if(r)for(let[e,n]of function*(e){let t,r=!1;if(e instanceof Headers){let r=[];e.forEach((e,t)=>{r.push([t,e])}),t=r}else Array.isArray(e)?t=e:(r=!0,t=Object.entries(e??{}));for(let e of t){let t=e[0];if("string"!=typeof t)throw TypeError(`Expected header name to be a string, got ${typeof t}`);let n=Array.isArray(e[1])?e[1]:[e[1]],a=!1;for(let e of n)void 0!==e&&(r&&!a&&(a=!0,yield[t,null]),yield[t,e])}}(r))null===n?t.delete(e):t.append(e,n);let r=[];return t.forEach((e,t)=>{r.push([t,e])}),Object.fromEntries(r)}let nk=/(\/threads\/(?<thread_id>.+))?\/runs\/(?<run_id>.+)/;function nT(e){let t=e.headers.get("Content-Location");if(!t)return;let r=nk.exec(t);if(r?.groups?.run_id)return{run_id:r.groups.run_id,thread_id:r.groups.thread_id||void 0}}var nA=class{asyncCaller;timeoutMs;apiUrl;defaultHeaders;onRequest;constructor(e){const t={maxRetries:4,maxConcurrency:4,...e?.callerOptions};let r="http://localhost:8123";if(!e?.apiUrl&&"object"==typeof globalThis&&null!=globalThis){const e=Symbol.for("langgraph_api:fetch"),n=Symbol.for("langgraph_api:url"),a=globalThis;a[e]&&(t.fetch??=a[e]),a[n]&&(r=a[n])}this.asyncCaller=new nb(t),this.timeoutMs=e?.timeoutMs,this.apiUrl=e?.apiUrl?.replace(/\/$/,"")||r,this.defaultHeaders=e?.defaultHeaders||{},this.onRequest=e?.onRequest;const n=function(e){if(null!==e){if(e)return e;for(let e of["LANGGRAPH","LANGSMITH","LANGCHAIN"]){let t=function(e){try{return void 0!==X.default?X.default.env?.[e]:void 0}catch(e){return}}(`${e}_API_KEY`);if(t)return t.trim().replace(/^["']|["']$/g,"")}}}(e?.apiKey);n&&(this.defaultHeaders["x-api-key"]=n)}prepareFetchOptions(e,t){let r={...t,headers:nS(this.defaultHeaders,t?.headers)};r.json&&(r.body=JSON.stringify(r.json),r.headers=nS(r.headers,{"content-type":"application/json"}),delete r.json),r.withResponse&&delete r.withResponse;let n=null;void 0!==t?.timeoutMs?null!=t.timeoutMs&&(n=AbortSignal.timeout(t.timeoutMs)):null!=this.timeoutMs&&(n=AbortSignal.timeout(this.timeoutMs)),r.signal=function(...e){let t=e.filter(e=>null!=e);if(0===t.length)return;if(1===t.length)return t[0];let r=new AbortController;for(let t of e){if(t?.aborted){r.abort(t.reason);break}t?.addEventListener("abort",()=>r.abort(t.reason),{once:!0})}return r.signal}(n,r.signal);let a=new URL(`${this.apiUrl}${e}`);if(r.params){for(let[e,t]of Object.entries(r.params)){if(null==t)continue;let r="string"==typeof t||"number"==typeof t?t.toString():JSON.stringify(t);a.searchParams.append(e,r)}delete r.params}return[a,r]}async fetch(e,t){let[r,n]=this.prepareFetchOptions(e,t),a=n;this.onRequest&&(a=await this.onRequest(r,n));let i=await this.asyncCaller.fetch(r,a),o=(()=>{if(202!==i.status&&204!==i.status)return i.json()})();return t?.withResponse?[await o,i]:o}},nN=class extends nA{async createForThread(e,t,r){let n={schedule:r?.schedule,input:r?.input,config:r?.config,context:r?.context,metadata:r?.metadata,assistant_id:t,interrupt_before:r?.interruptBefore,interrupt_after:r?.interruptAfter,webhook:r?.webhook,multitask_strategy:r?.multitaskStrategy,if_not_exists:r?.ifNotExists,checkpoint_during:r?.checkpointDuring,durability:r?.durability};return this.fetch(`/threads/${e}/runs/crons`,{method:"POST",json:n})}async create(e,t){let r={schedule:t?.schedule,input:t?.input,config:t?.config,context:t?.context,metadata:t?.metadata,assistant_id:e,interrupt_before:t?.interruptBefore,interrupt_after:t?.interruptAfter,webhook:t?.webhook,multitask_strategy:t?.multitaskStrategy,if_not_exists:t?.ifNotExists,checkpoint_during:t?.checkpointDuring,durability:t?.durability};return this.fetch("/runs/crons",{method:"POST",json:r})}async delete(e){await this.fetch(`/runs/crons/${e}`,{method:"DELETE"})}async search(e){return this.fetch("/runs/crons/search",{method:"POST",json:{assistant_id:e?.assistantId??void 0,thread_id:e?.threadId??void 0,limit:e?.limit??10,offset:e?.offset??0,sort_by:e?.sortBy??void 0,sort_order:e?.sortOrder??void 0,select:e?.select??void 0}})}async count(e){return this.fetch("/runs/crons/count",{method:"POST",json:{assistant_id:e?.assistantId??void 0,thread_id:e?.threadId??void 0}})}},nI=class extends nA{async get(e){return this.fetch(`/assistants/${e}`)}async getGraph(e,t){return this.fetch(`/assistants/${e}/graph`,{params:{xray:t?.xray}})}async getSchemas(e){return this.fetch(`/assistants/${e}/schemas`)}async getSubgraphs(e,t){return t?.namespace?this.fetch(`/assistants/${e}/subgraphs/${t.namespace}`,{params:{recurse:t?.recurse}}):this.fetch(`/assistants/${e}/subgraphs`,{params:{recurse:t?.recurse}})}async create(e){return this.fetch("/assistants",{method:"POST",json:{graph_id:e.graphId,config:e.config,context:e.context,metadata:e.metadata,assistant_id:e.assistantId,if_exists:e.ifExists,name:e.name,description:e.description}})}async update(e,t){return this.fetch(`/assistants/${e}`,{method:"PATCH",json:{graph_id:t.graphId,config:t.config,context:t.context,metadata:t.metadata,name:t.name,description:t.description}})}async delete(e){return this.fetch(`/assistants/${e}`,{method:"DELETE"})}async search(e){return this.fetch("/assistants/search",{method:"POST",json:{graph_id:e?.graphId??void 0,name:e?.name??void 0,metadata:e?.metadata??void 0,limit:e?.limit??10,offset:e?.offset??0,sort_by:e?.sortBy??void 0,sort_order:e?.sortOrder??void 0,select:e?.select??void 0}})}async count(e){return this.fetch("/assistants/count",{method:"POST",json:{metadata:e?.metadata??void 0,graph_id:e?.graphId??void 0}})}async getVersions(e,t){return this.fetch(`/assistants/${e}/versions`,{method:"POST",json:{metadata:t?.metadata??void 0,limit:t?.limit??10,offset:t?.offset??0}})}async setLatest(e,t){return this.fetch(`/assistants/${e}/latest`,{method:"POST",json:{version:t}})}},nC=class extends nA{async get(e){return this.fetch(`/threads/${e}`)}async create(e){let t="number"==typeof e?.ttl?{ttl:e.ttl,strategy:"delete"}:e?.ttl;return this.fetch("/threads",{method:"POST",json:{metadata:{...e?.metadata,graph_id:e?.graphId},thread_id:e?.threadId,if_exists:e?.ifExists,supersteps:e?.supersteps?.map(e=>({updates:e.updates.map(e=>({values:e.values,command:e.command,as_node:e.asNode}))})),ttl:t}})}async copy(e){return this.fetch(`/threads/${e}/copy`,{method:"POST"})}async update(e,t){let r="number"==typeof t?.ttl?{ttl:t.ttl,strategy:"delete"}:t?.ttl;return this.fetch(`/threads/${e}`,{method:"PATCH",json:{metadata:t?.metadata,ttl:r}})}async delete(e){return this.fetch(`/threads/${e}`,{method:"DELETE"})}async search(e){return this.fetch("/threads/search",{method:"POST",json:{metadata:e?.metadata??void 0,ids:e?.ids??void 0,limit:e?.limit??10,offset:e?.offset??0,status:e?.status,sort_by:e?.sortBy,sort_order:e?.sortOrder,select:e?.select??void 0,values:e?.values??void 0}})}async count(e){return this.fetch("/threads/count",{method:"POST",json:{metadata:e?.metadata??void 0,values:e?.values??void 0,status:e?.status??void 0}})}async getState(e,t,r){return null!=t?"string"!=typeof t?this.fetch(`/threads/${e}/state/checkpoint`,{method:"POST",json:{checkpoint:t,subgraphs:r?.subgraphs}}):this.fetch(`/threads/${e}/state/${t}`,{params:{subgraphs:r?.subgraphs}}):this.fetch(`/threads/${e}/state`,{params:{subgraphs:r?.subgraphs}})}async updateState(e,t){return this.fetch(`/threads/${e}/state`,{method:"POST",json:{values:t.values,checkpoint_id:t.checkpointId,checkpoint:t.checkpoint,as_node:t?.asNode}})}async patchState(e,t){let r;if("string"!=typeof e){if("string"!=typeof e.configurable?.thread_id)throw Error("Thread ID is required when updating state with a config.");r=e.configurable.thread_id}else r=e;return this.fetch(`/threads/${r}/state`,{method:"PATCH",json:{metadata:t}})}async getHistory(e,t){return this.fetch(`/threads/${e}/history`,{method:"POST",json:{limit:t?.limit??10,before:t?.before,metadata:t?.metadata,checkpoint:t?.checkpoint}})}async *joinStream(e,t){let[r,n]=this.prepareFetchOptions(`/threads/${e}/stream`,{method:"GET",headers:t?.lastEventId?{"Last-Event-ID":t.lastEventId}:void 0,params:t?.streamMode?{stream_mode:t.streamMode}:void 0});null!=this.onRequest&&(n=await this.onRequest(r,n));let a=((await this.asyncCaller.fetch(r,n)).body||new ReadableStream({start:e=>e.close()})).pipeThrough(nv()).pipeThrough(n_());yield*nx.fromReadableStream(a)}},nR=class extends nA{async *stream(e,t,r){let n={input:r?.input,command:r?.command,config:r?.config,context:r?.context,metadata:r?.metadata,stream_mode:r?.streamMode,stream_subgraphs:r?.streamSubgraphs,stream_resumable:r?.streamResumable,feedback_keys:r?.feedbackKeys,assistant_id:t,interrupt_before:r?.interruptBefore,interrupt_after:r?.interruptAfter,checkpoint:r?.checkpoint,checkpoint_id:r?.checkpointId,webhook:r?.webhook,multitask_strategy:r?.multitaskStrategy,on_completion:r?.onCompletion,on_disconnect:r?.onDisconnect,after_seconds:r?.afterSeconds,if_not_exists:r?.ifNotExists,checkpoint_during:r?.checkpointDuring,durability:r?.durability},a=null==e?"/runs/stream":`/threads/${e}/runs/stream`,[i,o]=this.prepareFetchOptions(a,{method:"POST",json:n,timeoutMs:null,signal:r?.signal});null!=this.onRequest&&(o=await this.onRequest(i,o));let s=await this.asyncCaller.fetch(i,o),l=nT(s);l&&r?.onRunCreated?.(l);let u=(s.body||new ReadableStream({start:e=>e.close()})).pipeThrough(nv()).pipeThrough(n_());yield*nx.fromReadableStream(u)}async create(e,t,r){let n={input:r?.input,command:r?.command,config:r?.config,context:r?.context,metadata:r?.metadata,stream_mode:r?.streamMode,stream_subgraphs:r?.streamSubgraphs,stream_resumable:r?.streamResumable,assistant_id:t,interrupt_before:r?.interruptBefore,interrupt_after:r?.interruptAfter,webhook:r?.webhook,checkpoint:r?.checkpoint,checkpoint_id:r?.checkpointId,multitask_strategy:r?.multitaskStrategy,after_seconds:r?.afterSeconds,if_not_exists:r?.ifNotExists,checkpoint_during:r?.checkpointDuring,durability:r?.durability,langsmith_tracer:r?._langsmithTracer?{project_name:r?._langsmithTracer?.projectName,example_id:r?._langsmithTracer?.exampleId}:void 0},a=null===e?"/runs":`/threads/${e}/runs`,[i,o]=await this.fetch(a,{method:"POST",json:n,signal:r?.signal,withResponse:!0}),s=nT(o);return s&&r?.onRunCreated?.(s),i}async createBatch(e){let t=e.map(e=>({...e,assistant_id:e.assistantId})).map(e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>void 0!==t)));return this.fetch("/runs/batch",{method:"POST",json:t})}async wait(e,t,r){let n={input:r?.input,command:r?.command,config:r?.config,context:r?.context,metadata:r?.metadata,assistant_id:t,interrupt_before:r?.interruptBefore,interrupt_after:r?.interruptAfter,checkpoint:r?.checkpoint,checkpoint_id:r?.checkpointId,webhook:r?.webhook,multitask_strategy:r?.multitaskStrategy,on_completion:r?.onCompletion,on_disconnect:r?.onDisconnect,after_seconds:r?.afterSeconds,if_not_exists:r?.ifNotExists,checkpoint_during:r?.checkpointDuring,durability:r?.durability,langsmith_tracer:r?._langsmithTracer?{project_name:r?._langsmithTracer?.projectName,example_id:r?._langsmithTracer?.exampleId}:void 0},a=null==e?"/runs/wait":`/threads/${e}/runs/wait`,[i,o]=await this.fetch(a,{method:"POST",json:n,timeoutMs:null,signal:r?.signal,withResponse:!0}),s=nT(o);if(s&&r?.onRunCreated?.(s),(r?.raiseError===void 0||r.raiseError)&&"__error__"in i&&"object"==typeof i.__error__&&i.__error__&&"error"in i.__error__&&"message"in i.__error__)throw Error(`${i.__error__?.error}: ${i.__error__?.message}`);return i}async list(e,t){return this.fetch(`/threads/${e}/runs`,{params:{limit:t?.limit??10,offset:t?.offset??0,status:t?.status??void 0,select:t?.select??void 0}})}async get(e,t){return this.fetch(`/threads/${e}/runs/${t}`)}async cancel(e,t,r=!1,n="interrupt"){return this.fetch(`/threads/${e}/runs/${t}/cancel`,{method:"POST",params:{wait:r?"1":"0",action:n}})}async join(e,t,r){return this.fetch(`/threads/${e}/runs/${t}/join`,{timeoutMs:null,signal:r?.signal})}async *joinStream(e,t,r){let n="object"==typeof r&&null!=r&&r instanceof AbortSignal?{signal:r}:r,[a,i]=this.prepareFetchOptions(null!=e?`/threads/${e}/runs/${t}/stream`:`/runs/${t}/stream`,{method:"GET",timeoutMs:null,signal:n?.signal,headers:n?.lastEventId?{"Last-Event-ID":n.lastEventId}:void 0,params:{cancel_on_disconnect:n?.cancelOnDisconnect?"1":"0",stream_mode:n?.streamMode}});null!=this.onRequest&&(i=await this.onRequest(a,i));let o=((await this.asyncCaller.fetch(a,i)).body||new ReadableStream({start:e=>e.close()})).pipeThrough(nv()).pipeThrough(n_());yield*nx.fromReadableStream(o)}async delete(e,t){return this.fetch(`/threads/${e}/runs/${t}`,{method:"DELETE"})}},nO=class extends nA{async putItem(e,t,r,n){e.forEach(e=>{if(e.includes("."))throw Error(`Invalid namespace label '${e}'. Namespace labels cannot contain periods ('.')`)});let a={namespace:e,key:t,value:r,index:n?.index,ttl:n?.ttl};return this.fetch("/store/items",{method:"PUT",json:a})}async getItem(e,t,r){e.forEach(e=>{if(e.includes("."))throw Error(`Invalid namespace label '${e}'. Namespace labels cannot contain periods ('.')`)});let n={namespace:e.join("."),key:t};r?.refreshTtl!==void 0&&(n.refresh_ttl=r.refreshTtl);let a=await this.fetch("/store/items",{params:n});return a?{...a,createdAt:a.created_at,updatedAt:a.updated_at}:null}async deleteItem(e,t){return e.forEach(e=>{if(e.includes("."))throw Error(`Invalid namespace label '${e}'. Namespace labels cannot contain periods ('.')`)}),this.fetch("/store/items",{method:"DELETE",json:{namespace:e,key:t}})}async searchItems(e,t){let r={namespace_prefix:e,filter:t?.filter,limit:t?.limit??10,offset:t?.offset??0,query:t?.query,refresh_ttl:t?.refreshTtl};return{items:(await this.fetch("/store/items/search",{method:"POST",json:r})).items.map(e=>({...e,createdAt:e.created_at,updatedAt:e.updated_at}))}}async listNamespaces(e){let t={prefix:e?.prefix,suffix:e?.suffix,max_depth:e?.maxDepth,limit:e?.limit??100,offset:e?.offset??0};return this.fetch("/store/namespaces",{method:"POST",json:t})}},nL=class e extends nA{static promiseCache={};static getOrCached(t,r){if(null!=e.promiseCache[t])return e.promiseCache[t];let n=r();return e.promiseCache[t]=n,n}async getComponent(t,r){return e.getOrCached(`${this.apiUrl}-${t}-${r}`,async()=>{let[e,n]=this.prepareFetchOptions(`/ui/${t}`,{headers:{Accept:"text/html","Content-Type":"application/json"},method:"POST",json:{name:r}});return null!=this.onRequest&&(n=await this.onRequest(e,n)),(await this.asyncCaller.fetch(e,n)).text()})}},nP=class{assistants;threads;runs;crons;store;"~ui";"~configHash";constructor(e){this["~configHash"]=JSON.stringify({apiUrl:e?.apiUrl,apiKey:e?.apiKey,timeoutMs:e?.timeoutMs,defaultHeaders:e?.defaultHeaders,maxConcurrency:e?.callerOptions?.maxConcurrency,maxRetries:e?.callerOptions?.maxRetries,callbacks:{onFailedResponseHook:e?.callerOptions?.onFailedResponseHook!=null,onRequest:e?.onRequest!=null,fetch:e?.callerOptions?.fetch!=null}}),this.assistants=new nI(e),this.threads=new nC(e),this.runs=new nR(e),this.crons=new nN(e),this.store=new nO(e),this["~ui"]=new nL(e)}};let nD=(0,Q.createContext)(null);function nM({children:e,deploymentUrl:t,apiKey:r}){let n=(0,Q.useMemo)(()=>new nP({apiUrl:t,defaultHeaders:{"Content-Type":"application/json","X-Api-Key":r}}),[t,r]),a=(0,Q.useMemo)(()=>({client:n}),[n]);return(0,J.jsx)(nD.Provider,{value:a,children:e})}function nj(){let e=(0,Q.useContext)(nD);if(!e)throw Error("useClient must be used within a ClientProvider");return e.client}let nF=ro("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),n$=ro("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),nU=ro("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),nz=ro("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]),nB=ro("panel-right",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),nH=ro("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]),nG=ro("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),nV=(0,Q.createContext)(null);nV.displayName="PanelGroupContext";let nq="data-panel-group-direction",nW="data-panel-group-id",nZ="data-resize-handle",nK="data-panel-resize-handle-id",nY=Q.useLayoutEffect,nX=Q["useId".toString()],nJ="function"==typeof nX?nX:()=>null,nQ=0;function n0(e=null){let t=nJ(),r=(0,Q.useRef)(e||t||null);return null===r.current&&(r.current=""+nQ++),null!=e?e:r.current}function n1({children:e,className:t="",collapsedSize:r,collapsible:n,defaultSize:a,forwardedRef:i,id:o,maxSize:s,minSize:l,onCollapse:u,onExpand:c,onResize:d,order:p,style:f,tagName:m="div",...h}){let g=(0,Q.useContext)(nV);if(null===g)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:b,expandPanel:y,getPanelSize:v,getPanelStyle:_,groupId:w,isPanelCollapsed:E,reevaluatePanelConstraints:x,registerPanel:S,resizePanel:k,unregisterPanel:T}=g,A=n0(o),N=(0,Q.useRef)({callbacks:{onCollapse:u,onExpand:c,onResize:d},constraints:{collapsedSize:r,collapsible:n,defaultSize:a,maxSize:s,minSize:l},id:A,idIsFromProps:void 0!==o,order:p});(0,Q.useRef)({didLogMissingDefaultSizeWarning:!1}),nY(()=>{let{callbacks:e,constraints:t}=N.current,i={...t};N.current.id=A,N.current.idIsFromProps=void 0!==o,N.current.order=p,e.onCollapse=u,e.onExpand=c,e.onResize=d,t.collapsedSize=r,t.collapsible=n,t.defaultSize=a,t.maxSize=s,t.minSize=l,(i.collapsedSize!==t.collapsedSize||i.collapsible!==t.collapsible||i.maxSize!==t.maxSize||i.minSize!==t.minSize)&&x(N.current,i)}),nY(()=>{let e=N.current;return S(e),()=>{T(e)}},[p,A,S,T]),(0,Q.useImperativeHandle)(i,()=>({collapse:()=>{b(N.current)},expand:e=>{y(N.current,e)},getId:()=>A,getSize:()=>v(N.current),isCollapsed:()=>E(N.current),isExpanded:()=>!E(N.current),resize:e=>{k(N.current,e)}}),[b,y,v,E,A,k]);let I=_(N.current,a);return(0,Q.createElement)(m,{...h,children:e,className:t,id:A,style:{...I,...f},[nW]:w,"data-panel":"","data-panel-collapsible":n||void 0,"data-panel-id":A,"data-panel-size":parseFloat(""+I.flexGrow).toFixed(1)})}let n2=(0,Q.forwardRef)((e,t)=>(0,Q.createElement)(n1,{...e,forwardedRef:t}));n1.displayName="Panel",n2.displayName="forwardRef(Panel)";let n4=null,n3=-1,n5=null;function n6(e,r,n){var a,i,o;let s=function(e,t){let r=(t&ao)!=0,n=(t&as)!=0,a=(t&al)!=0,i=(t&au)!=0;if(t){if(r)if(a)return"se-resize";else if(i)return"ne-resize";else return"e-resize";else if(n)if(a)return"sw-resize";else if(i)return"nw-resize";else return"w-resize";else if(a)return"s-resize";else if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,r);n4!==s&&(n4=s,null===n5&&(n5=document.createElement("style"),t&&n5.setAttribute("nonce",t),document.head.appendChild(n5)),n3>=0&&(null==(o=n5.sheet)||o.removeRule(n3)),n3=null!=(a=null==(i=n5.sheet)?void 0:i.insertRule(`*{cursor: ${s} !important;}`))?a:-1)}function n9(e){return"keydown"===e.type}function n8(e){return e.type.startsWith("pointer")}function n7(e){return e.type.startsWith("mouse")}function ae(e){if(n8(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(n7(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}let at=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ar(e){let t=e.length;for(;t--;){let r=e[t];if(aS(r,"Missing node"),function(e){var t;let r,n=getComputedStyle(e);return"fixed"===n.position||!!("auto"!==n.zIndex&&("static"!==n.position||"flex"===(r=getComputedStyle(null!=(t=ai(e))?t:e).display)||"inline-flex"===r)||1>+n.opacity||"transform"in n&&"none"!==n.transform||"webkitTransform"in n&&"none"!==n.webkitTransform||"mixBlendMode"in n&&"normal"!==n.mixBlendMode||"filter"in n&&"none"!==n.filter||"webkitFilter"in n&&"none"!==n.webkitFilter||"isolation"in n&&"isolate"===n.isolation||at.test(n.willChange))||"touch"===n.webkitOverflowScrolling}(r))return r}return null}function an(e){return e&&Number(getComputedStyle(e).zIndex)||0}function aa(e){let t=[];for(;e;)t.push(e),e=ai(e);return t}function ai(e){let{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}let ao=1,as=2,al=4,au=8,ac="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}(),ad=[],ap=!1,af=new Map,am=new Map,ah=new Set;function ag(e){let{target:t}=e,{x:r,y:n}=ae(e);ap=!0,a_({target:t,x:r,y:n}),aE(),ad.length>0&&(ax("down",e),aw(),e.preventDefault(),av(t)||e.stopImmediatePropagation())}function ab(e){let{x:t,y:r}=ae(e);if(ap&&"pointerleave"!==e.type&&0===e.buttons&&(ap=!1,ax("up",e)),!ap){let{target:n}=e;a_({target:n,x:t,y:r})}ax("move",e),aw(),ad.length>0&&e.preventDefault()}function ay(e){let{target:t}=e,{x:r,y:n}=ae(e);am.clear(),ap=!1,ad.length>0&&(e.preventDefault(),av(t)||e.stopImmediatePropagation()),ax("up",e),a_({target:t,x:r,y:n}),aw(),aE()}function av(e){let t=e;for(;t;){if(t.hasAttribute(nZ))return!0;t=t.parentElement}return!1}function a_({target:e,x:t,y:r}){ad.splice(0);let n=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(n=e),ah.forEach(e=>{let{element:a,hitAreaMargins:i}=e,o=a.getBoundingClientRect(),{bottom:s,left:l,right:u,top:c}=o,d=ac?i.coarse:i.fine;if(t>=l-d&&t<=u+d&&r>=c-d&&r<=s+d){if(null!==n&&document.contains(n)&&a!==n&&!a.contains(n)&&!n.contains(a)&&function(e,t){let r;if(e===t)throw Error("Cannot compare node with itself");let n={a:aa(e),b:aa(t)};for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;aS(r,"Stacking order can only be calculated for elements with a common ancestor");let a={a:an(ar(n.a)),b:an(ar(n.b))};if(a.a===a.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},a=e.length;for(;a--;){let r=e[a];if(r===t.a)return 1;if(r===t.b)return -1}}return Math.sign(a.a-a.b)}(n,a)>0){let e=n,t=!1;for(;e;){var p;if(e.contains(a))break;if(p=e.getBoundingClientRect(),p.x<o.x+o.width&&p.x+p.width>o.x&&p.y<o.y+o.height&&p.y+p.height>o.y){t=!0;break}e=e.parentElement}if(t)return}ad.push(e)}})}function aw(){let e=!1,t=!1;ad.forEach(r=>{let{direction:n}=r;"horizontal"===n?e=!0:t=!0});let r=0;am.forEach(e=>{r|=e}),e&&t?n6("intersection",r,ap):e?n6("horizontal",r,ap):t?n6("vertical",r,ap):null!==n5&&(document.head.removeChild(n5),n4=null,n5=null,n3=-1)}function aE(){var e;null==(e=r)||e.abort();let t={capture:!0,signal:(r=new AbortController).signal};ah.size&&(ap?(ad.length>0&&af.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",ay,t),n.addEventListener("pointerleave",ab,t),n.addEventListener("pointermove",ab,t))}),af.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",ay,t),n.addEventListener("pointercancel",ay,t)})):af.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",ag,t),n.addEventListener("pointermove",ab,t))}))}function ax(e,t){ah.forEach(r=>{let{setResizeHandlerState:n}=r;n(e,ad.includes(r),t)})}function aS(e,t){if(!e)throw console.error(t),Error(t)}function ak(e,t,r=10){return e.toFixed(r)===t.toFixed(r)?0:e>t?1:-1}function aT(e,t,r=10){return 0===ak(e,t,r)}function aA(e,t,r){return 0===ak(e,t,r)}function aN({panelConstraints:e,panelIndex:t,size:r}){let n=e[t];aS(null!=n,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:i,maxSize:o=100,minSize:s=0}=n;return 0>ak(r,s)&&(r=i&&0>ak(r,(a+s)/2)?a:s),r=parseFloat((r=Math.min(o,r)).toFixed(10))}function aI({delta:e,initialLayout:t,panelConstraints:r,pivotIndices:n,prevLayout:a,trigger:i}){if(aA(e,0))return t;let o=[...t],[s,l]=n;aS(null!=s,"Invalid first pivot index"),aS(null!=l,"Invalid second pivot index");let u=0;if("keyboard"===i){{let n=e<0?l:s,a=r[n];aS(a,`Panel constraints not found for index ${n}`);let{collapsedSize:i=0,collapsible:o,minSize:u=0}=a;if(o){let r=t[n];if(aS(null!=r,`Previous layout not found for panel index ${n}`),aA(r,i)){let t=u-r;ak(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let n=e<0?s:l,a=r[n];aS(a,`No panel constraints found for index ${n}`);let{collapsedSize:i=0,collapsible:o,minSize:u=0}=a;if(o){let r=t[n];if(aS(null!=r,`Previous layout not found for panel index ${n}`),aA(r,u)){let t=r-i;ak(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let n=e<0?1:-1,a=e<0?l:s,i=0;for(;;){let e=t[a];if(aS(null!=e,`Previous layout not found for panel index ${a}`),i+=aN({panelConstraints:r,panelIndex:a,size:100})-e,(a+=n)<0||a>=r.length)break}let o=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-o:o}{let n=e<0?s:l;for(;n>=0&&n<r.length;){let a=Math.abs(e)-Math.abs(u),i=t[n];aS(null!=i,`Previous layout not found for panel index ${n}`);let s=aN({panelConstraints:r,panelIndex:n,size:i-a});if(!aA(i,s)&&(u+=i-s,o[n]=s,u.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?n--:n++}}if(function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!aA(e[r],t[r],void 0))return!1;return!0}(a,o))return a;{let n=e<0?l:s,a=t[n];aS(null!=a,`Previous layout not found for panel index ${n}`);let i=a+u,c=aN({panelConstraints:r,panelIndex:n,size:i});if(o[n]=c,!aA(c,i)){let t=i-c,n=e<0?l:s;for(;n>=0&&n<r.length;){let a=o[n];aS(null!=a,`Previous layout not found for panel index ${n}`);let i=aN({panelConstraints:r,panelIndex:n,size:a+t});if(aA(a,i)||(t-=i-a,o[n]=i),aA(t,0))break;e>0?n--:n++}}}return aA(o.reduce((e,t)=>t+e,0),100)?o:a}function aC(e,t=document){return Array.from(t.querySelectorAll(`[${nK}][data-panel-group-id="${e}"]`))}function aR(e,t,r=document){let n=aC(e,r).findIndex(e=>e.getAttribute(nK)===t);return null!=n?n:null}function aO(e,t,r){let n=aR(e,t,r);return null!=n?[n,n+1]:[-1,-1]}function aL(e,t=document){if((t instanceof HTMLElement||"object"==typeof t&&null!==t&&"tagName"in t&&"getAttribute"in t)&&t.dataset.panelGroupId==e)return t;let r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function aP(e,t=document){let r=t.querySelector(`[${nK}="${e}"]`);return r||null}function aD(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function aM(e,t){let{x:r,y:n}=ae(t);return"horizontal"===e?r:n}function aj(e,t,r){t.forEach((t,n)=>{let a=e[n];aS(a,`Panel data not found for index ${n}`);let{callbacks:i,constraints:o,id:s}=a,{collapsedSize:l=0,collapsible:u}=o,c=r[s];if(null==c||t!==c){r[s]=t;let{onCollapse:e,onExpand:n,onResize:a}=i;a&&a(t,c),u&&(e||n)&&(n&&(null==c||aT(c,l))&&!aT(t,l)&&n(),e&&(null==c||!aT(c,l))&&aT(t,l)&&e())}})}function aF(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function a$(e){try{if("u">typeof localStorage)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function aU(e){return`react-resizable-panels:${e}`}function az(e){return e.map(e=>{let{constraints:t,id:r,idIsFromProps:n,order:a}=e;return n?r:a?`${a}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(",")}function aB(e,t){try{let r=aU(e),n=t.getItem(r);if(n){let e=JSON.parse(n);if("object"==typeof e&&null!=e)return e}}catch(e){}return null}function aH(e,t,r,n,a){var i;let o=aU(e),s=az(t),l=null!=(i=aB(e,a))?i:{};l[s]={expandToSizes:Object.fromEntries(r.entries()),layout:n};try{a.setItem(o,JSON.stringify(l))}catch(e){console.error(e)}}function aG({layout:e,panelConstraints:t}){let r=[...e],n=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(", ")}`);if(!aA(n,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];aS(null!=t,`No layout data found for index ${e}`);let a=100/n*t;r[e]=a}let a=0;for(let e=0;e<t.length;e++){let n=r[e];aS(null!=n,`No layout data found for index ${e}`);let i=aN({panelConstraints:t,panelIndex:e,size:n});n!=i&&(a+=n-i,r[e]=i)}if(!aA(a,0))for(let e=0;e<t.length;e++){let n=r[e];aS(null!=n,`No layout data found for index ${e}`);let i=aN({panelConstraints:t,panelIndex:e,size:n+a});if(n!==i&&(a-=i-n,r[e]=i,aA(a,0)))break}return r}let aV={getItem:e=>(a$(aV),aV.getItem(e)),setItem:(e,t)=>{a$(aV),aV.setItem(e,t)}},aq={};function aW({autoSaveId:e=null,children:t,className:r="",direction:n,forwardedRef:a,id:i=null,onLayout:o=null,keyboardResizeBy:s=null,storage:l=aV,style:u,tagName:c="div",...d}){let p=n0(i),f=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(null),[g,b]=(0,Q.useState)([]),y=function(){let[e,t]=(0,Q.useState)(0);return(0,Q.useCallback)(()=>t(e=>e+1),[])}(),v=(0,Q.useRef)({}),_=(0,Q.useRef)(new Map),w=(0,Q.useRef)(0),E=(0,Q.useRef)({autoSaveId:e,direction:n,dragState:m,id:p,keyboardResizeBy:s,onLayout:o,storage:l}),x=(0,Q.useRef)({layout:g,panelDataArray:[],panelDataArrayChanged:!1});(0,Q.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,Q.useImperativeHandle)(a,()=>({getId:()=>E.current.id,getLayout:()=>{let{layout:e}=x.current;return e},setLayout:e=>{let{onLayout:t}=E.current,{layout:r,panelDataArray:n}=x.current,a=aG({layout:e,panelConstraints:n.map(e=>e.constraints)});aD(r,a)||(b(a),x.current.layout=a,t&&t(a),aj(n,a,v.current))}}),[]),nY(()=>{E.current.autoSaveId=e,E.current.direction=n,E.current.dragState=m,E.current.id=p,E.current.onLayout=o,E.current.storage=l}),function({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:n,panelDataArray:a,panelGroupElement:i,setLayout:o}){(0,Q.useRef)({didWarnAboutMissingResizeHandle:!1}),nY(()=>{if(!i)return;let e=aC(r,i);for(let t=0;t<a.length-1;t++){let{valueMax:r,valueMin:i,valueNow:o}=function({layout:e,panelsArray:t,pivotIndices:r}){let n=0,a=100,i=0,o=0,s=r[0];return aS(null!=s,"No pivot index found"),t.forEach((e,t)=>{let{constraints:r}=e,{maxSize:l=100,minSize:u=0}=r;t===s?(n=u,a=l):(i+=u,o+=l)}),{valueMax:Math.min(a,100-i),valueMin:Math.max(n,100-o),valueNow:e[s]}}({layout:n,panelsArray:a,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{let e=a[t];aS(e,`No panel data found for index "${t}"`),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-valuemax",""+Math.round(r)),s.setAttribute("aria-valuemin",""+Math.round(i)),s.setAttribute("aria-valuenow",null!=o?""+Math.round(o):"")}}return()=>{e.forEach((e,t)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")})}},[r,n,a,i]),(0,Q.useEffect)(()=>{if(!i)return;let e=t.current;aS(e,"Eager values not found");let{panelDataArray:a}=e;aS(null!=aL(r,i),`No group found for id "${r}"`);let s=aC(r,i);aS(s,`No resize handles found for group id "${r}"`);let l=s.map(e=>{let t=e.getAttribute(nK);aS(t,"Resize handle element has no handle id attribute");let[s,l]=function(e,t,r,n=document){var a,i,o,s;let l=aP(t,n),u=aC(e,n),c=l?u.indexOf(l):-1;return[null!=(a=null==(i=r[c])?void 0:i.id)?a:null,null!=(o=null==(s=r[c+1])?void 0:s.id)?o:null]}(r,t,a,i);if(null==s||null==l)return()=>{};let u=e=>{if(!e.defaultPrevented&&"Enter"===e.key){e.preventDefault();let l=a.findIndex(e=>e.id===s);if(l>=0){let e=a[l];aS(e,`No panel data found for index ${l}`);let s=n[l],{collapsedSize:u=0,collapsible:c,minSize:d=0}=e.constraints;if(null!=s&&c){let e=aI({delta:aA(s,u)?d-u:u-s,initialLayout:n,panelConstraints:a.map(e=>e.constraints),pivotIndices:aO(r,t,i),prevLayout:n,trigger:"keyboard"});n!==e&&o(e)}}}};return e.addEventListener("keydown",u),()=>{e.removeEventListener("keydown",u)}});return()=>{l.forEach(e=>e())}},[i,e,t,r,n,a,o])}({committedValuesRef:E,eagerValuesRef:x,groupId:p,layout:g,panelDataArray:x.current.panelDataArray,setLayout:b,panelGroupElement:f.current}),(0,Q.useEffect)(()=>{let{panelDataArray:t}=x.current;if(e){if(0===g.length||g.length!==t.length)return;let r=aq[e];null==r&&(r=function(e,t=10){let r=null;return(...n)=>{null!==r&&clearTimeout(r),r=setTimeout(()=>{e(...n)},t)}}(aH,100),aq[e]=r),r(e,[...t],new Map(_.current),g,l)}},[e,g,l]),(0,Q.useEffect)(()=>{});let S=(0,Q.useCallback)(e=>{let{onLayout:t}=E.current,{layout:r,panelDataArray:n}=x.current;if(e.constraints.collapsible){let a=n.map(e=>e.constraints),{collapsedSize:i=0,panelSize:o,pivotIndices:s}=aY(n,e,r);if(aS(null!=o,`Panel size not found for panel "${e.id}"`),!aT(o,i)){_.current.set(e.id,o);let l=aI({delta:aK(n,e)===n.length-1?o-i:i-o,initialLayout:r,panelConstraints:a,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});aF(r,l)||(b(l),x.current.layout=l,t&&t(l),aj(n,l,v.current))}}},[]),k=(0,Q.useCallback)((e,t)=>{let{onLayout:r}=E.current,{layout:n,panelDataArray:a}=x.current;if(e.constraints.collapsible){let i=a.map(e=>e.constraints),{collapsedSize:o=0,panelSize:s=0,minSize:l=0,pivotIndices:u}=aY(a,e,n),c=null!=t?t:l;if(aT(s,o)){let t=_.current.get(e.id),o=null!=t&&t>=c?t:c,l=aI({delta:aK(a,e)===a.length-1?s-o:o-s,initialLayout:n,panelConstraints:i,pivotIndices:u,prevLayout:n,trigger:"imperative-api"});aF(n,l)||(b(l),x.current.layout=l,r&&r(l),aj(a,l,v.current))}}},[]),T=(0,Q.useCallback)(e=>{let{layout:t,panelDataArray:r}=x.current,{panelSize:n}=aY(r,e,t);return aS(null!=n,`Panel size not found for panel "${e.id}"`),n},[]),A=(0,Q.useCallback)((e,t)=>{let{panelDataArray:r}=x.current,n=aK(r,e);return function({defaultSize:e,dragState:t,layout:r,panelData:n,panelIndex:a,precision:i=3}){let o=r[a];return{flexBasis:0,flexGrow:null==o?void 0!=e?e.toFixed(i):"1":1===n.length?"1":o.toFixed(i),flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:m,layout:g,panelData:r,panelIndex:n})},[m,g]),N=(0,Q.useCallback)(e=>{let{layout:t,panelDataArray:r}=x.current,{collapsedSize:n=0,collapsible:a,panelSize:i}=aY(r,e,t);return aS(null!=i,`Panel size not found for panel "${e.id}"`),!0===a&&aT(i,n)},[]),I=(0,Q.useCallback)(e=>{let{layout:t,panelDataArray:r}=x.current,{collapsedSize:n=0,collapsible:a,panelSize:i}=aY(r,e,t);return aS(null!=i,`Panel size not found for panel "${e.id}"`),!a||ak(i,n)>0},[]),C=(0,Q.useCallback)(e=>{let{panelDataArray:t}=x.current;t.push(e),t.sort((e,t)=>{let r=e.order,n=t.order;return null==r&&null==n?0:null==r?-1:null==n?1:r-n}),x.current.panelDataArrayChanged=!0,y()},[y]);nY(()=>{if(x.current.panelDataArrayChanged){x.current.panelDataArrayChanged=!1;let{autoSaveId:r,onLayout:n,storage:a}=E.current,{layout:i,panelDataArray:o}=x.current,s=null;if(r){var e,t;let n=null!=(t=(null!=(e=aB(r,a))?e:{})[az(o)])?t:null;n&&(_.current=new Map(Object.entries(n.expandToSizes)),s=n.layout)}null==s&&(s=function({panelDataArray:e}){let t=Array(e.length),r=e.map(e=>e.constraints),n=0,a=100;for(let i=0;i<e.length;i++){let e=r[i];aS(e,`Panel constraints not found for index ${i}`);let{defaultSize:o}=e;null!=o&&(n++,t[i]=o,a-=o)}for(let i=0;i<e.length;i++){let o=r[i];aS(o,`Panel constraints not found for index ${i}`);let{defaultSize:s}=o;if(null!=s)continue;let l=a/(e.length-n);n++,t[i]=l,a-=l}return t}({panelDataArray:o}));let l=aG({layout:s,panelConstraints:o.map(e=>e.constraints)});aD(i,l)||(b(l),x.current.layout=l,n&&n(l),aj(o,l,v.current))}}),nY(()=>{let e=x.current;return()=>{e.layout=[]}},[]);let R=(0,Q.useCallback)(e=>{let t=!1,r=f.current;return r&&"rtl"===window.getComputedStyle(r,null).getPropertyValue("direction")&&(t=!0),function(r){var n,a;r.preventDefault();let i=f.current;if(!i)return()=>null;let{direction:o,dragState:s,id:l,keyboardResizeBy:u,onLayout:c}=E.current,{layout:d,panelDataArray:p}=x.current,{initialLayout:m}=null!=s?s:{},h=aO(l,e,i),g=function(e,t,r,n,a,i){if(n9(e)){let t="horizontal"===r,n=0;n=e.shiftKey?100:null!=a?a:10;let i=0;switch(e.key){case"ArrowDown":i=t?0:n;break;case"ArrowLeft":i=t?-n:0;break;case"ArrowRight":i=t?n:0;break;case"ArrowUp":i=t?0:-n;break;case"End":i=100;break;case"Home":i=-100}return i}return null==n?0:function(e,t,r,n,a){let i="horizontal"===r,o=aP(t,a);aS(o,`No resize handle element found for id "${t}"`);let s=o.getAttribute(nW);aS(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=n,u=aM(r,e),c=aL(s,a);aS(c,`No group element found for id "${s}"`);let d=c.getBoundingClientRect();return(u-l)/(i?d.width:d.height)*100}(e,t,r,n,i)}(r,e,o,s,u,i),y="horizontal"===o;y&&t&&(g=-g);let _=aI({delta:g,initialLayout:null!=m?m:d,panelConstraints:p.map(e=>e.constraints),pivotIndices:h,prevLayout:d,trigger:n9(r)?"keyboard":"mouse-or-touch"}),S=!aF(d,_);(n8(r)||n7(r))&&w.current!=g&&((w.current=g,S||0===g)?am.set(e,0):y?(n=g<0?ao:as,am.set(e,n)):(a=g<0?al:au,am.set(e,a))),S&&(b(_),x.current.layout=_,c&&c(_),aj(p,_,v.current))}},[]),O=(0,Q.useCallback)((e,t)=>{let{onLayout:r}=E.current,{layout:n,panelDataArray:a}=x.current,i=a.map(e=>e.constraints),{panelSize:o,pivotIndices:s}=aY(a,e,n);aS(null!=o,`Panel size not found for panel "${e.id}"`);let l=aI({delta:aK(a,e)===a.length-1?o-t:t-o,initialLayout:n,panelConstraints:i,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});aF(n,l)||(b(l),x.current.layout=l,r&&r(l),aj(a,l,v.current))},[]),L=(0,Q.useCallback)((e,t)=>{let{layout:r,panelDataArray:n}=x.current,{collapsedSize:a=0,collapsible:i}=t,{collapsedSize:o=0,collapsible:s,maxSize:l=100,minSize:u=0}=e.constraints,{panelSize:c}=aY(n,e,r);null!=c&&(i&&s&&aT(c,a)?aT(a,o)||O(e,o):c<u?O(e,u):c>l&&O(e,l))},[O]),P=(0,Q.useCallback)((e,t)=>{let{direction:r}=E.current,{layout:n}=x.current;if(!f.current)return;let a=aP(e,f.current);aS(a,`Drag handle element not found for id "${e}"`);let i=aM(r,t);h({dragHandleId:e,dragHandleRect:a.getBoundingClientRect(),initialCursorPosition:i,initialLayout:n})},[]),D=(0,Q.useCallback)(()=>{h(null)},[]),M=(0,Q.useCallback)(e=>{let{panelDataArray:t}=x.current,r=aK(t,e);r>=0&&(t.splice(r,1),delete v.current[e.id],x.current.panelDataArrayChanged=!0,y())},[y]),j=(0,Q.useMemo)(()=>({collapsePanel:S,direction:n,dragState:m,expandPanel:k,getPanelSize:T,getPanelStyle:A,groupId:p,isPanelCollapsed:N,isPanelExpanded:I,reevaluatePanelConstraints:L,registerPanel:C,registerResizeHandle:R,resizePanel:O,startDragging:P,stopDragging:D,unregisterPanel:M,panelGroupElement:f.current}),[S,m,n,k,T,A,p,N,I,L,C,R,O,P,D,M]);return(0,Q.createElement)(nV.Provider,{value:j},(0,Q.createElement)(c,{...d,children:t,className:r,id:i,ref:f,style:{display:"flex",flexDirection:"horizontal"===n?"row":"column",height:"100%",overflow:"hidden",width:"100%",...u},"data-panel-group":"",[nq]:n,[nW]:p}))}let aZ=(0,Q.forwardRef)((e,t)=>(0,Q.createElement)(aW,{...e,forwardedRef:t}));function aK(e,t){return e.findIndex(e=>e===t||e.id===t.id)}function aY(e,t,r){let n=aK(e,t),a=n===e.length-1,i=r[n];return{...t.constraints,panelSize:i,pivotIndices:a?[n-1,n]:[n,n+1]}}function aX({children:e=null,className:t="",disabled:r=!1,hitAreaMargins:n,id:a,onBlur:i,onClick:o,onDragging:s,onFocus:l,onPointerDown:u,onPointerUp:c,style:d={},tabIndex:p=0,tagName:f="div",...m}){var h,g;let b=(0,Q.useRef)(null),y=(0,Q.useRef)({onClick:o,onDragging:s,onPointerDown:u,onPointerUp:c});(0,Q.useEffect)(()=>{y.current.onClick=o,y.current.onDragging=s,y.current.onPointerDown=u,y.current.onPointerUp=c});let v=(0,Q.useContext)(nV);if(null===v)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:_,groupId:w,registerResizeHandle:E,startDragging:x,stopDragging:S,panelGroupElement:k}=v,T=n0(a),[A,N]=(0,Q.useState)("inactive"),[I,C]=(0,Q.useState)(!1),[R,O]=(0,Q.useState)(null),L=(0,Q.useRef)({state:A});nY(()=>{L.current.state=A}),(0,Q.useEffect)(()=>{if(r)O(null);else{let e=E(T);O(()=>e)}},[r,T,E]);let P=null!=(h=null==n?void 0:n.coarse)?h:15,D=null!=(g=null==n?void 0:n.fine)?g:5;return(0,Q.useEffect)(()=>{if(r||null==R)return;let e=b.current;aS(e,"Element ref not attached");let t=!1;return function(e,t,r,n,a){var i;let{ownerDocument:o}=t,s={direction:r,element:t,hitAreaMargins:n,setResizeHandlerState:a},l=null!=(i=af.get(o))?i:0;return af.set(o,l+1),ah.add(s),aE(),function(){var t;am.delete(e),ah.delete(s);let r=null!=(t=af.get(o))?t:1;if(af.set(o,r-1),aE(),1===r&&af.delete(o),ad.includes(s)){let e=ad.indexOf(s);e>=0&&ad.splice(e,1),aw(),a("up",!0,null)}}}(T,e,_,{coarse:P,fine:D},(e,r,n)=>{if(!r)return void N("inactive");switch(e){case"down":{N("drag"),t=!1,aS(n,'Expected event to be defined for "down" action'),x(T,n);let{onDragging:e,onPointerDown:r}=y.current;null==e||e(!0),null==r||r();break}case"move":{let{state:e}=L.current;t=!0,"drag"!==e&&N("hover"),aS(n,'Expected event to be defined for "move" action'),R(n);break}case"up":{N("hover"),S();let{onClick:e,onDragging:r,onPointerUp:n}=y.current;null==r||r(!1),null==n||n(),t||null==e||e()}}})},[P,_,r,D,E,T,R,x,S]),!function({disabled:e,handleId:t,resizeHandler:r,panelGroupElement:n}){(0,Q.useEffect)(()=>{if(e||null==r||null==n)return;let a=aP(t,n);if(null==a)return;let i=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),r(e);break;case"F6":{e.preventDefault();let r=a.getAttribute(nW);aS(r,`No group element found for id "${r}"`);let i=aC(r,n),o=aR(r,t,n);aS(null!==o,`No resize element found for id "${t}"`);let s=e.shiftKey?o>0?o-1:i.length-1:o+1<i.length?o+1:0;i[s].focus()}}};return a.addEventListener("keydown",i),()=>{a.removeEventListener("keydown",i)}},[n,e,t,r])}({disabled:r,handleId:T,resizeHandler:R,panelGroupElement:k}),(0,Q.createElement)(f,{...m,children:e,className:t,id:a,onBlur:()=>{C(!1),null==i||i()},onFocus:()=>{C(!0),null==l||l()},ref:b,role:"separator",style:{touchAction:"none",userSelect:"none",...d},tabIndex:p,[nq]:_,[nW]:w,[nZ]:"","data-resize-handle-active":"drag"===A?"pointer":I?"keyboard":void 0,"data-panel-resize-handle-enabled":!r,[nK]:T,"data-resize-handle-state":A})}aW.displayName="PanelGroup",aZ.displayName="forwardRef(PanelGroup)",aX.displayName="PanelResizeHandle";let aJ=({className:e,...t})=>(0,J.jsx)(aZ,{className:rZ("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),aQ=({withHandle:e,className:t,...r})=>(0,J.jsx)(aX,{className:rZ("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...r,children:e&&(0,J.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:(0,J.jsx)(nG,{className:"h-2.5 w-2.5"})})}),a0=ro("brain-circuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]),a1=ro("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),a2=ro("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),a4=ro("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),a3=ro("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),a5=ro("pin-off",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]),a6=ro("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]),a9=ro("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),a8=ro("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);var a7=Q.createContext(void 0);function ie(e){let t=Q.useContext(a7);return e||t||"ltr"}function it(e,[t,r]){return Math.min(r,Math.max(t,e))}var ir="ScrollArea",[ia,ii]=ey(ir),[io,is]=ia(ir),il=Q.forwardRef((e,t)=>{let{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:i=600,...o}=e,[s,l]=Q.useState(null),[u,c]=Q.useState(null),[d,p]=Q.useState(null),[f,m]=Q.useState(null),[h,g]=Q.useState(null),[b,y]=Q.useState(0),[v,_]=Q.useState(0),[w,E]=Q.useState(!1),[x,S]=Q.useState(!1),k=eb(t,e=>l(e)),T=ie(a);return(0,J.jsx)(io,{scope:r,type:n,dir:T,scrollHideDelay:i,scrollArea:s,viewport:u,onViewportChange:c,content:d,onContentChange:p,scrollbarX:f,onScrollbarXChange:m,scrollbarXEnabled:w,onScrollbarXEnabledChange:E,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:x,onScrollbarYEnabledChange:S,onCornerWidthChange:y,onCornerHeightChange:_,children:(0,J.jsx)(eN.div,{dir:T,...o,ref:k,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":v+"px",...e.style}})})});il.displayName=ir;var iu="ScrollAreaViewport",ic=Q.forwardRef((e,t)=>{let{__scopeScrollArea:r,children:n,nonce:a,...i}=e,o=is(iu,r),s=eb(t,Q.useRef(null),o.onViewportChange);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),(0,J.jsx)(eN.div,{"data-radix-scroll-area-viewport":"",...i,ref:s,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,J.jsx)("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});ic.displayName=iu;var id="ScrollAreaScrollbar",ip=Q.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=is(id,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=a,s="horizontal"===e.orientation;return Q.useEffect(()=>(s?i(!0):o(!0),()=>{s?i(!1):o(!1)}),[s,i,o]),"hover"===a.type?(0,J.jsx)(im,{...n,ref:t,forceMount:r}):"scroll"===a.type?(0,J.jsx)(ih,{...n,ref:t,forceMount:r}):"auto"===a.type?(0,J.jsx)(ig,{...n,ref:t,forceMount:r}):"always"===a.type?(0,J.jsx)(ib,{...n,ref:t}):null});ip.displayName=id;var im=Q.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=is(id,e.__scopeScrollArea),[i,o]=Q.useState(!1);return Q.useEffect(()=>{let e=a.scrollArea,t=0;if(e){let r=()=>{window.clearTimeout(t),o(!0)},n=()=>{t=window.setTimeout(()=>o(!1),a.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[a.scrollArea,a.scrollHideDelay]),(0,J.jsx)(eV,{present:r||i,children:(0,J.jsx)(ig,{"data-state":i?"visible":"hidden",...n,ref:t})})}),ih=Q.forwardRef((e,t)=>{var r;let{forceMount:n,...a}=e,i=is(id,e.__scopeScrollArea),o="horizontal"===e.orientation,s=iD(()=>u("SCROLL_END"),100),[l,u]=(r={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},Q.useReducer((e,t)=>r[e][t]??e,"hidden"));return Q.useEffect(()=>{if("idle"===l){let e=window.setTimeout(()=>u("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,i.scrollHideDelay,u]),Q.useEffect(()=>{let e=i.viewport,t=o?"scrollLeft":"scrollTop";if(e){let r=e[t],n=()=>{let n=e[t];r!==n&&(u("SCROLL"),s()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[i.viewport,o,u,s]),(0,J.jsx)(eV,{present:n||"hidden"!==l,children:(0,J.jsx)(ib,{"data-state":"hidden"===l?"hidden":"visible",...a,ref:t,onPointerEnter:em(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:em(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),ig=Q.forwardRef((e,t)=>{let r=is(id,e.__scopeScrollArea),{forceMount:n,...a}=e,[i,o]=Q.useState(!1),s="horizontal"===e.orientation,l=iD(()=>{if(r.viewport){let e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;o(s?e:t)}},10);return iM(r.viewport,l),iM(r.content,l),(0,J.jsx)(eV,{present:n||i,children:(0,J.jsx)(ib,{"data-state":i?"visible":"hidden",...a,ref:t})})}),ib=Q.forwardRef((e,t)=>{let{orientation:r="vertical",...n}=e,a=is(id,e.__scopeScrollArea),i=Q.useRef(null),o=Q.useRef(0),[s,l]=Q.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=iC(s.viewport,s.content),c={...n,sizes:s,onSizesChange:l,hasThumb:!!(u>0&&u<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return function(e,t,r,n="ltr"){let a=iR(r),i=t||a/2,o=r.scrollbar.paddingStart+i,s=r.scrollbar.size-r.scrollbar.paddingEnd-(a-i),l=r.content-r.viewport;return iL([o,s],"ltr"===n?[0,l]:[-1*l,0])(e)}(e,o.current,s,t)}return"horizontal"===r?(0,J.jsx)(iy,{...c,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){let e=iO(a.viewport.scrollLeft,s,a.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollLeft=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollLeft=d(e,a.dir))}}):"vertical"===r?(0,J.jsx)(iv,{...c,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){let e=iO(a.viewport.scrollTop,s);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollTop=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollTop=d(e))}}):null}),iy=Q.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...a}=e,i=is(id,e.__scopeScrollArea),[o,s]=Q.useState(),l=Q.useRef(null),u=eb(t,l,i.onScrollbarXChange);return Q.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,J.jsx)(iE,{"data-orientation":"horizontal",...a,ref:u,sizes:r,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":iR(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(i.viewport){var n,a;let o=i.viewport.scrollLeft+t.deltaX;e.onWheelScroll(o),n=o,a=r,n>0&&n<a&&t.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:iI(o.paddingLeft),paddingEnd:iI(o.paddingRight)}})}})}),iv=Q.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...a}=e,i=is(id,e.__scopeScrollArea),[o,s]=Q.useState(),l=Q.useRef(null),u=eb(t,l,i.onScrollbarYChange);return Q.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,J.jsx)(iE,{"data-orientation":"vertical",...a,ref:u,sizes:r,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":iR(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(i.viewport){var n,a;let o=i.viewport.scrollTop+t.deltaY;e.onWheelScroll(o),n=o,a=r,n>0&&n<a&&t.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:iI(o.paddingTop),paddingEnd:iI(o.paddingBottom)}})}})}),[i_,iw]=ia(id),iE=Q.forwardRef((e,t)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:c,onResize:d,...p}=e,f=is(id,r),[m,h]=Q.useState(null),g=eb(t,e=>h(e)),b=Q.useRef(null),y=Q.useRef(""),v=f.viewport,_=n.content-n.viewport,w=eI(c),E=eI(l),x=iD(d,10);function S(e){b.current&&u({x:e.clientX-b.current.left,y:e.clientY-b.current.top})}return Q.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&w(e,_)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[v,m,_,w]),Q.useEffect(E,[n,E]),iM(m,x),iM(f.content,x),(0,J.jsx)(i_,{scope:r,scrollbar:m,hasThumb:a,onThumbChange:eI(i),onThumbPointerUp:eI(o),onThumbPositionChange:E,onThumbPointerDown:eI(s),children:(0,J.jsx)(eN.div,{...p,ref:g,style:{position:"absolute",...p.style},onPointerDown:em(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),b.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),S(e))}),onPointerMove:em(e.onPointerMove,S),onPointerUp:em(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,f.viewport&&(f.viewport.style.scrollBehavior=""),b.current=null})})})}),ix="ScrollAreaThumb",iS=Q.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=iw(ix,e.__scopeScrollArea);return(0,J.jsx)(eV,{present:r||a.hasThumb,children:(0,J.jsx)(ik,{ref:t,...n})})}),ik=Q.forwardRef((e,t)=>{let{__scopeScrollArea:r,style:n,...a}=e,i=is(ix,r),o=iw(ix,r),{onThumbPositionChange:s}=o,l=eb(t,e=>o.onThumbChange(e)),u=Q.useRef(void 0),c=iD(()=>{u.current&&(u.current(),u.current=void 0)},100);return Q.useEffect(()=>{let e=i.viewport;if(e){let t=()=>{c(),u.current||(u.current=iP(e,s),s())};return s(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,c,s]),(0,J.jsx)(eN.div,{"data-state":o.hasThumb?"visible":"hidden",...a,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:em(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;o.onThumbPointerDown({x:r,y:n})}),onPointerUp:em(e.onPointerUp,o.onThumbPointerUp)})});iS.displayName=ix;var iT="ScrollAreaCorner",iA=Q.forwardRef((e,t)=>{let r=is(iT,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?(0,J.jsx)(iN,{...e,ref:t}):null});iA.displayName=iT;var iN=Q.forwardRef((e,t)=>{let{__scopeScrollArea:r,...n}=e,a=is(iT,r),[i,o]=Q.useState(0),[s,l]=Q.useState(0),u=!!(i&&s);return iM(a.scrollbarX,()=>{let e=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(e),l(e)}),iM(a.scrollbarY,()=>{let e=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(e),o(e)}),u?(0,J.jsx)(eN.div,{...n,ref:t,style:{width:i,height:s,position:"absolute",right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:0,...e.style}}):null});function iI(e){return e?parseInt(e,10):0}function iC(e,t){let r=e/t;return isNaN(r)?0:r}function iR(e){let t=iC(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function iO(e,t,r="ltr"){let n=iR(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,o=t.content-t.viewport,s=it(e,"ltr"===r?[0,o]:[-1*o,0]);return iL([0,o],[0,i-n])(s)}function iL(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}var iP=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return!function a(){let i={left:e.scrollLeft,top:e.scrollTop},o=r.left!==i.left,s=r.top!==i.top;(o||s)&&t(),r=i,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function iD(e,t){let r=eI(e),n=Q.useRef(0);return Q.useEffect(()=>()=>window.clearTimeout(n.current),[]),Q.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function iM(e,t){let r=eI(t);ev(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}function ij({className:e,children:t,...r}){return(0,J.jsxs)(il,{"data-slot":"scroll-area",className:rZ("relative",e),...r,children:[(0,J.jsx)(ic,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] focus-visible:ring-ring/50",children:t}),(0,J.jsx)(iF,{}),(0,J.jsx)(iA,{})]})}function iF({className:e,orientation:t="vertical",...r}){return(0,J.jsx)(ip,{"data-slot":"scroll-area-scrollbar",orientation:t,className:rZ("flex touch-none select-none p-px transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:(0,J.jsx)(iS,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}function i$({className:e,...t}){return(0,J.jsx)("div",{className:rZ("animate-pulse rounded-md bg-muted",e),...t})}function iU(e){var t;let r,n=(t=e,(r=Q.forwardRef((e,t)=>{let{children:r,...n}=e;if(Q.isValidElement(r)){var a;let e,i,o=(a=r,(i=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(i=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...e)=>{let t=i(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...i}:"className"===n&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==Q.Fragment&&(s.ref=t?eg(t,o):o),Q.cloneElement(r,s)}return Q.Children.count(r)>1?Q.Children.only(null):null})).displayName=`${t}.SlotClone`,r),a=Q.forwardRef((e,t)=>{let{children:r,...a}=e,i=Q.Children.toArray(r),o=i.find(iB);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null);return(0,J.jsx)(n,{...a,ref:t,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,r):null})}return(0,J.jsx)(n,{...a,ref:t,children:r})});return a.displayName=`${e}.Slot`,a}var iz=Symbol("radix.slottable");function iB(e){return Q.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===iz}var iH=new WeakMap;function iG(e,t){var r,n;let a,i,o;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let s=(r=e,n=t,a=r.length,(o=(i=iV(n))>=0?i:a+i)<0||o>=a?-1:o);return -1===s?void 0:e[s]}function iV(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],iH.set(this,!0)}set(e,t){return iH.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,a=this.has(t),i=this.#e.length,o=iV(e),s=o>=0?o:i+o,l=s<0||s>=i?-1:s;if(l===this.size||a&&l===this.size-1||-1===l)return this.set(t,r),this;let u=this.size+ +!a;o<0&&s++;let c=[...this.#e],d=!1;for(let e=s;e<u;e++)if(s===e){let i=c[e];c[e]===t&&(i=c[e+1]),a&&this.delete(t),n=this.get(i),this.set(t,r)}else{d||c[e-1]!==t||(d=!0);let r=c[d?e:e-1],a=n;n=this.get(r),this.delete(r),this.set(r,a)}return this}with(t,r,n){let a=new e(this);return a.insert(t,r,n),a}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=iG(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=iG(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return iG(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],a=0;for(let e of this)Reflect.apply(t,r,[e,a,this])&&n.push(e),a++;return new e(n)}map(t,r){let n=[],a=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,a,this])]),a++;return new e(n)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let r of this)a=0===n&&1===e.length?r:Reflect.apply(t,this,[a,r,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let a=this.at(r);n=r===this.size-1&&1===e.length?a:Reflect.apply(t,this,[n,a,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,a=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(a=r-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}});let iq=["top","right","bottom","left"],iW=Math.min,iZ=Math.max,iK=Math.round,iY=Math.floor,iX=e=>({x:e,y:e}),iJ={left:"right",right:"left",bottom:"top",top:"bottom"};function iQ(e,t){return"function"==typeof e?e(t):e}function i0(e){return e.split("-")[0]}function i1(e){return e.split("-")[1]}function i2(e){return"x"===e?"y":"x"}function i4(e){return"y"===e?"height":"width"}function i3(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function i5(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let i6=["left","right"],i9=["right","left"],i8=["top","bottom"],i7=["bottom","top"];function oe(e){let t=i0(e);return iJ[t]+e.slice(t.length)}function ot(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function or(e){let{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function on(e,t,r){let n,{reference:a,floating:i}=e,o=i3(t),s=i2(i3(t)),l=i4(s),u=i0(t),c="y"===o,d=a.x+a.width/2-i.width/2,p=a.y+a.height/2-i.height/2,f=a[l]/2-i[l]/2;switch(u){case"top":n={x:d,y:a.y-i.height};break;case"bottom":n={x:d,y:a.y+a.height};break;case"right":n={x:a.x+a.width,y:p};break;case"left":n={x:a.x-i.width,y:p};break;default:n={x:a.x,y:a.y}}switch(i1(t)){case"start":n[s]-=f*(r&&c?-1:1);break;case"end":n[s]+=f*(r&&c?-1:1)}return n}async function oa(e,t){var r;void 0===t&&(t={});let{x:n,y:a,platform:i,rects:o,elements:s,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=iQ(t,e),m=ot(f),h=s[p?"floating"===d?"reference":"floating":d],g=or(await i.getClippingRect({element:null==(r=await (null==i.isElement?void 0:i.isElement(h)))||r?h:h.contextElement||await (null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),b="floating"===d?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,y=await (null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),v=await (null==i.isElement?void 0:i.isElement(y))&&await (null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},_=or(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:y,strategy:l}):b);return{top:(g.top-_.top+m.top)/v.y,bottom:(_.bottom-g.bottom+m.bottom)/v.y,left:(g.left-_.left+m.left)/v.x,right:(_.right-g.right+m.right)/v.x}}let oi=async(e,t,r)=>{let{placement:n="bottom",strategy:a="absolute",middleware:i=[],platform:o}=r,s=o.detectOverflow?o:{...o,detectOverflow:oa},l=await (null==o.isRTL?void 0:o.isRTL(t)),u=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:c,y:d}=on(u,n,l),p=n,f=0,m={};for(let r=0;r<i.length;r++){let h=i[r];if(!h)continue;let{name:g,fn:b}=h,{x:y,y:v,data:_,reset:w}=await b({x:c,y:d,initialPlacement:n,placement:p,strategy:a,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});c=null!=y?y:c,d=null!=v?v:d,m[g]={...m[g],..._},w&&f<50&&(f++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(u=!0===w.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):w.rects),{x:c,y:d}=on(u,p,l)),r=-1)}return{x:c,y:d,placement:p,strategy:a,middlewareData:m}};function oo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function os(e){return iq.some(t=>e[t]>=0)}let ol=new Set(["left","top"]);async function ou(e,t){let{placement:r,platform:n,elements:a}=e,i=await (null==n.isRTL?void 0:n.isRTL(a.floating)),o=i0(r),s=i1(r),l="y"===i3(r),u=ol.has(o)?-1:1,c=i&&l?-1:1,d=iQ(t,e),{mainAxis:p,crossAxis:f,alignmentAxis:m}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof m&&(f="end"===s?-1*m:m),l?{x:f*c,y:p*u}:{x:p*u,y:f*c}}function oc(){return"u">typeof window}function od(e){return om(e)?(e.nodeName||"").toLowerCase():"#document"}function op(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function of(e){var t;return null==(t=(om(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function om(e){return!!oc()&&(e instanceof Node||e instanceof op(e).Node)}function oh(e){return!!oc()&&(e instanceof Element||e instanceof op(e).Element)}function og(e){return!!oc()&&(e instanceof HTMLElement||e instanceof op(e).HTMLElement)}function ob(e){return!(!oc()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof op(e).ShadowRoot)}function oy(e){let{overflow:t,overflowX:r,overflowY:n,display:a}=oT(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==a&&"contents"!==a}function ov(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let o_=/transform|translate|scale|rotate|perspective|filter/,ow=/paint|layout|strict|content/,oE=e=>!!e&&"none"!==e;function ox(e){let t=oh(e)?oT(e):e;return oE(t.transform)||oE(t.translate)||oE(t.scale)||oE(t.rotate)||oE(t.perspective)||!oS()&&(oE(t.backdropFilter)||oE(t.filter))||o_.test(t.willChange||"")||ow.test(t.contain||"")}function oS(){return null==n&&(n="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),n}function ok(e){return/^(html|body|#document)$/.test(od(e))}function oT(e){return op(e).getComputedStyle(e)}function oA(e){return oh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function oN(e){if("html"===od(e))return e;let t=e.assignedSlot||e.parentNode||ob(e)&&e.host||of(e);return ob(t)?t.host:t}function oI(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let a=function e(t){let r=oN(t);return ok(r)?t.ownerDocument?t.ownerDocument.body:t.body:og(r)&&oy(r)?r:e(r)}(e),i=a===(null==(n=e.ownerDocument)?void 0:n.body),o=op(a);if(!i)return t.concat(a,oI(a,[],r));{let e=oC(o);return t.concat(o,o.visualViewport||[],oy(a)?a:[],e&&r?oI(e):[])}}function oC(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oR(e){let t=oT(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,a=og(e),i=a?e.offsetWidth:r,o=a?e.offsetHeight:n,s=iK(r)!==i||iK(n)!==o;return s&&(r=i,n=o),{width:r,height:n,$:s}}function oO(e){return oh(e)?e:e.contextElement}function oL(e){let t=oO(e);if(!og(t))return iX(1);let r=t.getBoundingClientRect(),{width:n,height:a,$:i}=oR(t),o=(i?iK(r.width):r.width)/n,s=(i?iK(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}let oP=iX(0);function oD(e){let t=op(e);return oS()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:oP}function oM(e,t,r,n){var a;void 0===t&&(t=!1),void 0===r&&(r=!1);let i=e.getBoundingClientRect(),o=oO(e),s=iX(1);t&&(n?oh(n)&&(s=oL(n)):s=oL(e));let l=(void 0===(a=r)&&(a=!1),n&&(!a||n===op(o))&&a)?oD(o):iX(0),u=(i.left+l.x)/s.x,c=(i.top+l.y)/s.y,d=i.width/s.x,p=i.height/s.y;if(o){let e=op(o),t=n&&oh(n)?op(n):n,r=e,a=oC(r);for(;a&&n&&t!==r;){let e=oL(a),t=a.getBoundingClientRect(),n=oT(a),i=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;u*=e.x,c*=e.y,d*=e.x,p*=e.y,u+=i,c+=o,a=oC(r=op(a))}}return or({width:d,height:p,x:u,y:c})}function oj(e,t){let r=oA(e).scrollLeft;return t?t.left+r:oM(of(e)).left+r}function oF(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-oj(e,r),y:r.top+t.scrollTop}}function o$(e,t,r){var n;let a;if("viewport"===t)a=function(e,t){let r=op(e),n=of(e),a=r.visualViewport,i=n.clientWidth,o=n.clientHeight,s=0,l=0;if(a){i=a.width,o=a.height;let e=oS();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,l=a.offsetTop)}let u=oj(n);if(u<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-a);o<=25&&(i-=o)}else u<=25&&(i+=u);return{width:i,height:o,x:s,y:l}}(e,r);else if("document"===t){let t,r,i,o,s,l,u;n=of(e),t=of(n),r=oA(n),i=n.ownerDocument.body,o=iZ(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=iZ(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),l=-r.scrollLeft+oj(n),u=-r.scrollTop,"rtl"===oT(i).direction&&(l+=iZ(t.clientWidth,i.clientWidth)-o),a={width:o,height:s,x:l,y:u}}else if(oh(t)){let e,n,i,o,s,l;n=(e=oM(t,!0,"fixed"===r)).top+t.clientTop,i=e.left+t.clientLeft,o=og(t)?oL(t):iX(1),s=t.clientWidth*o.x,l=t.clientHeight*o.y,a={width:s,height:l,x:i*o.x,y:n*o.y}}else{let r=oD(e);a={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return or(a)}function oU(e){return"static"===oT(e).position}function oz(e,t){if(!og(e)||"fixed"===oT(e).position)return null;if(t)return t(e);let r=e.offsetParent;return of(e)===r&&(r=r.ownerDocument.body),r}function oB(e,t){var r;let n=op(e);if(ov(e))return n;if(!og(e)){let t=oN(e);for(;t&&!ok(t);){if(oh(t)&&!oU(t))return t;t=oN(t)}return n}let a=oz(e,t);for(;a&&(r=a,/^(table|td|th)$/.test(od(r)))&&oU(a);)a=oz(a,t);return a&&ok(a)&&oU(a)&&!ox(a)?n:a||function(e){let t=oN(e);for(;og(t)&&!ok(t);){if(ox(t))return t;if(ov(t))break;t=oN(t)}return null}(e)||n}let oH=async function(e){let t=this.getOffsetParent||oB,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=og(t),a=of(t),i="fixed"===r,o=oM(e,!0,i,t),s={scrollLeft:0,scrollTop:0},l=iX(0);if(n||!n&&!i)if(("body"!==od(t)||oy(a))&&(s=oA(t)),n){let e=oM(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&(l.x=oj(a));i&&!n&&a&&(l.x=oj(a));let u=!a||n||i?iX(0):oF(a,s);return{x:o.left+s.scrollLeft-l.x-u.x,y:o.top+s.scrollTop-l.y-u.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},oG={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e,i="fixed"===a,o=of(n),s=!!t&&ov(t.floating);if(n===o||s&&i)return r;let l={scrollLeft:0,scrollTop:0},u=iX(1),c=iX(0),d=og(n);if((d||!d&&!i)&&(("body"!==od(n)||oy(o))&&(l=oA(n)),d)){let e=oM(n);u=oL(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let p=!o||d||i?iX(0):oF(o,l);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+c.x+p.x,y:r.y*u.y-l.scrollTop*u.y+c.y+p.y}},getDocumentElement:of,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e,i=[..."clippingAncestors"===r?ov(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=oI(e,[],!1).filter(e=>oh(e)&&"body"!==od(e)),a=null,i="fixed"===oT(e).position,o=i?oN(e):e;for(;oh(o)&&!ok(o);){let t=oT(o),r=ox(o);r||"fixed"!==t.position||(a=null),(i?r||a:!(!r&&"static"===t.position&&a&&("absolute"===a.position||"fixed"===a.position)||oy(o)&&!r&&function e(t,r){let n=oN(t);return!(n===r||!oh(n)||ok(n))&&("fixed"===oT(n).position||e(n,r))}(e,o)))?a=t:n=n.filter(e=>e!==o),o=oN(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=o$(t,i[0],a),s=o.top,l=o.right,u=o.bottom,c=o.left;for(let e=1;e<i.length;e++){let r=o$(t,i[e],a);s=iZ(r.top,s),l=iW(r.right,l),u=iW(r.bottom,u),c=iZ(r.left,c)}return{width:l-c,height:u-s,x:c,y:s}},getOffsetParent:oB,getElementRects:oH,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=oR(e);return{width:t,height:r}},getScale:oL,isElement:oh,isRTL:function(e){return"rtl"===oT(e).direction}};function oV(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let oq=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:a,rects:i,platform:o,elements:s,middlewareData:l}=t,{element:u,padding:c=0}=iQ(e,t)||{};if(null==u)return{};let d=ot(c),p={x:r,y:n},f=i2(i3(a)),m=i4(f),h=await o.getDimensions(u),g="y"===f,b=g?"clientHeight":"clientWidth",y=i.reference[m]+i.reference[f]-p[f]-i.floating[m],v=p[f]-i.reference[f],_=await (null==o.getOffsetParent?void 0:o.getOffsetParent(u)),w=_?_[b]:0;w&&await (null==o.isElement?void 0:o.isElement(_))||(w=s.floating[b]||i.floating[m]);let E=w/2-h[m]/2-1,x=iW(d[g?"top":"left"],E),S=iW(d[g?"bottom":"right"],E),k=w-h[m]-S,T=w/2-h[m]/2+(y/2-v/2),A=iZ(x,iW(T,k)),N=!l.arrow&&null!=i1(a)&&T!==A&&i.reference[m]/2-(T<x?x:S)-h[m]/2<0,I=N?T<x?T-x:T-k:0;return{[f]:p[f]+I,data:{[f]:A,centerOffset:T-A-I,...N&&{alignmentOffset:I}},reset:N}}});var oW="u">typeof document?Q.useLayoutEffect:function(){};function oZ(e,t){let r,n,a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!oZ(e[n],t[n]))return!1;return!0}if((r=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!=n--;){let r=a[n];if(("_owner"!==r||!e.$$typeof)&&!oZ(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function oK(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function oY(e,t){let r=oK(e);return Math.round(t*r)/r}function oX(e){let t=Q.useRef(e);return oW(()=>{t.current=e}),t}var oJ=Q.forwardRef((e,t)=>{let{children:r,width:n=10,height:a=5,...i}=e;return(0,J.jsx)(eN.svg,{...i,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,J.jsx)("polygon",{points:"0,0 30,0 15,10"})})});oJ.displayName="Arrow";var oQ="Popper",[o0,o1]=ey(oQ),[o2,o4]=o0(oQ),o3=e=>{let{__scopePopper:t,children:r}=e,[n,a]=Q.useState(null);return(0,J.jsx)(o2,{scope:t,anchor:n,onAnchorChange:a,children:r})};o3.displayName=oQ;var o5="PopperAnchor",o6=Q.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...a}=e,i=o4(o5,r),o=Q.useRef(null),s=eb(t,o),l=Q.useRef(null);return Q.useEffect(()=>{let e=l.current;l.current=n?.current||o.current,e!==l.current&&i.onAnchorChange(l.current)}),n?null:(0,J.jsx)(eN.div,{...a,ref:s})});o6.displayName=o5;var o9="PopperContent",[o8,o7]=o0(o9),se=Q.forwardRef((e,t)=>{var r,n,a,i,o,s,l,u,c,d,p,f,m,h,g,b,y,v,_,w,E;let x,S,k,T,A,N,{__scopePopper:I,side:C="bottom",sideOffset:R=0,align:O="center",alignOffset:L=0,arrowPadding:P=0,avoidCollisions:D=!0,collisionBoundary:M=[],collisionPadding:j=0,sticky:F="partial",hideWhenDetached:$=!1,updatePositionStrategy:U="optimized",onPlaced:z,...B}=e,H=o4(o9,I),[G,V]=Q.useState(null),q=eb(t,e=>V(e)),[W,Z]=Q.useState(null),K=function(e){let[t,r]=Q.useState(void 0);return ev(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,a;if(!Array.isArray(t)||!t.length)return;let i=t[0];if("borderBoxSize"in i){let e=i.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,a=t.blockSize}else n=e.offsetWidth,a=e.offsetHeight;r({width:n,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}(W),Y=K?.width??0,X=K?.height??0,ee="number"==typeof j?j:{top:0,right:0,bottom:0,left:0,...j},et=Array.isArray(M)?M:[M],er=et.length>0,en={padding:ee,boundary:et.filter(sa),altBoundary:er},{refs:ea,floatingStyles:ei,placement:eo,isPositioned:es,middlewareData:el}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:i,floating:o}={},transform:s=!0,whileElementsMounted:l,open:u}=e,[c,d]=Q.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=Q.useState(n);oZ(p,n)||f(n);let[m,h]=Q.useState(null),[g,b]=Q.useState(null),y=Q.useCallback(e=>{e!==E.current&&(E.current=e,h(e))},[]),v=Q.useCallback(e=>{e!==x.current&&(x.current=e,b(e))},[]),_=i||m,w=o||g,E=Q.useRef(null),x=Q.useRef(null),S=Q.useRef(c),k=null!=l,T=oX(l),A=oX(a),N=oX(u),I=Q.useCallback(()=>{var e,n;let a,i,o;if(!E.current||!x.current)return;let s={placement:t,strategy:r,middleware:p};A.current&&(s.platform=A.current),(e=E.current,n=x.current,a=new Map,o={...(i={platform:oG,...s}).platform,_c:a},oi(e,n,{...i,platform:o})).then(e=>{let t={...e,isPositioned:!1!==N.current};C.current&&!oZ(S.current,t)&&(S.current=t,ek.flushSync(()=>{d(t)}))})},[p,t,r,A,N]);oW(()=>{!1===u&&S.current.isPositioned&&(S.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[u]);let C=Q.useRef(!1);oW(()=>(C.current=!0,()=>{C.current=!1}),[]),oW(()=>{if(_&&(E.current=_),w&&(x.current=w),_&&w){if(T.current)return T.current(_,w,I);I()}},[_,w,I,T,k]);let R=Q.useMemo(()=>({reference:E,floating:x,setReference:y,setFloating:v}),[y,v]),O=Q.useMemo(()=>({reference:_,floating:w}),[_,w]),L=Q.useMemo(()=>{let e={position:r,left:0,top:0};if(!O.floating)return e;let t=oY(O.floating,c.x),n=oY(O.floating,c.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...oK(O.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,s,O.floating,c.x,c.y]);return Q.useMemo(()=>({...c,update:I,refs:R,elements:O,floatingStyles:L}),[c,I,R,O,L])}({strategy:"fixed",placement:C+("center"!==O?"-"+O:""),whileElementsMounted:(...e)=>(function(e,t,r,n){let a;void 0===n&&(n={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:u=!1}=n,c=oO(e),d=i||o?[...c?oI(c):[],...t?oI(t):[]]:[];d.forEach(e=>{i&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let p=c&&l?function(e,t){let r,n=null,a=of(e);function i(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function o(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();let u=e.getBoundingClientRect(),{left:c,top:d,width:p,height:f}=u;if(s||t(),!p||!f)return;let m={rootMargin:-iY(d)+"px "+-iY(a.clientWidth-(c+p))+"px "+-iY(a.clientHeight-(d+f))+"px "+-iY(c)+"px",threshold:iZ(0,iW(1,l))||1},h=!0;function g(t){let n=t[0].intersectionRatio;if(n!==l){if(!h)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||oV(u,e.getBoundingClientRect())||o(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),i}(c,r):null,f=-1,m=null;s&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&m&&t&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),c&&!u&&m.observe(c),t&&m.observe(t));let h=u?oM(e):null;return u&&function t(){let n=oM(e);h&&!oV(h,n)&&r(),h=n,a=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{i&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==p||p(),null==(e=m)||e.disconnect(),m=null,u&&cancelAnimationFrame(a)}})(...e,{animationFrame:"always"===U}),elements:{reference:H.anchor},middleware:[{name:(x={name:"offset",options:a=r={mainAxis:R+X,alignmentAxis:L},async fn(e){var t,r;let{x:n,y:i,placement:o,middlewareData:s}=e,l=await ou(e,a);return o===(null==(t=s.offset)?void 0:t.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:n+l.x,y:i+l.y,data:{...l,placement:o}}}}).name,fn:x.fn,options:[r,n]},D&&{name:(S={name:"shift",options:c=l={mainAxis:!0,crossAxis:!1,limiter:"partial"===F?{fn:(void 0===(s=i)&&(s={}),{options:s,fn(e){let{x:t,y:r,placement:n,rects:a,middlewareData:i}=e,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=iQ(s,e),c={x:t,y:r},d=i3(n),p=i2(d),f=c[p],m=c[d],h=iQ(o,e),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){let e="y"===p?"height":"width",t=a.reference[p]-a.floating[e]+g.mainAxis,r=a.reference[p]+a.reference[e]-g.mainAxis;f<t?f=t:f>r&&(f=r)}if(u){var b,y;let e="y"===p?"width":"height",t=ol.has(i0(n)),r=a.reference[d]-a.floating[e]+(t&&(null==(b=i.offset)?void 0:b[d])||0)+(t?0:g.crossAxis),o=a.reference[d]+a.reference[e]+(t?0:(null==(y=i.offset)?void 0:y[d])||0)-(t?g.crossAxis:0);m<r?m=r:m>o&&(m=o)}return{[p]:f,[d]:m}}}).fn,options:[i,o]}:void 0,...en},async fn(e){let{x:t,y:r,placement:n,platform:a}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=iQ(c,e),u={x:t,y:r},d=await a.detectOverflow(e,l),p=i3(i0(n)),f=i2(p),m=u[f],h=u[p];if(i){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=m+d[e],n=m-d[t];m=iZ(r,iW(m,n))}if(o){let e="y"===p?"top":"left",t="y"===p?"bottom":"right",r=h+d[e],n=h-d[t];h=iZ(r,iW(h,n))}let g=s.fn({...e,[f]:m,[p]:h});return{...g,data:{x:g.x-t,y:g.y-r,enabled:{[f]:i,[p]:o}}}}}).name,fn:S.fn,options:[l,u]},D&&{name:(k={name:"flip",options:f=d={...en},async fn(e){var t,r,n,a,i,o,s,l;let u,c,d,{placement:p,middlewareData:m,rects:h,initialPlacement:g,platform:b,elements:y}=e,{mainAxis:v=!0,crossAxis:_=!0,fallbackPlacements:w,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:S=!0,...k}=iQ(f,e);if(null!=(t=m.arrow)&&t.alignmentOffset)return{};let T=i0(p),A=i3(g),N=i0(g)===g,I=await (null==b.isRTL?void 0:b.isRTL(y.floating)),C=w||(N||!S?[oe(g)]:(u=oe(g),[i5(g),u,i5(u)])),R="none"!==x;!w&&R&&C.push(...(c=i1(g),d=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?i9:i6;return t?i6:i9;case"left":case"right":return t?i8:i7;default:return[]}}(i0(g),"start"===x,I),c&&(d=d.map(e=>e+"-"+c),S&&(d=d.concat(d.map(i5)))),d));let O=[g,...C],L=await b.detectOverflow(e,k),P=[],D=(null==(r=m.flip)?void 0:r.overflows)||[];if(v&&P.push(L[T]),_){let e,t,r,n,a=(o=p,s=h,void 0===(l=I)&&(l=!1),e=i1(o),r=i4(t=i2(i3(o))),n="x"===t?e===(l?"end":"start")?"right":"left":"start"===e?"bottom":"top",s.reference[r]>s.floating[r]&&(n=oe(n)),[n,oe(n)]);P.push(L[a[0]],L[a[1]])}if(D=[...D,{placement:p,overflows:P}],!P.every(e=>e<=0)){let e=((null==(n=m.flip)?void 0:n.index)||0)+1,t=O[e];if(t&&("alignment"!==_||A===i3(t)||D.every(e=>i3(e.placement)!==A||e.overflows[0]>0)))return{data:{index:e,overflows:D},reset:{placement:t}};let r=null==(a=D.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!r)switch(E){case"bestFit":{let e=null==(i=D.filter(e=>{if(R){let t=i3(e.placement);return t===A||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:i[0];e&&(r=e);break}case"initialPlacement":r=g}if(p!==r)return{reset:{placement:r}}}return{}}}).name,fn:k.fn,options:[d,p]},{name:(T={name:"size",options:g=m={...en,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:a,height:i}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${i}px`)}},async fn(e){var t,r;let n,a,{placement:i,rects:o,platform:s,elements:l}=e,{apply:u=()=>{},...c}=iQ(g,e),d=await s.detectOverflow(e,c),p=i0(i),f=i1(i),m="y"===i3(i),{width:h,height:b}=o.floating;"top"===p||"bottom"===p?(n=p,a=f===(await (null==s.isRTL?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(a=p,n="end"===f?"top":"bottom");let y=b-d.top-d.bottom,v=h-d.left-d.right,_=iW(b-d[n],y),w=iW(h-d[a],v),E=!e.middlewareData.shift,x=_,S=w;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(S=v),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(x=y),E&&!f){let e=iZ(d.left,0),t=iZ(d.right,0),r=iZ(d.top,0),n=iZ(d.bottom,0);m?S=h-2*(0!==e||0!==t?e+t:iZ(d.left,d.right)):x=b-2*(0!==r||0!==n?r+n:iZ(d.top,d.bottom))}await u({...e,availableWidth:S,availableHeight:x});let k=await s.getDimensions(l.floating);return h!==k.width||b!==k.height?{reset:{rects:!0}}:{}}}).name,fn:T.fn,options:[m,h]},W&&{name:(A={name:"arrow",options:v=b={element:W,padding:P},fn(e){let{element:t,padding:r}="function"==typeof v?v(e):v;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?oq({element:t.current,padding:r}).fn(e):{}:t?oq({element:t,padding:r}).fn(e):{}}}).name,fn:A.fn,options:[b,y]},si({arrowWidth:Y,arrowHeight:X}),$&&{name:(N={name:"hide",options:E=_={strategy:"referenceHidden",...en},async fn(e){let{rects:t,platform:r}=e,{strategy:n="referenceHidden",...a}=iQ(E,e);switch(n){case"referenceHidden":{let n=oo(await r.detectOverflow(e,{...a,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:n,referenceHidden:os(n)}}}case"escaped":{let n=oo(await r.detectOverflow(e,{...a,altBoundary:!0}),t.floating);return{data:{escapedOffsets:n,escaped:os(n)}}}default:return{}}}}).name,fn:N.fn,options:[_,w]}]}),[eu,ec]=so(eo),ed=eI(z);ev(()=>{es&&ed?.()},[es,ed]);let ep=el.arrow?.x,ef=el.arrow?.y,em=el.arrow?.centerOffset!==0,[eh,eg]=Q.useState();return ev(()=>{G&&eg(window.getComputedStyle(G).zIndex)},[G]),(0,J.jsx)("div",{ref:ea.setFloating,"data-radix-popper-content-wrapper":"",style:{...ei,transform:es?ei.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:eh,"--radix-popper-transform-origin":[el.transformOrigin?.x,el.transformOrigin?.y].join(" "),...el.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,J.jsx)(o8,{scope:I,placedSide:eu,onArrowChange:Z,arrowX:ep,arrowY:ef,shouldHideArrow:em,children:(0,J.jsx)(eN.div,{"data-side":eu,"data-align":ec,...B,ref:q,style:{...B.style,animation:es?void 0:"none"}})})})});se.displayName=o9;var st="PopperArrow",sr={top:"bottom",right:"left",bottom:"top",left:"right"},sn=Q.forwardRef(function(e,t){let{__scopePopper:r,...n}=e,a=o7(st,r),i=sr[a.placedSide];return(0,J.jsx)("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:(0,J.jsx)(oJ,{...n,ref:t,style:{...n.style,display:"block"}})})});function sa(e){return null!==e}sn.displayName=st;var si=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:a}=t,i=a.arrow?.centerOffset!==0,o=i?0:e.arrowWidth,s=i?0:e.arrowHeight,[l,u]=so(r),c={start:"0%",center:"50%",end:"100%"}[u],d=(a.arrow?.x??0)+o/2,p=(a.arrow?.y??0)+s/2,f="",m="";return"bottom"===l?(f=i?c:`${d}px`,m=`${-s}px`):"top"===l?(f=i?c:`${d}px`,m=`${n.floating.height+s}px`):"right"===l?(f=`${-s}px`,m=i?c:`${p}px`):"left"===l&&(f=`${n.floating.width+s}px`,m=i?c:`${p}px`),{data:{x:f,y:m}}}});function so(e){let[t,r="center"]=e.split("-");return[t,r]}var ss=Symbol("radix.slottable");function sl(e){return Q.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ss}var su=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});Q.forwardRef((e,t)=>(0,J.jsx)(eN.span,{...e,ref:t,style:{...su,...e.style}})).displayName="VisuallyHidden";var sc=[" ","Enter","ArrowUp","ArrowDown"],sd=[" ","Enter"],sp="Select",[sf,sm,sh]=function(e){let t=e+"CollectionProvider",[r,n]=ey(t),[a,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:r}=e,n=Q.default.useRef(null),i=Q.default.useRef(new Map).current;return(0,J.jsx)(a,{scope:t,itemMap:i,collectionRef:n,children:r})};o.displayName=t;let s=e+"CollectionSlot",l=iU(s),u=Q.default.forwardRef((e,t)=>{let{scope:r,children:n}=e,a=eb(t,i(s,r).collectionRef);return(0,J.jsx)(l,{ref:a,children:n})});u.displayName=s;let c=e+"CollectionItemSlot",d="data-radix-collection-item",p=iU(c),f=Q.default.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,o=Q.default.useRef(null),s=eb(t,o),l=i(c,r);return Q.default.useEffect(()=>(l.itemMap.set(o,{ref:o,...a}),()=>void l.itemMap.delete(o))),(0,J.jsx)(p,{...{[d]:""},ref:s,children:n})});return f.displayName=c,[{Provider:o,Slot:u,ItemSlot:f},function(t){let r=i(e+"CollectionConsumer",t);return Q.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},n]}(sp),[sg,sb]=ey(sp,[sh,o1]),sy=o1(),[sv,s_]=sg(sp),[sw,sE]=sg(sp),sx=e=>{let{__scopeSelect:t,children:r,open:n,defaultOpen:a,onOpenChange:i,value:o,defaultValue:s,onValueChange:l,dir:u,name:c,autoComplete:d,disabled:p,required:f,form:m}=e,h=sy(t),[g,b]=Q.useState(null),[y,v]=Q.useState(null),[_,w]=Q.useState(!1),E=ie(u),[x,S]=eS({prop:n,defaultProp:a??!1,onChange:i,caller:sp}),[k,T]=eS({prop:o,defaultProp:s,onChange:l,caller:sp}),A=Q.useRef(null),N=!g||m||!!g.closest("form"),[I,C]=Q.useState(new Set),R=Array.from(I).map(e=>e.props.value).join(";");return(0,J.jsx)(o3,{...h,children:(0,J.jsxs)(sv,{required:f,scope:t,trigger:g,onTriggerChange:b,valueNode:y,onValueNodeChange:v,valueNodeHasChildren:_,onValueNodeHasChildrenChange:w,contentId:eE(),value:k,onValueChange:T,open:x,onOpenChange:S,dir:E,triggerPointerDownPosRef:A,disabled:p,children:[(0,J.jsx)(sf.Provider,{scope:t,children:(0,J.jsx)(sw,{scope:e.__scopeSelect,onNativeOptionAdd:Q.useCallback(e=>{C(t=>new Set(t).add(e))},[]),onNativeOptionRemove:Q.useCallback(e=>{C(t=>{let r=new Set(t);return r.delete(e),r})},[]),children:r})}),N?(0,J.jsxs)(s7,{"aria-hidden":!0,required:f,tabIndex:-1,name:c,autoComplete:d,value:k,onChange:e=>T(e.target.value),disabled:p,form:m,children:[void 0===k?(0,J.jsx)("option",{value:""}):null,Array.from(I)]},R):null]})})};sx.displayName=sp;var sS="SelectTrigger",sk=Q.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:n=!1,...a}=e,i=sy(r),o=s_(sS,r),s=o.disabled||n,l=eb(t,o.onTriggerChange),u=sm(r),c=Q.useRef("touch"),[d,p,f]=lt(e=>{let t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===o.value),n=lr(t,e,r);void 0!==n&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),f()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,J.jsx)(o6,{asChild:!0,...i,children:(0,J.jsx)(eN.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":le(o.value)?"":void 0,...a,ref:l,onClick:em(a.onClick,e=>{e.currentTarget.focus(),"mouse"!==c.current&&m(e)}),onPointerDown:em(a.onPointerDown,e=>{c.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(m(e),e.preventDefault())}),onKeyDown:em(a.onKeyDown,e=>{let t=""!==d.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),(!t||" "!==e.key)&&sc.includes(e.key)&&(m(),e.preventDefault())})})})});sk.displayName=sS;var sT="SelectValue",sA=Q.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:a,children:i,placeholder:o="",...s}=e,l=s_(sT,r),{onValueNodeHasChildrenChange:u}=l,c=void 0!==i,d=eb(t,l.onValueNodeChange);return ev(()=>{u(c)},[u,c]),(0,J.jsx)(eN.span,{...s,ref:d,style:{pointerEvents:"none"},children:le(l.value)?(0,J.jsx)(J.Fragment,{children:o}):i})});sA.displayName=sT;var sN=Q.forwardRef((e,t)=>{let{__scopeSelect:r,children:n,...a}=e;return(0,J.jsx)(eN.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});sN.displayName="SelectIcon";var sI=e=>(0,J.jsx)(eG,{asChild:!0,...e});sI.displayName="SelectPortal";var sC="SelectContent",sR=Q.forwardRef((e,t)=>{let r=s_(sC,e.__scopeSelect),[n,a]=Q.useState();return(ev(()=>{a(new DocumentFragment)},[]),r.open)?(0,J.jsx)(sD,{...e,ref:t}):n?ek.createPortal((0,J.jsx)(sO,{scope:e.__scopeSelect,children:(0,J.jsx)(sf.Slot,{scope:e.__scopeSelect,children:(0,J.jsx)("div",{children:e.children})})}),n):null});sR.displayName=sC;var[sO,sL]=sg(sC),sP=((x=Q.forwardRef((e,t)=>{let{children:r,...n}=e;if(Q.isValidElement(r)){var a;let e,i,o=(a=r,(i=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(i=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...e)=>{let t=i(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...i}:"className"===n&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==Q.Fragment&&(s.ref=t?eg(t,o):o),Q.cloneElement(r,s)}return Q.Children.count(r)>1?Q.Children.only(null):null})).displayName="SelectContent.RemoveScroll.SlotClone",g=x,(b=Q.forwardRef((e,t)=>{let{children:r,...n}=e,a=Q.Children.toArray(r),i=a.find(sl);if(i){let e=i.props.children,r=a.map(t=>t!==i?t:Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null);return(0,J.jsx)(g,{...n,ref:t,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,r):null})}return(0,J.jsx)(g,{...n,ref:t,children:r})})).displayName="SelectContent.RemoveScroll.Slot",b),sD=Q.forwardRef((e,t)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:p,collisionPadding:f,sticky:m,hideWhenDetached:h,avoidCollisions:g,...b}=e,y=s_(sC,r),[v,_]=Q.useState(null),[w,E]=Q.useState(null),x=eb(t,e=>_(e)),[S,k]=Q.useState(null),[T,A]=Q.useState(null),N=sm(r),[I,C]=Q.useState(!1),R=Q.useRef(!1);Q.useEffect(()=>{if(v)return tR(v)},[v]),eZ();let O=Q.useCallback(e=>{let[t,...r]=N().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(let r of e)if(r===a||(r?.scrollIntoView({block:"nearest"}),r===t&&w&&(w.scrollTop=0),r===n&&w&&(w.scrollTop=w.scrollHeight),r?.focus(),document.activeElement!==a))return},[N,w]),L=Q.useCallback(()=>O([S,v]),[O,S,v]);Q.useEffect(()=>{I&&L()},[I,L]);let{onOpenChange:P,triggerPointerDownPosRef:D}=y;Q.useEffect(()=>{if(v){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(D.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():v.contains(r.target)||P(!1),document.removeEventListener("pointermove",t),D.current=null};return null!==D.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[v,P,D]),Q.useEffect(()=>{let e=()=>P(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[P]);let[M,j]=lt(e=>{let t=N().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=lr(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),F=Q.useCallback((e,t,r)=>{let n=!R.current&&!r;(void 0!==y.value&&y.value===t||n)&&(k(e),n&&(R.current=!0))},[y.value]),$=Q.useCallback(()=>v?.focus(),[v]),U=Q.useCallback((e,t,r)=>{let n=!R.current&&!r;(void 0!==y.value&&y.value===t||n)&&A(e)},[y.value]),z="popper"===n?sj:sM,B=z===sj?{side:s,sideOffset:l,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:p,collisionPadding:f,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,J.jsx)(sO,{scope:r,content:v,viewport:w,onViewportChange:E,itemRefCallback:F,selectedItem:S,onItemLeave:$,itemTextRefCallback:U,focusSelectedItem:L,selectedItemText:T,position:n,isPositioned:I,searchRef:M,children:(0,J.jsx)(tS,{as:sP,allowPinchZoom:!0,children:(0,J.jsx)(eF,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:em(a,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,J.jsx)(eO,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,J.jsx)(z,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:e=>e.preventDefault(),...b,...B,onPlaced:()=>C(!0),ref:x,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:em(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||j(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=N().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>O(t)),e.preventDefault()}})})})})})})});sD.displayName="SelectContentImpl";var sM=Q.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:n,...a}=e,i=s_(sC,r),o=sL(sC,r),[s,l]=Q.useState(null),[u,c]=Q.useState(null),d=eb(t,e=>c(e)),p=sm(r),f=Q.useRef(!1),m=Q.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:b,focusSelectedItem:y}=o,v=Q.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&u&&h&&g&&b){let e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),a=b.getBoundingClientRect();if("rtl"!==i.dir){let n=a.left-t.left,i=r.left-n,o=e.left-i,l=e.width+o,u=Math.max(l,t.width),c=it(i,[10,Math.max(10,window.innerWidth-10-u)]);s.style.minWidth=l+"px",s.style.left=c+"px"}else{let n=t.right-a.right,i=window.innerWidth-r.right-n,o=window.innerWidth-e.right-i,l=e.width+o,u=Math.max(l,t.width),c=it(i,[10,Math.max(10,window.innerWidth-10-u)]);s.style.minWidth=l+"px",s.style.right=c+"px"}let o=p(),l=window.innerHeight-20,c=h.scrollHeight,d=window.getComputedStyle(u),m=parseInt(d.borderTopWidth,10),y=parseInt(d.paddingTop,10),v=parseInt(d.borderBottomWidth,10),_=m+y+c+parseInt(d.paddingBottom,10)+v,w=Math.min(5*g.offsetHeight,_),E=window.getComputedStyle(h),x=parseInt(E.paddingTop,10),S=parseInt(E.paddingBottom,10),k=e.top+e.height/2-10,T=g.offsetHeight/2,A=m+y+(g.offsetTop+T);if(A<=k){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom="0px";let t=Math.max(l-k,T+(e?S:0)+(u.clientHeight-h.offsetTop-h.offsetHeight)+v);s.style.height=A+t+"px"}else{let e=o.length>0&&g===o[0].ref.current;s.style.top="0px";let t=Math.max(k,m+h.offsetTop+(e?x:0)+T);s.style.height=t+(_-A)+"px",h.scrollTop=A-k+h.offsetTop}s.style.margin="10px 0",s.style.minHeight=w+"px",s.style.maxHeight=l+"px",n?.(),requestAnimationFrame(()=>f.current=!0)}},[p,i.trigger,i.valueNode,s,u,h,g,b,i.dir,n]);ev(()=>v(),[v]);let[_,w]=Q.useState();ev(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]);let E=Q.useCallback(e=>{e&&!0===m.current&&(v(),y?.(),m.current=!1)},[v,y]);return(0,J.jsx)(sF,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:f,onScrollButtonChange:E,children:(0,J.jsx)("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:(0,J.jsx)(eN.div,{...a,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});sM.displayName="SelectItemAlignedPosition";var sj=Q.forwardRef((e,t)=>{let{__scopeSelect:r,align:n="start",collisionPadding:a=10,...i}=e,o=sy(r);return(0,J.jsx)(se,{...o,...i,ref:t,align:n,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});sj.displayName="SelectPopperPosition";var[sF,s$]=sg(sC,{}),sU="SelectViewport",sz=Q.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:n,...a}=e,i=sL(sU,r),o=s$(sU,r),s=eb(t,i.onViewportChange),l=Q.useRef(0);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),(0,J.jsx)(sf.Slot,{scope:r,children:(0,J.jsx)(eN.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:em(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=o;if(n?.current&&r){let e=Math.abs(l.current-t.scrollTop);if(e>0){let n=window.innerHeight-20,a=Math.max(parseFloat(r.style.minHeight),parseFloat(r.style.height));if(a<n){let i=a+e,o=Math.min(n,i),s=i-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=s>0?s:0,r.style.justifyContent="flex-end")}}}l.current=t.scrollTop})})})]})});sz.displayName=sU;var sB="SelectGroup",[sH,sG]=sg(sB),sV=Q.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=eE();return(0,J.jsx)(sH,{scope:r,id:a,children:(0,J.jsx)(eN.div,{role:"group","aria-labelledby":a,...n,ref:t})})});sV.displayName=sB;var sq="SelectLabel",sW=Q.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=sG(sq,r);return(0,J.jsx)(eN.div,{id:a.id,...n,ref:t})});sW.displayName=sq;var sZ="SelectItem",[sK,sY]=sg(sZ),sX=Q.forwardRef((e,t)=>{let{__scopeSelect:r,value:n,disabled:a=!1,textValue:i,...o}=e,s=s_(sZ,r),l=sL(sZ,r),u=s.value===n,[c,d]=Q.useState(i??""),[p,f]=Q.useState(!1),m=eb(t,e=>l.itemRefCallback?.(e,n,a)),h=eE(),g=Q.useRef("touch"),b=()=>{a||(s.onValueChange(n),s.onOpenChange(!1))};if(""===n)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,J.jsx)(sK,{scope:r,value:n,disabled:a,textId:h,isSelected:u,onItemTextChange:Q.useCallback(e=>{d(t=>t||(e?.textContent??"").trim())},[]),children:(0,J.jsx)(sf.ItemSlot,{scope:r,value:n,disabled:a,textValue:c,children:(0,J.jsx)(eN.div,{role:"option","aria-labelledby":h,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:m,onFocus:em(o.onFocus,()=>f(!0)),onBlur:em(o.onBlur,()=>f(!1)),onClick:em(o.onClick,()=>{"mouse"!==g.current&&b()}),onPointerUp:em(o.onPointerUp,()=>{"mouse"===g.current&&b()}),onPointerDown:em(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:em(o.onPointerMove,e=>{g.current=e.pointerType,a?l.onItemLeave?.():"mouse"===g.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:em(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:em(o.onKeyDown,e=>{(l.searchRef?.current===""||" "!==e.key)&&(sd.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})});sX.displayName=sZ;var sJ="SelectItemText",sQ=Q.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:a,...i}=e,o=s_(sJ,r),s=sL(sJ,r),l=sY(sJ,r),u=sE(sJ,r),[c,d]=Q.useState(null),p=eb(t,e=>d(e),l.onItemTextChange,e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),f=c?.textContent,m=Q.useMemo(()=>(0,J.jsx)("option",{value:l.value,disabled:l.disabled,children:f},l.value),[l.disabled,l.value,f]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=u;return ev(()=>(h(m),()=>g(m)),[h,g,m]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(eN.span,{id:l.textId,...i,ref:p}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ek.createPortal(i.children,o.valueNode):null]})});sQ.displayName=sJ;var s0="SelectItemIndicator",s1=Q.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return sY(s0,r).isSelected?(0,J.jsx)(eN.span,{"aria-hidden":!0,...n,ref:t}):null});s1.displayName=s0;var s2="SelectScrollUpButton",s4=Q.forwardRef((e,t)=>{let r=sL(s2,e.__scopeSelect),n=s$(s2,e.__scopeSelect),[a,i]=Q.useState(!1),o=eb(t,n.onScrollButtonChange);return ev(()=>{if(r.viewport&&r.isPositioned){let e=function(){i(t.scrollTop>0)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),a?(0,J.jsx)(s6,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});s4.displayName=s2;var s3="SelectScrollDownButton",s5=Q.forwardRef((e,t)=>{let r=sL(s3,e.__scopeSelect),n=s$(s3,e.__scopeSelect),[a,i]=Q.useState(!1),o=eb(t,n.onScrollButtonChange);return ev(()=>{if(r.viewport&&r.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;i(Math.ceil(t.scrollTop)<e)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),a?(0,J.jsx)(s6,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});s5.displayName=s3;var s6=Q.forwardRef((e,t)=>{let{__scopeSelect:r,onAutoScroll:n,...a}=e,i=sL("SelectScrollButton",r),o=Q.useRef(null),s=sm(r),l=Q.useCallback(()=>{null!==o.current&&(window.clearInterval(o.current),o.current=null)},[]);return Q.useEffect(()=>()=>l(),[l]),ev(()=>{let e=s().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,J.jsx)(eN.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:em(a.onPointerDown,()=>{null===o.current&&(o.current=window.setInterval(n,50))}),onPointerMove:em(a.onPointerMove,()=>{i.onItemLeave?.(),null===o.current&&(o.current=window.setInterval(n,50))}),onPointerLeave:em(a.onPointerLeave,()=>{l()})})}),s9=Q.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return(0,J.jsx)(eN.div,{"aria-hidden":!0,...n,ref:t})});s9.displayName="SelectSeparator";var s8="SelectArrow";Q.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=sy(r),i=s_(s8,r),o=sL(s8,r);return i.open&&"popper"===o.position?(0,J.jsx)(sn,{...a,...n,ref:t}):null}).displayName=s8;var s7=Q.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{let a,i=Q.useRef(null),o=eb(n,i),s=(a=Q.useRef({value:t,previous:t}),Q.useMemo(()=>(a.current.value!==t&&(a.current.previous=a.current.value,a.current.value=t),a.current.previous),[t]));return Q.useEffect(()=>{let e=i.current;if(!e)return;let r=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(s!==t&&r){let n=new Event("change",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,J.jsx)(eN.select,{...r,style:{...su,...r.style},ref:o,defaultValue:t})});function le(e){return""===e||void 0===e}function lt(e){let t=eI(e),r=Q.useRef(""),n=Q.useRef(0),a=Q.useCallback(e=>{let a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),i=Q.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return Q.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,i]}function lr(e,t,r){var n,a;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=r?e.indexOf(r):-1,s=(n=e,a=Math.max(o,0),n.map((e,t)=>n[(a+t)%n.length]));1===i.length&&(s=s.filter(e=>e!==r));let l=s.find(e=>e.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==r?l:void 0}s7.displayName="SelectBubbleInput";let ln=ro("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),la=ro("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),li=ro("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),lo=Q.forwardRef(({className:e,children:t,...r},n)=>(0,J.jsxs)(sk,{ref:n,className:rZ("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1",e),...r,children:[t,(0,J.jsx)(sN,{asChild:!0,children:(0,J.jsx)(la,{className:"h-4 w-4 opacity-50"})})]}));lo.displayName=sk.displayName;let ls=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)(s4,{ref:r,className:rZ("flex cursor-default items-center justify-center py-1",e),...t,children:(0,J.jsx)(li,{className:"h-4 w-4"})}));ls.displayName=s4.displayName;let ll=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)(s5,{ref:r,className:rZ("flex cursor-default items-center justify-center py-1",e),...t,children:(0,J.jsx)(la,{className:"h-4 w-4"})}));ll.displayName=s5.displayName;let lu=Q.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>(0,J.jsx)(sI,{children:(0,J.jsxs)(sR,{ref:a,className:rZ("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[(0,J.jsx)(ls,{}),(0,J.jsx)(sz,{className:rZ("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,J.jsx)(ll,{})]})}));lu.displayName=sR.displayName;let lc=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)(sW,{ref:r,className:rZ("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));lc.displayName=sW.displayName;let ld=Q.forwardRef(({className:e,children:t,...r},n)=>(0,J.jsxs)(sX,{ref:n,className:rZ("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[(0,J.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,J.jsx)(s1,{children:(0,J.jsx)(ln,{className:"h-4 w-4"})})}),(0,J.jsx)(sQ,{children:t})]}));ld.displayName=sX.displayName;let lp=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)(s9,{ref:r,className:rZ("-mx-1 my-1 h-px bg-muted",e),...t}));lp.displayName=s9.displayName;var lf=e.i(2239);e.s(["ERROR_REVALIDATE_EVENT",0,3,"FOCUS_EVENT",0,0,"MUTATE_EVENT",0,2,"RECONNECT_EVENT",0,1],11671);var lm=Object.prototype.hasOwnProperty;let lh=new WeakMap,lg=()=>{},lb=lg(),ly=Object,lv=e=>e===lb,l_=(e,t)=>({...e,...t}),lw={},lE={},lx="undefined",lS=typeof window!=lx,lk=typeof document!=lx,lT=lS&&"Deno"in window,lA=(e,t)=>{let r=lh.get(e);return[()=>!lv(t)&&e.get(t)||lw,n=>{if(!lv(t)){let a=e.get(t);t in lE||(lE[t]=a),r[5](t,l_(a,n),a||lw)}},r[6],()=>!lv(t)&&t in lE?lE[t]:!lv(t)&&e.get(t)||lw]},lN=!0,[lI,lC]=lS&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[lg,lg],lR={initFocus:e=>(lk&&document.addEventListener("visibilitychange",e),lI("focus",e),()=>{lk&&document.removeEventListener("visibilitychange",e),lC("focus",e)}),initReconnect:e=>{let t=()=>{lN=!0,e()},r=()=>{lN=!1};return lI("online",t),lI("offline",r),()=>{lC("online",t),lC("offline",r)}}},lO=!Q.default.useId,lL=!lS||lT,lP=lL?Q.useEffect:Q.useLayoutEffect,lD="u">typeof navigator&&navigator.connection,lM=!lL&&lD&&(["slow-2g","2g"].includes(lD.effectiveType)||lD.saveData),lj=new WeakMap,lF=(e,t)=>e===`[object ${t}]`,l$=0,lU=e=>{let t,r,n=typeof e,a=ly.prototype.toString.call(e),i=lF(a,"Date"),o=lF(a,"RegExp"),s=lF(a,"Object");if(ly(e)!==e||i||o)t=i?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=lj.get(e))return t;if(t=++l$+"~",lj.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=lU(e[r])+",";lj.set(e,t)}if(s){t="#";let n=ly.keys(e).sort();for(;!lv(r=n.pop());)lv(e[r])||(t+=r+":"+lU(e[r])+",");lj.set(e,t)}}return t},lz=e=>{if("function"==typeof e)try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?lU(e):"",t]},lB=0,lH=()=>++lB;async function lG(...e){let[t,r,n,a]=e,i=l_({populateCache:!0,throwOnError:!0},"boolean"==typeof a?{revalidate:a}:a||{}),o=i.populateCache,s=i.rollbackOnError,l=i.optimisticData,u=i.throwOnError;if("function"==typeof r){let e=[];for(let n of t.keys())!/^\$(inf|sub)\$/.test(n)&&r(t.get(n)._k)&&e.push(n);return Promise.all(e.map(c))}return c(r);async function c(r){let a,[c]=lz(r);if(!c)return;let[d,p]=lA(t,c),[f,m,h,g]=lh.get(t),b=()=>{let e=f[c];return("function"==typeof i.revalidate?i.revalidate(d().data,r):!1!==i.revalidate)&&(delete h[c],delete g[c],e&&e[0])?e[0](2).then(()=>d().data):d().data};if(e.length<3)return b();let y=n,v=!1,_=lH();m[c]=[_,0];let w=!lv(l),E=d(),x=E.data,S=E._c,k=lv(S)?x:S;if(w&&p({data:l="function"==typeof l?l(k,x):l,_c:k}),"function"==typeof y)try{y=y(k)}catch(e){a=e,v=!0}if(y&&"function"==typeof y.then){let e;if(y=await y.catch(e=>{a=e,v=!0}),_!==m[c][0]){if(v)throw a;return y}v&&w&&(e=a,"function"==typeof s?s(e):!1!==s)&&(o=!0,p({data:k,_c:lb}))}if(o&&!v&&("function"==typeof o?p({data:o(y,k),error:lb,_c:lb}):p({data:y,error:lb,_c:lb})),m[c][1]=lH(),Promise.resolve(b()).then(()=>{p({_c:lb})}),v){if(u)throw a;return}return y}}let lV=(e,t)=>{for(let r in e)e[r][0]&&e[r][0](t)},lq=(e,t)=>{if(!lh.has(e)){let r=l_(lR,t),n=Object.create(null),a=lG.bind(lb,e),i=lg,o=Object.create(null),s=(e,t)=>{let r=o[e]||[];return o[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},l=(t,r,n)=>{e.set(t,r);let a=o[t];if(a)for(let e of a)e(r,n)},u=()=>{if(!lh.has(e)&&(lh.set(e,[n,Object.create(null),Object.create(null),Object.create(null),a,l,s]),!lL)){let t=r.initFocus(setTimeout.bind(lb,lV.bind(lb,n,0))),a=r.initReconnect(setTimeout.bind(lb,lV.bind(lb,n,1)));i=()=>{t&&t(),a&&a(),lh.delete(e)}}};return u(),[e,a,u,i]}return[e,lh.get(e)[4]]},[lW,lZ]=lq(new Map),lK=l_({onLoadingSlow:lg,onSuccess:lg,onError:lg,onErrorRetry:(e,t,r,n,a)=>{let i=r.errorRetryCount,o=a.retryCount,s=~~((Math.random()+.5)*(1<<(o<8?o:8)))*r.errorRetryInterval;(lv(i)||!(o>i))&&setTimeout(n,s,a)},onDiscarded:lg,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:lM?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:lM?5e3:3e3,compare:function e(t,r){var n,a;if(t===r)return!0;if(t&&r&&(n=t.constructor)===r.constructor){if(n===Date)return t.getTime()===r.getTime();if(n===RegExp)return t.toString()===r.toString();if(n===Array){if((a=t.length)===r.length)for(;a--&&e(t[a],r[a]););return -1===a}if(!n||"object"==typeof t){for(n in a=0,t)if(lm.call(t,n)&&++a&&!lm.call(r,n)||!(n in r)||!e(t[n],r[n]))return!1;return Object.keys(r).length===a}}return t!=t&&r!=r},isPaused:()=>!1,cache:lW,mutate:lZ,fallback:{}},{isOnline:()=>lN,isVisible:()=>{let e=lk&&document.visibilityState;return lv(e)||"hidden"!==e}}),lY=(e,t)=>{let r=l_(e,t);if(t){let{use:n,fallback:a}=e,{use:i,fallback:o}=t;n&&i&&(r.use=n.concat(i)),a&&o&&(r.fallback=l_(a,o))}return r},lX=(0,Q.createContext)({});var lJ=e.i(11671);let lQ="$inf$",l0=lS&&window.__SWR_DEVTOOLS_USE__,l1=l0?window.__SWR_DEVTOOLS_USE__:[],l2=e=>"function"==typeof e[1]?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],l4=()=>{let e=(0,Q.useContext)(lX);return(0,Q.useMemo)(()=>l_(lK,e),[e])},l3=l1.concat(e=>(t,r,n)=>{let a=r&&((...e)=>{let[n]=lz(t),[,,,a]=lh.get(lW);if(n.startsWith(lQ))return r(...e);let i=a[n];return lv(i)?r(...e):(delete a[n],i)});return e(t,a,n)}),l5=(e,t)=>(...r)=>{let[n,a,i]=l2(r),o=(i.use||[]).concat(t);return e(n,a,{...i,use:o})};l0&&(window.__SWR_DEVTOOLS_REACT__=Q.default);let l6=()=>{},l9=l6(),l8=(new WeakMap,Q.default.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}})),l7={dedupe:!0},ue=Promise.resolve(lb),ut=()=>lg;ly.defineProperty(e=>{let{value:t}=e,r=(0,Q.useContext)(lX),n="function"==typeof t,a=(0,Q.useMemo)(()=>n?t(r):t,[n,r,t]),i=(0,Q.useMemo)(()=>n?a:lY(r,a),[n,r,a]),o=a&&a.provider,s=(0,Q.useRef)(lb);o&&!s.current&&(s.current=lq(o(i.cache||lW),a));let l=s.current;return l&&(i.cache=l[0],i.mutate=l[1]),lP(()=>{if(l)return l[2]&&l[2](),l[3]},[]),(0,Q.createElement)(lX.Provider,l_(e,{value:i}))},"defaultValue",{value:lK});let ur=(y=(e,t,r)=>{let{cache:n,compare:a,suspense:i,fallbackData:o,revalidateOnMount:s,revalidateIfStale:l,refreshInterval:u,refreshWhenHidden:c,refreshWhenOffline:d,keepPreviousData:p,strictServerPrefetchWarning:f}=r,[m,h,g,b]=lh.get(n),[y,v]=lz(e),_=(0,Q.useRef)(!1),w=(0,Q.useRef)(!1),E=(0,Q.useRef)(y),x=(0,Q.useRef)(t),S=(0,Q.useRef)(r),k=()=>S.current.isVisible()&&S.current.isOnline(),[T,A,N,I]=lA(n,y),C=(0,Q.useRef)({}).current,R=lv(o)?lv(r.fallback)?lb:r.fallback[y]:o,O=(e,t)=>{for(let r in C)if("data"===r){if(!a(e[r],t[r])&&(!lv(e[r])||!a(z,t[r])))return!1}else if(t[r]!==e[r])return!1;return!0},L=!_.current,P=(0,Q.useMemo)(()=>{let e=T(),r=I(),n=e=>{let r=l_(e);return(delete r._k,(()=>{if(!y||!t||S.current.isPaused())return!1;if(L&&!lv(s))return s;let e=lv(R)?r.data:R;return lv(e)||l})())?{isValidating:!0,isLoading:!0,...r}:r},a=n(e),i=e===r?a:n(r),o=a;return[()=>{let e=n(T());return O(e,o)?(o.data=e.data,o.isLoading=e.isLoading,o.isValidating=e.isValidating,o.error=e.error,o):(o=e,e)},()=>i]},[n,y]),D=(0,lf.useSyncExternalStore)((0,Q.useCallback)(e=>N(y,(t,r)=>{O(r,t)||e()}),[n,y]),P[0],P[1]),M=m[y]&&m[y].length>0,j=D.data,F=lv(j)?R&&"function"==typeof R.then?l8(R):R:j,$=D.error,U=(0,Q.useRef)(F),z=p?lv(j)?lv(U.current)?F:U.current:j:F,B=y&&lv(F),H=(0,Q.useRef)(null);lL||(0,lf.useSyncExternalStore)(ut,()=>(H.current=!1,H),()=>(H.current=!0,H));let G=H.current;f&&G&&!i&&B&&console.warn(`Missing pre-initiated data for serialized key "${y}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);let V=!(!y||!t||S.current.isPaused())&&(!M||!!lv($))&&(L&&!lv(s)?s:i?!lv(F)&&l:lv(F)||l),q=L&&V,W=lv(D.isValidating)?q:D.isValidating,Z=lv(D.isLoading)?q:D.isLoading,K=(0,Q.useCallback)(async e=>{let t,n,i=x.current;if(!y||!i||w.current||S.current.isPaused())return!1;let o=!0,s=e||{},l=!g[y]||!s.dedupe,u=()=>lO?!w.current&&y===E.current&&_.current:y===E.current,c={isValidating:!1,isLoading:!1},d=()=>{A(c)},p=()=>{let e=g[y];e&&e[1]===n&&delete g[y]},f={isValidating:!0};lv(T().data)&&(f.isLoading=!0);try{if(l&&(A(f),r.loadingTimeout&&lv(T().data)&&setTimeout(()=>{o&&u()&&S.current.onLoadingSlow(y,r)},r.loadingTimeout),g[y]=[i(v),lH()]),[t,n]=g[y],t=await t,l&&setTimeout(p,r.dedupingInterval),!g[y]||g[y][1]!==n)return l&&u()&&S.current.onDiscarded(y),!1;c.error=lb;let e=h[y];if(!lv(e)&&(n<=e[0]||n<=e[1]||0===e[1]))return d(),l&&u()&&S.current.onDiscarded(y),!1;let s=T().data;c.data=a(s,t)?s:t,l&&u()&&S.current.onSuccess(t,y,r)}catch(r){p();let e=S.current,{shouldRetryOnError:t}=e;!e.isPaused()&&(c.error=r,l&&u())&&(e.onError(r,y,e),(!0===t||"function"==typeof t&&t(r))&&(!S.current.revalidateOnFocus||!S.current.revalidateOnReconnect||k())&&e.onErrorRetry(r,y,e,e=>{let t=m[y];t&&t[0]&&t[0](lJ.ERROR_REVALIDATE_EVENT,e)},{retryCount:(s.retryCount||0)+1,dedupe:!0}))}return o=!1,d(),!0},[y,n]),Y=(0,Q.useCallback)((...e)=>lG(n,E.current,...e),[]);if(lP(()=>{x.current=t,S.current=r,lv(j)||(U.current=j)}),lP(()=>{var e;let t;if(!y)return;let r=K.bind(lb,l7),n=0;S.current.revalidateOnFocus&&(n=Date.now()+S.current.focusThrottleInterval);let a=(e=(e,t={})=>{if(e==lJ.FOCUS_EVENT){let e=Date.now();S.current.revalidateOnFocus&&e>n&&k()&&(n=e+S.current.focusThrottleInterval,r())}else if(e==lJ.RECONNECT_EVENT)S.current.revalidateOnReconnect&&k()&&r();else if(e==lJ.MUTATE_EVENT)return K();else if(e==lJ.ERROR_REVALIDATE_EVENT)return K(t)},(t=m[y]||(m[y]=[])).push(e),()=>{let r=t.indexOf(e);r>=0&&(t[r]=t[t.length-1],t.pop())});if(w.current=!1,E.current=y,_.current=!0,A({_k:v}),V&&!g[y])if(lv(F)||lL)r();else lS&&typeof window.requestAnimationFrame!=lx?window.requestAnimationFrame(r):setTimeout(r,1);return()=>{w.current=!0,a()}},[y]),lP(()=>{let e;function t(){let t="function"==typeof u?u(T().data):u;t&&-1!==e&&(e=setTimeout(r,t))}function r(){!T().error&&(c||S.current.isVisible())&&(d||S.current.isOnline())?K(l7).then(t):t()}return t(),()=>{e&&(clearTimeout(e),e=-1)}},[u,c,d,y]),(0,Q.useDebugValue)(z),i){if(!lO&&lL&&B)throw Error("Fallback data is required when using Suspense in SSR.");B&&(x.current=t,S.current=r,w.current=!1);let e=b[y];if(l8(!lv(e)&&B?Y(e):ue),!lv($)&&B)throw $;let n=B?K(l7):ue;!lv(z)&&B&&(n.status="fulfilled",n.value=!0),l8(n)}return{mutate:Y,get data(){return C.data=!0,z},get error(){return C.error=!0,$},get isValidating(){return C.isValidating=!0,W},get isLoading(){return C.isLoading=!0,Z}}},function(...e){let t=l4(),[r,n,a]=l2(e),i=lY(t,a),o=y,{use:s}=i,l=(s||[]).concat(l3);for(let e=l.length;e--;)o=l[e](o);return o(r,n||i.fetcher||null,i)}),un=()=>{},ua=un(),ui=Object,uo=e=>e===ua,us=new WeakMap,ul=(e,t)=>e===`[object ${t}]`,uu=0,uc=e=>{let t,r,n=typeof e,a=ui.prototype.toString.call(e),i=ul(a,"Date"),o=ul(a,"RegExp"),s=ul(a,"Object");if(ui(e)!==e||i||o)t=i?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=us.get(e))return t;if(t=++uu+"~",us.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=uc(e[r])+",";us.set(e,t)}if(s){t="#";let n=ui.keys(e).sort();for(;!uo(r=n.pop());)uo(e[r])||(t+=r+":"+uc(e[r])+",");us.set(e,t)}}return t},ud=Promise.resolve(),up=l5(ur,e=>(t,r,n)=>{let a,i=(0,Q.useRef)(!1),{cache:o,initialSize:s=1,revalidateAll:l=!1,persistSize:u=!1,revalidateFirstPage:c=!0,revalidateOnMount:d=!1,parallel:p=!1}=n,[,,,f]=lh.get(lW);try{(a=(e=>{if("function"==typeof e)try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?uc(e):"",t]})(t?t(0,null):null)[0])&&(a=lQ+a)}catch(e){}let[m,h,g]=lA(o,a),b=(0,Q.useCallback)(()=>lv(m()._l)?s:m()._l,[o,a,s]);(0,lf.useSyncExternalStore)((0,Q.useCallback)(e=>a?g(a,()=>{e()}):()=>{},[o,a]),b,b);let y=(0,Q.useCallback)(()=>{let e=m()._l;return lv(e)?s:e},[a,s]),v=(0,Q.useRef)(y());lP(()=>{if(!i.current){i.current=!0;return}a&&h({_l:u?v.current:y()})},[a,o]);let _=d&&!i.current,w=e(a,async e=>{let a=m()._i,i=m()._r;h({_r:lb});let s=[],u=y(),[d]=lA(o,e),g=d().data,b=[],v=null;for(let e=0;e<u;++e){let[u,d]=lz(t(e,p?null:v));if(!u)break;let[m,h]=lA(o,u),y=m().data,w=l||a||lv(y)||c&&!e&&!lv(g)||_||g&&!lv(g[e])&&!n.compare(g[e],y);if(r&&("function"==typeof i?i(y,d):w)){let t=async()=>{if(u in f){let e=f[u];delete f[u],y=await e}else y=await r(d);h({data:y,_k:d}),s[e]=y};p?b.push(t):await t()}else s[e]=y;p||(v=y)}return p&&await Promise.all(b.map(e=>e())),h({_i:lb}),s},n),E=(0,Q.useCallback)(function(e,t){let r="boolean"==typeof t?{revalidate:t}:t||{},n=!1!==r.revalidate;return a?(n&&(lv(e)?h({_i:!0,_r:r.revalidate}):h({_i:!1,_r:r.revalidate})),arguments.length?w.mutate(e,{...r,revalidate:n}):w.mutate()):ud},[a,o]),x=(0,Q.useCallback)(e=>{let r;if(!a)return ud;let[,n]=lA(o,a);if("function"==typeof e?r=e(y()):"number"==typeof e&&(r=e),"number"!=typeof r)return ud;n({_l:r}),v.current=r;let i=[],[s]=lA(o,a),l=null;for(let e=0;e<r;++e){let[r]=lz(t(e,l)),[n]=lA(o,r),a=r?n().data:lb;if(lv(a))return E(s().data);i.push(a),l=a}return E(i)},[a,o,E,y]);return{size:y(),setSize:x,mutate:E,get data(){return w.data},get error(){return w.error},get isValidating(){return w.isValidating},get isLoading(){return w.isLoading}}});function uf(){let e=ef();if(!e)return null;let t=e.langsmithApiKey||X.default.env.NEXT_PUBLIC_LANGSMITH_API_KEY||"";return new nP({apiUrl:e.deploymentUrl,defaultHeaders:t?{"X-Api-Key":t}:{}})}async function um(e){let t=uf();if(!t)throw Error("No EvoScientist deployment configured.");await t.threads.delete(e)}async function uh(e,t,r){let n={...(await e.threads.get(t)).metadata??{},...r};await e.threads.update(t,{metadata:n})}async function ug(e,t){let r=uf();if(!r)throw Error("No EvoScientist deployment configured.");await uh(r,e,{title:t})}async function ub(e,t){let r=uf();if(!r)throw Error("No EvoScientist deployment configured.");await uh(r,e,{pinned:t})}let uy="evoscientist-memory-seen-at";function uv(e){try{localStorage.setItem(uy,String(e))}catch{}}var u_=e.i(46696);let uw={interrupted:"Requiring Attention",today:"Today",yesterday:"Yesterday",week:"This Week",older:"Older"},uE={idle:"bg-green-500",busy:"bg-blue-500",interrupted:"bg-orange-500",error:"bg-red-600"},ux={idle:"Idle",busy:"Busy",interrupted:"Interrupted",error:"Error"};function uS(e){return uE[e]??"bg-gray-400"}function uk({status:e,label:t,badge:r}){return(0,J.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,J.jsx)("span",{className:rZ("inline-block size-2 rounded-full",uS(e))}),t,void 0!==r&&r>0&&(0,J.jsx)("span",{className:"ml-1 inline-flex items-center justify-center rounded-full bg-red-600 px-1.5 py-0.5 text-xs font-bold leading-none text-white",children:r})]})}function uT({message:e}){return(0,J.jsxs)("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[(0,J.jsx)("p",{className:"text-sm text-red-600",children:"Failed to load research"}),(0,J.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e})]})}function uA(){return(0,J.jsx)("div",{className:"space-y-2 p-4",children:Array.from({length:5}).map((e,t)=>(0,J.jsx)(i$,{className:"h-16 w-full"},t))})}function uN(){return(0,J.jsxs)("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[(0,J.jsx)(a2,{className:"mb-2 h-12 w-12 text-gray-300"}),(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No research yet"})]})}function uI({onThreadSelect:e,onClose:t,onNewChat:r,onMutateReady:n,onInterruptCountChange:a}){var i;let o,[s,l]=ec("threadId"),[u,c]=ec("view"),{unseenCount:d,markSeen:p}=function(){let e=(void 0)??!0,t=(void 0)??15e3,[r,n]=(0,Q.useState)(0),[a,i]=(0,Q.useState)(0),o=(0,Q.useRef)(!0),s=(0,Q.useCallback)(async()=>{try{let e,t=await fetch("/api/memory",{cache:"no-store"});if(!t.ok)return;let r=await t.json();if(!o.current)return;let a=(r.entries??[]).map(e=>"number"==typeof e.mtime?e.mtime:0).filter(e=>e>0),s=a.length?Math.max(...a):0,l=(e=Number(localStorage.getItem(uy)),Number.isFinite(e)?e:0);0===l&&s>0&&(uv(s),l=s),n(s),i(a.filter(e=>e>l).length)}catch{}},[]),l=(0,Q.useCallback)(()=>{uv(r>0?r:Date.now()),i(0)},[r]);return(0,Q.useEffect)(()=>{if(o.current=!0,!e)return()=>{o.current=!1};s();let r=setInterval(()=>{document.hidden||s()},t);return()=>{o.current=!1,clearInterval(r)}},[s,e,t]),{unseenCount:a,latestMtime:r,markSeen:l,refresh:s}}(),[f,m]=(0,Q.useState)("all"),[h,g]=(0,Q.useState)(""),[b,y]=(0,Q.useState)(null),[v,_]=(0,Q.useState)(""),[w,E]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),[k,T]=(0,Q.useState)(()=>new Date),[A,N]=(0,Q.useState)(()=>new Set),I=(o=(i={status:"all"===f?void 0:f,limit:20}).limit||20,up((e,t)=>{let r=ef(),n=r?.langsmithApiKey||X.default.env.NEXT_PUBLIC_LANGSMITH_API_KEY||"";return!r||t&&0===t.length?null:{kind:"threads",pageIndex:e,pageSize:o,deploymentUrl:r.deploymentUrl,assistantId:r.assistantId,apiKey:n,status:i?.status}},async({deploymentUrl:e,assistantId:t,apiKey:r,status:n,pageIndex:a,pageSize:i})=>{let o=new nP({apiUrl:e,defaultHeaders:r?{"X-Api-Key":r}:{}}),s=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)?{assistant_id:t}:{graph_id:t};return(await o.threads.search({limit:i,offset:a*i,sortBy:"updated_at",sortOrder:"desc",status:n,metadata:s})).map(e=>{let r="Untitled Thread",n="";try{if(e.values&&"object"==typeof e.values){let t=e.values,a=Array.isArray(t.messages)?t.messages:[],i=e=>"string"==typeof e?e:Array.isArray(e)?e.map(e=>"string"==typeof e?.text?e.text:"").join(""):"",o=a.find(e=>"human"===e.type),s=i(o?.content).trim();for(let e of(s&&(r=s.slice(0,50)+(s.length>50?"…":"")),a)){if(e?.type!=="ai")continue;let t=i(e.content).trim();if(t){n=t.slice(0,100);break}}"Untitled Thread"===r&&n&&(r=n.slice(0,50)+(n.length>50?"…":""))}}catch{r=`Thread ${e.thread_id.slice(0,8)}`}let a=e.metadata?.title;"string"==typeof a&&a.trim()&&(r=a.trim());let i=e.metadata?.pinned===!0;return{id:e.thread_id,updatedAt:new Date(e.updated_at),status:e.status,title:r,description:n,assistantId:t,pinned:i}})},{revalidateFirstPage:!0,revalidateOnFocus:!0})),C=(0,Q.useMemo)(()=>I.data?.flat()??[],[I.data]),R=(0,Q.useMemo)(()=>{let e=h.trim().toLowerCase();return e?C.filter(t=>t.title.toLowerCase().includes(e)):C},[C,h]);(0,Q.useEffect)(()=>{let e=()=>T(new Date),t=window.setInterval(e,6e4);return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.clearInterval(t),window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[]);let O=I.size>0&&I.data?.[I.size-1]==null,L=I.data?.at(0)?.length===0,P=L||(I.data?.at(-1)?.length??0)<20,D=(0,Q.useMemo)(()=>R.filter(e=>e.pinned),[R]),M=(0,Q.useMemo)(()=>{let e={interrupted:[],today:[],yesterday:[],week:[],older:[]};return R.forEach(t=>{if(t.pinned)return;if("interrupted"===t.status)return void e.interrupted.push(t);let r=Math.floor((k.getTime()-t.updatedAt.getTime())/864e5);0===r?e.today.push(t):1===r?e.yesterday.push(t):r<7?e.week.push(t):e.older.push(t)}),e},[R,k]),j=(0,Q.useMemo)(()=>C.filter(e=>"interrupted"===e.status).length,[C]),F=(0,Q.useRef)(n),$=(0,Q.useRef)(I.mutate);(0,Q.useEffect)(()=>{F.current=n},[n]),(0,Q.useEffect)(()=>{$.current=I.mutate},[I.mutate]);let U=(0,Q.useCallback)(()=>{$.current()},[]);(0,Q.useEffect)(()=>{F.current?.(U)},[]),(0,Q.useEffect)(()=>{a?.(j)},[j,a]);let z=(0,Q.useRef)(!1),B=(0,Q.useRef)(new Set),H=(0,Q.useRef)(null),G=(0,Q.useRef)(!1),V=async()=>{if(!b||z.current)return;let e=v.trim();if(!e||e===b.title)return void y(null);z.current=!0,S(!0);try{await ug(b.id,e),y(null),U()}catch{u_.toast.error("Couldn't rename — try again.")}finally{z.current=!1,S(!1)}},q=async()=>{if(w&&!z.current){z.current=!0,S(!0);try{await um(w.id),s===w.id&&(r?r():(l(null),c(null))),G.current=!0,E(null),U()}catch{u_.toast.error("Couldn't delete — try again.")}finally{z.current=!1,S(!1)}}},W=async e=>{if(!B.current.has(e.id)){B.current.add(e.id),N(t=>{let r=new Set(t);return r.add(e.id),r});try{await ub(e.id,!e.pinned),U()}catch{u_.toast.error(e.pinned?"Couldn't unpin — try again.":"Couldn't pin — try again.")}finally{B.current.delete(e.id),N(t=>{let r=new Set(t);return r.delete(e.id),r})}}},Z=t=>{var r;let n=A.has(t.id);return(0,J.jsxs)("div",{className:"group relative",children:[(0,J.jsx)("button",{type:"button",onClick:()=>e(t.id),className:rZ("grid w-full cursor-pointer items-center gap-2 rounded-md py-2 pl-2.5 pr-20 text-left transition-colors duration-200 md:pr-2.5 md:group-focus-within:pr-20 md:group-hover:pr-20","hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",s===t.id?"border border-primary bg-accent hover:bg-accent":"border border-transparent bg-transparent"),"aria-current":s===t.id,children:(0,J.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,J.jsxs)("div",{className:"mb-0.5 flex items-center justify-between gap-2",children:[(0,J.jsxs)("h3",{className:"flex min-w-0 items-center gap-1.5 text-sm font-semibold",children:[t.pinned&&(0,J.jsx)(a3,{className:"size-3 flex-shrink-0 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("span",{className:"truncate",children:t.title})]}),(0,J.jsx)("span",{className:"ml-2 flex-shrink-0 text-xs tabular-nums text-muted-foreground",children:(0,J.jsx)("time",{dateTime:t.updatedAt.toISOString(),title:(r=t.updatedAt,new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short",hourCycle:"h23"}).format(r)),children:function(e,t=new Date){let r=Math.floor((t.getTime()-e.getTime())/864e5);return 0===r?new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(e):1===r?"Yesterday":r<7?new Intl.DateTimeFormat(void 0,{weekday:"long"}).format(e):new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit"}).format(e)}(t.updatedAt,k)})})]}),(0,J.jsxs)("div",{className:"flex items-center justify-between",children:[(0,J.jsx)("p",{className:"flex-1 truncate text-[13px] text-muted-foreground",children:t.description}),(0,J.jsx)("div",{className:"ml-2 flex-shrink-0",children:(0,J.jsx)("span",{role:"img","aria-label":`Status: ${ux[t.status]}`,title:`Status: ${ux[t.status]}`,className:rZ("h-2 w-2 rounded-full",uS(t.status))})})]})]})}),(0,J.jsxs)("div",{className:"absolute right-1.5 top-1.5 flex items-center gap-0.5 rounded-md bg-accent/95 p-0.5 opacity-100 shadow-sm backdrop-blur-sm transition-opacity md:opacity-0 md:group-focus-within:opacity-100 md:group-hover:opacity-100",children:[(0,J.jsx)("button",{type:"button","aria-label":t.pinned?`Unpin "${t.title}"`:`Pin "${t.title}"`,title:t.pinned?"Unpin":"Pin",onClick:()=>W(t),disabled:n,className:rZ("rounded p-1 transition-colors hover:bg-background focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t.pinned?"text-[var(--brand)] hover:text-[var(--brand)]":"text-muted-foreground hover:text-foreground"),children:t.pinned?(0,J.jsx)(a5,{className:"size-3.5","aria-hidden":"true"}):(0,J.jsx)(a3,{className:"size-3.5","aria-hidden":"true"})}),(0,J.jsx)("button",{type:"button","aria-label":`Rename "${t.title}"`,title:"Rename",onClick:()=>{y(t),_(t.title)},className:"rounded p-1 text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(a4,{className:"size-3.5","aria-hidden":"true"})}),(0,J.jsx)("button",{type:"button","aria-label":`Delete "${t.title}"`,title:"Delete",onClick:()=>E(t),className:"rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(a8,{className:"size-3.5","aria-hidden":"true"})})]})]},t.id)};return(0,J.jsxs)("div",{className:"absolute inset-0 flex flex-col",children:[(0,J.jsxs)("button",{ref:H,type:"button",onClick:()=>{r?r():(l(null),c(null)),t?.()},className:"flex flex-shrink-0 items-center gap-2.5 border-b border-border px-3 py-3 text-left text-sm font-medium transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[(0,J.jsx)(n$,{className:"size-4","aria-hidden":"true"}),"New Chat"]}),(0,J.jsxs)("button",{type:"button",onClick:()=>{if("skills"===u){c(null),t?.();return}c("skills"),t?.()},className:rZ("flex flex-shrink-0 items-center gap-2.5 border-b border-border px-3 py-3 text-left text-sm font-medium transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","skills"===u&&"bg-accent"),children:[(0,J.jsx)(a6,{className:"size-4","aria-hidden":"true"}),"Research Skills"]}),(0,J.jsxs)("button",{type:"button",onClick:()=>{if("memory"===u){c(null),t?.();return}p(),c("memory"),t?.()},className:rZ("flex flex-shrink-0 items-center gap-2.5 border-b border-border px-3 py-3 text-left text-sm font-medium transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","memory"===u&&"bg-accent"),children:[(0,J.jsx)(a0,{className:"size-4","aria-hidden":"true"}),"EvoMemory","memory"!==u&&d>0&&(0,J.jsx)("span",{className:"ml-auto inline-flex min-w-4 items-center justify-center rounded-full bg-[var(--brand-solid)] px-1 text-[10px] font-bold leading-none text-[var(--brand-foreground)]",title:`${d} memory file${1===d?"":"s"} updated since you last looked`,"aria-label":`${d} memory updates`,children:d})]}),(0,J.jsx)("div",{className:"flex-shrink-0 border-b border-border p-2.5",children:(0,J.jsxs)("div",{className:"relative",children:[(0,J.jsx)(a9,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground","aria-hidden":"true"}),(0,J.jsx)("input",{type:"search",name:"research-search",value:h,onChange:e=>g(e.target.value),placeholder:"Search research…","aria-label":"Search research",autoComplete:"off",spellCheck:!1,className:"w-full rounded-md border border-border bg-background py-1.5 pl-8 pr-8 text-sm outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring"}),h&&(0,J.jsx)("button",{type:"button","aria-label":"Clear research search",onClick:()=>g(""),className:"absolute right-1 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(rs,{className:"size-3.5","aria-hidden":"true"})})]})}),(0,J.jsxs)("div",{className:"grid flex-shrink-0 grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-3 py-2.5",children:[(0,J.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Recents"}),(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[(0,J.jsxs)(sx,{value:f,onValueChange:e=>m(e),children:[(0,J.jsx)(lo,{className:"w-fit",children:(0,J.jsx)(sA,{})}),(0,J.jsxs)(lu,{align:"end",children:[(0,J.jsx)(ld,{value:"all",children:"All"}),(0,J.jsx)(lp,{}),(0,J.jsxs)(sV,{children:[(0,J.jsx)(lc,{children:"Active"}),(0,J.jsx)(ld,{value:"idle",children:(0,J.jsx)(uk,{status:"idle",label:"Idle"})}),(0,J.jsx)(ld,{value:"busy",children:(0,J.jsx)(uk,{status:"busy",label:"Busy"})})]}),(0,J.jsx)(lp,{}),(0,J.jsxs)(sV,{children:[(0,J.jsx)(lc,{children:"Attention"}),(0,J.jsx)(ld,{value:"interrupted",children:(0,J.jsx)(uk,{status:"interrupted",label:"Interrupted",badge:j})}),(0,J.jsx)(ld,{value:"error",children:(0,J.jsx)(uk,{status:"error",label:"Error"})})]})]})]}),t&&(0,J.jsx)("button",{type:"button","aria-label":u?"Close navigation":"Close research",onClick:t,className:"rounded-md p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(rs,{className:"size-4","aria-hidden":"true"})})]})]}),(0,J.jsxs)(ij,{className:"h-0 flex-1",children:[I.error&&(0,J.jsx)(uT,{message:I.error.message}),!I.error&&!I.data&&I.isLoading&&(0,J.jsx)("div",{"aria-live":"polite",children:(0,J.jsx)(uA,{})}),!I.error&&!I.isLoading&&L&&(0,J.jsx)(uN,{}),!I.error&&!L&&h.trim()&&0===R.length&&(0,J.jsx)("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No research matches your search."})}),!I.error&&!L&&R.length>0&&(0,J.jsxs)("div",{className:"box-border w-full max-w-full overflow-hidden p-1.5",children:[D.length>0&&(0,J.jsxs)("div",{className:"mb-3",children:[(0,J.jsx)("h4",{className:"m-0 px-2.5 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Research"}),(0,J.jsx)("div",{className:"flex flex-col gap-1",children:D.map(e=>Z(e))})]}),Object.keys(uw).map(e=>{let t=M[e];return 0===t.length?null:(0,J.jsxs)("div",{className:"mb-3",children:[(0,J.jsx)("h4",{className:"m-0 px-2.5 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:uw[e]}),(0,J.jsx)("div",{className:"flex flex-col gap-1",children:t.map(e=>Z(e))})]},e)}),!P&&(0,J.jsx)("div",{className:"flex justify-center py-4",children:(0,J.jsx)(na,{variant:"outline",size:"sm",onClick:()=>I.setSize(I.size+1),disabled:O,children:O?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(a1,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading…"]}):"Load More"})})]})]}),(0,J.jsx)(rK,{open:null!==b,onOpenChange:e=>{e||x||y(null)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Rename research"}),(0,J.jsx)(r2,{children:"Give this conversation a custom title."})]}),(0,J.jsx)(nu,{autoFocus:!0,value:v,onChange:e=>_(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),V())},placeholder:"Enter a title…",maxLength:100,disabled:x}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>y(null),disabled:x,children:"Cancel"}),(0,J.jsx)(na,{onClick:V,disabled:x||!v.trim(),children:x?"Saving…":"Save"})]})]})}),(0,J.jsx)(rK,{open:null!==w,onOpenChange:e=>{e||x||E(null)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",onCloseAutoFocus:e=>{G.current&&(e.preventDefault(),G.current=!1,H.current?.focus())},children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Delete this research?"}),(0,J.jsxs)(r2,{children:["“",w?.title,"” will be permanently deleted. This can’t be undone."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>E(null),disabled:x,children:"Cancel"}),(0,J.jsx)(na,{onClick:q,disabled:x,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:x?"Deleting…":"Delete"})]})]})})]})}var uC=Object.defineProperty,uR=(e,t)=>{for(var r in t)uC(e,r,{get:t[r],enumerable:!0})};function uO(e){return"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"source_type"in e&&("url"===e.source_type||"base64"===e.source_type||"text"===e.source_type||"id"===e.source_type)}function uL(e){return uO(e)&&"url"===e.source_type&&"url"in e&&"string"==typeof e.url}function uP(e){return uO(e)&&"base64"===e.source_type&&"data"in e&&"string"==typeof e.data}function uD(e){return uO(e)&&"text"===e.source_type&&"text"in e&&"string"==typeof e.text}function uM(e){return uO(e)&&"id"===e.source_type&&"id"in e&&"string"==typeof e.id}function uj(e){if(uO(e)){if("url"===e.source_type)return{type:"image_url",image_url:{url:e.url}};if("base64"===e.source_type){if(!e.mime_type)throw Error("mime_type key is required for base64 data.");let t=e.mime_type;return{type:"image_url",image_url:{url:`data:${t};base64,${e.data}`}}}}throw Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function uF(e){let t=e.split(";")[0].split("/");if(2!==t.length)throw Error(`Invalid mime type: "${e}" - does not match type/subtype format.`);let r=t[0].trim(),n=t[1].trim();if(""===r||""===n)throw Error(`Invalid mime type: "${e}" - type or subtype is empty.`);let a={};for(let t of e.split(";").slice(1)){let r=t.split("=");if(2!==r.length)throw Error(`Invalid parameter syntax in mime type: "${e}".`);let n=r[0].trim(),i=r[1].trim();if(""===n)throw Error(`Invalid parameter syntax in mime type: "${e}".`);a[n]=i}return{type:r,subtype:n,parameters:a}}function u$({dataUrl:e,asTypedArray:t=!1}){let r=e.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/);if(r)return{mime_type:r[1].toLowerCase(),data:t?Uint8Array.from(atob(r[2]),e=>e.charCodeAt(0)):r[2]}}function uU(e,t){if("text"===e.type){if(!t.fromStandardTextBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardTextBlock\` method.`);return t.fromStandardTextBlock(e)}if("image"===e.type){if(!t.fromStandardImageBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardImageBlock\` method.`);return t.fromStandardImageBlock(e)}if("audio"===e.type){if(!t.fromStandardAudioBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardAudioBlock\` method.`);return t.fromStandardAudioBlock(e)}if("file"===e.type){if(!t.fromStandardFileBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardFileBlock\` method.`);return t.fromStandardFileBlock(e)}throw Error(`Unable to convert content block type '${e.type}' to provider-specific format: not recognized.`)}function uz(e){return"object"==typeof e&&null!==e&&"type"in e&&"content"in e&&("string"==typeof e.content||Array.isArray(e.content))}var uB=e.i(31272);function uH(e,t){return t?.[e]||(0,uB.default)(e)}e.i(45796);let uG="__lc_escaped__";function uV(e){return Array.isArray(e)?[...e]:{...e}}function uq(e){let t=Object.getPrototypeOf(e);return"function"==typeof e.lc_name&&("function"!=typeof t.lc_name||e.lc_name()!==t.lc_name())?e.lc_name():e.name}uR({},{Serializable:()=>uW,get_lc_unique_name:()=>uq});var uW=class e{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,uq(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...t){void 0!==this.lc_serializable_keys?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([e])=>this.lc_serializable_keys?.includes(e))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable||this.lc_kwargs instanceof e||"object"!=typeof this.lc_kwargs||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let t={},r={},n=Object.keys(this.lc_kwargs).reduce((e,t)=>(e[t]=t in this?this[t]:this.lc_kwargs[t],e),{});for(let e=Object.getPrototypeOf(this);e;e=Object.getPrototypeOf(e))Object.assign(t,Reflect.get(e,"lc_aliases",this)),Object.assign(r,Reflect.get(e,"lc_secrets",this)),Object.assign(n,Reflect.get(e,"lc_attributes",this));Object.keys(r).forEach(e=>{let t=this,r=n,[a,...i]=e.split(".").reverse();for(let e of i.reverse()){if(!(e in t)||void 0===t[e])return;e in r&&void 0!==r[e]||("object"==typeof t[e]&&null!=t[e]?r[e]={}:Array.isArray(t[e])&&(r[e]=[])),t=t[e],r=r[e]}a in t&&void 0!==t[a]&&(r[a]=r[a]||t[a])});let a={},i=new WeakSet;for(let[e,t]of(i.add(this),Object.entries(n)))a[e]=function e(t,r=new WeakSet){if(null!==t&&"object"==typeof t&&!Array.isArray(t)){if(r.has(t))return{lc:1,type:"not_implemented",id:null!==t&&"object"==typeof t?"lc_id"in t&&Array.isArray(t.lc_id)?t.lc_id:[t.constructor?.name??"Object"]:[typeof t]};if(null!==t&&"object"==typeof t&&"lc_serializable"in t&&"function"==typeof t.toJSON)return t;if(r.add(t),"lc"in t||1===Object.keys(t).length&&uG in t)return r.delete(t),{[uG]:t};let n={};for(let[a,i]of Object.entries(t))n[a]=e(i,r);return r.delete(t),n}return Array.isArray(t)?t.map(t=>e(t,r)):t}(t,i);let o=function(e,t,r){let n={};for(let a in e)Object.hasOwn(e,a)&&(n[t(a,r)]=e[a]);return n}(Object.keys(r).length?function(e,t){let r=uV(e);for(let[e,n]of Object.entries(t)){let[t,...a]=e.split(".").reverse(),i=r;for(let e of a.reverse()){if(void 0===i[e])break;i[e]=uV(i[e]),i=i[e]}void 0!==i[t]&&(i[t]={lc:1,type:"secret",id:[n]})}return r}(a,r):a,uH,t);return{lc:1,type:"constructor",id:this.lc_id,kwargs:o}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function uZ(e,t){return uK(e)&&e.type===t}function uK(e){return"object"==typeof e&&null!==e}function uY(e){return Array.isArray(e)}function uX(e){return"string"==typeof e}function uJ(e){return"number"==typeof e}function uQ(e){return e instanceof Uint8Array}function u0(e){try{return JSON.parse(e)}catch{return}}let u1=e=>e();function u2(e){if(uZ(e,"document")&&uK(e.source)&&"type"in e.source){if("base64"===e.source.type&&uX(e.source.media_type)&&uX(e.source.data))return{type:"file",mimeType:e.source.media_type,data:e.source.data};else if("url"===e.source.type&&uX(e.source.url))return{type:"file",url:e.source.url};else if("file"===e.source.type&&uX(e.source.file_id))return{type:"file",fileId:e.source.file_id};else if("text"===e.source.type&&uX(e.source.data))return{type:"file",mimeType:String(e.source.media_type??"text/plain"),data:e.source.data}}else if(uZ(e,"image")&&uK(e.source)&&"type"in e.source){if("base64"===e.source.type&&uX(e.source.media_type)&&uX(e.source.data))return{type:"image",mimeType:e.source.media_type,data:e.source.data};else if("url"===e.source.type&&uX(e.source.url))return{type:"image",url:e.source.url};else if("file"===e.source.type&&uX(e.source.file_id))return{type:"image",fileId:e.source.file_id}}}function u4(e){return Array.from(function*(){for(let t of e){let e=u2(t);e?yield e:yield t}}())}function u3(e){return Array.from(function*(){for(let r of"string"==typeof e.content?[{type:"text",text:e.content}]:e.content){if(uZ(r,"text")&&uX(r.text)){let{text:e,citations:t,...n}=r;if(uY(t)&&t.length){let r=t.reduce((e,t)=>{let r=function(e){if("char_location"===e.type&&uX(e.document_title)&&uJ(e.start_char_index)&&uJ(e.end_char_index)&&uX(e.cited_text)){let{document_title:t,start_char_index:r,end_char_index:n,cited_text:a,...i}=e;return{...i,type:"citation",source:"char",title:t??void 0,startIndex:r,endIndex:n,citedText:a}}if("page_location"===e.type&&uX(e.document_title)&&uJ(e.start_page_number)&&uJ(e.end_page_number)&&uX(e.cited_text)){let{document_title:t,start_page_number:r,end_page_number:n,cited_text:a,...i}=e;return{...i,type:"citation",source:"page",title:t??void 0,startIndex:r,endIndex:n,citedText:a}}if("content_block_location"===e.type&&uX(e.document_title)&&uJ(e.start_block_index)&&uJ(e.end_block_index)&&uX(e.cited_text)){let{document_title:t,start_block_index:r,end_block_index:n,cited_text:a,...i}=e;return{...i,type:"citation",source:"block",title:t??void 0,startIndex:r,endIndex:n,citedText:a}}if("web_search_result_location"===e.type&&uX(e.url)&&uX(e.title)&&uX(e.encrypted_index)&&uX(e.cited_text)){let{url:t,title:r,encrypted_index:n,cited_text:a,...i}=e;return{...i,type:"citation",source:"url",url:t,title:r,startIndex:Number(n),endIndex:Number(n),citedText:a}}if("search_result_location"===e.type&&uX(e.source)&&uX(e.title)&&uJ(e.start_block_index)&&uJ(e.end_block_index)&&uX(e.cited_text)){let{source:t,title:r,start_block_index:n,end_block_index:a,cited_text:i,...o}=e;return{...o,type:"citation",source:"search",url:t,title:r??void 0,startIndex:n,endIndex:a,citedText:i}}}(t);return r?[...e,r]:e},[]);yield{...n,type:"text",text:e,annotations:r};continue}yield{...n,type:"text",text:e};continue}if(uZ(r,"thinking")&&uX(r.thinking)){let{thinking:e,signature:t,...n}=r;yield{...n,type:"reasoning",reasoning:e,signature:t};continue}if(uZ(r,"redacted_thinking")){yield{type:"non_standard",value:r};continue}else if(uZ(r,"tool_use")&&uX(r.name)&&uX(r.id)){yield{type:"tool_call",id:r.id,name:r.name,args:r.input};continue}else if(uZ(r,"input_json_delta")){var t;if(t=e,"function"==typeof t?._getType&&"function"==typeof t.concat&&"ai"===t._getType()&&e.tool_call_chunks?.length){let t=e.tool_call_chunks[0];yield{type:"tool_call_chunk",id:t.id,name:t.name,args:t.args,index:t.index};continue}}else if(uZ(r,"server_tool_use")&&uX(r.name)&&uX(r.id)){let{name:e,id:t}=r;if("web_search"===e){let e=u1(()=>{if("string"==typeof r.input)return r.input;if(uK(r.input)&&uX(r.input.query))return r.input.query;if(uX(r.partial_json)){let e=u0(r.partial_json);if(e?.query)return e.query}return""});yield{id:t,type:"server_tool_call",name:"web_search",args:{query:e}};continue}if("code_execution"===r.name){let e=u1(()=>{if("string"==typeof r.input)return r.input;if(uK(r.input)&&uX(r.input.code))return r.input.code;if(uX(r.partial_json)){let e=u0(r.partial_json);if(e?.code)return e.code}return""});yield{id:t,type:"server_tool_call",name:"code_execution",args:{code:e}};continue}}else if(uZ(r,"web_search_tool_result")&&uX(r.tool_use_id)&&uY(r.content)){let{content:e,tool_use_id:t}=r,n=e.reduce((e,t)=>uZ(t,"web_search_result")?[...e,t.url]:e,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:t,status:"success",output:{urls:n}};continue}else if(uZ(r,"code_execution_tool_result")&&uX(r.tool_use_id)&&uK(r.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:r.tool_use_id,status:"success",output:r.content};continue}else if(uZ(r,"mcp_tool_use")){yield{id:r.id,type:"server_tool_call",name:"mcp_tool_use",args:r.input};continue}else if(uZ(r,"mcp_tool_result")&&uX(r.tool_use_id)&&uK(r.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:r.tool_use_id,status:"success",output:r.content};continue}else if(uZ(r,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:r.input};continue}else if(uZ(r,"search_result")){yield{id:r.id,type:"non_standard",value:r};continue}else if(uZ(r,"tool_result")){yield{id:r.id,type:"non_standard",value:r};continue}else{let e=u2(r);if(e){yield e;continue}}yield{type:"non_standard",value:r}}}())}function u5(e){return uL(e)?{type:e.type,mimeType:e.mime_type,url:e.url,metadata:e.metadata}:uP(e)?{type:e.type,mimeType:e.mime_type??"application/octet-stream",data:e.data,metadata:e.metadata}:uM(e)?{type:e.type,mimeType:e.mime_type,fileId:e.id,metadata:e.metadata}:e}function u6(e){return e.map(u5)}function u9(e){let t=[];for(let r of e)(uZ(r,"image_url")&&uK(r.image_url)||uZ(r,"input_audio")&&uK(r.input_audio)||uZ(r,"file")&&uK(r.file)?0:1)?t.push(r):t.push(function(e){if(uZ(e,"image_url")&&uK(e.image_url)&&uX(e.image_url.url)){let t=u$({dataUrl:e.image_url.url});return t?{type:"image",mimeType:t.mime_type,data:t.data}:{type:"image",url:e.image_url.url}}if(uZ(e,"input_audio")&&uK(e.input_audio)&&uX(e.input_audio.data)&&uX(e.input_audio.format))return{type:"audio",data:e.input_audio.data,mimeType:`audio/${e.input_audio.format}`};if(uZ(e,"file")&&uK(e.file)&&uX(e.file.data)){let t=u$({dataUrl:e.file.data});if(t)return{type:"file",data:t.data,mimeType:t.mime_type};if(uX(e.file.file_id))return{type:"file",fileId:e.file.file_id}}return e}(r));return t}function u8(e){if("url_citation"===e.type){let{url:t,title:r,start_index:n,end_index:a}=e;return{type:"citation",url:t,title:r,startIndex:n,endIndex:a}}if("file_citation"===e.type){let{file_id:t,filename:r,index:n}=e;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:t}}return e}function u7(e){return Array.from(function*(){if(uK(e.additional_kwargs?.reasoning)&&uY(e.additional_kwargs.reasoning.summary)){let t=e.additional_kwargs.reasoning.summary.reduce((e,t)=>uK(t)&&uX(t.text)?`${e}${t.text}`:e,"");yield{type:"reasoning",reasoning:t}}for(let t of"string"==typeof e.content?[{type:"text",text:e.content}]:e.content)if(uZ(t,"text")){let{text:e,annotations:r,...n}=t;Array.isArray(r)?yield{...n,type:"text",text:String(e),annotations:r.map(u8)}:yield{...n,type:"text",text:String(e)}}for(let t of e.tool_calls??[])yield{type:"tool_call",id:t.id,name:t.name,args:t.args};if(uK(e.additional_kwargs)&&uY(e.additional_kwargs.tool_outputs))for(let t of e.additional_kwargs.tool_outputs){if(uZ(t,"web_search_call")){yield{id:t.id,type:"server_tool_call",name:"web_search",args:{query:t.query}};continue}if(uZ(t,"file_search_call")){yield{id:t.id,type:"server_tool_call",name:"file_search",args:{query:t.query}};continue}if(uZ(t,"computer_call")){yield{type:"non_standard",value:t};continue}else if(uZ(t,"code_interpreter_call")){if(uX(t.code)&&(yield{id:t.id,type:"server_tool_call",name:"code_interpreter",args:{code:t.code}}),uY(t.outputs)){let e=u1(()=>{if("in_progress"!==t.status){if("completed"===t.status)return 0;if("incomplete"===t.status)return 127;if("interpreting"!==t.status&&"failed"===t.status)return 1}});for(let r of t.outputs)if(uZ(r,"logs")){yield{type:"server_tool_call_result",toolCallId:t.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:e??0,stderr:[0,void 0].includes(e)?void 0:String(r.logs),stdout:[0,void 0].includes(e)?String(r.logs):void 0}};continue}}continue}else if(uZ(t,"mcp_call")){yield{id:t.id,type:"server_tool_call",name:"mcp_call",args:t.input};continue}else if(uZ(t,"mcp_list_tools")){yield{id:t.id,type:"server_tool_call",name:"mcp_list_tools",args:t.input};continue}else if(uZ(t,"mcp_approval_request")){yield{type:"non_standard",value:t};continue}else if(uZ(t,"image_generation_call")){uX(t.result)&&(yield{type:"image",mimeType:"image/png",data:t.result,id:uX(t.id)?t.id:void 0,metadata:{status:uX(t.status)?t.status:void 0}}),yield{type:"non_standard",value:t};continue}uK(t)&&(yield{type:"non_standard",value:t})}}())}let ce=Symbol.for("langchain.message");function ct(e,t){if("string"==typeof e)return""===e?t:"string"==typeof t?e+t:Array.isArray(t)&&0===t.length?e:Array.isArray(t)&&t.some(e=>uO(e))?[{type:"text",source_type:"text",text:e},...t]:[{type:"text",text:e},...t];return Array.isArray(t)?cs(e,t)??[...e,...t]:""===t?e:Array.isArray(e)&&e.some(e=>uO(e))?[...e,{type:"file",source_type:"text",text:t}]:[...e,{type:"text",text:t}]}function cr(e,t){return"error"===e||"error"===t?"error":"success"}var cn=class extends uW{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[ce]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(e){const t="string"==typeof e||Array.isArray(e)?{content:e}:e;t.additional_kwargs||(t.additional_kwargs={}),t.response_metadata||(t.response_metadata={}),super(t),this.name=t.name,void 0===t.content&&void 0!==t.contentBlocks?(this.content=t.contentBlocks,this.response_metadata={output_version:"v1",...t.response_metadata}):(void 0!==t.content?this.content=t.content??[]:this.content=[],this.response_metadata=t.response_metadata),this.additional_kwargs=t.additional_kwargs,this.id=t.id}get text(){return"string"==typeof this.content?this.content:Array.isArray(this.content)?this.content.map(e=>"string"==typeof e?e:"text"===e.type?e.text:"").join(""):""}get contentBlocks(){return[u6,u9,u4].reduce((e,t)=>t(e),"string"==typeof this.content?[{type:"text",text:this.content}]:this.content)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(e){return"object"==typeof e&&null!==e&&ce in e&&!0===e[ce]&&uz(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){var t,r;if(null===e)return this;let n=(t=this._printableFields,r=Math.max(4,e),JSON.stringify(function e(t,n){if("object"!=typeof t||null==t)return t;if(n>=r)return Array.isArray(t)?"[Array]":"[Object]";if(Array.isArray(t))return t.map(t=>e(t,n+1));let a={};for(let r of Object.keys(t))a[r]=e(t[r],n+1);return a}(t,0),null,2));return`${this.constructor.lc_name()} ${n}`}toFormattedString(e="pretty"){return function(e,t="pretty"){return"pretty"===t?function(e){let t=[],r=` ${e.type.charAt(0).toUpperCase()+e.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),a="=".repeat(n),i=r.length%2==0?a:`${a}=`;if(t.push(`${a}${r}${i}`),"ai"===e.type&&e.tool_calls&&e.tool_calls.length>0)for(let r of(t.push("Tool Calls:"),e.tool_calls))for(let[e,n]of(t.push(` ${r.name} (${r.id})`),t.push(` Call ID: ${r.id}`),t.push(" Args:"),Object.entries(r.args)))t.push(` ${e}: ${"object"==typeof n?JSON.stringify(n):n}`);return"tool"===e.type&&e.name&&t.push(`Name: ${e.name}`),"string"==typeof e.content&&e.content.trim()&&(t.length>1&&t.push(""),t.push(e.content)),t.join("\n")}(e):JSON.stringify(e)}(this,e)}};function ca(e){return Array.isArray(e)&&e.every(e=>"number"==typeof e.index)}let ci=["index","created","timestamp"];function co(e,t,r){let n=r?.ignoreKeys??ci;if(null==e&&null==t)return;if(null==e||null==t)return e??t;let a={...e};for(let[e,i]of Object.entries(t))if(null==a[e])a[e]=i;else if(null==i)continue;else if(typeof a[e]!=typeof i||Array.isArray(a[e])!==Array.isArray(i))throw Error(`field[${e}] already exists in the message chunk, but with a different type.`);else if("string"==typeof a[e])if("type"===e)continue;else if(["id","name","output_version","model_provider"].includes(e))i&&(a[e]=i);else{if(n.includes(e))continue;a[e]+=i}else if("number"==typeof a[e]){if(n.includes(e))continue;a[e]=a[e]+i}else if("object"!=typeof a[e]||Array.isArray(a[e]))if(Array.isArray(a[e]))a[e]=cs(a[e],i,r);else{if(a[e]===i)continue;console.warn(`field[${e}] already exists in this message chunk and value has unsupported type.`)}else a[e]=co(a[e],i,r);return a}function cs(e,t,r){if(null!=e||null!=t){if(null==e||null==t)return e||t;let n=[...e];for(let e of t)if("object"==typeof e&&null!==e&&"index"in e&&"number"==typeof e.index){let t=n.findIndex(t=>{let r="object"==typeof t,n="index"in t&&t.index===e.index,a="id"in t&&"id"in e&&t?.id===e?.id,i=!("id"in t)||!t?.id||!("id"in e)||!e?.id;return r&&n&&(a||i)});-1!==t&&"object"==typeof n[t]&&null!==n[t]?n[t]=co(n[t],e,r):n.push(e)}else{if("object"==typeof e&&null!==e&&"text"in e&&""===e.text)continue;n.push(e)}return n}}function cl(e,t,r){if(null!=e||null!=t)if(null==e||null==t)return e??t;else if(typeof e!=typeof t)throw Error(`Cannot merge objects of different types.
|
|
7
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return Q.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},rt=({contentRef:e,descriptionId:t})=>{let r=t7("DialogDescriptionWarning"),n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return Q.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null};let rr=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},rn=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim();var ra={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"};let ri=(0,Q.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:o,...s},l)=>(0,Q.createElement)("svg",{ref:l,...ra,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:rn("lucide",a),...!i&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(s)&&{"aria-hidden":"true"},...s},[...o.map(([e,t])=>(0,Q.createElement)(e,t)),...Array.isArray(i)?i:[i]])),ro=(e,t)=>{let r=(0,Q.forwardRef)(({className:r,...n},a)=>(0,Q.createElement)(ri,{ref:a,iconNode:t,className:rn(`lucide-${rr(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...n}));return r.displayName=rr(e),r},rs=ro("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),rl=(e,t)=>{if(0===e.length)return t.classGroupId;let r=e[0],n=t.nextPart.get(r),a=n?rl(e.slice(1),n):void 0;if(a)return a;if(0===t.validators.length)return;let i=e.join("-");return t.validators.find(({validator:e})=>e(i))?.classGroupId},ru=/^\[(.+)\]$/,rc=(e,t,r,n)=>{e.forEach(e=>{if("string"==typeof e){(""===e?t:rd(t,e)).classGroupId=r;return}"function"==typeof e?rp(e)?rc(e(n),t,r,n):t.validators.push({validator:e,classGroupId:r}):Object.entries(e).forEach(([e,a])=>{rc(a,rd(t,e),r,n)})})},rd=(e,t)=>{let r=e;return t.split("-").forEach(e=>{r.nextPart.has(e)||r.nextPart.set(e,{nextPart:new Map,validators:[]}),r=r.nextPart.get(e)}),r},rp=e=>e.isThemeGetter,rf=(e,t)=>t?e.map(([e,r])=>[e,r.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,r])=>[t+e,r])):e)]):e,rm=e=>{if(e.length<=1)return e;let t=[],r=[];return e.forEach(e=>{"["===e[0]?(t.push(...r.sort(),e),r=[]):r.push(e)}),t.push(...r.sort()),t},rh=/\s+/;function rg(){let e,t,r=0,n="";for(;r<arguments.length;)(e=arguments[r++])&&(t=rb(e))&&(n&&(n+=" "),n+=t);return n}let rb=e=>{let t;if("string"==typeof e)return e;let r="";for(let n=0;n<e.length;n++)e[n]&&(t=rb(e[n]))&&(r&&(r+=" "),r+=t);return r},ry=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},rv=/^\[(?:([a-z-]+):)?(.+)\]$/i,r_=/^\d+\/\d+$/,rw=new Set(["px","full","screen"]),rE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rx=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,rS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,rk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rA=e=>rI(e)||rw.has(e)||r_.test(e),rN=e=>rB(e,"length",rH),rI=e=>!!e&&!Number.isNaN(Number(e)),rC=e=>rB(e,"number",rI),rR=e=>!!e&&Number.isInteger(Number(e)),rO=e=>e.endsWith("%")&&rI(e.slice(0,-1)),rL=e=>rv.test(e),rP=e=>rE.test(e),rD=new Set(["length","size","percentage"]),rM=e=>rB(e,rD,rG),rj=e=>rB(e,"position",rG),rF=new Set(["image","url"]),r$=e=>rB(e,rF,rq),rU=e=>rB(e,"",rV),rz=()=>!0,rB=(e,t,r)=>{let n=rv.exec(e);return!!n&&(n[1]?"string"==typeof t?n[1]===t:t.has(n[1]):r(n[2]))},rH=e=>rx.test(e)&&!rS.test(e),rG=()=>!1,rV=e=>rk.test(e),rq=e=>rT.test(e),rW=function(e,...t){let r,n,a,i=function(s){let l;return n=(r={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=new Map,n=new Map,a=(a,i)=>{r.set(a,i),++t>e&&(t=0,n=r,r=new Map)};return{get(e){let t=r.get(e);return void 0!==t?t:void 0!==(t=n.get(e))?(a(e,t),t):void 0},set(e,t){r.has(e)?r.set(e,t):a(e,t)}}})((l=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{separator:t,experimentalParseClassName:r}=e,n=1===t.length,a=t[0],i=t.length,o=e=>{let r,o=[],s=0,l=0;for(let u=0;u<e.length;u++){let c=e[u];if(0===s){if(c===a&&(n||e.slice(u,u+i)===t)){o.push(e.slice(l,u)),l=u+i;continue}if("/"===c){r=u;continue}}"["===c?s++:"]"===c&&s--}let u=0===o.length?e:e.substring(l),c=u.startsWith("!"),d=c?u.substring(1):u;return{modifiers:o,hasImportantModifier:c,baseClassName:d,maybePostfixModifierPosition:r&&r>l?r-l:void 0}};return r?e=>r({className:e,parseClassName:o}):o})(l),...(e=>{let t=(e=>{let{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return rf(Object.entries(e.classGroups),r).forEach(([e,r])=>{rc(r,n,e,t)}),n})(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{let r=e.split("-");return""===r[0]&&1!==r.length&&r.shift(),rl(r,t)||(e=>{if(ru.test(e)){let t=ru.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}})(e)},getConflictingClassGroupIds:(e,t)=>{let a=r[e]||[];return t&&n[e]?[...a,...n[e]]:a}}})(l)}).cache.get,a=r.cache.set,i=o,o(s)};function o(e){let t=n(e);if(t)return t;let i=((e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a}=t,i=[],o=e.trim().split(rh),s="";for(let e=o.length-1;e>=0;e-=1){let t=o[e],{modifiers:l,hasImportantModifier:u,baseClassName:c,maybePostfixModifierPosition:d}=r(t),p=!!d,f=n(p?c.substring(0,d):c);if(!f){if(!p||!(f=n(c))){s=t+(s.length>0?" "+s:s);continue}p=!1}let m=rm(l).join(":"),h=u?m+"!":m,g=h+f;if(i.includes(g))continue;i.push(g);let b=a(f,p);for(let e=0;e<b.length;++e){let t=b[e];i.push(h+t)}s=t+(s.length>0?" "+s:s)}return s})(e,r);return a(e,i),i}return function(){return i(rg.apply(null,arguments))}}(()=>{let e=ry("colors"),t=ry("spacing"),r=ry("blur"),n=ry("brightness"),a=ry("borderColor"),i=ry("borderRadius"),o=ry("borderSpacing"),s=ry("borderWidth"),l=ry("contrast"),u=ry("grayscale"),c=ry("hueRotate"),d=ry("invert"),p=ry("gap"),f=ry("gradientColorStops"),m=ry("gradientColorStopPositions"),h=ry("inset"),g=ry("margin"),b=ry("opacity"),y=ry("padding"),v=ry("saturate"),_=ry("scale"),w=ry("sepia"),E=ry("skew"),x=ry("space"),S=ry("translate"),k=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",rL,t],N=()=>[rL,t],I=()=>["",rA,rN],C=()=>["auto",rI,rL],R=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],O=()=>["solid","dashed","dotted","double","none"],L=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],P=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",rL],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>[rI,rL];return{cacheSize:500,separator:":",theme:{colors:[rz],spacing:[rA,rN],blur:["none","",rP,rL],brightness:j(),borderColor:[e],borderRadius:["none","","full",rP,rL],borderSpacing:N(),borderWidth:I(),contrast:j(),grayscale:D(),hueRotate:j(),invert:D(),gap:N(),gradientColorStops:[e],gradientColorStopPositions:[rO,rN],inset:A(),margin:A(),opacity:j(),padding:N(),saturate:j(),scale:j(),sepia:D(),skew:j(),space:N(),translate:N()},classGroups:{aspect:[{aspect:["auto","square","video",rL]}],container:["container"],columns:[{columns:[rP]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...R(),rL]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",rR,rL]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",rL]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",rR,rL]}],"grid-cols":[{"grid-cols":[rz]}],"col-start-end":[{col:["auto",{span:["full",rR,rL]},rL]}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":[rz]}],"row-start-end":[{row:["auto",{span:[rR,rL]},rL]}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",rL]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",rL]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...P()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...P(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...P(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[x]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[x]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",rL,t]}],"min-w":[{"min-w":[rL,t,"min","max","fit"]}],"max-w":[{"max-w":[rL,t,"none","full","min","max","fit","prose",{screen:[rP]},rP]}],h:[{h:[rL,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[rL,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[rL,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[rL,t,"auto","min","max","fit"]}],"font-size":[{text:["base",rP,rN]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",rC]}],"font-family":[{font:[rz]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",rL]}],"line-clamp":[{"line-clamp":["none",rI,rC]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",rA,rL]}],"list-image":[{"list-image":["none",rL]}],"list-style-type":[{list:["none","disc","decimal",rL]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",rA,rN]}],"underline-offset":[{"underline-offset":["auto",rA,rL]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",rL]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",rL]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...R(),rj]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",rM]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},r$]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...O(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:O()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...O()]}],"outline-offset":[{"outline-offset":[rA,rL]}],"outline-w":[{outline:[rA,rN]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[rA,rN]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",rP,rU]}],"shadow-color":[{shadow:[rz]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...L(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":L()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",rP,rL]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[v]}],sepia:[{sepia:[w]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[w]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",rL]}],duration:[{duration:j()}],ease:[{ease:["linear","in","out","in-out",rL]}],delay:[{delay:j()}],animate:[{animate:["none","spin","ping","pulse","bounce",rL]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[rR,rL]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",rL]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",rL]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",rL]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[rA,rN,rC]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function rZ(...e){return rW(function(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=function e(t){var r,n,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t))for(r=0;r<t.length;r++)t[r]&&(n=e(t[r]))&&(a&&(a+=" "),a+=n);else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}(e))&&(n&&(n+=" "),n+=t);return n}(e))}function rK({...e}){return(0,J.jsx)(t$,{"data-slot":"dialog",...e})}function rY({...e}){return(0,J.jsx)(tG,{"data-slot":"dialog-portal",...e})}function rX({className:e,...t}){return(0,J.jsx)(tq,{"data-slot":"dialog-overlay",className:rZ("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t})}function rJ({className:e,children:t,showCloseButton:r=!0,...n}){return(0,J.jsxs)(rY,{"data-slot":"dialog-portal",children:[(0,J.jsx)(rX,{}),(0,J.jsxs)(tY,{"data-slot":"dialog-content",className:rZ("fixed left-[50%] top-[50%] z-50 grid max-h-[calc(100vh-2rem)] w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto overscroll-contain rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 motion-reduce:transition-none motion-reduce:data-[state=closed]:animate-none motion-reduce:data-[state=open]:animate-none sm:max-w-lg",e),...n,children:[t,r&&(0,J.jsxs)(t5,{"data-slot":"dialog-close",className:"focus:outline-hidden absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",children:[(0,J.jsx)(rs,{}),(0,J.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function rQ({className:e,...t}){return(0,J.jsx)("div",{"data-slot":"dialog-header",className:rZ("flex flex-col gap-2 text-center sm:text-left",e),...t})}function r0({className:e,...t}){return(0,J.jsx)("div",{"data-slot":"dialog-footer",className:rZ("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function r1({className:e,...t}){return(0,J.jsx)(t1,{"data-slot":"dialog-title",className:rZ("text-lg font-semibold leading-none",e),...t})}function r2({className:e,...t}){return(0,J.jsx)(t4,{"data-slot":"dialog-description",className:rZ("text-sm text-muted-foreground",e),...t})}var r4=Symbol.for("react.lazy"),r3=Q[" use ".trim().toString()];function r5(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===r4&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}function r6(e){var t;let r,n=(t=e,(r=Q.forwardRef((e,t)=>{let{children:r,...n}=e;if(r5(r)&&"function"==typeof r3&&(r=r3(r._payload)),Q.isValidElement(r)){var a;let e,i,o=(a=r,(i=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(i=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...e)=>{let t=i(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...i}:"className"===n&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==Q.Fragment&&(s.ref=t?eg(t,o):o),Q.cloneElement(r,s)}return Q.Children.count(r)>1?Q.Children.only(null):null})).displayName=`${t}.SlotClone`,r),a=Q.forwardRef((e,t)=>{let{children:r,...a}=e;r5(r)&&"function"==typeof r3&&(r=r3(r._payload));let i=Q.Children.toArray(r),o=i.find(r7);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null);return(0,J.jsx)(n,{...a,ref:t,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,r):null})}return(0,J.jsx)(n,{...a,ref:t,children:r})});return a.displayName=`${e}.Slot`,a}var r9=r6("Slot"),r8=Symbol("radix.slottable");function r7(e){return Q.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===r8}let ne=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,nt=function(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=function e(t){var r,n,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t)){var i=t.length;for(r=0;r<i;r++)t[r]&&(n=e(t[r]))&&(a&&(a+=" "),a+=n)}else for(n in t)t[n]&&(a&&(a+=" "),a+=n);return a}(e))&&(n&&(n+=" "),n+=t);return n},nr=(e,t)=>r=>{var n;if((null==t?void 0:t.variants)==null)return nt(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(e=>{let t=null==r?void 0:r[e],n=null==i?void 0:i[e];if(null===t)return null;let o=ne(t)||ne(n);return a[e][o]}),s=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return nt(e,o,null==t||null==(n=t.compoundVariants)?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...i,...s}[t]):({...i,...s})[t]===r})?[...e,r,n]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)},nn=nr("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-[var(--brand-solid)] text-[var(--brand-foreground)] shadow-xs hover:opacity-90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:opacity-90",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-[var(--brand)] underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function na({className:e,variant:t,size:r,asChild:n=!1,...a}){return(0,J.jsx)(n?r9:"button",{"data-slot":"button",className:rZ(nn({variant:t,size:r,className:e})),...a})}var ni=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=r6(`Primitive.${t}`),n=Q.forwardRef((e,n)=>{let{asChild:a,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,J.jsx)(a?r:t,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),no=Q.forwardRef((e,t)=>(0,J.jsx)(ni.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));no.displayName="Label";let ns=nr("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),nl=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)(no,{ref:r,className:rZ(ns(),e),...t}));function nu({className:e,type:t,...r}){return(0,J.jsx)("input",{type:t,"data-slot":"input",className:rZ("flex h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none transition-[color,box-shadow] selection:bg-blue-200 selection:text-gray-900 file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 dark:bg-input/30 dark:selection:bg-blue-600 dark:selection:text-white md:text-sm","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}function nc({open:e,onOpenChange:t,onSave:r,initialConfig:n}){let[a,i]=(0,Q.useState)(n?.deploymentUrl||"http://127.0.0.1:6174"),[o,s]=(0,Q.useState)(null),l=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(e){if(s(null),n?.deploymentUrl)return void i(n.deploymentUrl);fetch("/api/evosci-config").then(e=>e.json()).then(e=>{e?.deploymentUrl&&i(e.deploymentUrl)}).catch(()=>{})}},[e,n]);let u=()=>{let e=a.trim();if(!e){s("Enter your deployment URL to continue."),l.current?.focus();return}try{new URL(e)}catch{s("Enter a valid URL, e.g. http://127.0.0.1:6174"),l.current?.focus();return}r({deploymentUrl:e,assistantId:ed}),t(!1)};return(0,J.jsx)(rK,{open:e,onOpenChange:t,children:(0,J.jsxs)(rJ,{className:"sm:max-w-[525px]",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Configuration"}),(0,J.jsxs)(r2,{children:["The URL of your EvoScientist deployment. By default this is your local deployment (detected automatically) — or a public URL from"," ",(0,J.jsx)("code",{children:"EvoSci deploy"}),". Saved in your browser's local storage."]})]}),(0,J.jsx)("div",{className:"grid gap-4 py-4",children:(0,J.jsxs)("div",{className:"grid gap-2",children:[(0,J.jsx)(nl,{htmlFor:"deploymentUrl",children:"Deployment URL"}),(0,J.jsx)(nu,{ref:l,id:"deploymentUrl",name:"deploymentUrl",type:"url",inputMode:"url",autoComplete:"off",spellCheck:!1,autoFocus:!0,placeholder:"http://127.0.0.1:6174",value:a,onChange:e=>{i(e.target.value),o&&s(null)},onKeyDown:e=>{"Enter"!==e.key||e.nativeEvent.isComposing||u()},"aria-invalid":!!o||void 0,"aria-describedby":o?"deploymentUrl-error":void 0}),o&&(0,J.jsx)("p",{id:"deploymentUrl-error",role:"alert","aria-live":"polite",className:"text-sm text-destructive",children:o})]})}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),(0,J.jsx)(na,{onClick:u,children:"Save"})]})]})})}nl.displayName=no.displayName;let nd=(...e)=>fetch(...e),np=Symbol.for("lg:fetch_implementation");var nf=e.i(57140),nm=e.i(53274);let nh=[400,401,402,403,404,405,406,407,408,409,422];var ng=class e extends Error{status;text;response;constructor(e,t,r){super(`HTTP ${e}: ${t}`),this.status=e,this.text=t,this.response=r}static async fromResponse(t,r){try{return new e(t.status,await t.text(),r?.includeResponse?t:void 0)}catch{return new e(t.status,t.statusText,r?.includeResponse?t:void 0)}}},nb=class{maxConcurrency;maxRetries;queue;onFailedResponseHook;customFetch;constructor(e){this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??4,"default"in nm.default?this.queue=new nm.default.default({concurrency:this.maxConcurrency}):this.queue=new nm.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook,this.customFetch=e.fetch}call(e,...t){let{onFailedResponseHook:r}=this;return this.queue.add(()=>(0,nf.default)(()=>e(...t).catch(async e=>{if(e instanceof Error)throw e;if(null!=e&&"object"==typeof e&&"status"in e&&"statusText"in e&&"text"in e)throw await ng.fromResponse(e,{includeResponse:!!r});throw Error(e)}),{async onFailedAttempt(e){if(e.message.startsWith("Cancel")||e.message.startsWith("TimeoutError")||e.message.startsWith("AbortError")||e?.code==="ECONNABORTED")throw e;if(e instanceof ng){if(nh.includes(e.status))throw e;r&&e.response&&await r(e.response)}},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,t,...r){return e.signal?Promise.race([this.call(t,...r),new Promise((t,r)=>{e.signal?.addEventListener("abort",()=>{r(Error("AbortError"))})})]):this.call(t,...r)}fetch(...e){let t=this.customFetch??globalThis[np]??nd;return this.call(()=>t(...e).then(e=>e.ok?e:Promise.reject(e)))}};let ny=[13,10];function nv(){let e=[],t=!1;return new TransformStream({start(){e=[],t=!1},transform(r,n){let a=r;if(t&&(a=nw([[13],a]),t=!1),a.length>0&&13===a.at(-1)&&(t=!0,a=a.subarray(0,-1)),!a.length)return;let i=ny.includes(a.at(-1)),o=a.length-1,{lines:s}=a.reduce((e,t,r)=>(e.from>r||((13===t||10===t)&&(e.lines.push(a.subarray(e.from,r)),13===t&&10===a[r+1]?e.from=r+2:e.from=r+1),r===o&&e.from<=o&&e.lines.push(a.subarray(e.from))),e),{lines:[],from:0});if(1===s.length&&!i)return void e.push(s[0]);for(let t of(e.length&&(e.push(s[0]),s[0]=nw(e),e=[]),!i&&s.length&&(e=[s.pop()]),s))n.enqueue(t)},flush(t){e.length&&t.enqueue(nw(e))}})}function n_(){let e="",t=[],r="",n=null,a=new TextDecoder;return new TransformStream({transform(i,o){if(!i.length){if(!e&&!t.length&&!r&&null==n)return;let i={id:r||void 0,event:e,data:t.length?nE(a,t):null};e="",t=[],n=null,o.enqueue(i);return}if(58===i[0])return;let s=i.indexOf(58);if(-1===s)return;let l=a.decode(i.subarray(0,s)),u=i.subarray(s+1);if(32===u[0]&&(u=u.subarray(1)),"event"===l)e=a.decode(u);else if("data"===l)t.push(u);else if("id"===l)-1===u.indexOf(0)&&(r=a.decode(u));else if("retry"===l){let e=Number.parseInt(a.decode(u),10);Number.isNaN(e)||(n=e)}},flush(n){e&&n.enqueue({id:r||void 0,event:e,data:t.length?nE(a,t):null})}})}function nw(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}function nE(e,t){return JSON.parse(e.decode(nw(t)))}var nx=class e extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();if(e.done)return this.reader.releaseLock(),{done:!0,value:void 0};return{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}throw e}async [Symbol.asyncDispose](){await this.return()}[Symbol.asyncIterator](){return this}static fromReadableStream(t){let r=t.getReader();return new e({start:e=>(function t(){return r.read().then(({done:r,value:n})=>r?void e.close():(e.enqueue(n),t()))})(),cancel(){r.releaseLock()}})}static fromAsyncGenerator(t){return new e({async pull(e){let{value:r,done:n}=await t.next();n&&e.close(),e.enqueue(r)},async cancel(e){await t.return(e)}})}};function nS(...e){let t=new Headers;for(let r of e)if(r)for(let[e,n]of function*(e){let t,r=!1;if(e instanceof Headers){let r=[];e.forEach((e,t)=>{r.push([t,e])}),t=r}else Array.isArray(e)?t=e:(r=!0,t=Object.entries(e??{}));for(let e of t){let t=e[0];if("string"!=typeof t)throw TypeError(`Expected header name to be a string, got ${typeof t}`);let n=Array.isArray(e[1])?e[1]:[e[1]],a=!1;for(let e of n)void 0!==e&&(r&&!a&&(a=!0,yield[t,null]),yield[t,e])}}(r))null===n?t.delete(e):t.append(e,n);let r=[];return t.forEach((e,t)=>{r.push([t,e])}),Object.fromEntries(r)}let nk=/(\/threads\/(?<thread_id>.+))?\/runs\/(?<run_id>.+)/;function nT(e){let t=e.headers.get("Content-Location");if(!t)return;let r=nk.exec(t);if(r?.groups?.run_id)return{run_id:r.groups.run_id,thread_id:r.groups.thread_id||void 0}}var nA=class{asyncCaller;timeoutMs;apiUrl;defaultHeaders;onRequest;constructor(e){const t={maxRetries:4,maxConcurrency:4,...e?.callerOptions};let r="http://localhost:8123";if(!e?.apiUrl&&"object"==typeof globalThis&&null!=globalThis){const e=Symbol.for("langgraph_api:fetch"),n=Symbol.for("langgraph_api:url"),a=globalThis;a[e]&&(t.fetch??=a[e]),a[n]&&(r=a[n])}this.asyncCaller=new nb(t),this.timeoutMs=e?.timeoutMs,this.apiUrl=e?.apiUrl?.replace(/\/$/,"")||r,this.defaultHeaders=e?.defaultHeaders||{},this.onRequest=e?.onRequest;const n=function(e){if(null!==e){if(e)return e;for(let e of["LANGGRAPH","LANGSMITH","LANGCHAIN"]){let t=function(e){try{return void 0!==X.default?X.default.env?.[e]:void 0}catch(e){return}}(`${e}_API_KEY`);if(t)return t.trim().replace(/^["']|["']$/g,"")}}}(e?.apiKey);n&&(this.defaultHeaders["x-api-key"]=n)}prepareFetchOptions(e,t){let r={...t,headers:nS(this.defaultHeaders,t?.headers)};r.json&&(r.body=JSON.stringify(r.json),r.headers=nS(r.headers,{"content-type":"application/json"}),delete r.json),r.withResponse&&delete r.withResponse;let n=null;void 0!==t?.timeoutMs?null!=t.timeoutMs&&(n=AbortSignal.timeout(t.timeoutMs)):null!=this.timeoutMs&&(n=AbortSignal.timeout(this.timeoutMs)),r.signal=function(...e){let t=e.filter(e=>null!=e);if(0===t.length)return;if(1===t.length)return t[0];let r=new AbortController;for(let t of e){if(t?.aborted){r.abort(t.reason);break}t?.addEventListener("abort",()=>r.abort(t.reason),{once:!0})}return r.signal}(n,r.signal);let a=new URL(`${this.apiUrl}${e}`);if(r.params){for(let[e,t]of Object.entries(r.params)){if(null==t)continue;let r="string"==typeof t||"number"==typeof t?t.toString():JSON.stringify(t);a.searchParams.append(e,r)}delete r.params}return[a,r]}async fetch(e,t){let[r,n]=this.prepareFetchOptions(e,t),a=n;this.onRequest&&(a=await this.onRequest(r,n));let i=await this.asyncCaller.fetch(r,a),o=(()=>{if(202!==i.status&&204!==i.status)return i.json()})();return t?.withResponse?[await o,i]:o}},nN=class extends nA{async createForThread(e,t,r){let n={schedule:r?.schedule,input:r?.input,config:r?.config,context:r?.context,metadata:r?.metadata,assistant_id:t,interrupt_before:r?.interruptBefore,interrupt_after:r?.interruptAfter,webhook:r?.webhook,multitask_strategy:r?.multitaskStrategy,if_not_exists:r?.ifNotExists,checkpoint_during:r?.checkpointDuring,durability:r?.durability};return this.fetch(`/threads/${e}/runs/crons`,{method:"POST",json:n})}async create(e,t){let r={schedule:t?.schedule,input:t?.input,config:t?.config,context:t?.context,metadata:t?.metadata,assistant_id:e,interrupt_before:t?.interruptBefore,interrupt_after:t?.interruptAfter,webhook:t?.webhook,multitask_strategy:t?.multitaskStrategy,if_not_exists:t?.ifNotExists,checkpoint_during:t?.checkpointDuring,durability:t?.durability};return this.fetch("/runs/crons",{method:"POST",json:r})}async delete(e){await this.fetch(`/runs/crons/${e}`,{method:"DELETE"})}async search(e){return this.fetch("/runs/crons/search",{method:"POST",json:{assistant_id:e?.assistantId??void 0,thread_id:e?.threadId??void 0,limit:e?.limit??10,offset:e?.offset??0,sort_by:e?.sortBy??void 0,sort_order:e?.sortOrder??void 0,select:e?.select??void 0}})}async count(e){return this.fetch("/runs/crons/count",{method:"POST",json:{assistant_id:e?.assistantId??void 0,thread_id:e?.threadId??void 0}})}},nI=class extends nA{async get(e){return this.fetch(`/assistants/${e}`)}async getGraph(e,t){return this.fetch(`/assistants/${e}/graph`,{params:{xray:t?.xray}})}async getSchemas(e){return this.fetch(`/assistants/${e}/schemas`)}async getSubgraphs(e,t){return t?.namespace?this.fetch(`/assistants/${e}/subgraphs/${t.namespace}`,{params:{recurse:t?.recurse}}):this.fetch(`/assistants/${e}/subgraphs`,{params:{recurse:t?.recurse}})}async create(e){return this.fetch("/assistants",{method:"POST",json:{graph_id:e.graphId,config:e.config,context:e.context,metadata:e.metadata,assistant_id:e.assistantId,if_exists:e.ifExists,name:e.name,description:e.description}})}async update(e,t){return this.fetch(`/assistants/${e}`,{method:"PATCH",json:{graph_id:t.graphId,config:t.config,context:t.context,metadata:t.metadata,name:t.name,description:t.description}})}async delete(e){return this.fetch(`/assistants/${e}`,{method:"DELETE"})}async search(e){return this.fetch("/assistants/search",{method:"POST",json:{graph_id:e?.graphId??void 0,name:e?.name??void 0,metadata:e?.metadata??void 0,limit:e?.limit??10,offset:e?.offset??0,sort_by:e?.sortBy??void 0,sort_order:e?.sortOrder??void 0,select:e?.select??void 0}})}async count(e){return this.fetch("/assistants/count",{method:"POST",json:{metadata:e?.metadata??void 0,graph_id:e?.graphId??void 0}})}async getVersions(e,t){return this.fetch(`/assistants/${e}/versions`,{method:"POST",json:{metadata:t?.metadata??void 0,limit:t?.limit??10,offset:t?.offset??0}})}async setLatest(e,t){return this.fetch(`/assistants/${e}/latest`,{method:"POST",json:{version:t}})}},nC=class extends nA{async get(e){return this.fetch(`/threads/${e}`)}async create(e){let t="number"==typeof e?.ttl?{ttl:e.ttl,strategy:"delete"}:e?.ttl;return this.fetch("/threads",{method:"POST",json:{metadata:{...e?.metadata,graph_id:e?.graphId},thread_id:e?.threadId,if_exists:e?.ifExists,supersteps:e?.supersteps?.map(e=>({updates:e.updates.map(e=>({values:e.values,command:e.command,as_node:e.asNode}))})),ttl:t}})}async copy(e){return this.fetch(`/threads/${e}/copy`,{method:"POST"})}async update(e,t){let r="number"==typeof t?.ttl?{ttl:t.ttl,strategy:"delete"}:t?.ttl;return this.fetch(`/threads/${e}`,{method:"PATCH",json:{metadata:t?.metadata,ttl:r}})}async delete(e){return this.fetch(`/threads/${e}`,{method:"DELETE"})}async search(e){return this.fetch("/threads/search",{method:"POST",json:{metadata:e?.metadata??void 0,ids:e?.ids??void 0,limit:e?.limit??10,offset:e?.offset??0,status:e?.status,sort_by:e?.sortBy,sort_order:e?.sortOrder,select:e?.select??void 0,values:e?.values??void 0}})}async count(e){return this.fetch("/threads/count",{method:"POST",json:{metadata:e?.metadata??void 0,values:e?.values??void 0,status:e?.status??void 0}})}async getState(e,t,r){return null!=t?"string"!=typeof t?this.fetch(`/threads/${e}/state/checkpoint`,{method:"POST",json:{checkpoint:t,subgraphs:r?.subgraphs}}):this.fetch(`/threads/${e}/state/${t}`,{params:{subgraphs:r?.subgraphs}}):this.fetch(`/threads/${e}/state`,{params:{subgraphs:r?.subgraphs}})}async updateState(e,t){return this.fetch(`/threads/${e}/state`,{method:"POST",json:{values:t.values,checkpoint_id:t.checkpointId,checkpoint:t.checkpoint,as_node:t?.asNode}})}async patchState(e,t){let r;if("string"!=typeof e){if("string"!=typeof e.configurable?.thread_id)throw Error("Thread ID is required when updating state with a config.");r=e.configurable.thread_id}else r=e;return this.fetch(`/threads/${r}/state`,{method:"PATCH",json:{metadata:t}})}async getHistory(e,t){return this.fetch(`/threads/${e}/history`,{method:"POST",json:{limit:t?.limit??10,before:t?.before,metadata:t?.metadata,checkpoint:t?.checkpoint}})}async *joinStream(e,t){let[r,n]=this.prepareFetchOptions(`/threads/${e}/stream`,{method:"GET",headers:t?.lastEventId?{"Last-Event-ID":t.lastEventId}:void 0,params:t?.streamMode?{stream_mode:t.streamMode}:void 0});null!=this.onRequest&&(n=await this.onRequest(r,n));let a=((await this.asyncCaller.fetch(r,n)).body||new ReadableStream({start:e=>e.close()})).pipeThrough(nv()).pipeThrough(n_());yield*nx.fromReadableStream(a)}},nR=class extends nA{async *stream(e,t,r){let n={input:r?.input,command:r?.command,config:r?.config,context:r?.context,metadata:r?.metadata,stream_mode:r?.streamMode,stream_subgraphs:r?.streamSubgraphs,stream_resumable:r?.streamResumable,feedback_keys:r?.feedbackKeys,assistant_id:t,interrupt_before:r?.interruptBefore,interrupt_after:r?.interruptAfter,checkpoint:r?.checkpoint,checkpoint_id:r?.checkpointId,webhook:r?.webhook,multitask_strategy:r?.multitaskStrategy,on_completion:r?.onCompletion,on_disconnect:r?.onDisconnect,after_seconds:r?.afterSeconds,if_not_exists:r?.ifNotExists,checkpoint_during:r?.checkpointDuring,durability:r?.durability},a=null==e?"/runs/stream":`/threads/${e}/runs/stream`,[i,o]=this.prepareFetchOptions(a,{method:"POST",json:n,timeoutMs:null,signal:r?.signal});null!=this.onRequest&&(o=await this.onRequest(i,o));let s=await this.asyncCaller.fetch(i,o),l=nT(s);l&&r?.onRunCreated?.(l);let u=(s.body||new ReadableStream({start:e=>e.close()})).pipeThrough(nv()).pipeThrough(n_());yield*nx.fromReadableStream(u)}async create(e,t,r){let n={input:r?.input,command:r?.command,config:r?.config,context:r?.context,metadata:r?.metadata,stream_mode:r?.streamMode,stream_subgraphs:r?.streamSubgraphs,stream_resumable:r?.streamResumable,assistant_id:t,interrupt_before:r?.interruptBefore,interrupt_after:r?.interruptAfter,webhook:r?.webhook,checkpoint:r?.checkpoint,checkpoint_id:r?.checkpointId,multitask_strategy:r?.multitaskStrategy,after_seconds:r?.afterSeconds,if_not_exists:r?.ifNotExists,checkpoint_during:r?.checkpointDuring,durability:r?.durability,langsmith_tracer:r?._langsmithTracer?{project_name:r?._langsmithTracer?.projectName,example_id:r?._langsmithTracer?.exampleId}:void 0},a=null===e?"/runs":`/threads/${e}/runs`,[i,o]=await this.fetch(a,{method:"POST",json:n,signal:r?.signal,withResponse:!0}),s=nT(o);return s&&r?.onRunCreated?.(s),i}async createBatch(e){let t=e.map(e=>({...e,assistant_id:e.assistantId})).map(e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>void 0!==t)));return this.fetch("/runs/batch",{method:"POST",json:t})}async wait(e,t,r){let n={input:r?.input,command:r?.command,config:r?.config,context:r?.context,metadata:r?.metadata,assistant_id:t,interrupt_before:r?.interruptBefore,interrupt_after:r?.interruptAfter,checkpoint:r?.checkpoint,checkpoint_id:r?.checkpointId,webhook:r?.webhook,multitask_strategy:r?.multitaskStrategy,on_completion:r?.onCompletion,on_disconnect:r?.onDisconnect,after_seconds:r?.afterSeconds,if_not_exists:r?.ifNotExists,checkpoint_during:r?.checkpointDuring,durability:r?.durability,langsmith_tracer:r?._langsmithTracer?{project_name:r?._langsmithTracer?.projectName,example_id:r?._langsmithTracer?.exampleId}:void 0},a=null==e?"/runs/wait":`/threads/${e}/runs/wait`,[i,o]=await this.fetch(a,{method:"POST",json:n,timeoutMs:null,signal:r?.signal,withResponse:!0}),s=nT(o);if(s&&r?.onRunCreated?.(s),(r?.raiseError===void 0||r.raiseError)&&"__error__"in i&&"object"==typeof i.__error__&&i.__error__&&"error"in i.__error__&&"message"in i.__error__)throw Error(`${i.__error__?.error}: ${i.__error__?.message}`);return i}async list(e,t){return this.fetch(`/threads/${e}/runs`,{params:{limit:t?.limit??10,offset:t?.offset??0,status:t?.status??void 0,select:t?.select??void 0}})}async get(e,t){return this.fetch(`/threads/${e}/runs/${t}`)}async cancel(e,t,r=!1,n="interrupt"){return this.fetch(`/threads/${e}/runs/${t}/cancel`,{method:"POST",params:{wait:r?"1":"0",action:n}})}async join(e,t,r){return this.fetch(`/threads/${e}/runs/${t}/join`,{timeoutMs:null,signal:r?.signal})}async *joinStream(e,t,r){let n="object"==typeof r&&null!=r&&r instanceof AbortSignal?{signal:r}:r,[a,i]=this.prepareFetchOptions(null!=e?`/threads/${e}/runs/${t}/stream`:`/runs/${t}/stream`,{method:"GET",timeoutMs:null,signal:n?.signal,headers:n?.lastEventId?{"Last-Event-ID":n.lastEventId}:void 0,params:{cancel_on_disconnect:n?.cancelOnDisconnect?"1":"0",stream_mode:n?.streamMode}});null!=this.onRequest&&(i=await this.onRequest(a,i));let o=((await this.asyncCaller.fetch(a,i)).body||new ReadableStream({start:e=>e.close()})).pipeThrough(nv()).pipeThrough(n_());yield*nx.fromReadableStream(o)}async delete(e,t){return this.fetch(`/threads/${e}/runs/${t}`,{method:"DELETE"})}},nO=class extends nA{async putItem(e,t,r,n){e.forEach(e=>{if(e.includes("."))throw Error(`Invalid namespace label '${e}'. Namespace labels cannot contain periods ('.')`)});let a={namespace:e,key:t,value:r,index:n?.index,ttl:n?.ttl};return this.fetch("/store/items",{method:"PUT",json:a})}async getItem(e,t,r){e.forEach(e=>{if(e.includes("."))throw Error(`Invalid namespace label '${e}'. Namespace labels cannot contain periods ('.')`)});let n={namespace:e.join("."),key:t};r?.refreshTtl!==void 0&&(n.refresh_ttl=r.refreshTtl);let a=await this.fetch("/store/items",{params:n});return a?{...a,createdAt:a.created_at,updatedAt:a.updated_at}:null}async deleteItem(e,t){return e.forEach(e=>{if(e.includes("."))throw Error(`Invalid namespace label '${e}'. Namespace labels cannot contain periods ('.')`)}),this.fetch("/store/items",{method:"DELETE",json:{namespace:e,key:t}})}async searchItems(e,t){let r={namespace_prefix:e,filter:t?.filter,limit:t?.limit??10,offset:t?.offset??0,query:t?.query,refresh_ttl:t?.refreshTtl};return{items:(await this.fetch("/store/items/search",{method:"POST",json:r})).items.map(e=>({...e,createdAt:e.created_at,updatedAt:e.updated_at}))}}async listNamespaces(e){let t={prefix:e?.prefix,suffix:e?.suffix,max_depth:e?.maxDepth,limit:e?.limit??100,offset:e?.offset??0};return this.fetch("/store/namespaces",{method:"POST",json:t})}},nL=class e extends nA{static promiseCache={};static getOrCached(t,r){if(null!=e.promiseCache[t])return e.promiseCache[t];let n=r();return e.promiseCache[t]=n,n}async getComponent(t,r){return e.getOrCached(`${this.apiUrl}-${t}-${r}`,async()=>{let[e,n]=this.prepareFetchOptions(`/ui/${t}`,{headers:{Accept:"text/html","Content-Type":"application/json"},method:"POST",json:{name:r}});return null!=this.onRequest&&(n=await this.onRequest(e,n)),(await this.asyncCaller.fetch(e,n)).text()})}},nP=class{assistants;threads;runs;crons;store;"~ui";"~configHash";constructor(e){this["~configHash"]=JSON.stringify({apiUrl:e?.apiUrl,apiKey:e?.apiKey,timeoutMs:e?.timeoutMs,defaultHeaders:e?.defaultHeaders,maxConcurrency:e?.callerOptions?.maxConcurrency,maxRetries:e?.callerOptions?.maxRetries,callbacks:{onFailedResponseHook:e?.callerOptions?.onFailedResponseHook!=null,onRequest:e?.onRequest!=null,fetch:e?.callerOptions?.fetch!=null}}),this.assistants=new nI(e),this.threads=new nC(e),this.runs=new nR(e),this.crons=new nN(e),this.store=new nO(e),this["~ui"]=new nL(e)}};let nD=(0,Q.createContext)(null);function nM({children:e,deploymentUrl:t,apiKey:r}){let n=(0,Q.useMemo)(()=>new nP({apiUrl:t,defaultHeaders:{"Content-Type":"application/json","X-Api-Key":r}}),[t,r]),a=(0,Q.useMemo)(()=>({client:n}),[n]);return(0,J.jsx)(nD.Provider,{value:a,children:e})}function nj(){let e=(0,Q.useContext)(nD);if(!e)throw Error("useClient must be used within a ClientProvider");return e.client}let nF=ro("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),n$=ro("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),nU=ro("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),nz=ro("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]),nB=ro("panel-right",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),nH=ro("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]),nG=ro("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),nV=(0,Q.createContext)(null);nV.displayName="PanelGroupContext";let nq="data-panel-group-direction",nW="data-panel-group-id",nZ="data-resize-handle",nK="data-panel-resize-handle-id",nY=Q.useLayoutEffect,nX=Q["useId".toString()],nJ="function"==typeof nX?nX:()=>null,nQ=0;function n0(e=null){let t=nJ(),r=(0,Q.useRef)(e||t||null);return null===r.current&&(r.current=""+nQ++),null!=e?e:r.current}function n1({children:e,className:t="",collapsedSize:r,collapsible:n,defaultSize:a,forwardedRef:i,id:o,maxSize:s,minSize:l,onCollapse:u,onExpand:c,onResize:d,order:p,style:f,tagName:m="div",...h}){let g=(0,Q.useContext)(nV);if(null===g)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:b,expandPanel:y,getPanelSize:v,getPanelStyle:_,groupId:w,isPanelCollapsed:E,reevaluatePanelConstraints:x,registerPanel:S,resizePanel:k,unregisterPanel:T}=g,A=n0(o),N=(0,Q.useRef)({callbacks:{onCollapse:u,onExpand:c,onResize:d},constraints:{collapsedSize:r,collapsible:n,defaultSize:a,maxSize:s,minSize:l},id:A,idIsFromProps:void 0!==o,order:p});(0,Q.useRef)({didLogMissingDefaultSizeWarning:!1}),nY(()=>{let{callbacks:e,constraints:t}=N.current,i={...t};N.current.id=A,N.current.idIsFromProps=void 0!==o,N.current.order=p,e.onCollapse=u,e.onExpand=c,e.onResize=d,t.collapsedSize=r,t.collapsible=n,t.defaultSize=a,t.maxSize=s,t.minSize=l,(i.collapsedSize!==t.collapsedSize||i.collapsible!==t.collapsible||i.maxSize!==t.maxSize||i.minSize!==t.minSize)&&x(N.current,i)}),nY(()=>{let e=N.current;return S(e),()=>{T(e)}},[p,A,S,T]),(0,Q.useImperativeHandle)(i,()=>({collapse:()=>{b(N.current)},expand:e=>{y(N.current,e)},getId:()=>A,getSize:()=>v(N.current),isCollapsed:()=>E(N.current),isExpanded:()=>!E(N.current),resize:e=>{k(N.current,e)}}),[b,y,v,E,A,k]);let I=_(N.current,a);return(0,Q.createElement)(m,{...h,children:e,className:t,id:A,style:{...I,...f},[nW]:w,"data-panel":"","data-panel-collapsible":n||void 0,"data-panel-id":A,"data-panel-size":parseFloat(""+I.flexGrow).toFixed(1)})}let n2=(0,Q.forwardRef)((e,t)=>(0,Q.createElement)(n1,{...e,forwardedRef:t}));n1.displayName="Panel",n2.displayName="forwardRef(Panel)";let n4=null,n3=-1,n5=null;function n6(e,r,n){var a,i,o;let s=function(e,t){let r=(t&ao)!=0,n=(t&as)!=0,a=(t&al)!=0,i=(t&au)!=0;if(t){if(r)if(a)return"se-resize";else if(i)return"ne-resize";else return"e-resize";else if(n)if(a)return"sw-resize";else if(i)return"nw-resize";else return"w-resize";else if(a)return"s-resize";else if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,r);n4!==s&&(n4=s,null===n5&&(n5=document.createElement("style"),t&&n5.setAttribute("nonce",t),document.head.appendChild(n5)),n3>=0&&(null==(o=n5.sheet)||o.removeRule(n3)),n3=null!=(a=null==(i=n5.sheet)?void 0:i.insertRule(`*{cursor: ${s} !important;}`))?a:-1)}function n9(e){return"keydown"===e.type}function n8(e){return e.type.startsWith("pointer")}function n7(e){return e.type.startsWith("mouse")}function ae(e){if(n8(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(n7(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}let at=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ar(e){let t=e.length;for(;t--;){let r=e[t];if(aS(r,"Missing node"),function(e){var t;let r,n=getComputedStyle(e);return"fixed"===n.position||!!("auto"!==n.zIndex&&("static"!==n.position||"flex"===(r=getComputedStyle(null!=(t=ai(e))?t:e).display)||"inline-flex"===r)||1>+n.opacity||"transform"in n&&"none"!==n.transform||"webkitTransform"in n&&"none"!==n.webkitTransform||"mixBlendMode"in n&&"normal"!==n.mixBlendMode||"filter"in n&&"none"!==n.filter||"webkitFilter"in n&&"none"!==n.webkitFilter||"isolation"in n&&"isolate"===n.isolation||at.test(n.willChange))||"touch"===n.webkitOverflowScrolling}(r))return r}return null}function an(e){return e&&Number(getComputedStyle(e).zIndex)||0}function aa(e){let t=[];for(;e;)t.push(e),e=ai(e);return t}function ai(e){let{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}let ao=1,as=2,al=4,au=8,ac="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}(),ad=[],ap=!1,af=new Map,am=new Map,ah=new Set;function ag(e){let{target:t}=e,{x:r,y:n}=ae(e);ap=!0,a_({target:t,x:r,y:n}),aE(),ad.length>0&&(ax("down",e),aw(),e.preventDefault(),av(t)||e.stopImmediatePropagation())}function ab(e){let{x:t,y:r}=ae(e);if(ap&&"pointerleave"!==e.type&&0===e.buttons&&(ap=!1,ax("up",e)),!ap){let{target:n}=e;a_({target:n,x:t,y:r})}ax("move",e),aw(),ad.length>0&&e.preventDefault()}function ay(e){let{target:t}=e,{x:r,y:n}=ae(e);am.clear(),ap=!1,ad.length>0&&(e.preventDefault(),av(t)||e.stopImmediatePropagation()),ax("up",e),a_({target:t,x:r,y:n}),aw(),aE()}function av(e){let t=e;for(;t;){if(t.hasAttribute(nZ))return!0;t=t.parentElement}return!1}function a_({target:e,x:t,y:r}){ad.splice(0);let n=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(n=e),ah.forEach(e=>{let{element:a,hitAreaMargins:i}=e,o=a.getBoundingClientRect(),{bottom:s,left:l,right:u,top:c}=o,d=ac?i.coarse:i.fine;if(t>=l-d&&t<=u+d&&r>=c-d&&r<=s+d){if(null!==n&&document.contains(n)&&a!==n&&!a.contains(n)&&!n.contains(a)&&function(e,t){let r;if(e===t)throw Error("Cannot compare node with itself");let n={a:aa(e),b:aa(t)};for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;aS(r,"Stacking order can only be calculated for elements with a common ancestor");let a={a:an(ar(n.a)),b:an(ar(n.b))};if(a.a===a.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},a=e.length;for(;a--;){let r=e[a];if(r===t.a)return 1;if(r===t.b)return -1}}return Math.sign(a.a-a.b)}(n,a)>0){let e=n,t=!1;for(;e;){var p;if(e.contains(a))break;if(p=e.getBoundingClientRect(),p.x<o.x+o.width&&p.x+p.width>o.x&&p.y<o.y+o.height&&p.y+p.height>o.y){t=!0;break}e=e.parentElement}if(t)return}ad.push(e)}})}function aw(){let e=!1,t=!1;ad.forEach(r=>{let{direction:n}=r;"horizontal"===n?e=!0:t=!0});let r=0;am.forEach(e=>{r|=e}),e&&t?n6("intersection",r,ap):e?n6("horizontal",r,ap):t?n6("vertical",r,ap):null!==n5&&(document.head.removeChild(n5),n4=null,n5=null,n3=-1)}function aE(){var e;null==(e=r)||e.abort();let t={capture:!0,signal:(r=new AbortController).signal};ah.size&&(ap?(ad.length>0&&af.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",ay,t),n.addEventListener("pointerleave",ab,t),n.addEventListener("pointermove",ab,t))}),af.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",ay,t),n.addEventListener("pointercancel",ay,t)})):af.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",ag,t),n.addEventListener("pointermove",ab,t))}))}function ax(e,t){ah.forEach(r=>{let{setResizeHandlerState:n}=r;n(e,ad.includes(r),t)})}function aS(e,t){if(!e)throw console.error(t),Error(t)}function ak(e,t,r=10){return e.toFixed(r)===t.toFixed(r)?0:e>t?1:-1}function aT(e,t,r=10){return 0===ak(e,t,r)}function aA(e,t,r){return 0===ak(e,t,r)}function aN({panelConstraints:e,panelIndex:t,size:r}){let n=e[t];aS(null!=n,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:i,maxSize:o=100,minSize:s=0}=n;return 0>ak(r,s)&&(r=i&&0>ak(r,(a+s)/2)?a:s),r=parseFloat((r=Math.min(o,r)).toFixed(10))}function aI({delta:e,initialLayout:t,panelConstraints:r,pivotIndices:n,prevLayout:a,trigger:i}){if(aA(e,0))return t;let o=[...t],[s,l]=n;aS(null!=s,"Invalid first pivot index"),aS(null!=l,"Invalid second pivot index");let u=0;if("keyboard"===i){{let n=e<0?l:s,a=r[n];aS(a,`Panel constraints not found for index ${n}`);let{collapsedSize:i=0,collapsible:o,minSize:u=0}=a;if(o){let r=t[n];if(aS(null!=r,`Previous layout not found for panel index ${n}`),aA(r,i)){let t=u-r;ak(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let n=e<0?s:l,a=r[n];aS(a,`No panel constraints found for index ${n}`);let{collapsedSize:i=0,collapsible:o,minSize:u=0}=a;if(o){let r=t[n];if(aS(null!=r,`Previous layout not found for panel index ${n}`),aA(r,u)){let t=r-i;ak(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let n=e<0?1:-1,a=e<0?l:s,i=0;for(;;){let e=t[a];if(aS(null!=e,`Previous layout not found for panel index ${a}`),i+=aN({panelConstraints:r,panelIndex:a,size:100})-e,(a+=n)<0||a>=r.length)break}let o=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-o:o}{let n=e<0?s:l;for(;n>=0&&n<r.length;){let a=Math.abs(e)-Math.abs(u),i=t[n];aS(null!=i,`Previous layout not found for panel index ${n}`);let s=aN({panelConstraints:r,panelIndex:n,size:i-a});if(!aA(i,s)&&(u+=i-s,o[n]=s,u.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?n--:n++}}if(function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!aA(e[r],t[r],void 0))return!1;return!0}(a,o))return a;{let n=e<0?l:s,a=t[n];aS(null!=a,`Previous layout not found for panel index ${n}`);let i=a+u,c=aN({panelConstraints:r,panelIndex:n,size:i});if(o[n]=c,!aA(c,i)){let t=i-c,n=e<0?l:s;for(;n>=0&&n<r.length;){let a=o[n];aS(null!=a,`Previous layout not found for panel index ${n}`);let i=aN({panelConstraints:r,panelIndex:n,size:a+t});if(aA(a,i)||(t-=i-a,o[n]=i),aA(t,0))break;e>0?n--:n++}}}return aA(o.reduce((e,t)=>t+e,0),100)?o:a}function aC(e,t=document){return Array.from(t.querySelectorAll(`[${nK}][data-panel-group-id="${e}"]`))}function aR(e,t,r=document){let n=aC(e,r).findIndex(e=>e.getAttribute(nK)===t);return null!=n?n:null}function aO(e,t,r){let n=aR(e,t,r);return null!=n?[n,n+1]:[-1,-1]}function aL(e,t=document){if((t instanceof HTMLElement||"object"==typeof t&&null!==t&&"tagName"in t&&"getAttribute"in t)&&t.dataset.panelGroupId==e)return t;let r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function aP(e,t=document){let r=t.querySelector(`[${nK}="${e}"]`);return r||null}function aD(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function aM(e,t){let{x:r,y:n}=ae(t);return"horizontal"===e?r:n}function aj(e,t,r){t.forEach((t,n)=>{let a=e[n];aS(a,`Panel data not found for index ${n}`);let{callbacks:i,constraints:o,id:s}=a,{collapsedSize:l=0,collapsible:u}=o,c=r[s];if(null==c||t!==c){r[s]=t;let{onCollapse:e,onExpand:n,onResize:a}=i;a&&a(t,c),u&&(e||n)&&(n&&(null==c||aT(c,l))&&!aT(t,l)&&n(),e&&(null==c||!aT(c,l))&&aT(t,l)&&e())}})}function aF(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function a$(e){try{if("u">typeof localStorage)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function aU(e){return`react-resizable-panels:${e}`}function az(e){return e.map(e=>{let{constraints:t,id:r,idIsFromProps:n,order:a}=e;return n?r:a?`${a}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(",")}function aB(e,t){try{let r=aU(e),n=t.getItem(r);if(n){let e=JSON.parse(n);if("object"==typeof e&&null!=e)return e}}catch(e){}return null}function aH(e,t,r,n,a){var i;let o=aU(e),s=az(t),l=null!=(i=aB(e,a))?i:{};l[s]={expandToSizes:Object.fromEntries(r.entries()),layout:n};try{a.setItem(o,JSON.stringify(l))}catch(e){console.error(e)}}function aG({layout:e,panelConstraints:t}){let r=[...e],n=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(", ")}`);if(!aA(n,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];aS(null!=t,`No layout data found for index ${e}`);let a=100/n*t;r[e]=a}let a=0;for(let e=0;e<t.length;e++){let n=r[e];aS(null!=n,`No layout data found for index ${e}`);let i=aN({panelConstraints:t,panelIndex:e,size:n});n!=i&&(a+=n-i,r[e]=i)}if(!aA(a,0))for(let e=0;e<t.length;e++){let n=r[e];aS(null!=n,`No layout data found for index ${e}`);let i=aN({panelConstraints:t,panelIndex:e,size:n+a});if(n!==i&&(a-=i-n,r[e]=i,aA(a,0)))break}return r}let aV={getItem:e=>(a$(aV),aV.getItem(e)),setItem:(e,t)=>{a$(aV),aV.setItem(e,t)}},aq={};function aW({autoSaveId:e=null,children:t,className:r="",direction:n,forwardedRef:a,id:i=null,onLayout:o=null,keyboardResizeBy:s=null,storage:l=aV,style:u,tagName:c="div",...d}){let p=n0(i),f=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(null),[g,b]=(0,Q.useState)([]),y=function(){let[e,t]=(0,Q.useState)(0);return(0,Q.useCallback)(()=>t(e=>e+1),[])}(),v=(0,Q.useRef)({}),_=(0,Q.useRef)(new Map),w=(0,Q.useRef)(0),E=(0,Q.useRef)({autoSaveId:e,direction:n,dragState:m,id:p,keyboardResizeBy:s,onLayout:o,storage:l}),x=(0,Q.useRef)({layout:g,panelDataArray:[],panelDataArrayChanged:!1});(0,Q.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,Q.useImperativeHandle)(a,()=>({getId:()=>E.current.id,getLayout:()=>{let{layout:e}=x.current;return e},setLayout:e=>{let{onLayout:t}=E.current,{layout:r,panelDataArray:n}=x.current,a=aG({layout:e,panelConstraints:n.map(e=>e.constraints)});aD(r,a)||(b(a),x.current.layout=a,t&&t(a),aj(n,a,v.current))}}),[]),nY(()=>{E.current.autoSaveId=e,E.current.direction=n,E.current.dragState=m,E.current.id=p,E.current.onLayout=o,E.current.storage=l}),function({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:n,panelDataArray:a,panelGroupElement:i,setLayout:o}){(0,Q.useRef)({didWarnAboutMissingResizeHandle:!1}),nY(()=>{if(!i)return;let e=aC(r,i);for(let t=0;t<a.length-1;t++){let{valueMax:r,valueMin:i,valueNow:o}=function({layout:e,panelsArray:t,pivotIndices:r}){let n=0,a=100,i=0,o=0,s=r[0];return aS(null!=s,"No pivot index found"),t.forEach((e,t)=>{let{constraints:r}=e,{maxSize:l=100,minSize:u=0}=r;t===s?(n=u,a=l):(i+=u,o+=l)}),{valueMax:Math.min(a,100-i),valueMin:Math.max(n,100-o),valueNow:e[s]}}({layout:n,panelsArray:a,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{let e=a[t];aS(e,`No panel data found for index "${t}"`),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-valuemax",""+Math.round(r)),s.setAttribute("aria-valuemin",""+Math.round(i)),s.setAttribute("aria-valuenow",null!=o?""+Math.round(o):"")}}return()=>{e.forEach((e,t)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")})}},[r,n,a,i]),(0,Q.useEffect)(()=>{if(!i)return;let e=t.current;aS(e,"Eager values not found");let{panelDataArray:a}=e;aS(null!=aL(r,i),`No group found for id "${r}"`);let s=aC(r,i);aS(s,`No resize handles found for group id "${r}"`);let l=s.map(e=>{let t=e.getAttribute(nK);aS(t,"Resize handle element has no handle id attribute");let[s,l]=function(e,t,r,n=document){var a,i,o,s;let l=aP(t,n),u=aC(e,n),c=l?u.indexOf(l):-1;return[null!=(a=null==(i=r[c])?void 0:i.id)?a:null,null!=(o=null==(s=r[c+1])?void 0:s.id)?o:null]}(r,t,a,i);if(null==s||null==l)return()=>{};let u=e=>{if(!e.defaultPrevented&&"Enter"===e.key){e.preventDefault();let l=a.findIndex(e=>e.id===s);if(l>=0){let e=a[l];aS(e,`No panel data found for index ${l}`);let s=n[l],{collapsedSize:u=0,collapsible:c,minSize:d=0}=e.constraints;if(null!=s&&c){let e=aI({delta:aA(s,u)?d-u:u-s,initialLayout:n,panelConstraints:a.map(e=>e.constraints),pivotIndices:aO(r,t,i),prevLayout:n,trigger:"keyboard"});n!==e&&o(e)}}}};return e.addEventListener("keydown",u),()=>{e.removeEventListener("keydown",u)}});return()=>{l.forEach(e=>e())}},[i,e,t,r,n,a,o])}({committedValuesRef:E,eagerValuesRef:x,groupId:p,layout:g,panelDataArray:x.current.panelDataArray,setLayout:b,panelGroupElement:f.current}),(0,Q.useEffect)(()=>{let{panelDataArray:t}=x.current;if(e){if(0===g.length||g.length!==t.length)return;let r=aq[e];null==r&&(r=function(e,t=10){let r=null;return(...n)=>{null!==r&&clearTimeout(r),r=setTimeout(()=>{e(...n)},t)}}(aH,100),aq[e]=r),r(e,[...t],new Map(_.current),g,l)}},[e,g,l]),(0,Q.useEffect)(()=>{});let S=(0,Q.useCallback)(e=>{let{onLayout:t}=E.current,{layout:r,panelDataArray:n}=x.current;if(e.constraints.collapsible){let a=n.map(e=>e.constraints),{collapsedSize:i=0,panelSize:o,pivotIndices:s}=aY(n,e,r);if(aS(null!=o,`Panel size not found for panel "${e.id}"`),!aT(o,i)){_.current.set(e.id,o);let l=aI({delta:aK(n,e)===n.length-1?o-i:i-o,initialLayout:r,panelConstraints:a,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});aF(r,l)||(b(l),x.current.layout=l,t&&t(l),aj(n,l,v.current))}}},[]),k=(0,Q.useCallback)((e,t)=>{let{onLayout:r}=E.current,{layout:n,panelDataArray:a}=x.current;if(e.constraints.collapsible){let i=a.map(e=>e.constraints),{collapsedSize:o=0,panelSize:s=0,minSize:l=0,pivotIndices:u}=aY(a,e,n),c=null!=t?t:l;if(aT(s,o)){let t=_.current.get(e.id),o=null!=t&&t>=c?t:c,l=aI({delta:aK(a,e)===a.length-1?s-o:o-s,initialLayout:n,panelConstraints:i,pivotIndices:u,prevLayout:n,trigger:"imperative-api"});aF(n,l)||(b(l),x.current.layout=l,r&&r(l),aj(a,l,v.current))}}},[]),T=(0,Q.useCallback)(e=>{let{layout:t,panelDataArray:r}=x.current,{panelSize:n}=aY(r,e,t);return aS(null!=n,`Panel size not found for panel "${e.id}"`),n},[]),A=(0,Q.useCallback)((e,t)=>{let{panelDataArray:r}=x.current,n=aK(r,e);return function({defaultSize:e,dragState:t,layout:r,panelData:n,panelIndex:a,precision:i=3}){let o=r[a];return{flexBasis:0,flexGrow:null==o?void 0!=e?e.toFixed(i):"1":1===n.length?"1":o.toFixed(i),flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:m,layout:g,panelData:r,panelIndex:n})},[m,g]),N=(0,Q.useCallback)(e=>{let{layout:t,panelDataArray:r}=x.current,{collapsedSize:n=0,collapsible:a,panelSize:i}=aY(r,e,t);return aS(null!=i,`Panel size not found for panel "${e.id}"`),!0===a&&aT(i,n)},[]),I=(0,Q.useCallback)(e=>{let{layout:t,panelDataArray:r}=x.current,{collapsedSize:n=0,collapsible:a,panelSize:i}=aY(r,e,t);return aS(null!=i,`Panel size not found for panel "${e.id}"`),!a||ak(i,n)>0},[]),C=(0,Q.useCallback)(e=>{let{panelDataArray:t}=x.current;t.push(e),t.sort((e,t)=>{let r=e.order,n=t.order;return null==r&&null==n?0:null==r?-1:null==n?1:r-n}),x.current.panelDataArrayChanged=!0,y()},[y]);nY(()=>{if(x.current.panelDataArrayChanged){x.current.panelDataArrayChanged=!1;let{autoSaveId:r,onLayout:n,storage:a}=E.current,{layout:i,panelDataArray:o}=x.current,s=null;if(r){var e,t;let n=null!=(t=(null!=(e=aB(r,a))?e:{})[az(o)])?t:null;n&&(_.current=new Map(Object.entries(n.expandToSizes)),s=n.layout)}null==s&&(s=function({panelDataArray:e}){let t=Array(e.length),r=e.map(e=>e.constraints),n=0,a=100;for(let i=0;i<e.length;i++){let e=r[i];aS(e,`Panel constraints not found for index ${i}`);let{defaultSize:o}=e;null!=o&&(n++,t[i]=o,a-=o)}for(let i=0;i<e.length;i++){let o=r[i];aS(o,`Panel constraints not found for index ${i}`);let{defaultSize:s}=o;if(null!=s)continue;let l=a/(e.length-n);n++,t[i]=l,a-=l}return t}({panelDataArray:o}));let l=aG({layout:s,panelConstraints:o.map(e=>e.constraints)});aD(i,l)||(b(l),x.current.layout=l,n&&n(l),aj(o,l,v.current))}}),nY(()=>{let e=x.current;return()=>{e.layout=[]}},[]);let R=(0,Q.useCallback)(e=>{let t=!1,r=f.current;return r&&"rtl"===window.getComputedStyle(r,null).getPropertyValue("direction")&&(t=!0),function(r){var n,a;r.preventDefault();let i=f.current;if(!i)return()=>null;let{direction:o,dragState:s,id:l,keyboardResizeBy:u,onLayout:c}=E.current,{layout:d,panelDataArray:p}=x.current,{initialLayout:m}=null!=s?s:{},h=aO(l,e,i),g=function(e,t,r,n,a,i){if(n9(e)){let t="horizontal"===r,n=0;n=e.shiftKey?100:null!=a?a:10;let i=0;switch(e.key){case"ArrowDown":i=t?0:n;break;case"ArrowLeft":i=t?-n:0;break;case"ArrowRight":i=t?n:0;break;case"ArrowUp":i=t?0:-n;break;case"End":i=100;break;case"Home":i=-100}return i}return null==n?0:function(e,t,r,n,a){let i="horizontal"===r,o=aP(t,a);aS(o,`No resize handle element found for id "${t}"`);let s=o.getAttribute(nW);aS(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=n,u=aM(r,e),c=aL(s,a);aS(c,`No group element found for id "${s}"`);let d=c.getBoundingClientRect();return(u-l)/(i?d.width:d.height)*100}(e,t,r,n,i)}(r,e,o,s,u,i),y="horizontal"===o;y&&t&&(g=-g);let _=aI({delta:g,initialLayout:null!=m?m:d,panelConstraints:p.map(e=>e.constraints),pivotIndices:h,prevLayout:d,trigger:n9(r)?"keyboard":"mouse-or-touch"}),S=!aF(d,_);(n8(r)||n7(r))&&w.current!=g&&((w.current=g,S||0===g)?am.set(e,0):y?(n=g<0?ao:as,am.set(e,n)):(a=g<0?al:au,am.set(e,a))),S&&(b(_),x.current.layout=_,c&&c(_),aj(p,_,v.current))}},[]),O=(0,Q.useCallback)((e,t)=>{let{onLayout:r}=E.current,{layout:n,panelDataArray:a}=x.current,i=a.map(e=>e.constraints),{panelSize:o,pivotIndices:s}=aY(a,e,n);aS(null!=o,`Panel size not found for panel "${e.id}"`);let l=aI({delta:aK(a,e)===a.length-1?o-t:t-o,initialLayout:n,panelConstraints:i,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});aF(n,l)||(b(l),x.current.layout=l,r&&r(l),aj(a,l,v.current))},[]),L=(0,Q.useCallback)((e,t)=>{let{layout:r,panelDataArray:n}=x.current,{collapsedSize:a=0,collapsible:i}=t,{collapsedSize:o=0,collapsible:s,maxSize:l=100,minSize:u=0}=e.constraints,{panelSize:c}=aY(n,e,r);null!=c&&(i&&s&&aT(c,a)?aT(a,o)||O(e,o):c<u?O(e,u):c>l&&O(e,l))},[O]),P=(0,Q.useCallback)((e,t)=>{let{direction:r}=E.current,{layout:n}=x.current;if(!f.current)return;let a=aP(e,f.current);aS(a,`Drag handle element not found for id "${e}"`);let i=aM(r,t);h({dragHandleId:e,dragHandleRect:a.getBoundingClientRect(),initialCursorPosition:i,initialLayout:n})},[]),D=(0,Q.useCallback)(()=>{h(null)},[]),M=(0,Q.useCallback)(e=>{let{panelDataArray:t}=x.current,r=aK(t,e);r>=0&&(t.splice(r,1),delete v.current[e.id],x.current.panelDataArrayChanged=!0,y())},[y]),j=(0,Q.useMemo)(()=>({collapsePanel:S,direction:n,dragState:m,expandPanel:k,getPanelSize:T,getPanelStyle:A,groupId:p,isPanelCollapsed:N,isPanelExpanded:I,reevaluatePanelConstraints:L,registerPanel:C,registerResizeHandle:R,resizePanel:O,startDragging:P,stopDragging:D,unregisterPanel:M,panelGroupElement:f.current}),[S,m,n,k,T,A,p,N,I,L,C,R,O,P,D,M]);return(0,Q.createElement)(nV.Provider,{value:j},(0,Q.createElement)(c,{...d,children:t,className:r,id:i,ref:f,style:{display:"flex",flexDirection:"horizontal"===n?"row":"column",height:"100%",overflow:"hidden",width:"100%",...u},"data-panel-group":"",[nq]:n,[nW]:p}))}let aZ=(0,Q.forwardRef)((e,t)=>(0,Q.createElement)(aW,{...e,forwardedRef:t}));function aK(e,t){return e.findIndex(e=>e===t||e.id===t.id)}function aY(e,t,r){let n=aK(e,t),a=n===e.length-1,i=r[n];return{...t.constraints,panelSize:i,pivotIndices:a?[n-1,n]:[n,n+1]}}function aX({children:e=null,className:t="",disabled:r=!1,hitAreaMargins:n,id:a,onBlur:i,onClick:o,onDragging:s,onFocus:l,onPointerDown:u,onPointerUp:c,style:d={},tabIndex:p=0,tagName:f="div",...m}){var h,g;let b=(0,Q.useRef)(null),y=(0,Q.useRef)({onClick:o,onDragging:s,onPointerDown:u,onPointerUp:c});(0,Q.useEffect)(()=>{y.current.onClick=o,y.current.onDragging=s,y.current.onPointerDown=u,y.current.onPointerUp=c});let v=(0,Q.useContext)(nV);if(null===v)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:_,groupId:w,registerResizeHandle:E,startDragging:x,stopDragging:S,panelGroupElement:k}=v,T=n0(a),[A,N]=(0,Q.useState)("inactive"),[I,C]=(0,Q.useState)(!1),[R,O]=(0,Q.useState)(null),L=(0,Q.useRef)({state:A});nY(()=>{L.current.state=A}),(0,Q.useEffect)(()=>{if(r)O(null);else{let e=E(T);O(()=>e)}},[r,T,E]);let P=null!=(h=null==n?void 0:n.coarse)?h:15,D=null!=(g=null==n?void 0:n.fine)?g:5;return(0,Q.useEffect)(()=>{if(r||null==R)return;let e=b.current;aS(e,"Element ref not attached");let t=!1;return function(e,t,r,n,a){var i;let{ownerDocument:o}=t,s={direction:r,element:t,hitAreaMargins:n,setResizeHandlerState:a},l=null!=(i=af.get(o))?i:0;return af.set(o,l+1),ah.add(s),aE(),function(){var t;am.delete(e),ah.delete(s);let r=null!=(t=af.get(o))?t:1;if(af.set(o,r-1),aE(),1===r&&af.delete(o),ad.includes(s)){let e=ad.indexOf(s);e>=0&&ad.splice(e,1),aw(),a("up",!0,null)}}}(T,e,_,{coarse:P,fine:D},(e,r,n)=>{if(!r)return void N("inactive");switch(e){case"down":{N("drag"),t=!1,aS(n,'Expected event to be defined for "down" action'),x(T,n);let{onDragging:e,onPointerDown:r}=y.current;null==e||e(!0),null==r||r();break}case"move":{let{state:e}=L.current;t=!0,"drag"!==e&&N("hover"),aS(n,'Expected event to be defined for "move" action'),R(n);break}case"up":{N("hover"),S();let{onClick:e,onDragging:r,onPointerUp:n}=y.current;null==r||r(!1),null==n||n(),t||null==e||e()}}})},[P,_,r,D,E,T,R,x,S]),!function({disabled:e,handleId:t,resizeHandler:r,panelGroupElement:n}){(0,Q.useEffect)(()=>{if(e||null==r||null==n)return;let a=aP(t,n);if(null==a)return;let i=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),r(e);break;case"F6":{e.preventDefault();let r=a.getAttribute(nW);aS(r,`No group element found for id "${r}"`);let i=aC(r,n),o=aR(r,t,n);aS(null!==o,`No resize element found for id "${t}"`);let s=e.shiftKey?o>0?o-1:i.length-1:o+1<i.length?o+1:0;i[s].focus()}}};return a.addEventListener("keydown",i),()=>{a.removeEventListener("keydown",i)}},[n,e,t,r])}({disabled:r,handleId:T,resizeHandler:R,panelGroupElement:k}),(0,Q.createElement)(f,{...m,children:e,className:t,id:a,onBlur:()=>{C(!1),null==i||i()},onFocus:()=>{C(!0),null==l||l()},ref:b,role:"separator",style:{touchAction:"none",userSelect:"none",...d},tabIndex:p,[nq]:_,[nW]:w,[nZ]:"","data-resize-handle-active":"drag"===A?"pointer":I?"keyboard":void 0,"data-panel-resize-handle-enabled":!r,[nK]:T,"data-resize-handle-state":A})}aW.displayName="PanelGroup",aZ.displayName="forwardRef(PanelGroup)",aX.displayName="PanelResizeHandle";let aJ=({className:e,...t})=>(0,J.jsx)(aZ,{className:rZ("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),aQ=({withHandle:e,className:t,...r})=>(0,J.jsx)(aX,{className:rZ("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...r,children:e&&(0,J.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:(0,J.jsx)(nG,{className:"h-2.5 w-2.5"})})}),a0=ro("brain-circuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]),a1=ro("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),a2=ro("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),a4=ro("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),a3=ro("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),a5=ro("pin-off",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]),a6=ro("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]),a9=ro("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),a8=ro("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);var a7=Q.createContext(void 0);function ie(e){let t=Q.useContext(a7);return e||t||"ltr"}function it(e,[t,r]){return Math.min(r,Math.max(t,e))}var ir="ScrollArea",[ia,ii]=ey(ir),[io,is]=ia(ir),il=Q.forwardRef((e,t)=>{let{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:i=600,...o}=e,[s,l]=Q.useState(null),[u,c]=Q.useState(null),[d,p]=Q.useState(null),[f,m]=Q.useState(null),[h,g]=Q.useState(null),[b,y]=Q.useState(0),[v,_]=Q.useState(0),[w,E]=Q.useState(!1),[x,S]=Q.useState(!1),k=eb(t,e=>l(e)),T=ie(a);return(0,J.jsx)(io,{scope:r,type:n,dir:T,scrollHideDelay:i,scrollArea:s,viewport:u,onViewportChange:c,content:d,onContentChange:p,scrollbarX:f,onScrollbarXChange:m,scrollbarXEnabled:w,onScrollbarXEnabledChange:E,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:x,onScrollbarYEnabledChange:S,onCornerWidthChange:y,onCornerHeightChange:_,children:(0,J.jsx)(eN.div,{dir:T,...o,ref:k,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":v+"px",...e.style}})})});il.displayName=ir;var iu="ScrollAreaViewport",ic=Q.forwardRef((e,t)=>{let{__scopeScrollArea:r,children:n,nonce:a,...i}=e,o=is(iu,r),s=eb(t,Q.useRef(null),o.onViewportChange);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),(0,J.jsx)(eN.div,{"data-radix-scroll-area-viewport":"",...i,ref:s,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,J.jsx)("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});ic.displayName=iu;var id="ScrollAreaScrollbar",ip=Q.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=is(id,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=a,s="horizontal"===e.orientation;return Q.useEffect(()=>(s?i(!0):o(!0),()=>{s?i(!1):o(!1)}),[s,i,o]),"hover"===a.type?(0,J.jsx)(im,{...n,ref:t,forceMount:r}):"scroll"===a.type?(0,J.jsx)(ih,{...n,ref:t,forceMount:r}):"auto"===a.type?(0,J.jsx)(ig,{...n,ref:t,forceMount:r}):"always"===a.type?(0,J.jsx)(ib,{...n,ref:t}):null});ip.displayName=id;var im=Q.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=is(id,e.__scopeScrollArea),[i,o]=Q.useState(!1);return Q.useEffect(()=>{let e=a.scrollArea,t=0;if(e){let r=()=>{window.clearTimeout(t),o(!0)},n=()=>{t=window.setTimeout(()=>o(!1),a.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[a.scrollArea,a.scrollHideDelay]),(0,J.jsx)(eV,{present:r||i,children:(0,J.jsx)(ig,{"data-state":i?"visible":"hidden",...n,ref:t})})}),ih=Q.forwardRef((e,t)=>{var r;let{forceMount:n,...a}=e,i=is(id,e.__scopeScrollArea),o="horizontal"===e.orientation,s=iD(()=>u("SCROLL_END"),100),[l,u]=(r={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},Q.useReducer((e,t)=>r[e][t]??e,"hidden"));return Q.useEffect(()=>{if("idle"===l){let e=window.setTimeout(()=>u("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,i.scrollHideDelay,u]),Q.useEffect(()=>{let e=i.viewport,t=o?"scrollLeft":"scrollTop";if(e){let r=e[t],n=()=>{let n=e[t];r!==n&&(u("SCROLL"),s()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[i.viewport,o,u,s]),(0,J.jsx)(eV,{present:n||"hidden"!==l,children:(0,J.jsx)(ib,{"data-state":"hidden"===l?"hidden":"visible",...a,ref:t,onPointerEnter:em(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:em(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),ig=Q.forwardRef((e,t)=>{let r=is(id,e.__scopeScrollArea),{forceMount:n,...a}=e,[i,o]=Q.useState(!1),s="horizontal"===e.orientation,l=iD(()=>{if(r.viewport){let e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;o(s?e:t)}},10);return iM(r.viewport,l),iM(r.content,l),(0,J.jsx)(eV,{present:n||i,children:(0,J.jsx)(ib,{"data-state":i?"visible":"hidden",...a,ref:t})})}),ib=Q.forwardRef((e,t)=>{let{orientation:r="vertical",...n}=e,a=is(id,e.__scopeScrollArea),i=Q.useRef(null),o=Q.useRef(0),[s,l]=Q.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=iC(s.viewport,s.content),c={...n,sizes:s,onSizesChange:l,hasThumb:!!(u>0&&u<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return function(e,t,r,n="ltr"){let a=iR(r),i=t||a/2,o=r.scrollbar.paddingStart+i,s=r.scrollbar.size-r.scrollbar.paddingEnd-(a-i),l=r.content-r.viewport;return iL([o,s],"ltr"===n?[0,l]:[-1*l,0])(e)}(e,o.current,s,t)}return"horizontal"===r?(0,J.jsx)(iy,{...c,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){let e=iO(a.viewport.scrollLeft,s,a.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollLeft=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollLeft=d(e,a.dir))}}):"vertical"===r?(0,J.jsx)(iv,{...c,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){let e=iO(a.viewport.scrollTop,s);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollTop=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollTop=d(e))}}):null}),iy=Q.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...a}=e,i=is(id,e.__scopeScrollArea),[o,s]=Q.useState(),l=Q.useRef(null),u=eb(t,l,i.onScrollbarXChange);return Q.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,J.jsx)(iE,{"data-orientation":"horizontal",...a,ref:u,sizes:r,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":iR(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(i.viewport){var n,a;let o=i.viewport.scrollLeft+t.deltaX;e.onWheelScroll(o),n=o,a=r,n>0&&n<a&&t.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:iI(o.paddingLeft),paddingEnd:iI(o.paddingRight)}})}})}),iv=Q.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...a}=e,i=is(id,e.__scopeScrollArea),[o,s]=Q.useState(),l=Q.useRef(null),u=eb(t,l,i.onScrollbarYChange);return Q.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,J.jsx)(iE,{"data-orientation":"vertical",...a,ref:u,sizes:r,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":iR(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(i.viewport){var n,a;let o=i.viewport.scrollTop+t.deltaY;e.onWheelScroll(o),n=o,a=r,n>0&&n<a&&t.preventDefault()}},onResize:()=>{l.current&&i.viewport&&o&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:iI(o.paddingTop),paddingEnd:iI(o.paddingBottom)}})}})}),[i_,iw]=ia(id),iE=Q.forwardRef((e,t)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:c,onResize:d,...p}=e,f=is(id,r),[m,h]=Q.useState(null),g=eb(t,e=>h(e)),b=Q.useRef(null),y=Q.useRef(""),v=f.viewport,_=n.content-n.viewport,w=eI(c),E=eI(l),x=iD(d,10);function S(e){b.current&&u({x:e.clientX-b.current.left,y:e.clientY-b.current.top})}return Q.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&w(e,_)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[v,m,_,w]),Q.useEffect(E,[n,E]),iM(m,x),iM(f.content,x),(0,J.jsx)(i_,{scope:r,scrollbar:m,hasThumb:a,onThumbChange:eI(i),onThumbPointerUp:eI(o),onThumbPositionChange:E,onThumbPointerDown:eI(s),children:(0,J.jsx)(eN.div,{...p,ref:g,style:{position:"absolute",...p.style},onPointerDown:em(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),b.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),S(e))}),onPointerMove:em(e.onPointerMove,S),onPointerUp:em(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,f.viewport&&(f.viewport.style.scrollBehavior=""),b.current=null})})})}),ix="ScrollAreaThumb",iS=Q.forwardRef((e,t)=>{let{forceMount:r,...n}=e,a=iw(ix,e.__scopeScrollArea);return(0,J.jsx)(eV,{present:r||a.hasThumb,children:(0,J.jsx)(ik,{ref:t,...n})})}),ik=Q.forwardRef((e,t)=>{let{__scopeScrollArea:r,style:n,...a}=e,i=is(ix,r),o=iw(ix,r),{onThumbPositionChange:s}=o,l=eb(t,e=>o.onThumbChange(e)),u=Q.useRef(void 0),c=iD(()=>{u.current&&(u.current(),u.current=void 0)},100);return Q.useEffect(()=>{let e=i.viewport;if(e){let t=()=>{c(),u.current||(u.current=iP(e,s),s())};return s(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,c,s]),(0,J.jsx)(eN.div,{"data-state":o.hasThumb?"visible":"hidden",...a,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:em(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;o.onThumbPointerDown({x:r,y:n})}),onPointerUp:em(e.onPointerUp,o.onThumbPointerUp)})});iS.displayName=ix;var iT="ScrollAreaCorner",iA=Q.forwardRef((e,t)=>{let r=is(iT,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?(0,J.jsx)(iN,{...e,ref:t}):null});iA.displayName=iT;var iN=Q.forwardRef((e,t)=>{let{__scopeScrollArea:r,...n}=e,a=is(iT,r),[i,o]=Q.useState(0),[s,l]=Q.useState(0),u=!!(i&&s);return iM(a.scrollbarX,()=>{let e=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(e),l(e)}),iM(a.scrollbarY,()=>{let e=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(e),o(e)}),u?(0,J.jsx)(eN.div,{...n,ref:t,style:{width:i,height:s,position:"absolute",right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:0,...e.style}}):null});function iI(e){return e?parseInt(e,10):0}function iC(e,t){let r=e/t;return isNaN(r)?0:r}function iR(e){let t=iC(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function iO(e,t,r="ltr"){let n=iR(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,o=t.content-t.viewport,s=it(e,"ltr"===r?[0,o]:[-1*o,0]);return iL([0,o],[0,i-n])(s)}function iL(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}var iP=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return!function a(){let i={left:e.scrollLeft,top:e.scrollTop},o=r.left!==i.left,s=r.top!==i.top;(o||s)&&t(),r=i,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function iD(e,t){let r=eI(e),n=Q.useRef(0);return Q.useEffect(()=>()=>window.clearTimeout(n.current),[]),Q.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function iM(e,t){let r=eI(t);ev(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}function ij({className:e,children:t,...r}){return(0,J.jsxs)(il,{"data-slot":"scroll-area",className:rZ("relative",e),...r,children:[(0,J.jsx)(ic,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] focus-visible:ring-ring/50",children:t}),(0,J.jsx)(iF,{}),(0,J.jsx)(iA,{})]})}function iF({className:e,orientation:t="vertical",...r}){return(0,J.jsx)(ip,{"data-slot":"scroll-area-scrollbar",orientation:t,className:rZ("flex touch-none select-none p-px transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:(0,J.jsx)(iS,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}function i$({className:e,...t}){return(0,J.jsx)("div",{className:rZ("animate-pulse rounded-md bg-muted",e),...t})}function iU(e){var t;let r,n=(t=e,(r=Q.forwardRef((e,t)=>{let{children:r,...n}=e;if(Q.isValidElement(r)){var a;let e,i,o=(a=r,(i=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(i=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...e)=>{let t=i(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...i}:"className"===n&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==Q.Fragment&&(s.ref=t?eg(t,o):o),Q.cloneElement(r,s)}return Q.Children.count(r)>1?Q.Children.only(null):null})).displayName=`${t}.SlotClone`,r),a=Q.forwardRef((e,t)=>{let{children:r,...a}=e,i=Q.Children.toArray(r),o=i.find(iB);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null);return(0,J.jsx)(n,{...a,ref:t,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,r):null})}return(0,J.jsx)(n,{...a,ref:t,children:r})});return a.displayName=`${e}.Slot`,a}var iz=Symbol("radix.slottable");function iB(e){return Q.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===iz}var iH=new WeakMap;function iG(e,t){var r,n;let a,i,o;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let s=(r=e,n=t,a=r.length,(o=(i=iV(n))>=0?i:a+i)<0||o>=a?-1:o);return -1===s?void 0:e[s]}function iV(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],iH.set(this,!0)}set(e,t){return iH.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,a=this.has(t),i=this.#e.length,o=iV(e),s=o>=0?o:i+o,l=s<0||s>=i?-1:s;if(l===this.size||a&&l===this.size-1||-1===l)return this.set(t,r),this;let u=this.size+ +!a;o<0&&s++;let c=[...this.#e],d=!1;for(let e=s;e<u;e++)if(s===e){let i=c[e];c[e]===t&&(i=c[e+1]),a&&this.delete(t),n=this.get(i),this.set(t,r)}else{d||c[e-1]!==t||(d=!0);let r=c[d?e:e-1],a=n;n=this.get(r),this.delete(r),this.set(r,a)}return this}with(t,r,n){let a=new e(this);return a.insert(t,r,n),a}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=iG(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=iG(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return iG(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],a=0;for(let e of this)Reflect.apply(t,r,[e,a,this])&&n.push(e),a++;return new e(n)}map(t,r){let n=[],a=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,a,this])]),a++;return new e(n)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let r of this)a=0===n&&1===e.length?r:Reflect.apply(t,this,[a,r,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let a=this.at(r);n=r===this.size-1&&1===e.length?a:Reflect.apply(t,this,[n,a,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,a=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(a=r-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}});let iq=["top","right","bottom","left"],iW=Math.min,iZ=Math.max,iK=Math.round,iY=Math.floor,iX=e=>({x:e,y:e}),iJ={left:"right",right:"left",bottom:"top",top:"bottom"};function iQ(e,t){return"function"==typeof e?e(t):e}function i0(e){return e.split("-")[0]}function i1(e){return e.split("-")[1]}function i2(e){return"x"===e?"y":"x"}function i4(e){return"y"===e?"height":"width"}function i3(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function i5(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let i6=["left","right"],i9=["right","left"],i8=["top","bottom"],i7=["bottom","top"];function oe(e){let t=i0(e);return iJ[t]+e.slice(t.length)}function ot(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function or(e){let{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function on(e,t,r){let n,{reference:a,floating:i}=e,o=i3(t),s=i2(i3(t)),l=i4(s),u=i0(t),c="y"===o,d=a.x+a.width/2-i.width/2,p=a.y+a.height/2-i.height/2,f=a[l]/2-i[l]/2;switch(u){case"top":n={x:d,y:a.y-i.height};break;case"bottom":n={x:d,y:a.y+a.height};break;case"right":n={x:a.x+a.width,y:p};break;case"left":n={x:a.x-i.width,y:p};break;default:n={x:a.x,y:a.y}}switch(i1(t)){case"start":n[s]-=f*(r&&c?-1:1);break;case"end":n[s]+=f*(r&&c?-1:1)}return n}async function oa(e,t){var r;void 0===t&&(t={});let{x:n,y:a,platform:i,rects:o,elements:s,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=iQ(t,e),m=ot(f),h=s[p?"floating"===d?"reference":"floating":d],g=or(await i.getClippingRect({element:null==(r=await (null==i.isElement?void 0:i.isElement(h)))||r?h:h.contextElement||await (null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),b="floating"===d?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,y=await (null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),v=await (null==i.isElement?void 0:i.isElement(y))&&await (null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},_=or(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:y,strategy:l}):b);return{top:(g.top-_.top+m.top)/v.y,bottom:(_.bottom-g.bottom+m.bottom)/v.y,left:(g.left-_.left+m.left)/v.x,right:(_.right-g.right+m.right)/v.x}}let oi=async(e,t,r)=>{let{placement:n="bottom",strategy:a="absolute",middleware:i=[],platform:o}=r,s=o.detectOverflow?o:{...o,detectOverflow:oa},l=await (null==o.isRTL?void 0:o.isRTL(t)),u=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:c,y:d}=on(u,n,l),p=n,f=0,m={};for(let r=0;r<i.length;r++){let h=i[r];if(!h)continue;let{name:g,fn:b}=h,{x:y,y:v,data:_,reset:w}=await b({x:c,y:d,initialPlacement:n,placement:p,strategy:a,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});c=null!=y?y:c,d=null!=v?v:d,m[g]={...m[g],..._},w&&f<50&&(f++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(u=!0===w.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):w.rects),{x:c,y:d}=on(u,p,l)),r=-1)}return{x:c,y:d,placement:p,strategy:a,middlewareData:m}};function oo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function os(e){return iq.some(t=>e[t]>=0)}let ol=new Set(["left","top"]);async function ou(e,t){let{placement:r,platform:n,elements:a}=e,i=await (null==n.isRTL?void 0:n.isRTL(a.floating)),o=i0(r),s=i1(r),l="y"===i3(r),u=ol.has(o)?-1:1,c=i&&l?-1:1,d=iQ(t,e),{mainAxis:p,crossAxis:f,alignmentAxis:m}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof m&&(f="end"===s?-1*m:m),l?{x:f*c,y:p*u}:{x:p*u,y:f*c}}function oc(){return"u">typeof window}function od(e){return om(e)?(e.nodeName||"").toLowerCase():"#document"}function op(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function of(e){var t;return null==(t=(om(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function om(e){return!!oc()&&(e instanceof Node||e instanceof op(e).Node)}function oh(e){return!!oc()&&(e instanceof Element||e instanceof op(e).Element)}function og(e){return!!oc()&&(e instanceof HTMLElement||e instanceof op(e).HTMLElement)}function ob(e){return!(!oc()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof op(e).ShadowRoot)}function oy(e){let{overflow:t,overflowX:r,overflowY:n,display:a}=oT(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==a&&"contents"!==a}function ov(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let o_=/transform|translate|scale|rotate|perspective|filter/,ow=/paint|layout|strict|content/,oE=e=>!!e&&"none"!==e;function ox(e){let t=oh(e)?oT(e):e;return oE(t.transform)||oE(t.translate)||oE(t.scale)||oE(t.rotate)||oE(t.perspective)||!oS()&&(oE(t.backdropFilter)||oE(t.filter))||o_.test(t.willChange||"")||ow.test(t.contain||"")}function oS(){return null==n&&(n="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),n}function ok(e){return/^(html|body|#document)$/.test(od(e))}function oT(e){return op(e).getComputedStyle(e)}function oA(e){return oh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function oN(e){if("html"===od(e))return e;let t=e.assignedSlot||e.parentNode||ob(e)&&e.host||of(e);return ob(t)?t.host:t}function oI(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let a=function e(t){let r=oN(t);return ok(r)?t.ownerDocument?t.ownerDocument.body:t.body:og(r)&&oy(r)?r:e(r)}(e),i=a===(null==(n=e.ownerDocument)?void 0:n.body),o=op(a);if(!i)return t.concat(a,oI(a,[],r));{let e=oC(o);return t.concat(o,o.visualViewport||[],oy(a)?a:[],e&&r?oI(e):[])}}function oC(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oR(e){let t=oT(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,a=og(e),i=a?e.offsetWidth:r,o=a?e.offsetHeight:n,s=iK(r)!==i||iK(n)!==o;return s&&(r=i,n=o),{width:r,height:n,$:s}}function oO(e){return oh(e)?e:e.contextElement}function oL(e){let t=oO(e);if(!og(t))return iX(1);let r=t.getBoundingClientRect(),{width:n,height:a,$:i}=oR(t),o=(i?iK(r.width):r.width)/n,s=(i?iK(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}let oP=iX(0);function oD(e){let t=op(e);return oS()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:oP}function oM(e,t,r,n){var a;void 0===t&&(t=!1),void 0===r&&(r=!1);let i=e.getBoundingClientRect(),o=oO(e),s=iX(1);t&&(n?oh(n)&&(s=oL(n)):s=oL(e));let l=(void 0===(a=r)&&(a=!1),n&&(!a||n===op(o))&&a)?oD(o):iX(0),u=(i.left+l.x)/s.x,c=(i.top+l.y)/s.y,d=i.width/s.x,p=i.height/s.y;if(o){let e=op(o),t=n&&oh(n)?op(n):n,r=e,a=oC(r);for(;a&&n&&t!==r;){let e=oL(a),t=a.getBoundingClientRect(),n=oT(a),i=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;u*=e.x,c*=e.y,d*=e.x,p*=e.y,u+=i,c+=o,a=oC(r=op(a))}}return or({width:d,height:p,x:u,y:c})}function oj(e,t){let r=oA(e).scrollLeft;return t?t.left+r:oM(of(e)).left+r}function oF(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-oj(e,r),y:r.top+t.scrollTop}}function o$(e,t,r){var n;let a;if("viewport"===t)a=function(e,t){let r=op(e),n=of(e),a=r.visualViewport,i=n.clientWidth,o=n.clientHeight,s=0,l=0;if(a){i=a.width,o=a.height;let e=oS();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,l=a.offsetTop)}let u=oj(n);if(u<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-a);o<=25&&(i-=o)}else u<=25&&(i+=u);return{width:i,height:o,x:s,y:l}}(e,r);else if("document"===t){let t,r,i,o,s,l,u;n=of(e),t=of(n),r=oA(n),i=n.ownerDocument.body,o=iZ(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=iZ(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),l=-r.scrollLeft+oj(n),u=-r.scrollTop,"rtl"===oT(i).direction&&(l+=iZ(t.clientWidth,i.clientWidth)-o),a={width:o,height:s,x:l,y:u}}else if(oh(t)){let e,n,i,o,s,l;n=(e=oM(t,!0,"fixed"===r)).top+t.clientTop,i=e.left+t.clientLeft,o=og(t)?oL(t):iX(1),s=t.clientWidth*o.x,l=t.clientHeight*o.y,a={width:s,height:l,x:i*o.x,y:n*o.y}}else{let r=oD(e);a={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return or(a)}function oU(e){return"static"===oT(e).position}function oz(e,t){if(!og(e)||"fixed"===oT(e).position)return null;if(t)return t(e);let r=e.offsetParent;return of(e)===r&&(r=r.ownerDocument.body),r}function oB(e,t){var r;let n=op(e);if(ov(e))return n;if(!og(e)){let t=oN(e);for(;t&&!ok(t);){if(oh(t)&&!oU(t))return t;t=oN(t)}return n}let a=oz(e,t);for(;a&&(r=a,/^(table|td|th)$/.test(od(r)))&&oU(a);)a=oz(a,t);return a&&ok(a)&&oU(a)&&!ox(a)?n:a||function(e){let t=oN(e);for(;og(t)&&!ok(t);){if(ox(t))return t;if(ov(t))break;t=oN(t)}return null}(e)||n}let oH=async function(e){let t=this.getOffsetParent||oB,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=og(t),a=of(t),i="fixed"===r,o=oM(e,!0,i,t),s={scrollLeft:0,scrollTop:0},l=iX(0);if(n||!n&&!i)if(("body"!==od(t)||oy(a))&&(s=oA(t)),n){let e=oM(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&(l.x=oj(a));i&&!n&&a&&(l.x=oj(a));let u=!a||n||i?iX(0):oF(a,s);return{x:o.left+s.scrollLeft-l.x-u.x,y:o.top+s.scrollTop-l.y-u.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},oG={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e,i="fixed"===a,o=of(n),s=!!t&&ov(t.floating);if(n===o||s&&i)return r;let l={scrollLeft:0,scrollTop:0},u=iX(1),c=iX(0),d=og(n);if((d||!d&&!i)&&(("body"!==od(n)||oy(o))&&(l=oA(n)),d)){let e=oM(n);u=oL(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let p=!o||d||i?iX(0):oF(o,l);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+c.x+p.x,y:r.y*u.y-l.scrollTop*u.y+c.y+p.y}},getDocumentElement:of,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e,i=[..."clippingAncestors"===r?ov(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=oI(e,[],!1).filter(e=>oh(e)&&"body"!==od(e)),a=null,i="fixed"===oT(e).position,o=i?oN(e):e;for(;oh(o)&&!ok(o);){let t=oT(o),r=ox(o);r||"fixed"!==t.position||(a=null),(i?r||a:!(!r&&"static"===t.position&&a&&("absolute"===a.position||"fixed"===a.position)||oy(o)&&!r&&function e(t,r){let n=oN(t);return!(n===r||!oh(n)||ok(n))&&("fixed"===oT(n).position||e(n,r))}(e,o)))?a=t:n=n.filter(e=>e!==o),o=oN(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=o$(t,i[0],a),s=o.top,l=o.right,u=o.bottom,c=o.left;for(let e=1;e<i.length;e++){let r=o$(t,i[e],a);s=iZ(r.top,s),l=iW(r.right,l),u=iW(r.bottom,u),c=iZ(r.left,c)}return{width:l-c,height:u-s,x:c,y:s}},getOffsetParent:oB,getElementRects:oH,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=oR(e);return{width:t,height:r}},getScale:oL,isElement:oh,isRTL:function(e){return"rtl"===oT(e).direction}};function oV(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let oq=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:a,rects:i,platform:o,elements:s,middlewareData:l}=t,{element:u,padding:c=0}=iQ(e,t)||{};if(null==u)return{};let d=ot(c),p={x:r,y:n},f=i2(i3(a)),m=i4(f),h=await o.getDimensions(u),g="y"===f,b=g?"clientHeight":"clientWidth",y=i.reference[m]+i.reference[f]-p[f]-i.floating[m],v=p[f]-i.reference[f],_=await (null==o.getOffsetParent?void 0:o.getOffsetParent(u)),w=_?_[b]:0;w&&await (null==o.isElement?void 0:o.isElement(_))||(w=s.floating[b]||i.floating[m]);let E=w/2-h[m]/2-1,x=iW(d[g?"top":"left"],E),S=iW(d[g?"bottom":"right"],E),k=w-h[m]-S,T=w/2-h[m]/2+(y/2-v/2),A=iZ(x,iW(T,k)),N=!l.arrow&&null!=i1(a)&&T!==A&&i.reference[m]/2-(T<x?x:S)-h[m]/2<0,I=N?T<x?T-x:T-k:0;return{[f]:p[f]+I,data:{[f]:A,centerOffset:T-A-I,...N&&{alignmentOffset:I}},reset:N}}});var oW="u">typeof document?Q.useLayoutEffect:function(){};function oZ(e,t){let r,n,a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!oZ(e[n],t[n]))return!1;return!0}if((r=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!=n--;){let r=a[n];if(("_owner"!==r||!e.$$typeof)&&!oZ(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function oK(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function oY(e,t){let r=oK(e);return Math.round(t*r)/r}function oX(e){let t=Q.useRef(e);return oW(()=>{t.current=e}),t}var oJ=Q.forwardRef((e,t)=>{let{children:r,width:n=10,height:a=5,...i}=e;return(0,J.jsx)(eN.svg,{...i,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,J.jsx)("polygon",{points:"0,0 30,0 15,10"})})});oJ.displayName="Arrow";var oQ="Popper",[o0,o1]=ey(oQ),[o2,o4]=o0(oQ),o3=e=>{let{__scopePopper:t,children:r}=e,[n,a]=Q.useState(null);return(0,J.jsx)(o2,{scope:t,anchor:n,onAnchorChange:a,children:r})};o3.displayName=oQ;var o5="PopperAnchor",o6=Q.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...a}=e,i=o4(o5,r),o=Q.useRef(null),s=eb(t,o),l=Q.useRef(null);return Q.useEffect(()=>{let e=l.current;l.current=n?.current||o.current,e!==l.current&&i.onAnchorChange(l.current)}),n?null:(0,J.jsx)(eN.div,{...a,ref:s})});o6.displayName=o5;var o9="PopperContent",[o8,o7]=o0(o9),se=Q.forwardRef((e,t)=>{var r,n,a,i,o,s,l,u,c,d,p,f,m,h,g,b,y,v,_,w,E;let x,S,k,T,A,N,{__scopePopper:I,side:C="bottom",sideOffset:R=0,align:O="center",alignOffset:L=0,arrowPadding:P=0,avoidCollisions:D=!0,collisionBoundary:M=[],collisionPadding:j=0,sticky:F="partial",hideWhenDetached:$=!1,updatePositionStrategy:U="optimized",onPlaced:z,...B}=e,H=o4(o9,I),[G,V]=Q.useState(null),q=eb(t,e=>V(e)),[W,Z]=Q.useState(null),K=function(e){let[t,r]=Q.useState(void 0);return ev(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,a;if(!Array.isArray(t)||!t.length)return;let i=t[0];if("borderBoxSize"in i){let e=i.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,a=t.blockSize}else n=e.offsetWidth,a=e.offsetHeight;r({width:n,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}(W),Y=K?.width??0,X=K?.height??0,ee="number"==typeof j?j:{top:0,right:0,bottom:0,left:0,...j},et=Array.isArray(M)?M:[M],er=et.length>0,en={padding:ee,boundary:et.filter(sa),altBoundary:er},{refs:ea,floatingStyles:ei,placement:eo,isPositioned:es,middlewareData:el}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:i,floating:o}={},transform:s=!0,whileElementsMounted:l,open:u}=e,[c,d]=Q.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=Q.useState(n);oZ(p,n)||f(n);let[m,h]=Q.useState(null),[g,b]=Q.useState(null),y=Q.useCallback(e=>{e!==E.current&&(E.current=e,h(e))},[]),v=Q.useCallback(e=>{e!==x.current&&(x.current=e,b(e))},[]),_=i||m,w=o||g,E=Q.useRef(null),x=Q.useRef(null),S=Q.useRef(c),k=null!=l,T=oX(l),A=oX(a),N=oX(u),I=Q.useCallback(()=>{var e,n;let a,i,o;if(!E.current||!x.current)return;let s={placement:t,strategy:r,middleware:p};A.current&&(s.platform=A.current),(e=E.current,n=x.current,a=new Map,o={...(i={platform:oG,...s}).platform,_c:a},oi(e,n,{...i,platform:o})).then(e=>{let t={...e,isPositioned:!1!==N.current};C.current&&!oZ(S.current,t)&&(S.current=t,ek.flushSync(()=>{d(t)}))})},[p,t,r,A,N]);oW(()=>{!1===u&&S.current.isPositioned&&(S.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[u]);let C=Q.useRef(!1);oW(()=>(C.current=!0,()=>{C.current=!1}),[]),oW(()=>{if(_&&(E.current=_),w&&(x.current=w),_&&w){if(T.current)return T.current(_,w,I);I()}},[_,w,I,T,k]);let R=Q.useMemo(()=>({reference:E,floating:x,setReference:y,setFloating:v}),[y,v]),O=Q.useMemo(()=>({reference:_,floating:w}),[_,w]),L=Q.useMemo(()=>{let e={position:r,left:0,top:0};if(!O.floating)return e;let t=oY(O.floating,c.x),n=oY(O.floating,c.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...oK(O.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,s,O.floating,c.x,c.y]);return Q.useMemo(()=>({...c,update:I,refs:R,elements:O,floatingStyles:L}),[c,I,R,O,L])}({strategy:"fixed",placement:C+("center"!==O?"-"+O:""),whileElementsMounted:(...e)=>(function(e,t,r,n){let a;void 0===n&&(n={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:u=!1}=n,c=oO(e),d=i||o?[...c?oI(c):[],...t?oI(t):[]]:[];d.forEach(e=>{i&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let p=c&&l?function(e,t){let r,n=null,a=of(e);function i(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function o(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();let u=e.getBoundingClientRect(),{left:c,top:d,width:p,height:f}=u;if(s||t(),!p||!f)return;let m={rootMargin:-iY(d)+"px "+-iY(a.clientWidth-(c+p))+"px "+-iY(a.clientHeight-(d+f))+"px "+-iY(c)+"px",threshold:iZ(0,iW(1,l))||1},h=!0;function g(t){let n=t[0].intersectionRatio;if(n!==l){if(!h)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||oV(u,e.getBoundingClientRect())||o(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),i}(c,r):null,f=-1,m=null;s&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&m&&t&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),c&&!u&&m.observe(c),t&&m.observe(t));let h=u?oM(e):null;return u&&function t(){let n=oM(e);h&&!oV(h,n)&&r(),h=n,a=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{i&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==p||p(),null==(e=m)||e.disconnect(),m=null,u&&cancelAnimationFrame(a)}})(...e,{animationFrame:"always"===U}),elements:{reference:H.anchor},middleware:[{name:(x={name:"offset",options:a=r={mainAxis:R+X,alignmentAxis:L},async fn(e){var t,r;let{x:n,y:i,placement:o,middlewareData:s}=e,l=await ou(e,a);return o===(null==(t=s.offset)?void 0:t.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:n+l.x,y:i+l.y,data:{...l,placement:o}}}}).name,fn:x.fn,options:[r,n]},D&&{name:(S={name:"shift",options:c=l={mainAxis:!0,crossAxis:!1,limiter:"partial"===F?{fn:(void 0===(s=i)&&(s={}),{options:s,fn(e){let{x:t,y:r,placement:n,rects:a,middlewareData:i}=e,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=iQ(s,e),c={x:t,y:r},d=i3(n),p=i2(d),f=c[p],m=c[d],h=iQ(o,e),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){let e="y"===p?"height":"width",t=a.reference[p]-a.floating[e]+g.mainAxis,r=a.reference[p]+a.reference[e]-g.mainAxis;f<t?f=t:f>r&&(f=r)}if(u){var b,y;let e="y"===p?"width":"height",t=ol.has(i0(n)),r=a.reference[d]-a.floating[e]+(t&&(null==(b=i.offset)?void 0:b[d])||0)+(t?0:g.crossAxis),o=a.reference[d]+a.reference[e]+(t?0:(null==(y=i.offset)?void 0:y[d])||0)-(t?g.crossAxis:0);m<r?m=r:m>o&&(m=o)}return{[p]:f,[d]:m}}}).fn,options:[i,o]}:void 0,...en},async fn(e){let{x:t,y:r,placement:n,platform:a}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=iQ(c,e),u={x:t,y:r},d=await a.detectOverflow(e,l),p=i3(i0(n)),f=i2(p),m=u[f],h=u[p];if(i){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=m+d[e],n=m-d[t];m=iZ(r,iW(m,n))}if(o){let e="y"===p?"top":"left",t="y"===p?"bottom":"right",r=h+d[e],n=h-d[t];h=iZ(r,iW(h,n))}let g=s.fn({...e,[f]:m,[p]:h});return{...g,data:{x:g.x-t,y:g.y-r,enabled:{[f]:i,[p]:o}}}}}).name,fn:S.fn,options:[l,u]},D&&{name:(k={name:"flip",options:f=d={...en},async fn(e){var t,r,n,a,i,o,s,l;let u,c,d,{placement:p,middlewareData:m,rects:h,initialPlacement:g,platform:b,elements:y}=e,{mainAxis:v=!0,crossAxis:_=!0,fallbackPlacements:w,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:S=!0,...k}=iQ(f,e);if(null!=(t=m.arrow)&&t.alignmentOffset)return{};let T=i0(p),A=i3(g),N=i0(g)===g,I=await (null==b.isRTL?void 0:b.isRTL(y.floating)),C=w||(N||!S?[oe(g)]:(u=oe(g),[i5(g),u,i5(u)])),R="none"!==x;!w&&R&&C.push(...(c=i1(g),d=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?i9:i6;return t?i6:i9;case"left":case"right":return t?i8:i7;default:return[]}}(i0(g),"start"===x,I),c&&(d=d.map(e=>e+"-"+c),S&&(d=d.concat(d.map(i5)))),d));let O=[g,...C],L=await b.detectOverflow(e,k),P=[],D=(null==(r=m.flip)?void 0:r.overflows)||[];if(v&&P.push(L[T]),_){let e,t,r,n,a=(o=p,s=h,void 0===(l=I)&&(l=!1),e=i1(o),r=i4(t=i2(i3(o))),n="x"===t?e===(l?"end":"start")?"right":"left":"start"===e?"bottom":"top",s.reference[r]>s.floating[r]&&(n=oe(n)),[n,oe(n)]);P.push(L[a[0]],L[a[1]])}if(D=[...D,{placement:p,overflows:P}],!P.every(e=>e<=0)){let e=((null==(n=m.flip)?void 0:n.index)||0)+1,t=O[e];if(t&&("alignment"!==_||A===i3(t)||D.every(e=>i3(e.placement)!==A||e.overflows[0]>0)))return{data:{index:e,overflows:D},reset:{placement:t}};let r=null==(a=D.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!r)switch(E){case"bestFit":{let e=null==(i=D.filter(e=>{if(R){let t=i3(e.placement);return t===A||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:i[0];e&&(r=e);break}case"initialPlacement":r=g}if(p!==r)return{reset:{placement:r}}}return{}}}).name,fn:k.fn,options:[d,p]},{name:(T={name:"size",options:g=m={...en,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:a,height:i}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${i}px`)}},async fn(e){var t,r;let n,a,{placement:i,rects:o,platform:s,elements:l}=e,{apply:u=()=>{},...c}=iQ(g,e),d=await s.detectOverflow(e,c),p=i0(i),f=i1(i),m="y"===i3(i),{width:h,height:b}=o.floating;"top"===p||"bottom"===p?(n=p,a=f===(await (null==s.isRTL?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(a=p,n="end"===f?"top":"bottom");let y=b-d.top-d.bottom,v=h-d.left-d.right,_=iW(b-d[n],y),w=iW(h-d[a],v),E=!e.middlewareData.shift,x=_,S=w;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(S=v),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(x=y),E&&!f){let e=iZ(d.left,0),t=iZ(d.right,0),r=iZ(d.top,0),n=iZ(d.bottom,0);m?S=h-2*(0!==e||0!==t?e+t:iZ(d.left,d.right)):x=b-2*(0!==r||0!==n?r+n:iZ(d.top,d.bottom))}await u({...e,availableWidth:S,availableHeight:x});let k=await s.getDimensions(l.floating);return h!==k.width||b!==k.height?{reset:{rects:!0}}:{}}}).name,fn:T.fn,options:[m,h]},W&&{name:(A={name:"arrow",options:v=b={element:W,padding:P},fn(e){let{element:t,padding:r}="function"==typeof v?v(e):v;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?oq({element:t.current,padding:r}).fn(e):{}:t?oq({element:t,padding:r}).fn(e):{}}}).name,fn:A.fn,options:[b,y]},si({arrowWidth:Y,arrowHeight:X}),$&&{name:(N={name:"hide",options:E=_={strategy:"referenceHidden",...en},async fn(e){let{rects:t,platform:r}=e,{strategy:n="referenceHidden",...a}=iQ(E,e);switch(n){case"referenceHidden":{let n=oo(await r.detectOverflow(e,{...a,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:n,referenceHidden:os(n)}}}case"escaped":{let n=oo(await r.detectOverflow(e,{...a,altBoundary:!0}),t.floating);return{data:{escapedOffsets:n,escaped:os(n)}}}default:return{}}}}).name,fn:N.fn,options:[_,w]}]}),[eu,ec]=so(eo),ed=eI(z);ev(()=>{es&&ed?.()},[es,ed]);let ep=el.arrow?.x,ef=el.arrow?.y,em=el.arrow?.centerOffset!==0,[eh,eg]=Q.useState();return ev(()=>{G&&eg(window.getComputedStyle(G).zIndex)},[G]),(0,J.jsx)("div",{ref:ea.setFloating,"data-radix-popper-content-wrapper":"",style:{...ei,transform:es?ei.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:eh,"--radix-popper-transform-origin":[el.transformOrigin?.x,el.transformOrigin?.y].join(" "),...el.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,J.jsx)(o8,{scope:I,placedSide:eu,onArrowChange:Z,arrowX:ep,arrowY:ef,shouldHideArrow:em,children:(0,J.jsx)(eN.div,{"data-side":eu,"data-align":ec,...B,ref:q,style:{...B.style,animation:es?void 0:"none"}})})})});se.displayName=o9;var st="PopperArrow",sr={top:"bottom",right:"left",bottom:"top",left:"right"},sn=Q.forwardRef(function(e,t){let{__scopePopper:r,...n}=e,a=o7(st,r),i=sr[a.placedSide];return(0,J.jsx)("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:(0,J.jsx)(oJ,{...n,ref:t,style:{...n.style,display:"block"}})})});function sa(e){return null!==e}sn.displayName=st;var si=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:a}=t,i=a.arrow?.centerOffset!==0,o=i?0:e.arrowWidth,s=i?0:e.arrowHeight,[l,u]=so(r),c={start:"0%",center:"50%",end:"100%"}[u],d=(a.arrow?.x??0)+o/2,p=(a.arrow?.y??0)+s/2,f="",m="";return"bottom"===l?(f=i?c:`${d}px`,m=`${-s}px`):"top"===l?(f=i?c:`${d}px`,m=`${n.floating.height+s}px`):"right"===l?(f=`${-s}px`,m=i?c:`${p}px`):"left"===l&&(f=`${n.floating.width+s}px`,m=i?c:`${p}px`),{data:{x:f,y:m}}}});function so(e){let[t,r="center"]=e.split("-");return[t,r]}var ss=Symbol("radix.slottable");function sl(e){return Q.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ss}var su=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});Q.forwardRef((e,t)=>(0,J.jsx)(eN.span,{...e,ref:t,style:{...su,...e.style}})).displayName="VisuallyHidden";var sc=[" ","Enter","ArrowUp","ArrowDown"],sd=[" ","Enter"],sp="Select",[sf,sm,sh]=function(e){let t=e+"CollectionProvider",[r,n]=ey(t),[a,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:r}=e,n=Q.default.useRef(null),i=Q.default.useRef(new Map).current;return(0,J.jsx)(a,{scope:t,itemMap:i,collectionRef:n,children:r})};o.displayName=t;let s=e+"CollectionSlot",l=iU(s),u=Q.default.forwardRef((e,t)=>{let{scope:r,children:n}=e,a=eb(t,i(s,r).collectionRef);return(0,J.jsx)(l,{ref:a,children:n})});u.displayName=s;let c=e+"CollectionItemSlot",d="data-radix-collection-item",p=iU(c),f=Q.default.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,o=Q.default.useRef(null),s=eb(t,o),l=i(c,r);return Q.default.useEffect(()=>(l.itemMap.set(o,{ref:o,...a}),()=>void l.itemMap.delete(o))),(0,J.jsx)(p,{...{[d]:""},ref:s,children:n})});return f.displayName=c,[{Provider:o,Slot:u,ItemSlot:f},function(t){let r=i(e+"CollectionConsumer",t);return Q.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},n]}(sp),[sg,sb]=ey(sp,[sh,o1]),sy=o1(),[sv,s_]=sg(sp),[sw,sE]=sg(sp),sx=e=>{let{__scopeSelect:t,children:r,open:n,defaultOpen:a,onOpenChange:i,value:o,defaultValue:s,onValueChange:l,dir:u,name:c,autoComplete:d,disabled:p,required:f,form:m}=e,h=sy(t),[g,b]=Q.useState(null),[y,v]=Q.useState(null),[_,w]=Q.useState(!1),E=ie(u),[x,S]=eS({prop:n,defaultProp:a??!1,onChange:i,caller:sp}),[k,T]=eS({prop:o,defaultProp:s,onChange:l,caller:sp}),A=Q.useRef(null),N=!g||m||!!g.closest("form"),[I,C]=Q.useState(new Set),R=Array.from(I).map(e=>e.props.value).join(";");return(0,J.jsx)(o3,{...h,children:(0,J.jsxs)(sv,{required:f,scope:t,trigger:g,onTriggerChange:b,valueNode:y,onValueNodeChange:v,valueNodeHasChildren:_,onValueNodeHasChildrenChange:w,contentId:eE(),value:k,onValueChange:T,open:x,onOpenChange:S,dir:E,triggerPointerDownPosRef:A,disabled:p,children:[(0,J.jsx)(sf.Provider,{scope:t,children:(0,J.jsx)(sw,{scope:e.__scopeSelect,onNativeOptionAdd:Q.useCallback(e=>{C(t=>new Set(t).add(e))},[]),onNativeOptionRemove:Q.useCallback(e=>{C(t=>{let r=new Set(t);return r.delete(e),r})},[]),children:r})}),N?(0,J.jsxs)(s7,{"aria-hidden":!0,required:f,tabIndex:-1,name:c,autoComplete:d,value:k,onChange:e=>T(e.target.value),disabled:p,form:m,children:[void 0===k?(0,J.jsx)("option",{value:""}):null,Array.from(I)]},R):null]})})};sx.displayName=sp;var sS="SelectTrigger",sk=Q.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:n=!1,...a}=e,i=sy(r),o=s_(sS,r),s=o.disabled||n,l=eb(t,o.onTriggerChange),u=sm(r),c=Q.useRef("touch"),[d,p,f]=lt(e=>{let t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===o.value),n=lr(t,e,r);void 0!==n&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),f()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,J.jsx)(o6,{asChild:!0,...i,children:(0,J.jsx)(eN.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":le(o.value)?"":void 0,...a,ref:l,onClick:em(a.onClick,e=>{e.currentTarget.focus(),"mouse"!==c.current&&m(e)}),onPointerDown:em(a.onPointerDown,e=>{c.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(m(e),e.preventDefault())}),onKeyDown:em(a.onKeyDown,e=>{let t=""!==d.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),(!t||" "!==e.key)&&sc.includes(e.key)&&(m(),e.preventDefault())})})})});sk.displayName=sS;var sT="SelectValue",sA=Q.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:a,children:i,placeholder:o="",...s}=e,l=s_(sT,r),{onValueNodeHasChildrenChange:u}=l,c=void 0!==i,d=eb(t,l.onValueNodeChange);return ev(()=>{u(c)},[u,c]),(0,J.jsx)(eN.span,{...s,ref:d,style:{pointerEvents:"none"},children:le(l.value)?(0,J.jsx)(J.Fragment,{children:o}):i})});sA.displayName=sT;var sN=Q.forwardRef((e,t)=>{let{__scopeSelect:r,children:n,...a}=e;return(0,J.jsx)(eN.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});sN.displayName="SelectIcon";var sI=e=>(0,J.jsx)(eG,{asChild:!0,...e});sI.displayName="SelectPortal";var sC="SelectContent",sR=Q.forwardRef((e,t)=>{let r=s_(sC,e.__scopeSelect),[n,a]=Q.useState();return(ev(()=>{a(new DocumentFragment)},[]),r.open)?(0,J.jsx)(sD,{...e,ref:t}):n?ek.createPortal((0,J.jsx)(sO,{scope:e.__scopeSelect,children:(0,J.jsx)(sf.Slot,{scope:e.__scopeSelect,children:(0,J.jsx)("div",{children:e.children})})}),n):null});sR.displayName=sC;var[sO,sL]=sg(sC),sP=((x=Q.forwardRef((e,t)=>{let{children:r,...n}=e;if(Q.isValidElement(r)){var a;let e,i,o=(a=r,(i=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(i=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...e)=>{let t=i(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...i}:"className"===n&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==Q.Fragment&&(s.ref=t?eg(t,o):o),Q.cloneElement(r,s)}return Q.Children.count(r)>1?Q.Children.only(null):null})).displayName="SelectContent.RemoveScroll.SlotClone",g=x,(b=Q.forwardRef((e,t)=>{let{children:r,...n}=e,a=Q.Children.toArray(r),i=a.find(sl);if(i){let e=i.props.children,r=a.map(t=>t!==i?t:Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null);return(0,J.jsx)(g,{...n,ref:t,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,r):null})}return(0,J.jsx)(g,{...n,ref:t,children:r})})).displayName="SelectContent.RemoveScroll.Slot",b),sD=Q.forwardRef((e,t)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:p,collisionPadding:f,sticky:m,hideWhenDetached:h,avoidCollisions:g,...b}=e,y=s_(sC,r),[v,_]=Q.useState(null),[w,E]=Q.useState(null),x=eb(t,e=>_(e)),[S,k]=Q.useState(null),[T,A]=Q.useState(null),N=sm(r),[I,C]=Q.useState(!1),R=Q.useRef(!1);Q.useEffect(()=>{if(v)return tR(v)},[v]),eZ();let O=Q.useCallback(e=>{let[t,...r]=N().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(let r of e)if(r===a||(r?.scrollIntoView({block:"nearest"}),r===t&&w&&(w.scrollTop=0),r===n&&w&&(w.scrollTop=w.scrollHeight),r?.focus(),document.activeElement!==a))return},[N,w]),L=Q.useCallback(()=>O([S,v]),[O,S,v]);Q.useEffect(()=>{I&&L()},[I,L]);let{onOpenChange:P,triggerPointerDownPosRef:D}=y;Q.useEffect(()=>{if(v){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(D.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():v.contains(r.target)||P(!1),document.removeEventListener("pointermove",t),D.current=null};return null!==D.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[v,P,D]),Q.useEffect(()=>{let e=()=>P(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[P]);let[M,j]=lt(e=>{let t=N().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=lr(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),F=Q.useCallback((e,t,r)=>{let n=!R.current&&!r;(void 0!==y.value&&y.value===t||n)&&(k(e),n&&(R.current=!0))},[y.value]),$=Q.useCallback(()=>v?.focus(),[v]),U=Q.useCallback((e,t,r)=>{let n=!R.current&&!r;(void 0!==y.value&&y.value===t||n)&&A(e)},[y.value]),z="popper"===n?sj:sM,B=z===sj?{side:s,sideOffset:l,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:p,collisionPadding:f,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,J.jsx)(sO,{scope:r,content:v,viewport:w,onViewportChange:E,itemRefCallback:F,selectedItem:S,onItemLeave:$,itemTextRefCallback:U,focusSelectedItem:L,selectedItemText:T,position:n,isPositioned:I,searchRef:M,children:(0,J.jsx)(tS,{as:sP,allowPinchZoom:!0,children:(0,J.jsx)(eF,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:em(a,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,J.jsx)(eO,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,J.jsx)(z,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:e=>e.preventDefault(),...b,...B,onPlaced:()=>C(!0),ref:x,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:em(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||j(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=N().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>O(t)),e.preventDefault()}})})})})})})});sD.displayName="SelectContentImpl";var sM=Q.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:n,...a}=e,i=s_(sC,r),o=sL(sC,r),[s,l]=Q.useState(null),[u,c]=Q.useState(null),d=eb(t,e=>c(e)),p=sm(r),f=Q.useRef(!1),m=Q.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:b,focusSelectedItem:y}=o,v=Q.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&u&&h&&g&&b){let e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),a=b.getBoundingClientRect();if("rtl"!==i.dir){let n=a.left-t.left,i=r.left-n,o=e.left-i,l=e.width+o,u=Math.max(l,t.width),c=it(i,[10,Math.max(10,window.innerWidth-10-u)]);s.style.minWidth=l+"px",s.style.left=c+"px"}else{let n=t.right-a.right,i=window.innerWidth-r.right-n,o=window.innerWidth-e.right-i,l=e.width+o,u=Math.max(l,t.width),c=it(i,[10,Math.max(10,window.innerWidth-10-u)]);s.style.minWidth=l+"px",s.style.right=c+"px"}let o=p(),l=window.innerHeight-20,c=h.scrollHeight,d=window.getComputedStyle(u),m=parseInt(d.borderTopWidth,10),y=parseInt(d.paddingTop,10),v=parseInt(d.borderBottomWidth,10),_=m+y+c+parseInt(d.paddingBottom,10)+v,w=Math.min(5*g.offsetHeight,_),E=window.getComputedStyle(h),x=parseInt(E.paddingTop,10),S=parseInt(E.paddingBottom,10),k=e.top+e.height/2-10,T=g.offsetHeight/2,A=m+y+(g.offsetTop+T);if(A<=k){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom="0px";let t=Math.max(l-k,T+(e?S:0)+(u.clientHeight-h.offsetTop-h.offsetHeight)+v);s.style.height=A+t+"px"}else{let e=o.length>0&&g===o[0].ref.current;s.style.top="0px";let t=Math.max(k,m+h.offsetTop+(e?x:0)+T);s.style.height=t+(_-A)+"px",h.scrollTop=A-k+h.offsetTop}s.style.margin="10px 0",s.style.minHeight=w+"px",s.style.maxHeight=l+"px",n?.(),requestAnimationFrame(()=>f.current=!0)}},[p,i.trigger,i.valueNode,s,u,h,g,b,i.dir,n]);ev(()=>v(),[v]);let[_,w]=Q.useState();ev(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]);let E=Q.useCallback(e=>{e&&!0===m.current&&(v(),y?.(),m.current=!1)},[v,y]);return(0,J.jsx)(sF,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:f,onScrollButtonChange:E,children:(0,J.jsx)("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:(0,J.jsx)(eN.div,{...a,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});sM.displayName="SelectItemAlignedPosition";var sj=Q.forwardRef((e,t)=>{let{__scopeSelect:r,align:n="start",collisionPadding:a=10,...i}=e,o=sy(r);return(0,J.jsx)(se,{...o,...i,ref:t,align:n,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});sj.displayName="SelectPopperPosition";var[sF,s$]=sg(sC,{}),sU="SelectViewport",sz=Q.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:n,...a}=e,i=sL(sU,r),o=s$(sU,r),s=eb(t,i.onViewportChange),l=Q.useRef(0);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),(0,J.jsx)(sf.Slot,{scope:r,children:(0,J.jsx)(eN.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:em(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=o;if(n?.current&&r){let e=Math.abs(l.current-t.scrollTop);if(e>0){let n=window.innerHeight-20,a=Math.max(parseFloat(r.style.minHeight),parseFloat(r.style.height));if(a<n){let i=a+e,o=Math.min(n,i),s=i-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=s>0?s:0,r.style.justifyContent="flex-end")}}}l.current=t.scrollTop})})})]})});sz.displayName=sU;var sB="SelectGroup",[sH,sG]=sg(sB),sV=Q.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=eE();return(0,J.jsx)(sH,{scope:r,id:a,children:(0,J.jsx)(eN.div,{role:"group","aria-labelledby":a,...n,ref:t})})});sV.displayName=sB;var sq="SelectLabel",sW=Q.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=sG(sq,r);return(0,J.jsx)(eN.div,{id:a.id,...n,ref:t})});sW.displayName=sq;var sZ="SelectItem",[sK,sY]=sg(sZ),sX=Q.forwardRef((e,t)=>{let{__scopeSelect:r,value:n,disabled:a=!1,textValue:i,...o}=e,s=s_(sZ,r),l=sL(sZ,r),u=s.value===n,[c,d]=Q.useState(i??""),[p,f]=Q.useState(!1),m=eb(t,e=>l.itemRefCallback?.(e,n,a)),h=eE(),g=Q.useRef("touch"),b=()=>{a||(s.onValueChange(n),s.onOpenChange(!1))};if(""===n)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,J.jsx)(sK,{scope:r,value:n,disabled:a,textId:h,isSelected:u,onItemTextChange:Q.useCallback(e=>{d(t=>t||(e?.textContent??"").trim())},[]),children:(0,J.jsx)(sf.ItemSlot,{scope:r,value:n,disabled:a,textValue:c,children:(0,J.jsx)(eN.div,{role:"option","aria-labelledby":h,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:m,onFocus:em(o.onFocus,()=>f(!0)),onBlur:em(o.onBlur,()=>f(!1)),onClick:em(o.onClick,()=>{"mouse"!==g.current&&b()}),onPointerUp:em(o.onPointerUp,()=>{"mouse"===g.current&&b()}),onPointerDown:em(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:em(o.onPointerMove,e=>{g.current=e.pointerType,a?l.onItemLeave?.():"mouse"===g.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:em(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:em(o.onKeyDown,e=>{(l.searchRef?.current===""||" "!==e.key)&&(sd.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})});sX.displayName=sZ;var sJ="SelectItemText",sQ=Q.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:a,...i}=e,o=s_(sJ,r),s=sL(sJ,r),l=sY(sJ,r),u=sE(sJ,r),[c,d]=Q.useState(null),p=eb(t,e=>d(e),l.onItemTextChange,e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),f=c?.textContent,m=Q.useMemo(()=>(0,J.jsx)("option",{value:l.value,disabled:l.disabled,children:f},l.value),[l.disabled,l.value,f]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=u;return ev(()=>(h(m),()=>g(m)),[h,g,m]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(eN.span,{id:l.textId,...i,ref:p}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ek.createPortal(i.children,o.valueNode):null]})});sQ.displayName=sJ;var s0="SelectItemIndicator",s1=Q.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return sY(s0,r).isSelected?(0,J.jsx)(eN.span,{"aria-hidden":!0,...n,ref:t}):null});s1.displayName=s0;var s2="SelectScrollUpButton",s4=Q.forwardRef((e,t)=>{let r=sL(s2,e.__scopeSelect),n=s$(s2,e.__scopeSelect),[a,i]=Q.useState(!1),o=eb(t,n.onScrollButtonChange);return ev(()=>{if(r.viewport&&r.isPositioned){let e=function(){i(t.scrollTop>0)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),a?(0,J.jsx)(s6,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});s4.displayName=s2;var s3="SelectScrollDownButton",s5=Q.forwardRef((e,t)=>{let r=sL(s3,e.__scopeSelect),n=s$(s3,e.__scopeSelect),[a,i]=Q.useState(!1),o=eb(t,n.onScrollButtonChange);return ev(()=>{if(r.viewport&&r.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;i(Math.ceil(t.scrollTop)<e)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),a?(0,J.jsx)(s6,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});s5.displayName=s3;var s6=Q.forwardRef((e,t)=>{let{__scopeSelect:r,onAutoScroll:n,...a}=e,i=sL("SelectScrollButton",r),o=Q.useRef(null),s=sm(r),l=Q.useCallback(()=>{null!==o.current&&(window.clearInterval(o.current),o.current=null)},[]);return Q.useEffect(()=>()=>l(),[l]),ev(()=>{let e=s().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,J.jsx)(eN.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:em(a.onPointerDown,()=>{null===o.current&&(o.current=window.setInterval(n,50))}),onPointerMove:em(a.onPointerMove,()=>{i.onItemLeave?.(),null===o.current&&(o.current=window.setInterval(n,50))}),onPointerLeave:em(a.onPointerLeave,()=>{l()})})}),s9=Q.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return(0,J.jsx)(eN.div,{"aria-hidden":!0,...n,ref:t})});s9.displayName="SelectSeparator";var s8="SelectArrow";Q.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=sy(r),i=s_(s8,r),o=sL(s8,r);return i.open&&"popper"===o.position?(0,J.jsx)(sn,{...a,...n,ref:t}):null}).displayName=s8;var s7=Q.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{let a,i=Q.useRef(null),o=eb(n,i),s=(a=Q.useRef({value:t,previous:t}),Q.useMemo(()=>(a.current.value!==t&&(a.current.previous=a.current.value,a.current.value=t),a.current.previous),[t]));return Q.useEffect(()=>{let e=i.current;if(!e)return;let r=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(s!==t&&r){let n=new Event("change",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,J.jsx)(eN.select,{...r,style:{...su,...r.style},ref:o,defaultValue:t})});function le(e){return""===e||void 0===e}function lt(e){let t=eI(e),r=Q.useRef(""),n=Q.useRef(0),a=Q.useCallback(e=>{let a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),i=Q.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return Q.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,i]}function lr(e,t,r){var n,a;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=r?e.indexOf(r):-1,s=(n=e,a=Math.max(o,0),n.map((e,t)=>n[(a+t)%n.length]));1===i.length&&(s=s.filter(e=>e!==r));let l=s.find(e=>e.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==r?l:void 0}s7.displayName="SelectBubbleInput";let ln=ro("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),la=ro("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),li=ro("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),lo=Q.forwardRef(({className:e,children:t,...r},n)=>(0,J.jsxs)(sk,{ref:n,className:rZ("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1",e),...r,children:[t,(0,J.jsx)(sN,{asChild:!0,children:(0,J.jsx)(la,{className:"h-4 w-4 opacity-50"})})]}));lo.displayName=sk.displayName;let ls=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)(s4,{ref:r,className:rZ("flex cursor-default items-center justify-center py-1",e),...t,children:(0,J.jsx)(li,{className:"h-4 w-4"})}));ls.displayName=s4.displayName;let ll=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)(s5,{ref:r,className:rZ("flex cursor-default items-center justify-center py-1",e),...t,children:(0,J.jsx)(la,{className:"h-4 w-4"})}));ll.displayName=s5.displayName;let lu=Q.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>(0,J.jsx)(sI,{children:(0,J.jsxs)(sR,{ref:a,className:rZ("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[(0,J.jsx)(ls,{}),(0,J.jsx)(sz,{className:rZ("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,J.jsx)(ll,{})]})}));lu.displayName=sR.displayName;let lc=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)(sW,{ref:r,className:rZ("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));lc.displayName=sW.displayName;let ld=Q.forwardRef(({className:e,children:t,...r},n)=>(0,J.jsxs)(sX,{ref:n,className:rZ("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[(0,J.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,J.jsx)(s1,{children:(0,J.jsx)(ln,{className:"h-4 w-4"})})}),(0,J.jsx)(sQ,{children:t})]}));ld.displayName=sX.displayName;let lp=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)(s9,{ref:r,className:rZ("-mx-1 my-1 h-px bg-muted",e),...t}));lp.displayName=s9.displayName;var lf=e.i(2239);e.s(["ERROR_REVALIDATE_EVENT",0,3,"FOCUS_EVENT",0,0,"MUTATE_EVENT",0,2,"RECONNECT_EVENT",0,1],11671);var lm=Object.prototype.hasOwnProperty;let lh=new WeakMap,lg=()=>{},lb=lg(),ly=Object,lv=e=>e===lb,l_=(e,t)=>({...e,...t}),lw={},lE={},lx="undefined",lS=typeof window!=lx,lk=typeof document!=lx,lT=lS&&"Deno"in window,lA=(e,t)=>{let r=lh.get(e);return[()=>!lv(t)&&e.get(t)||lw,n=>{if(!lv(t)){let a=e.get(t);t in lE||(lE[t]=a),r[5](t,l_(a,n),a||lw)}},r[6],()=>!lv(t)&&t in lE?lE[t]:!lv(t)&&e.get(t)||lw]},lN=!0,[lI,lC]=lS&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[lg,lg],lR={initFocus:e=>(lk&&document.addEventListener("visibilitychange",e),lI("focus",e),()=>{lk&&document.removeEventListener("visibilitychange",e),lC("focus",e)}),initReconnect:e=>{let t=()=>{lN=!0,e()},r=()=>{lN=!1};return lI("online",t),lI("offline",r),()=>{lC("online",t),lC("offline",r)}}},lO=!Q.default.useId,lL=!lS||lT,lP=lL?Q.useEffect:Q.useLayoutEffect,lD="u">typeof navigator&&navigator.connection,lM=!lL&&lD&&(["slow-2g","2g"].includes(lD.effectiveType)||lD.saveData),lj=new WeakMap,lF=(e,t)=>e===`[object ${t}]`,l$=0,lU=e=>{let t,r,n=typeof e,a=ly.prototype.toString.call(e),i=lF(a,"Date"),o=lF(a,"RegExp"),s=lF(a,"Object");if(ly(e)!==e||i||o)t=i?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=lj.get(e))return t;if(t=++l$+"~",lj.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=lU(e[r])+",";lj.set(e,t)}if(s){t="#";let n=ly.keys(e).sort();for(;!lv(r=n.pop());)lv(e[r])||(t+=r+":"+lU(e[r])+",");lj.set(e,t)}}return t},lz=e=>{if("function"==typeof e)try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?lU(e):"",t]},lB=0,lH=()=>++lB;async function lG(...e){let[t,r,n,a]=e,i=l_({populateCache:!0,throwOnError:!0},"boolean"==typeof a?{revalidate:a}:a||{}),o=i.populateCache,s=i.rollbackOnError,l=i.optimisticData,u=i.throwOnError;if("function"==typeof r){let e=[];for(let n of t.keys())!/^\$(inf|sub)\$/.test(n)&&r(t.get(n)._k)&&e.push(n);return Promise.all(e.map(c))}return c(r);async function c(r){let a,[c]=lz(r);if(!c)return;let[d,p]=lA(t,c),[f,m,h,g]=lh.get(t),b=()=>{let e=f[c];return("function"==typeof i.revalidate?i.revalidate(d().data,r):!1!==i.revalidate)&&(delete h[c],delete g[c],e&&e[0])?e[0](2).then(()=>d().data):d().data};if(e.length<3)return b();let y=n,v=!1,_=lH();m[c]=[_,0];let w=!lv(l),E=d(),x=E.data,S=E._c,k=lv(S)?x:S;if(w&&p({data:l="function"==typeof l?l(k,x):l,_c:k}),"function"==typeof y)try{y=y(k)}catch(e){a=e,v=!0}if(y&&"function"==typeof y.then){let e;if(y=await y.catch(e=>{a=e,v=!0}),_!==m[c][0]){if(v)throw a;return y}v&&w&&(e=a,"function"==typeof s?s(e):!1!==s)&&(o=!0,p({data:k,_c:lb}))}if(o&&!v&&("function"==typeof o?p({data:o(y,k),error:lb,_c:lb}):p({data:y,error:lb,_c:lb})),m[c][1]=lH(),Promise.resolve(b()).then(()=>{p({_c:lb})}),v){if(u)throw a;return}return y}}let lV=(e,t)=>{for(let r in e)e[r][0]&&e[r][0](t)},lq=(e,t)=>{if(!lh.has(e)){let r=l_(lR,t),n=Object.create(null),a=lG.bind(lb,e),i=lg,o=Object.create(null),s=(e,t)=>{let r=o[e]||[];return o[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},l=(t,r,n)=>{e.set(t,r);let a=o[t];if(a)for(let e of a)e(r,n)},u=()=>{if(!lh.has(e)&&(lh.set(e,[n,Object.create(null),Object.create(null),Object.create(null),a,l,s]),!lL)){let t=r.initFocus(setTimeout.bind(lb,lV.bind(lb,n,0))),a=r.initReconnect(setTimeout.bind(lb,lV.bind(lb,n,1)));i=()=>{t&&t(),a&&a(),lh.delete(e)}}};return u(),[e,a,u,i]}return[e,lh.get(e)[4]]},[lW,lZ]=lq(new Map),lK=l_({onLoadingSlow:lg,onSuccess:lg,onError:lg,onErrorRetry:(e,t,r,n,a)=>{let i=r.errorRetryCount,o=a.retryCount,s=~~((Math.random()+.5)*(1<<(o<8?o:8)))*r.errorRetryInterval;(lv(i)||!(o>i))&&setTimeout(n,s,a)},onDiscarded:lg,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:lM?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:lM?5e3:3e3,compare:function e(t,r){var n,a;if(t===r)return!0;if(t&&r&&(n=t.constructor)===r.constructor){if(n===Date)return t.getTime()===r.getTime();if(n===RegExp)return t.toString()===r.toString();if(n===Array){if((a=t.length)===r.length)for(;a--&&e(t[a],r[a]););return -1===a}if(!n||"object"==typeof t){for(n in a=0,t)if(lm.call(t,n)&&++a&&!lm.call(r,n)||!(n in r)||!e(t[n],r[n]))return!1;return Object.keys(r).length===a}}return t!=t&&r!=r},isPaused:()=>!1,cache:lW,mutate:lZ,fallback:{}},{isOnline:()=>lN,isVisible:()=>{let e=lk&&document.visibilityState;return lv(e)||"hidden"!==e}}),lY=(e,t)=>{let r=l_(e,t);if(t){let{use:n,fallback:a}=e,{use:i,fallback:o}=t;n&&i&&(r.use=n.concat(i)),a&&o&&(r.fallback=l_(a,o))}return r},lX=(0,Q.createContext)({});var lJ=e.i(11671);let lQ="$inf$",l0=lS&&window.__SWR_DEVTOOLS_USE__,l1=l0?window.__SWR_DEVTOOLS_USE__:[],l2=e=>"function"==typeof e[1]?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],l4=()=>{let e=(0,Q.useContext)(lX);return(0,Q.useMemo)(()=>l_(lK,e),[e])},l3=l1.concat(e=>(t,r,n)=>{let a=r&&((...e)=>{let[n]=lz(t),[,,,a]=lh.get(lW);if(n.startsWith(lQ))return r(...e);let i=a[n];return lv(i)?r(...e):(delete a[n],i)});return e(t,a,n)}),l5=(e,t)=>(...r)=>{let[n,a,i]=l2(r),o=(i.use||[]).concat(t);return e(n,a,{...i,use:o})};l0&&(window.__SWR_DEVTOOLS_REACT__=Q.default);let l6=()=>{},l9=l6(),l8=(new WeakMap,Q.default.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}})),l7={dedupe:!0},ue=Promise.resolve(lb),ut=()=>lg;ly.defineProperty(e=>{let{value:t}=e,r=(0,Q.useContext)(lX),n="function"==typeof t,a=(0,Q.useMemo)(()=>n?t(r):t,[n,r,t]),i=(0,Q.useMemo)(()=>n?a:lY(r,a),[n,r,a]),o=a&&a.provider,s=(0,Q.useRef)(lb);o&&!s.current&&(s.current=lq(o(i.cache||lW),a));let l=s.current;return l&&(i.cache=l[0],i.mutate=l[1]),lP(()=>{if(l)return l[2]&&l[2](),l[3]},[]),(0,Q.createElement)(lX.Provider,l_(e,{value:i}))},"defaultValue",{value:lK});let ur=(y=(e,t,r)=>{let{cache:n,compare:a,suspense:i,fallbackData:o,revalidateOnMount:s,revalidateIfStale:l,refreshInterval:u,refreshWhenHidden:c,refreshWhenOffline:d,keepPreviousData:p,strictServerPrefetchWarning:f}=r,[m,h,g,b]=lh.get(n),[y,v]=lz(e),_=(0,Q.useRef)(!1),w=(0,Q.useRef)(!1),E=(0,Q.useRef)(y),x=(0,Q.useRef)(t),S=(0,Q.useRef)(r),k=()=>S.current.isVisible()&&S.current.isOnline(),[T,A,N,I]=lA(n,y),C=(0,Q.useRef)({}).current,R=lv(o)?lv(r.fallback)?lb:r.fallback[y]:o,O=(e,t)=>{for(let r in C)if("data"===r){if(!a(e[r],t[r])&&(!lv(e[r])||!a(z,t[r])))return!1}else if(t[r]!==e[r])return!1;return!0},L=!_.current,P=(0,Q.useMemo)(()=>{let e=T(),r=I(),n=e=>{let r=l_(e);return(delete r._k,(()=>{if(!y||!t||S.current.isPaused())return!1;if(L&&!lv(s))return s;let e=lv(R)?r.data:R;return lv(e)||l})())?{isValidating:!0,isLoading:!0,...r}:r},a=n(e),i=e===r?a:n(r),o=a;return[()=>{let e=n(T());return O(e,o)?(o.data=e.data,o.isLoading=e.isLoading,o.isValidating=e.isValidating,o.error=e.error,o):(o=e,e)},()=>i]},[n,y]),D=(0,lf.useSyncExternalStore)((0,Q.useCallback)(e=>N(y,(t,r)=>{O(r,t)||e()}),[n,y]),P[0],P[1]),M=m[y]&&m[y].length>0,j=D.data,F=lv(j)?R&&"function"==typeof R.then?l8(R):R:j,$=D.error,U=(0,Q.useRef)(F),z=p?lv(j)?lv(U.current)?F:U.current:j:F,B=y&&lv(F),H=(0,Q.useRef)(null);lL||(0,lf.useSyncExternalStore)(ut,()=>(H.current=!1,H),()=>(H.current=!0,H));let G=H.current;f&&G&&!i&&B&&console.warn(`Missing pre-initiated data for serialized key "${y}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);let V=!(!y||!t||S.current.isPaused())&&(!M||!!lv($))&&(L&&!lv(s)?s:i?!lv(F)&&l:lv(F)||l),q=L&&V,W=lv(D.isValidating)?q:D.isValidating,Z=lv(D.isLoading)?q:D.isLoading,K=(0,Q.useCallback)(async e=>{let t,n,i=x.current;if(!y||!i||w.current||S.current.isPaused())return!1;let o=!0,s=e||{},l=!g[y]||!s.dedupe,u=()=>lO?!w.current&&y===E.current&&_.current:y===E.current,c={isValidating:!1,isLoading:!1},d=()=>{A(c)},p=()=>{let e=g[y];e&&e[1]===n&&delete g[y]},f={isValidating:!0};lv(T().data)&&(f.isLoading=!0);try{if(l&&(A(f),r.loadingTimeout&&lv(T().data)&&setTimeout(()=>{o&&u()&&S.current.onLoadingSlow(y,r)},r.loadingTimeout),g[y]=[i(v),lH()]),[t,n]=g[y],t=await t,l&&setTimeout(p,r.dedupingInterval),!g[y]||g[y][1]!==n)return l&&u()&&S.current.onDiscarded(y),!1;c.error=lb;let e=h[y];if(!lv(e)&&(n<=e[0]||n<=e[1]||0===e[1]))return d(),l&&u()&&S.current.onDiscarded(y),!1;let s=T().data;c.data=a(s,t)?s:t,l&&u()&&S.current.onSuccess(t,y,r)}catch(r){p();let e=S.current,{shouldRetryOnError:t}=e;!e.isPaused()&&(c.error=r,l&&u())&&(e.onError(r,y,e),(!0===t||"function"==typeof t&&t(r))&&(!S.current.revalidateOnFocus||!S.current.revalidateOnReconnect||k())&&e.onErrorRetry(r,y,e,e=>{let t=m[y];t&&t[0]&&t[0](lJ.ERROR_REVALIDATE_EVENT,e)},{retryCount:(s.retryCount||0)+1,dedupe:!0}))}return o=!1,d(),!0},[y,n]),Y=(0,Q.useCallback)((...e)=>lG(n,E.current,...e),[]);if(lP(()=>{x.current=t,S.current=r,lv(j)||(U.current=j)}),lP(()=>{var e;let t;if(!y)return;let r=K.bind(lb,l7),n=0;S.current.revalidateOnFocus&&(n=Date.now()+S.current.focusThrottleInterval);let a=(e=(e,t={})=>{if(e==lJ.FOCUS_EVENT){let e=Date.now();S.current.revalidateOnFocus&&e>n&&k()&&(n=e+S.current.focusThrottleInterval,r())}else if(e==lJ.RECONNECT_EVENT)S.current.revalidateOnReconnect&&k()&&r();else if(e==lJ.MUTATE_EVENT)return K();else if(e==lJ.ERROR_REVALIDATE_EVENT)return K(t)},(t=m[y]||(m[y]=[])).push(e),()=>{let r=t.indexOf(e);r>=0&&(t[r]=t[t.length-1],t.pop())});if(w.current=!1,E.current=y,_.current=!0,A({_k:v}),V&&!g[y])if(lv(F)||lL)r();else lS&&typeof window.requestAnimationFrame!=lx?window.requestAnimationFrame(r):setTimeout(r,1);return()=>{w.current=!0,a()}},[y]),lP(()=>{let e;function t(){let t="function"==typeof u?u(T().data):u;t&&-1!==e&&(e=setTimeout(r,t))}function r(){!T().error&&(c||S.current.isVisible())&&(d||S.current.isOnline())?K(l7).then(t):t()}return t(),()=>{e&&(clearTimeout(e),e=-1)}},[u,c,d,y]),(0,Q.useDebugValue)(z),i){if(!lO&&lL&&B)throw Error("Fallback data is required when using Suspense in SSR.");B&&(x.current=t,S.current=r,w.current=!1);let e=b[y];if(l8(!lv(e)&&B?Y(e):ue),!lv($)&&B)throw $;let n=B?K(l7):ue;!lv(z)&&B&&(n.status="fulfilled",n.value=!0),l8(n)}return{mutate:Y,get data(){return C.data=!0,z},get error(){return C.error=!0,$},get isValidating(){return C.isValidating=!0,W},get isLoading(){return C.isLoading=!0,Z}}},function(...e){let t=l4(),[r,n,a]=l2(e),i=lY(t,a),o=y,{use:s}=i,l=(s||[]).concat(l3);for(let e=l.length;e--;)o=l[e](o);return o(r,n||i.fetcher||null,i)}),un=()=>{},ua=un(),ui=Object,uo=e=>e===ua,us=new WeakMap,ul=(e,t)=>e===`[object ${t}]`,uu=0,uc=e=>{let t,r,n=typeof e,a=ui.prototype.toString.call(e),i=ul(a,"Date"),o=ul(a,"RegExp"),s=ul(a,"Object");if(ui(e)!==e||i||o)t=i?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=us.get(e))return t;if(t=++uu+"~",us.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=uc(e[r])+",";us.set(e,t)}if(s){t="#";let n=ui.keys(e).sort();for(;!uo(r=n.pop());)uo(e[r])||(t+=r+":"+uc(e[r])+",");us.set(e,t)}}return t},ud=Promise.resolve(),up=l5(ur,e=>(t,r,n)=>{let a,i=(0,Q.useRef)(!1),{cache:o,initialSize:s=1,revalidateAll:l=!1,persistSize:u=!1,revalidateFirstPage:c=!0,revalidateOnMount:d=!1,parallel:p=!1}=n,[,,,f]=lh.get(lW);try{(a=(e=>{if("function"==typeof e)try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?uc(e):"",t]})(t?t(0,null):null)[0])&&(a=lQ+a)}catch(e){}let[m,h,g]=lA(o,a),b=(0,Q.useCallback)(()=>lv(m()._l)?s:m()._l,[o,a,s]);(0,lf.useSyncExternalStore)((0,Q.useCallback)(e=>a?g(a,()=>{e()}):()=>{},[o,a]),b,b);let y=(0,Q.useCallback)(()=>{let e=m()._l;return lv(e)?s:e},[a,s]),v=(0,Q.useRef)(y());lP(()=>{if(!i.current){i.current=!0;return}a&&h({_l:u?v.current:y()})},[a,o]);let _=d&&!i.current,w=e(a,async e=>{let a=m()._i,i=m()._r;h({_r:lb});let s=[],u=y(),[d]=lA(o,e),g=d().data,b=[],v=null;for(let e=0;e<u;++e){let[u,d]=lz(t(e,p?null:v));if(!u)break;let[m,h]=lA(o,u),y=m().data,w=l||a||lv(y)||c&&!e&&!lv(g)||_||g&&!lv(g[e])&&!n.compare(g[e],y);if(r&&("function"==typeof i?i(y,d):w)){let t=async()=>{if(u in f){let e=f[u];delete f[u],y=await e}else y=await r(d);h({data:y,_k:d}),s[e]=y};p?b.push(t):await t()}else s[e]=y;p||(v=y)}return p&&await Promise.all(b.map(e=>e())),h({_i:lb}),s},n),E=(0,Q.useCallback)(function(e,t){let r="boolean"==typeof t?{revalidate:t}:t||{},n=!1!==r.revalidate;return a?(n&&(lv(e)?h({_i:!0,_r:r.revalidate}):h({_i:!1,_r:r.revalidate})),arguments.length?w.mutate(e,{...r,revalidate:n}):w.mutate()):ud},[a,o]),x=(0,Q.useCallback)(e=>{let r;if(!a)return ud;let[,n]=lA(o,a);if("function"==typeof e?r=e(y()):"number"==typeof e&&(r=e),"number"!=typeof r)return ud;n({_l:r}),v.current=r;let i=[],[s]=lA(o,a),l=null;for(let e=0;e<r;++e){let[r]=lz(t(e,l)),[n]=lA(o,r),a=r?n().data:lb;if(lv(a))return E(s().data);i.push(a),l=a}return E(i)},[a,o,E,y]);return{size:y(),setSize:x,mutate:E,get data(){return w.data},get error(){return w.error},get isValidating(){return w.isValidating},get isLoading(){return w.isLoading}}});function uf(){let e=ef();if(!e)return null;let t=e.langsmithApiKey||X.default.env.NEXT_PUBLIC_LANGSMITH_API_KEY||"";return new nP({apiUrl:e.deploymentUrl,defaultHeaders:t?{"X-Api-Key":t}:{}})}async function um(e){let t=uf();if(!t)throw Error("No EvoScientist deployment configured.");await t.threads.delete(e)}async function uh(e,t,r){let n={...(await e.threads.get(t)).metadata??{},...r};await e.threads.update(t,{metadata:n})}async function ug(e,t){let r=uf();if(!r)throw Error("No EvoScientist deployment configured.");await uh(r,e,{title:t})}async function ub(e,t){let r=uf();if(!r)throw Error("No EvoScientist deployment configured.");await uh(r,e,{pinned:t})}let uy="evoscientist-memory-seen-at";function uv(e){try{localStorage.setItem(uy,String(e))}catch{}}var u_=e.i(46696);let uw={interrupted:"Requiring Attention",today:"Today",yesterday:"Yesterday",week:"This Week",older:"Older"},uE={idle:"bg-green-500",busy:"bg-blue-500",interrupted:"bg-orange-500",error:"bg-red-600"},ux={idle:"Idle",busy:"Busy",interrupted:"Interrupted",error:"Error"};function uS(e){return uE[e]??"bg-gray-400"}function uk({status:e,label:t,badge:r}){return(0,J.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,J.jsx)("span",{className:rZ("inline-block size-2 rounded-full",uS(e))}),t,void 0!==r&&r>0&&(0,J.jsx)("span",{className:"ml-1 inline-flex items-center justify-center rounded-full bg-red-600 px-1.5 py-0.5 text-xs font-bold leading-none text-white",children:r})]})}function uT({message:e}){return(0,J.jsxs)("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[(0,J.jsx)("p",{className:"text-sm text-red-600",children:"Failed to load research"}),(0,J.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e})]})}function uA(){return(0,J.jsx)("div",{className:"space-y-2 p-4",children:Array.from({length:5}).map((e,t)=>(0,J.jsx)(i$,{className:"h-16 w-full"},t))})}function uN(){return(0,J.jsxs)("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[(0,J.jsx)(a2,{className:"mb-2 h-12 w-12 text-gray-300"}),(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No research yet"})]})}function uI({onThreadSelect:e,onClose:t,onNewChat:r,onMutateReady:n,onInterruptCountChange:a}){var i;let o,[s,l]=ec("threadId"),[u,c]=ec("view"),{unseenCount:d,markSeen:p}=function(){let e=(void 0)??!0,t=(void 0)??15e3,[r,n]=(0,Q.useState)(0),[a,i]=(0,Q.useState)(0),o=(0,Q.useRef)(!0),s=(0,Q.useCallback)(async()=>{try{let e,t=await fetch("/api/memory",{cache:"no-store"});if(!t.ok)return;let r=await t.json();if(!o.current)return;let a=(r.entries??[]).map(e=>"number"==typeof e.mtime?e.mtime:0).filter(e=>e>0),s=a.length?Math.max(...a):0,l=(e=Number(localStorage.getItem(uy)),Number.isFinite(e)?e:0);0===l&&s>0&&(uv(s),l=s),n(s),i(a.filter(e=>e>l).length)}catch{}},[]),l=(0,Q.useCallback)(()=>{uv(r>0?r:Date.now()),i(0)},[r]);return(0,Q.useEffect)(()=>{if(o.current=!0,!e)return()=>{o.current=!1};s();let r=setInterval(()=>{document.hidden||s()},t);return()=>{o.current=!1,clearInterval(r)}},[s,e,t]),{unseenCount:a,latestMtime:r,markSeen:l,refresh:s}}(),[f,m]=(0,Q.useState)("all"),[h,g]=(0,Q.useState)(""),[b,y]=(0,Q.useState)(null),[v,_]=(0,Q.useState)(""),[w,E]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),[k,T]=(0,Q.useState)(()=>new Date),[A,N]=(0,Q.useState)(()=>new Set),I=(o=(i={status:"all"===f?void 0:f,limit:20}).limit||20,up((e,t)=>{let r=ef(),n=r?.langsmithApiKey||X.default.env.NEXT_PUBLIC_LANGSMITH_API_KEY||"";return!r||t&&0===t.length?null:{kind:"threads",pageIndex:e,pageSize:o,deploymentUrl:r.deploymentUrl,assistantId:r.assistantId,apiKey:n,status:i?.status}},async({deploymentUrl:e,assistantId:t,apiKey:r,status:n,pageIndex:a,pageSize:i})=>{let o=new nP({apiUrl:e,defaultHeaders:r?{"X-Api-Key":r}:{}}),s=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)?{assistant_id:t}:{graph_id:t};return(await o.threads.search({limit:i,offset:a*i,sortBy:"updated_at",sortOrder:"desc",status:n,metadata:s})).map(e=>{let r="Untitled Thread",n="";try{if(e.values&&"object"==typeof e.values){let t=e.values,a=Array.isArray(t.messages)?t.messages:[],i=e=>"string"==typeof e?e:Array.isArray(e)?e.map(e=>"string"==typeof e?.text?e.text:"").join(""):"",o=a.find(e=>"human"===e.type),s=i(o?.content).trim();for(let e of(s&&(r=s.slice(0,50)+(s.length>50?"…":"")),a)){if(e?.type!=="ai")continue;let t=i(e.content).trim();if(t){n=t.slice(0,100);break}}"Untitled Thread"===r&&n&&(r=n.slice(0,50)+(n.length>50?"…":""))}}catch{r=`Thread ${e.thread_id.slice(0,8)}`}let a=e.metadata?.title;"string"==typeof a&&a.trim()&&(r=a.trim());let i=e.metadata?.pinned===!0;return{id:e.thread_id,updatedAt:new Date(e.updated_at),status:e.status,title:r,description:n,assistantId:t,pinned:i}})},{revalidateFirstPage:!0,revalidateOnFocus:!0})),C=(0,Q.useMemo)(()=>I.data?.flat()??[],[I.data]),R=(0,Q.useMemo)(()=>{let e=h.trim().toLowerCase();return e?C.filter(t=>t.title.toLowerCase().includes(e)):C},[C,h]);(0,Q.useEffect)(()=>{let e=()=>T(new Date),t=window.setInterval(e,6e4);return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.clearInterval(t),window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[]);let O=I.size>0&&I.data?.[I.size-1]==null,L=I.data?.at(0)?.length===0,P=L||(I.data?.at(-1)?.length??0)<20,D=(0,Q.useMemo)(()=>R.filter(e=>e.pinned),[R]),M=(0,Q.useMemo)(()=>{let e={interrupted:[],today:[],yesterday:[],week:[],older:[]};return R.forEach(t=>{if(t.pinned)return;if("interrupted"===t.status)return void e.interrupted.push(t);let r=Math.floor((k.getTime()-t.updatedAt.getTime())/864e5);0===r?e.today.push(t):1===r?e.yesterday.push(t):r<7?e.week.push(t):e.older.push(t)}),e},[R,k]),j=(0,Q.useMemo)(()=>C.filter(e=>"interrupted"===e.status).length,[C]),F=(0,Q.useRef)(n),$=(0,Q.useRef)(I.mutate);(0,Q.useEffect)(()=>{F.current=n},[n]),(0,Q.useEffect)(()=>{$.current=I.mutate},[I.mutate]);let U=(0,Q.useCallback)(()=>{$.current()},[]);(0,Q.useEffect)(()=>{F.current?.(U)},[]),(0,Q.useEffect)(()=>{a?.(j)},[j,a]);let z=(0,Q.useRef)(!1),B=(0,Q.useRef)(new Set),H=(0,Q.useRef)(null),G=(0,Q.useRef)(!1),V=async()=>{if(!b||z.current)return;let e=v.trim();if(!e||e===b.title)return void y(null);z.current=!0,S(!0);try{await ug(b.id,e),y(null),U()}catch{u_.toast.error("Couldn't rename — try again.")}finally{z.current=!1,S(!1)}},q=async()=>{if(w&&!z.current){z.current=!0,S(!0);try{await um(w.id),s===w.id&&(r?r():(l(null),c(null))),G.current=!0,E(null),U()}catch{u_.toast.error("Couldn't delete — try again.")}finally{z.current=!1,S(!1)}}},W=async e=>{if(!B.current.has(e.id)){B.current.add(e.id),N(t=>{let r=new Set(t);return r.add(e.id),r});try{await ub(e.id,!e.pinned),U()}catch{u_.toast.error(e.pinned?"Couldn't unpin — try again.":"Couldn't pin — try again.")}finally{B.current.delete(e.id),N(t=>{let r=new Set(t);return r.delete(e.id),r})}}},Z=t=>{var r;let n=A.has(t.id);return(0,J.jsxs)("div",{className:"group relative",children:[(0,J.jsx)("button",{type:"button",onClick:()=>e(t.id),className:rZ("grid w-full cursor-pointer items-center gap-2 rounded-md py-2 pl-2.5 pr-20 text-left transition-colors duration-200 md:pr-2.5 md:group-focus-within:pr-20 md:group-hover:pr-20","hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",s===t.id?"border border-primary bg-accent hover:bg-accent":"border border-transparent bg-transparent"),"aria-current":s===t.id,children:(0,J.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,J.jsxs)("div",{className:"mb-0.5 flex items-center justify-between gap-2",children:[(0,J.jsxs)("h3",{className:"flex min-w-0 items-center gap-1.5 text-sm font-semibold",children:[t.pinned&&(0,J.jsx)(a3,{className:"size-3 flex-shrink-0 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("span",{className:"truncate",children:t.title})]}),(0,J.jsx)("span",{className:"ml-2 flex-shrink-0 text-xs tabular-nums text-muted-foreground",children:(0,J.jsx)("time",{dateTime:t.updatedAt.toISOString(),title:(r=t.updatedAt,new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short",hourCycle:"h23"}).format(r)),children:function(e,t=new Date){let r=Math.floor((t.getTime()-e.getTime())/864e5);return 0===r?new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(e):1===r?"Yesterday":r<7?new Intl.DateTimeFormat(void 0,{weekday:"long"}).format(e):new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit"}).format(e)}(t.updatedAt,k)})})]}),(0,J.jsxs)("div",{className:"flex items-center justify-between",children:[(0,J.jsx)("p",{className:"flex-1 truncate text-[13px] text-muted-foreground",children:t.description}),(0,J.jsx)("div",{className:"ml-2 flex-shrink-0",children:(0,J.jsx)("span",{role:"img","aria-label":`Status: ${ux[t.status]}`,title:`Status: ${ux[t.status]}`,className:rZ("h-2 w-2 rounded-full",uS(t.status))})})]})]})}),(0,J.jsxs)("div",{className:"absolute right-1.5 top-1.5 flex items-center gap-0.5 rounded-md bg-accent/95 p-0.5 opacity-100 shadow-sm backdrop-blur-sm transition-opacity md:opacity-0 md:group-focus-within:opacity-100 md:group-hover:opacity-100",children:[(0,J.jsx)("button",{type:"button","aria-label":t.pinned?`Unpin "${t.title}"`:`Pin "${t.title}"`,title:t.pinned?"Unpin":"Pin",onClick:()=>W(t),disabled:n,className:rZ("rounded p-1 transition-colors hover:bg-background focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t.pinned?"text-[var(--brand)] hover:text-[var(--brand)]":"text-muted-foreground hover:text-foreground"),children:t.pinned?(0,J.jsx)(a5,{className:"size-3.5","aria-hidden":"true"}):(0,J.jsx)(a3,{className:"size-3.5","aria-hidden":"true"})}),(0,J.jsx)("button",{type:"button","aria-label":`Rename "${t.title}"`,title:"Rename",onClick:()=>{y(t),_(t.title)},className:"rounded p-1 text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(a4,{className:"size-3.5","aria-hidden":"true"})}),(0,J.jsx)("button",{type:"button","aria-label":`Delete "${t.title}"`,title:"Delete",onClick:()=>E(t),className:"rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(a8,{className:"size-3.5","aria-hidden":"true"})})]})]},t.id)};return(0,J.jsxs)("div",{className:"absolute inset-0 flex flex-col",children:[(0,J.jsxs)("button",{ref:H,type:"button",onClick:()=>{r?r():(l(null),c(null)),t?.()},className:"flex flex-shrink-0 items-center gap-2.5 border-b border-border px-3 py-3 text-left text-sm font-medium transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[(0,J.jsx)(n$,{className:"size-4","aria-hidden":"true"}),"New Chat"]}),(0,J.jsxs)("button",{type:"button",onClick:()=>{if("skills"===u){c(null),t?.();return}c("skills"),t?.()},className:rZ("flex flex-shrink-0 items-center gap-2.5 border-b border-border px-3 py-3 text-left text-sm font-medium transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","skills"===u&&"bg-accent"),children:[(0,J.jsx)(a6,{className:"size-4","aria-hidden":"true"}),"Research Skills"]}),(0,J.jsxs)("button",{type:"button",onClick:()=>{if("memory"===u){c(null),t?.();return}p(),c("memory"),t?.()},className:rZ("flex flex-shrink-0 items-center gap-2.5 border-b border-border px-3 py-3 text-left text-sm font-medium transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","memory"===u&&"bg-accent"),children:[(0,J.jsx)(a0,{className:"size-4","aria-hidden":"true"}),"EvoMemory","memory"!==u&&d>0&&(0,J.jsx)("span",{className:"ml-auto inline-flex min-w-4 items-center justify-center rounded-full bg-[var(--brand-solid)] px-1 text-[10px] font-bold leading-none text-[var(--brand-foreground)]",title:`${d} memory file${1===d?"":"s"} updated since you last looked`,"aria-label":`${d} memory updates`,children:d})]}),(0,J.jsx)("div",{className:"flex-shrink-0 border-b border-border p-2.5",children:(0,J.jsxs)("div",{className:"relative",children:[(0,J.jsx)(a9,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground","aria-hidden":"true"}),(0,J.jsx)("input",{type:"search",name:"research-search",value:h,onChange:e=>g(e.target.value),placeholder:"Search research…","aria-label":"Search research",autoComplete:"off",spellCheck:!1,className:"w-full rounded-md border border-border bg-background py-1.5 pl-8 pr-8 text-sm outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring"}),h&&(0,J.jsx)("button",{type:"button","aria-label":"Clear research search",onClick:()=>g(""),className:"absolute right-1 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(rs,{className:"size-3.5","aria-hidden":"true"})})]})}),(0,J.jsxs)("div",{className:"grid flex-shrink-0 grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-3 py-2.5",children:[(0,J.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Recents"}),(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[(0,J.jsxs)(sx,{value:f,onValueChange:e=>m(e),children:[(0,J.jsx)(lo,{className:"w-fit",children:(0,J.jsx)(sA,{})}),(0,J.jsxs)(lu,{align:"end",children:[(0,J.jsx)(ld,{value:"all",children:"All"}),(0,J.jsx)(lp,{}),(0,J.jsxs)(sV,{children:[(0,J.jsx)(lc,{children:"Active"}),(0,J.jsx)(ld,{value:"idle",children:(0,J.jsx)(uk,{status:"idle",label:"Idle"})}),(0,J.jsx)(ld,{value:"busy",children:(0,J.jsx)(uk,{status:"busy",label:"Busy"})})]}),(0,J.jsx)(lp,{}),(0,J.jsxs)(sV,{children:[(0,J.jsx)(lc,{children:"Attention"}),(0,J.jsx)(ld,{value:"interrupted",children:(0,J.jsx)(uk,{status:"interrupted",label:"Interrupted",badge:j})}),(0,J.jsx)(ld,{value:"error",children:(0,J.jsx)(uk,{status:"error",label:"Error"})})]})]})]}),t&&(0,J.jsx)("button",{type:"button","aria-label":u?"Close navigation":"Close research",onClick:t,className:"rounded-md p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(rs,{className:"size-4","aria-hidden":"true"})})]})]}),(0,J.jsxs)(ij,{className:"h-0 flex-1",children:[I.error&&(0,J.jsx)(uT,{message:I.error.message}),!I.error&&!I.data&&I.isLoading&&(0,J.jsx)("div",{"aria-live":"polite",children:(0,J.jsx)(uA,{})}),!I.error&&!I.isLoading&&L&&(0,J.jsx)(uN,{}),!I.error&&!L&&h.trim()&&0===R.length&&(0,J.jsx)("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No research matches your search."})}),!I.error&&!L&&R.length>0&&(0,J.jsxs)("div",{className:"box-border w-full max-w-full overflow-hidden p-1.5",children:[D.length>0&&(0,J.jsxs)("div",{className:"mb-3",children:[(0,J.jsx)("h4",{className:"m-0 px-2.5 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Research"}),(0,J.jsx)("div",{className:"flex flex-col gap-1",children:D.map(e=>Z(e))})]}),Object.keys(uw).map(e=>{let t=M[e];return 0===t.length?null:(0,J.jsxs)("div",{className:"mb-3",children:[(0,J.jsx)("h4",{className:"m-0 px-2.5 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:uw[e]}),(0,J.jsx)("div",{className:"flex flex-col gap-1",children:t.map(e=>Z(e))})]},e)}),!P&&(0,J.jsx)("div",{className:"flex justify-center py-4",children:(0,J.jsx)(na,{variant:"outline",size:"sm",onClick:()=>I.setSize(I.size+1),disabled:O,children:O?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(a1,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading…"]}):"Load More"})})]})]}),(0,J.jsx)(rK,{open:null!==b,onOpenChange:e=>{e||x||y(null)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Rename research"}),(0,J.jsx)(r2,{children:"Give this conversation a custom title."})]}),(0,J.jsx)(nu,{autoFocus:!0,value:v,onChange:e=>_(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),V())},placeholder:"Enter a title…",maxLength:100,disabled:x}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>y(null),disabled:x,children:"Cancel"}),(0,J.jsx)(na,{onClick:V,disabled:x||!v.trim(),children:x?"Saving…":"Save"})]})]})}),(0,J.jsx)(rK,{open:null!==w,onOpenChange:e=>{e||x||E(null)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",onCloseAutoFocus:e=>{G.current&&(e.preventDefault(),G.current=!1,H.current?.focus())},children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Delete this research?"}),(0,J.jsxs)(r2,{children:["“",w?.title,"” will be permanently deleted. This can’t be undone."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>E(null),disabled:x,children:"Cancel"}),(0,J.jsx)(na,{onClick:q,disabled:x,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:x?"Deleting…":"Delete"})]})]})})]})}var uC=Object.defineProperty,uR=(e,t)=>{for(var r in t)uC(e,r,{get:t[r],enumerable:!0})};function uO(e){return"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"source_type"in e&&("url"===e.source_type||"base64"===e.source_type||"text"===e.source_type||"id"===e.source_type)}function uL(e){return uO(e)&&"url"===e.source_type&&"url"in e&&"string"==typeof e.url}function uP(e){return uO(e)&&"base64"===e.source_type&&"data"in e&&"string"==typeof e.data}function uD(e){return uO(e)&&"text"===e.source_type&&"text"in e&&"string"==typeof e.text}function uM(e){return uO(e)&&"id"===e.source_type&&"id"in e&&"string"==typeof e.id}function uj(e){if(uO(e)){if("url"===e.source_type)return{type:"image_url",image_url:{url:e.url}};if("base64"===e.source_type){if(!e.mime_type)throw Error("mime_type key is required for base64 data.");let t=e.mime_type;return{type:"image_url",image_url:{url:`data:${t};base64,${e.data}`}}}}throw Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function uF(e){let t=e.split(";")[0].split("/");if(2!==t.length)throw Error(`Invalid mime type: "${e}" - does not match type/subtype format.`);let r=t[0].trim(),n=t[1].trim();if(""===r||""===n)throw Error(`Invalid mime type: "${e}" - type or subtype is empty.`);let a={};for(let t of e.split(";").slice(1)){let r=t.split("=");if(2!==r.length)throw Error(`Invalid parameter syntax in mime type: "${e}".`);let n=r[0].trim(),i=r[1].trim();if(""===n)throw Error(`Invalid parameter syntax in mime type: "${e}".`);a[n]=i}return{type:r,subtype:n,parameters:a}}function u$({dataUrl:e,asTypedArray:t=!1}){let r=e.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/);if(r)return{mime_type:r[1].toLowerCase(),data:t?Uint8Array.from(atob(r[2]),e=>e.charCodeAt(0)):r[2]}}function uU(e,t){if("text"===e.type){if(!t.fromStandardTextBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardTextBlock\` method.`);return t.fromStandardTextBlock(e)}if("image"===e.type){if(!t.fromStandardImageBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardImageBlock\` method.`);return t.fromStandardImageBlock(e)}if("audio"===e.type){if(!t.fromStandardAudioBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardAudioBlock\` method.`);return t.fromStandardAudioBlock(e)}if("file"===e.type){if(!t.fromStandardFileBlock)throw Error(`Converter for ${t.providerName} does not implement \`fromStandardFileBlock\` method.`);return t.fromStandardFileBlock(e)}throw Error(`Unable to convert content block type '${e.type}' to provider-specific format: not recognized.`)}function uz(e){return"object"==typeof e&&null!==e&&"type"in e&&"content"in e&&("string"==typeof e.content||Array.isArray(e.content))}var uB=e.i(31272);function uH(e,t){return t?.[e]||(0,uB.default)(e)}e.i(45796);let uG="__lc_escaped__";function uV(e){return Array.isArray(e)?[...e]:{...e}}function uq(e){let t=Object.getPrototypeOf(e);return"function"==typeof e.lc_name&&("function"!=typeof t.lc_name||e.lc_name()!==t.lc_name())?e.lc_name():e.name}uR({},{Serializable:()=>uW,get_lc_unique_name:()=>uq});var uW=class e{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,uq(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...t){void 0!==this.lc_serializable_keys?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([e])=>this.lc_serializable_keys?.includes(e))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable||this.lc_kwargs instanceof e||"object"!=typeof this.lc_kwargs||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let t={},r={},n=Object.keys(this.lc_kwargs).reduce((e,t)=>(e[t]=t in this?this[t]:this.lc_kwargs[t],e),{});for(let e=Object.getPrototypeOf(this);e;e=Object.getPrototypeOf(e))Object.assign(t,Reflect.get(e,"lc_aliases",this)),Object.assign(r,Reflect.get(e,"lc_secrets",this)),Object.assign(n,Reflect.get(e,"lc_attributes",this));Object.keys(r).forEach(e=>{let t=this,r=n,[a,...i]=e.split(".").reverse();for(let e of i.reverse()){if(!(e in t)||void 0===t[e])return;e in r&&void 0!==r[e]||("object"==typeof t[e]&&null!=t[e]?r[e]={}:Array.isArray(t[e])&&(r[e]=[])),t=t[e],r=r[e]}a in t&&void 0!==t[a]&&(r[a]=r[a]||t[a])});let a={},i=new WeakSet;for(let[e,t]of(i.add(this),Object.entries(n)))a[e]=function e(t,r=new WeakSet){if(null!==t&&"object"==typeof t&&!Array.isArray(t)){if(r.has(t))return{lc:1,type:"not_implemented",id:null!==t&&"object"==typeof t?"lc_id"in t&&Array.isArray(t.lc_id)?t.lc_id:[t.constructor?.name??"Object"]:[typeof t]};if(null!==t&&"object"==typeof t&&"lc_serializable"in t&&"function"==typeof t.toJSON)return t;if(r.add(t),"lc"in t||1===Object.keys(t).length&&uG in t)return r.delete(t),{[uG]:t};let n={};for(let[a,i]of Object.entries(t))n[a]=e(i,r);return r.delete(t),n}return Array.isArray(t)?t.map(t=>e(t,r)):t}(t,i);let o=function(e,t,r){let n={};for(let a in e)Object.hasOwn(e,a)&&(n[t(a,r)]=e[a]);return n}(Object.keys(r).length?function(e,t){let r=uV(e);for(let[e,n]of Object.entries(t)){let[t,...a]=e.split(".").reverse(),i=r;for(let e of a.reverse()){if(void 0===i[e])break;i[e]=uV(i[e]),i=i[e]}void 0!==i[t]&&(i[t]={lc:1,type:"secret",id:[n]})}return r}(a,r):a,uH,t);return{lc:1,type:"constructor",id:this.lc_id,kwargs:o}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function uZ(e,t){return uK(e)&&e.type===t}function uK(e){return"object"==typeof e&&null!==e}function uY(e){return Array.isArray(e)}function uX(e){return"string"==typeof e}function uJ(e){return"number"==typeof e}function uQ(e){return e instanceof Uint8Array}function u0(e){try{return JSON.parse(e)}catch{return}}let u1=e=>e();function u2(e){if(uZ(e,"document")&&uK(e.source)&&"type"in e.source){if("base64"===e.source.type&&uX(e.source.media_type)&&uX(e.source.data))return{type:"file",mimeType:e.source.media_type,data:e.source.data};else if("url"===e.source.type&&uX(e.source.url))return{type:"file",url:e.source.url};else if("file"===e.source.type&&uX(e.source.file_id))return{type:"file",fileId:e.source.file_id};else if("text"===e.source.type&&uX(e.source.data))return{type:"file",mimeType:String(e.source.media_type??"text/plain"),data:e.source.data}}else if(uZ(e,"image")&&uK(e.source)&&"type"in e.source){if("base64"===e.source.type&&uX(e.source.media_type)&&uX(e.source.data))return{type:"image",mimeType:e.source.media_type,data:e.source.data};else if("url"===e.source.type&&uX(e.source.url))return{type:"image",url:e.source.url};else if("file"===e.source.type&&uX(e.source.file_id))return{type:"image",fileId:e.source.file_id}}}function u4(e){return Array.from(function*(){for(let t of e){let e=u2(t);e?yield e:yield t}}())}function u3(e){return Array.from(function*(){for(let r of"string"==typeof e.content?[{type:"text",text:e.content}]:e.content){if(uZ(r,"text")&&uX(r.text)){let{text:e,citations:t,...n}=r;if(uY(t)&&t.length){let r=t.reduce((e,t)=>{let r=function(e){if("char_location"===e.type&&uX(e.document_title)&&uJ(e.start_char_index)&&uJ(e.end_char_index)&&uX(e.cited_text)){let{document_title:t,start_char_index:r,end_char_index:n,cited_text:a,...i}=e;return{...i,type:"citation",source:"char",title:t??void 0,startIndex:r,endIndex:n,citedText:a}}if("page_location"===e.type&&uX(e.document_title)&&uJ(e.start_page_number)&&uJ(e.end_page_number)&&uX(e.cited_text)){let{document_title:t,start_page_number:r,end_page_number:n,cited_text:a,...i}=e;return{...i,type:"citation",source:"page",title:t??void 0,startIndex:r,endIndex:n,citedText:a}}if("content_block_location"===e.type&&uX(e.document_title)&&uJ(e.start_block_index)&&uJ(e.end_block_index)&&uX(e.cited_text)){let{document_title:t,start_block_index:r,end_block_index:n,cited_text:a,...i}=e;return{...i,type:"citation",source:"block",title:t??void 0,startIndex:r,endIndex:n,citedText:a}}if("web_search_result_location"===e.type&&uX(e.url)&&uX(e.title)&&uX(e.encrypted_index)&&uX(e.cited_text)){let{url:t,title:r,encrypted_index:n,cited_text:a,...i}=e;return{...i,type:"citation",source:"url",url:t,title:r,startIndex:Number(n),endIndex:Number(n),citedText:a}}if("search_result_location"===e.type&&uX(e.source)&&uX(e.title)&&uJ(e.start_block_index)&&uJ(e.end_block_index)&&uX(e.cited_text)){let{source:t,title:r,start_block_index:n,end_block_index:a,cited_text:i,...o}=e;return{...o,type:"citation",source:"search",url:t,title:r??void 0,startIndex:n,endIndex:a,citedText:i}}}(t);return r?[...e,r]:e},[]);yield{...n,type:"text",text:e,annotations:r};continue}yield{...n,type:"text",text:e};continue}if(uZ(r,"thinking")&&uX(r.thinking)){let{thinking:e,signature:t,...n}=r;yield{...n,type:"reasoning",reasoning:e,signature:t};continue}if(uZ(r,"redacted_thinking")){yield{type:"non_standard",value:r};continue}else if(uZ(r,"tool_use")&&uX(r.name)&&uX(r.id)){yield{type:"tool_call",id:r.id,name:r.name,args:r.input};continue}else if(uZ(r,"input_json_delta")){var t;if(t=e,"function"==typeof t?._getType&&"function"==typeof t.concat&&"ai"===t._getType()&&e.tool_call_chunks?.length){let t=e.tool_call_chunks[0];yield{type:"tool_call_chunk",id:t.id,name:t.name,args:t.args,index:t.index};continue}}else if(uZ(r,"server_tool_use")&&uX(r.name)&&uX(r.id)){let{name:e,id:t}=r;if("web_search"===e){let e=u1(()=>{if("string"==typeof r.input)return r.input;if(uK(r.input)&&uX(r.input.query))return r.input.query;if(uX(r.partial_json)){let e=u0(r.partial_json);if(e?.query)return e.query}return""});yield{id:t,type:"server_tool_call",name:"web_search",args:{query:e}};continue}if("code_execution"===r.name){let e=u1(()=>{if("string"==typeof r.input)return r.input;if(uK(r.input)&&uX(r.input.code))return r.input.code;if(uX(r.partial_json)){let e=u0(r.partial_json);if(e?.code)return e.code}return""});yield{id:t,type:"server_tool_call",name:"code_execution",args:{code:e}};continue}}else if(uZ(r,"web_search_tool_result")&&uX(r.tool_use_id)&&uY(r.content)){let{content:e,tool_use_id:t}=r,n=e.reduce((e,t)=>uZ(t,"web_search_result")?[...e,t.url]:e,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:t,status:"success",output:{urls:n}};continue}else if(uZ(r,"code_execution_tool_result")&&uX(r.tool_use_id)&&uK(r.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:r.tool_use_id,status:"success",output:r.content};continue}else if(uZ(r,"mcp_tool_use")){yield{id:r.id,type:"server_tool_call",name:"mcp_tool_use",args:r.input};continue}else if(uZ(r,"mcp_tool_result")&&uX(r.tool_use_id)&&uK(r.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:r.tool_use_id,status:"success",output:r.content};continue}else if(uZ(r,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:r.input};continue}else if(uZ(r,"search_result")){yield{id:r.id,type:"non_standard",value:r};continue}else if(uZ(r,"tool_result")){yield{id:r.id,type:"non_standard",value:r};continue}else{let e=u2(r);if(e){yield e;continue}}yield{type:"non_standard",value:r}}}())}function u5(e){return uL(e)?{type:e.type,mimeType:e.mime_type,url:e.url,metadata:e.metadata}:uP(e)?{type:e.type,mimeType:e.mime_type??"application/octet-stream",data:e.data,metadata:e.metadata}:uM(e)?{type:e.type,mimeType:e.mime_type,fileId:e.id,metadata:e.metadata}:e}function u6(e){return e.map(u5)}function u9(e){let t=[];for(let r of e)(uZ(r,"image_url")&&uK(r.image_url)||uZ(r,"input_audio")&&uK(r.input_audio)||uZ(r,"file")&&uK(r.file)?0:1)?t.push(r):t.push(function(e){if(uZ(e,"image_url")&&uK(e.image_url)&&uX(e.image_url.url)){let t=u$({dataUrl:e.image_url.url});return t?{type:"image",mimeType:t.mime_type,data:t.data}:{type:"image",url:e.image_url.url}}if(uZ(e,"input_audio")&&uK(e.input_audio)&&uX(e.input_audio.data)&&uX(e.input_audio.format))return{type:"audio",data:e.input_audio.data,mimeType:`audio/${e.input_audio.format}`};if(uZ(e,"file")&&uK(e.file)&&uX(e.file.data)){let t=u$({dataUrl:e.file.data});if(t)return{type:"file",data:t.data,mimeType:t.mime_type};if(uX(e.file.file_id))return{type:"file",fileId:e.file.file_id}}return e}(r));return t}function u8(e){if("url_citation"===e.type){let{url:t,title:r,start_index:n,end_index:a}=e;return{type:"citation",url:t,title:r,startIndex:n,endIndex:a}}if("file_citation"===e.type){let{file_id:t,filename:r,index:n}=e;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:t}}return e}function u7(e){return Array.from(function*(){if(uK(e.additional_kwargs?.reasoning)&&uY(e.additional_kwargs.reasoning.summary)){let t=e.additional_kwargs.reasoning.summary.reduce((e,t)=>uK(t)&&uX(t.text)?`${e}${t.text}`:e,"");yield{type:"reasoning",reasoning:t}}for(let t of"string"==typeof e.content?[{type:"text",text:e.content}]:e.content)if(uZ(t,"text")){let{text:e,annotations:r,...n}=t;Array.isArray(r)?yield{...n,type:"text",text:String(e),annotations:r.map(u8)}:yield{...n,type:"text",text:String(e)}}for(let t of e.tool_calls??[])yield{type:"tool_call",id:t.id,name:t.name,args:t.args};if(uK(e.additional_kwargs)&&uY(e.additional_kwargs.tool_outputs))for(let t of e.additional_kwargs.tool_outputs){if(uZ(t,"web_search_call")){yield{id:t.id,type:"server_tool_call",name:"web_search",args:{query:t.query}};continue}if(uZ(t,"file_search_call")){yield{id:t.id,type:"server_tool_call",name:"file_search",args:{query:t.query}};continue}if(uZ(t,"computer_call")){yield{type:"non_standard",value:t};continue}else if(uZ(t,"code_interpreter_call")){if(uX(t.code)&&(yield{id:t.id,type:"server_tool_call",name:"code_interpreter",args:{code:t.code}}),uY(t.outputs)){let e=u1(()=>{if("in_progress"!==t.status){if("completed"===t.status)return 0;if("incomplete"===t.status)return 127;if("interpreting"!==t.status&&"failed"===t.status)return 1}});for(let r of t.outputs)if(uZ(r,"logs")){yield{type:"server_tool_call_result",toolCallId:t.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:e??0,stderr:[0,void 0].includes(e)?void 0:String(r.logs),stdout:[0,void 0].includes(e)?String(r.logs):void 0}};continue}}continue}else if(uZ(t,"mcp_call")){yield{id:t.id,type:"server_tool_call",name:"mcp_call",args:t.input};continue}else if(uZ(t,"mcp_list_tools")){yield{id:t.id,type:"server_tool_call",name:"mcp_list_tools",args:t.input};continue}else if(uZ(t,"mcp_approval_request")){yield{type:"non_standard",value:t};continue}else if(uZ(t,"image_generation_call")){uX(t.result)&&(yield{type:"image",mimeType:"image/png",data:t.result,id:uX(t.id)?t.id:void 0,metadata:{status:uX(t.status)?t.status:void 0}}),yield{type:"non_standard",value:t};continue}uK(t)&&(yield{type:"non_standard",value:t})}}())}let ce=Symbol.for("langchain.message");function ct(e,t){if("string"==typeof e)return""===e?t:"string"==typeof t?e+t:Array.isArray(t)&&0===t.length?e:Array.isArray(t)&&t.some(e=>uO(e))?[{type:"text",source_type:"text",text:e},...t]:[{type:"text",text:e},...t];return Array.isArray(t)?cs(e,t)??[...e,...t]:""===t?e:Array.isArray(e)&&e.some(e=>uO(e))?[...e,{type:"file",source_type:"text",text:t}]:[...e,{type:"text",text:t}]}function cr(e,t){return"error"===e||"error"===t?"error":"success"}var cn=class extends uW{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[ce]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(e){const t="string"==typeof e||Array.isArray(e)?{content:e}:e;t.additional_kwargs||(t.additional_kwargs={}),t.response_metadata||(t.response_metadata={}),super(t),this.name=t.name,void 0===t.content&&void 0!==t.contentBlocks?(this.content=t.contentBlocks,this.response_metadata={output_version:"v1",...t.response_metadata}):(void 0!==t.content?this.content=t.content??[]:this.content=[],this.response_metadata=t.response_metadata),this.additional_kwargs=t.additional_kwargs,this.id=t.id}get text(){return"string"==typeof this.content?this.content:Array.isArray(this.content)?this.content.map(e=>"string"==typeof e?e:"text"===e.type?e.text:"").join(""):""}get contentBlocks(){return[u6,u9,u4].reduce((e,t)=>t(e),"string"==typeof this.content?[{type:"text",text:this.content}]:this.content)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(e){return"object"==typeof e&&null!==e&&ce in e&&!0===e[ce]&&uz(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){var t,r;if(null===e)return this;let n=(t=this._printableFields,r=Math.max(4,e),JSON.stringify(function e(t,n){if("object"!=typeof t||null==t)return t;if(n>=r)return Array.isArray(t)?"[Array]":"[Object]";if(Array.isArray(t))return t.map(t=>e(t,n+1));let a={};for(let r of Object.keys(t))a[r]=e(t[r],n+1);return a}(t,0),null,2));return`${this.constructor.lc_name()} ${n}`}toFormattedString(e="pretty"){return function(e,t="pretty"){return"pretty"===t?function(e){let t=[],r=` ${e.type.charAt(0).toUpperCase()+e.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),a="=".repeat(n),i=r.length%2==0?a:`${a}=`;if(t.push(`${a}${r}${i}`),"ai"===e.type&&e.tool_calls&&e.tool_calls.length>0)for(let r of(t.push("Tool Calls:"),e.tool_calls))for(let[e,n]of(t.push(` ${r.name} (${r.id})`),t.push(` Call ID: ${r.id}`),t.push(" Args:"),Object.entries(r.args)))t.push(` ${e}: ${"object"==typeof n?JSON.stringify(n):n}`);return"tool"===e.type&&e.name&&t.push(`Name: ${e.name}`),"string"==typeof e.content&&e.content.trim()&&(t.length>1&&t.push(""),t.push(e.content)),t.join("\n")}(e):JSON.stringify(e)}(this,e)}};function ca(e){return Array.isArray(e)&&e.every(e=>"number"==typeof e.index)}let ci=["index","created","timestamp"];function co(e,t,r){let n=r?.ignoreKeys??ci;if(null==e&&null==t)return;if(null==e||null==t)return e??t;let a={...e};for(let[e,i]of Object.entries(t))if(null==a[e])a[e]=i;else if(null==i)continue;else if(typeof a[e]!=typeof i||Array.isArray(a[e])!==Array.isArray(i))throw Error(`field[${e}] already exists in the message chunk, but with a different type.`);else if("string"==typeof a[e])if("type"===e)continue;else if(["id","name","output_version","model_provider"].includes(e))i&&(a[e]=i);else{if(n.includes(e))continue;a[e]+=i}else if("number"==typeof a[e]){if(n.includes(e))continue;a[e]=a[e]+i}else if("object"!=typeof a[e]||Array.isArray(a[e]))if(Array.isArray(a[e]))a[e]=cs(a[e],i,r);else{if(a[e]===i)continue;console.warn(`field[${e}] already exists in this message chunk and value has unsupported type.`)}else a[e]=co(a[e],i,r);return a}function cs(e,t,r){if(null!=e||null!=t){if(null==e||null==t)return e||t;let n=[...e];for(let e of t)if("object"==typeof e&&null!==e&&"index"in e&&"number"==typeof e.index){let t=n.findIndex(t=>{let r="object"==typeof t,n="index"in t&&t.index===e.index,a="id"in t&&"id"in e&&t?.id===e?.id,i=!("id"in t)||!t?.id||!("id"in e)||!e?.id;return r&&n&&(a||i)});-1!==t&&"object"==typeof n[t]&&null!==n[t]?n[t]=co(n[t],e,r):n.push(e)}else{if("object"==typeof e&&null!==e&&"text"in e&&""===e.text)continue;n.push(e)}return n}}function cl(e,t,r){if(null!=e||null!=t)if(null==e||null==t)return e??t;else if(typeof e!=typeof t)throw Error(`Cannot merge objects of different types.
|
|
8
8
|
Left ${typeof e}
|
|
9
9
|
Right ${typeof t}`);else if("string"==typeof e&&"string"==typeof t)return e+t;else if(Array.isArray(e)&&Array.isArray(t))return cs(e,t,r);else if("object"==typeof e&&"object"==typeof t)return co(e,t,r);else if(e===t)return e;else throw Error(`Can not merge objects of different types.
|
|
10
10
|
Left ${e}
|
|
@@ -67,9 +67,9 @@ data: ${JSON.stringify(t)}
|
|
|
67
67
|
`));e.enqueue(i.encode("event: end\n\n")),e.close()}}),mw.fromReadableStream(o)}async *_streamEventsV2(e,t,r){let n,a=new m2({...r,autoClose:!1}),i=mg(t),o=i.runId??y5();i.runId=o;let s=i.callbacks;if(void 0===s)i.callbacks=[a];else if(Array.isArray(s))i.callbacks=s.concat(a);else{let e=s.copy();e.addHandler(a,!0),i.callbacks=e}let l=new AbortController,u=this,c=async function(){let r,n=null;try{t?.signal?"any"in AbortSignal?r=AbortSignal.any([l.signal,t.signal]):(r=t.signal,n=()=>{l.abort()},t.signal.addEventListener("abort",n,{once:!0})):r=l.signal;let s=await u.stream(e,{...i,signal:r});for await(let e of a.tapOutputIterable(o,s))if(l.signal.aborted)break}finally{await a.finish(),r&&n&&r.removeEventListener("abort",n)}}(),d=!1;try{for await(let t of a){if(!d){t.data.input=e,d=!0,n=t.run_id,yield t;continue}t.run_id===n&&t.event.endsWith("_end")&&t.data?.input&&delete t.data.input,yield t}}finally{l.abort(),await c}}async *_streamEventsV1(e,t,r){let n,a=!1,i=mg(t),o=i.tags??[],s=i.metadata??{},l=i.runName??this.getName(),u=new mY({...r,autoClose:!1,_schemaFormat:"streaming_events"}),c=new hi({...r});for await(let t of this._streamLog(e,u,i)){if(void 0===(n=n?n.concat(t):mq.fromRunLogPatch(t)).state)throw Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!a){a=!0;let t={...n.state},r={run_id:t.id,event:`on_${t.type}_start`,name:l,tags:o,metadata:s,data:{input:e}};c.includeEvent(r,t.type)&&(yield r)}for(let e of[...new Set(t.ops.filter(e=>e.path.startsWith("/logs/")).map(e=>e.path.split("/")[2]))]){let t,r={},a=n.state.logs[e];if("start"==(t=void 0===a.end_time?a.streamed_output.length>0?"stream":"start":"end"))void 0!==a.inputs&&(r.input=a.inputs);else if("end"===t)void 0!==a.inputs&&(r.input=a.inputs),r.output=a.final_output;else if("stream"===t){let e=a.streamed_output.length;if(1!==e)throw Error(`Expected exactly one chunk of streamed output, got ${e} instead. Encountered in: "${a.name}"`);r={chunk:a.streamed_output[0]},a.streamed_output=[]}yield{event:`on_${a.type}_${t}`,name:a.name,run_id:a.id,tags:a.tags,metadata:a.metadata,data:r}}let{state:r}=n;if(r.streamed_output.length>0){let e=r.streamed_output.length;if(1!==e)throw Error(`Expected exactly one chunk of streamed output, got ${e} instead. Encountered in: "${r.name}"`);let t={chunk:r.streamed_output[0]};r.streamed_output=[];let n={event:`on_${r.type}_stream`,run_id:r.id,tags:o,metadata:s,name:l,data:t};c.includeEvent(n,r.type)&&(yield n)}}let d=n?.state;if(void 0!==d){let e={event:`on_${d.type}_end`,name:l,run_id:d.id,tags:o,metadata:s,data:{output:d.final_output}};c.includeEvent(e,d.type)&&(yield e)}}static isRunnable(e){return ha(e)}withListeners({onStart:e,onEnd:t,onError:r}){return new vo({bound:this,config:{},configFactories:[n=>({callbacks:[new hn({config:n,onStart:e,onEnd:t,onError:r})]})]})}asTool(e){var t,r,n,a,i;let o,s;return t=this,o=(r=e).name??t.getName(),s=r.description??(h9(n=r.schema)?h6.get(n)?.description:h8(n)||"description"in n&&"string"==typeof n.description?n.description:void 0),new vg(!(!(i=a=r.schema)||"object"!=typeof i||Array.isArray(i))&&(h9(i)||h8(i))&&(h8(a)?"ZodString"===a._def.typeName:!!h9(a)&&"string"===a._zod.def.type)?{name:o,description:s,schema:vn.object({input:vn.string()}).transform(e=>e.input),bound:t}:{name:o,description:s,schema:r.schema,bound:t})}},vo=class e extends vi{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(e){super(e),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){let t=mm(this.config,...e);return mm(t,...this.configFactories?await Promise.all(this.configFactories.map(async e=>await e(t))):[])}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new vs({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,t){return this.bound.invoke(e,await this._mergeConfig(t,this.kwargs))}async batch(e,t,r){let n=Array.isArray(t)?await Promise.all(t.map(async e=>this._mergeConfig(mg(e),this.kwargs))):await this._mergeConfig(mg(t),this.kwargs);return this.bound.batch(e,n,r)}_concatOutputChunks(e,t){return this.bound._concatOutputChunks(e,t)}async *_streamIterator(e,t){yield*this.bound._streamIterator(e,await this._mergeConfig(mg(t),this.kwargs))}async stream(e,t){return this.bound.stream(e,await this._mergeConfig(mg(t),this.kwargs))}async *transform(e,t){yield*this.bound.transform(e,await this._mergeConfig(mg(t),this.kwargs))}streamEvents(e,t,r){let n=this,a=async function*(){yield*n.bound.streamEvents(e,{...await n._mergeConfig(mg(t),n.kwargs),version:t.version},r)};return mw.fromAsyncGenerator(a())}static isRunnableBinding(e){return e.bound&&vi.isRunnable(e.bound)}withListeners({onStart:t,onEnd:r,onError:n}){return new e({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[e=>({callbacks:[new hn({config:e,onStart:t,onEnd:r,onError:n})]})]})}},vs=class extends vo{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(e){super(e),this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(e,t,r){let n=e>1?`retry:attempt:${e}`:void 0;return mb(t,{callbacks:r?.getChild(n)})}async _invoke(e,t,r){return m7(n=>super.invoke(e,this._patchConfigForRetry(n,t,r)),{onFailedAttempt:({error:t})=>this.onFailedAttempt(t,e),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(e,t){return this._callWithConfig(this._invoke.bind(this),e,t)}async _batch(e,t,r,n){let a={};try{await m7(async i=>{let o,s=e.map((e,t)=>t).filter(e=>void 0===a[e.toString()]||a[e.toString()]instanceof Error),l=s.map(t=>e[t]),u=s.map(e=>this._patchConfigForRetry(i,t?.[e],r?.[e])),c=await super.batch(l,u,{...n,returnExceptions:!0});for(let e=0;e<c.length;e+=1){let t=c[e],r=s[e];t instanceof Error&&void 0===o&&((o=t).input=l[e]),a[r.toString()]=t}if(o)throw o;return c},{onFailedAttempt:({error:e})=>this.onFailedAttempt(e,e.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(e){if(n?.returnExceptions!==!0)throw e}return Object.keys(a).sort((e,t)=>parseInt(e,10)-parseInt(t,10)).map(e=>a[parseInt(e,10)])}async batch(e,t,r){return this._batchWithConfig(this._batch.bind(this),e,t,r)}},vl=class e extends vi{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(e){super(e),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,t){let r,n=mg(t),a=await mf(n),i=await a?.handleChainStart(this.toJSON(),va(e,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let o=e;try{let e=[this.first,...this.middle];for(let r=0;r<e.length;r+=1){let a=e[r].invoke(o,mb(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${r+1}`)}));o=await mv(a,t?.signal)}if(t?.signal?.aborted)throw m_(t.signal);r=await this.last.invoke(o,mb(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(e){throw await i?.handleChainError(e),e}return await i?.handleChainEnd(va(r,"output")),r}async batch(e,t,r){let n=this._getOptionsList(t??{},e.length),a=await Promise.all(n.map(mf)),i=await Promise.all(a.map(async(t,r)=>{let a=await t?.handleChainStart(this.toJSON(),va(e[r],"input"),n[r].runId,void 0,void 0,void 0,n[r].runName);return delete n[r].runId,a})),o=e;try{for(let e=0;e<this.steps.length;e+=1){let t=this.steps[e].batch(o,i.map((t,r)=>{let a=t?.getChild(this.omitSequenceTags?void 0:`seq:step:${e+1}`);return mb(n[r],{callbacks:a})}),r);o=await mv(t,n[0]?.signal)}}catch(e){throw await Promise.all(i.map(t=>t?.handleChainError(e))),e}return await Promise.all(i.map(e=>e?.handleChainEnd(va(o,"output")))),o}_concatOutputChunks(e,t){return this.last._concatOutputChunks(e,t)}async *_streamIterator(e,t){let r,n=await mf(t),{runId:a,...i}=t??{},o=await n?.handleChainStart(this.toJSON(),va(e,"input"),a,void 0,void 0,void 0,i?.runName),s=[this.first,...this.middle,this.last],l=!0;async function*u(){yield e}try{let e=s[0].transform(u(),mb(i,{callbacks:o?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let t=1;t<s.length;t+=1){let r=s[t];e=await r.transform(e,mb(i,{callbacks:o?.getChild(this.omitSequenceTags?void 0:`seq:step:${t+1}`)}))}for await(let n of e)if(t?.signal?.throwIfAborted(),yield n,l)if(void 0===r)r=n;else try{r=this._concatOutputChunks(r,n)}catch{r=void 0,l=!1}}catch(e){throw await o?.handleChainError(e),e}await o?.handleChainEnd(va(r,"output"))}getGraph(e){let t=new y6,r=null;return this.steps.forEach((n,a)=>{let i=n.getGraph(e);0!==a&&i.trimFirstNode(),a!==this.steps.length-1&&i.trimLastNode(),t.extend(i);let o=i.firstNode();if(!o)throw Error(`Runnable ${n} has no first node`);r&&t.addEdge(r,o),r=i.lastNode()}),t}pipe(t){return new e(e.isRunnableSequence(t)?{first:this.first,middle:this.middle.concat([this.last,t.first,...t.middle]),last:t.last,name:this.name??t.name}:{first:this.first,middle:[...this.middle,this.last],last:vf(t),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&vi.isRunnable(e)}static from([t,...r],n){let a={};return"string"==typeof n?a.name=n:void 0!==n&&(a=n),new e({...a,first:vf(t),middle:r.slice(0,-1).map(vf),last:vf(r[r.length-1])})}},vu=class e extends vi{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(e){for(const[t,r]of(super(e),this.steps={},Object.entries(e.steps)))this.steps[t]=vf(r)}static from(t){return new e({steps:t})}async invoke(e,t){let r=mg(t),n=await mf(r),a=await n?.handleChainStart(this.toJSON(),{input:e},r.runId,void 0,void 0,void 0,r?.runName);delete r.runId;let i={};try{let n=Object.entries(this.steps).map(async([t,n])=>{i[t]=await n.invoke(e,mb(r,{callbacks:a?.getChild(`map:key:${t}`)}))});await mv(Promise.all(n),t?.signal)}catch(e){throw await a?.handleChainError(e),e}return await a?.handleChainEnd(i),i}async *_transform(e,t,r){let n={...this.steps},a=mE(e,Object.keys(n).length),i=new Map(Object.entries(n).map(([e,n],i)=>{let o=n.transform(a[i],mb(r,{callbacks:t?.getChild(`map:key:${e}`)}));return[e,o.next().then(t=>({key:e,gen:o,result:t}))]}));for(;i.size;){let e=Promise.race(i.values()),{key:t,result:n,gen:a}=await mv(e,r?.signal);i.delete(t),n.done||(yield{[t]:n.value},i.set(t,a.next().then(e=>({key:t,gen:a,result:e}))))}}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=mg(t),a=new mS({generator:this.transform(r(),n),config:n});return await a.setup,mw.fromAsyncGenerator(a)}},vc=class e extends vi{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(e){if(super(e),!f3(e.func))throw Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,t){let[r]=this._getOptionsList(t??{},1),n=await mf(r);return mv(this.func(mb(r,{callbacks:n}),e),r?.signal)}async *_streamIterator(e,t){let[r]=this._getOptionsList(t??{},1),n=await this.invoke(e,t);if(ve(n)){for await(let e of n)r?.signal?.throwIfAborted(),yield e;return}if(null!=n&&"object"==typeof n&&"next"in n&&"function"==typeof n.next){for(;;){r?.signal?.throwIfAborted();let e=n.next();if(e.done)break;yield e.value}return}yield n}static from(t){return new e({func:t})}},vd=class e extends vi{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(e){if(f3(e.func))return vc.from(e.func);super(e),function(e){if(f3(e))throw Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}(e.func),this.func=e.func}static from(t){return new e({func:t})}async _invoke(e,t,r){return new Promise((n,a)=>{let i=mb(t,{callbacks:r?.getChild(),recursionLimit:(t?.recursionLimit??25)-1});mp.runWithConfig(my(i),async()=>{try{let r=await this.func(e,{...i});if(r&&vi.isRunnable(r)){if(t?.recursionLimit===0)throw Error("Recursion limit reached.");r=await r.invoke(e,{...i,recursionLimit:(i.recursionLimit??25)-1})}else if(ve(r)){let e;for await(let n of vr(i,r))if(t?.signal?.throwIfAborted(),void 0===e)e=n;else try{e=this._concatOutputChunks(e,n)}catch{e=n}r=e}else if(y7(r)){let e;for(let n of vt(i,r))if(t?.signal?.throwIfAborted(),void 0===e)e=n;else try{e=this._concatOutputChunks(e,n)}catch{e=n}r=e}n(r)}catch(e){a(e)}})})}async invoke(e,t){return this._callWithConfig(this._invoke.bind(this),e,t)}async *_transform(e,t,r){let n;for await(let t of e)if(void 0===n)n=t;else try{n=this._concatOutputChunks(n,t)}catch{n=t}let a=mb(r,{callbacks:t?.getChild(),recursionLimit:(r?.recursionLimit??25)-1}),i=await new Promise((e,t)=>{mp.runWithConfig(my(a),async()=>{try{let t=await this.func(n,{...a,config:a});e(t)}catch(e){t(e)}})});if(i&&vi.isRunnable(i)){if(r?.recursionLimit===0)throw Error("Recursion limit reached.");for await(let e of(await i.stream(n,a)))yield e}else if(ve(i))for await(let e of vr(a,i))r?.signal?.throwIfAborted(),yield e;else if(y7(i))for(let e of vt(a,i))r?.signal?.throwIfAborted(),yield e;else yield i}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=mg(t),a=new mS({generator:this.transform(r(),n),config:n});return await a.setup,mw.fromAsyncGenerator(a)}},vp=class extends vi{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(e){super(e),this.runnable=e.runnable,this.fallbacks=e.fallbacks}*runnables(){for(let e of(yield this.runnable,this.fallbacks))yield e}async invoke(e,t){let r=mg(t),n=await mf(r),{runId:a,...i}=r,o=await n?.handleChainStart(this.toJSON(),va(e,"input"),a,void 0,void 0,void 0,i?.runName),s=mb(i,{callbacks:o?.getChild()});return await mp.runWithConfig(s,async()=>{let t;for(let n of this.runnables()){r?.signal?.throwIfAborted();try{let t=await n.invoke(e,s);return await o?.handleChainEnd(va(t,"output")),t}catch(e){void 0===t&&(t=e)}}if(void 0===t)throw Error("No error stored at end of fallback.");throw await o?.handleChainError(t),t})}async *_streamIterator(e,t){let r,n,a,i=mg(t),o=await mf(i),{runId:s,...l}=i,u=await o?.handleChainStart(this.toJSON(),va(e,"input"),s,void 0,void 0,void 0,l?.runName);for(let t of this.runnables()){i?.signal?.throwIfAborted();let a=mb(l,{callbacks:u?.getChild()});try{let r=await t.stream(e,a);n=vr(a,r);break}catch(e){void 0===r&&(r=e)}}if(void 0===n){let e=r??Error("No error stored at end of fallback.");throw await u?.handleChainError(e),e}try{for await(let e of n){yield e;try{a=void 0===a?a:this._concatOutputChunks(a,e)}catch{a=void 0}}}catch(e){throw await u?.handleChainError(e),e}await u?.handleChainEnd(va(a,"output"))}async batch(e,t,r){let n;if(r?.returnExceptions)throw Error("Not implemented.");let a=this._getOptionsList(t??{},e.length),i=await Promise.all(a.map(e=>mf(e))),o=await Promise.all(i.map(async(t,r)=>{let n=await t?.handleChainStart(this.toJSON(),va(e[r],"input"),a[r].runId,void 0,void 0,void 0,a[r].runName);return delete a[r].runId,n}));for(let t of this.runnables()){a[0].signal?.throwIfAborted();try{let n=await t.batch(e,o.map((e,t)=>mb(a[t],{callbacks:e?.getChild()})),r);return await Promise.all(o.map((e,t)=>e?.handleChainEnd(va(n[t],"output")))),n}catch(e){void 0===n&&(n=e)}}if(!n)throw Error("No error stored at end of fallbacks.");throw await Promise.all(o.map(e=>e?.handleChainError(n))),n}};function vf(e){if("function"==typeof e)return new vd({func:e});if(vi.isRunnable(e))return e;if(Array.isArray(e)||"object"!=typeof e)throw Error(`Expected a Runnable, function or object.
|
|
68
68
|
Instead got an unsupported type.`);{let t={};for(let[r,n]of Object.entries(e))t[r]=vf(n);return new vu({steps:t})}}var vm=class extends vi{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(e){e instanceof vu&&(e={mapper:e}),super(e),this.mapper=e.mapper}async invoke(e,t){let r=await this.mapper.invoke(e,t);return{...e,...r}}async *_transform(e,t,r){let n=this.mapper.getStepsKeys(),[a,i]=mE(e),o=this.mapper.transform(i,mb(r,{callbacks:t?.getChild()})),s=o.next();for await(let e of a){if("object"!=typeof e||Array.isArray(e))throw Error(`RunnableAssign can only be used with objects as input, got ${typeof e}`);let t=Object.fromEntries(Object.entries(e).filter(([e])=>!n.includes(e)));Object.keys(t).length>0&&(yield t)}for await(let e of(yield(await s).value,o))yield e}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=mg(t),a=new mS({generator:this.transform(r(),n),config:n});return await a.setup,mw.fromAsyncGenerator(a)}},vh=class extends vi{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(e){("string"==typeof e||Array.isArray(e))&&(e={keys:e}),super(e),this.keys=e.keys}async _pick(e){if("string"==typeof this.keys)return e[this.keys];{let t=this.keys.map(t=>[t,e[t]]).filter(e=>void 0!==e[1]);return 0===t.length?void 0:Object.fromEntries(t)}}async invoke(e,t){return this._callWithConfig(this._pick.bind(this),e,t)}async *_transform(e){for await(let t of e){let e=await this._pick(t);void 0!==e&&(yield e)}}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=mg(t),a=new mS({generator:this.transform(r(),n),config:n});return await a.setup,mw.fromAsyncGenerator(a)}},vg=class extends vo{name;description;schema;constructor(e){super({bound:vl.from([vd.from(async e=>{let t;if(cz(e))try{t=await h7(this.schema,e.args)}catch{throw new cB("Received tool input did not match expected schema",JSON.stringify(e.args))}else t=e;return t}).withConfig({runName:`${e.name}:parse_input`}),e.bound]).withConfig({runName:e.name}),config:e.config??{}}),this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}};let vb=(e,t)=>{let r=[...new Set(t?.map(e=>{if("string"==typeof e)return e;let t=new e({});if(!("getType"in t)||"function"!=typeof t.getType)throw Error("Invalid type provided.");return t.getType()}))],n=e.getType();return r.some(e=>e===n)};function vy(e,t){return Array.isArray(e)?vv(e,t):vd.from(t=>vv(t,e))}function vv(e,t={}){let{includeNames:r,excludeNames:n,includeTypes:a,excludeTypes:i,includeIds:o,excludeIds:s}=t,l=[];for(let t of e)if(!(n&&t.name&&n.includes(t.name))){if(i&&vb(t,i))continue;if(s&&t.id&&s.includes(t.id))continue;a||o||r?r&&t.name&&r.some(e=>e===t.name)||a&&vb(t,a)?l.push(t):o&&t.id&&o.some(e=>e===t.id)&&l.push(t):l.push(t)}return l}function v_(e){return Array.isArray(e)?vw(e):vd.from(vw)}function vw(e){if(!e.length)return[];let t=[];for(let r of e){let e=t.pop();if(e)if("tool"===r.getType()||r.getType()!==e.getType())t.push(e,r);else{let n=dt(e),a=dt(r),i=n.concat(a);"string"==typeof n.content&&"string"==typeof a.content&&(i.content=`${n.content}
|
|
69
69
|
${a.content}`),t.push(function(e){let t,r=e.getType(),n=Object.fromEntries(Object.entries(e).filter(([e])=>!["type","tool_call_chunks"].includes(e)&&!e.startsWith("lc_")));if(r in vT&&(t=vA(r,n)),!t)throw Error(`Unrecognized message chunk class ${r}. Supported classes are ${Object.keys(vT)}`);return t}(i))}else t.push(r)}return t}function vE(e,t){if(!Array.isArray(e))return vd.from(t=>vx(t,e)).withConfig({runName:"trim_messages"});if(!t)throw Error("Options parameter is required when providing messages.");return vx(e,t)}async function vx(e,t){let r,{maxTokens:n,tokenCounter:a,strategy:i="last",allowPartial:o=!1,endOn:s,startOn:l,includeSystem:u=!1,textSplitter:c}=t;if(l&&"first"===i)throw Error("`startOn` should only be specified if `strategy` is 'last'.");if(u&&"first"===i)throw Error("`includeSystem` should only be specified if `strategy` is 'last'.");r="getNumTokens"in a?async e=>(await Promise.all(e.map(e=>a.getNumTokens(e.content)))).reduce((e,t)=>e+t,0):async e=>a(e);let d=vN;if(c&&(d="splitText"in c?c.splitText:async e=>c(e)),"first"===i)return vS(e,{maxTokens:n,tokenCounter:r,textSplitter:d,partialStrategy:o?"first":void 0,endOn:s});if("last"===i)return vk(e,{maxTokens:n,tokenCounter:r,textSplitter:d,allowPartial:o,includeSystem:u,startOn:l,endOn:s});throw Error(`Unrecognized strategy: '${i}'. Must be one of 'first' or 'last'.`)}async function vS(e,t){let{maxTokens:r,tokenCounter:n,textSplitter:a,partialStrategy:i,endOn:o}=t,s=[...e],l=0;for(let e=0;e<s.length;e+=1){let t=e>0?s.slice(0,-e):s;if(await n(t)<=r){l=s.length-e;break}}if(l<s.length&&i){let e=!1;if(Array.isArray(s[l].content)){let t=s[l];if("string"==typeof t.content)throw Error("Expected content to be an array.");let a=t.content.length,o="last"===i?[...t.content].reverse():t.content;for(let u=1;u<=a;u+=1){let a="first"===i?o.slice(0,u):o.slice(-u),c=Object.fromEntries(Object.entries(t).filter(([e])=>"type"!==e&&!e.startsWith("lc_"))),d=vA(t.getType(),{...c,content:a}),p=[...s.slice(0,l),d];if(await n(p)<=r)s=p,l+=1,e=!0;else break}e&&"last"===i&&(t.content=[...o].reverse())}if(!e){let e,t=s[l];if(Array.isArray(t.content)&&t.content.some(e=>"string"==typeof e||"text"===e.type)){let r=t.content.find(e=>"text"===e.type&&e.text);e=r?.text}else"string"==typeof t.content&&(e=t.content);if(e){let o=await a(e),u=o.length;"last"===i&&o.reverse();for(let e=0;e<u-1;e+=1)if(o.pop(),t.content=o.join(""),await n([...s.slice(0,l),t])<=r){"last"===i&&(t.content=[...o].reverse().join("")),s=[...s.slice(0,l),t],l+=1;break}}}}if(o){let e=Array.isArray(o)?o:[o];for(;l>0&&!vb(s[l-1],e);)l-=1}return s.slice(0,l)}async function vk(e,t){let{allowPartial:r=!1,includeSystem:n=!1,endOn:a,startOn:i,...o}=t,s=e.map(e=>{let t=Object.fromEntries(Object.entries(e).filter(([e])=>"type"!==e&&!e.startsWith("lc_")));return vA(e.getType(),t,cp(e))});if(a){let e=Array.isArray(a)?a:[a];for(;s.length>0&&!vb(s[s.length-1],e);)s=s.slice(0,-1)}let l=n&&s[0]?.getType()==="system",u=l?s.slice(0,1).concat(s.slice(1).reverse()):s.reverse();return(u=await vS(u,{...o,partialStrategy:r?"last":void 0,endOn:i}),l)?[u[0],...u.slice(1).reverse()]:u.reverse()}let vT={human:{message:cC,messageChunk:cR},ai:{message:cQ,messageChunk:c2},system:{message:cD,messageChunk:cM},developer:{message:cD,messageChunk:cM},tool:{message:cb,messageChunk:cy},function:{message:cT,messageChunk:cA},generic:{message:cE,messageChunk:cx},remove:{message:cP,messageChunk:cP}};function vA(e,t,r){let n,a;switch(e){case"human":r?n=new cR(t):a=new cC(t);break;case"ai":if(r){let e={...t};"tool_calls"in e&&(e={...e,tool_call_chunks:e.tool_calls?.map(e=>({...e,type:"tool_call_chunk",index:void 0,args:JSON.stringify(e.args)}))}),n=new c2(e)}else a=new cQ(t);break;case"system":r?n=new cM(t):a=new cD(t);break;case"developer":r?n=new cM({...t,additional_kwargs:{...t.additional_kwargs,__openai_role__:"developer"}}):a=new cD({...t,additional_kwargs:{...t.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in t)r?n=new cy(t):a=new cb(t);else throw Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(r)n=new cA(t);else{if(!t.name)throw Error("FunctionMessage must have a 'name' field");a=new cT(t)}break;case"generic":if("role"in t)r?n=new cx(t):a=new cE(t);else throw Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw Error(`Unrecognized message type ${e}`)}if(r&&n)return n;if(a)return a;throw Error(`Unrecognized message type ${e}`)}function vN(e){let t=e.split("\n");return Promise.resolve([...t.slice(0,-1).map(e=>`${e}
|
|
70
|
-
`),t[t.length-1]])}let vI=["text","reasoning","tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result","image","video","audio","text-plain","file"];uR({},{AIMessage:()=>cQ,AIMessageChunk:()=>c2,BaseMessage:()=>cn,BaseMessageChunk:()=>cu,ChatMessage:()=>cE,ChatMessageChunk:()=>cx,DEFAULT_MERGE_IGNORE_KEYS:()=>ci,FunctionMessage:()=>cT,FunctionMessageChunk:()=>cA,HumanMessage:()=>cC,HumanMessageChunk:()=>cR,KNOWN_BLOCK_TYPES:()=>vI,RemoveMessage:()=>cP,SystemMessage:()=>cD,SystemMessageChunk:()=>cM,ToolMessage:()=>cb,ToolMessageChunk:()=>cy,_isMessageFieldWithRole:()=>cc,_mergeDicts:()=>co,_mergeLists:()=>cs,_mergeObj:()=>cl,_mergeStatus:()=>cr,coerceMessageLikeToMessage:()=>c6,collapseToolCallChunks:()=>dr,convertToChunk:()=>dt,convertToOpenAIImageBlock:()=>uj,convertToProviderContentBlock:()=>uU,defaultTextSplitter:()=>vN,defaultToolCallParser:()=>cv,filterMessages:()=>vy,getBufferString:()=>c9,iife:()=>c4,isAIMessage:()=>c0,isAIMessageChunk:()=>c1,isBase64ContentBlock:()=>uP,isBaseMessage:()=>cd,isBaseMessageChunk:()=>cp,isChatMessage:()=>cS,isChatMessageChunk:()=>ck,isDataContentBlock:()=>uO,isDirectToolOutput:()=>cg,isFunctionMessage:()=>cN,isFunctionMessageChunk:()=>cI,isHumanMessage:()=>cO,isHumanMessageChunk:()=>cL,isIDContentBlock:()=>uM,isMessage:()=>uz,isOpenAIToolCallArray:()=>ca,isPlainTextContentBlock:()=>uD,isSystemMessage:()=>cj,isSystemMessageChunk:()=>cF,isToolMessage:()=>c_,isToolMessageChunk:()=>cw,isURLContentBlock:()=>uL,mapChatMessagesToStoredMessages:()=>de,mapStoredMessageToChatMessage:()=>c8,mapStoredMessagesToChatMessages:()=>c7,mergeContent:()=>ct,mergeMessageRuns:()=>v_,mergeResponseMetadata:()=>cf,mergeUsageMetadata:()=>ch,parseBase64DataUrl:()=>u$,parseMimeType:()=>uF,trimMessages:()=>vE});var vC=class{chunks={};constructor(){this.chunks={}}add(e,t){e.type.endsWith("MessageChunk")&&(e.type=e.type.slice(0,-12).toLowerCase());let r="remove"===e.type&&null!=e.id?new cP({...e,id:e.id}):c6(e),n=function(e){try{return dt(e)}catch{return null}}(r),{id:a}=n??r;if(!a)return console.warn("No message ID found for chunk, ignoring in state",e),null;if(this.chunks[a]??={},this.chunks[a].metadata=t??this.chunks[a].metadata,n){let e=this.chunks[a].chunk;this.chunks[a].chunk=(cp(e)?e:null)?.concat(n)??n}else this.chunks[a].chunk=r;return a}clear(){this.chunks={}}get(e,t){return null==e||null==this.chunks[e]?null:(null!=t&&(this.chunks[e].index??=t),this.chunks[e])}};let vR=e=>{let{type:t,data:r}=e.toDict();return{...r,type:t}};var vO=class extends Error{constructor(e){super(e.message),this.name=e.name??e.error??"StreamError"}static isStructuredError(e){return"object"==typeof e&&null!=e&&"message"in e}},vL=class{abortRef=new AbortController;messages;listeners=new Set;state;constructor(e){this.messages=e,this.state={isLoading:!1,values:null,error:void 0}}setState=e=>{this.state={...this.state,...e},this.notifyListeners()};notifyListeners=()=>{this.listeners.forEach(e=>e())};subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.state;get isLoading(){return this.state.isLoading}get values(){return this.state.values?.[0]??null}get error(){return this.state.error}setStreamValues=(e,t="stream")=>{if("function"==typeof e){let[r,n]=this.state.values??[null,"stream"],a=e(r,n);this.setState({values:null!=a?[a,t]:null})}else this.setState({values:null!=e?[e,t]:null})};getMutateFn=(e,t)=>r=>{let n={...t,...(this.state.values??[null,"stream"])[0]},a="function"==typeof r?r(n):r;this.setStreamValues({...n,...a},e)};matchEventType=(e,t,r)=>e===t||t.startsWith(`${e}|`);start=async(e,t)=>{if(!this.state.isLoading)try{let r;for await(let{event:n,data:a}of(this.setState({isLoading:!0,error:void 0}),this.abortRef=new AbortController,await e(this.abortRef.signal))){if("error"===n){r=new vO(a);break}let e=n.includes("|")?n.split("|").slice(1):void 0,i=this.getMutateFn("stream",t.initialValues);if("metadata"===n&&t.callbacks.onMetadataEvent?.(a),"events"===n&&t.callbacks.onLangChainEvent?.(a),this.matchEventType("updates",n,a)&&t.callbacks.onUpdateEvent?.(a,{namespace:e,mutate:i}),this.matchEventType("custom",n,a)&&t.callbacks.onCustomEvent?.(a,{namespace:e,mutate:i}),this.matchEventType("checkpoints",n,a)&&t.callbacks.onCheckpointEvent?.(a,{namespace:e}),this.matchEventType("tasks",n,a)&&t.callbacks.onTaskEvent?.(a,{namespace:e}),this.matchEventType("debug",n,a)&&t.callbacks.onDebugEvent?.(a,{namespace:e}),"values"===n&&("__interrupt__"in a?this.setStreamValues(e=>({...e,...a})):this.setStreamValues(a)),this.matchEventType("messages",n,a)){let[e,r]=a,n=this.messages.add(e,r);if(!n){console.warn("Failed to add message to manager, no message ID found");continue}this.setStreamValues(e=>{let r={...t.initialValues,...e},a=t.getMessages(r).slice(),{chunk:i,index:o}=this.messages.get(n,a.length)??{};return i&&null!=o?("remove"===i.getType()?a.splice(o,1):a[o]=vR(i),t.setMessages(r,a)):r})}}if(null!=r)throw r;let n=await t.onSuccess?.();void 0!==n&&this.setStreamValues(n)}catch(e){e instanceof Error&&("AbortError"===e.name||"TimeoutError"===e.name)||(console.error(e),this.setState({error:e}),await t.onError?.(e))}finally{this.setState({isLoading:!1}),this.abortRef=new AbortController,t.onFinish?.()}};stop=async(e,t)=>{this.abortRef.abort(),this.abortRef=new AbortController,t.onStop?.({mutate:this.getMutateFn("stop",e)})};clear=()=>{this.abortRef.abort(),this.abortRef=new AbortController,this.setState({error:void 0,values:null,isLoading:!1}),this.messages.clear()}};let vP=e=>{let[t,r]=(0,Q.useState)(e?.threadId??null),n=(0,Q.useRef)(e?.onThreadId);n.current=e?.onThreadId;let a=(0,Q.useCallback)(e=>{r(e),n.current?.(e)},[]);return e&&"threadId"in e?[e.threadId??null,a]:[t,a]};function vD(e,t,r){return[e["~configHash"],t,r].join(":")}function vM(e){let[t]=(0,Q.useState)("transport"in e);return t?function(e){let[t]=(0,Q.useState)(()=>new vC),[r]=(0,Q.useState)(()=>new vL(t));(0,Q.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot);let[n,a]=vP(e),i=(0,Q.useRef)(n);(0,Q.useEffect)(()=>{i.current!==n&&(i.current=n,r.clear())},[n,r]);let o=t=>{let r=e.messagesKey??"messages";return Array.isArray(t[r])?t[r]:[]},s=(t,r)=>{let n=e.messagesKey??"messages";return{...t,[n]:r}},l=e.initialValues??{},u=async(t,u)=>{let c,d=n;r.setStreamValues(()=>u?.optimisticValues!=null?{...l,..."function"==typeof u.optimisticValues?u.optimisticValues(l):u.optimisticValues}:{...l}),await r.start(async r=>{if(d||(i.current=d=crypto.randomUUID(),a(d)),!d)throw Error("Failed to obtain valid thread ID.");return e.transport.stream({input:t,context:u?.context,command:u?.command,signal:r,config:{...u?.config,configurable:{thread_id:d,...u?.config?.configurable}}})},{getMessages:o,setMessages:s,initialValues:{},callbacks:e,onSuccess:()=>void 0,onError(t){e.onError?.(t,c)}})};return{get values(){return r.values??{}},error:r.error,isLoading:r.isLoading,stop:()=>r.stop(l,{onStop:e.onStop}),submit:u,get interrupt(){if(null!=r.values&&"__interrupt__"in r.values&&Array.isArray(r.values.__interrupt__)){let e=r.values.__interrupt__;if(0===e.length)return{when:"breakpoint"};if(1===e.length)return e[0];return e}return},get messages(){if(!r.values)return[];return o(r.values)}}}(e):function(e){let t,r=(0,Q.useRef)(e.reconnectOnMount),n=(0,Q.useMemo)(()=>{if("u"<typeof window)return null;let e=r.current;return!0===e?window.sessionStorage:"function"==typeof e?e():null},[]),a=(0,Q.useMemo)(()=>e.client??new nP({apiUrl:e.apiUrl,apiKey:e.apiKey,callerOptions:e.callerOptions,defaultHeaders:e.defaultHeaders}),[e.client,e.apiKey,e.apiUrl,e.callerOptions,e.defaultHeaders]),[i]=(0,Q.useState)(()=>new vC),[o]=(0,Q.useState)(()=>new vL(i));(0,Q.useSyncExternalStore)(o.subscribe,o.getSnapshot,o.getSnapshot);let[s,l]=vP(e),u=(0,Q.useRef)([]),c=(0,Q.useCallback)((...e)=>{let t=u.current;for(let r of e)t.includes(r)||t.push(r)},[]),d=null!=e.onUpdateEvent,p=null!=e.onCustomEvent,f=null!=e.onLangChainEvent,m=null!=e.onDebugEvent,h=null!=e.onCheckpointEvent,g=null!=e.onTaskEvent,b=(0,Q.useMemo)(()=>{let e=[];return d&&e.push("updates"),p&&e.push("custom"),f&&e.push("events"),m&&e.push("debug"),h&&e.push("checkpoints"),g&&e.push("tasks"),e},[d,p,f,m,h,g]);(0,Q.useRef)(null).current=o.clear;let y=(0,Q.useRef)(s),v=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{y.current!==s&&(y.current=s,o.clear())},[s,o]);let _="object"==typeof e.fetchStateHistory&&null!=e.fetchStateHistory?e.fetchStateHistory.limit??!1:e.fetchStateHistory??!1,w=function(e,t,r,n){let a=vD(e,t,r),[i,o]=(0,Q.useState)(()=>({key:void 0,data:void 0,error:void 0,isLoading:null!=t})),s=(0,Q.useRef)(e);s.current=e;let l=(0,Q.useRef)(n?.onError);l.current=n?.onError;let u=(0,Q.useCallback)((e,t)=>{if(n.passthrough)return Promise.resolve([]);let r=s.current,a=vD(r,e,t);return null!=e?(o(e=>e.key===a?{...e,isLoading:!0}:{key:a,data:void 0,error:void 0,isLoading:!0}),(function(e,t,r){if(r?.limit===!1)return e.threads.getState(t).then(e=>null==e.checkpoint?[]:[e]);let n="number"==typeof r?.limit?r.limit:10;return e.threads.getHistory(t,{limit:n})})(r,e,{limit:t}).then(e=>(o(t=>t.key!==a?t:{key:a,data:e,error:void 0,isLoading:!1}),e),e=>(o(t=>t.key!==a?t:{key:a,data:t.data,error:e,isLoading:!1}),l.current?.(e),Promise.reject(e)))):(o({key:a,data:void 0,error:void 0,isLoading:!1}),Promise.resolve([]))},[n.passthrough]);return(0,Q.useEffect)(()=>{(null==n.submittingRef.current||n.submittingRef.current!==t)&&u(t,r)},[u,a]),{data:i.data,error:i.error,isLoading:i.isLoading,mutate:e=>u(e??t,r)}}(a,s,_,{passthrough:null!=e.experimental_thread,submittingRef:v,onError:e.onError}),E=e.experimental_thread??w,x=t=>{let r=e.messagesKey??"messages";return Array.isArray(t[r])?t[r]:[]},S=(t,r)=>{let n=e.messagesKey??"messages";return{...t,[n]:r}},[k,T]=(0,Q.useState)(""),A=function(e,t){let{rootSequence:r,paths:n}=function(e){let t=new Set,r={};if(e.length<=1)return{rootSequence:{type:"sequence",items:e.map(e=>({type:"node",value:e,path:[]}))},paths:[]};e.forEach(e=>{let n=e.parent_checkpoint?.checkpoint_id??"$";r[n]??=[],r[n].push(e),e.checkpoint?.checkpoint_id!=null&&t.add(e.checkpoint.checkpoint_id)});let n=(...e)=>e.filter(e=>null!=e).sort((e,t)=>e.localeCompare(t)).at(-1),a=null==r.$?Object.keys(r).filter(e=>!t.has(e)).map(e=>{let t=[e],a=new Set,i=e;for(;t.length>0;){let e=t.shift();if(a.has(e))continue;a.add(e);let o=(r[e]??[]).flatMap(e=>e.checkpoint?.checkpoint_id??[]);i=n(i,...o),t.push(...o)}return{parentId:e,lastId:i}}).sort((e,t)=>e.lastId.localeCompare(t.lastId)).at(-1)?.parentId:void 0;null!=a&&(r.$=r[a]);let i={type:"sequence",items:[]},o=[{id:"$",sequence:i,path:[]}],s=[],l=new Set;for(;o.length>0;){let e,t=o.shift();if(l.has(t.id))continue;l.add(t.id);let n=r[t.id];if(null!=n&&0!==n.length)for(let r of(n.length>1&&(e={type:"fork",items:[]},t.sequence.items.push(e)),n)){let n=r.checkpoint?.checkpoint_id;if(null==n)continue;let{sequence:a}=t,{path:i}=t;null!=e&&(a={type:"sequence",items:[]},e.items.unshift(a),(i=i.slice()).push(n),s.push(i)),a.items.push({type:"node",value:r,path:i}),o.push({id:n,sequence:a,path:i})}}return{rootSequence:i,paths:s}}(t??[]),{history:a,branchByCheckpoint:i}=function(e,t,r){let n=r.split(">"),a={};for(let e of t){let t=e.at(-2)??"$";a[t]??=[],a[t].unshift(e)}let i=[],o={},s=n.slice(),l=[...e.items];for(;l.length>0;){let e=l.shift();if("node"===e.type){i.push(e.value);let t=e.value.checkpoint?.checkpoint_id;if(null==t)continue;o[t]={branch:e.path.join(">"),branchOptions:(e.path.length>0?a[e.path.at(-2)??"$"]??[]:[]).map(e=>e.join(">"))}}if("fork"===e.type){let t=s.shift(),r=null!=t?e.items.findIndex(e=>{let r=e.items.at(0);return!!r&&"node"===r.type&&r.value.checkpoint?.checkpoint_id===t}):-1,n=e.items.at(r)?.items??[];l.push(...n)}}return{history:i,branchByCheckpoint:o}}(r,n,e);return{branchTree:r,flatHistory:a,branchByCheckpoint:i,threadHead:a.at(-1)}}(k,E.data??void 0),N=A.threadHead?.values??e.initialValues??{},I=(()=>{let e=A.threadHead?.tasks?.at(-1)?.error;if(null!=e){try{let t=JSON.parse(e);if(vO.isStructuredError(t))return new vO(t);return t}catch{}return e}})(),C=(t=new Set,x(N).map((e,r)=>{let n=e.id??r,a=function(e,t){for(let r=e.length-1;r>=0;r-=1)if(t(e[r]))return e[r]}(E.data??[],e=>x(e.values).map((e,t)=>e.id??t).includes(n)),i=a?.checkpoint?.checkpoint_id,o=null!=i?A.branchByCheckpoint[i]:void 0;o?.branch?.length||(o=void 0);let s=o?.branchOptions?.flat(2).join(",");return s&&(t.has(s)&&(o=void 0),t.add(s)),{messageId:n.toString(),firstSeenState:a,branch:o?.branch,branchOptions:o?.branchOptions}})),R=async(t,r)=>{let i,c,d=r?.checkpoint?.checkpoint_id;T(null!=d?A.branchByCheckpoint[d]?.branch??"":"");let p=!0===_||"number"==typeof _,f=null!=e.onFinish||p;o.setStreamValues(()=>{let e=f?N:{...N,...o.values};return r?.optimisticValues!=null?{...e,..."function"==typeof r.optimisticValues?r.optimisticValues(e):r.optimisticValues}:{...e}});let m=s;await o.start(async o=>{if(m||(y.current=m=(await a.threads.create({threadId:r?.threadId,metadata:r?.metadata})).thread_id,v.current=m,l(m)),!m)throw Error("Failed to obtain valid thread ID.");v.current=m;let s=[...new Set([...r?.streamMode??[],...u.current,...b])],d=r?.checkpoint??(p?A.threadHead?.checkpoint:void 0)??void 0;r?.checkpoint===null&&(d=void 0),null!=d&&delete d.thread_id;let f=r?.streamResumable??!!n;return a.runs.stream(m,e.assistantId,{input:t,config:r?.config,context:r?.context,command:r?.command,interruptBefore:r?.interruptBefore,interruptAfter:r?.interruptAfter,metadata:r?.metadata,multitaskStrategy:r?.multitaskStrategy,onCompletion:r?.onCompletion,onDisconnect:r?.onDisconnect??(f?"continue":"cancel"),signal:o,checkpoint:d,streamMode:s,streamSubgraphs:r?.streamSubgraphs,streamResumable:f,durability:r?.durability,onRunCreated(t){i={run_id:t.run_id,thread_id:t.thread_id??m},n&&(c=`lg:stream:${m}`,n.setItem(c,i.run_id)),e.onCreated?.(i)}})},{getMessages:x,setMessages:S,initialValues:N,callbacks:e,async onSuccess(){if(c&&n?.removeItem(c),f){let t=await E.mutate(m),r=t?.at(0);if(r)return e.onFinish?.(r,i),null}},onError(t){e.onError?.(t,i)},onFinish(){v.current=null}})},O=async(t,r,i)=>{if(r??="-1",!s)return;let l={thread_id:s,run_id:t};await o.start(async e=>(v.current=s,a.runs.joinStream(s,t,{signal:e,lastEventId:r,streamMode:i?.streamMode})),{getMessages:x,setMessages:S,initialValues:N,callbacks:e,async onSuccess(){n?.removeItem(`lg:stream:${s}`);let t=await E.mutate(s),r=t?.at(0);r&&e.onFinish?.(r,l)},onError(t){e.onError?.(t,l)},onFinish(){v.current=null}})},L=(0,Q.useMemo)(()=>{if(!n||o.isLoading||"u"<typeof window)return;let e=n?.getItem(`lg:stream:${s}`);if(e)return{runId:e,threadId:s}},[n,o.isLoading,s]),P=!!n,D=(0,Q.useRef)({threadId:s,shouldReconnect:P}),M=(0,Q.useRef)(O);M.current=O,(0,Q.useEffect)(()=>{D.current.threadId!==s&&(D.current={threadId:s,shouldReconnect:P})},[s,P]),(0,Q.useEffect)(()=>{L&&D.current.shouldReconnect&&(D.current.shouldReconnect=!1,M.current?.(L.runId))},[L]);let j=o.error??I??E.error,F=o.values??N;return{get values(){return c("values"),F},client:a,assistantId:e.assistantId,error:j,isLoading:o.isLoading,stop:()=>o.stop(N,{onStop:t=>{if(n&&s){let e=n.getItem(`lg:stream:${s}`);e&&a.runs.cancel(s,e),n.removeItem(`lg:stream:${s}`)}e.onStop?.(t)}}),submit:R,joinStream:O,branch:k,setBranch:T,get history(){if(!1===_)throw Error("`fetchStateHistory` must be set to `true` to use `history`");return A.flatHistory},isThreadLoading:E.isLoading&&null==E.data,get experimental_branchTree(){if(!1===_)throw Error("`fetchStateHistory` must be set to `true` to use `experimental_branchTree`");return A.branchTree},get interrupt(){if(null!=F&&"__interrupt__"in F&&Array.isArray(F.__interrupt__)){let e=F.__interrupt__;if(0===e.length)return{when:"breakpoint"};if(1===e.length)return e[0];return e}if(o.isLoading)return;let e=A.threadHead?.tasks?.at(-1)?.interrupts;if(null==e||0===e.length){if(!(A.threadHead?.next??[]).length||null!=j)return;return{when:"breakpoint"}}return e.at(-1)},get messages(){return c("messages-tuple","values"),x(F)},getMessagesMetadata(e,t){c("values");let r=i.get(e.id)?.metadata,n=C?.find(r=>r.messageId===(e.id??t));if(null!=r||null!=n)return{...n,streamMetadata:r}}}}(e)}let vj="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vF=new Uint8Array(16),v$=[];for(let e=0;e<256;++e)v$.push((e+256).toString(16).slice(1));let vU=function(e,t,r){if(vj&&!t&&!e)return vj();let n=(e=e||{}).random||(e.rng||function(){if(!d&&!(d="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return d(vF)})();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return v$[e[t+0]]+v$[e[t+1]]+v$[e[t+2]]+v$[e[t+3]]+"-"+v$[e[t+4]]+v$[e[t+5]]+"-"+v$[e[t+6]]+v$[e[t+7]]+"-"+v$[e[t+8]]+v$[e[t+9]]+"-"+v$[e[t+10]]+v$[e[t+11]]+v$[e[t+12]]+v$[e[t+13]]+v$[e[t+14]]+v$[e[t+15]]}(n)};function vz(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>e&&"object"==typeof e&&"text"in e?String(e.text??""):"").join(""):""}function vB(e){let t=0;for(let r of e){let e=r.content;if("string"==typeof e)t+=e.length;else if(Array.isArray(e))for(let r of e){let e=r?.text;"string"==typeof e&&(t+=e.length)}}return t}function vH(e){if(!e||"object"!=typeof e)return null;try{return JSON.stringify(e.value??null)}catch{return null}}function vG({children:e,activeAssistant:t,onHistoryRevalidate:r,thread:n}){let a=function({activeAssistant:e,onHistoryRevalidate:t,thread:r}){let[n,a]=ec("threadId"),i=nj(),[o,s]=(0,Q.useState)({}),l=vM({assistantId:e?.assistant_id||"",client:i??void 0,reconnectOnMount:!0,threadId:n??null,onThreadId:a,defaultHeaders:{"x-auth-scheme":"langsmith"},fetchStateHistory:!0,onFinish:t,onError:t,onCreated:t,onUpdateEvent:(e,t)=>{let r=t?.namespace;if(!r||0===r.length)return;let n=function(e){let t=[];if(!e||"object"!=typeof e)return t;for(let r of Object.values(e)){let e=r?.messages;if(Array.isArray(e))for(let r of e)if("ai"===r.type&&r.tool_calls&&r.tool_calls.length>0)for(let e of r.tool_calls)t.push({kind:"tool_call",id:e.id??"",name:e.name??"tool",args:e.args&&"object"==typeof e.args?e.args:{}});else if("ai"===r.type){let e=vz(r.content).trim();e&&t.push({kind:"text",text:e})}else"tool"===r.type&&t.push({kind:"tool_result",toolCallId:r.tool_call_id??"",name:r.name??"tool",text:vz(r.content).trim()})}return t}(e);if(0===n.length)return;let a=r.join("|");s(e=>({...e,[a]:[...e[a]??[],...n]}))},experimental_thread:r}),[u,c]=(0,Q.useState)(void 0),[d,p]=(0,Q.useState)(null),[f,m]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e;if(!n){c(void 0),m(null),p(null);return}let t=l.messages.length,r=!1,a=0,o=async()=>{a+=1;try{let s=await i.threads.getState(n);if(r)return;let u=s.values?.messages,d=s.tasks?.at(-1)?.interrupts,f=Array.isArray(d)&&d.length>0?d[d.length-1]:void 0,h=Array.isArray(s.next)&&s.next.length>0;Array.isArray(u)&&u.length>t&&m(u);let g=function(e){if(!e||"object"!=typeof e)return;let t=e.value;if(!t||"object"!=typeof t)return;let r={...t};return"action_requests"in t&&!Array.isArray(t.action_requests)&&(r.action_requests=[]),"review_configs"in t&&!Array.isArray(t.review_configs)&&(r.review_configs=[]),{...e,value:r}}(f);if(g){c(g),p(null),Array.isArray(u)&&m(u);return}if(!h){c(void 0),p(vH(l.interrupt)),Array.isArray(u)&&m(u);return}h&&a<15&&!r&&(e=setTimeout(o,1e3))}catch{!r&&a<15&&(e=setTimeout(o,1e3))}};return o(),()=>{r=!0,e&&clearTimeout(e)}},[n,l.interrupt,l.isLoading,i]);let h=l.interrupt,g=h&&(null===d||vH(h)!==d)?h:u??void 0,b=f&&(f.length>l.messages.length||!l.isLoading&&f.length===l.messages.length&&vB(f)>vB(l.messages))?f:l.messages,y=(0,Q.useCallback)(r=>{c(void 0),m(null),p(null);let n={id:vU(),type:"human",content:r};l.submit({messages:[n]},{optimisticValues:e=>({messages:[...e.messages??[],n]}),config:{...e?.config??{},recursion_limit:100},streamSubgraphs:!0,streamMode:["updates"],streamResumable:!0,onDisconnect:"continue"}),t?.()},[l,e?.config,t]),v=(0,Q.useCallback)(async e=>{n&&await i.threads.updateState(n,{values:{files:e}})},[i,n]),_=(0,Q.useCallback)(e=>{c(void 0),m(null),p(null),l.submit(null,{command:{resume:e},streamSubgraphs:!0,streamMode:["updates"],streamResumable:!0,onDisconnect:"continue"}),t?.()},[l,t]),w=(0,Q.useCallback)(()=>{l.stop()},[l]);return{stream:l,todos:l.values.todos??[],files:l.values.files??{},email:l.values.email,asyncTasks:l.values.async_tasks??{},ui:l.values.ui,setFiles:v,messages:b,isLoading:l.isLoading,isThreadLoading:l.isThreadLoading,interrupt:g,sendMessage:y,stopStream:w,resumeInterrupt:_,subAgentActivity:o}}({activeAssistant:t,onHistoryRevalidate:r,thread:n});return(0,J.jsx)(vV.Provider,{value:a,children:e})}let vV=(0,Q.createContext)(void 0);function vq(){let e=(0,Q.useContext)(vV);if(void 0===e)throw Error("useChatContext must be used within a ChatProvider");return e}let vW=ro("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),vZ=ro("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),vK=ro("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),vY=ro("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),vX=ro("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),vJ=ro("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]),vQ=ro("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),v0=ro("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),v1=ro("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),v2=ro("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),v4=ro("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),v3=ro("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),v5=Q.default.memo(({subAgent:e,onClick:t,isExpanded:r=!0})=>{let n="pending"===e.status;return(0,J.jsx)("div",{className:"w-fit max-w-[70vw] overflow-hidden rounded-lg bg-card",children:(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:t,className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left",children:[(0,J.jsx)("span",{className:"bg-[var(--brand)]/10 flex size-5 shrink-0 items-center justify-center rounded-md text-[var(--brand)]",children:n?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(v3,{className:"size-3.5","aria-hidden":"true"})}),(0,J.jsx)("span",{className:"truncate text-sm font-semibold text-foreground",children:e.subAgentName}),(0,J.jsx)("span",{className:"text-xs font-normal text-muted-foreground",children:"subagent"}),r?(0,J.jsx)(li,{size:14,className:"ml-auto shrink-0 text-muted-foreground"}):(0,J.jsx)(la,{size:14,className:"ml-auto shrink-0 text-muted-foreground"})]})})});v5.displayName="SubAgentIndicator";let v6=ro("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),v9=ro("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),v8=ro("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),v7=Q.createContext(null);function _e(){let e=Q.useContext(v7);if(!e)throw Error("useStreamContext must be used within a LoadExternalComponent");return new Proxy(e,{get:(e,t)=>"meta"===t?e.meta:e.stream[t]})}let _t=new class{cache={};boundCache={};callbacks={};respond(e,t,r){this.cache[e]={comp:t,target:r},this.callbacks[e]?.forEach(e=>e(t,r))}getBoundStore(e){return this.boundCache[e]??={subscribe:t=>(this.callbacks[e]??=[],this.callbacks[e].push(t),()=>{this.callbacks[e]=this.callbacks[e].filter(e=>e!==t)}),getSnapshot:()=>this.cache[e]},this.boundCache[e]}},_r=Symbol.for("LGUI_EXT_STORE"),_n=Symbol.for("LGUI_REQUIRE"),_a=Symbol.for("LGUI_REQUIRE_EXTRA");function _i({stream:e,namespace:t,message:r,meta:n,fallback:a,components:i,...o}){let s=Q.useRef(null),l=Q.useId(),u=`child-shadow-${l}`,c=Q.useMemo(()=>_t.getBoundStore(u),[u]),d=Q.useSyncExternalStore(c.subscribe,c.getSnapshot),p=i?.[r.name],f=null!=p,m=null;(e=>!!Q.isValidElement(e)||null==e||"string"==typeof e||"number"==typeof e||"bigint"==typeof e||"boolean"==typeof e||null!=e&&"object"==typeof e&&Symbol.iterator in e||null!=e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then)(a)?m=a:"object"==typeof a&&null!=a&&(m=a?.[r.name]);let h=t??e.assistantId,g=e.client["~ui"];return(Q.useEffect(()=>{f||g.getComponent(h,r.name).then(e=>{let t=s.current;if(!t)return;let r=t.shadowRoot??t.attachShadow({mode:"open"}),n=document.createRange().createContextualFragment(e.replace("{{shadowRootId}}",u));r.appendChild(n)})},[g,h,r.name,u,f]),f)?(0,J.jsx)(v7.Provider,{value:{stream:e,meta:n},children:Q.createElement(p,r.props)}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{id:u,ref:s,...o}),(0,J.jsx)(v7.Provider,{value:{stream:e,meta:n},children:d?.target!=null?ek.createPortal(Q.createElement(d.comp,r.props),d.target):m})]})}"u">typeof window&&(window[_r]=_t,window[_n]=e=>{if("react"===e)return Q;if("react-dom"===e)return ek;if("react/jsx-runtime"===e)return J;if("@langchain/langgraph-sdk/react"===e)return{useStream:vM};if("@langchain/langgraph-sdk/react-ui"===e)return{useStreamContext:_e,LoadExternalComponent:()=>{throw Error("Nesting LoadExternalComponent is not supported")}};if(null!=window[_a]&&"object"==typeof window[_a]&&e in window[_a])return window[_a][e];throw Error(`Unknown module...: ${e}`)});let _o=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)("textarea",{className:rZ("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));function _s({actionRequest:e,reviewConfig:t,onResume:r,isLoading:n,onSubmitted:a}){let[i,o]=(0,Q.useState)(""),[s,l]=(0,Q.useState)(!1),[u,c]=(0,Q.useState)({}),[d,p]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(!1),h=t?.allowedDecisions??t?.allowed_decisions??["approve","reject","edit"],g=e=>{(0,ek.flushSync)(()=>{m(!0),a&&a()}),r(e)};return f?null:(0,J.jsxs)("div",{className:"w-full rounded-md border border-border bg-muted/30 p-4",children:[(0,J.jsxs)("div",{className:"mb-3 flex items-center gap-2 text-foreground",children:[(0,J.jsx)(v9,{size:16,className:"text-yellow-600 dark:text-yellow-400"}),(0,J.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"Approval Required"})]}),e.description&&(0,J.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:e.description}),(0,J.jsxs)("div",{className:"mb-4 rounded-sm border border-border bg-background p-3",children:[(0,J.jsxs)("div",{className:"mb-2",children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Tool"}),(0,J.jsx)("p",{className:"mt-1 font-mono text-sm font-medium text-foreground",children:e.name})]}),s?(0,J.jsxs)("div",{children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Edit Arguments"}),(0,J.jsx)("div",{className:"mt-2 space-y-3",children:Object.entries(e.args).map(([e,t])=>(0,J.jsxs)("div",{children:[(0,J.jsx)("label",{className:"mb-1 block text-xs font-medium text-foreground",children:e}),(0,J.jsx)(_o,{value:void 0!==u[e]?"string"==typeof u[e]?u[e]:JSON.stringify(u[e],null,2):"string"==typeof t?t:JSON.stringify(t,null,2),onChange:t=>((e,t)=>{try{let r=t.trim().startsWith("{")||t.trim().startsWith("[")?JSON.parse(t):t;c(t=>({...t,[e]:r}))}catch{c(r=>({...r,[e]:t}))}})(e,t.target.value),className:"font-mono text-xs",rows:"string"==typeof t&&t.length<100?2:4,disabled:n})]},e))})]}):(0,J.jsxs)("div",{children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Arguments"}),(0,J.jsx)("pre",{className:"mt-2 overflow-x-auto whitespace-pre-wrap break-all rounded-sm border border-border bg-muted/40 p-2 font-mono text-xs text-foreground",children:JSON.stringify(e.args,null,2)})]})]}),d&&!s&&(0,J.jsxs)("div",{className:"mb-4",children:[(0,J.jsx)("label",{className:"mb-2 block text-xs font-medium text-foreground",children:"Rejection Message (optional)"}),(0,J.jsx)(_o,{value:i,onChange:e=>o(e.target.value),placeholder:"Explain why you're rejecting this action…",className:"text-sm",rows:2,disabled:n})]}),(0,J.jsx)("div",{className:"flex flex-wrap gap-2",children:s?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{l(!1),c({})},disabled:n,children:"Cancel"}),(0,J.jsxs)(na,{type:"button",size:"sm",onClick:()=>{s&&(g({decisions:[{type:"edit",edited_action:{name:e.name,args:u}}]}),l(!1),c({}))},disabled:n,className:"bg-green-600 text-white hover:bg-green-700 dark:bg-green-600 dark:hover:bg-green-700",children:[(0,J.jsx)(ln,{size:14}),n?"Saving…":"Save & Approve"]})]}):d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{p(!1),o("")},disabled:n,children:"Cancel"}),(0,J.jsx)(na,{type:"button",variant:"destructive",size:"sm",onClick:()=>{g({decisions:[{type:"reject",message:i.trim()}]})},disabled:n,children:n?"Rejecting…":"Confirm Reject"})]}):(0,J.jsxs)(J.Fragment,{children:[h.includes("reject")&&(0,J.jsxs)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{d?g({decisions:[{type:"reject",message:i.trim()}]}):p(!0)},disabled:n,className:"text-destructive hover:bg-destructive/10",children:[(0,J.jsx)(rs,{size:14}),"Reject"]}),h.includes("edit")&&(0,J.jsxs)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{l(!0),c(JSON.parse(JSON.stringify(e.args))),p(!1)},disabled:n,children:[(0,J.jsx)(a4,{size:14}),"Edit"]}),h.includes("approve")&&(0,J.jsxs)(na,{type:"button",size:"sm",onClick:()=>{g({decisions:[{type:"approve"}]})},disabled:n,className:rZ("bg-green-600 text-white hover:bg-green-700","dark:bg-green-600 dark:hover:bg-green-700"),children:[(0,J.jsx)(ln,{size:14}),n?"Approving…":"Approve"]})]})})]})}_o.displayName="Textarea";let _l=Q.default.memo(({toolCall:e,uiComponent:t,stream:r,graphId:n,actionRequest:a,actionRequestKey:i,actionRequestSubmitted:o,onActionRequestSubmitted:s,reviewConfig:l,onResume:u,isLoading:c,autoApprove:d,compact:p=!1})=>{let[f,m]=(0,Q.useState)(()=>!!t||!!a&&!d),[h,g]=(0,Q.useState)({}),b=(0,Q.useMemo)(()=>a?`${e.id}:${a.name}:${JSON.stringify(a.args)}`:null,[a,e.id]),y=i??b,[v,_]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{y?_(e=>e&&e!==y?null:e):_(null)},[y]),(0,Q.useEffect)(()=>{t&&m(!0)},[t]);let w=(0,Q.useRef)(a);(0,Q.useEffect)(()=>{let e=!!w.current,t=!!a;!t||e||d?!t&&e&&m(!1):m(!0),w.current=a},[a,d]);let{name:E,args:x,result:S,status:k}=(0,Q.useMemo)(()=>{let t=e.args;return{name:function(e,t){if(!e)return"Unknown Tool";if("ToolSelectionResponse"===e)return"Adaptive tool selection";let r=e.toLowerCase();if("think_tool"===r)return"Reflection";if("read_file"===r||"write_file"===r||"edit_file"===r){let e,n=function(e){if(e&&"object"==typeof e)return e;if("string"==typeof e)try{let t=JSON.parse(e);if(t&&"object"==typeof t)return t}catch{}return{}}(t),a=String(n.path??n.file_path??"");if("/memories"===(e=(a||"").trim())||e.startsWith("/memories/"))return"read_file"===r?"Reading memory":"Updating memory";if("read_file"===r){let e=function(e){let t=(e||"").trim();if(!t.startsWith("/skills/"))return"";let[r]=t.slice(8).split("/");return r||""}(a);if(e)return`Skill: ${e}`}}return e}(e.name,t),args:t&&"object"==typeof t?t:{},result:e.result,status:e.status||"completed"}},[e]),T=(0,Q.useMemo)(()=>{switch(k){case"completed":return(0,J.jsx)(vK,{});case"error":return(0,J.jsx)(v9,{size:14,className:"text-destructive"});case"pending":return(0,J.jsx)(a1,{size:14,className:"animate-spin"});case"interrupted":return(0,J.jsx)(v8,{size:14,className:"text-orange-500"});default:return(0,J.jsx)(v6,{size:14,className:"text-muted-foreground"})}},[k]),A=(0,Q.useCallback)(()=>{m(e=>!e)},[]),N=(0,Q.useCallback)(e=>{g(t=>({...t,[e]:!t[e]}))},[]),I=S||Object.keys(x).length>0,C=o??v===y,R=a&&u&&(!y||!C);return(0,J.jsxs)("div",{className:rZ("w-full overflow-hidden rounded-lg border-none shadow-none outline-none transition-colors duration-200 focus-within:ring-2 focus-within:ring-ring hover:bg-accent",p&&"rounded-md",f&&I&&"bg-accent"),children:[(0,J.jsx)(na,{variant:"ghost",size:"sm",onClick:A,className:rZ("flex w-full items-center justify-between gap-2 border-none px-2 py-2 text-left shadow-none outline-none disabled:cursor-default",p&&"h-auto min-h-8 py-1.5"),disabled:!I,children:(0,J.jsxs)("div",{className:"flex w-full items-center justify-between gap-2",children:[(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[T,(0,J.jsx)("span",{className:rZ("text-[15px] font-medium tracking-[-0.6px] text-foreground",p&&"text-xs tracking-normal"),children:E})]}),I&&(f?(0,J.jsx)(li,{size:14,className:"shrink-0 text-muted-foreground"}):(0,J.jsx)(la,{size:14,className:"shrink-0 text-muted-foreground"}))]})}),f&&I&&(0,J.jsx)("div",{className:rZ("px-4 pb-4",p&&"px-2 pb-2"),children:t&&r&&n?(0,J.jsx)("div",{className:"mt-4",children:(0,J.jsx)(_i,{stream:r,message:t,namespace:n,meta:{status:k,args:x,result:S??"No Result Yet"}},t.id)}):R?(0,J.jsx)("div",{className:"mt-4",children:(0,J.jsx)(_s,{actionRequest:a,reviewConfig:l,onResume:u,isLoading:c,onSubmitted:()=>{_(y),y&&s?.(y),m(!1)}})}):(0,J.jsxs)(J.Fragment,{children:[Object.keys(x).length>0&&(0,J.jsxs)("div",{className:rZ("mt-4",p&&"mt-2"),children:[(0,J.jsx)("h4",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Arguments"}),(0,J.jsx)("div",{className:"space-y-2",children:Object.entries(x).map(([e,t])=>(0,J.jsxs)("div",{className:"rounded-sm border border-border",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>N(e),className:"flex w-full items-center justify-between bg-muted/30 p-2 text-left text-xs font-medium transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[(0,J.jsx)("span",{className:"font-mono",children:e}),h[e]?(0,J.jsx)(li,{size:12,className:"text-muted-foreground"}):(0,J.jsx)(la,{size:12,className:"text-muted-foreground"})]}),h[e]&&(0,J.jsx)("div",{className:rZ("border-t border-border bg-muted/20 p-2",p&&"p-1.5"),children:(0,J.jsx)("pre",{className:rZ("m-0 overflow-x-auto whitespace-pre-wrap break-all font-mono text-xs leading-6 text-foreground",p&&"text-[11px] leading-5"),children:"string"==typeof t?t:JSON.stringify(t,null,2)})})]},e))})]}),S&&(0,J.jsxs)("div",{className:rZ("mt-4",p&&"mt-2"),children:[(0,J.jsx)("h4",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Result"}),(0,J.jsx)("pre",{className:rZ("m-0 overflow-x-auto whitespace-pre-wrap break-all rounded-sm border border-border bg-muted/40 p-2 font-mono text-xs leading-7 text-foreground",p&&"p-1.5 text-[11px] leading-5"),children:"string"==typeof S?S:JSON.stringify(S,null,2)})]})]})})]})});function _u(){}function _c(){}_l.displayName="ToolCallBox";let _d=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_p=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_f={};function _m(e,t){return((t||_f).jsx?_p:_d).test(e)}let _h=/[ \t\n\f\r]/g;function _g(e){return""===e.replace(_h,"")}class _b{constructor(e,t){this.attribute=t,this.property=e}}_b.prototype.attribute="",_b.prototype.booleanish=!1,_b.prototype.boolean=!1,_b.prototype.commaOrSpaceSeparated=!1,_b.prototype.commaSeparated=!1,_b.prototype.defined=!1,_b.prototype.mustUseProperty=!1,_b.prototype.number=!1,_b.prototype.overloadedBoolean=!1,_b.prototype.property="",_b.prototype.spaceSeparated=!1,_b.prototype.space=void 0;let _y=0,_v=_T(),__=_T(),_w=_T(),_E=_T(),_x=_T(),_S=_T(),_k=_T();function _T(){return 2**++_y}e.s(["boolean",0,_v,"booleanish",0,__,"commaOrSpaceSeparated",0,_k,"commaSeparated",0,_S,"number",0,_E,"overloadedBoolean",0,_w,"spaceSeparated",0,_x],744);var _A=e.i(744);let _N=Object.keys(_A);class _I extends _b{constructor(e,t,r,n){let a=-1;if(super(e,t),function(e,t,r){r&&(e[t]=r)}(this,"space",n),"number"==typeof r)for(;++a<_N.length;){const e=_N[a];!function(e,t,r){r&&(e[t]=r)}(this,_N[a],(r&_A[e])===_A[e])}}}function _C(e){return e.toLowerCase()}_I.prototype.defined=!0;let _R=/[A-Z]/g,_O=/-[a-z]/g,_L=/^data[-\w.:]+$/i;function _P(e){return"-"+e.toLowerCase()}function _D(e){return e.charAt(1).toUpperCase()}let _M={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"};class _j{constructor(e,t,r){this.normal=t,this.property=e,r&&(this.space=r)}}function _F(e,t){let r={},n={};for(let t of e)Object.assign(r,t.property),Object.assign(n,t.normal);return new _j(r,n,t)}function _$(e){let t={},r={};for(let[n,a]of Object.entries(e.properties)){let i=new _I(n,e.transform(e.attributes||{},n),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(i.mustUseProperty=!0),t[n]=i,r[_C(n)]=n,r[_C(i.attribute)]=n}return new _j(t,r,e.space)}_j.prototype.normal={},_j.prototype.property={},_j.prototype.space=void 0;let _U=_$({properties:{ariaActiveDescendant:null,ariaAtomic:__,ariaAutoComplete:null,ariaBusy:__,ariaChecked:__,ariaColCount:_E,ariaColIndex:_E,ariaColSpan:_E,ariaControls:_x,ariaCurrent:null,ariaDescribedBy:_x,ariaDetails:null,ariaDisabled:__,ariaDropEffect:_x,ariaErrorMessage:null,ariaExpanded:__,ariaFlowTo:_x,ariaGrabbed:__,ariaHasPopup:null,ariaHidden:__,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_x,ariaLevel:_E,ariaLive:null,ariaModal:__,ariaMultiLine:__,ariaMultiSelectable:__,ariaOrientation:null,ariaOwns:_x,ariaPlaceholder:null,ariaPosInSet:_E,ariaPressed:__,ariaReadOnly:__,ariaRelevant:null,ariaRequired:__,ariaRoleDescription:_x,ariaRowCount:_E,ariaRowIndex:_E,ariaRowSpan:_E,ariaSelected:__,ariaSetSize:_E,ariaSort:null,ariaValueMax:_E,ariaValueMin:_E,ariaValueNow:_E,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function _z(e,t){return t in e?e[t]:t}function _B(e,t){return _z(e,t.toLowerCase())}let _H=_$({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_S,acceptCharset:_x,accessKey:_x,action:null,allow:null,allowFullScreen:_v,allowPaymentRequest:_v,allowUserMedia:_v,alt:null,as:null,async:_v,autoCapitalize:null,autoComplete:_x,autoFocus:_v,autoPlay:_v,blocking:_x,capture:null,charSet:null,checked:_v,cite:null,className:_x,cols:_E,colSpan:null,content:null,contentEditable:__,controls:_v,controlsList:_x,coords:_E|_S,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_v,defer:_v,dir:null,dirName:null,disabled:_v,download:_w,draggable:__,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_v,formTarget:null,headers:_x,height:_E,hidden:_w,high:_E,href:null,hrefLang:null,htmlFor:_x,httpEquiv:_x,id:null,imageSizes:null,imageSrcSet:null,inert:_v,inputMode:null,integrity:null,is:null,isMap:_v,itemId:null,itemProp:_x,itemRef:_x,itemScope:_v,itemType:_x,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_v,low:_E,manifest:null,max:null,maxLength:_E,media:null,method:null,min:null,minLength:_E,multiple:_v,muted:_v,name:null,nonce:null,noModule:_v,noValidate:_v,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:_v,optimum:_E,pattern:null,ping:_x,placeholder:null,playsInline:_v,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_v,referrerPolicy:null,rel:_x,required:_v,reversed:_v,rows:_E,rowSpan:_E,sandbox:_x,scope:null,scoped:_v,seamless:_v,selected:_v,shadowRootClonable:_v,shadowRootDelegatesFocus:_v,shadowRootMode:null,shape:null,size:_E,sizes:null,slot:null,span:_E,spellCheck:__,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:_v,useMap:null,value:__,width:_E,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_x,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:_v,declare:_v,event:null,face:null,frame:null,frameBorder:null,hSpace:_E,leftMargin:_E,link:null,longDesc:null,lowSrc:null,marginHeight:_E,marginWidth:_E,noResize:_v,noHref:_v,noShade:_v,noWrap:_v,object:null,profile:null,prompt:null,rev:null,rightMargin:_E,rules:null,scheme:null,scrolling:__,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:_v,disableRemotePlayback:_v,prefix:null,property:null,results:_E,security:null,unselectable:null},space:"html",transform:_B}),_G=_$({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:_k,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:_x,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:_E,diffuseConstant:_E,direction:null,display:null,dur:null,divisor:_E,dominantBaseline:null,download:_v,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:_S,g2:_S,glyphName:_S,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:_k,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:_x,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_E,pointsAtY:_E,pointsAtZ:_E,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:_k,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:_k,rev:_k,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:_k,requiredFeatures:_k,requiredFonts:_k,requiredFormats:_k,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:_k,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:_k,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:_k,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:_z}),_V=_$({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),_q=_$({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_B}),_W=_$({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),_Z=_F([_U,_H,_V,_q,_W],"html"),_K=_F([_U,_G,_V,_q,_W],"svg");var _Y=e.i(15511);let _X=_Q("end"),_J=_Q("start");function _Q(e){return function(t){let r=t&&t.position&&t.position[e]||{};if("number"==typeof r.line&&r.line>0&&"number"==typeof r.column&&r.column>0)return{line:r.line,column:r.column,offset:"number"==typeof r.offset&&r.offset>-1?r.offset:void 0}}}function _0(e){return e&&"object"==typeof e?"position"in e||"type"in e?_2(e.position):"start"in e||"end"in e?_2(e):"line"in e||"column"in e?_1(e):"":""}function _1(e){return _4(e&&e.line)+":"+_4(e&&e.column)}function _2(e){return _1(e&&e.start)+"-"+_1(e&&e.end)}function _4(e){return e&&"number"==typeof e?e:1}class _3 extends Error{constructor(e,t,r){super(),"string"==typeof t&&(r=t,t=void 0);let n="",a={},i=!1;if(t&&(a="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?n=e:!a.cause&&e&&(i=!0,n=e.message,a.cause=e),!a.ruleId&&!a.source&&"string"==typeof r){const e=r.indexOf(":");-1===e?a.ruleId=r:(a.source=r.slice(0,e),a.ruleId=r.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){const e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=n,this.line=o?o.line:void 0,this.name=_0(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=i&&a.cause&&"string"==typeof a.cause.stack?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}_3.prototype.file="",_3.prototype.name="",_3.prototype.reason="",_3.prototype.message="",_3.prototype.stack="",_3.prototype.column=void 0,_3.prototype.line=void 0,_3.prototype.ancestors=void 0,_3.prototype.cause=void 0,_3.prototype.fatal=void 0,_3.prototype.place=void 0,_3.prototype.ruleId=void 0,_3.prototype.source=void 0;let _5={}.hasOwnProperty,_6=new Map,_9=/[A-Z]/g,_8=new Set(["table","tbody","thead","tfoot","tr"]),_7=new Set(["td","th"]),we="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wt(e,t,r){var n,a,i,o,s,l,u,c,d;let p,f,m,h,g,b,y,v,_,w,E;return"element"===t.type?(n=e,a=t,i=r,f=p=n.schema,"svg"===a.tagName.toLowerCase()&&"html"===p.space&&(n.schema=_K),n.ancestors.push(a),m=wi(n,a.tagName,!1),h=function(e,t){let r,n,a={};for(n in t.properties)if("children"!==n&&_5.call(t.properties,n)){let i=function(e,t,r){let n=function(e,t){let r=_C(t),n=t,a=_b;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&"data"===r.slice(0,4)&&_L.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(_O,_D);n="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!_O.test(e)){let r=e.replace(_R,_P);"-"!==r.charAt(0)&&(r="-"+r),t="data"+r}}a=_I}return new a(n,t)}(e.schema,t);if(!(null==r||"number"==typeof r&&Number.isNaN(r))){var a;let t;if(Array.isArray(r)&&(r=n.commaSeparated?(t={},(""===(a=r)[a.length-1]?[...a,""]:a).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):r.join(" ").trim()),"style"===n.property){let t="object"==typeof r?r:function(e,t){try{return(0,_Y.default)(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};let t=new _3("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=we+"#cannot-parse-style-attribute",t}}(e,String(r));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,r={};for(t in e)_5.call(e,t)&&(r[function(e){let t=e.replace(_9,ws);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return r}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&n.space?_M[n.property]||n.property:n.attribute,r]}}(e,n,t.properties[n]);if(i){let[n,o]=i;e.tableCellAlignToStyle&&"align"===n&&"string"==typeof o&&_7.has(t.tagName)?r=o:a[n]=o}}return r&&((a.style||(a.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r),a}(n,a),g=wa(n,a),_8.has(a.tagName)&&(g=g.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&_g(e.value):_g(e))})),wr(n,h,m,a),wn(h,g),n.ancestors.pop(),n.schema=p,n.create(a,m,h,i)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let r=t.data.estree.body[0];return _u("ExpressionStatement"===r.type),e.evaluater.evaluateExpression(r.expression)}wo(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(o=e,s=t,l=r,y=b=o.schema,"svg"===s.name&&"html"===b.space&&(o.schema=_K),o.ancestors.push(s),v=null===s.name?o.Fragment:wi(o,s.name,!0),_=function(e,t){let r={};for(let n of t.attributes)if("mdxJsxExpressionAttribute"===n.type)if(n.data&&n.data.estree&&e.evaluater){let t=n.data.estree.body[0];_u("ExpressionStatement"===t.type);let a=t.expression;_u("ObjectExpression"===a.type);let i=a.properties[0];_u("SpreadElement"===i.type),Object.assign(r,e.evaluater.evaluateExpression(i.argument))}else wo(e,t.position);else{let a,i=n.name;if(n.value&&"object"==typeof n.value)if(n.value.data&&n.value.data.estree&&e.evaluater){let t=n.value.data.estree.body[0];_u("ExpressionStatement"===t.type),a=e.evaluater.evaluateExpression(t.expression)}else wo(e,t.position);else a=null===n.value||n.value;r[i]=a}return r}(o,s),w=wa(o,s),wr(o,_,v,s),wn(_,w),o.ancestors.pop(),o.schema=b,o.create(s,v,_,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wo(e,t.position)}(e,t):"root"===t.type?(u=e,c=t,d=r,wn(E={},wa(u,c)),u.create(c,u.Fragment,E,d)):"text"===t.type?t.value:void 0}function wr(e,t,r,n){"string"!=typeof r&&r!==e.Fragment&&e.passNode&&(t.node=n)}function wn(e,t){if(t.length>0){let r=t.length>1?t:t[0];r&&(e.children=r)}}function wa(e,t){let r=[],n=-1,a=e.passKeys?new Map:_6;for(;++n<t.children.length;){let i,o=t.children[n];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=a.get(e)||0;i=e+"-"+t,a.set(e,t+1)}}let s=wt(e,o,i);void 0!==s&&r.push(s)}return r}function wi(e,t,r){let n;if(r)if(t.includes(".")){let e,r=t.split("."),a=-1;for(;++a<r.length;){let t=_m(r[a])?{type:"Identifier",name:r[a]}:{type:"Literal",value:r[a]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(a&&"Literal"===t.type),optional:!1}:t}_u(e,"always a result"),n=e}else n=_m(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else n={type:"Literal",value:t};if("Literal"===n.type){let t=n.value;return _5.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(n);wo(e)}function wo(e,t){let r=new _3("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=we+"#cannot-handle-mdx-estrees-without-createevaluater",r}function ws(e){return"-"+e.toLowerCase()}let wl={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"]},wu={};function wc(e,t){let r=t||wu;return wd(e,"boolean"!=typeof r.includeImageAlt||r.includeImageAlt,"boolean"!=typeof r.includeHtml||r.includeHtml)}function wd(e,t,r){var n;if((n=e)&&"object"==typeof n){if("value"in e)return"html"!==e.type||r?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return wp(e.children,t,r)}return Array.isArray(e)?wp(e,t,r):""}function wp(e,t,r){let n=[],a=-1;for(;++a<e.length;)n[a]=wd(e[a],t,r);return n.join("")}function wf(e,t,r,n){let a,i=e.length,o=0;if(t=t<0?-t>i?0:i+t:t>i?i:t,r=r>0?r:0,n.length<1e4)(a=Array.from(n)).unshift(t,r),e.splice(...a);else for(r&&e.splice(t,r);o<n.length;)(a=n.slice(o,o+1e4)).unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function wm(e,t){return e.length>0?(wf(e,e.length,0,t),e):t}let wh={}.hasOwnProperty;function wg(e){let t={},r=-1;for(;++r<e.length;)!function(e,t){let r;for(r in t){let n,a=(wh.call(e,r)?e[r]:void 0)||(e[r]={}),i=t[r];if(i)for(n in i){wh.call(a,n)||(a[n]=[]);let e=i[n];!function(e,t){let r=-1,n=[];for(;++r<t.length;)("after"===t[r].add?e:n).push(t[r]);wf(e,0,0,n)}(a[n],Array.isArray(e)?e:e?[e]:[])}}}(t,e[r]);return t}let wb=wI(/[A-Za-z]/),wy=wI(/[\dA-Za-z]/),wv=wI(/[#-'*+\--9=?A-Z^-~]/);function w_(e){return null!==e&&(e<32||127===e)}let ww=wI(/\d/),wE=wI(/[\dA-Fa-f]/),wx=wI(/[!-/:-@[-`{-~]/);function wS(e){return null!==e&&e<-2}function wk(e){return null!==e&&(e<0||32===e)}function wT(e){return -2===e||-1===e||32===e}let wA=wI(/\p{P}|\p{S}/u),wN=wI(/\s/);function wI(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wC(e,t,r,n){let a=n?n-1:1/0,i=0;return function(n){return wT(n)?(e.enter(r),function n(o){return wT(o)&&i++<a?(e.consume(o),n):(e.exit(r),t(o))}(n)):t(n)}}let wR={tokenize:function(e){let t,r=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wC(e,r,"linePrefix"))},function(r){return e.enter("paragraph"),function r(n){let a=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=a),t=a,function t(n){if(null===n){e.exit("chunkText"),e.exit("paragraph"),e.consume(n);return}return wS(n)?(e.consume(n),e.exit("chunkText"),r):(e.consume(n),t)}(n)}(r)});return r}},wO={tokenize:function(e){let t,r,n,a=this,i=[],o=0;return s;function s(t){if(o<i.length){let r=i[o];return a.containerState=r[1],e.attempt(r[0].continuation,l,u)(t)}return u(t)}function l(e){if(o++,a.containerState._closeFlow){let r;a.containerState._closeFlow=void 0,t&&b();let n=a.events.length,i=n;for(;i--;)if("exit"===a.events[i][0]&&"chunkFlow"===a.events[i][1].type){r=a.events[i][1].end;break}g(o);let s=n;for(;s<a.events.length;)a.events[s][1].end={...r},s++;return wf(a.events,i+1,0,a.events.slice(n)),a.events.length=s,u(e)}return s(e)}function u(r){if(o===i.length){if(!t)return p(r);if(t.currentConstruct&&t.currentConstruct.concrete)return m(r);a.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return a.containerState={},e.check(wL,c,d)(r)}function c(e){return t&&b(),g(o),p(e)}function d(e){return a.parser.lazy[a.now().line]=o!==i.length,n=a.now().offset,m(e)}function p(t){return a.containerState={},e.attempt(wL,f,m)(t)}function f(e){return o++,i.push([a.currentConstruct,a.containerState]),p(e)}function m(n){if(null===n){t&&b(),g(0),e.consume(n);return}return t=t||a.parser.flow(a.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:r}),function t(r){if(null===r){h(e.exit("chunkFlow"),!0),g(0),e.consume(r);return}return wS(r)?(e.consume(r),h(e.exit("chunkFlow")),o=0,a.interrupt=void 0,s):(e.consume(r),t)}(n)}function h(e,i){let s=a.sliceStream(e);if(i&&s.push(null),e.previous=r,r&&(r.next=e),r=e,t.defineSkip(e.start),t.write(s),a.parser.lazy[e.start.line]){let e,r,i=t.events.length;for(;i--;)if(t.events[i][1].start.offset<n&&(!t.events[i][1].end||t.events[i][1].end.offset>n))return;let s=a.events.length,l=s;for(;l--;)if("exit"===a.events[l][0]&&"chunkFlow"===a.events[l][1].type){if(e){r=a.events[l][1].end;break}e=!0}for(g(o),i=s;i<a.events.length;)a.events[i][1].end={...r},i++;wf(a.events,l+1,0,a.events.slice(s)),a.events.length=i}}function g(t){let r=i.length;for(;r-- >t;){let t=i[r];a.containerState=t[1],t[0].exit.call(a,e)}i.length=t}function b(){t.write([null]),r=void 0,t=void 0,a.containerState._closeFlow=void 0}}},wL={tokenize:function(e,t,r){return wC(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},wP={partial:!0,tokenize:function(e,t,r){return function(t){return wT(t)?wC(e,n,"linePrefix")(t):n(t)};function n(e){return null===e||wS(e)?t(e):r(e)}}};class wD{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let r=null==t?1/0:t;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,t,r){this.setCursor(Math.trunc(e));let n=this.right.splice(this.right.length-(t||0),1/0);return r&&wM(this.left,r),n.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),wM(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wM(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);wM(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);wM(this.left,t.reverse())}}}function wM(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function wj(e){let t,r,n,a,i,o,s,l={},u=-1,c=new wD(e);for(;++u<c.length;){for(;u in l;)u=l[u];if(t=c.get(u),u&&"chunkFlow"===t[1].type&&"listItemPrefix"===c.get(u-1)[1].type&&((n=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[n][1].type&&(n+=2),n<o.length&&"content"===o[n][1].type))for(;++n<o.length&&"content"!==o[n][1].type;)"chunkText"===o[n][1].type&&(o[n][1]._isInFirstContentOfListItem=!0,n++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let r,n,a=e.get(t)[1],i=e.get(t)[2],o=t-1,s=[],l=a._tokenizer;!l&&(l=i.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let u=l.events,c=[],d={},p=-1,f=a,m=0,h=0,g=[0];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),!f._tokenizer&&(r=i.sliceStream(f),f.next||r.push(null),n&&l.defineSkip(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(r),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),n=f,f=f.next}for(f=a;++p<u.length;)"exit"===u[p][0]&&"enter"===u[p-1][0]&&u[p][1].type===u[p-1][1].type&&u[p][1].start.line!==u[p][1].end.line&&(h=p+1,g.push(h),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),p=g.length;p--;){let t=u.slice(g[p],g[p+1]),r=s.pop();c.push([r,r+t.length-1]),e.splice(r,2,t)}for(c.reverse(),p=-1;++p<c.length;)d[m+c[p][0]]=m+c[p][1],m+=c[p][1]-c[p][0]-1;return d}(c,u)),u=l[u],s=!0);else if(t[1]._container){for(n=u,r=void 0;n--;)if("lineEnding"===(a=c.get(n))[1].type||"lineEndingBlank"===a[1].type)"enter"===a[0]&&(r&&(c.get(r)[1].type="lineEndingBlank"),a[1].type="lineEnding",r=n);else if("linePrefix"===a[1].type||"listItemIndent"===a[1].type);else break;r&&(t[1].end={...c.get(r)[1].start},(i=c.slice(r,u)).unshift(t),c.splice(r,u-r+1,i))}}return wf(e,0,1/0,c.slice(0)),!s}let wF={resolve:function(e){return wj(e),e},tokenize:function(e,t){let r;return function(t){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),n(t)};function n(t){return null===t?a(t):wS(t)?e.check(w$,i,a)(t):(e.consume(t),n)}function a(r){return e.exit("chunkContent"),e.exit("content"),t(r)}function i(t){return e.consume(t),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,n}}},w$={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wC(e,a,"linePrefix")};function a(a){if(null===a||wS(a))return r(a);let i=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(a):e.interrupt(n.parser.constructs.flow,r,t)(a)}}},wU={tokenize:function(e){let t=this,r=e.attempt(wP,function(n){return null===n?void e.consume(n):(e.enter("lineEndingBlank"),e.consume(n),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r)},e.attempt(this.parser.constructs.flowInitial,n,wC(e,e.attempt(this.parser.constructs.flow,n,e.attempt(wF,n)),"linePrefix")));return r;function n(n){return null===n?void e.consume(n):(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),t.currentConstruct=void 0,r)}}},wz={resolveAll:wV()},wB=wG("string"),wH=wG("text");function wG(e){return{resolveAll:wV("text"===e?wq:void 0),tokenize:function(t){let r=this,n=this.parser.constructs[e],a=t.attempt(n,i,o);return i;function i(e){return l(e)?a(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),s)}function s(e){return l(e)?(t.exit("data"),a(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;let t=n[e],a=-1;if(t)for(;++a<t.length;){let e=t[a];if(!e.previous||e.previous.call(r,r.previous))return!0}return!1}}}}function wV(e){return function(t,r){let n,a=-1;for(;++a<=t.length;)void 0===n?t[a]&&"data"===t[a][1].type&&(n=a,a++):t[a]&&"data"===t[a][1].type||(a!==n+2&&(t[n][1].end=t[a-1][1].end,t.splice(n+2,a-n-2),a=n+2),n=void 0);return e?e(t,r):t}}function wq(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||"lineEnding"===e[r][1].type)&&"data"===e[r-1][1].type){let n,a=e[r-1][1],i=t.sliceStream(a),o=i.length,s=-1,l=0;for(;o--;){let e=i[o];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)n=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){let i={type:r===e.length||n||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:a.start._bufferIndex+s,_index:a.start._index+o,line:a.end.line,column:a.end.column-l,offset:a.end.offset-l},end:{...a.end}};a.end={...i.start},a.start.offset===a.end.offset?Object.assign(a,i):(e.splice(r,0,["enter",i,t],["exit",i,t]),r+=2)}r++}return e}function wW(e){return null===e||wk(e)||wN(e)?1:wA(e)?2:void 0}function wZ(e,t,r){let n=[],a=-1;for(;++a<e.length;){let i=e[a].resolveAll;i&&!n.includes(i)&&(t=i(t,r),n.push(i))}return t}let wK={name:"attention",resolveAll:function(e,t){let r,n,a,i,o,s,l,u,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close){for(r=c;r--;)if("exit"===e[r][0]&&"attentionSequence"===e[r][1].type&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[r][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;s=e[r][1].end.offset-e[r][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;let d={...e[r][1].end},p={...e[c][1].start};wY(d,-s),wY(p,s),i={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:p},a={type:s>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[c][1].start}},n={type:s>1?"strong":"emphasis",start:{...i.start},end:{...o.end}},e[r][1].end={...i.start},e[c][1].start={...o.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=wm(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=wm(l,[["enter",n,t],["enter",i,t],["exit",i,t],["enter",a,t]]),l=wm(l,wZ(t.parser.constructs.insideSpan.null,e.slice(r+1,c),t)),l=wm(l,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",n,t]]),e[c][1].end.offset-e[c][1].start.offset?(u=2,l=wm(l,[["enter",e[c][1],t],["exit",e[c][1],t]])):u=0,wf(e,r-1,c-r+3,l),c=r+l.length-u-2;break}}for(c=-1;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e},tokenize:function(e,t){let r,n=this.parser.constructs.attentionMarkers.null,a=this.previous,i=wW(a);return function(o){return r=o,e.enter("attentionSequence"),function o(s){if(s===r)return e.consume(s),o;let l=e.exit("attentionSequence"),u=wW(s),c=!u||2===u&&i||n.includes(s),d=!i||2===i&&u||n.includes(a);return l._open=!!(42===r?c:c&&(i||!d)),l._close=!!(42===r?d:d&&(u||!c)),t(s)}(o)}}};function wY(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let wX={continuation:{tokenize:function(e,t,r){let n=this;return function(t){return wT(t)?wC(e,a,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):a(t)};function a(n){return e.attempt(wX,t,r)(n)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,r){let n=this;return function(t){if(62===t){let r=n.containerState;return r.open||(e.enter("blockQuote",{_container:!0}),r.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),a}return r(t)};function a(r){return wT(r)?(e.enter("blockQuotePrefixWhitespace"),e.consume(r),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(r))}}},wJ={name:"characterEscape",tokenize:function(e,t,r){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),n};function n(n){return wx(n)?(e.enter("characterEscapeValue"),e.consume(n),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(n)}}},wQ=document.createElement("i");function w0(e){let t="&"+e+";";wQ.innerHTML=t;let r=wQ.textContent;return(59!==r.charCodeAt(r.length-1)||"semi"===e)&&r!==t&&r}let w1={name:"characterReference",tokenize:function(e,t,r){let n,a,i=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),n=31,a=wy,u(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),n=6,a=wE,u):(e.enter("characterReferenceValue"),n=7,a=ww,u(t))}function u(s){if(59===s&&o){let n=e.exit("characterReferenceValue");return a!==wy||w0(i.sliceSerialize(n))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):r(s)}return a(s)&&o++<n?(e.consume(s),u):r(s)}}},w2={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return null===t?r(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a)};function a(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},w4={concrete:!0,name:"codeFenced",tokenize:function(e,t,r){let n,a=this,i={partial:!0,tokenize:function(e,t,r){let i=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),wT(t)?wC(e,l,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===n?(e.enter("codeFencedFenceSequence"),function t(a){return a===n?(i++,e.consume(a),t):i>=s?(e.exit("codeFencedFenceSequence"),wT(a)?wC(e,u,"whitespace")(a):u(a)):r(a)}(t)):r(t)}function u(n){return null===n||wS(n)?(e.exit("codeFencedFence"),t(n)):r(n)}}},o=0,s=0;return function(t){var i;let u;return i=t,o=(u=a.events[a.events.length-1])&&"linePrefix"===u[1].type?u[2].sliceSerialize(u[1],!0).length:0,n=i,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(a){return a===n?(s++,e.consume(a),t):s<3?r(a):(e.exit("codeFencedFenceSequence"),wT(a)?wC(e,l,"whitespace")(a):l(a))}(i)};function l(i){return null===i||wS(i)?(e.exit("codeFencedFence"),a.interrupt?t(i):e.check(w2,c,m)(i)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(a){return null===a||wS(a)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(a)):wT(a)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),wC(e,u,"whitespace")(a)):96===a&&a===n?r(a):(e.consume(a),t)}(i))}function u(t){return null===t||wS(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(a){return null===a||wS(a)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(a)):96===a&&a===n?r(a):(e.consume(a),t)}(t))}function c(t){return e.attempt(i,m,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p}function p(t){return o>0&&wT(t)?wC(e,f,"linePrefix",o+1)(t):f(t)}function f(t){return null===t||wS(t)?e.check(w2,c,m)(t):(e.enter("codeFlowValue"),function t(r){return null===r||wS(r)?(e.exit("codeFlowValue"),f(r)):(e.consume(r),t)}(t))}function m(r){return e.exit("codeFenced"),t(r)}}},w3={name:"codeIndented",tokenize:function(e,t,r){let n=this;return function(t){return e.enter("codeIndented"),wC(e,a,"linePrefix",5)(t)};function a(t){let a=n.events[n.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?function t(r){return null===r?i(r):wS(r)?e.attempt(w5,t,i)(r):(e.enter("codeFlowValue"),function r(n){return null===n||wS(n)?(e.exit("codeFlowValue"),t(n)):(e.consume(n),r)}(r))}(t):r(t)}function i(r){return e.exit("codeIndented"),t(r)}}},w5={partial:!0,tokenize:function(e,t,r){let n=this;return a;function a(t){return n.parser.lazy[n.now().line]?r(t):wS(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):wC(e,i,"linePrefix",5)(t)}function i(e){let i=n.events[n.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(e):wS(e)?a(e):r(e)}}};function w6(e,t,r,n,a,i,o,s,l){let u=l||1/0,c=0;return function(t){return 60===t?(e.enter(n),e.enter(a),e.enter(i),e.consume(t),e.exit(i),d):null===t||32===t||41===t||w_(t)?r(t):(e.enter(n),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),m(t))};function d(r){return 62===r?(e.enter(i),e.consume(r),e.exit(i),e.exit(a),e.exit(n),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(r))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(s),d(t)):null===t||60===t||wS(t)?r(t):(e.consume(t),92===t?f:p)}function f(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function m(a){return!c&&(null===a||41===a||wk(a))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(n),t(a)):c<u&&40===a?(e.consume(a),c++,m):41===a?(e.consume(a),c--,m):null===a||32===a||40===a||w_(a)?r(a):(e.consume(a),92===a?h:m)}function h(t){return 40===t||41===t||92===t?(e.consume(t),m):m(t)}}function w9(e,t,r,n,a,i){let o,s=this,l=0;return function(t){return e.enter(n),e.enter(a),e.consume(t),e.exit(a),e.enter(i),u};function u(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?r(d):93===d?(e.exit(i),e.enter(a),e.consume(d),e.exit(a),e.exit(n),t):wS(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(t){return null===t||91===t||93===t||wS(t)||l++>999?(e.exit("chunkString"),u(t)):(e.consume(t),o||(o=!wT(t)),92===t?d:c)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}}function w8(e,t,r,n,a,i){let o;return function(t){return 34===t||39===t||40===t?(e.enter(n),e.enter(a),e.consume(t),e.exit(a),o=40===t?41:t,s):r(t)};function s(r){return r===o?(e.enter(a),e.consume(r),e.exit(a),e.exit(n),t):(e.enter(i),l(r))}function l(t){return t===o?(e.exit(i),s(o)):null===t?r(t):wS(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wC(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===o||null===t||wS(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return t===o||92===t?(e.consume(t),u):u(t)}}function w7(e,t){let r;return function n(a){return wS(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,n):wT(a)?wC(e,n,r?"linePrefix":"lineSuffix")(a):t(a)}}function Ee(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let Et={partial:!0,tokenize:function(e,t,r){return function(t){return wk(t)?w7(e,n)(t):r(t)};function n(t){return w8(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function a(t){return wT(t)?wC(e,i,"whitespace")(t):i(t)}function i(e){return null===e||wS(e)?t(e):r(e)}}},Er=["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"],En=["pre","script","style","textarea"],Ea={partial:!0,tokenize:function(e,t,r){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),e.attempt(wP,t,r)}}},Ei={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return wS(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):r(t)};function a(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},Eo={name:"labelEnd",resolveAll:function(e){let t=-1,r=[];for(;++t<e.length;){let n=e[t][1];if(r.push(e[t]),"labelImage"===n.type||"labelLink"===n.type||"labelEnd"===n.type){let e="labelImage"===n.type?4:2;n.type="data",t+=e}}return e.length!==r.length&&wf(e,0,e.length,r),e},resolveTo:function(e,t){let r,n,a,i,o=e.length,s=0;for(;o--;)if(r=e[o][1],n){if("link"===r.type||"labelLink"===r.type&&r._inactive)break;"enter"===e[o][0]&&"labelLink"===r.type&&(r._inactive=!0)}else if(a){if("enter"===e[o][0]&&("labelImage"===r.type||"labelLink"===r.type)&&!r._balanced&&(n=o,"labelLink"!==r.type)){s=2;break}}else"labelEnd"===r.type&&(a=o);let l={type:"labelLink"===e[n][1].type?"link":"image",start:{...e[n][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[n][1].start},end:{...e[a][1].end}},c={type:"labelText",start:{...e[n+s+2][1].end},end:{...e[a-2][1].start}};return i=wm(i=[["enter",l,t],["enter",u,t]],e.slice(n+1,n+s+3)),i=wm(i,[["enter",c,t]]),i=wm(i,wZ(t.parser.constructs.insideSpan.null,e.slice(n+s+4,a-3),t)),i=wm(i,[["exit",c,t],e[a-2],e[a-1],["exit",u,t]]),i=wm(i,e.slice(a+1)),i=wm(i,[["exit",l,t]]),wf(e,n,e.length,i),e},tokenize:function(e,t,r){let n,a,i=this,o=i.events.length;for(;o--;)if(("labelImage"===i.events[o][1].type||"labelLink"===i.events[o][1].type)&&!i.events[o][1]._balanced){n=i.events[o][1];break}return function(t){return n?n._inactive?c(t):(a=i.parser.defined.includes(Ee(i.sliceSerialize({start:n.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):r(t)};function s(t){return 40===t?e.attempt(Es,u,a?u:c)(t):91===t?e.attempt(El,u,a?l:c)(t):a?u(t):c(t)}function l(t){return e.attempt(Eu,u,c)(t)}function u(e){return t(e)}function c(e){return n._balanced=!0,r(e)}}},Es={tokenize:function(e,t,r){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),n};function n(t){return wk(t)?w7(e,a)(t):a(t)}function a(t){return 41===t?u(t):w6(e,i,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function i(t){return wk(t)?w7(e,s)(t):u(t)}function o(e){return r(e)}function s(t){return 34===t||39===t||40===t?w8(e,l,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):u(t)}function l(t){return wk(t)?w7(e,u)(t):u(t)}function u(n){return 41===n?(e.enter("resourceMarker"),e.consume(n),e.exit("resourceMarker"),e.exit("resource"),t):r(n)}}},El={tokenize:function(e,t,r){let n=this;return function(t){return w9.call(n,e,a,i,"reference","referenceMarker","referenceString")(t)};function a(e){return n.parser.defined.includes(Ee(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(e):r(e)}function i(e){return r(e)}}},Eu={tokenize:function(e,t,r){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),n};function n(n){return 93===n?(e.enter("referenceMarker"),e.consume(n),e.exit("referenceMarker"),e.exit("reference"),t):r(n)}}},Ec={name:"labelStartImage",resolveAll:Eo.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),a};function a(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),i):r(t)}function i(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},Ed={name:"labelStartLink",resolveAll:Eo.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),a};function a(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},Ep={name:"lineEnding",tokenize:function(e,t){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),wC(e,t,"linePrefix")}}},Ef={name:"thematicBreak",tokenize:function(e,t,r){let n,a=0;return function(i){var o;return e.enter("thematicBreak"),n=o=i,function i(o){return o===n?(e.enter("thematicBreakSequence"),function t(r){return r===n?(e.consume(r),a++,t):(e.exit("thematicBreakSequence"),wT(r)?wC(e,i,"whitespace")(r):i(r))}(o)):a>=3&&(null===o||wS(o))?(e.exit("thematicBreak"),t(o)):r(o)}(o)}}},Em={continuation:{tokenize:function(e,t,r){let n=this;return n.containerState._closeFlow=void 0,e.check(wP,function(r){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,wC(e,t,"listItemIndent",n.containerState.size+1)(r)},function(r){return n.containerState.furtherBlankLines||!wT(r)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,a(r)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(Eg,t,a)(r))});function a(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,wC(e,e.attempt(Em,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,r){let n=this,a=n.events[n.events.length-1],i=a&&"linePrefix"===a[1].type?a[2].sliceSerialize(a[1],!0).length:0,o=0;return function(t){let a=n.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===a?!n.containerState.marker||t===n.containerState.marker:ww(t)){if(n.containerState.type||(n.containerState.type=a,e.enter(a,{_container:!0})),"listUnordered"===a)return e.enter("listItemPrefix"),42===t||45===t?e.check(Ef,r,s)(t):s(t);if(!n.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(a){return ww(a)&&++o<10?(e.consume(a),t):(!n.interrupt||o<2)&&(n.containerState.marker?a===n.containerState.marker:41===a||46===a)?(e.exit("listItemValue"),s(a)):r(a)}(t)}return r(t)};function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||t,e.check(wP,n.interrupt?r:l,e.attempt(Eh,c,u))}function l(e){return n.containerState.initialBlankLine=!0,i++,c(e)}function u(t){return wT(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),c):r(t)}function c(r){return n.containerState.size=i+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(r)}}},Eh={partial:!0,tokenize:function(e,t,r){let n=this;return wC(e,function(e){let a=n.events[n.events.length-1];return!wT(e)&&a&&"listItemPrefixWhitespace"===a[1].type?t(e):r(e)},"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},Eg={partial:!0,tokenize:function(e,t,r){let n=this;return wC(e,function(e){let a=n.events[n.events.length-1];return a&&"listItemIndent"===a[1].type&&a[2].sliceSerialize(a[1],!0).length===n.containerState.size?t(e):r(e)},"listItemIndent",n.containerState.size+1)}},Eb={name:"setextUnderline",resolveTo:function(e,t){let r,n,a,i=e.length;for(;i--;)if("enter"===e[i][0]){if("content"===e[i][1].type){r=i;break}"paragraph"===e[i][1].type&&(n=i)}else"content"===e[i][1].type&&e.splice(i,1),a||"definition"!==e[i][1].type||(a=i);let o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[n][1].type="setextHeadingText",a?(e.splice(n,0,["enter",o,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,r){let n,a=this;return function(t){var o;let s,l=a.events.length;for(;l--;)if("lineEnding"!==a.events[l][1].type&&"linePrefix"!==a.events[l][1].type&&"content"!==a.events[l][1].type){s="paragraph"===a.events[l][1].type;break}return!a.parser.lazy[a.now().line]&&(a.interrupt||s)?(e.enter("setextHeadingLine"),n=t,o=t,e.enter("setextHeadingLineSequence"),function t(r){return r===n?(e.consume(r),t):(e.exit("setextHeadingLineSequence"),wT(r)?wC(e,i,"lineSuffix")(r):i(r))}(o)):r(t)};function i(n){return null===n||wS(n)?(e.exit("setextHeadingLine"),t(n)):r(n)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,r){let n,a=this;return function(t){var n;return e.enter("definition"),n=t,w9.call(a,e,i,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(n)};function i(t){return(n=Ee(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):r(t)}function o(t){return wk(t)?w7(e,s)(t):s(t)}function s(t){return w6(e,l,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(Et,u,u)(t)}function u(t){return wT(t)?wC(e,c,"whitespace")(t):c(t)}function c(i){return null===i||wS(i)?(e.exit("definition"),a.parser.defined.push(n),t(i)):r(i)}}}},"disable",0,{null:[]},"document",0,{42:Em,43:Em,45:Em,48:Em,49:Em,50:Em,51:Em,52:Em,53:Em,54:Em,55:Em,56:Em,57:Em,62:wX},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let r,n,a=e.length-2,i=3;return"whitespace"===e[3][1].type&&(i+=2),a-2>i&&"whitespace"===e[a][1].type&&(a-=2),"atxHeadingSequence"===e[a][1].type&&(i===a-1||a-4>i&&"whitespace"===e[a-2][1].type)&&(a-=i+1===a?2:4),a>i&&(r={type:"atxHeadingText",start:e[i][1].start,end:e[a][1].end},n={type:"chunkText",start:e[i][1].start,end:e[a][1].end,contentType:"text"},wf(e,i,a-i+1,[["enter",r,t],["enter",n,t],["exit",n,t],["exit",r,t]])),e},tokenize:function(e,t,r){let n=0;return function(a){var i;return e.enter("atxHeading"),i=a,e.enter("atxHeadingSequence"),function a(i){return 35===i&&n++<6?(e.consume(i),a):null===i||wk(i)?(e.exit("atxHeadingSequence"),function r(n){return 35===n?(e.enter("atxHeadingSequence"),function t(n){return 35===n?(e.consume(n),t):(e.exit("atxHeadingSequence"),r(n))}(n)):null===n||wS(n)?(e.exit("atxHeading"),t(n)):wT(n)?wC(e,r,"whitespace")(n):(e.enter("atxHeadingText"),function t(n){return null===n||35===n||wk(n)?(e.exit("atxHeadingText"),r(n)):(e.consume(n),t)}(n))}(i)):r(i)}(i)}}},42:Ef,45:[Eb,Ef],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(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},tokenize:function(e,t,r){let n,a,i,o,s,l=this;return function(t){var r;return r=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(r),u};function u(o){return 33===o?(e.consume(o),c):47===o?(e.consume(o),a=!0,f):63===o?(e.consume(o),n=3,l.interrupt?t:O):wb(o)?(e.consume(o),i=String.fromCharCode(o),m):r(o)}function c(a){return 45===a?(e.consume(a),n=2,d):91===a?(e.consume(a),n=5,o=0,p):wb(a)?(e.consume(a),n=4,l.interrupt?t:O):r(a)}function d(n){return 45===n?(e.consume(n),l.interrupt?t:O):r(n)}function p(n){let a="CDATA[";return n===a.charCodeAt(o++)?(e.consume(n),o===a.length)?l.interrupt?t:S:p:r(n)}function f(t){return wb(t)?(e.consume(t),i=String.fromCharCode(t),m):r(t)}function m(o){if(null===o||47===o||62===o||wk(o)){let s=47===o,u=i.toLowerCase();return!s&&!a&&En.includes(u)?(n=1,l.interrupt?t(o):S(o)):Er.includes(i.toLowerCase())?(n=6,s)?(e.consume(o),h):l.interrupt?t(o):S(o):(n=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(o):a?function t(r){return wT(r)?(e.consume(r),t):E(r)}(o):g(o))}return 45===o||wy(o)?(e.consume(o),i+=String.fromCharCode(o),m):r(o)}function h(n){return 62===n?(e.consume(n),l.interrupt?t:S):r(n)}function g(t){return 47===t?(e.consume(t),E):58===t||95===t||wb(t)?(e.consume(t),b):wT(t)?(e.consume(t),g):E(t)}function b(t){return 45===t||46===t||58===t||95===t||wy(t)?(e.consume(t),b):y(t)}function y(t){return 61===t?(e.consume(t),v):wT(t)?(e.consume(t),y):g(t)}function v(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),s=t,_):wT(t)?(e.consume(t),v):function t(r){return null===r||34===r||39===r||47===r||60===r||61===r||62===r||96===r||wk(r)?y(r):(e.consume(r),t)}(t)}function _(t){return t===s?(e.consume(t),s=null,w):null===t||wS(t)?r(t):(e.consume(t),_)}function w(e){return 47===e||62===e||wT(e)?g(e):r(e)}function E(t){return 62===t?(e.consume(t),x):r(t)}function x(t){return null===t||wS(t)?S(t):wT(t)?(e.consume(t),x):r(t)}function S(t){return 45===t&&2===n?(e.consume(t),N):60===t&&1===n?(e.consume(t),I):62===t&&4===n?(e.consume(t),L):63===t&&3===n?(e.consume(t),O):93===t&&5===n?(e.consume(t),R):wS(t)&&(6===n||7===n)?(e.exit("htmlFlowData"),e.check(Ea,P,k)(t)):null===t||wS(t)?(e.exit("htmlFlowData"),k(t)):(e.consume(t),S)}function k(t){return e.check(Ei,T,P)(t)}function T(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A}function A(t){return null===t||wS(t)?k(t):(e.enter("htmlFlowData"),S(t))}function N(t){return 45===t?(e.consume(t),O):S(t)}function I(t){return 47===t?(e.consume(t),i="",C):S(t)}function C(t){if(62===t){let r=i.toLowerCase();return En.includes(r)?(e.consume(t),L):S(t)}return wb(t)&&i.length<8?(e.consume(t),i+=String.fromCharCode(t),C):S(t)}function R(t){return 93===t?(e.consume(t),O):S(t)}function O(t){return 62===t?(e.consume(t),L):45===t&&2===n?(e.consume(t),O):S(t)}function L(t){return null===t||wS(t)?(e.exit("htmlFlowData"),P(t)):(e.consume(t),L)}function P(r){return e.exit("htmlFlow"),t(r)}}},61:Eb,95:Ef,96:w4,126:w4},"flowInitial",0,{[-2]:w3,[-1]:w3,32:w3},"insideSpan",0,{null:[wK,wz]},"string",0,{38:w1,92:wJ},"text",0,{[-5]:Ep,[-4]:Ep,[-3]:Ep,33:Ec,38:w1,42:wK,60:[{name:"autolink",tokenize:function(e,t,r){let n=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a};function a(t){return wb(t)?(e.consume(t),i):64===t?r(t):s(t)}function i(t){return 43===t||45===t||46===t||wy(t)?(n=1,function t(r){return 58===r?(e.consume(r),n=0,o):(43===r||45===r||46===r||wy(r))&&n++<32?(e.consume(r),t):(n=0,s(r))}(t)):s(t)}function o(n){return 62===n?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):null===n||32===n||60===n||w_(n)?r(n):(e.consume(n),o)}function s(t){return 64===t?(e.consume(t),l):wv(t)?(e.consume(t),s):r(t)}function l(a){return wy(a)?function a(i){return 46===i?(e.consume(i),n=0,l):62===i?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(i),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(i){if((45===i||wy(i))&&n++<63){let r=45===i?t:a;return e.consume(i),r}return r(i)}(i)}(a):r(a)}}},{name:"htmlText",tokenize:function(e,t,r){let n,a,i,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),_):63===t?(e.consume(t),y):wb(t)?(e.consume(t),E):r(t)}function l(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),a=0,f):wb(t)?(e.consume(t),b):r(t)}function u(t){return 45===t?(e.consume(t),p):r(t)}function c(t){return null===t?r(t):45===t?(e.consume(t),d):wS(t)?(i=c,C(t)):(e.consume(t),c)}function d(t){return 45===t?(e.consume(t),p):c(t)}function p(e){return 62===e?I(e):45===e?d(e):c(e)}function f(t){let n="CDATA[";return t===n.charCodeAt(a++)?(e.consume(t),a===n.length?m:f):r(t)}function m(t){return null===t?r(t):93===t?(e.consume(t),h):wS(t)?(i=m,C(t)):(e.consume(t),m)}function h(t){return 93===t?(e.consume(t),g):m(t)}function g(t){return 62===t?I(t):93===t?(e.consume(t),g):m(t)}function b(t){return null===t||62===t?I(t):wS(t)?(i=b,C(t)):(e.consume(t),b)}function y(t){return null===t?r(t):63===t?(e.consume(t),v):wS(t)?(i=y,C(t)):(e.consume(t),y)}function v(e){return 62===e?I(e):y(e)}function _(t){return wb(t)?(e.consume(t),w):r(t)}function w(t){return 45===t||wy(t)?(e.consume(t),w):function t(r){return wS(r)?(i=t,C(r)):wT(r)?(e.consume(r),t):I(r)}(t)}function E(t){return 45===t||wy(t)?(e.consume(t),E):47===t||62===t||wk(t)?x(t):r(t)}function x(t){return 47===t?(e.consume(t),I):58===t||95===t||wb(t)?(e.consume(t),S):wS(t)?(i=x,C(t)):wT(t)?(e.consume(t),x):I(t)}function S(t){return 45===t||46===t||58===t||95===t||wy(t)?(e.consume(t),S):function t(r){return 61===r?(e.consume(r),k):wS(r)?(i=t,C(r)):wT(r)?(e.consume(r),t):x(r)}(t)}function k(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),n=t,T):wS(t)?(i=k,C(t)):wT(t)?(e.consume(t),k):(e.consume(t),A)}function T(t){return t===n?(e.consume(t),n=void 0,N):null===t?r(t):wS(t)?(i=T,C(t)):(e.consume(t),T)}function A(t){return null===t||34===t||39===t||60===t||61===t||96===t?r(t):47===t||62===t||wk(t)?x(t):(e.consume(t),A)}function N(e){return 47===e||62===e||wk(e)?x(e):r(e)}function I(n){return 62===n?(e.consume(n),e.exit("htmlTextData"),e.exit("htmlText"),t):r(n)}function C(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),R}function R(t){return wT(t)?wC(e,O,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):O(t)}function O(t){return e.enter("htmlTextData"),i(t)}}}],91:Ed,92:[{name:"hardBreakEscape",tokenize:function(e,t,r){return function(t){return e.enter("hardBreakEscape"),e.consume(t),n};function n(n){return wS(n)?(e.exit("hardBreakEscape"),t(n)):r(n)}}},wJ],93:Eo,95:wK,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,r,n=e.length-4,a=3;if(("lineEnding"===e[3][1].type||"space"===e[a][1].type)&&("lineEnding"===e[n][1].type||"space"===e[n][1].type)){for(t=a;++t<n;)if("codeTextData"===e[t][1].type){e[a][1].type="codeTextPadding",e[n][1].type="codeTextPadding",a+=2,n-=2;break}}for(t=a-1,n++;++t<=n;)void 0===r?t!==n&&"lineEnding"!==e[t][1].type&&(r=t):(t===n||"lineEnding"===e[t][1].type)&&(e[r][1].type="codeTextData",t!==r+2&&(e[r][1].end=e[t-1][1].end,e.splice(r+2,t-r-2),n-=t-r-2,t=r+2),r=void 0);return e},tokenize:function(e,t,r){let n,a,i=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(r){return 96===r?(e.consume(r),i++,t):(e.exit("codeTextSequence"),o(r))}(t)};function o(l){return null===l?r(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(a=e.enter("codeTextSequence"),n=0,function r(o){return 96===o?(e.consume(o),n++,r):n===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(a.type="codeTextData",s(o))}(l)):wS(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),s(l))}function s(t){return null===t||32===t||96===t||wS(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var Ey=e.i(4127);let Ev=/[\0\t\n\r]/g;function E_(e,t){let r=Number.parseInt(e,t);return r<9||11===r||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(65535&r)==65535||(65535&r)==65534||r>1114111?"�":String.fromCodePoint(r)}let Ew=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function EE(e,t,r){if(t)return t;if(35===r.charCodeAt(0)){let e=r.charCodeAt(1),t=120===e||88===e;return E_(r.slice(t?2:1),t?16:10)}return w0(r)||e}let Ex={}.hasOwnProperty;function ES(e){return{line:e.line,column:e.column,offset:e.offset}}function Ek(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+_0({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+_0({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+_0({start:t.start,end:t.end})+") is still open")}function ET(e){let t=this;t.parser=function(r){var n,a;let i,o,s,l;return"object"==typeof(n={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(a=n,n=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:n(b),autolinkProtocol:u,autolinkEmail:u,atxHeading:n(m),blockQuote:n(function(){return{type:"blockquote",children:[]}}),characterEscape:u,characterReference:u,codeFenced:n(f),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:n(f,a),codeText:n(function(){return{type:"inlineCode",value:""}},a),codeTextData:u,data:u,codeFlowValue:u,definition:n(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:n(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:n(h),hardBreakTrailing:n(h),htmlFlow:n(g,a),htmlFlowData:u,htmlText:n(g,a),htmlTextData:u,image:n(function(){return{type:"image",title:null,url:"",alt:null}}),label:a,link:n(b),listItem:n(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:n(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:n(y),paragraph:n(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:n(m),strong:n(function(){return{type:"strong",children:[]}}),thematicBreak:n(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){c.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){c.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:c,characterReferenceMarkerHexadecimal:p,characterReferenceMarkerNumeric:p,characterReferenceValue:function(e){let t,r=this.sliceSerialize(e),n=this.data.characterReferenceType;n?(t=E_(r,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):t=w0(r);let a=this.stack[this.stack.length-1];a.value+=t},characterReference:function(e){this.stack.pop().position.end=ES(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:c,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:c,data:c,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=Ee(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:c,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:c,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),r=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===r.type?r.children=e.children:r.alt=t},labelText:function(e){let t=this.sliceSerialize(e),r=this.stack[this.stack.length-2];r.label=t.replace(Ew,EE),r.identifier=Ee(t).toLowerCase()},lineEnding:function(e){let r=this.stack[this.stack.length-1];if(this.data.atHardBreak){r.children[r.children.length-1].position.end=ES(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(r.type)&&(u.call(this,e),c.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=Ee(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,r){let n=-1;for(;++n<r.length;){let a=r[n];Array.isArray(a)?e(t,a):function(e,t){let r;for(r in t)if(Ex.call(t,r))switch(r){case"canContainEols":{let n=t[r];n&&e[r].push(...n);break}case"transforms":{let n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{let n=t[r];n&&Object.assign(e[r],n)}}}(t,a)}}(t,(e||{}).mdastExtensions||[]);let r={};return function(e){let n={type:"root",children:[]},o={stack:[n],tokenStack:[],config:t,enter:i,exit:s,buffer:a,resume:l,data:r},u=[],c=-1;for(;++c<e.length;)("listOrdered"===e[c][1].type||"listUnordered"===e[c][1].type)&&("enter"===e[c][0]?u.push(c):c=function(e,t,r){let n,a,i,o,s=t-1,l=-1,u=!1;for(;++s<=r;){let t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!n||o||l||i||(i=s),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(n){let o=s;for(a=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;a&&(e[a][1].type="lineEndingBlank",u=!0),t[1].type="lineEnding",a=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}i&&(!a||i<a)&&(n._spread=!0),n.end=Object.assign({},a?e[a][1].start:t[1].end),e.splice(a||s,0,["exit",n,t[2]]),s++,r++}if("listItemPrefix"===t[1].type){let a={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};n=a,e.splice(s,0,["enter",a,t[2]]),s++,r++,i=void 0,o=!0}}}return e[t][1]._spread=u,r}(e,u.pop(),c));for(c=-1;++c<e.length;){let r=t[e[c][0]];Ex.call(r,e[c][1].type)&&r[e[c][1].type].call(Object.assign({sliceSerialize:e[c][2].sliceSerialize},o),e[c][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||Ek).call(o,void 0,e[0])}for(n.position={start:ES(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ES(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c<t.transforms.length;)n=t.transforms[c](n)||n;return n};function n(e,t){return function(r){i.call(this,e(r),r),t&&t.call(this,r)}}function a(){this.stack.push({type:"fragment",children:[]})}function i(e,t,r){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,r||void 0]),e.position={start:ES(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){let r=this.stack.pop(),n=this.tokenStack.pop();if(n)n[0].type!==e.type&&(t?t.call(this,e,n[0]):(n[1]||Ek).call(this,e,n[0]));else throw Error("Cannot close `"+e.type+"` ("+_0({start:e.start,end:e.end})+"): it’s not open");r.position.end=ES(e.end)}function l(){return wc(this.stack.pop())}function u(e){let t=this.stack[this.stack.length-1].children,r=t[t.length-1];r&&"text"===r.type||((r={type:"text",value:""}).position={start:ES(e.start),end:void 0},t.push(r)),this.stack.push(r)}function c(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=ES(e.end)}function d(){this.data.atHardBreak=!0}function p(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function m(){return{type:"heading",depth:0,children:[]}}function h(){return{type:"break"}}function g(){return{type:"html",value:""}}function b(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(a)(function(e){for(;!wj(e););return e}((function(e){let t={constructs:wg([Ey,...(e||{}).extensions||[]]),content:r(wR),defined:[],document:r(wO),flow:r(wU),lazy:{},string:r(wB),text:r(wH)};return t;function r(e){return function(r){return function(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0},a={},i=[],o=[],s=[],l={attempt:m(function(e,t){h(e,t.from)}),check:m(f),consume:function(e){wS(e)?(n.line++,n.column=1,n.offset+=-3===e?2:1,g()):-1!==e&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=e},enter:function(e,t){let r=t||{};return r.type=e,r.start=p(),u.events.push(["enter",r,u]),s.push(r),r},exit:function(e){let t=s.pop();return t.end=p(),u.events.push(["exit",t,u]),t},interrupt:m(f,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){a[e.line]=e.column,g()},events:[],now:p,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let r,n=-1,a=[];for(;++n<e.length;){let i,o=e[n];if("string"==typeof o)i=o;else switch(o){case -5:i="\r";break;case -4:i="\n";break;case -3:i="\r\n";break;case -2:i=t?" ":" ";break;case -1:if(!t&&r)continue;i=" ";break;default:i=String.fromCharCode(o)}r=-2===o,a.push(i)}return a.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=wm(o,e),function(){let e;for(;n._index<o.length;){let r=o[n._index];if("string"==typeof r)for(e=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===e&&n._bufferIndex<r.length;){var t;t=r.charCodeAt(n._bufferIndex),c=c(t)}else c=c(r)}}(),null!==o[o.length-1])?[]:(h(t,0),u.events=wZ(i,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function d(e){return function(e,t){let r,n=t.start._index,a=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;if(n===i)r=[e[n].slice(a,o)];else{if(r=e.slice(n,i),a>-1){let e=r[0];"string"==typeof e?r[0]=e.slice(a):r.shift()}o>0&&r.push(e[i].slice(0,o))}return r}(o,e)}function p(){let{_bufferIndex:e,_index:t,line:r,column:a,offset:i}=n;return{_bufferIndex:e,_index:t,line:r,column:a,offset:i}}function f(e,t){t.restore()}function m(e,t){return function(r,a,i){var o;let c,d,f,m;return Array.isArray(r)?h(r):"tokenize"in r?h([r]):(o=r,function(e){let t=null!==e&&o[e],r=null!==e&&o.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(r)?r:r?[r]:[]])(e)});function h(e){return(c=e,d=0,0===e.length)?i:b(e[d])}function b(e){return function(r){let a,i,o,c,d;return(a=p(),i=u.previous,o=u.currentConstruct,c=u.events.length,d=Array.from(s),m={from:c,restore:function(){n=a,u.previous=i,u.currentConstruct=o,u.events.length=c,s=d,g()}},f=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?v(r):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,y,v)(r)}}function y(t){return e(f,m),a}function v(e){return(m.restore(),++d<c.length)?b(c[d]):i}}}function h(e,t){e.resolveAll&&!i.includes(e)&&i.push(e),e.resolve&&wf(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function g(){n.line in a&&n.column<2&&(n.column=a[n.line],n.offset+=a[n.line]-1)}}(t,e,r)}}})(a).document().write((o=1,s="",l=!0,function(e,t,r){let n,a,u,c,d,p=[];for(e=s+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),u=0,s="",l&&(65279===e.charCodeAt(0)&&u++,l=void 0);u<e.length;){if(Ev.lastIndex=u,c=(n=Ev.exec(e))&&void 0!==n.index?n.index:e.length,d=e.charCodeAt(c),!n){s=e.slice(u);break}if(10===d&&u===c&&i)p.push(-3),i=void 0;else switch(i&&(p.push(-5),i=void 0),u<c&&(p.push(e.slice(u,c)),o+=c-u),d){case 0:p.push(65533),o++;break;case 9:for(a=4*Math.ceil(o/4),p.push(-2);o++<a;)p.push(-1);break;case 10:p.push(-4),o=1;break;default:i=!0,o=1}u=c+1}return r&&(i&&p.push(-5),s&&p.push(s),p.push(null)),p})(r,n,!0))))}}let EA="object"==typeof self?self:globalThis,EN=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw TypeError("unable to deserialize "+e)}return new EA[e](t)},EI=e=>{var t;let r,n;return(t=new Map,r=(e,r)=>(t.set(r,e),e),n=a=>{if(t.has(a))return t.get(a);let[i,o]=e[a];switch(i){case 0:case -1:return r(o,a);case 1:{let e=r([],a);for(let t of o)e.push(n(t));return e}case 2:{let e=r({},a);for(let[t,r]of o)e[n(t)]=n(r);return e}case 3:return r(new Date(o),a);case 4:{let{source:e,flags:t}=o;return r(new RegExp(e,t),a)}case 5:{let e=r(new Map,a);for(let[t,r]of o)e.set(n(t),n(r));return e}case 6:{let e=r(new Set,a);for(let t of o)e.add(n(t));return e}case 7:{let{name:e,message:t}=o;return r(EN(e,t),a)}case 8:return r(BigInt(o),a);case"BigInt":return r(Object(BigInt(o)),a);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return r(new DataView(e),o)}}return r(EN(i,o),a)})(0)},{toString:EC}={},{keys:ER}=Object,EO=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let r=EC.call(e).slice(8,-1);switch(r){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,r]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},EL=([e,t])=>0===e&&("function"===t||"symbol"===t),EP=(e,{json:t,lossy:r}={})=>{var n,a,i;let o,s,l=[];return(n=!(t||r),a=!!t,i=new Map,o=(e,t)=>{let r=l.push(e)-1;return i.set(t,r),r},s=e=>{if(i.has(e))return i.get(e);let[t,r]=EO(e);switch(t){case 0:{let a=e;switch(r){case"bigint":t=8,a=e.toString();break;case"function":case"symbol":if(n)throw TypeError("unable to serialize "+r);a=null;break;case"undefined":return o([-1],e)}return o([t,a],e)}case 1:{if(r){let t=e;return"DataView"===r?t=new Uint8Array(e.buffer):"ArrayBuffer"===r&&(t=new Uint8Array(e)),o([r,[...t]],e)}let n=[],a=o([t,n],e);for(let t of e)n.push(s(t));return a}case 2:{if(r)switch(r){case"BigInt":return o([r,e.toString()],e);case"Boolean":case"Number":case"String":return o([r,e.valueOf()],e)}if(a&&"toJSON"in e)return s(e.toJSON());let i=[],l=o([t,i],e);for(let t of ER(e))(n||!EL(EO(e[t])))&&i.push([s(t),s(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:r,flags:n}=e;return o([t,{source:r,flags:n}],e)}case 5:{let r=[],a=o([t,r],e);for(let[t,a]of e)(n||!(EL(EO(t))||EL(EO(a))))&&r.push([s(t),s(a)]);return a}case 6:{let r=[],a=o([t,r],e);for(let t of e)(n||!EL(EO(t)))&&r.push(s(t));return a}}let{message:l}=e;return o([t,{name:r,message:l}],e)})(e),l},ED="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?EI(EP(e,t)):structuredClone(e):(e,t)=>EI(EP(e,t));function EM(e){let t=[],r=-1,n=0,a=0;for(;++r<e.length;){let i=e.charCodeAt(r),o="";if(37===i&&wy(e.charCodeAt(r+1))&&wy(e.charCodeAt(r+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){let t=e.charCodeAt(r+1);i<56320&&t>56319&&t<57344?(o=String.fromCharCode(i,t),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+a+1,o=""),a&&(r+=a,a=0)}return t.join("")+e.slice(n)}function Ej(e,t){let r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function EF(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let E$=function(e){var t,r;if(null==e)return Ez;if("function"==typeof e)return EU(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],r=-1;for(;++r<e.length;)t[r]=E$(e[r]);return EU(function(...e){let r=-1;for(;++r<t.length;)if(t[r].apply(this,e))return!0;return!1})}(e):(t=e,EU(function(e){let r;for(r in t)if(e[r]!==t[r])return!1;return!0}))}if("string"==typeof e){return r=e,EU(function(e){return e&&e.type===r})}throw Error("Expected function, string, or object as test")};function EU(e){return function(t,r,n){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof r?r:void 0,n||void 0))}}function Ez(){return!0}let EB=[];function EH(e,t,r,n){let a;"function"==typeof t&&"function"!=typeof r?(n=r,r=t):a=t;let i=E$(a),o=n?-1:1;(function e(a,s,l){let u=a&&"object"==typeof a?a:{};if("string"==typeof u.type){let e="string"==typeof u.tagName?u.tagName:"string"==typeof u.name?u.name:void 0;Object.defineProperty(c,"name",{value:"node ("+a.type+(e?"<"+e+">":"")+")"})}return c;function c(){var u;let c,d,p,f=EB;if((!t||i(a,s,l[l.length-1]||void 0))&&!1===(f=Array.isArray(u=r(a,l))?u:"number"==typeof u?[!0,u]:null==u?EB:[u])[0])return f;if("children"in a&&a.children&&a.children&&"skip"!==f[0])for(d=(n?a.children.length:-1)+o,p=l.concat(a);d>-1&&d<a.children.length;){if(!1===(c=e(a.children[d],d,p)())[0])return c;d="number"==typeof c[1]?c[1]:d+o}return f}})(e,void 0,[])()}function EG(e,t,r,n){let a,i,o;"function"==typeof t&&"function"!=typeof r?(i=void 0,o=t,a=r):(i=t,o=r,a=n),EH(e,i,function(e,t){let r=t[t.length-1],n=r?r.children.indexOf(e):void 0;return o(e,n,r)},a)}function EV(e,t){let r=t.referenceType,n="]";if("collapsed"===r?n+="[]":"full"===r&&(n+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+n}];let a=e.all(t),i=a[0];i&&"text"===i.type?i.value="["+i.value:a.unshift({type:"text",value:"["});let o=a[a.length-1];return o&&"text"===o.type?o.value+=n:a.push({type:"text",value:n}),a}function Eq(e){let t=e.spread;return null==t?e.children.length>1:t}function EW(e,t,r){let n=0,a=e.length;if(t){let t=e.codePointAt(n);for(;9===t||32===t;)n++,t=e.codePointAt(n)}if(r){let t=e.codePointAt(a-1);for(;9===t||32===t;)a--,t=e.codePointAt(a-1)}return a>n?e.slice(n,a):""}let EZ={blockquote:function(e,t){let r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)},break:function(e,t){let r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:"\n"}]},code:function(e,t){let r=t.value?t.value+"\n":"",n={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(n.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i={type:"element",tagName:"pre",properties:{},children:[i=e.applyData(t,i)]},e.patch(t,i),i},delete:function(e,t){let r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},emphasis:function(e,t){let r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},footnoteReference:function(e,t){let r,n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),i=EM(a.toLowerCase()),o=e.footnoteOrder.indexOf(a),s=e.footnoteCounts.get(a);void 0===s?(s=0,e.footnoteOrder.push(a),r=e.footnoteOrder.length):r=o+1,s+=1,e.footnoteCounts.set(a,s);let l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(r)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){let r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},html:function(e,t){if(e.options.allowDangerousHtml){let r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}},imageReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return EV(e,t);let a={src:EM(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(a.title=n.title);let i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)},image:function(e,t){let r={src:EM(t.url)};null!==t.alt&&void 0!==t.alt&&(r.alt=t.alt),null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)},inlineCode:function(e,t){let r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);let n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)},linkReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return EV(e,t);let a={href:EM(n.url||"")};null!==n.title&&void 0!==n.title&&(a.title=n.title);let i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},link:function(e,t){let r={href:EM(t.url)};null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},listItem:function(e,t,r){let n=e.all(t),a=r?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let r=e.children,n=-1;for(;!t&&++n<r.length;)t=Eq(r[n])}return t}(r):Eq(t),i={},o=[];if("boolean"==typeof t.checked){let e,r=n[0];r&&"element"===r.type&&"p"===r.tagName?e=r:(e={type:"element",tagName:"p",properties:{},children:[]},n.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let s=-1;for(;++s<n.length;){let e=n[s];(a||0!==s||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||a?o.push(e):o.push(...e.children)}let l=n[n.length-1];l&&(a||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)},list:function(e,t){let r={},n=e.all(t),a=-1;for("number"==typeof t.start&&1!==t.start&&(r.start=t.start);++a<n.length;){let e=n[a];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}let i={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,i),e.applyData(t,i)},paragraph:function(e,t){let r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},root:function(e,t){let r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)},strong:function(e,t){let r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},table:function(e,t){let r=e.all(t),n=r.shift(),a=[];if(n){let r={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],r),a.push(r)}if(r.length>0){let n={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},i=_J(t.children[1]),o=_X(t.children[t.children.length-1]);i&&o&&(n.position={start:i,end:o}),a.push(n)}let i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)},tableCell:function(e,t){let r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},tableRow:function(e,t,r){let n=r?r.children:void 0,a=0===(n?n.indexOf(t):1)?"th":"td",i=r&&"table"===r.type?r.align:void 0,o=i?i.length:t.children.length,s=-1,l=[];for(;++s<o;){let r=t.children[s],n={},o=i?i[s]:void 0;o&&(n.align=o);let u={type:"element",tagName:a,properties:n,children:[]};r&&(u.children=e.all(r),e.patch(r,u),u=e.applyData(r,u)),l.push(u)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)},text:function(e,t){let r={type:"text",value:function(e){let t=String(e),r=/\r?\n|\r/g,n=r.exec(t),a=0,i=[];for(;n;)i.push(EW(t.slice(a,n.index),a>0,!0),n[0]),a=n.index+n[0].length,n=r.exec(t);return i.push(EW(t.slice(a),a>0,!1)),i.join("")}(String(t.value))};return e.patch(t,r),e.applyData(t,r)},thematicBreak:function(e,t){let r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)},toml:EK,yaml:EK,definition:EK,footnoteDefinition:EK};function EK(){}let EY={}.hasOwnProperty,EX={};function EJ(e,t){e.position&&(t.position=function(e){let t=_J(e),r=_X(e);if(t&&r)return{start:t,end:r}}(e))}function EQ(e,t){let r=t;if(e&&e.data){let t=e.data.hName,n=e.data.hChildren,a=e.data.hProperties;"string"==typeof t&&("element"===r.type?r.tagName=t:r={type:"element",tagName:t,properties:{},children:"children"in r?r.children:[r]}),"element"===r.type&&a&&Object.assign(r.properties,ED(a)),"children"in r&&r.children&&null!=n&&(r.children=n)}return r}function E0(e,t){let r=[],n=-1;for(t&&r.push({type:"text",value:"\n"});++n<e.length;)n&&r.push({type:"text",value:"\n"}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:"\n"}),r}function E1(e){let t=0,r=e.charCodeAt(t);for(;9===r||32===r;)t++,r=e.charCodeAt(t);return e.slice(t)}function E2(e,t){let r,n,a,i,o=(r=t||EX,n=new Map,a=new Map,i={all:function(e){let t=[];if("children"in e){let r=e.children,n=-1;for(;++n<r.length;){let a=i.one(r[n],e);if(a){if(n&&"break"===r[n-1].type&&(Array.isArray(a)||"text"!==a.type||(a.value=E1(a.value)),!Array.isArray(a)&&"element"===a.type)){let e=a.children[0];e&&"text"===e.type&&(e.value=E1(e.value))}Array.isArray(a)?t.push(...a):t.push(a)}}}return t},applyData:EQ,definitionById:n,footnoteById:a,footnoteCounts:new Map,footnoteOrder:[],handlers:{...EZ,...r.handlers},one:function(e,t){let r=e.type,n=i.handlers[r];if(EY.call(i.handlers,r)&&n)return n(i,e,t);if(i.options.passThrough&&i.options.passThrough.includes(r)){if("children"in e){let{children:t,...r}=e,n=ED(r);return n.children=i.all(e),n}return ED(e)}return(i.options.unknownHandler||function(e,t){let r=t.data||{},n="value"in t&&!(EY.call(r,"hProperties")||EY.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)})(i,e,t)},options:r,patch:EJ,wrap:E0},EG(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?n:a,r=String(e.identifier).toUpperCase();t.has(r)||t.set(r,e)}}),i),s=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||Ej,n=e.options.footnoteBackLabel||EF,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let a=e.footnoteById.get(e.footnoteOrder[l]);if(!a)continue;let i=e.all(a),o=String(a.identifier).toUpperCase(),u=EM(o.toLowerCase()),c=0,d=[],p=e.footnoteCounts.get(o);for(;void 0!==p&&++c<=p;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof r?r:r(l,c);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof n?n:n(l,c),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let f=i[i.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...d)}else i.push(...d);let m={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(i,!0)};e.patch(a,m),s.push(m)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...ED(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(o),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&(_u("children"in u),u.children.push({type:"text",value:"\n"},l)),u}function E4(e,t){return e&&"run"in e?async function(r,n){let a=E2(r,{file:n,...t});await e.run(a,n)}:function(r,n){return E2(r,{file:n,...e||t})}}function E3(e){if(e)throw e}var E5=e.i(2073);function E6(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let E9=function(e,t){let r;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');xt(e);let n=0,a=-1,i=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;i--;)if(47===e.codePointAt(i)){if(r){n=i+1;break}}else a<0&&(r=!0,a=i+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let o=-1,s=t.length-1;for(;i--;)if(47===e.codePointAt(i)){if(r){n=i+1;break}}else o<0&&(r=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(a=i):(s=-1,a=o));return n===a?a=o:a<0&&(a=e.length),e.slice(n,a)},E8=function(e){let t;if(xt(e),0===e.length)return".";let r=-1,n=e.length;for(;--n;)if(47===e.codePointAt(n)){if(t){r=n;break}}else t||(t=!0);return r<0?47===e.codePointAt(0)?"/":".":1===r&&47===e.codePointAt(0)?"//":e.slice(0,r)},E7=function(e){let t;xt(e);let r=e.length,n=-1,a=0,i=-1,o=0;for(;r--;){let s=e.codePointAt(r);if(47===s){if(t){a=r+1;break}continue}n<0&&(t=!0,n=r+1),46===s?i<0?i=r:1!==o&&(o=1):i>-1&&(o=-1)}return i<0||n<0||0===o||1===o&&i===n-1&&i===a+1?"":e.slice(i,n)},xe=function(...e){var t;let r,n,a,i=-1;for(;++i<e.length;)xt(e[i]),e[i]&&(a=void 0===a?e[i]:a+"/"+e[i]);return void 0===a?".":(xt(t=a),r=47===t.codePointAt(0),0!==(n=function(e,t){let r,n,a="",i=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)r=e.codePointAt(l);else if(47===r)break;else r=47;if(47===r){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(a.length<2||2!==i||46!==a.codePointAt(a.length-1)||46!==a.codePointAt(a.length-2)){if(a.length>2){if((n=a.lastIndexOf("/"))!==a.length-1){n<0?(a="",i=0):i=(a=a.slice(0,n)).length-1-a.lastIndexOf("/"),o=l,s=0;continue}}else if(a.length>0){a="",i=0,o=l,s=0;continue}}t&&(a=a.length>0?a+"/..":"..",i=2)}else a.length>0?a+="/"+e.slice(o+1,l):a=e.slice(o+1,l),i=l-o-1;o=l,s=0}else 46===r&&s>-1?s++:s=-1}return a}(t,!r)).length||r||(n="."),n.length>0&&47===t.codePointAt(t.length-1)&&(n+="/"),r?"/"+n:n)};function xt(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function xr(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let xn=["history","path","basename","stem","extname","dirname"];class xa{constructor(e){let t,r;t=e?xr(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<xn.length;){const e=xn[n];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(r in t)xn.includes(r)||(this[r]=t[r])}get basename(){return"string"==typeof this.path?E9(this.path):void 0}set basename(e){xo(e,"basename"),xi(e,"basename"),this.path=xe(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?E8(this.path):void 0}set dirname(e){xs(this.basename,"dirname"),this.path=xe(e||"",this.basename)}get extname(){return"string"==typeof this.path?E7(this.path):void 0}set extname(e){if(xi(e,"extname"),xs(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=xe(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){xr(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!xr(e)){let t=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("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,r=-1;for(;++r<t.length;)if(37===t.codePointAt(r)&&50===t.codePointAt(r+1)){let e=t.codePointAt(r+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),xo(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?E9(this.path,this.extname):void 0}set stem(e){xo(e,"stem"),xi(e,"stem"),this.path=xe(this.dirname||"",e+(this.extname||""))}fail(e,t,r){let n=this.message(e,t,r);throw n.fatal=!0,n}info(e,t,r){let n=this.message(e,t,r);return n.fatal=void 0,n}message(e,t,r){let n=new _3(e,t,r);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function xi(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function xo(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function xs(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let xl=function(e){let t=this.constructor.prototype,r=t[e],n=function(){return r.apply(n,arguments)};return Object.setPrototypeOf(n,t),n},xu={}.hasOwnProperty;class xc extends xl{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=function(){let e=[],t={run:function(...t){let r=-1,n=t.pop();if("function"!=typeof n)throw TypeError("Expected function as last argument, not "+n);!function a(i,...o){let s=e[++r],l=-1;if(i)return void n(i);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,s?(function(e,t){let r;return function(...t){let i,o=e.length>t.length;o&&t.push(n);try{i=e.apply(this,t)}catch(e){if(o&&r)throw e;return n(e)}o||(i&&i.then&&"function"==typeof i.then?i.then(a,n):i instanceof Error?n(i):a(i))};function n(e,...a){r||(r=!0,t(e,...a))}function a(e){n(null,e)}})(s,a)(...o):n(null,...o)}(null,...t)},use:function(r){if("function"!=typeof r)throw TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}};return t}()}copy(){let e=new xc,t=-1;for(;++t<this.attachers.length;){let r=this.attachers[t];e.use(...r)}return e.data((0,E5.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(xm("data",this.frozen),this.namespace[e]=t,this):xu.call(this.namespace,e)&&this.namespace[e]||void 0:e?(xm("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let r=e.call(this,...t);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=xb(e),r=this.parser||this.Parser;return xp("parse",r),r(String(t),t)}process(e,t){let r=this;return this.freeze(),xp("process",this.parser||this.Parser),xf("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(n,a){let i=xb(e),o=r.parse(i);function s(e,r){e||!r?a(e):n?n(r):(_u(t,"`done` is defined if `resolve` is not"),t(void 0,r))}r.run(o,i,function(e,t,n){var a,i;if(e||!t||!n)return s(e);let o=r.stringify(t,n);"string"==typeof(a=o)||(i=a)&&"object"==typeof i&&"byteLength"in i&&"byteOffset"in i?n.value=o:n.result=o,s(e,n)})}}processSync(e){let t,r=!1;return this.freeze(),xp("processSync",this.parser||this.Parser),xf("processSync",this.compiler||this.Compiler),this.process(e,function(e,n){r=!0,E3(e),t=n}),xg("processSync","process",r),_u(t,"we either bailed on an error or have a tree"),t}run(e,t,r){xh(e),this.freeze();let n=this.transformers;return r||"function"!=typeof t||(r=t,t=void 0),r?a(void 0,r):new Promise(a);function a(a,i){_u("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=xb(t);n.run(e,o,function(t,n,o){let s=n||e;t?i(t):a?a(s):(_u(r,"`done` is defined if `resolve` is not"),r(void 0,s,o))})}}runSync(e,t){let r,n=!1;return this.run(e,t,function(e,t){E3(e),r=t,n=!0}),xg("runSync","run",n),_u(r,"we either bailed on an error or have a tree"),r}stringify(e,t){this.freeze();let r=xb(t),n=this.compiler||this.Compiler;return xf("stringify",n),xh(e),n(e,r)}use(e,...t){let r=this.attachers,n=this.namespace;if(xm("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?i(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function a(e){if(!("plugins"in e)&&!("settings"in e))throw 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");i(e.plugins),e.settings&&(n.settings=(0,E5.default)(!0,n.settings,e.settings))}function i(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...r]=e;o(t,r)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let n=-1,a=-1;for(;++n<r.length;)if(r[n][0]===e){a=n;break}if(-1===a)r.push([e,...t]);else if(t.length>0){let[n,...i]=t,o=r[a][1];E6(o)&&E6(n)&&(n=(0,E5.default)(!0,o,n)),r[a]=[e,n,...i]}}}}let xd=new xc().freeze();function xp(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function xf(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function xm(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xh(e){if(!E6(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function xg(e,t,r){if(!r)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function xb(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new xa(e)}let xy=[],xv={allowDangerousHtml:!0},x_=/^(https?|ircs?|mailto|xmpp)$/i,xw=[{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:"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 xE(e){var t;let r,n,a,i,o,s=(r=(t=e).rehypePlugins||xy,n=t.remarkPlugins||xy,a=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...xv}:xv,xd().use(ET).use(n).use(E4,a).use(r)),l=(i=e.children||"",o=new xa,"string"==typeof i?o.value=i:_c("Unexpected value `"+i+"` for `children` prop, expected `string`"),o);return function(e,t){let r=t.allowedElements,n=t.allowElement,a=t.components,i=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||xx;for(let e of xw)Object.hasOwn(t,e.from)&&_c("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return r&&i&&_c("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:"root"===e.type?e.children:[e]}),EG(e,function(e,t,a){if("raw"===e.type&&a&&"number"==typeof t)return o?a.children.splice(t,1):a.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in wl)if(Object.hasOwn(wl,t)&&Object.hasOwn(e.properties,t)){let r=e.properties[t],n=wl[t];(null===n||n.includes(e.tagName))&&(e.properties[t]=l(String(r||""),t,e))}}if("element"===e.type){let o=r?!r.includes(e.tagName):!!i&&i.includes(e.tagName);if(!o&&n&&"number"==typeof t&&(o=!n(e,t,a)),o&&a&&"number"==typeof t)return s&&e.children?a.children.splice(t,1,...e.children):a.children.splice(t,1),t}}),function(e,t){var r,n,a,i;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let s=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=s,n=t.jsxDEV,o=function(e,t,a,i){let o=Array.isArray(a.children),s=_J(e);return n(t,a,i,o,{columnNumber:s?s.column-1:void 0,fileName:r,lineNumber:s?s.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");a=t.jsx,i=t.jsxs,o=function(e,t,r,n){let o=Array.isArray(r.children)?i:a;return n?o(t,r,n):o(t,r)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?_K:_Z,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},u=wt(l,e,void 0);return u&&"string"!=typeof u?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}(e,{Fragment:J.Fragment,components:a,ignoreInvalidStyle:!0,jsx:J.jsx,jsxs:J.jsxs,passKeys:!0,passNode:!0})}(s.runSync(s.parse(l),l),e)}function xx(e){let t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),a=e.indexOf("/");return -1===t||-1!==a&&t>a||-1!==r&&t>r||-1!==n&&t>n||x_.test(e.slice(0,t))?e:""}function xS(e,t){let r=String(e);if("string"!=typeof t)throw TypeError("Expected character");let n=0,a=r.indexOf(t);for(;-1!==a;)n++,a=r.indexOf(t,a+t.length);return n}let xk="phrasing",xT=["autolink","link","image","label"];function xA(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function xN(e){this.config.enter.autolinkProtocol.call(this,e)}function xI(e){this.config.exit.autolinkProtocol.call(this,e)}function xC(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];_u("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function xR(e){this.config.exit.autolinkEmail.call(this,e)}function xO(e){this.exit(e)}function xL(e){!function(e,t,r){let n=E$((r||{}).ignore||[]),a=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let r=!e[0]||Array.isArray(e[0])?e:[e],n=-1;for(;++n<r.length;){var a;let e=r[n];t.push(["string"==typeof(a=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(a),"g"):a,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),i=-1;for(;++i<a.length;)EH(e,"text",o);function o(e,t){let r,o=-1;for(;++o<t.length;){let e=t[o],a=r?r.children:void 0;if(n(e,a?a.indexOf(e):void 0,r))return;r=e}if(r)return function(e,t){let r=t[t.length-1],n=a[i][0],o=a[i][1],s=0,l=r.children.indexOf(e),u=!1,c=[];n.lastIndex=0;let d=n.exec(e.value);for(;d;){let r=d.index,a={index:d.index,input:d.input,stack:[...t,e]},i=o(...d,a);if("string"==typeof i&&(i=i.length>0?{type:"text",value:i}:void 0),!1===i?n.lastIndex=r+1:(s!==r&&c.push({type:"text",value:e.value.slice(s,r)}),Array.isArray(i)?c.push(...i):i&&c.push(i),s=r+d[0].length,u=!0),!n.global)break;d=n.exec(e.value)}return u?(s<e.value.length&&c.push({type:"text",value:e.value.slice(s)}),r.children.splice(l,1,...c)):c=[e],l+c.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xP],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,xD]],{ignore:["link","linkReference"]})}function xP(e,t,r,n,a){let i,o="";if(!xM(a))return!1;if(/^w/i.test(t)&&(r=t+r,t="",o="http://"),(i=r.split(".")).length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[a-zA-Z\d]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[a-zA-Z\d]/.test(i[i.length-2])))return!1;let s=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")"),a=xS(e,"("),i=xS(e,")");for(;-1!==n&&a>i;)e+=r.slice(0,n+1),n=(r=r.slice(n+1)).indexOf(")"),i++;return[e,r]}(r+n);if(!s[0])return!1;let l={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function xD(e,t,r,n){return!(!xM(n,!0)||/[-\d_]$/.test(r))&&{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function xM(e,t){let r=e.input.charCodeAt(e.index-1);return(0===e.index||wN(r)||wA(r))&&(!t||47!==r)}function xj(){this.buffer()}function xF(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function x$(){this.buffer()}function xU(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function xz(e){let t=this.resume(),r=this.stack[this.stack.length-1];_u("footnoteReference"===r.type),r.identifier=Ee(this.sliceSerialize(e)).toLowerCase(),r.label=t}function xB(e){this.exit(e)}function xH(e){let t=this.resume(),r=this.stack[this.stack.length-1];_u("footnoteDefinition"===r.type),r.identifier=Ee(this.sliceSerialize(e)).toLowerCase(),r.label=t}function xG(e){this.exit(e)}function xV(e,t,r,n){let a=r.createTracker(n),i=a.move("[^"),o=r.enter("footnoteReference"),s=r.enter("reference");return i+=a.move(r.safe(r.associationId(e),{after:"]",before:i})),s(),o(),i+=a.move("]")}function xq(e,t,r){return 0===t?e:xW(e,t,r)}function xW(e,t,r){return(r?"":" ")+e}xV.peek=function(){return"["};let xZ=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function xK(e){this.enter({type:"delete",children:[]},e)}function xY(e){this.exit(e)}function xX(e,t,r,n){let a=r.createTracker(n),i=r.enter("strikethrough"),o=a.move("~~");return o+=r.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),i(),o}function xJ(e){return e.length}function xQ(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}xX.peek=function(){return"~"};function x0(e,t,r){let n=e.value||"",a="`",i=-1;for(;RegExp("(^|[^`])"+a+"([^`]|$)").test(n);)a+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++i<r.unsafe.length;){let e,t=r.unsafe[i],a=r.compilePattern(t);if(t.atBreak)for(;e=a.exec(n);){let t=e.index;10===n.charCodeAt(t)&&13===n.charCodeAt(t-1)&&t--,n=n.slice(0,t)+" "+n.slice(e.index+1)}}return a+n+a}x0.peek=function(){return"`"};E$(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let x1=function(e,t,r,n){let a=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(r),i=r.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(r);t&&"list"===t.type&&t.ordered&&(i=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===r.options.incrementListMarker?0:t.children.indexOf(e))+i);let o=i.length+1;("tab"===a||"mixed"===a&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let s=r.createTracker(n);s.move(i+" ".repeat(o-i.length)),s.shift(o);let l=r.enter("listItem"),u=r.indentLines(r.containerFlow(e,s.current()),function(e,t,r){return t?(r?"":" ".repeat(o))+e:(r?i:i+" ".repeat(o-i.length))+e});return l(),u};function x2(e){let t=e._align;_u(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function x4(e){this.exit(e),this.data.inTable=void 0}function x3(e){this.enter({type:"tableRow",children:[]},e)}function x5(e){this.exit(e)}function x6(e){this.enter({type:"tableCell",children:[]},e)}function x9(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,x8));let r=this.stack[this.stack.length-1];_u("inlineCode"===r.type),r.value=t,this.exit(e)}function x8(e,t){return"|"===t?t:e}function x7(e){let t=this.stack[this.stack.length-2];_u("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function Se(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];_u("paragraph"===e.type);let r=e.children[0];if(r&&"text"===r.type){let n,a=t.children,i=-1;for(;++i<a.length;){let e=a[i];if("paragraph"===e.type){n=e;break}}n===e&&(r.value=r.value.slice(1),0===r.value.length?e.children.shift():e.position&&r.position&&"number"==typeof r.position.start.offset&&(r.position.start.column++,r.position.start.offset++,e.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function St(e,t,r,n){let a=e.children[0],i="boolean"==typeof e.checked&&a&&"paragraph"===a.type,o="["+(e.checked?"x":" ")+"] ",s=r.createTracker(n);i&&s.move(o);let l=x1(e,t,r,{...n,...s.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let Sr={tokenize:function(e,t,r){let n=0;return function t(i){return(87===i||119===i)&&n<3?(n++,e.consume(i),t):46===i&&3===n?(e.consume(i),a):r(i)};function a(e){return null===e?r(e):t(e)}},partial:!0},Sn={tokenize:function(e,t,r){let n,a,i;return o;function o(t){return 46===t||95===t?e.check(Si,l,s)(t):null===t||wk(t)||wN(t)||45!==t&&wA(t)?l(t):(i=!0,e.consume(t),o)}function s(t){return 95===t?n=!0:(a=n,n=void 0),e.consume(t),o}function l(e){return a||n||!i?r(e):t(e)}},partial:!0},Sa={tokenize:function(e,t){let r=0,n=0;return a;function a(o){return 40===o?(r++,e.consume(o),a):41===o&&n<r?i(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(Si,t,i)(o):null===o||wk(o)||wN(o)?t(o):(e.consume(o),a)}function i(t){return 41===t&&n++,e.consume(t),a}},partial:!0},Si={tokenize:function(e,t,r){return n;function n(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),n):38===o?(e.consume(o),i):93===o?(e.consume(o),a):60===o||null===o||wk(o)||wN(o)?t(o):r(o)}function a(e){return null===e||40===e||91===e||wk(e)||wN(e)?t(e):n(e)}function i(t){return wb(t)?function t(a){return 59===a?(e.consume(a),n):wb(a)?(e.consume(a),t):r(a)}(t):r(t)}},partial:!0},So={tokenize:function(e,t,r){return function(t){return e.consume(t),n};function n(e){return wy(e)?r(e):t(e)}},partial:!0},Ss={name:"wwwAutolink",tokenize:function(e,t,r){let n=this;return function(t){return 87!==t&&119!==t||!Sp.call(n,n.previous)||Sg(n.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Sr,e.attempt(Sn,e.attempt(Sa,a),r),r)(t))};function a(r){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(r)}},previous:Sp},Sl={name:"protocolAutolink",tokenize:function(e,t,r){let n=this,a="",i=!1;return function(t){return(72===t||104===t)&&Sf.call(n,n.previous)&&!Sg(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(t),e.consume(t),o):r(t)};function o(t){if(wb(t)&&a.length<5)return a+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let r=a.toLowerCase();if("http"===r||"https"===r)return e.consume(t),s}return r(t)}function s(t){return 47===t?(e.consume(t),i)?l:(i=!0,s):r(t)}function l(t){return null===t||w_(t)||wk(t)||wN(t)||wA(t)?r(t):e.attempt(Sn,e.attempt(Sa,u),r)(t)}function u(r){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(r)}},previous:Sf},Su={name:"emailAutolink",tokenize:function(e,t,r){let n,a,i=this;return function(t){return!Sh(t)||!Sm.call(i,i.previous)||Sg(i.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(n){return Sh(n)?(e.consume(n),t):64===n?(e.consume(n),o):r(n)}(t))};function o(t){return 46===t?e.check(So,l,s)(t):45===t||95===t||wy(t)?(a=!0,e.consume(t),o):l(t)}function s(t){return e.consume(t),n=!0,o}function l(o){return a&&n&&wb(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):r(o)}},previous:Sm},Sc={},Sd=48;for(;Sd<123;)Sc[Sd]=Su,58==++Sd?Sd=65:91===Sd&&(Sd=97);function Sp(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||wk(e)}function Sf(e){return!wb(e)}function Sm(e){return!(47===e||Sh(e))}function Sh(e){return 43===e||45===e||46===e||95===e||wy(e)}function Sg(e){let t=e.length,r=!1;for(;t--;){let n=e[t][1];if(("labelLink"===n.type||"labelImage"===n.type)&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}Sc[43]=Su,Sc[45]=Su,Sc[46]=Su,Sc[95]=Su,Sc[72]=[Su,Sl],Sc[104]=[Su,Sl],Sc[87]=[Su,Ss],Sc[119]=[Su,Ss];let Sb={tokenize:function(e,t,r){let n=this;return wC(e,function(e){let a=n.events[n.events.length-1];return a&&"gfmFootnoteDefinitionIndent"===a[1].type&&4===a[2].sliceSerialize(a[1],!0).length?t(e):r(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function Sy(e,t,r){let n,a=this,i=a.events.length,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);for(;i--;){let e=a.events[i][1];if("labelImage"===e.type){n=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(i){if(!n||!n._balanced)return r(i);let s=Ee(a.sliceSerialize({start:n.end,end:a.now()}));return 94===s.codePointAt(0)&&o.includes(s.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),t(i)):r(i)}}function Sv(e,t){let r=e.length;for(;r--;)if("labelImage"===e[r][1].type&&"enter"===e[r][0]){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";let n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;let i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},s=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",a,t],["exit",a,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...s),e}function S_(e,t,r){let n,a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?r(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(o>999||93===s&&!n||null===s||91===s||wk(s))return r(s);if(93===s){e.exit("chunkString");let n=e.exit("gfmFootnoteCallString");return i.includes(Ee(a.sliceSerialize(n)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(s)}return wk(s)||(n=!0),o++,e.consume(s),92===s?u:l}function u(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function Sw(e,t,r){let n,a,i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):r(t)}function u(t){if(s>999||93===t&&!a||null===t||91===t||wk(t))return r(t);if(93===t){e.exit("chunkString");let r=e.exit("gfmFootnoteDefinitionLabelString");return n=Ee(i.sliceSerialize(r)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return wk(t)||(a=!0),s++,e.consume(t),92===t?c:u}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,u):u(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(n)||o.push(n),wC(e,p,"gfmFootnoteDefinitionWhitespace")):r(t)}function p(e){return t(e)}}function SE(e,t,r){return e.check(wP,t,e.attempt(Sb,t,r))}function Sx(e){e.exit("gfmFootnoteDefinition")}class SS{constructor(){this.map=[]}add(e,t,r){!function(e,t,r,n){let a=0;if(0!==r||0!==n.length){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=r,e.map[a][2].push(...n);return}a+=1}e.map.push([t,r,n])}}(this,e,t,r)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,r=[];for(;t>0;)t-=1,r.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];r.push(e.slice()),e.length=0;let n=r.pop();for(;n;){for(let t of n)e.push(t);n=r.pop()}this.map.length=0}}function Sk(e,t,r){let n,a=this,i=0,o=0;return function(e){let t=a.events.length-1;for(;t>-1;){let e=a.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let n=t>-1?a.events[t][1].type:null,i="tableHead"===n||"tableRow"===n?y:s;return i===y&&a.parser.lazy[a.now().line]?r(e):i(e)};function s(t){var r;return e.enter("tableHead"),e.enter("tableRow"),124===(r=t)||(n=!0,o+=1),l(r)}function l(t){return null===t?r(t):wS(t)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):r(t):wT(t)?wC(e,l,"whitespace")(t):(o+=1,n&&(n=!1,i+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),n=!0,l):(e.enter("data"),u(t))}function u(t){return null===t||124===t||wk(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return 92===t||124===t?(e.consume(t),u):u(t)}function d(t){return(a.interrupt=!1,a.parser.lazy[a.now().line])?r(t):(e.enter("tableDelimiterRow"),n=!1,wT(t))?wC(e,p,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t)}function p(t){return 45===t||58===t?m(t):124===t?(n=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):r(t)}function f(t){return wT(t)?wC(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(o+=1,n=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),h):45===t?(o+=1,h(t)):null===t||wS(t)?b(t):r(t)}function h(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(r){return 45===r?(e.consume(r),t):58===r?(n=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(r),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(r))}(t)):r(t)}function g(t){return wT(t)?wC(e,b,"whitespace")(t):b(t)}function b(a){if(124===a)return p(a);if(null===a||wS(a))return n&&i===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(a)):r(a);return r(a)}function y(t){return e.enter("tableRow"),v(t)}function v(r){return 124===r?(e.enter("tableCellDivider"),e.consume(r),e.exit("tableCellDivider"),v):null===r||wS(r)?(e.exit("tableRow"),t(r)):wT(r)?wC(e,v,"whitespace")(r):(e.enter("data"),_(r))}function _(t){return null===t||124===t||wk(t)?(e.exit("data"),v(t)):(e.consume(t),92===t?w:_)}function w(t){return 92===t||124===t?(e.consume(t),_):_(t)}}function ST(e,t){let r,n,a,i=-1,o=!0,s=0,l=[0,0,0,0],u=[0,0,0,0],c=!1,d=0,p=new SS;for(;++i<e.length;){let f=e[i],m=f[1];"enter"===f[0]?"tableHead"===m.type?(c=!1,0!==d&&(SN(p,t,d,r,n),n=void 0,d=0),r={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(i,0,[["enter",r,t]])):"tableRow"===m.type||"tableDelimiterRow"===m.type?(o=!0,a=void 0,l=[0,0,0,0],u=[0,i+1,0,0],c&&(c=!1,n={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(i,0,[["enter",n,t]])),s="tableDelimiterRow"===m.type?2:n?3:1):s&&("data"===m.type||"tableDelimiterMarker"===m.type||"tableDelimiterFiller"===m.type)?(o=!1,0===u[2]&&(0!==l[1]&&(u[0]=u[1],a=SA(p,t,l,s,void 0,a),l=[0,0,0,0]),u[2]=i)):"tableCellDivider"===m.type&&(o?o=!1:(0!==l[1]&&(u[0]=u[1],a=SA(p,t,l,s,void 0,a)),u=[(l=u)[1],i,0,0])):"tableHead"===m.type?(c=!0,d=i):"tableRow"===m.type||"tableDelimiterRow"===m.type?(d=i,0!==l[1]?(u[0]=u[1],a=SA(p,t,l,s,i,a)):0!==u[1]&&(a=SA(p,t,u,s,i,a)),s=0):s&&("data"===m.type||"tableDelimiterMarker"===m.type||"tableDelimiterFiller"===m.type)&&(u[3]=i)}for(0!==d&&SN(p,t,d,r,n),p.consume(t.events),i=-1;++i<t.events.length;){let e=t.events[i];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let r=!1,n=[];for(;t<e.length;){let a=e[t];if(r){if("enter"===a[0])"tableContent"===a[1].type&&n.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===a[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=n.length-1;n[e]="left"===n[e]?"center":"right"}}else if("tableDelimiterRow"===a[1].type)break}else"enter"===a[0]&&"tableDelimiterRow"===a[1].type&&(r=!0);t+=1}return n}(t.events,i))}return e}function SA(e,t,r,n,a,i){0!==r[0]&&(i.end=Object.assign({},SI(t.events,r[0])),e.add(r[0],0,[["exit",i,t]]));let o=SI(t.events,r[1]);if(i={type:1===n?"tableHeader":2===n?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(r[1],0,[["enter",i,t]]),0!==r[2]){let a=SI(t.events,r[2]),i=SI(t.events,r[3]),o={type:"tableContent",start:Object.assign({},a),end:Object.assign({},i)};if(e.add(r[2],0,[["enter",o,t]]),2!==n){let n=t.events[r[2]],a=t.events[r[3]];if(n[1].end=Object.assign({},a[1].end),n[1].type="chunkText",n[1].contentType="text",r[3]>r[2]+1){let t=r[2]+1,n=r[3]-r[2]-1;e.add(t,n,[])}}e.add(r[3]+1,0,[["exit",o,t]])}return void 0!==a&&(i.end=Object.assign({},SI(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function SN(e,t,r,n,a){let i=[],o=SI(t.events,r);a&&(a.end=Object.assign({},o),i.push(["exit",a,t])),n.end=Object.assign({},o),i.push(["exit",n,t]),e.add(r+1,0,i)}function SI(e,t){let r=e[t],n="enter"===r[0]?"start":"end";return r[1][n]}let SC={name:"tasklistCheck",tokenize:function(e,t,r){let n=this;return function(t){return null===n.previous&&n._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),a):r(t)};function a(t){return wk(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),i):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),i):r(t)}function i(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):r(t)}function o(n){return wS(n)?t(n):wT(n)?e.check({tokenize:SR},t,r)(n):r(n)}}};function SR(e,t,r){return wC(e,function(e){return null===e?r(e):t(e)},"whitespace")}let SO={};function SL(e){let t,r,n,a=e||SO,i=this.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),s=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),l=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(wg([{text:Sc},{document:{91:{name:"gfmFootnoteDefinition",tokenize:Sw,continuation:{tokenize:SE},exit:Sx}},text:{91:{name:"gfmFootnoteCall",tokenize:S_},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Sy,resolveTo:Sv}}},(t=(a||{}).singleTilde,r={name:"strikethrough",tokenize:function(e,r,n){let a=this.previous,i=this.events,o=0;return function(s){return 126===a&&"characterEscape"!==i[i.length-1][1].type?n(s):(e.enter("strikethroughSequenceTemporary"),function i(s){let l=wW(a);if(126===s)return o>1?n(s):(e.consume(s),o++,i);if(o<2&&!t)return n(s);let u=e.exit("strikethroughSequenceTemporary"),c=wW(s);return u._open=!c||2===c&&!!l,u._close=!l||2===l&&!!c,r(s)}(s))}},resolveAll:function(e,t){let r=-1;for(;++r<e.length;)if("enter"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._close){let n=r;for(;n--;)if("exit"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._open&&e[r][1].end.offset-e[r][1].start.offset==e[n][1].end.offset-e[n][1].start.offset){e[r][1].type="strikethroughSequence",e[n][1].type="strikethroughSequence";let a={type:"strikethrough",start:Object.assign({},e[n][1].start),end:Object.assign({},e[r][1].end)},i={type:"strikethroughText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[r][1].start)},o=[["enter",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["enter",i,t]],s=t.parser.constructs.insideSpan.null;s&&wf(o,o.length,0,wZ(s,e.slice(n+1,r),t)),wf(o,o.length,0,[["exit",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["exit",a,t]]),wf(e,n-1,r-n+3,o),r=n+o.length-2;break}}for(r=-1;++r<e.length;)"strikethroughSequenceTemporary"===e[r][1].type&&(e[r][1].type="data");return e}},null==t&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:Sk,resolveAll:ST}}},{text:{91:SC}}])),s.push([{transforms:[xL],enter:{literalAutolink:xA,literalAutolinkEmail:xN,literalAutolinkHttp:xN,literalAutolinkWww:xN},exit:{literalAutolink:xO,literalAutolinkEmail:xR,literalAutolinkHttp:xI,literalAutolinkWww:xC}},{enter:{gfmFootnoteCallString:xj,gfmFootnoteCall:xF,gfmFootnoteDefinitionLabelString:x$,gfmFootnoteDefinition:xU},exit:{gfmFootnoteCallString:xz,gfmFootnoteCall:xB,gfmFootnoteDefinitionLabelString:xH,gfmFootnoteDefinition:xG}},{canContainEols:["delete"],enter:{strikethrough:xK},exit:{strikethrough:xY}},{enter:{table:x2,tableData:x6,tableHeader:x6,tableRow:x3},exit:{codeText:x9,table:x4,tableData:x5,tableHeader:x5,tableRow:x5}},{exit:{taskListCheckValueChecked:x7,taskListCheckValueUnchecked:x7,paragraph:Se}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:xk,notInConstruct:xT},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:xk,notInConstruct:xT},{character:":",before:"[ps]",after:"\\/",inConstruct:xk,notInConstruct:xT}]},(n=!1,a&&a.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:function(e,t,r,a){let i=r.createTracker(a),o=i.move("[^"),s=r.enter("footnoteDefinition"),l=r.enter("label");return o+=i.move(r.safe(r.associationId(e),{before:o,after:"]"})),l(),o+=i.move("]:"),e.children&&e.children.length>0&&(i.shift(4),o+=i.move((n?"\n":" ")+r.indentLines(r.containerFlow(e,i.current()),n?xW:xq))),s(),o},footnoteReference:xV},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xZ}],handlers:{delete:xX}},function(e){let t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,a=t.stringLength,i=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,r){let n=x0(e,t,r);return r.stack.includes("tableCell")&&(n=n.replace(/\|/g,"\\$&")),n},table:function(e,t,r,n){return s(function(e,t,r){let n=e.children,a=-1,i=[],o=t.enter("table");for(;++a<n.length;)i[a]=l(n[a],t,r);return o(),i}(e,r,n),e.align)},tableCell:o,tableRow:function(e,t,r,n){let a=s([l(e,r,n)]);return a.slice(0,a.indexOf("\n"))}}};function o(e,t,r,n){let a=r.enter("tableCell"),o=r.enter("phrasing"),s=r.containerPhrasing(e,{...n,before:i,after:i});return o(),a(),s}function s(e,t){return function(e,t){let r=t||{},n=(r.align||[]).concat(),a=r.stringLength||xJ,i=[],o=[],s=[],l=[],u=0,c=-1;for(;++c<e.length;){let t=[],n=[],i=-1;for(e[c].length>u&&(u=e[c].length);++i<e[c].length;){var d;let o=null==(d=e[c][i])?"":String(d);if(!1!==r.alignDelimiters){let e=a(o);n[i]=e,(void 0===l[i]||e>l[i])&&(l[i]=e)}t.push(o)}o[c]=t,s[c]=n}let p=-1;if("object"==typeof n&&"length"in n)for(;++p<u;)i[p]=xQ(n[p]);else{let e=xQ(n);for(;++p<u;)i[p]=e}p=-1;let f=[],m=[];for(;++p<u;){let e=i[p],t="",n="";99===e?(t=":",n=":"):108===e?t=":":114===e&&(n=":");let a=!1===r.alignDelimiters?1:Math.max(1,l[p]-t.length-n.length),o=t+"-".repeat(a)+n;!1!==r.alignDelimiters&&((a=t.length+a+n.length)>l[p]&&(l[p]=a),m[p]=a),f[p]=o}o.splice(1,0,f),s.splice(1,0,m),c=-1;let h=[];for(;++c<o.length;){let e=o[c],t=s[c];p=-1;let n=[];for(;++p<u;){let a=e[p]||"",o="",s="";if(!1!==r.alignDelimiters){let e=l[p]-(t[p]||0),r=i[p];114===r?o=" ".repeat(e):99===r?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):s=o=" ".repeat(e/2):s=" ".repeat(e)}!1===r.delimiterStart||p||n.push("|"),!1!==r.padding&&(!1!==r.alignDelimiters||""!==a)&&(!1!==r.delimiterStart||p)&&n.push(" "),!1!==r.alignDelimiters&&n.push(o),n.push(a),!1!==r.alignDelimiters&&n.push(s),!1!==r.padding&&n.push(" "),(!1!==r.delimiterEnd||p!==u-1)&&n.push("|")}h.push(!1===r.delimiterEnd?n.join("").replace(/ +$/,""):n.join(""))}return h.join("\n")}(e,{align:t,alignDelimiters:n,padding:r,stringLength:a})}function l(e,t,r){let n=e.children,a=-1,i=[],s=t.enter("tableRow");for(;++a<n.length;)i[a]=o(n[a],e,t,r);return s(),i}}(a),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:St}}]})}function SP(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function SD(e){return function(e){if(Array.isArray(e))return SP(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return SP(e,void 0);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?SP(e,void 0):void 0}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function SM(e){return(SM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Sj(e,t,r){var n;return(n=function(e,t){if("object"!=SM(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=SM(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==SM(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SF(){return(SF=Object.assign.bind()).apply(null,arguments)}function S$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function SU(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S$(Object(r),!0).forEach(function(t){Sj(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S$(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Sz={},SB=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function SH(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function SG(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SH(Object(r),!0).forEach(function(t){Sj(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SH(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var SV=/\n/g;function Sq(e){var t,r,n,a,i=e.codeString,o=e.codeStyle,s=e.containerStyle,l=e.numberStyle,u=e.startingLineNumber;return Q.default.createElement("code",{style:Object.assign({},o,void 0===s?{float:"left",paddingRight:"10px"}:s)},(r=(t={lines:i.replace(/\n$/,"").split("\n"),style:void 0===l?{}:l,startingLineNumber:u}).lines,n=t.startingLineNumber,a=t.style,r.map(function(e,t){var r=t+n;return Q.default.createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"==typeof a?a(r):a},"".concat(r,"\n"))})))}function SW(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function SZ(e,t,r){var n={display:"inline-block",minWidth:"".concat(r.toString().length,".25em"),paddingRight:"1em",textAlign:"right",userSelect:"none"},a="function"==typeof e?e(t):e;return SG(SG({},n),a)}function SK(e){var t=e.children,r=e.lineNumber,n=e.lineNumberStyle,a=e.largestLineNumber,i=e.showInlineLineNumbers,o=e.lineProps,s=void 0===o?{}:o,l=e.className,u=void 0===l?[]:l,c=e.showLineNumbers,d=e.wrapLongLines,p=e.wrapLines,f=void 0!==p&&p?SG({},"function"==typeof s?s(r):s):{};if(f.className=f.className?[].concat(SD(f.className.trim().split(/\s+/)),SD(u)):u,r&&i){var m=SZ(n,r,a);t.unshift(SW(r,m))}return d&c&&(f.style=SG({display:"flex"},f.style)),{type:"element",tagName:"span",properties:f,children:t}}function SY(e){var t=e.rows,r=e.stylesheet,n=e.useInlineStyles;return t.map(function(e,t){return function e(t){var r=t.node,n=t.stylesheet,a=t.style,i=t.useInlineStyles,o=t.key,s=r.properties,l=r.type,u=r.tagName,c=r.value;if("text"===l)return c;if(u){var d,p,f=(d=0,function(t){return d+=1,t.map(function(t,r){return e({node:t,stylesheet:n,useInlineStyles:i,key:"code-segment-".concat(d,"-").concat(r)})})});if(i){var m=Object.keys(n).reduce(function(e,t){return t.split(".").forEach(function(t){e.includes(t)||e.push(t)}),e},[]),h=s.className&&s.className.includes("token")?["token"]:[],g=s.className&&h.concat(s.className.filter(function(e){return!m.includes(e)}));p=SU(SU({},s),{},{className:g.join(" ")||void 0,style:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return(function(e){if(0===e.length||1===e.length)return e;var t,r=e.join(".");return Sz[r]||(Sz[r]=0===(t=e.length)||1===t?e:2===t?[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])]:3===t?[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])]:t>=4?[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]:void 0),Sz[r]})(e.filter(function(e){return"token"!==e})).reduce(function(e,t){return SU(SU({},e),r[t])},t)}(s.className,Object.assign({},s.style,void 0===a?{}:a),n)})}else p=SU(SU({},s),{},{className:s.className.join(" ")});var b=f(r.children);return Q.default.createElement(u,SF({key:o},p),b)}}({node:e,stylesheet:r,useInlineStyles:n,key:"code-segment-".concat(t)})})}function SX(e){return e&&void 0!==e.highlightAuto}var SJ=($=e.i(16907).default,U={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},namespace:{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},function(e){var t,r,n=e.language,a=e.children,i=e.style,o=void 0===i?U:i,s=e.customStyle,l=void 0===s?{}:s,u=e.codeTagProps,c=void 0===u?{className:n?"language-".concat(n):void 0,style:SG(SG({},o['code[class*="language-"]']),o['code[class*="language-'.concat(n,'"]')])}:u,d=e.useInlineStyles,p=void 0===d||d,f=e.showLineNumbers,m=void 0!==f&&f,h=e.showInlineLineNumbers,g=void 0===h||h,b=e.startingLineNumber,y=void 0===b?1:b,v=e.lineNumberContainerStyle,_=e.lineNumberStyle,w=void 0===_?{}:_,E=e.wrapLines,x=e.wrapLongLines,S=void 0!==x&&x,k=e.lineProps,T=e.renderer,A=e.PreTag,N=void 0===A?"pre":A,I=e.CodeTag,C=void 0===I?"code":I,R=e.code,O=void 0===R?(Array.isArray(a)?a[0]:a)||"":R,L=e.astGenerator,P=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(e,SB);L=L||$;var D=m?Q.default.createElement(Sq,{containerStyle:v,codeStyle:c.style||{},numberStyle:w,startingLineNumber:y,codeString:O}):null,M=o.hljs||o['pre[class*="language-"]']||{backgroundColor:"#fff"},j=SX(L)?"hljs":"prismjs",F=p?Object.assign({},P,{style:Object.assign({},M,l)}):Object.assign({},P,{className:P.className?"".concat(j," ").concat(P.className):j,style:Object.assign({},l)});if(S?c.style=SG({whiteSpace:"pre-wrap"},c.style):c.style=SG({whiteSpace:"pre"},c.style),!L)return Q.default.createElement(N,F,D,Q.default.createElement(C,c,O));(void 0===E&&T||S)&&(E=!0),T=T||SY;var z=[{type:"text",value:O}],B=function(e){var t=e.astGenerator,r=e.language,n=e.code,a=e.defaultCodeValue;if(SX(t)){var i=-1!==t.listLanguages().indexOf(r);return"text"===r?{value:a,language:"text"}:i?t.highlight(r,n):t.highlightAuto(n)}try{return r&&"text"!==r?{value:t.highlight(n,r)}:{value:a}}catch(e){return{value:a}}}({astGenerator:L,language:n,code:O,defaultCodeValue:z});null===B.language&&(B.value=z);var H=y+(null!=(t=null==(r=O.match(/\n/g))?void 0:r.length)?t:0),G=function(e,t,r,n,a,i,o,s,l){var u,c=function e(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=0;a<t.length;a++){var i=t[a];if("text"===i.type)n.push(SK({children:[i],className:SD(new Set(r))}));else if(i.children){var o=r.concat(i.properties.className);e(i.children,o).forEach(function(e){return n.push(e)})}}return n}(e.value),d=[],p=-1,f=0;function m(e,i){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t||u.length>0?function(e,i){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return SK({children:e,lineNumber:i,lineNumberStyle:s,largestLineNumber:o,showInlineLineNumbers:a,lineProps:r,className:u,showLineNumbers:n,wrapLongLines:l,wrapLines:t})}(e,i,u):function(e,t){if(n&&t&&a){var r=SZ(s,t,o);e.unshift(SW(t,r))}return e}(e,i)}for(;f<c.length;)!function(){var e=c[f],t=e.children[0].value;if(t.match(SV)){var r=t.split("\n");r.forEach(function(t,a){var o=n&&d.length+i,s={type:"text",value:"".concat(t,"\n")};if(0===a){var l=m(c.slice(p+1,f).concat(SK({children:[s],className:e.properties.className})),o);d.push(l)}else if(a===r.length-1){var u=c[f+1]&&c[f+1].children&&c[f+1].children[0],h={type:"text",value:"".concat(t)};if(u){var g=SK({children:[h],className:e.properties.className});c.splice(f+1,0,g)}else{var b=m([h],o,e.properties.className);d.push(b)}}else{var y=m([s],o,e.properties.className);d.push(y)}}),p=f}f++}();if(p!==c.length-1){var h=c.slice(p+1,c.length);if(h&&h.length){var g=m(h,n&&d.length+i);d.push(g)}}return t?d:(u=[]).concat.apply(u,d)}(B,E,void 0===k?{}:k,m,g,y,H,w,S);return Q.default.createElement(N,F,Q.default.createElement(C,c,!g&&D,T({rows:G,stylesheet:o,useInlineStyles:p})))});SJ.supportedLanguages=["abap","abnf","actionscript","ada","agda","al","antlr4","apacheconf","apex","apl","applescript","aql","arduino","arff","asciidoc","asm6502","asmatmel","aspnet","autohotkey","autoit","avisynth","avro-idl","bash","basic","batch","bbcode","bicep","birb","bison","bnf","brainfuck","brightscript","bro","bsl","c","cfscript","chaiscript","cil","clike","clojure","cmake","cobol","coffeescript","concurnas","coq","cpp","crystal","csharp","cshtml","csp","css-extras","css","csv","cypher","d","dart","dataweave","dax","dhall","diff","django","dns-zone-file","docker","dot","ebnf","editorconfig","eiffel","ejs","elixir","elm","erb","erlang","etlua","excel-formula","factor","false","firestore-security-rules","flow","fortran","fsharp","ftl","gap","gcode","gdscript","gedcom","gherkin","git","glsl","gml","gn","go-module","go","graphql","groovy","haml","handlebars","haskell","haxe","hcl","hlsl","hoon","hpkp","hsts","http","ichigojam","icon","icu-message-format","idris","iecst","ignore","inform7","ini","io","j","java","javadoc","javadoclike","javascript","javastacktrace","jexl","jolie","jq","js-extras","js-templates","jsdoc","json","json5","jsonp","jsstacktrace","jsx","julia","keepalived","keyman","kotlin","kumir","kusto","latex","latte","less","lilypond","liquid","lisp","livescript","llvm","log","lolcode","lua","magma","makefile","markdown","markup-templating","markup","matlab","maxscript","mel","mermaid","mizar","mongodb","monkey","moonscript","n1ql","n4js","nand2tetris-hdl","naniscript","nasm","neon","nevod","nginx","nim","nix","nsis","objectivec","ocaml","opencl","openqasm","oz","parigp","parser","pascal","pascaligo","pcaxis","peoplecode","perl","php-extras","php","phpdoc","plsql","powerquery","powershell","processing","prolog","promql","properties","protobuf","psl","pug","puppet","pure","purebasic","purescript","python","q","qml","qore","qsharp","r","racket","reason","regex","rego","renpy","rest","rip","roboconf","robotframework","ruby","rust","sas","sass","scala","scheme","scss","shell-session","smali","smalltalk","smarty","sml","solidity","solution-file","soy","sparql","splunk-spl","sqf","sql","squirrel","stan","stylus","swift","systemd","t4-cs","t4-templating","t4-vb","tap","tcl","textile","toml","tremor","tsx","tt2","turtle","twig","typescript","typoscript","unrealscript","uorazor","uri","v","vala","vbnet","velocity","verilog","vhdl","vim","visual-basic","warpscript","wasm","web-idl","wiki","wolfram","wren","xeora","xml-doc","xojo","xquery","yaml","yang","zig"];let SQ={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}},S0=Q.default.memo(({content:e,className:t=""})=>(0,J.jsx)("div",{className:rZ("prose min-w-0 max-w-full overflow-hidden break-words text-sm leading-relaxed text-inherit [&_h1:first-child]:mt-0 [&_h1]:mb-4 [&_h1]:mt-6 [&_h1]:font-semibold [&_h2:first-child]:mt-0 [&_h2]:mb-4 [&_h2]:mt-6 [&_h2]:font-semibold [&_h3:first-child]:mt-0 [&_h3]:mb-4 [&_h3]:mt-6 [&_h3]:font-semibold [&_h4:first-child]:mt-0 [&_h4]:mb-4 [&_h4]:mt-6 [&_h4]:font-semibold [&_h5:first-child]:mt-0 [&_h5]:mb-4 [&_h5]:mt-6 [&_h5]:font-semibold [&_h6:first-child]:mt-0 [&_h6]:mb-4 [&_h6]:mt-6 [&_h6]:font-semibold [&_p:last-child]:mb-0 [&_p]:mb-4",t),children:(0,J.jsx)(xE,{remarkPlugins:[SL],components:{code({inline:e,className:t,children:r,...n}){let a=/language-(\w+)/.exec(t||"");return!e&&a?(0,J.jsx)(SJ,{style:SQ,language:a[1],PreTag:"div",className:"max-w-full rounded-md text-sm",wrapLines:!0,wrapLongLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},customStyle:{margin:0,maxWidth:"100%",overflowX:"auto",fontSize:"0.875rem"},children:String(r).replace(/\n$/,"")}):(0,J.jsx)("code",{className:"bg-surface rounded-sm px-1 py-0.5 font-mono text-[0.9em]",...n,children:r})},pre:({children:e})=>(0,J.jsx)("div",{className:"my-4 max-w-full overflow-hidden last:mb-0",children:e}),a:({href:e,children:t})=>(0,J.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-primary no-underline hover:underline",children:t}),blockquote:({children:e})=>(0,J.jsx)("blockquote",{className:"my-4 border-l-4 border-border pl-4 italic text-[var(--color-text-tertiary)]",children:e}),ul:({children:e})=>(0,J.jsx)("ul",{className:"my-4 pl-6 [&>li:last-child]:mb-0 [&>li]:mb-1",children:e}),ol:({children:e})=>(0,J.jsx)("ol",{className:"my-4 pl-6 [&>li:last-child]:mb-0 [&>li]:mb-1",children:e}),table:({children:e})=>(0,J.jsx)("div",{className:"my-4 overflow-x-auto",children:(0,J.jsx)("table",{className:"[&_th]:bg-surface w-full border-collapse [&_td]:border [&_td]:border-border [&_td]:p-2 [&_th]:border [&_th]:border-border [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold",children:e})})},children:e})}));function S1({steps:e,hideFinalText:t,compact:r=!1}){let n=new Map;for(let t of e)"tool_result"===t.kind&&t.toolCallId&&n.set(t.toolCallId,t.text);let a=-1;if(t){for(let t=e.length-1;t>=0;t--)if("text"===e[t].kind){a=t;break}}return(0,J.jsx)("div",{className:rZ("flex flex-col gap-1",r&&"gap-0.5"),children:e.map((e,t)=>{if(t===a)return null;if("tool_call"===e.kind){let a={id:e.id,name:e.name,args:e.args,result:n.get(e.id),status:n.has(e.id)?"completed":"pending"};return(0,J.jsx)(_l,{toolCall:a,compact:r},e.id||`tc-${t}`)}return"text"===e.kind?(0,J.jsx)("div",{className:rZ("px-2 text-sm",r&&"px-1 text-xs"),children:(0,J.jsx)(S0,{content:e.text,className:r?"text-xs leading-5 [&_blockquote]:my-2 [&_blockquote]:pl-2 [&_h1]:mb-2 [&_h1]:mt-3 [&_h1]:text-base [&_h2]:mb-2 [&_h2]:mt-3 [&_h2]:text-base [&_h3]:mb-1.5 [&_h3]:mt-3 [&_h3]:text-sm [&_h4]:mb-1.5 [&_h4]:mt-3 [&_h4]:text-sm [&_ol]:my-2 [&_ol]:pl-5 [&_p]:mb-2 [&_table]:text-[11px] [&_td]:p-1.5 [&_th]:p-1.5 [&_ul]:my-2 [&_ul]:pl-5":void 0})},`txt-${t}`):null})})}function S2(e){switch(e){case"running":case"pending":case"busy":return"running";case"success":return"success";case"error":case"timeout":return"error";case"cancelled":case"interrupted":return"cancelled";default:return"unknown"}}S0.displayName="MarkdownContent";let S4={"writing-agent":"Writing agent","data-analysis-agent":"Data analysis agent"},S3="[Async tasks update]";function S5(e){return`${e.task_id}:${e.run_id||"legacy"}`}function S6(e){let t=e.trim().split(/\r?\n/);if(t[0]!==S3||!t[1])return null;try{let e=JSON.parse(t[1]);if("string"!=typeof e.task_id||!e.task_id)return null;return{taskId:e.task_id,runId:"string"==typeof e.run_id&&e.run_id?e.run_id:void 0}}catch{return null}}function S9(e,t){let r=S6(e);return!!r&&r.taskId===t.task_id&&(!r.runId||r.runId===t.run_id)}function S8(e){let t=e.liveStatus||e.status||"success";return[S3,JSON.stringify({agent:e.agent_name,kind:"agent",...e.run_id?{run_id:e.run_id}:{},status:t,task_id:e.task_id}),"(Signal only — fetch full result via check_async_task (sub-agents) if relevant to the current step, else acknowledge & continue.)"].join("\n")}let S7={running:{dot:"bg-[var(--color-warning)]",label:"Running",pulse:!0},success:{dot:"bg-[var(--color-success)]",label:"Done",pulse:!1},error:{dot:"bg-[var(--color-error)]",label:"Error",pulse:!1},cancelled:{dot:"bg-muted-foreground",label:"Cancelled",pulse:!1},unknown:{dot:"bg-muted-foreground",label:"Unknown",pulse:!1}};function ke(e){let t=S2(e);return"success"===t||"error"===t||"cancelled"===t}function kt(e){return e.filter(e=>"running"===S2(e.liveStatus??e.status)).length}let kr=ro("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),kn=ro("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),ka=ro("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),ki=ro("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);function ko(e){return"string"==typeof e.content?e.content:Array.isArray(e.content)?e.content.filter(e=>"object"==typeof e&&null!==e&&"type"in e&&"text"===e.type||"string"==typeof e).map(e=>"string"==typeof e?e:"object"==typeof e&&null!==e&&"text"in e&&e.text||"").join(""):""}function ks(e){if("string"==typeof e)return e;if(e&&"object"==typeof e){if(e.description&&"string"==typeof e.description)return e.description;if(e.prompt&&"string"==typeof e.prompt)return e.prompt;if(e.result&&"string"==typeof e.result)return e.result}return JSON.stringify(e,null,2)}async function kl(e){try{if("u">typeof navigator&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{if("u"<typeof document)return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}finally{t.remove()}}catch{return!1}}let ku=Q.default.memo(({message:e,toolCalls:t,isLoading:r,actionRequests:n,submittedActionRequestKeys:a,onActionRequestSubmitted:i,reviewConfigsMap:o,ui:s,stream:l,onResumeInterrupt:u,graphId:c,onEditMessage:d,autoApprove:p,subAgentSteps:f})=>{let m="human"===e.type,h=ko(e),g=h&&""!==h.trim(),b=t.length>0,y=(0,Q.useMemo)(()=>{let t=e.additional_kwargs?.reasoning_content;return"string"==typeof t&&t.trim()?t.trim():null},[e.additional_kwargs]),v=(0,Q.useMemo)(()=>t.filter(e=>"task"===e.name&&e.args.subagent_type&&""!==e.args.subagent_type&&null!==e.args.subagent_type).map(e=>{let t=e.args.subagent_type;return{id:e.id,name:e.name,subAgentName:t,input:e.args,output:e.result?{result:e.result}:void 0,status:e.status}}),[t]),_=(0,Q.useMemo)(()=>{let e=new Map;if(!n||0===n.length)return e;let r=new Map;n.forEach((e,t)=>{let n=r.get(e.name),a={actionRequest:e,actionIndex:t};n?n.push(a):r.set(e.name,[a])});let a=new Map;for(let n of t){let t=r.get(n.name);if(!t)continue;let i=a.get(n.name)??0;i<t.length&&(e.set(n.id,t[i]),a.set(n.name,i+1))}return e},[n,t]),w=(0,Q.useMemo)(()=>JSON.stringify((n??[]).map(e=>({name:e.name,args:e.args}))),[n]),E=(0,Q.useRef)({});(0,Q.useEffect)(()=>{E.current={}},[w]);let x=(0,Q.useCallback)((e,t)=>{let r=t?.decisions;if(!Array.isArray(r)||!n?.length||1===n.length||r.length===n.length)return void u?.(t);let a=r[0],i={...E.current,[e]:a};E.current=i,n.every((e,t)=>i[t])&&(E.current={},u?.({decisions:n.map((e,t)=>i[t])}))},[n,u]),[S,k]=(0,Q.useState)(!1),[T,A]=(0,Q.useState)(!1),N=(0,Q.useCallback)(async()=>{h&&(await kl(h)?(A(!0),setTimeout(()=>A(!1),2e3)):u_.toast.error("Couldn't copy to clipboard."))},[h]),[I,C]=(0,Q.useState)({}),R=(0,Q.useCallback)(e=>I[e]??!1,[I]),O=(0,Q.useCallback)(e=>{C(t=>({...t,[e]:!t[e]}))},[]);return m&&null!==S6(h)?(0,J.jsx)("div",{className:"flex w-full justify-center py-1.5",children:(0,J.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-3 py-1 text-xs text-muted-foreground",children:[(0,J.jsx)(kr,{className:"size-3 text-[var(--brand)]","aria-hidden":"true"}),"Background agent reported back"]})}):(0,J.jsx)("div",{className:rZ("group flex w-full max-w-full overflow-x-hidden",m&&"flex-row-reverse"),children:(0,J.jsxs)("div",{className:rZ("min-w-0 max-w-full",m?"max-w-[70%]":"w-full"),children:[!m&&y&&(0,J.jsxs)("div",{className:"mt-4",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>k(e=>!e),"aria-expanded":S,className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground",children:[(0,J.jsx)(ka,{className:rZ("h-3.5 w-3.5 transition-transform",S&&"rotate-90"),"aria-hidden":"true"}),(0,J.jsx)(kn,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Thinking"]}),S&&(0,J.jsx)("div",{className:"mt-2 whitespace-pre-wrap break-words border-l-2 border-border pl-3 text-sm leading-relaxed text-muted-foreground",children:y})]}),g&&(0,J.jsx)("div",{className:rZ("relative flex items-end gap-0"),children:(0,J.jsx)("div",{className:rZ("mt-4 overflow-hidden break-words text-sm font-normal leading-[150%]",m?"rounded-xl rounded-br-none border border-border px-3 py-2 text-foreground":"text-primary"),style:m?{backgroundColor:"var(--color-user-message-bg)"}:void 0,children:m?(0,J.jsx)("p",{className:"m-0 whitespace-pre-wrap break-words text-sm leading-relaxed",children:h}):g?(0,J.jsx)(S0,{content:h}):null})}),!m&&g&&(0,J.jsx)("div",{className:"mt-1",children:(0,J.jsx)("button",{type:"button",onClick:N,"aria-label":T?"Copied":"Copy message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:T?(0,J.jsx)(ln,{className:"h-4 w-4","aria-hidden":"true"}):(0,J.jsx)(ki,{className:"h-4 w-4","aria-hidden":"true"})})}),m&&g&&(0,J.jsxs)("div",{className:"mt-1 flex justify-end gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100",children:[(0,J.jsx)("button",{type:"button",onClick:N,"aria-label":T?"Copied":"Copy message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:T?(0,J.jsx)(ln,{className:"h-4 w-4","aria-hidden":"true"}):(0,J.jsx)(ki,{className:"h-4 w-4","aria-hidden":"true"})}),(0,J.jsx)("button",{type:"button",onClick:()=>d?.(h),"aria-label":"Edit message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:(0,J.jsx)(a4,{className:"h-4 w-4","aria-hidden":"true"})})]}),b&&(0,J.jsx)("div",{className:"mt-4 flex w-full flex-col",children:t.map(e=>{if("task"===e.name)return null;let t=s?.find(t=>t.metadata?.tool_call_id===e.id),n=_.get(e.id),d=n?.actionRequest,f=n?e.id:void 0,m=o?.get(e.name);return(0,J.jsx)(_l,{toolCall:e,uiComponent:t,stream:l,graphId:c,actionRequest:d,actionRequestKey:f,actionRequestSubmitted:f?a?.has(f):void 0,onActionRequestSubmitted:i,reviewConfig:m,onResume:n?e=>x(n.actionIndex,e):u,isLoading:r,autoApprove:p},e.id)})}),!m&&v.length>0&&(0,J.jsx)("div",{className:"flex w-fit max-w-full flex-col gap-4",children:v.map(e=>(0,J.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,J.jsx)("div",{className:"flex items-end gap-2",children:(0,J.jsx)("div",{className:"w-[calc(100%-100px)]",children:(0,J.jsx)(v5,{subAgent:e,onClick:()=>O(e.id),isExpanded:R(e.id)})})}),R(e.id)&&(0,J.jsx)("div",{className:"w-full max-w-full",children:(0,J.jsxs)("div",{className:"bg-surface border-border-light rounded-md border p-4",children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Input"}),(0,J.jsx)("div",{className:"mb-4",children:(0,J.jsx)(S0,{content:ks(e.input)})}),(f?.[e.id]?.length??0)>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Steps"}),(0,J.jsx)("div",{className:"mb-4",children:(0,J.jsx)(S1,{steps:f[e.id],hideFinalText:!!e.output})})]}),e.output&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Output"}),(0,J.jsx)(S0,{content:ks(e.output)})]})]})})]},e.id))})]})})});ku.displayName="ChatMessage";let kc=ro("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),kd="__other__";function kp({questions:e,onSubmit:t,onCancel:r,isLoading:n}){let[a,i]=(0,Q.useState)(()=>e.map(()=>"")),[o,s]=(0,Q.useState)(()=>e.map(()=>null)),l=(e,t)=>i(r=>r.map((r,n)=>n===e?t:r)),u=(e,t)=>s(r=>r.map((r,n)=>n===e?t:r)),c=e=>"text"===e.type&&!1===e.required,d=e.every((e,t)=>c(e)||""!==a[t].trim());return(0,J.jsxs)("div",{className:"w-full rounded-lg border border-border bg-muted/30 p-4",children:[(0,J.jsxs)("div",{className:"mb-3 flex items-center gap-2 text-foreground",children:[(0,J.jsx)(kc,{size:16,className:"text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"EvoScientist Needs Your Input"})]}),(0,J.jsx)("div",{className:"space-y-5",children:e.map((e,t)=>(0,J.jsxs)("div",{children:[(0,J.jsxs)("p",{className:"mb-2 text-sm font-medium text-foreground",children:[e.question,!c(e)&&(0,J.jsx)("span",{className:"ml-1 text-destructive",children:"*"})]}),"multiple_choice"===e.type?(0,J.jsxs)("div",{className:"flex flex-col gap-2",children:[e.choices?.map(e=>{let r=o[t]===e.value;return(0,J.jsx)("button",{type:"button",disabled:n,onClick:()=>{u(t,e.value),l(t,e.value)},className:rZ("rounded-md border px-3 py-2 text-left text-sm transition-colors",r?"border-[var(--brand-solid)] bg-[var(--brand-solid)] text-[var(--brand-foreground)]":"border-border bg-background hover:bg-accent"),children:e.value},e.value)}),(0,J.jsx)("button",{type:"button",disabled:n,onClick:()=>{u(t,kd),l(t,"")},className:rZ("rounded-md border px-3 py-2 text-left text-sm transition-colors",o[t]===kd?"border-[var(--brand)] text-foreground":"border-border bg-background hover:bg-accent"),children:"Other…"}),o[t]===kd&&(0,J.jsx)(_o,{value:a[t],onChange:e=>l(t,e.target.value),placeholder:"Type your answer…",className:"text-sm",rows:2,disabled:n})]}):(0,J.jsx)(_o,{value:a[t],onChange:e=>l(t,e.target.value),placeholder:c(e)?"Type your answer… (optional)":"Type your answer…",className:"text-sm",rows:2,disabled:n})]},t))}),(0,J.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,J.jsx)(na,{variant:"outline",size:"sm",onClick:r,disabled:n,children:"Cancel"}),(0,J.jsx)(na,{size:"sm",onClick:()=>t(a),disabled:!d||n,className:"bg-[var(--brand-solid)] text-[var(--brand-foreground)] hover:opacity-90",children:n?"Submitting…":"Submit"})]})]})}let kf="evoscientist-auto-approve",km="__new__";function kh(){try{let e=localStorage.getItem(kf);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function kg(e){try{localStorage.setItem(kf,JSON.stringify(e))}catch{}}function kb(e){return!0===kh()[e??km]}function ky(e,t){let r=kh(),n=e??km;t?r[n]=!0:delete r[n],kg(r)}function kv(e,t){let r=t?.enabled??!0,n=t?.intervalMs??3e3,a=nj(),[i,o]=(0,Q.useState)([]),[s,l]=(0,Q.useState)(!1),[u,c]=(0,Q.useState)(null),d=(0,Q.useRef)(0),p=(0,Q.useRef)(!0),f=(0,Q.useCallback)(async()=>{if(!r||!e){o([]),l(!0);return}let t=++d.current;try{let r=await a.threads.getState(e),n=function(e){if(!e||"object"!=typeof e)return[];let t=[];for(let r of Object.values(e))r&&"object"==typeof r&&"string"==typeof r.task_id&&"string"==typeof r.agent_name&&t.push({task_id:r.task_id,agent_name:r.agent_name,thread_id:"string"==typeof r.thread_id?r.thread_id:r.task_id,run_id:"string"==typeof r.run_id?r.run_id:"",status:"string"==typeof r.status?r.status:"",created_at:"string"==typeof r.created_at?r.created_at:void 0,last_updated_at:"string"==typeof r.last_updated_at?r.last_updated_at:void 0});return t.sort((e,t)=>(t.created_at??"").localeCompare(e.created_at??"")),t}(r.values?.async_tasks),i=await Promise.all(n.map(async e=>{if(!e.run_id)return{...e,liveStatus:e.status,startedAt:e.created_at};try{let t=await a.runs.get(e.thread_id,e.run_id),r=t.status??e.status;return{...e,liveStatus:r,startedAt:t.created_at??e.created_at,endedAt:ke(r)?t.updated_at??e.last_updated_at:void 0}}catch{return{...e,liveStatus:e.status,startedAt:e.created_at}}}));if(t!==d.current||!p.current)return;o(i),c(null)}catch{t===d.current&&p.current&&c("Couldn't load background agents.")}finally{t===d.current&&p.current&&l(!0)}},[a,e,r]);return(0,Q.useEffect)(()=>{if(p.current=!0,!r)return o([]),l(!0),()=>{p.current=!1};l(!1),f();let e=setInterval(()=>{document.hidden||f()},n);return()=>{p.current=!1,clearInterval(e)}},[f,r,n]),{tasks:i,loaded:s,error:u,refresh:f}}let k_="evoscientist-auto-notify",kw="evoscientist-auto-notify-reported",kE="evo-auto-notify-change";function kx(){try{let e=localStorage.getItem(k_);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function kS(){try{let e=localStorage.getItem(kw);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function kk(e){try{localStorage.setItem(kw,JSON.stringify(e))}catch{}}function kT(e){return!!e&&!1!==kx()[e]}function kA(e,t){if(!e)return;let r=kS(),n=r[e];r[e]={initialized:!0,keys:Array.from(new Set([...n?.keys??[],...t]))},kk(r)}function kN(e,t){if(!e)return;let r=kS(),n=r[e];r[e]={initialized:n?.initialized??!0,keys:Array.from(new Set([...n?.keys??[],t]))},kk(r)}function kI(e){let[t,r]=(0,Q.useState)(()=>kT(e));return(0,Q.useEffect)(()=>{let t=()=>r(kT(e));return t(),window.addEventListener(kE,t),window.addEventListener("storage",t),()=>{window.removeEventListener(kE,t),window.removeEventListener("storage",t)}},[e]),[t,(0,Q.useCallback)(t=>(function(e,t){if(!e)return;let r=kx();t?delete r[e]:r[e]=!1;try{localStorage.setItem(k_,JSON.stringify(r))}catch{}window.dispatchEvent(new Event(kE))})(e,t),[e])]}let kC={damping:.7,stiffness:.05,mass:1.25},kR=1e3/60,kO=!1;function kL(e,t){let r=(0,Q.useCallback)(t=>(r.current=t,e(t)),t);return r}globalThis.document?.addEventListener("mousedown",()=>{kO=!0}),globalThis.document?.addEventListener("mouseup",()=>{kO=!1}),globalThis.document?.addEventListener("click",()=>{kO=!1});let kP=new Map;function kD(...e){let t={...kC},r=!1;for(let n of e){if("instant"===n){r=!0;continue}"object"==typeof n&&(r=!1,t.damping=n.damping??t.damping,t.stiffness=n.stiffness??t.stiffness,t.mass=n.mass??t.mass)}let n=JSON.stringify(t);return kP.has(n)||kP.set(n,Object.freeze(t)),r?"instant":kP.get(n)}let kM=ro("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),kj=ro("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),kF=ro("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),k$=lO?e=>{e()}:Q.default.startTransition,kU=l5(ur,()=>(e,t,r={})=>{let{mutate:n}=l4(),a=(0,Q.useRef)(e),i=(0,Q.useRef)(t),o=(0,Q.useRef)(r),s=(0,Q.useRef)(0),[l,u,c]=(e=>{let[,t]=(0,Q.useState)({}),r=(0,Q.useRef)(!1),n=(0,Q.useRef)(e),a=(0,Q.useRef)({data:!1,error:!1,isValidating:!1}),i=(0,Q.useCallback)(e=>{let i=!1,o=n.current;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&o[t]!==e[t]&&(o[t]=e[t],a.current[t]&&(i=!0));i&&!r.current&&t({})},[]);return lP(()=>(r.current=!1,()=>{r.current=!0})),[n,a.current,i]})({data:lb,error:lb,isMutating:!1}),d=l.current,p=(0,Q.useCallback)(async(e,t)=>{let[r,l]=lz(a.current);if(!i.current)throw Error("Can’t trigger the mutation: missing fetcher.");if(!r)throw Error("Can’t trigger the mutation: missing key.");let u=l_(l_({populateCache:!1,throwOnError:!0},o.current),t),d=lH();s.current=d,c({isMutating:!0});try{let t=await n(r,i.current(l,{arg:e}),l_(u,{throwOnError:!0}));return s.current<=d&&(k$(()=>c({data:t,isMutating:!1,error:void 0})),null==u.onSuccess||u.onSuccess.call(u,t,r,u)),t}catch(e){if(s.current<=d&&(k$(()=>c({error:e,isMutating:!1})),null==u.onError||u.onError.call(u,e,r,u),u.throwOnError))throw e}},[]),f=(0,Q.useCallback)(()=>{s.current=lH(),c({data:lb,error:lb,isMutating:!1})},[]);return lP(()=>{a.current=e,i.current=t,o.current=r}),{trigger:p,reset:f,get data(){return u.data=!0,d.data},get error(){return u.error=!0,d.error},get isMutating(){return u.isMutating=!0,d.isMutating}}}),kz={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",json:"json",xml:"xml",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",dockerfile:"dockerfile",makefile:"makefile"},kB=Q.default.memo(({file:e,onSaveFile:t,onClose:r,editDisabled:n})=>{let[a,i]=(0,Q.useState)(null===e),[o,s]=(0,Q.useState)(String(e?.path||"")),[l,u]=(0,Q.useState)(String(e?.content||"")),c=kU({kind:"files-update",fileName:o,fileContent:l},async({fileName:e,fileContent:r})=>{if(e&&r)return await t(e,r)},{onSuccess:()=>i(!1),onError:e=>u_.toast.error(`Failed to save file: ${e}`)});(0,Q.useEffect)(()=>{s(String(e?.path||"")),u(String(e?.content||"")),i(null===e)},[e]);let d=(0,Q.useMemo)(()=>{let e=String(o||"");return e.split(".").pop()?.toLowerCase()||""},[o]),p=(0,Q.useMemo)(()=>"md"===d||"markdown"===d,[d]),f=(0,Q.useMemo)(()=>kz[d]||"text",[d]),m=(0,Q.useCallback)(()=>{l&&kl(l)},[l]),h=(0,Q.useCallback)(()=>{if(l&&o){let e=new Blob([l],{type:"text/plain"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=o,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t)}},[l,o]),g=(0,Q.useCallback)(()=>{i(!0)},[]),b=(0,Q.useCallback)(()=>{null===e?r():(s(String(e.path)),u(String(e.content)),i(!1))},[e,r]),y=(0,Q.useMemo)(()=>""!==o.trim()&&!o.includes("/")&&!o.includes(" "),[o]);return(0,J.jsx)(rK,{open:!0,onOpenChange:r,children:(0,J.jsxs)(rJ,{"aria-describedby":void 0,className:"flex h-[80vh] max-h-[80vh] min-w-[60vw] flex-col p-6",children:[(0,J.jsx)(r1,{className:"sr-only",children:e?.path||"New File"}),(0,J.jsxs)("div",{className:"mb-4 flex items-center justify-between border-b border-border pb-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(kM,{className:"h-5 w-5 shrink-0 text-[var(--color-text-tertiary)]"}),a&&null===e?(0,J.jsx)(nu,{value:o,onChange:e=>s(e.target.value),placeholder:"Enter filename…",className:"text-base font-medium","aria-invalid":!y}):(0,J.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-base font-medium text-primary",children:e?.path})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:!a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{onClick:g,variant:"ghost",size:"sm",className:"h-8 px-2",disabled:n,children:[(0,J.jsx)(n$,{size:16,className:"mr-1"}),"Edit"]}),(0,J.jsxs)(na,{onClick:m,variant:"ghost",size:"sm",className:"h-8 px-2",children:[(0,J.jsx)(ki,{size:16,className:"mr-1"}),"Copy"]}),(0,J.jsxs)(na,{onClick:h,variant:"ghost",size:"sm",className:"h-8 px-2",children:[(0,J.jsx)(kj,{size:16,className:"mr-1"}),"Download"]})]})})]}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:a?(0,J.jsx)(_o,{value:l,onChange:e=>u(e.target.value),placeholder:"Enter file content…",className:"h-full min-h-[400px] resize-none font-mono text-sm"}):(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"p-4",children:l?p?(0,J.jsx)("div",{className:"rounded-md p-6",children:(0,J.jsx)(S0,{content:l})}):(0,J.jsx)(SJ,{language:f,style:SQ,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem"},showLineNumbers:!0,wrapLines:!0,lineProps:{style:{whiteSpace:"pre-wrap"}},children:l}):(0,J.jsx)("div",{className:"flex items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"File is empty"})})})})}),a&&(0,J.jsxs)("div",{className:"mt-4 flex justify-end gap-2 border-t border-border pt-4",children:[(0,J.jsxs)(na,{onClick:b,variant:"outline",size:"sm",children:[(0,J.jsx)(rs,{size:16,className:"mr-1"}),"Cancel"]}),(0,J.jsxs)(na,{onClick:()=>c.trigger(),size:"sm",disabled:c.isMutating||!o.trim()||!l.trim()||!y,children:[c.isMutating?(0,J.jsx)(a1,{size:16,className:"mr-1 animate-spin"}):(0,J.jsx)(kF,{size:16,className:"mr-1"}),"Save"]})]})]})})});function kH({files:e,setFiles:t,editDisabled:r}){let[n,a]=(0,Q.useState)(null),i=(0,Q.useCallback)(async(r,n)=>{await t({...e,[r]:n}),a({path:r,content:n})},[e,t]);return(0,J.jsxs)(J.Fragment,{children:[0===Object.keys(e).length?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-4 text-center",children:(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:"No files created yet"})}):(0,J.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(256px,1fr))] gap-2",children:Object.keys(e).map(t=>{let r,n=String(t),i=e[t];if("object"==typeof i&&null!==i&&"content"in i){let e=i.content;r=Array.isArray(e)?e.join("\n"):String(e||"")}else r=String(i||"");return(0,J.jsxs)("button",{type:"button",onClick:()=>a({path:n,content:r}),className:"cursor-pointer space-y-1 truncate rounded-md border border-border px-2 py-3 shadow-sm transition-colors",style:{backgroundColor:"var(--color-file-button)"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="var(--color-file-button-hover)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="var(--color-file-button)"},children:[(0,J.jsx)(kM,{size:24,className:"mx-auto text-muted-foreground"}),(0,J.jsx)("span",{className:"mx-auto block w-full truncate break-words text-center text-sm leading-relaxed text-foreground",children:n})]},n)})}),n&&(0,J.jsx)(kB,{file:n,onSaveFile:i,onClose:()=>a(null),editDisabled:r})]})}kB.displayName="FileViewDialog",Q.default.memo(({todos:e,files:t,setFiles:r})=>{let{isLoading:n,interrupt:a}=vq(),[i,o]=(0,Q.useState)(!1),[s,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(e.length),c=(0,Q.useRef)(Object.keys(t).length);(0,Q.useEffect)(()=>{0===u.current&&e.length>0&&o(!0),u.current=e.length},[e.length]);let d=Object.keys(t).length;(0,Q.useEffect)(()=>{0===c.current&&d>0&&l(!0),c.current=d},[d]);let p=(0,Q.useCallback)(e=>{switch(e){case"completed":return(0,J.jsx)(vK,{size:12,className:"text-[var(--color-success)]"});case"in_progress":return(0,J.jsx)(vY,{size:12,className:"text-[var(--color-warning)]"});default:return(0,J.jsx)(vX,{size:10,className:"text-[var(--color-text-tertiary)]"})}},[]),f=(0,Q.useMemo)(()=>({pending:e.filter(e=>"pending"===e.status),in_progress:e.filter(e=>"in_progress"===e.status),completed:e.filter(e=>"completed"===e.status)}),[e]),m={pending:"Pending",in_progress:"In Progress",completed:"Completed"};return(0,J.jsx)("div",{className:"min-h-0 w-full flex-1",children:(0,J.jsx)("div",{className:"font-inter flex h-full w-full flex-col p-0",children:(0,J.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-hidden",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between px-3 pb-1.5 pt-2",children:[(0,J.jsx)("span",{className:"text-xs font-semibold tracking-wide text-zinc-600",children:"AGENT TASKS"}),(0,J.jsx)("button",{onClick:()=>o(e=>!e),className:rZ("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-transform duration-200 hover:bg-muted",i?"rotate-180":"rotate-0"),"aria-label":"Toggle tasks panel",children:(0,J.jsx)(la,{size:14})})]}),i&&(0,J.jsx)("div",{className:"bg-muted-secondary rounded-xl px-3 pb-2",children:(0,J.jsx)(ij,{className:"h-full",children:0===e.length?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-4 text-center",children:(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:"No tasks created yet"})}):(0,J.jsx)("div",{className:"ml-1 p-0.5",children:Object.entries(f).map(([e,t])=>(0,J.jsxs)("div",{className:"mb-4",children:[(0,J.jsx)("h3",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-tertiary",children:m[e]}),t.map((t,r)=>(0,J.jsxs)("div",{className:"mb-1.5 flex items-start gap-2 rounded-sm p-1 text-sm",children:[p(t.status),(0,J.jsx)("span",{className:"flex-1 break-words leading-relaxed text-inherit",children:t.content})]},`${e}_${t.id}_${r}`))]}))})})}),(0,J.jsxs)("div",{className:"flex items-center justify-between px-3 pb-1.5 pt-2",children:[(0,J.jsx)("span",{className:"text-xs font-semibold tracking-wide text-zinc-600",children:"FILE SYSTEM"}),(0,J.jsx)("button",{onClick:()=>l(e=>!e),className:rZ("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-transform duration-200 hover:bg-muted",s?"rotate-180":"rotate-0"),"aria-label":"Toggle files panel",children:(0,J.jsx)(la,{size:14})})]}),s&&(0,J.jsx)(kH,{files:t,setFiles:r,editDisabled:!0===n||void 0!==a})]})})})}).displayName="TasksFilesSidebar";let kG=ro("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),kV=ro("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),kq=ro("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),kW=ro("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),kZ=ro("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]),kK=ro("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),kY={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",sh:"bash",bash:"bash",zsh:"bash",json:"json",jsonl:"json",xml:"xml",html:"html",css:"css",scss:"scss",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",tex:"latex",bib:"latex",r:"r"},kX=new Set(["png","jpg","jpeg","gif","webp","svg","bmp"]),kJ=new Set([...Object.keys(kY),"txt","md","markdown","log","csv","tsv","cfg","conf","env","gitignore"]);function kQ(e,t=!1){let r=new URLSearchParams({path:e});return t&&r.set("download","1"),`/api/workspace/file?${r.toString()}`}let k0=Q.default.memo(({path:e,size:t,onClose:r,onChanged:n})=>{let[a,i]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),[c,d]=(0,Q.useState)(!1),[p,f]=(0,Q.useState)(""),[m,h]=(0,Q.useState)(!1),[g,b]=(0,Q.useState)(null),[y,v]=(0,Q.useState)(!1),[_,w]=(0,Q.useState)(!1),[E,x]=(0,Q.useState)(null),S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]);let k=e?e.split("/").pop()||e:"",T=(0,Q.useMemo)(()=>k.includes(".")?k.split(".").pop().toLowerCase():"",[k]),A=kX.has(T)?"image":"pdf"===T?"pdf":kJ.has(T)?"text":"binary",N="text"===A&&null!=t&&t>2097152;if((0,Q.useEffect)(()=>{if(!e||"text"!==A||N)return void i(null);let t=!1;return s(!0),u(null),d(!1),b(null),fetch(kQ(e)).then(async e=>{if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||`Failed to load file (${e.status})`)}return e.text()}).then(e=>{t||i(e)}).catch(e=>{t||u(e.message??"Failed to load file.")}).finally(()=>{t||s(!1)}),()=>{t=!0}},[e,A,N]),!e)return null;let I="md"===T||"markdown"===T,C=kY[T]||"text",R=c&&null!==a&&p!==a,O=e=>{R?x(e):"close"===e?r():d(!1)},L=async()=>{h(!0),b(null);try{let t=await fetch(kQ(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:p})}),r=await t.json().catch(()=>null);if(!t.ok)throw Error(r?.error||"Failed to save.");if(!S.current)return;i(p),d(!1),n?.()}catch(e){S.current&&b(e instanceof Error?e.message:"Failed to save.")}finally{S.current&&h(!1)}},P=async()=>{v(!0),b(null);try{let t=await fetch(kQ(e),{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to delete.")}n?.(),r()}catch(e){S.current&&(w(!1),b(e instanceof Error?e.message:"Failed to delete."))}finally{S.current&&v(!1)}};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(rK,{open:!0,onOpenChange:e=>{e||O("close")},children:(0,J.jsxs)(rJ,{"aria-describedby":void 0,className:"flex h-[80vh] max-h-[80vh] min-w-[60vw] flex-col p-6",children:[(0,J.jsx)(r1,{className:"sr-only",children:e}),(0,J.jsxs)("div",{className:"mb-4 flex items-center justify-between gap-3 border-b border-border pb-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(kM,{className:"h-5 w-5 shrink-0 text-[var(--color-text-tertiary)]"}),(0,J.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-base font-medium text-primary",children:e})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:c?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{O("cancel-edit")},disabled:m,children:[(0,J.jsx)(kK,{size:16,className:"mr-1"}),"Cancel"]}),(0,J.jsxs)(na,{size:"sm",className:"h-8 bg-[var(--brand-solid)] px-3 text-[var(--brand-foreground)] hover:opacity-90",onClick:L,disabled:m||!R,children:[m?(0,J.jsx)(a1,{size:16,className:"mr-1 animate-spin"}):(0,J.jsx)(kF,{size:16,className:"mr-1"}),m?"Saving…":"Save"]})]}):(0,J.jsxs)(J.Fragment,{children:["text"===A&&!N&&(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{f(a??""),b(null),d(!0)},disabled:o||null===a,"aria-label":"Edit file",children:[(0,J.jsx)(a4,{size:16,className:"mr-1"}),"Edit"]}),(0,J.jsx)("a",{href:kQ(e,!0),download:k,children:(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",asChild:!0,children:(0,J.jsxs)("span",{children:[(0,J.jsx)(kj,{size:16,className:"mr-1"}),"Download"]})})}),(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2 text-muted-foreground hover:text-destructive",onClick:()=>w(!0),disabled:y,"aria-label":"Delete file",title:"Delete file",children:y?(0,J.jsx)(a1,{size:16,className:"animate-spin"}):(0,J.jsx)(a8,{size:16})})]})})]}),g&&(0,J.jsx)("p",{role:"alert",className:"mb-2 text-sm text-destructive",children:g}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:c?(0,J.jsx)("textarea",{value:p,onChange:e=>f(e.target.value),spellCheck:!1,"aria-label":"File content",className:"h-full w-full resize-none rounded-md border border-border bg-background p-4 font-mono text-sm leading-relaxed text-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",placeholder:"File is empty…"}):"image"===A?(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"flex items-center justify-center p-4",children:(0,J.jsx)("img",{src:kQ(e),alt:k,className:"max-h-full max-w-full object-contain"})})}):"pdf"===A?(0,J.jsx)("iframe",{src:kQ(e),title:k,className:"h-full w-full rounded-md border border-border"}):"binary"===A||N?(0,J.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-12 text-center",children:[(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:N?"This file is too large to preview inline.":"This file type can't be previewed."}),(0,J.jsx)("a",{href:kQ(e,!0),download:k,children:(0,J.jsxs)(na,{variant:"outline",size:"sm",children:[(0,J.jsx)(kj,{size:16,className:"mr-1"}),"Download file"]})})]}):o?(0,J.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,J.jsx)(a1,{className:"size-5 animate-spin text-muted-foreground"})}):l?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-destructive",children:l})}):(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"p-4",children:a&&a.length>0?I?(0,J.jsx)("div",{className:"rounded-md p-6",children:(0,J.jsx)(S0,{content:a})}):(0,J.jsx)(SJ,{language:C,style:SQ,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem"},showLineNumbers:!0,wrapLines:!0,lineProps:{style:{whiteSpace:"pre-wrap"}},children:a}):(0,J.jsx)("div",{className:"flex items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"File is empty"})})})})})]})}),(0,J.jsx)(rK,{open:null!==E,onOpenChange:e=>{e||x(null)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Discard unsaved changes?"}),(0,J.jsxs)(r2,{children:["Your edits to “",k,"” have not been saved."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>x(null),children:"Keep Editing"}),(0,J.jsx)(na,{onClick:()=>{x(null),"close"===E&&r(),"cancel-edit"===E&&d(!1)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})}),(0,J.jsx)(rK,{open:_,onOpenChange:e=>{y||w(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Delete file?"}),(0,J.jsxs)(r2,{children:["“",k,"” will be permanently removed from the workspace. This can't be undone."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>w(!1),disabled:y,children:"Cancel"}),(0,J.jsx)(na,{onClick:P,disabled:y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:y?"Deleting…":"Delete"})]})]})})]})});async function k1(e){let t=await fetch(`/api/workspace?${new URLSearchParams({path:e})}`),r=await t.json().catch(()=>null);if(!t.ok)throw Error(r?.error||"Failed to list workspace.");return r?.entries??[]}async function k2(){let e=await fetch("/api/workspace?recursive=1"),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||"Failed to load workspace.");return{entries:t?.entries??[],truncated:!!t?.truncated}}k0.displayName="WorkspaceFileDialog";let k4=[{key:"docs",label:"Papers & docs",Icon:kM,exts:["pdf","tex","bib","md","markdown","txt","docx","doc","rtf","odt"]},{key:"figures",label:"Figures",Icon:kq,exts:["png","jpg","jpeg","gif","svg","webp","bmp","tiff","tif","eps"]},{key:"data",label:"Data",Icon:kW,exts:["json","jsonl","csv","tsv","xlsx","xls","parquet","pkl","npy","npz","h5","hdf5","db","sqlite","yaml","yml","xml"]},{key:"code",label:"Code",Icon:kZ,exts:["py","ipynb","js","ts","tsx","jsx","sh","bash","r","jl","cpp","cc","c","h","hpp","java","go","rs","m","rb"]}],k3={key:"other",label:"Other",Icon:vJ},k5={};for(let e of k4)for(let t of e.exts)k5[t]=e.key;function k6(){let[e,t]=(0,Q.useState)("tree"),[r,n]=(0,Q.useState)({}),[a,i]=(0,Q.useState)(new Set),[o,s]=(0,Q.useState)(new Set),[l,u]=(0,Q.useState)(!1),[c,d]=(0,Q.useState)(null),[p,f]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,b]=(0,Q.useState)(null),[y,v]=(0,Q.useState)(null),_=(0,Q.useCallback)(async e=>{s(t=>new Set(t).add(e));try{let t=await k1(e);return n(r=>({...r,[e]:t})),""===e&&b(null),t}catch(t){throw""===e&&b(t instanceof Error?t.message:"Failed to load."),t}finally{s(t=>{let r=new Set(t);return r.delete(e),r})}},[]),w=(0,Q.useCallback)(async()=>{f(!0);try{let{entries:e,truncated:t}=await k2();d(e),h(t),b(null)}catch(e){b(e instanceof Error?e.message:"Failed to load.")}finally{f(!1)}},[]);(0,Q.useEffect)(()=>{u(!0),_("").catch(()=>{}).finally(()=>u(!1))},[]),(0,Q.useEffect)(()=>{"type"!==e||null!==c||p||w()},[e]);let E=(0,Q.useCallback)(async()=>{(b(null),"type"===e)?await w():(u(!0),await Promise.allSettled(["",...a].map(e=>_(e))),u(!1))},[e,a,_,w]),x=(0,Q.useCallback)(e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):(n.add(e),r[e]||_(e).catch(()=>{})),n})},[r,_]),S=(0,Q.useMemo)(()=>{let e={};for(let t of c??[]){let r=k5[t.ext]??k3.key;(e[r]??=[]).push(t)}for(let t of Object.values(e))t.sort((e,t)=>t.mtime-e.mtime);return e},[c]),k="type"===e?p:l,T=(e,t)=>{let n=r[e];return n?0===n.length&&0===t?(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:"No files in the workspace yet"}):n.map(e=>{let r=a.has(e.path),n=o.has(e.path);return(0,J.jsxs)("div",{children:[(0,J.jsxs)("button",{type:"button",onClick:()=>"dir"===e.type?x(e.path):v({path:e.path,size:e.size}),className:"flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left text-sm text-foreground transition-colors hover:bg-muted",style:{paddingLeft:`${14*t+4}px`},title:e.name,children:["dir"===e.type?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center text-muted-foreground",children:n?(0,J.jsx)(a1,{className:"size-3 animate-spin"}):r?(0,J.jsx)(la,{className:"size-3.5"}):(0,J.jsx)(ka,{className:"size-3.5"})}),(0,J.jsx)(kG,{className:"size-4 shrink-0 text-[var(--brand)]"})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("span",{className:"size-4 shrink-0"}),(0,J.jsx)(kM,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,J.jsx)("span",{className:"truncate",children:e.name})]}),"dir"===e.type&&r&&T(e.path,t+1)]},e.path)}):null};return(0,J.jsxs)("div",{className:"flex min-h-0 flex-col",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between gap-2 pb-1.5",children:[(0,J.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted p-0.5 text-xs",children:["tree","type"].map(r=>(0,J.jsx)("button",{type:"button",onClick:()=>t(r),className:rZ("rounded px-2 py-0.5 font-medium transition-colors",e===r?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),"aria-pressed":e===r,children:"tree"===r?"Tree":"By type"},r))}),(0,J.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,J.jsxs)("a",{href:"/api/workspace/download",download:!0,className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:"Download the whole workspace as a zip",children:[(0,J.jsx)(kj,{className:"size-3.5"}),"All"]}),(0,J.jsx)("button",{type:"button",onClick:E,disabled:k,className:"inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50","aria-label":"Refresh workspace",title:"Refresh",children:(0,J.jsx)(kV,{className:rZ("size-3.5",k&&"animate-spin")})})]})]}),g?(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:g}):"tree"===e?l&&!r[""]?(0,J.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,J.jsx)(a1,{className:"size-4 animate-spin text-muted-foreground"})}):(0,J.jsx)("div",{className:"-mx-1",children:T("",0)}):p&&null===c?(0,J.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,J.jsx)(a1,{className:"size-4 animate-spin text-muted-foreground"})}):(()=>{if(!c)return null;if(0===c.length)return(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:"No files in the workspace yet"});let e=[...k4,k3];return(0,J.jsxs)("div",{className:"space-y-3",children:[m&&(0,J.jsx)("p",{className:"px-1 text-[11px] text-muted-foreground",children:"Showing the first files only — the workspace has more than the limit."}),e.map(e=>{let t=S[e.key];if(!t||0===t.length)return null;let r=e.Icon;return(0,J.jsxs)("div",{children:[(0,J.jsxs)("div",{className:"mb-0.5 flex items-center gap-1.5 px-1 text-[10px] font-semibold uppercase tracking-wider text-tertiary",children:[(0,J.jsx)(r,{className:"size-3.5"}),e.label,(0,J.jsxs)("span",{className:"text-muted-foreground",children:["(",t.length,")"]})]}),t.map(e=>{let t=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,J.jsxs)("button",{type:"button",onClick:()=>v({path:e.path,size:e.size}),className:"flex w-full items-center gap-1.5 rounded-md px-1 py-1 text-left text-sm text-foreground transition-colors hover:bg-muted",title:e.path,children:[(0,J.jsx)(r,{className:"size-4 shrink-0 text-muted-foreground"}),(0,J.jsx)("span",{className:"truncate",children:e.name}),t&&(0,J.jsx)("span",{className:"ml-auto shrink-0 truncate pl-2 text-[11px] text-muted-foreground",children:t})]},e.path)})]},e.key)})]})})(),(0,J.jsx)(k0,{path:y?.path??null,size:y?.size,onClose:()=>v(null),onChanged:E})]})}let k9=["Survey recent papers on a topic","Design an experiment plan","Analyze workspace files"],k8=(e,t)=>{switch(e){case"completed":return(0,J.jsx)(vK,{size:16,className:rZ("text-[var(--color-success)]",t)});case"in_progress":return(0,J.jsx)(vY,{size:16,className:rZ("text-[var(--color-warning)]",t)});default:return(0,J.jsx)(vX,{size:16,className:rZ("text-[var(--color-text-tertiary)]",t)})}},k7=Q.default.memo(({assistant:e,onShowAgents:t,onNotifyReady:r})=>{let n,a,i,o,s,l,u,[c,d]=(0,Q.useState)(null),p=(0,Q.useRef)(null),f=(0,Q.useRef)(null),m=(0,Q.useRef)(null),[h,g]=(0,Q.useState)(""),[b,y]=(0,Q.useState)([]),[v,_]=(0,Q.useState)(!1),[w]=ec("threadId"),[E,x]=(0,Q.useState)(()=>kb(w)),[S,k]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),A=(0,Q.useRef)(w),N=(0,Q.useRef)(!1),{scrollRef:I,contentRef:C,scrollToBottom:R}=((e={})=>{let[t,r]=(0,Q.useState)(!1),[n,a]=(0,Q.useState)(!1!==e.initial),[i,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null);s.current=e;let l=(0,Q.useCallback)(()=>{if(!kO)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),u=(0,Q.useCallback)(e=>{d.isAtBottom=e,a(e)},[]),c=(0,Q.useCallback)(e=>{d.escapedFromLock=e,r(e)},[]),d=(0,Q.useMemo)(()=>{let r;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(scrollTop){if(g.current){let{scrollBehavior:e}=getComputedStyle(g.current);"auto"!==e&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=scrollTop,d.ignoreScrollToTop=g.current.scrollTop,"auto"!==e&&(g.current.style.scrollBehavior=e)}},get targetScrollTop(){if(!g.current||!b.current)return 0;return g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!b.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(r?.targetScrollTop===t)return r.calculatedScrollTop;let n=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:b.current}),t),0);return r={targetScrollTop:t,calculatedScrollTop:n},requestAnimationFrame(()=>{r=void 0}),n},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=70}}},[]),p=(0,Q.useCallback)((e={})=>{let t;"string"==typeof e&&(e={animation:e}),e.preserveScrollPosition||u(!0);let r=Date.now()+(Number(e.wait)||0),n=kD(s.current,e.animation),{ignoreEscapes:a=!1}=e,i=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{t=Date.now()}):t=r+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:u}=d,c=performance.now(),f=(c-(d.lastTick??c))/kR;if(d.animation||(d.animation={behavior:n,promise:e,ignoreEscapes:a}),d.animation.behavior===n&&(d.lastTick=c),l()||r>Date.now())return o();if(u<Math.min(i,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if("instant"===n)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*f,d.scrollTop+=d.accumulated,d.scrollTop!==u&&(d.accumulated=0)}return o()}return t>Date.now()?(i=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop)?p({animation:kD(s.current,s.current.resize),ignoreEscapes:a,duration:Math.max(0,t-Date.now())||void 0}):d.isAtBottom});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return(!0!==e.wait&&(d.animation=void 0),d.animation?.behavior===n)?d.animation.promise:o()},[u,l,d]),f=(0,Q.useCallback)(()=>{c(!0),u(!1)},[c,u]),m=(0,Q.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:r}=d,{lastScrollTop:n=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,r&&r>t&&(n=r),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===r)return;if(l()){c(!0),u(!1);return}let e=t>n,a=t<n;if(d.animation?.ignoreEscapes){d.scrollTop=n;return}a&&(c(!0),u(!1)),e&&c(!1),!d.escapedFromLock&&d.isNearBottom&&u(!0)},1)},[c,u,l,d]),h=(0,Q.useCallback)(({target:e,deltaY:t})=>{let r=e;for(;!["scroll","auto"].includes(getComputedStyle(r).overflow);){if(!r.parentElement)return;r=r.parentElement}r===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(c(!0),u(!1))},[c,u,d]),g=kL(e=>{g.current?.removeEventListener("scroll",m),g.current?.removeEventListener("wheel",h),e?.addEventListener("scroll",m,{passive:!0}),e?.addEventListener("wheel",h,{passive:!0})},[]),b=kL(e=>{let t;d.resizeObserver?.disconnect(),e&&(d.resizeObserver=new ResizeObserver(([e])=>{let{height:r}=e.contentRect,n=r-(t??r);if(d.resizeDifference=n,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),n>=0){let e=kD(s.current,t?s.current.resize:s.current.initial);p({animation:e,wait:!0,preserveScrollPosition:!0,duration:"instant"===e?void 0:350})}else d.isNearBottom&&(c(!1),u(!0));t=r,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===n&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e))},[]);return{contentRef:b,scrollRef:g,scrollToBottom:p,stopScroll:f,isAtBottom:n||i,isNearBottom:i,escapedFromLock:t,state:d}})(),{stream:O,messages:L,todos:P,files:D,ui:M,setFiles:j,isLoading:F,isThreadLoading:$,interrupt:U,sendMessage:z,stopStream:B,resumeInterrupt:H,subAgentActivity:G,asyncTasks:V}=vq(),{tasks:q}=kv(w,{enabled:Object.keys(V??{}).length>0}),W=(0,Q.useMemo)(()=>kt(q),[q]),[Z]=kI(w),K=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{K.current=!1},[w]),(0,Q.useEffect)(()=>{F&&(K.current=!1)},[F]),(0,Q.useEffect)(()=>{var e;if(!q||0===q.length||!w||!Z)return;if(!(w&&kS()[w]?.initialized===!0))return void kA(w,q.filter(e=>ke(e.liveStatus)).map(S5));if(F||K.current||h.trim())return;let t=function(e){if(!e)return new Set;let t=kS()[e];return new Set(Array.isArray(t?.keys)?t.keys:[])}(w);for(let r of q){if(!ke(r.liveStatus))continue;let n=S5(r);if(!t.has(n)){if(L.some(e=>"human"===e.type&&S9(ko(e),r))){kN(w,n);continue}K.current=!0,kN(w,n),z(S8(r)),u_.toast.success(`Auto-reported ${S4[e=r.agent_name]??e} to the main chat.`);break}}},[q,Z,F,h,L,z,w]),(0,Q.useEffect)(()=>{F&&R()},[F,R]);let Y=(0,Q.useRef)({sendMessage:z,isLoading:F,messages:L,threadId:w});Y.current={sendMessage:z,isLoading:F,messages:L,threadId:w};let X=(0,Q.useRef)(r);X.current=r,(0,Q.useEffect)(()=>(X.current?.((e,t)=>{let r=Y.current;return r.threadId!==t?"wrong-thread":r.isLoading?"busy":r.messages.some(t=>"human"===t.type&&S9(ko(t),e))?"duplicate":(kN(t,S5(e)),r.sendMessage(S8(e)),"sent")}),()=>X.current?.(null)),[]);let ee=(0,Q.useMemo)(()=>{for(let e=L.length-1;e>=0;e--){let t=L[e];if("ai"!==t.type)continue;let r=t.response_metadata,n=function(e,t){if("string"!=typeof e||!e.trim())return null;let r=e.trim(),n=r.lastIndexOf("/"),a=n>=0?r.slice(0,n):"";n>=0&&(r=r.slice(n+1)),r=r.replace(/-\d{8}$/,"");let i="string"==typeof t&&t.trim()||a;return{name:r,provider:i?i.charAt(0).toUpperCase()+i.slice(1):null}}(r?.model_name??r?.model,r?.model_provider);if(n)return n}return null},[L]),et=(0,Q.useMemo)(()=>{let e={},t=Object.keys(G);if(0===t.length)return e;let r=[],n={};for(let e of L)if("ai"===e.type)for(let t of e.tool_calls??[])"task"===t.name&&t.id&&r.push(t.id);else if("tool"===e.type){let t=e.tool_call_id;t&&(n[t]=ko(e))}let a=e=>e.replace(/\s+/g," ").trim(),i=new Set;for(let o of r){let r=a(n[o]??"");if(!r)continue;let s=t.find(e=>{if(i.has(e))return!1;let t=a(function(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if("text"===r.kind)return r.text}return""}(G[e]));return""!==t&&(r.includes(t)||t.includes(r))});s&&(e[o]=G[s],i.add(s))}let o=t.filter(e=>!i.has(e)),s=0;for(let t of r)e[t]||n[t]||s<o.length&&(e[t]=G[o[s++]]);return e},[L,G]),er=U?.value,en=er?.type==="ask_user"||Array.isArray(er?.action_requests)&&er.action_requests.length>0,ea=F||!e||en,ei=(0,Q.useCallback)(()=>{x(!0),ky(w,!0),k(!1)},[w]),eo=(0,Q.useCallback)(()=>{x(!1),ky(w,!1),k(!1),T.current=null},[w]);(0,Q.useEffect)(()=>{let e=A.current;if(e!==w){if(null===e&&null!==w&&N.current){let e;(e=kh())[km]&&(e[w]=!0),km in e&&(delete e[km],kg(e))}else null===e&&null!==w&&ky(null,!1);x(kb(w)),T.current=null,k(!1),y([]),N.current=!1,A.current=w}},[w]);let es=(0,Q.useCallback)(async e=>{let t=Array.from(e.target.files??[]);if(e.target.value="",0!==t.length){_(!0);try{let e=new FormData;t.forEach(t=>e.append("files",t));let r=await fetch("/api/workspace/upload",{method:"POST",body:e}),n=await r.json();if(!r.ok||!n.files)throw Error(n.error||"Failed to upload files.");y(e=>[...e,...n.files]),u_.toast.success(`${n.files.length} file${1===n.files.length?"":"s"} uploaded to the workspace.`)}catch(e){u_.toast.error(e instanceof Error?e.message:"Failed to upload files.")}finally{_(!1)}}},[]),el=(0,Q.useCallback)(e=>{y(t=>t.filter(t=>t.path!==e))},[]),eu=(0,Q.useCallback)(e=>{e&&e.preventDefault();let t=h.trim();if(!t||F||v||ea)return;N.current=null===w&&E;let r=b.length>0?`
|
|
70
|
+
`),t[t.length-1]])}let vI=["text","reasoning","tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result","image","video","audio","text-plain","file"];uR({},{AIMessage:()=>cQ,AIMessageChunk:()=>c2,BaseMessage:()=>cn,BaseMessageChunk:()=>cu,ChatMessage:()=>cE,ChatMessageChunk:()=>cx,DEFAULT_MERGE_IGNORE_KEYS:()=>ci,FunctionMessage:()=>cT,FunctionMessageChunk:()=>cA,HumanMessage:()=>cC,HumanMessageChunk:()=>cR,KNOWN_BLOCK_TYPES:()=>vI,RemoveMessage:()=>cP,SystemMessage:()=>cD,SystemMessageChunk:()=>cM,ToolMessage:()=>cb,ToolMessageChunk:()=>cy,_isMessageFieldWithRole:()=>cc,_mergeDicts:()=>co,_mergeLists:()=>cs,_mergeObj:()=>cl,_mergeStatus:()=>cr,coerceMessageLikeToMessage:()=>c6,collapseToolCallChunks:()=>dr,convertToChunk:()=>dt,convertToOpenAIImageBlock:()=>uj,convertToProviderContentBlock:()=>uU,defaultTextSplitter:()=>vN,defaultToolCallParser:()=>cv,filterMessages:()=>vy,getBufferString:()=>c9,iife:()=>c4,isAIMessage:()=>c0,isAIMessageChunk:()=>c1,isBase64ContentBlock:()=>uP,isBaseMessage:()=>cd,isBaseMessageChunk:()=>cp,isChatMessage:()=>cS,isChatMessageChunk:()=>ck,isDataContentBlock:()=>uO,isDirectToolOutput:()=>cg,isFunctionMessage:()=>cN,isFunctionMessageChunk:()=>cI,isHumanMessage:()=>cO,isHumanMessageChunk:()=>cL,isIDContentBlock:()=>uM,isMessage:()=>uz,isOpenAIToolCallArray:()=>ca,isPlainTextContentBlock:()=>uD,isSystemMessage:()=>cj,isSystemMessageChunk:()=>cF,isToolMessage:()=>c_,isToolMessageChunk:()=>cw,isURLContentBlock:()=>uL,mapChatMessagesToStoredMessages:()=>de,mapStoredMessageToChatMessage:()=>c8,mapStoredMessagesToChatMessages:()=>c7,mergeContent:()=>ct,mergeMessageRuns:()=>v_,mergeResponseMetadata:()=>cf,mergeUsageMetadata:()=>ch,parseBase64DataUrl:()=>u$,parseMimeType:()=>uF,trimMessages:()=>vE});var vC=class{chunks={};constructor(){this.chunks={}}add(e,t){e.type.endsWith("MessageChunk")&&(e.type=e.type.slice(0,-12).toLowerCase());let r="remove"===e.type&&null!=e.id?new cP({...e,id:e.id}):c6(e),n=function(e){try{return dt(e)}catch{return null}}(r),{id:a}=n??r;if(!a)return console.warn("No message ID found for chunk, ignoring in state",e),null;if(this.chunks[a]??={},this.chunks[a].metadata=t??this.chunks[a].metadata,n){let e=this.chunks[a].chunk;this.chunks[a].chunk=(cp(e)?e:null)?.concat(n)??n}else this.chunks[a].chunk=r;return a}clear(){this.chunks={}}get(e,t){return null==e||null==this.chunks[e]?null:(null!=t&&(this.chunks[e].index??=t),this.chunks[e])}};let vR=e=>{let{type:t,data:r}=e.toDict();return{...r,type:t}};var vO=class extends Error{constructor(e){super(e.message),this.name=e.name??e.error??"StreamError"}static isStructuredError(e){return"object"==typeof e&&null!=e&&"message"in e}},vL=class{abortRef=new AbortController;messages;listeners=new Set;state;constructor(e){this.messages=e,this.state={isLoading:!1,values:null,error:void 0}}setState=e=>{this.state={...this.state,...e},this.notifyListeners()};notifyListeners=()=>{this.listeners.forEach(e=>e())};subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.state;get isLoading(){return this.state.isLoading}get values(){return this.state.values?.[0]??null}get error(){return this.state.error}setStreamValues=(e,t="stream")=>{if("function"==typeof e){let[r,n]=this.state.values??[null,"stream"],a=e(r,n);this.setState({values:null!=a?[a,t]:null})}else this.setState({values:null!=e?[e,t]:null})};getMutateFn=(e,t)=>r=>{let n={...t,...(this.state.values??[null,"stream"])[0]},a="function"==typeof r?r(n):r;this.setStreamValues({...n,...a},e)};matchEventType=(e,t,r)=>e===t||t.startsWith(`${e}|`);start=async(e,t)=>{if(!this.state.isLoading)try{let r;for await(let{event:n,data:a}of(this.setState({isLoading:!0,error:void 0}),this.abortRef=new AbortController,await e(this.abortRef.signal))){if("error"===n){r=new vO(a);break}let e=n.includes("|")?n.split("|").slice(1):void 0,i=this.getMutateFn("stream",t.initialValues);if("metadata"===n&&t.callbacks.onMetadataEvent?.(a),"events"===n&&t.callbacks.onLangChainEvent?.(a),this.matchEventType("updates",n,a)&&t.callbacks.onUpdateEvent?.(a,{namespace:e,mutate:i}),this.matchEventType("custom",n,a)&&t.callbacks.onCustomEvent?.(a,{namespace:e,mutate:i}),this.matchEventType("checkpoints",n,a)&&t.callbacks.onCheckpointEvent?.(a,{namespace:e}),this.matchEventType("tasks",n,a)&&t.callbacks.onTaskEvent?.(a,{namespace:e}),this.matchEventType("debug",n,a)&&t.callbacks.onDebugEvent?.(a,{namespace:e}),"values"===n&&("__interrupt__"in a?this.setStreamValues(e=>({...e,...a})):this.setStreamValues(a)),this.matchEventType("messages",n,a)){let[e,r]=a,n=this.messages.add(e,r);if(!n){console.warn("Failed to add message to manager, no message ID found");continue}this.setStreamValues(e=>{let r={...t.initialValues,...e},a=t.getMessages(r).slice(),{chunk:i,index:o}=this.messages.get(n,a.length)??{};return i&&null!=o?("remove"===i.getType()?a.splice(o,1):a[o]=vR(i),t.setMessages(r,a)):r})}}if(null!=r)throw r;let n=await t.onSuccess?.();void 0!==n&&this.setStreamValues(n)}catch(e){e instanceof Error&&("AbortError"===e.name||"TimeoutError"===e.name)||(console.error(e),this.setState({error:e}),await t.onError?.(e))}finally{this.setState({isLoading:!1}),this.abortRef=new AbortController,t.onFinish?.()}};stop=async(e,t)=>{this.abortRef.abort(),this.abortRef=new AbortController,t.onStop?.({mutate:this.getMutateFn("stop",e)})};clear=()=>{this.abortRef.abort(),this.abortRef=new AbortController,this.setState({error:void 0,values:null,isLoading:!1}),this.messages.clear()}};let vP=e=>{let[t,r]=(0,Q.useState)(e?.threadId??null),n=(0,Q.useRef)(e?.onThreadId);n.current=e?.onThreadId;let a=(0,Q.useCallback)(e=>{r(e),n.current?.(e)},[]);return e&&"threadId"in e?[e.threadId??null,a]:[t,a]};function vD(e,t,r){return[e["~configHash"],t,r].join(":")}function vM(e){let[t]=(0,Q.useState)("transport"in e);return t?function(e){let[t]=(0,Q.useState)(()=>new vC),[r]=(0,Q.useState)(()=>new vL(t));(0,Q.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot);let[n,a]=vP(e),i=(0,Q.useRef)(n);(0,Q.useEffect)(()=>{i.current!==n&&(i.current=n,r.clear())},[n,r]);let o=t=>{let r=e.messagesKey??"messages";return Array.isArray(t[r])?t[r]:[]},s=(t,r)=>{let n=e.messagesKey??"messages";return{...t,[n]:r}},l=e.initialValues??{},u=async(t,u)=>{let c,d=n;r.setStreamValues(()=>u?.optimisticValues!=null?{...l,..."function"==typeof u.optimisticValues?u.optimisticValues(l):u.optimisticValues}:{...l}),await r.start(async r=>{if(d||(i.current=d=crypto.randomUUID(),a(d)),!d)throw Error("Failed to obtain valid thread ID.");return e.transport.stream({input:t,context:u?.context,command:u?.command,signal:r,config:{...u?.config,configurable:{thread_id:d,...u?.config?.configurable}}})},{getMessages:o,setMessages:s,initialValues:{},callbacks:e,onSuccess:()=>void 0,onError(t){e.onError?.(t,c)}})};return{get values(){return r.values??{}},error:r.error,isLoading:r.isLoading,stop:()=>r.stop(l,{onStop:e.onStop}),submit:u,get interrupt(){if(null!=r.values&&"__interrupt__"in r.values&&Array.isArray(r.values.__interrupt__)){let e=r.values.__interrupt__;if(0===e.length)return{when:"breakpoint"};if(1===e.length)return e[0];return e}return},get messages(){if(!r.values)return[];return o(r.values)}}}(e):function(e){let t,r=(0,Q.useRef)(e.reconnectOnMount),n=(0,Q.useMemo)(()=>{if("u"<typeof window)return null;let e=r.current;return!0===e?window.sessionStorage:"function"==typeof e?e():null},[]),a=(0,Q.useMemo)(()=>e.client??new nP({apiUrl:e.apiUrl,apiKey:e.apiKey,callerOptions:e.callerOptions,defaultHeaders:e.defaultHeaders}),[e.client,e.apiKey,e.apiUrl,e.callerOptions,e.defaultHeaders]),[i]=(0,Q.useState)(()=>new vC),[o]=(0,Q.useState)(()=>new vL(i));(0,Q.useSyncExternalStore)(o.subscribe,o.getSnapshot,o.getSnapshot);let[s,l]=vP(e),u=(0,Q.useRef)([]),c=(0,Q.useCallback)((...e)=>{let t=u.current;for(let r of e)t.includes(r)||t.push(r)},[]),d=null!=e.onUpdateEvent,p=null!=e.onCustomEvent,f=null!=e.onLangChainEvent,m=null!=e.onDebugEvent,h=null!=e.onCheckpointEvent,g=null!=e.onTaskEvent,b=(0,Q.useMemo)(()=>{let e=[];return d&&e.push("updates"),p&&e.push("custom"),f&&e.push("events"),m&&e.push("debug"),h&&e.push("checkpoints"),g&&e.push("tasks"),e},[d,p,f,m,h,g]);(0,Q.useRef)(null).current=o.clear;let y=(0,Q.useRef)(s),v=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{y.current!==s&&(y.current=s,o.clear())},[s,o]);let _="object"==typeof e.fetchStateHistory&&null!=e.fetchStateHistory?e.fetchStateHistory.limit??!1:e.fetchStateHistory??!1,w=function(e,t,r,n){let a=vD(e,t,r),[i,o]=(0,Q.useState)(()=>({key:void 0,data:void 0,error:void 0,isLoading:null!=t})),s=(0,Q.useRef)(e);s.current=e;let l=(0,Q.useRef)(n?.onError);l.current=n?.onError;let u=(0,Q.useCallback)((e,t)=>{if(n.passthrough)return Promise.resolve([]);let r=s.current,a=vD(r,e,t);return null!=e?(o(e=>e.key===a?{...e,isLoading:!0}:{key:a,data:void 0,error:void 0,isLoading:!0}),(function(e,t,r){if(r?.limit===!1)return e.threads.getState(t).then(e=>null==e.checkpoint?[]:[e]);let n="number"==typeof r?.limit?r.limit:10;return e.threads.getHistory(t,{limit:n})})(r,e,{limit:t}).then(e=>(o(t=>t.key!==a?t:{key:a,data:e,error:void 0,isLoading:!1}),e),e=>(o(t=>t.key!==a?t:{key:a,data:t.data,error:e,isLoading:!1}),l.current?.(e),Promise.reject(e)))):(o({key:a,data:void 0,error:void 0,isLoading:!1}),Promise.resolve([]))},[n.passthrough]);return(0,Q.useEffect)(()=>{(null==n.submittingRef.current||n.submittingRef.current!==t)&&u(t,r)},[u,a]),{data:i.data,error:i.error,isLoading:i.isLoading,mutate:e=>u(e??t,r)}}(a,s,_,{passthrough:null!=e.experimental_thread,submittingRef:v,onError:e.onError}),E=e.experimental_thread??w,x=t=>{let r=e.messagesKey??"messages";return Array.isArray(t[r])?t[r]:[]},S=(t,r)=>{let n=e.messagesKey??"messages";return{...t,[n]:r}},[k,T]=(0,Q.useState)(""),A=function(e,t){let{rootSequence:r,paths:n}=function(e){let t=new Set,r={};if(e.length<=1)return{rootSequence:{type:"sequence",items:e.map(e=>({type:"node",value:e,path:[]}))},paths:[]};e.forEach(e=>{let n=e.parent_checkpoint?.checkpoint_id??"$";r[n]??=[],r[n].push(e),e.checkpoint?.checkpoint_id!=null&&t.add(e.checkpoint.checkpoint_id)});let n=(...e)=>e.filter(e=>null!=e).sort((e,t)=>e.localeCompare(t)).at(-1),a=null==r.$?Object.keys(r).filter(e=>!t.has(e)).map(e=>{let t=[e],a=new Set,i=e;for(;t.length>0;){let e=t.shift();if(a.has(e))continue;a.add(e);let o=(r[e]??[]).flatMap(e=>e.checkpoint?.checkpoint_id??[]);i=n(i,...o),t.push(...o)}return{parentId:e,lastId:i}}).sort((e,t)=>e.lastId.localeCompare(t.lastId)).at(-1)?.parentId:void 0;null!=a&&(r.$=r[a]);let i={type:"sequence",items:[]},o=[{id:"$",sequence:i,path:[]}],s=[],l=new Set;for(;o.length>0;){let e,t=o.shift();if(l.has(t.id))continue;l.add(t.id);let n=r[t.id];if(null!=n&&0!==n.length)for(let r of(n.length>1&&(e={type:"fork",items:[]},t.sequence.items.push(e)),n)){let n=r.checkpoint?.checkpoint_id;if(null==n)continue;let{sequence:a}=t,{path:i}=t;null!=e&&(a={type:"sequence",items:[]},e.items.unshift(a),(i=i.slice()).push(n),s.push(i)),a.items.push({type:"node",value:r,path:i}),o.push({id:n,sequence:a,path:i})}}return{rootSequence:i,paths:s}}(t??[]),{history:a,branchByCheckpoint:i}=function(e,t,r){let n=r.split(">"),a={};for(let e of t){let t=e.at(-2)??"$";a[t]??=[],a[t].unshift(e)}let i=[],o={},s=n.slice(),l=[...e.items];for(;l.length>0;){let e=l.shift();if("node"===e.type){i.push(e.value);let t=e.value.checkpoint?.checkpoint_id;if(null==t)continue;o[t]={branch:e.path.join(">"),branchOptions:(e.path.length>0?a[e.path.at(-2)??"$"]??[]:[]).map(e=>e.join(">"))}}if("fork"===e.type){let t=s.shift(),r=null!=t?e.items.findIndex(e=>{let r=e.items.at(0);return!!r&&"node"===r.type&&r.value.checkpoint?.checkpoint_id===t}):-1,n=e.items.at(r)?.items??[];l.push(...n)}}return{history:i,branchByCheckpoint:o}}(r,n,e);return{branchTree:r,flatHistory:a,branchByCheckpoint:i,threadHead:a.at(-1)}}(k,E.data??void 0),N=A.threadHead?.values??e.initialValues??{},I=(()=>{let e=A.threadHead?.tasks?.at(-1)?.error;if(null!=e){try{let t=JSON.parse(e);if(vO.isStructuredError(t))return new vO(t);return t}catch{}return e}})(),C=(t=new Set,x(N).map((e,r)=>{let n=e.id??r,a=function(e,t){for(let r=e.length-1;r>=0;r-=1)if(t(e[r]))return e[r]}(E.data??[],e=>x(e.values).map((e,t)=>e.id??t).includes(n)),i=a?.checkpoint?.checkpoint_id,o=null!=i?A.branchByCheckpoint[i]:void 0;o?.branch?.length||(o=void 0);let s=o?.branchOptions?.flat(2).join(",");return s&&(t.has(s)&&(o=void 0),t.add(s)),{messageId:n.toString(),firstSeenState:a,branch:o?.branch,branchOptions:o?.branchOptions}})),R=async(t,r)=>{let i,c,d=r?.checkpoint?.checkpoint_id;T(null!=d?A.branchByCheckpoint[d]?.branch??"":"");let p=!0===_||"number"==typeof _,f=null!=e.onFinish||p;o.setStreamValues(()=>{let e=f?N:{...N,...o.values};return r?.optimisticValues!=null?{...e,..."function"==typeof r.optimisticValues?r.optimisticValues(e):r.optimisticValues}:{...e}});let m=s;await o.start(async o=>{if(m||(y.current=m=(await a.threads.create({threadId:r?.threadId,metadata:r?.metadata})).thread_id,v.current=m,l(m)),!m)throw Error("Failed to obtain valid thread ID.");v.current=m;let s=[...new Set([...r?.streamMode??[],...u.current,...b])],d=r?.checkpoint??(p?A.threadHead?.checkpoint:void 0)??void 0;r?.checkpoint===null&&(d=void 0),null!=d&&delete d.thread_id;let f=r?.streamResumable??!!n;return a.runs.stream(m,e.assistantId,{input:t,config:r?.config,context:r?.context,command:r?.command,interruptBefore:r?.interruptBefore,interruptAfter:r?.interruptAfter,metadata:r?.metadata,multitaskStrategy:r?.multitaskStrategy,onCompletion:r?.onCompletion,onDisconnect:r?.onDisconnect??(f?"continue":"cancel"),signal:o,checkpoint:d,streamMode:s,streamSubgraphs:r?.streamSubgraphs,streamResumable:f,durability:r?.durability,onRunCreated(t){i={run_id:t.run_id,thread_id:t.thread_id??m},n&&(c=`lg:stream:${m}`,n.setItem(c,i.run_id)),e.onCreated?.(i)}})},{getMessages:x,setMessages:S,initialValues:N,callbacks:e,async onSuccess(){if(c&&n?.removeItem(c),f){let t=await E.mutate(m),r=t?.at(0);if(r)return e.onFinish?.(r,i),null}},onError(t){e.onError?.(t,i)},onFinish(){v.current=null}})},O=async(t,r,i)=>{if(r??="-1",!s)return;let l={thread_id:s,run_id:t};await o.start(async e=>(v.current=s,a.runs.joinStream(s,t,{signal:e,lastEventId:r,streamMode:i?.streamMode})),{getMessages:x,setMessages:S,initialValues:N,callbacks:e,async onSuccess(){n?.removeItem(`lg:stream:${s}`);let t=await E.mutate(s),r=t?.at(0);r&&e.onFinish?.(r,l)},onError(t){e.onError?.(t,l)},onFinish(){v.current=null}})},L=(0,Q.useMemo)(()=>{if(!n||o.isLoading||"u"<typeof window)return;let e=n?.getItem(`lg:stream:${s}`);if(e)return{runId:e,threadId:s}},[n,o.isLoading,s]),P=!!n,D=(0,Q.useRef)({threadId:s,shouldReconnect:P}),M=(0,Q.useRef)(O);M.current=O,(0,Q.useEffect)(()=>{D.current.threadId!==s&&(D.current={threadId:s,shouldReconnect:P})},[s,P]),(0,Q.useEffect)(()=>{L&&D.current.shouldReconnect&&(D.current.shouldReconnect=!1,M.current?.(L.runId))},[L]);let j=o.error??I??E.error,F=o.values??N;return{get values(){return c("values"),F},client:a,assistantId:e.assistantId,error:j,isLoading:o.isLoading,stop:()=>o.stop(N,{onStop:t=>{if(n&&s){let e=n.getItem(`lg:stream:${s}`);e&&a.runs.cancel(s,e),n.removeItem(`lg:stream:${s}`)}e.onStop?.(t)}}),submit:R,joinStream:O,branch:k,setBranch:T,get history(){if(!1===_)throw Error("`fetchStateHistory` must be set to `true` to use `history`");return A.flatHistory},isThreadLoading:E.isLoading&&null==E.data,get experimental_branchTree(){if(!1===_)throw Error("`fetchStateHistory` must be set to `true` to use `experimental_branchTree`");return A.branchTree},get interrupt(){if(null!=F&&"__interrupt__"in F&&Array.isArray(F.__interrupt__)){let e=F.__interrupt__;if(0===e.length)return{when:"breakpoint"};if(1===e.length)return e[0];return e}if(o.isLoading)return;let e=A.threadHead?.tasks?.at(-1)?.interrupts;if(null==e||0===e.length){if(!(A.threadHead?.next??[]).length||null!=j)return;return{when:"breakpoint"}}return e.at(-1)},get messages(){return c("messages-tuple","values"),x(F)},getMessagesMetadata(e,t){c("values");let r=i.get(e.id)?.metadata,n=C?.find(r=>r.messageId===(e.id??t));if(null!=r||null!=n)return{...n,streamMetadata:r}}}}(e)}let vj="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vF=new Uint8Array(16),v$=[];for(let e=0;e<256;++e)v$.push((e+256).toString(16).slice(1));let vU=function(e,t,r){if(vj&&!t&&!e)return vj();let n=(e=e||{}).random||(e.rng||function(){if(!d&&!(d="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return d(vF)})();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return v$[e[t+0]]+v$[e[t+1]]+v$[e[t+2]]+v$[e[t+3]]+"-"+v$[e[t+4]]+v$[e[t+5]]+"-"+v$[e[t+6]]+v$[e[t+7]]+"-"+v$[e[t+8]]+v$[e[t+9]]+"-"+v$[e[t+10]]+v$[e[t+11]]+v$[e[t+12]]+v$[e[t+13]]+v$[e[t+14]]+v$[e[t+15]]}(n)};function vz(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>e&&"object"==typeof e&&"text"in e?String(e.text??""):"").join(""):""}function vB(e){return"string"==typeof e.content?e.content:Array.isArray(e.content)?e.content.filter(e=>"object"==typeof e&&null!==e&&"type"in e&&"text"===e.type||"string"==typeof e).map(e=>"string"==typeof e?e:"object"==typeof e&&null!==e&&"text"in e&&e.text||"").join(""):""}function vH(e){if("string"==typeof e)return e;if(e&&"object"==typeof e){if(e.description&&"string"==typeof e.description)return e.description;if(e.prompt&&"string"==typeof e.prompt)return e.prompt;if(e.result&&"string"==typeof e.result)return e.result}return JSON.stringify(e,null,2)}function vG(e){let t=0;for(let r of e){let e=r.content;if("string"==typeof e)t+=e.length;else if(Array.isArray(e))for(let r of e){let e=r?.text;"string"==typeof e&&(t+=e.length)}}return t}function vV(e){if(!e||"object"!=typeof e)return null;try{return JSON.stringify(e.value??null)}catch{return null}}function vq({children:e,activeAssistant:t,onHistoryRevalidate:r,thread:n}){let a=function({activeAssistant:e,onHistoryRevalidate:t,thread:r}){let[n,a]=ec("threadId"),i=nj(),[o,s]=(0,Q.useState)({}),l=vM({assistantId:e?.assistant_id||"",client:i??void 0,reconnectOnMount:!0,threadId:n??null,onThreadId:a,defaultHeaders:{"x-auth-scheme":"langsmith"},fetchStateHistory:!0,onFinish:t,onError:t,onCreated:t,onUpdateEvent:(e,t)=>{let r=t?.namespace;if(!r||0===r.length)return;let n=function(e){let t=[];if(!e||"object"!=typeof e)return t;for(let r of Object.values(e)){let e=r?.messages;if(Array.isArray(e))for(let r of e)if("ai"===r.type&&r.tool_calls&&r.tool_calls.length>0)for(let e of r.tool_calls)t.push({kind:"tool_call",id:e.id??"",name:e.name??"tool",args:e.args&&"object"==typeof e.args?e.args:{}});else if("ai"===r.type){let e=vz(r.content).trim();e&&t.push({kind:"text",text:e})}else"tool"===r.type&&t.push({kind:"tool_result",toolCallId:r.tool_call_id??"",name:r.name??"tool",text:vz(r.content).trim()})}return t}(e);if(0===n.length)return;let a=r.join("|");s(e=>({...e,[a]:[...e[a]??[],...n]}))},experimental_thread:r}),[u,c]=(0,Q.useState)(void 0),[d,p]=(0,Q.useState)(null),[f,m]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e;if(!n){c(void 0),m(null),p(null);return}let t=l.messages.length,r=!1,a=0,o=async()=>{a+=1;try{let s=await i.threads.getState(n);if(r)return;let u=s.values?.messages,d=s.tasks?.at(-1)?.interrupts,f=Array.isArray(d)&&d.length>0?d[d.length-1]:void 0,h=Array.isArray(s.next)&&s.next.length>0;Array.isArray(u)&&u.length>t&&m(u);let g=function(e){if(!e||"object"!=typeof e)return;let t=e.value;if(!t||"object"!=typeof t)return;let r={...t};return"action_requests"in t&&!Array.isArray(t.action_requests)&&(r.action_requests=[]),"review_configs"in t&&!Array.isArray(t.review_configs)&&(r.review_configs=[]),{...e,value:r}}(f);if(g){c(g),p(null),Array.isArray(u)&&m(u);return}if(!h){c(void 0),p(vV(l.interrupt)),Array.isArray(u)&&m(u);return}h&&a<15&&!r&&(e=setTimeout(o,1e3))}catch{!r&&a<15&&(e=setTimeout(o,1e3))}};return o(),()=>{r=!0,e&&clearTimeout(e)}},[n,l.interrupt,l.isLoading,i]);let h=l.interrupt,g=h&&(null===d||vV(h)!==d)?h:u??void 0,b=f&&(f.length>l.messages.length||!l.isLoading&&f.length===l.messages.length&&vG(f)>vG(l.messages))?f:l.messages,y=(0,Q.useCallback)(r=>{c(void 0),m(null),p(null);let n={id:vU(),type:"human",content:r};l.submit({messages:[n]},{optimisticValues:e=>({messages:[...e.messages??[],n]}),config:{...e?.config??{},recursion_limit:100},streamSubgraphs:!0,streamMode:["updates"],streamResumable:!0,onDisconnect:"continue"}),t?.()},[l,e?.config,t]),v=(0,Q.useCallback)(async e=>{n&&await i.threads.updateState(n,{values:{files:e}})},[i,n]),_=(0,Q.useCallback)(e=>{c(void 0),m(null),p(null),l.submit(null,{command:{resume:e},streamSubgraphs:!0,streamMode:["updates"],streamResumable:!0,onDisconnect:"continue"}),t?.()},[l,t]),w=(0,Q.useCallback)(()=>{l.stop()},[l]);return{stream:l,todos:l.values.todos??[],files:l.values.files??{},email:l.values.email,asyncTasks:l.values.async_tasks??{},summarizationEvent:function(e){if(!e||"object"!=typeof e)return null;let t=e.summary_message,r="string"==typeof t?.content?t.content:"";if(!r)return null;let n=e.cutoff_index,a=e.file_path;return{cutoffIndex:"number"==typeof n&&n>=0?n:0,content:r,filePath:"string"==typeof a?a:null}}(l.values._summarization_event),ui:l.values.ui,setFiles:v,messages:b,isLoading:l.isLoading,isThreadLoading:l.isThreadLoading,interrupt:g,sendMessage:y,stopStream:w,resumeInterrupt:_,subAgentActivity:o}}({activeAssistant:t,onHistoryRevalidate:r,thread:n});return(0,J.jsx)(vW.Provider,{value:a,children:e})}let vW=(0,Q.createContext)(void 0);function vZ(){let e=(0,Q.useContext)(vW);if(void 0===e)throw Error("useChatContext must be used within a ChatProvider");return e}let vK=ro("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),vY=ro("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),vX=ro("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),vJ=ro("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),vQ=ro("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),v0=ro("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]),v1=ro("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),v2=ro("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),v4=ro("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),v3=ro("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),v5=ro("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),v6=ro("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),v9=Q.default.memo(({subAgent:e,onClick:t,isExpanded:r=!0})=>{let n="pending"===e.status;return(0,J.jsx)("div",{className:"w-fit max-w-[70vw] overflow-hidden rounded-lg bg-card",children:(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:t,className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left",children:[(0,J.jsx)("span",{className:"bg-[var(--brand)]/10 flex size-5 shrink-0 items-center justify-center rounded-md text-[var(--brand)]",children:n?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(v6,{className:"size-3.5","aria-hidden":"true"})}),(0,J.jsx)("span",{className:"truncate text-sm font-semibold text-foreground",children:e.subAgentName}),(0,J.jsx)("span",{className:"text-xs font-normal text-muted-foreground",children:"subagent"}),r?(0,J.jsx)(li,{size:14,className:"ml-auto shrink-0 text-muted-foreground"}):(0,J.jsx)(la,{size:14,className:"ml-auto shrink-0 text-muted-foreground"})]})})});v9.displayName="SubAgentIndicator";let v8=ro("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),v7=ro("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),_e=ro("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),_t=Q.createContext(null);function _r(){let e=Q.useContext(_t);if(!e)throw Error("useStreamContext must be used within a LoadExternalComponent");return new Proxy(e,{get:(e,t)=>"meta"===t?e.meta:e.stream[t]})}let _n=new class{cache={};boundCache={};callbacks={};respond(e,t,r){this.cache[e]={comp:t,target:r},this.callbacks[e]?.forEach(e=>e(t,r))}getBoundStore(e){return this.boundCache[e]??={subscribe:t=>(this.callbacks[e]??=[],this.callbacks[e].push(t),()=>{this.callbacks[e]=this.callbacks[e].filter(e=>e!==t)}),getSnapshot:()=>this.cache[e]},this.boundCache[e]}},_a=Symbol.for("LGUI_EXT_STORE"),_i=Symbol.for("LGUI_REQUIRE"),_o=Symbol.for("LGUI_REQUIRE_EXTRA");function _s({stream:e,namespace:t,message:r,meta:n,fallback:a,components:i,...o}){let s=Q.useRef(null),l=Q.useId(),u=`child-shadow-${l}`,c=Q.useMemo(()=>_n.getBoundStore(u),[u]),d=Q.useSyncExternalStore(c.subscribe,c.getSnapshot),p=i?.[r.name],f=null!=p,m=null;(e=>!!Q.isValidElement(e)||null==e||"string"==typeof e||"number"==typeof e||"bigint"==typeof e||"boolean"==typeof e||null!=e&&"object"==typeof e&&Symbol.iterator in e||null!=e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then)(a)?m=a:"object"==typeof a&&null!=a&&(m=a?.[r.name]);let h=t??e.assistantId,g=e.client["~ui"];return(Q.useEffect(()=>{f||g.getComponent(h,r.name).then(e=>{let t=s.current;if(!t)return;let r=t.shadowRoot??t.attachShadow({mode:"open"}),n=document.createRange().createContextualFragment(e.replace("{{shadowRootId}}",u));r.appendChild(n)})},[g,h,r.name,u,f]),f)?(0,J.jsx)(_t.Provider,{value:{stream:e,meta:n},children:Q.createElement(p,r.props)}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{id:u,ref:s,...o}),(0,J.jsx)(_t.Provider,{value:{stream:e,meta:n},children:d?.target!=null?ek.createPortal(Q.createElement(d.comp,r.props),d.target):m})]})}"u">typeof window&&(window[_a]=_n,window[_i]=e=>{if("react"===e)return Q;if("react-dom"===e)return ek;if("react/jsx-runtime"===e)return J;if("@langchain/langgraph-sdk/react"===e)return{useStream:vM};if("@langchain/langgraph-sdk/react-ui"===e)return{useStreamContext:_r,LoadExternalComponent:()=>{throw Error("Nesting LoadExternalComponent is not supported")}};if(null!=window[_o]&&"object"==typeof window[_o]&&e in window[_o])return window[_o][e];throw Error(`Unknown module...: ${e}`)});let _l=Q.forwardRef(({className:e,...t},r)=>(0,J.jsx)("textarea",{className:rZ("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));function _u({actionRequest:e,reviewConfig:t,onResume:r,isLoading:n,onSubmitted:a}){let[i,o]=(0,Q.useState)(""),[s,l]=(0,Q.useState)(!1),[u,c]=(0,Q.useState)({}),[d,p]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(!1),h=t?.allowedDecisions??t?.allowed_decisions??["approve","reject","edit"],g=e=>{(0,ek.flushSync)(()=>{m(!0),a&&a()}),r(e)};return f?null:(0,J.jsxs)("div",{className:"w-full rounded-md border border-border bg-muted/30 p-4",children:[(0,J.jsxs)("div",{className:"mb-3 flex items-center gap-2 text-foreground",children:[(0,J.jsx)(v7,{size:16,className:"text-yellow-600 dark:text-yellow-400"}),(0,J.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"Approval Required"})]}),e.description&&(0,J.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:e.description}),(0,J.jsxs)("div",{className:"mb-4 rounded-sm border border-border bg-background p-3",children:[(0,J.jsxs)("div",{className:"mb-2",children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Tool"}),(0,J.jsx)("p",{className:"mt-1 font-mono text-sm font-medium text-foreground",children:e.name})]}),s?(0,J.jsxs)("div",{children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Edit Arguments"}),(0,J.jsx)("div",{className:"mt-2 space-y-3",children:Object.entries(e.args).map(([e,t])=>(0,J.jsxs)("div",{children:[(0,J.jsx)("label",{className:"mb-1 block text-xs font-medium text-foreground",children:e}),(0,J.jsx)(_l,{value:void 0!==u[e]?"string"==typeof u[e]?u[e]:JSON.stringify(u[e],null,2):"string"==typeof t?t:JSON.stringify(t,null,2),onChange:t=>((e,t)=>{try{let r=t.trim().startsWith("{")||t.trim().startsWith("[")?JSON.parse(t):t;c(t=>({...t,[e]:r}))}catch{c(r=>({...r,[e]:t}))}})(e,t.target.value),className:"font-mono text-xs",rows:"string"==typeof t&&t.length<100?2:4,disabled:n})]},e))})]}):(0,J.jsxs)("div",{children:[(0,J.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Arguments"}),(0,J.jsx)("pre",{className:"mt-2 overflow-x-auto whitespace-pre-wrap break-all rounded-sm border border-border bg-muted/40 p-2 font-mono text-xs text-foreground",children:JSON.stringify(e.args,null,2)})]})]}),d&&!s&&(0,J.jsxs)("div",{className:"mb-4",children:[(0,J.jsx)("label",{className:"mb-2 block text-xs font-medium text-foreground",children:"Rejection Message (optional)"}),(0,J.jsx)(_l,{value:i,onChange:e=>o(e.target.value),placeholder:"Explain why you're rejecting this action…",className:"text-sm",rows:2,disabled:n})]}),(0,J.jsx)("div",{className:"flex flex-wrap gap-2",children:s?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{l(!1),c({})},disabled:n,children:"Cancel"}),(0,J.jsxs)(na,{type:"button",size:"sm",onClick:()=>{s&&(g({decisions:[{type:"edit",edited_action:{name:e.name,args:u}}]}),l(!1),c({}))},disabled:n,className:"bg-green-600 text-white hover:bg-green-700 dark:bg-green-600 dark:hover:bg-green-700",children:[(0,J.jsx)(ln,{size:14}),n?"Saving…":"Save & Approve"]})]}):d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{p(!1),o("")},disabled:n,children:"Cancel"}),(0,J.jsx)(na,{type:"button",variant:"destructive",size:"sm",onClick:()=>{g({decisions:[{type:"reject",message:i.trim()}]})},disabled:n,children:n?"Rejecting…":"Confirm Reject"})]}):(0,J.jsxs)(J.Fragment,{children:[h.includes("reject")&&(0,J.jsxs)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{d?g({decisions:[{type:"reject",message:i.trim()}]}):p(!0)},disabled:n,className:"text-destructive hover:bg-destructive/10",children:[(0,J.jsx)(rs,{size:14}),"Reject"]}),h.includes("edit")&&(0,J.jsxs)(na,{type:"button",variant:"outline",size:"sm",onClick:()=>{l(!0),c(JSON.parse(JSON.stringify(e.args))),p(!1)},disabled:n,children:[(0,J.jsx)(a4,{size:14}),"Edit"]}),h.includes("approve")&&(0,J.jsxs)(na,{type:"button",size:"sm",onClick:()=>{g({decisions:[{type:"approve"}]})},disabled:n,className:rZ("bg-green-600 text-white hover:bg-green-700","dark:bg-green-600 dark:hover:bg-green-700"),children:[(0,J.jsx)(ln,{size:14}),n?"Approving…":"Approve"]})]})})]})}_l.displayName="Textarea";let _c=Q.default.memo(({toolCall:e,uiComponent:t,stream:r,graphId:n,actionRequest:a,actionRequestKey:i,actionRequestSubmitted:o,onActionRequestSubmitted:s,reviewConfig:l,onResume:u,isLoading:c,autoApprove:d,compact:p=!1})=>{let[f,m]=(0,Q.useState)(()=>!!t||!!a&&!d),[h,g]=(0,Q.useState)({}),b=(0,Q.useMemo)(()=>a?`${e.id}:${a.name}:${JSON.stringify(a.args)}`:null,[a,e.id]),y=i??b,[v,_]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{y?_(e=>e&&e!==y?null:e):_(null)},[y]),(0,Q.useEffect)(()=>{t&&m(!0)},[t]);let w=(0,Q.useRef)(a);(0,Q.useEffect)(()=>{let e=!!w.current,t=!!a;!t||e||d?!t&&e&&m(!1):m(!0),w.current=a},[a,d]);let{name:E,args:x,result:S,status:k}=(0,Q.useMemo)(()=>{let t=e.args;return{name:function(e,t){if(!e)return"Unknown Tool";if("ToolSelectionResponse"===e)return"Adaptive tool selection";let r=e.toLowerCase();if("think_tool"===r)return"Reflection";if("read_file"===r||"write_file"===r||"edit_file"===r){let e,n=function(e){if(e&&"object"==typeof e)return e;if("string"==typeof e)try{let t=JSON.parse(e);if(t&&"object"==typeof t)return t}catch{}return{}}(t),a=String(n.path??n.file_path??"");if("/memories"===(e=(a||"").trim())||e.startsWith("/memories/"))return"read_file"===r?"Reading memory":"Updating memory";if("read_file"===r){let e=function(e){let t=(e||"").trim();if(!t.startsWith("/skills/"))return"";let[r]=t.slice(8).split("/");return r||""}(a);if(e)return`Skill: ${e}`}}return e}(e.name,t),args:t&&"object"==typeof t?t:{},result:e.result,status:e.status||"completed"}},[e]),T=(0,Q.useMemo)(()=>{switch(k){case"completed":return(0,J.jsx)(vX,{});case"error":return(0,J.jsx)(v7,{size:14,className:"text-destructive"});case"pending":return(0,J.jsx)(a1,{size:14,className:"animate-spin"});case"interrupted":return(0,J.jsx)(_e,{size:14,className:"text-orange-500"});default:return(0,J.jsx)(v8,{size:14,className:"text-muted-foreground"})}},[k]),A=(0,Q.useCallback)(()=>{m(e=>!e)},[]),N=(0,Q.useCallback)(e=>{g(t=>({...t,[e]:!t[e]}))},[]),I=S||Object.keys(x).length>0,C=o??v===y,R=a&&u&&(!y||!C);return(0,J.jsxs)("div",{className:rZ("w-full overflow-hidden rounded-lg border-none shadow-none outline-none transition-colors duration-200 focus-within:ring-2 focus-within:ring-ring hover:bg-accent",p&&"rounded-md",f&&I&&"bg-accent"),children:[(0,J.jsx)(na,{variant:"ghost",size:"sm",onClick:A,className:rZ("flex w-full items-center justify-between gap-2 border-none px-2 py-2 text-left shadow-none outline-none disabled:cursor-default",p&&"h-auto min-h-8 py-1.5"),disabled:!I,children:(0,J.jsxs)("div",{className:"flex w-full items-center justify-between gap-2",children:[(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[T,(0,J.jsx)("span",{className:rZ("text-[15px] font-medium tracking-[-0.6px] text-foreground",p&&"text-xs tracking-normal"),children:E})]}),I&&(f?(0,J.jsx)(li,{size:14,className:"shrink-0 text-muted-foreground"}):(0,J.jsx)(la,{size:14,className:"shrink-0 text-muted-foreground"}))]})}),f&&I&&(0,J.jsx)("div",{className:rZ("px-4 pb-4",p&&"px-2 pb-2"),children:t&&r&&n?(0,J.jsx)("div",{className:"mt-4",children:(0,J.jsx)(_s,{stream:r,message:t,namespace:n,meta:{status:k,args:x,result:S??"No Result Yet"}},t.id)}):R?(0,J.jsx)("div",{className:"mt-4",children:(0,J.jsx)(_u,{actionRequest:a,reviewConfig:l,onResume:u,isLoading:c,onSubmitted:()=>{_(y),y&&s?.(y),m(!1)}})}):(0,J.jsxs)(J.Fragment,{children:[Object.keys(x).length>0&&(0,J.jsxs)("div",{className:rZ("mt-4",p&&"mt-2"),children:[(0,J.jsx)("h4",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Arguments"}),(0,J.jsx)("div",{className:"space-y-2",children:Object.entries(x).map(([e,t])=>(0,J.jsxs)("div",{className:"rounded-sm border border-border",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>N(e),className:"flex w-full items-center justify-between bg-muted/30 p-2 text-left text-xs font-medium transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[(0,J.jsx)("span",{className:"font-mono",children:e}),h[e]?(0,J.jsx)(li,{size:12,className:"text-muted-foreground"}):(0,J.jsx)(la,{size:12,className:"text-muted-foreground"})]}),h[e]&&(0,J.jsx)("div",{className:rZ("border-t border-border bg-muted/20 p-2",p&&"p-1.5"),children:(0,J.jsx)("pre",{className:rZ("m-0 overflow-x-auto whitespace-pre-wrap break-all font-mono text-xs leading-6 text-foreground",p&&"text-[11px] leading-5"),children:"string"==typeof t?t:JSON.stringify(t,null,2)})})]},e))})]}),S&&(0,J.jsxs)("div",{className:rZ("mt-4",p&&"mt-2"),children:[(0,J.jsx)("h4",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Result"}),(0,J.jsx)("pre",{className:rZ("m-0 overflow-x-auto whitespace-pre-wrap break-all rounded-sm border border-border bg-muted/40 p-2 font-mono text-xs leading-7 text-foreground",p&&"p-1.5 text-[11px] leading-5"),children:"string"==typeof S?S:JSON.stringify(S,null,2)})]})]})})]})});function _d(){}function _p(){}_c.displayName="ToolCallBox";let _f=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_m=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_h={};function _g(e,t){return((t||_h).jsx?_m:_f).test(e)}let _b=/[ \t\n\f\r]/g;function _y(e){return""===e.replace(_b,"")}class _v{constructor(e,t){this.attribute=t,this.property=e}}_v.prototype.attribute="",_v.prototype.booleanish=!1,_v.prototype.boolean=!1,_v.prototype.commaOrSpaceSeparated=!1,_v.prototype.commaSeparated=!1,_v.prototype.defined=!1,_v.prototype.mustUseProperty=!1,_v.prototype.number=!1,_v.prototype.overloadedBoolean=!1,_v.prototype.property="",_v.prototype.spaceSeparated=!1,_v.prototype.space=void 0;let __=0,_w=_N(),_E=_N(),_x=_N(),_S=_N(),_k=_N(),_T=_N(),_A=_N();function _N(){return 2**++__}e.s(["boolean",0,_w,"booleanish",0,_E,"commaOrSpaceSeparated",0,_A,"commaSeparated",0,_T,"number",0,_S,"overloadedBoolean",0,_x,"spaceSeparated",0,_k],744);var _I=e.i(744);let _C=Object.keys(_I);class _R extends _v{constructor(e,t,r,n){let a=-1;if(super(e,t),function(e,t,r){r&&(e[t]=r)}(this,"space",n),"number"==typeof r)for(;++a<_C.length;){const e=_C[a];!function(e,t,r){r&&(e[t]=r)}(this,_C[a],(r&_I[e])===_I[e])}}}function _O(e){return e.toLowerCase()}_R.prototype.defined=!0;let _L=/[A-Z]/g,_P=/-[a-z]/g,_D=/^data[-\w.:]+$/i;function _M(e){return"-"+e.toLowerCase()}function _j(e){return e.charAt(1).toUpperCase()}let _F={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"};class _${constructor(e,t,r){this.normal=t,this.property=e,r&&(this.space=r)}}function _U(e,t){let r={},n={};for(let t of e)Object.assign(r,t.property),Object.assign(n,t.normal);return new _$(r,n,t)}function _z(e){let t={},r={};for(let[n,a]of Object.entries(e.properties)){let i=new _R(n,e.transform(e.attributes||{},n),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(i.mustUseProperty=!0),t[n]=i,r[_O(n)]=n,r[_O(i.attribute)]=n}return new _$(t,r,e.space)}_$.prototype.normal={},_$.prototype.property={},_$.prototype.space=void 0;let _B=_z({properties:{ariaActiveDescendant:null,ariaAtomic:_E,ariaAutoComplete:null,ariaBusy:_E,ariaChecked:_E,ariaColCount:_S,ariaColIndex:_S,ariaColSpan:_S,ariaControls:_k,ariaCurrent:null,ariaDescribedBy:_k,ariaDetails:null,ariaDisabled:_E,ariaDropEffect:_k,ariaErrorMessage:null,ariaExpanded:_E,ariaFlowTo:_k,ariaGrabbed:_E,ariaHasPopup:null,ariaHidden:_E,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_k,ariaLevel:_S,ariaLive:null,ariaModal:_E,ariaMultiLine:_E,ariaMultiSelectable:_E,ariaOrientation:null,ariaOwns:_k,ariaPlaceholder:null,ariaPosInSet:_S,ariaPressed:_E,ariaReadOnly:_E,ariaRelevant:null,ariaRequired:_E,ariaRoleDescription:_k,ariaRowCount:_S,ariaRowIndex:_S,ariaRowSpan:_S,ariaSelected:_E,ariaSetSize:_S,ariaSort:null,ariaValueMax:_S,ariaValueMin:_S,ariaValueNow:_S,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function _H(e,t){return t in e?e[t]:t}function _G(e,t){return _H(e,t.toLowerCase())}let _V=_z({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_T,acceptCharset:_k,accessKey:_k,action:null,allow:null,allowFullScreen:_w,allowPaymentRequest:_w,allowUserMedia:_w,alt:null,as:null,async:_w,autoCapitalize:null,autoComplete:_k,autoFocus:_w,autoPlay:_w,blocking:_k,capture:null,charSet:null,checked:_w,cite:null,className:_k,cols:_S,colSpan:null,content:null,contentEditable:_E,controls:_w,controlsList:_k,coords:_S|_T,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_w,defer:_w,dir:null,dirName:null,disabled:_w,download:_x,draggable:_E,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_w,formTarget:null,headers:_k,height:_S,hidden:_x,high:_S,href:null,hrefLang:null,htmlFor:_k,httpEquiv:_k,id:null,imageSizes:null,imageSrcSet:null,inert:_w,inputMode:null,integrity:null,is:null,isMap:_w,itemId:null,itemProp:_k,itemRef:_k,itemScope:_w,itemType:_k,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_w,low:_S,manifest:null,max:null,maxLength:_S,media:null,method:null,min:null,minLength:_S,multiple:_w,muted:_w,name:null,nonce:null,noModule:_w,noValidate:_w,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_w,optimum:_S,pattern:null,ping:_k,placeholder:null,playsInline:_w,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_w,referrerPolicy:null,rel:_k,required:_w,reversed:_w,rows:_S,rowSpan:_S,sandbox:_k,scope:null,scoped:_w,seamless:_w,selected:_w,shadowRootClonable:_w,shadowRootDelegatesFocus:_w,shadowRootMode:null,shape:null,size:_S,sizes:null,slot:null,span:_S,spellCheck:_E,src:null,srcDoc:null,srcLang:null,srcSet:null,start:_S,step:null,style:null,tabIndex:_S,target:null,title:null,translate:null,type:null,typeMustMatch:_w,useMap:null,value:_E,width:_S,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_k,axis:null,background:null,bgColor:null,border:_S,borderColor:null,bottomMargin:_S,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_w,declare:_w,event:null,face:null,frame:null,frameBorder:null,hSpace:_S,leftMargin:_S,link:null,longDesc:null,lowSrc:null,marginHeight:_S,marginWidth:_S,noResize:_w,noHref:_w,noShade:_w,noWrap:_w,object:null,profile:null,prompt:null,rev:null,rightMargin:_S,rules:null,scheme:null,scrolling:_E,standby:null,summary:null,text:null,topMargin:_S,valueType:null,version:null,vAlign:null,vLink:null,vSpace:_S,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_w,disableRemotePlayback:_w,prefix:null,property:null,results:_S,security:null,unselectable:null},space:"html",transform:_G}),_q=_z({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:_A,accentHeight:_S,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:_S,amplitude:_S,arabicForm:null,ascent:_S,attributeName:null,attributeType:null,azimuth:_S,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:_S,by:null,calcMode:null,capHeight:_S,className:_k,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:_S,diffuseConstant:_S,direction:null,display:null,dur:null,divisor:_S,dominantBaseline:null,download:_w,dx:null,dy:null,edgeMode:null,editable:null,elevation:_S,enableBackground:null,end:null,event:null,exponent:_S,externalResourcesRequired:null,fill:null,fillOpacity:_S,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:_T,g2:_T,glyphName:_T,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:_S,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:_S,horizOriginX:_S,horizOriginY:_S,id:null,ideographic:_S,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:_S,k:_S,k1:_S,k2:_S,k3:_S,k4:_S,kernelMatrix:_A,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:_S,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:_S,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:_S,overlineThickness:_S,paintOrder:null,panose1:null,path:null,pathLength:_S,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_k,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_S,pointsAtY:_S,pointsAtZ:_S,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:_A,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:_A,rev:_A,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:_A,requiredFeatures:_A,requiredFonts:_A,requiredFormats:_A,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:_S,specularExponent:_S,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:_S,strikethroughThickness:_S,string:null,stroke:null,strokeDashArray:_A,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:_S,strokeOpacity:_S,strokeWidth:null,style:null,surfaceScale:_S,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:_A,tabIndex:_S,tableValues:null,target:null,targetX:_S,targetY:_S,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:_A,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:_S,underlineThickness:_S,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:_S,values:null,vAlphabetic:_S,vMathematical:_S,vectorEffect:null,vHanging:_S,vIdeographic:_S,version:null,vertAdvY:_S,vertOriginX:_S,vertOriginY:_S,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:_S,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:_H}),_W=_z({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),_Z=_z({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_G}),_K=_z({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),_Y=_U([_B,_V,_W,_Z,_K],"html"),_X=_U([_B,_q,_W,_Z,_K],"svg");var _J=e.i(15511);let _Q=_1("end"),_0=_1("start");function _1(e){return function(t){let r=t&&t.position&&t.position[e]||{};if("number"==typeof r.line&&r.line>0&&"number"==typeof r.column&&r.column>0)return{line:r.line,column:r.column,offset:"number"==typeof r.offset&&r.offset>-1?r.offset:void 0}}}function _2(e){return e&&"object"==typeof e?"position"in e||"type"in e?_3(e.position):"start"in e||"end"in e?_3(e):"line"in e||"column"in e?_4(e):"":""}function _4(e){return _5(e&&e.line)+":"+_5(e&&e.column)}function _3(e){return _4(e&&e.start)+"-"+_4(e&&e.end)}function _5(e){return e&&"number"==typeof e?e:1}class _6 extends Error{constructor(e,t,r){super(),"string"==typeof t&&(r=t,t=void 0);let n="",a={},i=!1;if(t&&(a="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?n=e:!a.cause&&e&&(i=!0,n=e.message,a.cause=e),!a.ruleId&&!a.source&&"string"==typeof r){const e=r.indexOf(":");-1===e?a.ruleId=r:(a.source=r.slice(0,e),a.ruleId=r.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){const e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=n,this.line=o?o.line:void 0,this.name=_2(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=i&&a.cause&&"string"==typeof a.cause.stack?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}_6.prototype.file="",_6.prototype.name="",_6.prototype.reason="",_6.prototype.message="",_6.prototype.stack="",_6.prototype.column=void 0,_6.prototype.line=void 0,_6.prototype.ancestors=void 0,_6.prototype.cause=void 0,_6.prototype.fatal=void 0,_6.prototype.place=void 0,_6.prototype.ruleId=void 0,_6.prototype.source=void 0;let _9={}.hasOwnProperty,_8=new Map,_7=/[A-Z]/g,we=new Set(["table","tbody","thead","tfoot","tr"]),wt=new Set(["td","th"]),wr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wn(e,t,r){var n,a,i,o,s,l,u,c,d;let p,f,m,h,g,b,y,v,_,w,E;return"element"===t.type?(n=e,a=t,i=r,f=p=n.schema,"svg"===a.tagName.toLowerCase()&&"html"===p.space&&(n.schema=_X),n.ancestors.push(a),m=ws(n,a.tagName,!1),h=function(e,t){let r,n,a={};for(n in t.properties)if("children"!==n&&_9.call(t.properties,n)){let i=function(e,t,r){let n=function(e,t){let r=_O(t),n=t,a=_v;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&"data"===r.slice(0,4)&&_D.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(_P,_j);n="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!_P.test(e)){let r=e.replace(_L,_M);"-"!==r.charAt(0)&&(r="-"+r),t="data"+r}}a=_R}return new a(n,t)}(e.schema,t);if(!(null==r||"number"==typeof r&&Number.isNaN(r))){var a;let t;if(Array.isArray(r)&&(r=n.commaSeparated?(t={},(""===(a=r)[a.length-1]?[...a,""]:a).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):r.join(" ").trim()),"style"===n.property){let t="object"==typeof r?r:function(e,t){try{return(0,_J.default)(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};let t=new _6("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=wr+"#cannot-parse-style-attribute",t}}(e,String(r));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,r={};for(t in e)_9.call(e,t)&&(r[function(e){let t=e.replace(_7,wu);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return r}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&n.space?_F[n.property]||n.property:n.attribute,r]}}(e,n,t.properties[n]);if(i){let[n,o]=i;e.tableCellAlignToStyle&&"align"===n&&"string"==typeof o&&wt.has(t.tagName)?r=o:a[n]=o}}return r&&((a.style||(a.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r),a}(n,a),g=wo(n,a),we.has(a.tagName)&&(g=g.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&_y(e.value):_y(e))})),wa(n,h,m,a),wi(h,g),n.ancestors.pop(),n.schema=p,n.create(a,m,h,i)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let r=t.data.estree.body[0];return _d("ExpressionStatement"===r.type),e.evaluater.evaluateExpression(r.expression)}wl(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(o=e,s=t,l=r,y=b=o.schema,"svg"===s.name&&"html"===b.space&&(o.schema=_X),o.ancestors.push(s),v=null===s.name?o.Fragment:ws(o,s.name,!0),_=function(e,t){let r={};for(let n of t.attributes)if("mdxJsxExpressionAttribute"===n.type)if(n.data&&n.data.estree&&e.evaluater){let t=n.data.estree.body[0];_d("ExpressionStatement"===t.type);let a=t.expression;_d("ObjectExpression"===a.type);let i=a.properties[0];_d("SpreadElement"===i.type),Object.assign(r,e.evaluater.evaluateExpression(i.argument))}else wl(e,t.position);else{let a,i=n.name;if(n.value&&"object"==typeof n.value)if(n.value.data&&n.value.data.estree&&e.evaluater){let t=n.value.data.estree.body[0];_d("ExpressionStatement"===t.type),a=e.evaluater.evaluateExpression(t.expression)}else wl(e,t.position);else a=null===n.value||n.value;r[i]=a}return r}(o,s),w=wo(o,s),wa(o,_,v,s),wi(_,w),o.ancestors.pop(),o.schema=b,o.create(s,v,_,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wl(e,t.position)}(e,t):"root"===t.type?(u=e,c=t,d=r,wi(E={},wo(u,c)),u.create(c,u.Fragment,E,d)):"text"===t.type?t.value:void 0}function wa(e,t,r,n){"string"!=typeof r&&r!==e.Fragment&&e.passNode&&(t.node=n)}function wi(e,t){if(t.length>0){let r=t.length>1?t:t[0];r&&(e.children=r)}}function wo(e,t){let r=[],n=-1,a=e.passKeys?new Map:_8;for(;++n<t.children.length;){let i,o=t.children[n];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=a.get(e)||0;i=e+"-"+t,a.set(e,t+1)}}let s=wn(e,o,i);void 0!==s&&r.push(s)}return r}function ws(e,t,r){let n;if(r)if(t.includes(".")){let e,r=t.split("."),a=-1;for(;++a<r.length;){let t=_g(r[a])?{type:"Identifier",name:r[a]}:{type:"Literal",value:r[a]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(a&&"Literal"===t.type),optional:!1}:t}_d(e,"always a result"),n=e}else n=_g(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else n={type:"Literal",value:t};if("Literal"===n.type){let t=n.value;return _9.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(n);wl(e)}function wl(e,t){let r=new _6("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=wr+"#cannot-handle-mdx-estrees-without-createevaluater",r}function wu(e){return"-"+e.toLowerCase()}let wc={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"]},wd={};function wp(e,t){let r=t||wd;return wf(e,"boolean"!=typeof r.includeImageAlt||r.includeImageAlt,"boolean"!=typeof r.includeHtml||r.includeHtml)}function wf(e,t,r){var n;if((n=e)&&"object"==typeof n){if("value"in e)return"html"!==e.type||r?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return wm(e.children,t,r)}return Array.isArray(e)?wm(e,t,r):""}function wm(e,t,r){let n=[],a=-1;for(;++a<e.length;)n[a]=wf(e[a],t,r);return n.join("")}function wh(e,t,r,n){let a,i=e.length,o=0;if(t=t<0?-t>i?0:i+t:t>i?i:t,r=r>0?r:0,n.length<1e4)(a=Array.from(n)).unshift(t,r),e.splice(...a);else for(r&&e.splice(t,r);o<n.length;)(a=n.slice(o,o+1e4)).unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function wg(e,t){return e.length>0?(wh(e,e.length,0,t),e):t}let wb={}.hasOwnProperty;function wy(e){let t={},r=-1;for(;++r<e.length;)!function(e,t){let r;for(r in t){let n,a=(wb.call(e,r)?e[r]:void 0)||(e[r]={}),i=t[r];if(i)for(n in i){wb.call(a,n)||(a[n]=[]);let e=i[n];!function(e,t){let r=-1,n=[];for(;++r<t.length;)("after"===t[r].add?e:n).push(t[r]);wh(e,0,0,n)}(a[n],Array.isArray(e)?e:e?[e]:[])}}}(t,e[r]);return t}let wv=wR(/[A-Za-z]/),w_=wR(/[\dA-Za-z]/),ww=wR(/[#-'*+\--9=?A-Z^-~]/);function wE(e){return null!==e&&(e<32||127===e)}let wx=wR(/\d/),wS=wR(/[\dA-Fa-f]/),wk=wR(/[!-/:-@[-`{-~]/);function wT(e){return null!==e&&e<-2}function wA(e){return null!==e&&(e<0||32===e)}function wN(e){return -2===e||-1===e||32===e}let wI=wR(/\p{P}|\p{S}/u),wC=wR(/\s/);function wR(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wO(e,t,r,n){let a=n?n-1:1/0,i=0;return function(n){return wN(n)?(e.enter(r),function n(o){return wN(o)&&i++<a?(e.consume(o),n):(e.exit(r),t(o))}(n)):t(n)}}let wL={tokenize:function(e){let t,r=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wO(e,r,"linePrefix"))},function(r){return e.enter("paragraph"),function r(n){let a=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=a),t=a,function t(n){if(null===n){e.exit("chunkText"),e.exit("paragraph"),e.consume(n);return}return wT(n)?(e.consume(n),e.exit("chunkText"),r):(e.consume(n),t)}(n)}(r)});return r}},wP={tokenize:function(e){let t,r,n,a=this,i=[],o=0;return s;function s(t){if(o<i.length){let r=i[o];return a.containerState=r[1],e.attempt(r[0].continuation,l,u)(t)}return u(t)}function l(e){if(o++,a.containerState._closeFlow){let r;a.containerState._closeFlow=void 0,t&&b();let n=a.events.length,i=n;for(;i--;)if("exit"===a.events[i][0]&&"chunkFlow"===a.events[i][1].type){r=a.events[i][1].end;break}g(o);let s=n;for(;s<a.events.length;)a.events[s][1].end={...r},s++;return wh(a.events,i+1,0,a.events.slice(n)),a.events.length=s,u(e)}return s(e)}function u(r){if(o===i.length){if(!t)return p(r);if(t.currentConstruct&&t.currentConstruct.concrete)return m(r);a.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return a.containerState={},e.check(wD,c,d)(r)}function c(e){return t&&b(),g(o),p(e)}function d(e){return a.parser.lazy[a.now().line]=o!==i.length,n=a.now().offset,m(e)}function p(t){return a.containerState={},e.attempt(wD,f,m)(t)}function f(e){return o++,i.push([a.currentConstruct,a.containerState]),p(e)}function m(n){if(null===n){t&&b(),g(0),e.consume(n);return}return t=t||a.parser.flow(a.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:r}),function t(r){if(null===r){h(e.exit("chunkFlow"),!0),g(0),e.consume(r);return}return wT(r)?(e.consume(r),h(e.exit("chunkFlow")),o=0,a.interrupt=void 0,s):(e.consume(r),t)}(n)}function h(e,i){let s=a.sliceStream(e);if(i&&s.push(null),e.previous=r,r&&(r.next=e),r=e,t.defineSkip(e.start),t.write(s),a.parser.lazy[e.start.line]){let e,r,i=t.events.length;for(;i--;)if(t.events[i][1].start.offset<n&&(!t.events[i][1].end||t.events[i][1].end.offset>n))return;let s=a.events.length,l=s;for(;l--;)if("exit"===a.events[l][0]&&"chunkFlow"===a.events[l][1].type){if(e){r=a.events[l][1].end;break}e=!0}for(g(o),i=s;i<a.events.length;)a.events[i][1].end={...r},i++;wh(a.events,l+1,0,a.events.slice(s)),a.events.length=i}}function g(t){let r=i.length;for(;r-- >t;){let t=i[r];a.containerState=t[1],t[0].exit.call(a,e)}i.length=t}function b(){t.write([null]),r=void 0,t=void 0,a.containerState._closeFlow=void 0}}},wD={tokenize:function(e,t,r){return wO(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},wM={partial:!0,tokenize:function(e,t,r){return function(t){return wN(t)?wO(e,n,"linePrefix")(t):n(t)};function n(e){return null===e||wT(e)?t(e):r(e)}}};class wj{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let r=null==t?1/0:t;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,t,r){this.setCursor(Math.trunc(e));let n=this.right.splice(this.right.length-(t||0),1/0);return r&&wF(this.left,r),n.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),wF(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wF(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);wF(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);wF(this.left,t.reverse())}}}function wF(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function w$(e){let t,r,n,a,i,o,s,l={},u=-1,c=new wj(e);for(;++u<c.length;){for(;u in l;)u=l[u];if(t=c.get(u),u&&"chunkFlow"===t[1].type&&"listItemPrefix"===c.get(u-1)[1].type&&((n=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[n][1].type&&(n+=2),n<o.length&&"content"===o[n][1].type))for(;++n<o.length&&"content"!==o[n][1].type;)"chunkText"===o[n][1].type&&(o[n][1]._isInFirstContentOfListItem=!0,n++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let r,n,a=e.get(t)[1],i=e.get(t)[2],o=t-1,s=[],l=a._tokenizer;!l&&(l=i.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let u=l.events,c=[],d={},p=-1,f=a,m=0,h=0,g=[0];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),!f._tokenizer&&(r=i.sliceStream(f),f.next||r.push(null),n&&l.defineSkip(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(r),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),n=f,f=f.next}for(f=a;++p<u.length;)"exit"===u[p][0]&&"enter"===u[p-1][0]&&u[p][1].type===u[p-1][1].type&&u[p][1].start.line!==u[p][1].end.line&&(h=p+1,g.push(h),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),p=g.length;p--;){let t=u.slice(g[p],g[p+1]),r=s.pop();c.push([r,r+t.length-1]),e.splice(r,2,t)}for(c.reverse(),p=-1;++p<c.length;)d[m+c[p][0]]=m+c[p][1],m+=c[p][1]-c[p][0]-1;return d}(c,u)),u=l[u],s=!0);else if(t[1]._container){for(n=u,r=void 0;n--;)if("lineEnding"===(a=c.get(n))[1].type||"lineEndingBlank"===a[1].type)"enter"===a[0]&&(r&&(c.get(r)[1].type="lineEndingBlank"),a[1].type="lineEnding",r=n);else if("linePrefix"===a[1].type||"listItemIndent"===a[1].type);else break;r&&(t[1].end={...c.get(r)[1].start},(i=c.slice(r,u)).unshift(t),c.splice(r,u-r+1,i))}}return wh(e,0,1/0,c.slice(0)),!s}let wU={resolve:function(e){return w$(e),e},tokenize:function(e,t){let r;return function(t){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),n(t)};function n(t){return null===t?a(t):wT(t)?e.check(wz,i,a)(t):(e.consume(t),n)}function a(r){return e.exit("chunkContent"),e.exit("content"),t(r)}function i(t){return e.consume(t),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,n}}},wz={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wO(e,a,"linePrefix")};function a(a){if(null===a||wT(a))return r(a);let i=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(a):e.interrupt(n.parser.constructs.flow,r,t)(a)}}},wB={tokenize:function(e){let t=this,r=e.attempt(wM,function(n){return null===n?void e.consume(n):(e.enter("lineEndingBlank"),e.consume(n),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r)},e.attempt(this.parser.constructs.flowInitial,n,wO(e,e.attempt(this.parser.constructs.flow,n,e.attempt(wU,n)),"linePrefix")));return r;function n(n){return null===n?void e.consume(n):(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),t.currentConstruct=void 0,r)}}},wH={resolveAll:wW()},wG=wq("string"),wV=wq("text");function wq(e){return{resolveAll:wW("text"===e?wZ:void 0),tokenize:function(t){let r=this,n=this.parser.constructs[e],a=t.attempt(n,i,o);return i;function i(e){return l(e)?a(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),s)}function s(e){return l(e)?(t.exit("data"),a(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;let t=n[e],a=-1;if(t)for(;++a<t.length;){let e=t[a];if(!e.previous||e.previous.call(r,r.previous))return!0}return!1}}}}function wW(e){return function(t,r){let n,a=-1;for(;++a<=t.length;)void 0===n?t[a]&&"data"===t[a][1].type&&(n=a,a++):t[a]&&"data"===t[a][1].type||(a!==n+2&&(t[n][1].end=t[a-1][1].end,t.splice(n+2,a-n-2),a=n+2),n=void 0);return e?e(t,r):t}}function wZ(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||"lineEnding"===e[r][1].type)&&"data"===e[r-1][1].type){let n,a=e[r-1][1],i=t.sliceStream(a),o=i.length,s=-1,l=0;for(;o--;){let e=i[o];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)n=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){let i={type:r===e.length||n||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:a.start._bufferIndex+s,_index:a.start._index+o,line:a.end.line,column:a.end.column-l,offset:a.end.offset-l},end:{...a.end}};a.end={...i.start},a.start.offset===a.end.offset?Object.assign(a,i):(e.splice(r,0,["enter",i,t],["exit",i,t]),r+=2)}r++}return e}function wK(e){return null===e||wA(e)||wC(e)?1:wI(e)?2:void 0}function wY(e,t,r){let n=[],a=-1;for(;++a<e.length;){let i=e[a].resolveAll;i&&!n.includes(i)&&(t=i(t,r),n.push(i))}return t}let wX={name:"attention",resolveAll:function(e,t){let r,n,a,i,o,s,l,u,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close){for(r=c;r--;)if("exit"===e[r][0]&&"attentionSequence"===e[r][1].type&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[r][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;s=e[r][1].end.offset-e[r][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;let d={...e[r][1].end},p={...e[c][1].start};wJ(d,-s),wJ(p,s),i={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:p},a={type:s>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[c][1].start}},n={type:s>1?"strong":"emphasis",start:{...i.start},end:{...o.end}},e[r][1].end={...i.start},e[c][1].start={...o.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=wg(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=wg(l,[["enter",n,t],["enter",i,t],["exit",i,t],["enter",a,t]]),l=wg(l,wY(t.parser.constructs.insideSpan.null,e.slice(r+1,c),t)),l=wg(l,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",n,t]]),e[c][1].end.offset-e[c][1].start.offset?(u=2,l=wg(l,[["enter",e[c][1],t],["exit",e[c][1],t]])):u=0,wh(e,r-1,c-r+3,l),c=r+l.length-u-2;break}}for(c=-1;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e},tokenize:function(e,t){let r,n=this.parser.constructs.attentionMarkers.null,a=this.previous,i=wK(a);return function(o){return r=o,e.enter("attentionSequence"),function o(s){if(s===r)return e.consume(s),o;let l=e.exit("attentionSequence"),u=wK(s),c=!u||2===u&&i||n.includes(s),d=!i||2===i&&u||n.includes(a);return l._open=!!(42===r?c:c&&(i||!d)),l._close=!!(42===r?d:d&&(u||!c)),t(s)}(o)}}};function wJ(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let wQ={continuation:{tokenize:function(e,t,r){let n=this;return function(t){return wN(t)?wO(e,a,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):a(t)};function a(n){return e.attempt(wQ,t,r)(n)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,r){let n=this;return function(t){if(62===t){let r=n.containerState;return r.open||(e.enter("blockQuote",{_container:!0}),r.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),a}return r(t)};function a(r){return wN(r)?(e.enter("blockQuotePrefixWhitespace"),e.consume(r),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(r))}}},w0={name:"characterEscape",tokenize:function(e,t,r){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),n};function n(n){return wk(n)?(e.enter("characterEscapeValue"),e.consume(n),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(n)}}},w1=document.createElement("i");function w2(e){let t="&"+e+";";w1.innerHTML=t;let r=w1.textContent;return(59!==r.charCodeAt(r.length-1)||"semi"===e)&&r!==t&&r}let w4={name:"characterReference",tokenize:function(e,t,r){let n,a,i=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),n=31,a=w_,u(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),n=6,a=wS,u):(e.enter("characterReferenceValue"),n=7,a=wx,u(t))}function u(s){if(59===s&&o){let n=e.exit("characterReferenceValue");return a!==w_||w2(i.sliceSerialize(n))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):r(s)}return a(s)&&o++<n?(e.consume(s),u):r(s)}}},w3={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return null===t?r(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a)};function a(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},w5={concrete:!0,name:"codeFenced",tokenize:function(e,t,r){let n,a=this,i={partial:!0,tokenize:function(e,t,r){let i=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),wN(t)?wO(e,l,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===n?(e.enter("codeFencedFenceSequence"),function t(a){return a===n?(i++,e.consume(a),t):i>=s?(e.exit("codeFencedFenceSequence"),wN(a)?wO(e,u,"whitespace")(a):u(a)):r(a)}(t)):r(t)}function u(n){return null===n||wT(n)?(e.exit("codeFencedFence"),t(n)):r(n)}}},o=0,s=0;return function(t){var i;let u;return i=t,o=(u=a.events[a.events.length-1])&&"linePrefix"===u[1].type?u[2].sliceSerialize(u[1],!0).length:0,n=i,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(a){return a===n?(s++,e.consume(a),t):s<3?r(a):(e.exit("codeFencedFenceSequence"),wN(a)?wO(e,l,"whitespace")(a):l(a))}(i)};function l(i){return null===i||wT(i)?(e.exit("codeFencedFence"),a.interrupt?t(i):e.check(w3,c,m)(i)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(a){return null===a||wT(a)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(a)):wN(a)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),wO(e,u,"whitespace")(a)):96===a&&a===n?r(a):(e.consume(a),t)}(i))}function u(t){return null===t||wT(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(a){return null===a||wT(a)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(a)):96===a&&a===n?r(a):(e.consume(a),t)}(t))}function c(t){return e.attempt(i,m,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p}function p(t){return o>0&&wN(t)?wO(e,f,"linePrefix",o+1)(t):f(t)}function f(t){return null===t||wT(t)?e.check(w3,c,m)(t):(e.enter("codeFlowValue"),function t(r){return null===r||wT(r)?(e.exit("codeFlowValue"),f(r)):(e.consume(r),t)}(t))}function m(r){return e.exit("codeFenced"),t(r)}}},w6={name:"codeIndented",tokenize:function(e,t,r){let n=this;return function(t){return e.enter("codeIndented"),wO(e,a,"linePrefix",5)(t)};function a(t){let a=n.events[n.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?function t(r){return null===r?i(r):wT(r)?e.attempt(w9,t,i)(r):(e.enter("codeFlowValue"),function r(n){return null===n||wT(n)?(e.exit("codeFlowValue"),t(n)):(e.consume(n),r)}(r))}(t):r(t)}function i(r){return e.exit("codeIndented"),t(r)}}},w9={partial:!0,tokenize:function(e,t,r){let n=this;return a;function a(t){return n.parser.lazy[n.now().line]?r(t):wT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):wO(e,i,"linePrefix",5)(t)}function i(e){let i=n.events[n.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?t(e):wT(e)?a(e):r(e)}}};function w8(e,t,r,n,a,i,o,s,l){let u=l||1/0,c=0;return function(t){return 60===t?(e.enter(n),e.enter(a),e.enter(i),e.consume(t),e.exit(i),d):null===t||32===t||41===t||wE(t)?r(t):(e.enter(n),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),m(t))};function d(r){return 62===r?(e.enter(i),e.consume(r),e.exit(i),e.exit(a),e.exit(n),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(r))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(s),d(t)):null===t||60===t||wT(t)?r(t):(e.consume(t),92===t?f:p)}function f(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function m(a){return!c&&(null===a||41===a||wA(a))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(n),t(a)):c<u&&40===a?(e.consume(a),c++,m):41===a?(e.consume(a),c--,m):null===a||32===a||40===a||wE(a)?r(a):(e.consume(a),92===a?h:m)}function h(t){return 40===t||41===t||92===t?(e.consume(t),m):m(t)}}function w7(e,t,r,n,a,i){let o,s=this,l=0;return function(t){return e.enter(n),e.enter(a),e.consume(t),e.exit(a),e.enter(i),u};function u(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?r(d):93===d?(e.exit(i),e.enter(a),e.consume(d),e.exit(a),e.exit(n),t):wT(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(t){return null===t||91===t||93===t||wT(t)||l++>999?(e.exit("chunkString"),u(t)):(e.consume(t),o||(o=!wN(t)),92===t?d:c)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}}function Ee(e,t,r,n,a,i){let o;return function(t){return 34===t||39===t||40===t?(e.enter(n),e.enter(a),e.consume(t),e.exit(a),o=40===t?41:t,s):r(t)};function s(r){return r===o?(e.enter(a),e.consume(r),e.exit(a),e.exit(n),t):(e.enter(i),l(r))}function l(t){return t===o?(e.exit(i),s(o)):null===t?r(t):wT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),wO(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===o||null===t||wT(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return t===o||92===t?(e.consume(t),u):u(t)}}function Et(e,t){let r;return function n(a){return wT(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,n):wN(a)?wO(e,n,r?"linePrefix":"lineSuffix")(a):t(a)}}function Er(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let En={partial:!0,tokenize:function(e,t,r){return function(t){return wA(t)?Et(e,n)(t):r(t)};function n(t){return Ee(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function a(t){return wN(t)?wO(e,i,"whitespace")(t):i(t)}function i(e){return null===e||wT(e)?t(e):r(e)}}},Ea=["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"],Ei=["pre","script","style","textarea"],Eo={partial:!0,tokenize:function(e,t,r){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),e.attempt(wM,t,r)}}},Es={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return wT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):r(t)};function a(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},El={name:"labelEnd",resolveAll:function(e){let t=-1,r=[];for(;++t<e.length;){let n=e[t][1];if(r.push(e[t]),"labelImage"===n.type||"labelLink"===n.type||"labelEnd"===n.type){let e="labelImage"===n.type?4:2;n.type="data",t+=e}}return e.length!==r.length&&wh(e,0,e.length,r),e},resolveTo:function(e,t){let r,n,a,i,o=e.length,s=0;for(;o--;)if(r=e[o][1],n){if("link"===r.type||"labelLink"===r.type&&r._inactive)break;"enter"===e[o][0]&&"labelLink"===r.type&&(r._inactive=!0)}else if(a){if("enter"===e[o][0]&&("labelImage"===r.type||"labelLink"===r.type)&&!r._balanced&&(n=o,"labelLink"!==r.type)){s=2;break}}else"labelEnd"===r.type&&(a=o);let l={type:"labelLink"===e[n][1].type?"link":"image",start:{...e[n][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[n][1].start},end:{...e[a][1].end}},c={type:"labelText",start:{...e[n+s+2][1].end},end:{...e[a-2][1].start}};return i=wg(i=[["enter",l,t],["enter",u,t]],e.slice(n+1,n+s+3)),i=wg(i,[["enter",c,t]]),i=wg(i,wY(t.parser.constructs.insideSpan.null,e.slice(n+s+4,a-3),t)),i=wg(i,[["exit",c,t],e[a-2],e[a-1],["exit",u,t]]),i=wg(i,e.slice(a+1)),i=wg(i,[["exit",l,t]]),wh(e,n,e.length,i),e},tokenize:function(e,t,r){let n,a,i=this,o=i.events.length;for(;o--;)if(("labelImage"===i.events[o][1].type||"labelLink"===i.events[o][1].type)&&!i.events[o][1]._balanced){n=i.events[o][1];break}return function(t){return n?n._inactive?c(t):(a=i.parser.defined.includes(Er(i.sliceSerialize({start:n.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):r(t)};function s(t){return 40===t?e.attempt(Eu,u,a?u:c)(t):91===t?e.attempt(Ec,u,a?l:c)(t):a?u(t):c(t)}function l(t){return e.attempt(Ed,u,c)(t)}function u(e){return t(e)}function c(e){return n._balanced=!0,r(e)}}},Eu={tokenize:function(e,t,r){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),n};function n(t){return wA(t)?Et(e,a)(t):a(t)}function a(t){return 41===t?u(t):w8(e,i,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function i(t){return wA(t)?Et(e,s)(t):u(t)}function o(e){return r(e)}function s(t){return 34===t||39===t||40===t?Ee(e,l,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):u(t)}function l(t){return wA(t)?Et(e,u)(t):u(t)}function u(n){return 41===n?(e.enter("resourceMarker"),e.consume(n),e.exit("resourceMarker"),e.exit("resource"),t):r(n)}}},Ec={tokenize:function(e,t,r){let n=this;return function(t){return w7.call(n,e,a,i,"reference","referenceMarker","referenceString")(t)};function a(e){return n.parser.defined.includes(Er(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(e):r(e)}function i(e){return r(e)}}},Ed={tokenize:function(e,t,r){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),n};function n(n){return 93===n?(e.enter("referenceMarker"),e.consume(n),e.exit("referenceMarker"),e.exit("reference"),t):r(n)}}},Ep={name:"labelStartImage",resolveAll:El.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),a};function a(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),i):r(t)}function i(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},Ef={name:"labelStartLink",resolveAll:El.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),a};function a(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},Em={name:"lineEnding",tokenize:function(e,t){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),wO(e,t,"linePrefix")}}},Eh={name:"thematicBreak",tokenize:function(e,t,r){let n,a=0;return function(i){var o;return e.enter("thematicBreak"),n=o=i,function i(o){return o===n?(e.enter("thematicBreakSequence"),function t(r){return r===n?(e.consume(r),a++,t):(e.exit("thematicBreakSequence"),wN(r)?wO(e,i,"whitespace")(r):i(r))}(o)):a>=3&&(null===o||wT(o))?(e.exit("thematicBreak"),t(o)):r(o)}(o)}}},Eg={continuation:{tokenize:function(e,t,r){let n=this;return n.containerState._closeFlow=void 0,e.check(wM,function(r){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,wO(e,t,"listItemIndent",n.containerState.size+1)(r)},function(r){return n.containerState.furtherBlankLines||!wN(r)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,a(r)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(Ey,t,a)(r))});function a(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,wO(e,e.attempt(Eg,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,r){let n=this,a=n.events[n.events.length-1],i=a&&"linePrefix"===a[1].type?a[2].sliceSerialize(a[1],!0).length:0,o=0;return function(t){let a=n.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===a?!n.containerState.marker||t===n.containerState.marker:wx(t)){if(n.containerState.type||(n.containerState.type=a,e.enter(a,{_container:!0})),"listUnordered"===a)return e.enter("listItemPrefix"),42===t||45===t?e.check(Eh,r,s)(t):s(t);if(!n.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(a){return wx(a)&&++o<10?(e.consume(a),t):(!n.interrupt||o<2)&&(n.containerState.marker?a===n.containerState.marker:41===a||46===a)?(e.exit("listItemValue"),s(a)):r(a)}(t)}return r(t)};function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||t,e.check(wM,n.interrupt?r:l,e.attempt(Eb,c,u))}function l(e){return n.containerState.initialBlankLine=!0,i++,c(e)}function u(t){return wN(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),c):r(t)}function c(r){return n.containerState.size=i+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(r)}}},Eb={partial:!0,tokenize:function(e,t,r){let n=this;return wO(e,function(e){let a=n.events[n.events.length-1];return!wN(e)&&a&&"listItemPrefixWhitespace"===a[1].type?t(e):r(e)},"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},Ey={partial:!0,tokenize:function(e,t,r){let n=this;return wO(e,function(e){let a=n.events[n.events.length-1];return a&&"listItemIndent"===a[1].type&&a[2].sliceSerialize(a[1],!0).length===n.containerState.size?t(e):r(e)},"listItemIndent",n.containerState.size+1)}},Ev={name:"setextUnderline",resolveTo:function(e,t){let r,n,a,i=e.length;for(;i--;)if("enter"===e[i][0]){if("content"===e[i][1].type){r=i;break}"paragraph"===e[i][1].type&&(n=i)}else"content"===e[i][1].type&&e.splice(i,1),a||"definition"!==e[i][1].type||(a=i);let o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[n][1].type="setextHeadingText",a?(e.splice(n,0,["enter",o,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,r){let n,a=this;return function(t){var o;let s,l=a.events.length;for(;l--;)if("lineEnding"!==a.events[l][1].type&&"linePrefix"!==a.events[l][1].type&&"content"!==a.events[l][1].type){s="paragraph"===a.events[l][1].type;break}return!a.parser.lazy[a.now().line]&&(a.interrupt||s)?(e.enter("setextHeadingLine"),n=t,o=t,e.enter("setextHeadingLineSequence"),function t(r){return r===n?(e.consume(r),t):(e.exit("setextHeadingLineSequence"),wN(r)?wO(e,i,"lineSuffix")(r):i(r))}(o)):r(t)};function i(n){return null===n||wT(n)?(e.exit("setextHeadingLine"),t(n)):r(n)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,r){let n,a=this;return function(t){var n;return e.enter("definition"),n=t,w7.call(a,e,i,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(n)};function i(t){return(n=Er(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):r(t)}function o(t){return wA(t)?Et(e,s)(t):s(t)}function s(t){return w8(e,l,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(En,u,u)(t)}function u(t){return wN(t)?wO(e,c,"whitespace")(t):c(t)}function c(i){return null===i||wT(i)?(e.exit("definition"),a.parser.defined.push(n),t(i)):r(i)}}}},"disable",0,{null:[]},"document",0,{42:Eg,43:Eg,45:Eg,48:Eg,49:Eg,50:Eg,51:Eg,52:Eg,53:Eg,54:Eg,55:Eg,56:Eg,57:Eg,62:wQ},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let r,n,a=e.length-2,i=3;return"whitespace"===e[3][1].type&&(i+=2),a-2>i&&"whitespace"===e[a][1].type&&(a-=2),"atxHeadingSequence"===e[a][1].type&&(i===a-1||a-4>i&&"whitespace"===e[a-2][1].type)&&(a-=i+1===a?2:4),a>i&&(r={type:"atxHeadingText",start:e[i][1].start,end:e[a][1].end},n={type:"chunkText",start:e[i][1].start,end:e[a][1].end,contentType:"text"},wh(e,i,a-i+1,[["enter",r,t],["enter",n,t],["exit",n,t],["exit",r,t]])),e},tokenize:function(e,t,r){let n=0;return function(a){var i;return e.enter("atxHeading"),i=a,e.enter("atxHeadingSequence"),function a(i){return 35===i&&n++<6?(e.consume(i),a):null===i||wA(i)?(e.exit("atxHeadingSequence"),function r(n){return 35===n?(e.enter("atxHeadingSequence"),function t(n){return 35===n?(e.consume(n),t):(e.exit("atxHeadingSequence"),r(n))}(n)):null===n||wT(n)?(e.exit("atxHeading"),t(n)):wN(n)?wO(e,r,"whitespace")(n):(e.enter("atxHeadingText"),function t(n){return null===n||35===n||wA(n)?(e.exit("atxHeadingText"),r(n)):(e.consume(n),t)}(n))}(i)):r(i)}(i)}}},42:Eh,45:[Ev,Eh],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(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},tokenize:function(e,t,r){let n,a,i,o,s,l=this;return function(t){var r;return r=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(r),u};function u(o){return 33===o?(e.consume(o),c):47===o?(e.consume(o),a=!0,f):63===o?(e.consume(o),n=3,l.interrupt?t:O):wv(o)?(e.consume(o),i=String.fromCharCode(o),m):r(o)}function c(a){return 45===a?(e.consume(a),n=2,d):91===a?(e.consume(a),n=5,o=0,p):wv(a)?(e.consume(a),n=4,l.interrupt?t:O):r(a)}function d(n){return 45===n?(e.consume(n),l.interrupt?t:O):r(n)}function p(n){let a="CDATA[";return n===a.charCodeAt(o++)?(e.consume(n),o===a.length)?l.interrupt?t:S:p:r(n)}function f(t){return wv(t)?(e.consume(t),i=String.fromCharCode(t),m):r(t)}function m(o){if(null===o||47===o||62===o||wA(o)){let s=47===o,u=i.toLowerCase();return!s&&!a&&Ei.includes(u)?(n=1,l.interrupt?t(o):S(o)):Ea.includes(i.toLowerCase())?(n=6,s)?(e.consume(o),h):l.interrupt?t(o):S(o):(n=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(o):a?function t(r){return wN(r)?(e.consume(r),t):E(r)}(o):g(o))}return 45===o||w_(o)?(e.consume(o),i+=String.fromCharCode(o),m):r(o)}function h(n){return 62===n?(e.consume(n),l.interrupt?t:S):r(n)}function g(t){return 47===t?(e.consume(t),E):58===t||95===t||wv(t)?(e.consume(t),b):wN(t)?(e.consume(t),g):E(t)}function b(t){return 45===t||46===t||58===t||95===t||w_(t)?(e.consume(t),b):y(t)}function y(t){return 61===t?(e.consume(t),v):wN(t)?(e.consume(t),y):g(t)}function v(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),s=t,_):wN(t)?(e.consume(t),v):function t(r){return null===r||34===r||39===r||47===r||60===r||61===r||62===r||96===r||wA(r)?y(r):(e.consume(r),t)}(t)}function _(t){return t===s?(e.consume(t),s=null,w):null===t||wT(t)?r(t):(e.consume(t),_)}function w(e){return 47===e||62===e||wN(e)?g(e):r(e)}function E(t){return 62===t?(e.consume(t),x):r(t)}function x(t){return null===t||wT(t)?S(t):wN(t)?(e.consume(t),x):r(t)}function S(t){return 45===t&&2===n?(e.consume(t),N):60===t&&1===n?(e.consume(t),I):62===t&&4===n?(e.consume(t),L):63===t&&3===n?(e.consume(t),O):93===t&&5===n?(e.consume(t),R):wT(t)&&(6===n||7===n)?(e.exit("htmlFlowData"),e.check(Eo,P,k)(t)):null===t||wT(t)?(e.exit("htmlFlowData"),k(t)):(e.consume(t),S)}function k(t){return e.check(Es,T,P)(t)}function T(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A}function A(t){return null===t||wT(t)?k(t):(e.enter("htmlFlowData"),S(t))}function N(t){return 45===t?(e.consume(t),O):S(t)}function I(t){return 47===t?(e.consume(t),i="",C):S(t)}function C(t){if(62===t){let r=i.toLowerCase();return Ei.includes(r)?(e.consume(t),L):S(t)}return wv(t)&&i.length<8?(e.consume(t),i+=String.fromCharCode(t),C):S(t)}function R(t){return 93===t?(e.consume(t),O):S(t)}function O(t){return 62===t?(e.consume(t),L):45===t&&2===n?(e.consume(t),O):S(t)}function L(t){return null===t||wT(t)?(e.exit("htmlFlowData"),P(t)):(e.consume(t),L)}function P(r){return e.exit("htmlFlow"),t(r)}}},61:Ev,95:Eh,96:w5,126:w5},"flowInitial",0,{[-2]:w6,[-1]:w6,32:w6},"insideSpan",0,{null:[wX,wH]},"string",0,{38:w4,92:w0},"text",0,{[-5]:Em,[-4]:Em,[-3]:Em,33:Ep,38:w4,42:wX,60:[{name:"autolink",tokenize:function(e,t,r){let n=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a};function a(t){return wv(t)?(e.consume(t),i):64===t?r(t):s(t)}function i(t){return 43===t||45===t||46===t||w_(t)?(n=1,function t(r){return 58===r?(e.consume(r),n=0,o):(43===r||45===r||46===r||w_(r))&&n++<32?(e.consume(r),t):(n=0,s(r))}(t)):s(t)}function o(n){return 62===n?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):null===n||32===n||60===n||wE(n)?r(n):(e.consume(n),o)}function s(t){return 64===t?(e.consume(t),l):ww(t)?(e.consume(t),s):r(t)}function l(a){return w_(a)?function a(i){return 46===i?(e.consume(i),n=0,l):62===i?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(i),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(i){if((45===i||w_(i))&&n++<63){let r=45===i?t:a;return e.consume(i),r}return r(i)}(i)}(a):r(a)}}},{name:"htmlText",tokenize:function(e,t,r){let n,a,i,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),_):63===t?(e.consume(t),y):wv(t)?(e.consume(t),E):r(t)}function l(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),a=0,f):wv(t)?(e.consume(t),b):r(t)}function u(t){return 45===t?(e.consume(t),p):r(t)}function c(t){return null===t?r(t):45===t?(e.consume(t),d):wT(t)?(i=c,C(t)):(e.consume(t),c)}function d(t){return 45===t?(e.consume(t),p):c(t)}function p(e){return 62===e?I(e):45===e?d(e):c(e)}function f(t){let n="CDATA[";return t===n.charCodeAt(a++)?(e.consume(t),a===n.length?m:f):r(t)}function m(t){return null===t?r(t):93===t?(e.consume(t),h):wT(t)?(i=m,C(t)):(e.consume(t),m)}function h(t){return 93===t?(e.consume(t),g):m(t)}function g(t){return 62===t?I(t):93===t?(e.consume(t),g):m(t)}function b(t){return null===t||62===t?I(t):wT(t)?(i=b,C(t)):(e.consume(t),b)}function y(t){return null===t?r(t):63===t?(e.consume(t),v):wT(t)?(i=y,C(t)):(e.consume(t),y)}function v(e){return 62===e?I(e):y(e)}function _(t){return wv(t)?(e.consume(t),w):r(t)}function w(t){return 45===t||w_(t)?(e.consume(t),w):function t(r){return wT(r)?(i=t,C(r)):wN(r)?(e.consume(r),t):I(r)}(t)}function E(t){return 45===t||w_(t)?(e.consume(t),E):47===t||62===t||wA(t)?x(t):r(t)}function x(t){return 47===t?(e.consume(t),I):58===t||95===t||wv(t)?(e.consume(t),S):wT(t)?(i=x,C(t)):wN(t)?(e.consume(t),x):I(t)}function S(t){return 45===t||46===t||58===t||95===t||w_(t)?(e.consume(t),S):function t(r){return 61===r?(e.consume(r),k):wT(r)?(i=t,C(r)):wN(r)?(e.consume(r),t):x(r)}(t)}function k(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),n=t,T):wT(t)?(i=k,C(t)):wN(t)?(e.consume(t),k):(e.consume(t),A)}function T(t){return t===n?(e.consume(t),n=void 0,N):null===t?r(t):wT(t)?(i=T,C(t)):(e.consume(t),T)}function A(t){return null===t||34===t||39===t||60===t||61===t||96===t?r(t):47===t||62===t||wA(t)?x(t):(e.consume(t),A)}function N(e){return 47===e||62===e||wA(e)?x(e):r(e)}function I(n){return 62===n?(e.consume(n),e.exit("htmlTextData"),e.exit("htmlText"),t):r(n)}function C(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),R}function R(t){return wN(t)?wO(e,O,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):O(t)}function O(t){return e.enter("htmlTextData"),i(t)}}}],91:Ef,92:[{name:"hardBreakEscape",tokenize:function(e,t,r){return function(t){return e.enter("hardBreakEscape"),e.consume(t),n};function n(n){return wT(n)?(e.exit("hardBreakEscape"),t(n)):r(n)}}},w0],93:El,95:wX,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,r,n=e.length-4,a=3;if(("lineEnding"===e[3][1].type||"space"===e[a][1].type)&&("lineEnding"===e[n][1].type||"space"===e[n][1].type)){for(t=a;++t<n;)if("codeTextData"===e[t][1].type){e[a][1].type="codeTextPadding",e[n][1].type="codeTextPadding",a+=2,n-=2;break}}for(t=a-1,n++;++t<=n;)void 0===r?t!==n&&"lineEnding"!==e[t][1].type&&(r=t):(t===n||"lineEnding"===e[t][1].type)&&(e[r][1].type="codeTextData",t!==r+2&&(e[r][1].end=e[t-1][1].end,e.splice(r+2,t-r-2),n-=t-r-2,t=r+2),r=void 0);return e},tokenize:function(e,t,r){let n,a,i=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(r){return 96===r?(e.consume(r),i++,t):(e.exit("codeTextSequence"),o(r))}(t)};function o(l){return null===l?r(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(a=e.enter("codeTextSequence"),n=0,function r(o){return 96===o?(e.consume(o),n++,r):n===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(a.type="codeTextData",s(o))}(l)):wT(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),s(l))}function s(t){return null===t||32===t||96===t||wT(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var E_=e.i(4127);let Ew=/[\0\t\n\r]/g;function EE(e,t){let r=Number.parseInt(e,t);return r<9||11===r||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(65535&r)==65535||(65535&r)==65534||r>1114111?"�":String.fromCodePoint(r)}let Ex=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ES(e,t,r){if(t)return t;if(35===r.charCodeAt(0)){let e=r.charCodeAt(1),t=120===e||88===e;return EE(r.slice(t?2:1),t?16:10)}return w2(r)||e}let Ek={}.hasOwnProperty;function ET(e){return{line:e.line,column:e.column,offset:e.offset}}function EA(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+_2({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+_2({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+_2({start:t.start,end:t.end})+") is still open")}function EN(e){let t=this;t.parser=function(r){var n,a;let i,o,s,l;return"object"==typeof(n={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(a=n,n=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:n(b),autolinkProtocol:u,autolinkEmail:u,atxHeading:n(m),blockQuote:n(function(){return{type:"blockquote",children:[]}}),characterEscape:u,characterReference:u,codeFenced:n(f),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:n(f,a),codeText:n(function(){return{type:"inlineCode",value:""}},a),codeTextData:u,data:u,codeFlowValue:u,definition:n(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:n(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:n(h),hardBreakTrailing:n(h),htmlFlow:n(g,a),htmlFlowData:u,htmlText:n(g,a),htmlTextData:u,image:n(function(){return{type:"image",title:null,url:"",alt:null}}),label:a,link:n(b),listItem:n(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:n(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:n(y),paragraph:n(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:n(m),strong:n(function(){return{type:"strong",children:[]}}),thematicBreak:n(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){c.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){c.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:c,characterReferenceMarkerHexadecimal:p,characterReferenceMarkerNumeric:p,characterReferenceValue:function(e){let t,r=this.sliceSerialize(e),n=this.data.characterReferenceType;n?(t=EE(r,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):t=w2(r);let a=this.stack[this.stack.length-1];a.value+=t},characterReference:function(e){this.stack.pop().position.end=ET(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:c,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:c,data:c,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=Er(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:c,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:c,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),r=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===r.type?r.children=e.children:r.alt=t},labelText:function(e){let t=this.sliceSerialize(e),r=this.stack[this.stack.length-2];r.label=t.replace(Ex,ES),r.identifier=Er(t).toLowerCase()},lineEnding:function(e){let r=this.stack[this.stack.length-1];if(this.data.atHardBreak){r.children[r.children.length-1].position.end=ET(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(r.type)&&(u.call(this,e),c.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=Er(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,r){let n=-1;for(;++n<r.length;){let a=r[n];Array.isArray(a)?e(t,a):function(e,t){let r;for(r in t)if(Ek.call(t,r))switch(r){case"canContainEols":{let n=t[r];n&&e[r].push(...n);break}case"transforms":{let n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{let n=t[r];n&&Object.assign(e[r],n)}}}(t,a)}}(t,(e||{}).mdastExtensions||[]);let r={};return function(e){let n={type:"root",children:[]},o={stack:[n],tokenStack:[],config:t,enter:i,exit:s,buffer:a,resume:l,data:r},u=[],c=-1;for(;++c<e.length;)("listOrdered"===e[c][1].type||"listUnordered"===e[c][1].type)&&("enter"===e[c][0]?u.push(c):c=function(e,t,r){let n,a,i,o,s=t-1,l=-1,u=!1;for(;++s<=r;){let t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!n||o||l||i||(i=s),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(n){let o=s;for(a=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;a&&(e[a][1].type="lineEndingBlank",u=!0),t[1].type="lineEnding",a=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}i&&(!a||i<a)&&(n._spread=!0),n.end=Object.assign({},a?e[a][1].start:t[1].end),e.splice(a||s,0,["exit",n,t[2]]),s++,r++}if("listItemPrefix"===t[1].type){let a={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};n=a,e.splice(s,0,["enter",a,t[2]]),s++,r++,i=void 0,o=!0}}}return e[t][1]._spread=u,r}(e,u.pop(),c));for(c=-1;++c<e.length;){let r=t[e[c][0]];Ek.call(r,e[c][1].type)&&r[e[c][1].type].call(Object.assign({sliceSerialize:e[c][2].sliceSerialize},o),e[c][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||EA).call(o,void 0,e[0])}for(n.position={start:ET(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ET(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c<t.transforms.length;)n=t.transforms[c](n)||n;return n};function n(e,t){return function(r){i.call(this,e(r),r),t&&t.call(this,r)}}function a(){this.stack.push({type:"fragment",children:[]})}function i(e,t,r){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,r||void 0]),e.position={start:ET(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){let r=this.stack.pop(),n=this.tokenStack.pop();if(n)n[0].type!==e.type&&(t?t.call(this,e,n[0]):(n[1]||EA).call(this,e,n[0]));else throw Error("Cannot close `"+e.type+"` ("+_2({start:e.start,end:e.end})+"): it’s not open");r.position.end=ET(e.end)}function l(){return wp(this.stack.pop())}function u(e){let t=this.stack[this.stack.length-1].children,r=t[t.length-1];r&&"text"===r.type||((r={type:"text",value:""}).position={start:ET(e.start),end:void 0},t.push(r)),this.stack.push(r)}function c(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=ET(e.end)}function d(){this.data.atHardBreak=!0}function p(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function m(){return{type:"heading",depth:0,children:[]}}function h(){return{type:"break"}}function g(){return{type:"html",value:""}}function b(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(a)(function(e){for(;!w$(e););return e}((function(e){let t={constructs:wy([E_,...(e||{}).extensions||[]]),content:r(wL),defined:[],document:r(wP),flow:r(wB),lazy:{},string:r(wG),text:r(wV)};return t;function r(e){return function(r){return function(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0},a={},i=[],o=[],s=[],l={attempt:m(function(e,t){h(e,t.from)}),check:m(f),consume:function(e){wT(e)?(n.line++,n.column=1,n.offset+=-3===e?2:1,g()):-1!==e&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=e},enter:function(e,t){let r=t||{};return r.type=e,r.start=p(),u.events.push(["enter",r,u]),s.push(r),r},exit:function(e){let t=s.pop();return t.end=p(),u.events.push(["exit",t,u]),t},interrupt:m(f,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){a[e.line]=e.column,g()},events:[],now:p,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let r,n=-1,a=[];for(;++n<e.length;){let i,o=e[n];if("string"==typeof o)i=o;else switch(o){case -5:i="\r";break;case -4:i="\n";break;case -3:i="\r\n";break;case -2:i=t?" ":" ";break;case -1:if(!t&&r)continue;i=" ";break;default:i=String.fromCharCode(o)}r=-2===o,a.push(i)}return a.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=wg(o,e),function(){let e;for(;n._index<o.length;){let r=o[n._index];if("string"==typeof r)for(e=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===e&&n._bufferIndex<r.length;){var t;t=r.charCodeAt(n._bufferIndex),c=c(t)}else c=c(r)}}(),null!==o[o.length-1])?[]:(h(t,0),u.events=wY(i,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function d(e){return function(e,t){let r,n=t.start._index,a=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;if(n===i)r=[e[n].slice(a,o)];else{if(r=e.slice(n,i),a>-1){let e=r[0];"string"==typeof e?r[0]=e.slice(a):r.shift()}o>0&&r.push(e[i].slice(0,o))}return r}(o,e)}function p(){let{_bufferIndex:e,_index:t,line:r,column:a,offset:i}=n;return{_bufferIndex:e,_index:t,line:r,column:a,offset:i}}function f(e,t){t.restore()}function m(e,t){return function(r,a,i){var o;let c,d,f,m;return Array.isArray(r)?h(r):"tokenize"in r?h([r]):(o=r,function(e){let t=null!==e&&o[e],r=null!==e&&o.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(r)?r:r?[r]:[]])(e)});function h(e){return(c=e,d=0,0===e.length)?i:b(e[d])}function b(e){return function(r){let a,i,o,c,d;return(a=p(),i=u.previous,o=u.currentConstruct,c=u.events.length,d=Array.from(s),m={from:c,restore:function(){n=a,u.previous=i,u.currentConstruct=o,u.events.length=c,s=d,g()}},f=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?v(r):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,y,v)(r)}}function y(t){return e(f,m),a}function v(e){return(m.restore(),++d<c.length)?b(c[d]):i}}}function h(e,t){e.resolveAll&&!i.includes(e)&&i.push(e),e.resolve&&wh(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function g(){n.line in a&&n.column<2&&(n.column=a[n.line],n.offset+=a[n.line]-1)}}(t,e,r)}}})(a).document().write((o=1,s="",l=!0,function(e,t,r){let n,a,u,c,d,p=[];for(e=s+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),u=0,s="",l&&(65279===e.charCodeAt(0)&&u++,l=void 0);u<e.length;){if(Ew.lastIndex=u,c=(n=Ew.exec(e))&&void 0!==n.index?n.index:e.length,d=e.charCodeAt(c),!n){s=e.slice(u);break}if(10===d&&u===c&&i)p.push(-3),i=void 0;else switch(i&&(p.push(-5),i=void 0),u<c&&(p.push(e.slice(u,c)),o+=c-u),d){case 0:p.push(65533),o++;break;case 9:for(a=4*Math.ceil(o/4),p.push(-2);o++<a;)p.push(-1);break;case 10:p.push(-4),o=1;break;default:i=!0,o=1}u=c+1}return r&&(i&&p.push(-5),s&&p.push(s),p.push(null)),p})(r,n,!0))))}}let EI="object"==typeof self?self:globalThis,EC=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw TypeError("unable to deserialize "+e)}return new EI[e](t)},ER=e=>{var t;let r,n;return(t=new Map,r=(e,r)=>(t.set(r,e),e),n=a=>{if(t.has(a))return t.get(a);let[i,o]=e[a];switch(i){case 0:case -1:return r(o,a);case 1:{let e=r([],a);for(let t of o)e.push(n(t));return e}case 2:{let e=r({},a);for(let[t,r]of o)e[n(t)]=n(r);return e}case 3:return r(new Date(o),a);case 4:{let{source:e,flags:t}=o;return r(new RegExp(e,t),a)}case 5:{let e=r(new Map,a);for(let[t,r]of o)e.set(n(t),n(r));return e}case 6:{let e=r(new Set,a);for(let t of o)e.add(n(t));return e}case 7:{let{name:e,message:t}=o;return r(EC(e,t),a)}case 8:return r(BigInt(o),a);case"BigInt":return r(Object(BigInt(o)),a);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return r(new DataView(e),o)}}return r(EC(i,o),a)})(0)},{toString:EO}={},{keys:EL}=Object,EP=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let r=EO.call(e).slice(8,-1);switch(r){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,r]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},ED=([e,t])=>0===e&&("function"===t||"symbol"===t),EM=(e,{json:t,lossy:r}={})=>{var n,a,i;let o,s,l=[];return(n=!(t||r),a=!!t,i=new Map,o=(e,t)=>{let r=l.push(e)-1;return i.set(t,r),r},s=e=>{if(i.has(e))return i.get(e);let[t,r]=EP(e);switch(t){case 0:{let a=e;switch(r){case"bigint":t=8,a=e.toString();break;case"function":case"symbol":if(n)throw TypeError("unable to serialize "+r);a=null;break;case"undefined":return o([-1],e)}return o([t,a],e)}case 1:{if(r){let t=e;return"DataView"===r?t=new Uint8Array(e.buffer):"ArrayBuffer"===r&&(t=new Uint8Array(e)),o([r,[...t]],e)}let n=[],a=o([t,n],e);for(let t of e)n.push(s(t));return a}case 2:{if(r)switch(r){case"BigInt":return o([r,e.toString()],e);case"Boolean":case"Number":case"String":return o([r,e.valueOf()],e)}if(a&&"toJSON"in e)return s(e.toJSON());let i=[],l=o([t,i],e);for(let t of EL(e))(n||!ED(EP(e[t])))&&i.push([s(t),s(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:r,flags:n}=e;return o([t,{source:r,flags:n}],e)}case 5:{let r=[],a=o([t,r],e);for(let[t,a]of e)(n||!(ED(EP(t))||ED(EP(a))))&&r.push([s(t),s(a)]);return a}case 6:{let r=[],a=o([t,r],e);for(let t of e)(n||!ED(EP(t)))&&r.push(s(t));return a}}let{message:l}=e;return o([t,{name:r,message:l}],e)})(e),l},Ej="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?ER(EM(e,t)):structuredClone(e):(e,t)=>ER(EM(e,t));function EF(e){let t=[],r=-1,n=0,a=0;for(;++r<e.length;){let i=e.charCodeAt(r),o="";if(37===i&&w_(e.charCodeAt(r+1))&&w_(e.charCodeAt(r+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){let t=e.charCodeAt(r+1);i<56320&&t>56319&&t<57344?(o=String.fromCharCode(i,t),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+a+1,o=""),a&&(r+=a,a=0)}return t.join("")+e.slice(n)}function E$(e,t){let r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function EU(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let Ez=function(e){var t,r;if(null==e)return EH;if("function"==typeof e)return EB(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],r=-1;for(;++r<e.length;)t[r]=Ez(e[r]);return EB(function(...e){let r=-1;for(;++r<t.length;)if(t[r].apply(this,e))return!0;return!1})}(e):(t=e,EB(function(e){let r;for(r in t)if(e[r]!==t[r])return!1;return!0}))}if("string"==typeof e){return r=e,EB(function(e){return e&&e.type===r})}throw Error("Expected function, string, or object as test")};function EB(e){return function(t,r,n){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof r?r:void 0,n||void 0))}}function EH(){return!0}let EG=[];function EV(e,t,r,n){let a;"function"==typeof t&&"function"!=typeof r?(n=r,r=t):a=t;let i=Ez(a),o=n?-1:1;(function e(a,s,l){let u=a&&"object"==typeof a?a:{};if("string"==typeof u.type){let e="string"==typeof u.tagName?u.tagName:"string"==typeof u.name?u.name:void 0;Object.defineProperty(c,"name",{value:"node ("+a.type+(e?"<"+e+">":"")+")"})}return c;function c(){var u;let c,d,p,f=EG;if((!t||i(a,s,l[l.length-1]||void 0))&&!1===(f=Array.isArray(u=r(a,l))?u:"number"==typeof u?[!0,u]:null==u?EG:[u])[0])return f;if("children"in a&&a.children&&a.children&&"skip"!==f[0])for(d=(n?a.children.length:-1)+o,p=l.concat(a);d>-1&&d<a.children.length;){if(!1===(c=e(a.children[d],d,p)())[0])return c;d="number"==typeof c[1]?c[1]:d+o}return f}})(e,void 0,[])()}function Eq(e,t,r,n){let a,i,o;"function"==typeof t&&"function"!=typeof r?(i=void 0,o=t,a=r):(i=t,o=r,a=n),EV(e,i,function(e,t){let r=t[t.length-1],n=r?r.children.indexOf(e):void 0;return o(e,n,r)},a)}function EW(e,t){let r=t.referenceType,n="]";if("collapsed"===r?n+="[]":"full"===r&&(n+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+n}];let a=e.all(t),i=a[0];i&&"text"===i.type?i.value="["+i.value:a.unshift({type:"text",value:"["});let o=a[a.length-1];return o&&"text"===o.type?o.value+=n:a.push({type:"text",value:n}),a}function EZ(e){let t=e.spread;return null==t?e.children.length>1:t}function EK(e,t,r){let n=0,a=e.length;if(t){let t=e.codePointAt(n);for(;9===t||32===t;)n++,t=e.codePointAt(n)}if(r){let t=e.codePointAt(a-1);for(;9===t||32===t;)a--,t=e.codePointAt(a-1)}return a>n?e.slice(n,a):""}let EY={blockquote:function(e,t){let r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)},break:function(e,t){let r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:"\n"}]},code:function(e,t){let r=t.value?t.value+"\n":"",n={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(n.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i={type:"element",tagName:"pre",properties:{},children:[i=e.applyData(t,i)]},e.patch(t,i),i},delete:function(e,t){let r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},emphasis:function(e,t){let r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},footnoteReference:function(e,t){let r,n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),i=EF(a.toLowerCase()),o=e.footnoteOrder.indexOf(a),s=e.footnoteCounts.get(a);void 0===s?(s=0,e.footnoteOrder.push(a),r=e.footnoteOrder.length):r=o+1,s+=1,e.footnoteCounts.set(a,s);let l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(r)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){let r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},html:function(e,t){if(e.options.allowDangerousHtml){let r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}},imageReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return EW(e,t);let a={src:EF(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(a.title=n.title);let i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)},image:function(e,t){let r={src:EF(t.url)};null!==t.alt&&void 0!==t.alt&&(r.alt=t.alt),null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)},inlineCode:function(e,t){let r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);let n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)},linkReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return EW(e,t);let a={href:EF(n.url||"")};null!==n.title&&void 0!==n.title&&(a.title=n.title);let i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},link:function(e,t){let r={href:EF(t.url)};null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},listItem:function(e,t,r){let n=e.all(t),a=r?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let r=e.children,n=-1;for(;!t&&++n<r.length;)t=EZ(r[n])}return t}(r):EZ(t),i={},o=[];if("boolean"==typeof t.checked){let e,r=n[0];r&&"element"===r.type&&"p"===r.tagName?e=r:(e={type:"element",tagName:"p",properties:{},children:[]},n.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let s=-1;for(;++s<n.length;){let e=n[s];(a||0!==s||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||a?o.push(e):o.push(...e.children)}let l=n[n.length-1];l&&(a||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)},list:function(e,t){let r={},n=e.all(t),a=-1;for("number"==typeof t.start&&1!==t.start&&(r.start=t.start);++a<n.length;){let e=n[a];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}let i={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,i),e.applyData(t,i)},paragraph:function(e,t){let r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},root:function(e,t){let r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)},strong:function(e,t){let r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},table:function(e,t){let r=e.all(t),n=r.shift(),a=[];if(n){let r={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],r),a.push(r)}if(r.length>0){let n={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},i=_0(t.children[1]),o=_Q(t.children[t.children.length-1]);i&&o&&(n.position={start:i,end:o}),a.push(n)}let i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)},tableCell:function(e,t){let r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},tableRow:function(e,t,r){let n=r?r.children:void 0,a=0===(n?n.indexOf(t):1)?"th":"td",i=r&&"table"===r.type?r.align:void 0,o=i?i.length:t.children.length,s=-1,l=[];for(;++s<o;){let r=t.children[s],n={},o=i?i[s]:void 0;o&&(n.align=o);let u={type:"element",tagName:a,properties:n,children:[]};r&&(u.children=e.all(r),e.patch(r,u),u=e.applyData(r,u)),l.push(u)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)},text:function(e,t){let r={type:"text",value:function(e){let t=String(e),r=/\r?\n|\r/g,n=r.exec(t),a=0,i=[];for(;n;)i.push(EK(t.slice(a,n.index),a>0,!0),n[0]),a=n.index+n[0].length,n=r.exec(t);return i.push(EK(t.slice(a),a>0,!1)),i.join("")}(String(t.value))};return e.patch(t,r),e.applyData(t,r)},thematicBreak:function(e,t){let r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)},toml:EX,yaml:EX,definition:EX,footnoteDefinition:EX};function EX(){}let EJ={}.hasOwnProperty,EQ={};function E0(e,t){e.position&&(t.position=function(e){let t=_0(e),r=_Q(e);if(t&&r)return{start:t,end:r}}(e))}function E1(e,t){let r=t;if(e&&e.data){let t=e.data.hName,n=e.data.hChildren,a=e.data.hProperties;"string"==typeof t&&("element"===r.type?r.tagName=t:r={type:"element",tagName:t,properties:{},children:"children"in r?r.children:[r]}),"element"===r.type&&a&&Object.assign(r.properties,Ej(a)),"children"in r&&r.children&&null!=n&&(r.children=n)}return r}function E2(e,t){let r=[],n=-1;for(t&&r.push({type:"text",value:"\n"});++n<e.length;)n&&r.push({type:"text",value:"\n"}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:"\n"}),r}function E4(e){let t=0,r=e.charCodeAt(t);for(;9===r||32===r;)t++,r=e.charCodeAt(t);return e.slice(t)}function E3(e,t){let r,n,a,i,o=(r=t||EQ,n=new Map,a=new Map,i={all:function(e){let t=[];if("children"in e){let r=e.children,n=-1;for(;++n<r.length;){let a=i.one(r[n],e);if(a){if(n&&"break"===r[n-1].type&&(Array.isArray(a)||"text"!==a.type||(a.value=E4(a.value)),!Array.isArray(a)&&"element"===a.type)){let e=a.children[0];e&&"text"===e.type&&(e.value=E4(e.value))}Array.isArray(a)?t.push(...a):t.push(a)}}}return t},applyData:E1,definitionById:n,footnoteById:a,footnoteCounts:new Map,footnoteOrder:[],handlers:{...EY,...r.handlers},one:function(e,t){let r=e.type,n=i.handlers[r];if(EJ.call(i.handlers,r)&&n)return n(i,e,t);if(i.options.passThrough&&i.options.passThrough.includes(r)){if("children"in e){let{children:t,...r}=e,n=Ej(r);return n.children=i.all(e),n}return Ej(e)}return(i.options.unknownHandler||function(e,t){let r=t.data||{},n="value"in t&&!(EJ.call(r,"hProperties")||EJ.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)})(i,e,t)},options:r,patch:E0,wrap:E2},Eq(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?n:a,r=String(e.identifier).toUpperCase();t.has(r)||t.set(r,e)}}),i),s=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||E$,n=e.options.footnoteBackLabel||EU,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let a=e.footnoteById.get(e.footnoteOrder[l]);if(!a)continue;let i=e.all(a),o=String(a.identifier).toUpperCase(),u=EF(o.toLowerCase()),c=0,d=[],p=e.footnoteCounts.get(o);for(;void 0!==p&&++c<=p;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof r?r:r(l,c);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof n?n:n(l,c),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let f=i[i.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...d)}else i.push(...d);let m={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(i,!0)};e.patch(a,m),s.push(m)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Ej(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(o),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&(_d("children"in u),u.children.push({type:"text",value:"\n"},l)),u}function E5(e,t){return e&&"run"in e?async function(r,n){let a=E3(r,{file:n,...t});await e.run(a,n)}:function(r,n){return E3(r,{file:n,...e||t})}}function E6(e){if(e)throw e}var E9=e.i(2073);function E8(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let E7=function(e,t){let r;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');xn(e);let n=0,a=-1,i=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;i--;)if(47===e.codePointAt(i)){if(r){n=i+1;break}}else a<0&&(r=!0,a=i+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let o=-1,s=t.length-1;for(;i--;)if(47===e.codePointAt(i)){if(r){n=i+1;break}}else o<0&&(r=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(a=i):(s=-1,a=o));return n===a?a=o:a<0&&(a=e.length),e.slice(n,a)},xe=function(e){let t;if(xn(e),0===e.length)return".";let r=-1,n=e.length;for(;--n;)if(47===e.codePointAt(n)){if(t){r=n;break}}else t||(t=!0);return r<0?47===e.codePointAt(0)?"/":".":1===r&&47===e.codePointAt(0)?"//":e.slice(0,r)},xt=function(e){let t;xn(e);let r=e.length,n=-1,a=0,i=-1,o=0;for(;r--;){let s=e.codePointAt(r);if(47===s){if(t){a=r+1;break}continue}n<0&&(t=!0,n=r+1),46===s?i<0?i=r:1!==o&&(o=1):i>-1&&(o=-1)}return i<0||n<0||0===o||1===o&&i===n-1&&i===a+1?"":e.slice(i,n)},xr=function(...e){var t;let r,n,a,i=-1;for(;++i<e.length;)xn(e[i]),e[i]&&(a=void 0===a?e[i]:a+"/"+e[i]);return void 0===a?".":(xn(t=a),r=47===t.codePointAt(0),0!==(n=function(e,t){let r,n,a="",i=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)r=e.codePointAt(l);else if(47===r)break;else r=47;if(47===r){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(a.length<2||2!==i||46!==a.codePointAt(a.length-1)||46!==a.codePointAt(a.length-2)){if(a.length>2){if((n=a.lastIndexOf("/"))!==a.length-1){n<0?(a="",i=0):i=(a=a.slice(0,n)).length-1-a.lastIndexOf("/"),o=l,s=0;continue}}else if(a.length>0){a="",i=0,o=l,s=0;continue}}t&&(a=a.length>0?a+"/..":"..",i=2)}else a.length>0?a+="/"+e.slice(o+1,l):a=e.slice(o+1,l),i=l-o-1;o=l,s=0}else 46===r&&s>-1?s++:s=-1}return a}(t,!r)).length||r||(n="."),n.length>0&&47===t.codePointAt(t.length-1)&&(n+="/"),r?"/"+n:n)};function xn(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function xa(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let xi=["history","path","basename","stem","extname","dirname"];class xo{constructor(e){let t,r;t=e?xa(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<xi.length;){const e=xi[n];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(r in t)xi.includes(r)||(this[r]=t[r])}get basename(){return"string"==typeof this.path?E7(this.path):void 0}set basename(e){xl(e,"basename"),xs(e,"basename"),this.path=xr(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?xe(this.path):void 0}set dirname(e){xu(this.basename,"dirname"),this.path=xr(e||"",this.basename)}get extname(){return"string"==typeof this.path?xt(this.path):void 0}set extname(e){if(xs(e,"extname"),xu(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=xr(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){xa(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!xa(e)){let t=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("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,r=-1;for(;++r<t.length;)if(37===t.codePointAt(r)&&50===t.codePointAt(r+1)){let e=t.codePointAt(r+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),xl(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?E7(this.path,this.extname):void 0}set stem(e){xl(e,"stem"),xs(e,"stem"),this.path=xr(this.dirname||"",e+(this.extname||""))}fail(e,t,r){let n=this.message(e,t,r);throw n.fatal=!0,n}info(e,t,r){let n=this.message(e,t,r);return n.fatal=void 0,n}message(e,t,r){let n=new _6(e,t,r);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function xs(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function xl(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function xu(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let xc=function(e){let t=this.constructor.prototype,r=t[e],n=function(){return r.apply(n,arguments)};return Object.setPrototypeOf(n,t),n},xd={}.hasOwnProperty;class xp extends xc{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=function(){let e=[],t={run:function(...t){let r=-1,n=t.pop();if("function"!=typeof n)throw TypeError("Expected function as last argument, not "+n);!function a(i,...o){let s=e[++r],l=-1;if(i)return void n(i);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,s?(function(e,t){let r;return function(...t){let i,o=e.length>t.length;o&&t.push(n);try{i=e.apply(this,t)}catch(e){if(o&&r)throw e;return n(e)}o||(i&&i.then&&"function"==typeof i.then?i.then(a,n):i instanceof Error?n(i):a(i))};function n(e,...a){r||(r=!0,t(e,...a))}function a(e){n(null,e)}})(s,a)(...o):n(null,...o)}(null,...t)},use:function(r){if("function"!=typeof r)throw TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}};return t}()}copy(){let e=new xp,t=-1;for(;++t<this.attachers.length;){let r=this.attachers[t];e.use(...r)}return e.data((0,E9.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(xg("data",this.frozen),this.namespace[e]=t,this):xd.call(this.namespace,e)&&this.namespace[e]||void 0:e?(xg("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let r=e.call(this,...t);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=xv(e),r=this.parser||this.Parser;return xm("parse",r),r(String(t),t)}process(e,t){let r=this;return this.freeze(),xm("process",this.parser||this.Parser),xh("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(n,a){let i=xv(e),o=r.parse(i);function s(e,r){e||!r?a(e):n?n(r):(_d(t,"`done` is defined if `resolve` is not"),t(void 0,r))}r.run(o,i,function(e,t,n){var a,i;if(e||!t||!n)return s(e);let o=r.stringify(t,n);"string"==typeof(a=o)||(i=a)&&"object"==typeof i&&"byteLength"in i&&"byteOffset"in i?n.value=o:n.result=o,s(e,n)})}}processSync(e){let t,r=!1;return this.freeze(),xm("processSync",this.parser||this.Parser),xh("processSync",this.compiler||this.Compiler),this.process(e,function(e,n){r=!0,E6(e),t=n}),xy("processSync","process",r),_d(t,"we either bailed on an error or have a tree"),t}run(e,t,r){xb(e),this.freeze();let n=this.transformers;return r||"function"!=typeof t||(r=t,t=void 0),r?a(void 0,r):new Promise(a);function a(a,i){_d("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=xv(t);n.run(e,o,function(t,n,o){let s=n||e;t?i(t):a?a(s):(_d(r,"`done` is defined if `resolve` is not"),r(void 0,s,o))})}}runSync(e,t){let r,n=!1;return this.run(e,t,function(e,t){E6(e),r=t,n=!0}),xy("runSync","run",n),_d(r,"we either bailed on an error or have a tree"),r}stringify(e,t){this.freeze();let r=xv(t),n=this.compiler||this.Compiler;return xh("stringify",n),xb(e),n(e,r)}use(e,...t){let r=this.attachers,n=this.namespace;if(xg("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?i(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function a(e){if(!("plugins"in e)&&!("settings"in e))throw 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");i(e.plugins),e.settings&&(n.settings=(0,E9.default)(!0,n.settings,e.settings))}function i(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...r]=e;o(t,r)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let n=-1,a=-1;for(;++n<r.length;)if(r[n][0]===e){a=n;break}if(-1===a)r.push([e,...t]);else if(t.length>0){let[n,...i]=t,o=r[a][1];E8(o)&&E8(n)&&(n=(0,E9.default)(!0,o,n)),r[a]=[e,n,...i]}}}}let xf=new xp().freeze();function xm(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function xh(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function xg(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xb(e){if(!E8(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function xy(e,t,r){if(!r)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function xv(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new xo(e)}let x_=[],xw={allowDangerousHtml:!0},xE=/^(https?|ircs?|mailto|xmpp)$/i,xx=[{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:"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 xS(e){var t;let r,n,a,i,o,s=(r=(t=e).rehypePlugins||x_,n=t.remarkPlugins||x_,a=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...xw}:xw,xf().use(EN).use(n).use(E5,a).use(r)),l=(i=e.children||"",o=new xo,"string"==typeof i?o.value=i:_p("Unexpected value `"+i+"` for `children` prop, expected `string`"),o);return function(e,t){let r=t.allowedElements,n=t.allowElement,a=t.components,i=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||xk;for(let e of xx)Object.hasOwn(t,e.from)&&_p("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return r&&i&&_p("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:"root"===e.type?e.children:[e]}),Eq(e,function(e,t,a){if("raw"===e.type&&a&&"number"==typeof t)return o?a.children.splice(t,1):a.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in wc)if(Object.hasOwn(wc,t)&&Object.hasOwn(e.properties,t)){let r=e.properties[t],n=wc[t];(null===n||n.includes(e.tagName))&&(e.properties[t]=l(String(r||""),t,e))}}if("element"===e.type){let o=r?!r.includes(e.tagName):!!i&&i.includes(e.tagName);if(!o&&n&&"number"==typeof t&&(o=!n(e,t,a)),o&&a&&"number"==typeof t)return s&&e.children?a.children.splice(t,1,...e.children):a.children.splice(t,1),t}}),function(e,t){var r,n,a,i;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let s=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=s,n=t.jsxDEV,o=function(e,t,a,i){let o=Array.isArray(a.children),s=_0(e);return n(t,a,i,o,{columnNumber:s?s.column-1:void 0,fileName:r,lineNumber:s?s.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");a=t.jsx,i=t.jsxs,o=function(e,t,r,n){let o=Array.isArray(r.children)?i:a;return n?o(t,r,n):o(t,r)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?_X:_Y,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},u=wn(l,e,void 0);return u&&"string"!=typeof u?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}(e,{Fragment:J.Fragment,components:a,ignoreInvalidStyle:!0,jsx:J.jsx,jsxs:J.jsxs,passKeys:!0,passNode:!0})}(s.runSync(s.parse(l),l),e)}function xk(e){let t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),a=e.indexOf("/");return -1===t||-1!==a&&t>a||-1!==r&&t>r||-1!==n&&t>n||xE.test(e.slice(0,t))?e:""}function xT(e,t){let r=String(e);if("string"!=typeof t)throw TypeError("Expected character");let n=0,a=r.indexOf(t);for(;-1!==a;)n++,a=r.indexOf(t,a+t.length);return n}let xA="phrasing",xN=["autolink","link","image","label"];function xI(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function xC(e){this.config.enter.autolinkProtocol.call(this,e)}function xR(e){this.config.exit.autolinkProtocol.call(this,e)}function xO(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];_d("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function xL(e){this.config.exit.autolinkEmail.call(this,e)}function xP(e){this.exit(e)}function xD(e){!function(e,t,r){let n=Ez((r||{}).ignore||[]),a=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let r=!e[0]||Array.isArray(e[0])?e:[e],n=-1;for(;++n<r.length;){var a;let e=r[n];t.push(["string"==typeof(a=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(a),"g"):a,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),i=-1;for(;++i<a.length;)EV(e,"text",o);function o(e,t){let r,o=-1;for(;++o<t.length;){let e=t[o],a=r?r.children:void 0;if(n(e,a?a.indexOf(e):void 0,r))return;r=e}if(r)return function(e,t){let r=t[t.length-1],n=a[i][0],o=a[i][1],s=0,l=r.children.indexOf(e),u=!1,c=[];n.lastIndex=0;let d=n.exec(e.value);for(;d;){let r=d.index,a={index:d.index,input:d.input,stack:[...t,e]},i=o(...d,a);if("string"==typeof i&&(i=i.length>0?{type:"text",value:i}:void 0),!1===i?n.lastIndex=r+1:(s!==r&&c.push({type:"text",value:e.value.slice(s,r)}),Array.isArray(i)?c.push(...i):i&&c.push(i),s=r+d[0].length,u=!0),!n.global)break;d=n.exec(e.value)}return u?(s<e.value.length&&c.push({type:"text",value:e.value.slice(s)}),r.children.splice(l,1,...c)):c=[e],l+c.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xM],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,xj]],{ignore:["link","linkReference"]})}function xM(e,t,r,n,a){let i,o="";if(!xF(a))return!1;if(/^w/i.test(t)&&(r=t+r,t="",o="http://"),(i=r.split(".")).length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[a-zA-Z\d]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[a-zA-Z\d]/.test(i[i.length-2])))return!1;let s=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")"),a=xT(e,"("),i=xT(e,")");for(;-1!==n&&a>i;)e+=r.slice(0,n+1),n=(r=r.slice(n+1)).indexOf(")"),i++;return[e,r]}(r+n);if(!s[0])return!1;let l={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function xj(e,t,r,n){return!(!xF(n,!0)||/[-\d_]$/.test(r))&&{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function xF(e,t){let r=e.input.charCodeAt(e.index-1);return(0===e.index||wC(r)||wI(r))&&(!t||47!==r)}function x$(){this.buffer()}function xU(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function xz(){this.buffer()}function xB(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function xH(e){let t=this.resume(),r=this.stack[this.stack.length-1];_d("footnoteReference"===r.type),r.identifier=Er(this.sliceSerialize(e)).toLowerCase(),r.label=t}function xG(e){this.exit(e)}function xV(e){let t=this.resume(),r=this.stack[this.stack.length-1];_d("footnoteDefinition"===r.type),r.identifier=Er(this.sliceSerialize(e)).toLowerCase(),r.label=t}function xq(e){this.exit(e)}function xW(e,t,r,n){let a=r.createTracker(n),i=a.move("[^"),o=r.enter("footnoteReference"),s=r.enter("reference");return i+=a.move(r.safe(r.associationId(e),{after:"]",before:i})),s(),o(),i+=a.move("]")}function xZ(e,t,r){return 0===t?e:xK(e,t,r)}function xK(e,t,r){return(r?"":" ")+e}xW.peek=function(){return"["};let xY=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function xX(e){this.enter({type:"delete",children:[]},e)}function xJ(e){this.exit(e)}function xQ(e,t,r,n){let a=r.createTracker(n),i=r.enter("strikethrough"),o=a.move("~~");return o+=r.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),i(),o}function x0(e){return e.length}function x1(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}xQ.peek=function(){return"~"};function x2(e,t,r){let n=e.value||"",a="`",i=-1;for(;RegExp("(^|[^`])"+a+"([^`]|$)").test(n);)a+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++i<r.unsafe.length;){let e,t=r.unsafe[i],a=r.compilePattern(t);if(t.atBreak)for(;e=a.exec(n);){let t=e.index;10===n.charCodeAt(t)&&13===n.charCodeAt(t-1)&&t--,n=n.slice(0,t)+" "+n.slice(e.index+1)}}return a+n+a}x2.peek=function(){return"`"};Ez(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let x4=function(e,t,r,n){let a=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(r),i=r.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(r);t&&"list"===t.type&&t.ordered&&(i=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===r.options.incrementListMarker?0:t.children.indexOf(e))+i);let o=i.length+1;("tab"===a||"mixed"===a&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let s=r.createTracker(n);s.move(i+" ".repeat(o-i.length)),s.shift(o);let l=r.enter("listItem"),u=r.indentLines(r.containerFlow(e,s.current()),function(e,t,r){return t?(r?"":" ".repeat(o))+e:(r?i:i+" ".repeat(o-i.length))+e});return l(),u};function x3(e){let t=e._align;_d(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function x5(e){this.exit(e),this.data.inTable=void 0}function x6(e){this.enter({type:"tableRow",children:[]},e)}function x9(e){this.exit(e)}function x8(e){this.enter({type:"tableCell",children:[]},e)}function x7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Se));let r=this.stack[this.stack.length-1];_d("inlineCode"===r.type),r.value=t,this.exit(e)}function Se(e,t){return"|"===t?t:e}function St(e){let t=this.stack[this.stack.length-2];_d("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function Sr(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];_d("paragraph"===e.type);let r=e.children[0];if(r&&"text"===r.type){let n,a=t.children,i=-1;for(;++i<a.length;){let e=a[i];if("paragraph"===e.type){n=e;break}}n===e&&(r.value=r.value.slice(1),0===r.value.length?e.children.shift():e.position&&r.position&&"number"==typeof r.position.start.offset&&(r.position.start.column++,r.position.start.offset++,e.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Sn(e,t,r,n){let a=e.children[0],i="boolean"==typeof e.checked&&a&&"paragraph"===a.type,o="["+(e.checked?"x":" ")+"] ",s=r.createTracker(n);i&&s.move(o);let l=x4(e,t,r,{...n,...s.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let Sa={tokenize:function(e,t,r){let n=0;return function t(i){return(87===i||119===i)&&n<3?(n++,e.consume(i),t):46===i&&3===n?(e.consume(i),a):r(i)};function a(e){return null===e?r(e):t(e)}},partial:!0},Si={tokenize:function(e,t,r){let n,a,i;return o;function o(t){return 46===t||95===t?e.check(Ss,l,s)(t):null===t||wA(t)||wC(t)||45!==t&&wI(t)?l(t):(i=!0,e.consume(t),o)}function s(t){return 95===t?n=!0:(a=n,n=void 0),e.consume(t),o}function l(e){return a||n||!i?r(e):t(e)}},partial:!0},So={tokenize:function(e,t){let r=0,n=0;return a;function a(o){return 40===o?(r++,e.consume(o),a):41===o&&n<r?i(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(Ss,t,i)(o):null===o||wA(o)||wC(o)?t(o):(e.consume(o),a)}function i(t){return 41===t&&n++,e.consume(t),a}},partial:!0},Ss={tokenize:function(e,t,r){return n;function n(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),n):38===o?(e.consume(o),i):93===o?(e.consume(o),a):60===o||null===o||wA(o)||wC(o)?t(o):r(o)}function a(e){return null===e||40===e||91===e||wA(e)||wC(e)?t(e):n(e)}function i(t){return wv(t)?function t(a){return 59===a?(e.consume(a),n):wv(a)?(e.consume(a),t):r(a)}(t):r(t)}},partial:!0},Sl={tokenize:function(e,t,r){return function(t){return e.consume(t),n};function n(e){return w_(e)?r(e):t(e)}},partial:!0},Su={name:"wwwAutolink",tokenize:function(e,t,r){let n=this;return function(t){return 87!==t&&119!==t||!Sm.call(n,n.previous)||Sy(n.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Sa,e.attempt(Si,e.attempt(So,a),r),r)(t))};function a(r){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(r)}},previous:Sm},Sc={name:"protocolAutolink",tokenize:function(e,t,r){let n=this,a="",i=!1;return function(t){return(72===t||104===t)&&Sh.call(n,n.previous)&&!Sy(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(t),e.consume(t),o):r(t)};function o(t){if(wv(t)&&a.length<5)return a+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let r=a.toLowerCase();if("http"===r||"https"===r)return e.consume(t),s}return r(t)}function s(t){return 47===t?(e.consume(t),i)?l:(i=!0,s):r(t)}function l(t){return null===t||wE(t)||wA(t)||wC(t)||wI(t)?r(t):e.attempt(Si,e.attempt(So,u),r)(t)}function u(r){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(r)}},previous:Sh},Sd={name:"emailAutolink",tokenize:function(e,t,r){let n,a,i=this;return function(t){return!Sb(t)||!Sg.call(i,i.previous)||Sy(i.events)?r(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(n){return Sb(n)?(e.consume(n),t):64===n?(e.consume(n),o):r(n)}(t))};function o(t){return 46===t?e.check(Sl,l,s)(t):45===t||95===t||w_(t)?(a=!0,e.consume(t),o):l(t)}function s(t){return e.consume(t),n=!0,o}function l(o){return a&&n&&wv(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):r(o)}},previous:Sg},Sp={},Sf=48;for(;Sf<123;)Sp[Sf]=Sd,58==++Sf?Sf=65:91===Sf&&(Sf=97);function Sm(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||wA(e)}function Sh(e){return!wv(e)}function Sg(e){return!(47===e||Sb(e))}function Sb(e){return 43===e||45===e||46===e||95===e||w_(e)}function Sy(e){let t=e.length,r=!1;for(;t--;){let n=e[t][1];if(("labelLink"===n.type||"labelImage"===n.type)&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}Sp[43]=Sd,Sp[45]=Sd,Sp[46]=Sd,Sp[95]=Sd,Sp[72]=[Sd,Sc],Sp[104]=[Sd,Sc],Sp[87]=[Sd,Su],Sp[119]=[Sd,Su];let Sv={tokenize:function(e,t,r){let n=this;return wO(e,function(e){let a=n.events[n.events.length-1];return a&&"gfmFootnoteDefinitionIndent"===a[1].type&&4===a[2].sliceSerialize(a[1],!0).length?t(e):r(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function S_(e,t,r){let n,a=this,i=a.events.length,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);for(;i--;){let e=a.events[i][1];if("labelImage"===e.type){n=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(i){if(!n||!n._balanced)return r(i);let s=Er(a.sliceSerialize({start:n.end,end:a.now()}));return 94===s.codePointAt(0)&&o.includes(s.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),t(i)):r(i)}}function Sw(e,t){let r=e.length;for(;r--;)if("labelImage"===e[r][1].type&&"enter"===e[r][0]){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";let n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;let i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},s=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",a,t],["exit",a,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...s),e}function SE(e,t,r){let n,a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?r(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(o>999||93===s&&!n||null===s||91===s||wA(s))return r(s);if(93===s){e.exit("chunkString");let n=e.exit("gfmFootnoteCallString");return i.includes(Er(a.sliceSerialize(n)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(s)}return wA(s)||(n=!0),o++,e.consume(s),92===s?u:l}function u(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function Sx(e,t,r){let n,a,i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):r(t)}function u(t){if(s>999||93===t&&!a||null===t||91===t||wA(t))return r(t);if(93===t){e.exit("chunkString");let r=e.exit("gfmFootnoteDefinitionLabelString");return n=Er(i.sliceSerialize(r)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return wA(t)||(a=!0),s++,e.consume(t),92===t?c:u}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,u):u(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(n)||o.push(n),wO(e,p,"gfmFootnoteDefinitionWhitespace")):r(t)}function p(e){return t(e)}}function SS(e,t,r){return e.check(wM,t,e.attempt(Sv,t,r))}function Sk(e){e.exit("gfmFootnoteDefinition")}class ST{constructor(){this.map=[]}add(e,t,r){!function(e,t,r,n){let a=0;if(0!==r||0!==n.length){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=r,e.map[a][2].push(...n);return}a+=1}e.map.push([t,r,n])}}(this,e,t,r)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,r=[];for(;t>0;)t-=1,r.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];r.push(e.slice()),e.length=0;let n=r.pop();for(;n;){for(let t of n)e.push(t);n=r.pop()}this.map.length=0}}function SA(e,t,r){let n,a=this,i=0,o=0;return function(e){let t=a.events.length-1;for(;t>-1;){let e=a.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let n=t>-1?a.events[t][1].type:null,i="tableHead"===n||"tableRow"===n?y:s;return i===y&&a.parser.lazy[a.now().line]?r(e):i(e)};function s(t){var r;return e.enter("tableHead"),e.enter("tableRow"),124===(r=t)||(n=!0,o+=1),l(r)}function l(t){return null===t?r(t):wT(t)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):r(t):wN(t)?wO(e,l,"whitespace")(t):(o+=1,n&&(n=!1,i+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),n=!0,l):(e.enter("data"),u(t))}function u(t){return null===t||124===t||wA(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return 92===t||124===t?(e.consume(t),u):u(t)}function d(t){return(a.interrupt=!1,a.parser.lazy[a.now().line])?r(t):(e.enter("tableDelimiterRow"),n=!1,wN(t))?wO(e,p,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t)}function p(t){return 45===t||58===t?m(t):124===t?(n=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):r(t)}function f(t){return wN(t)?wO(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(o+=1,n=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),h):45===t?(o+=1,h(t)):null===t||wT(t)?b(t):r(t)}function h(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(r){return 45===r?(e.consume(r),t):58===r?(n=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(r),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(r))}(t)):r(t)}function g(t){return wN(t)?wO(e,b,"whitespace")(t):b(t)}function b(a){if(124===a)return p(a);if(null===a||wT(a))return n&&i===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(a)):r(a);return r(a)}function y(t){return e.enter("tableRow"),v(t)}function v(r){return 124===r?(e.enter("tableCellDivider"),e.consume(r),e.exit("tableCellDivider"),v):null===r||wT(r)?(e.exit("tableRow"),t(r)):wN(r)?wO(e,v,"whitespace")(r):(e.enter("data"),_(r))}function _(t){return null===t||124===t||wA(t)?(e.exit("data"),v(t)):(e.consume(t),92===t?w:_)}function w(t){return 92===t||124===t?(e.consume(t),_):_(t)}}function SN(e,t){let r,n,a,i=-1,o=!0,s=0,l=[0,0,0,0],u=[0,0,0,0],c=!1,d=0,p=new ST;for(;++i<e.length;){let f=e[i],m=f[1];"enter"===f[0]?"tableHead"===m.type?(c=!1,0!==d&&(SC(p,t,d,r,n),n=void 0,d=0),r={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(i,0,[["enter",r,t]])):"tableRow"===m.type||"tableDelimiterRow"===m.type?(o=!0,a=void 0,l=[0,0,0,0],u=[0,i+1,0,0],c&&(c=!1,n={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(i,0,[["enter",n,t]])),s="tableDelimiterRow"===m.type?2:n?3:1):s&&("data"===m.type||"tableDelimiterMarker"===m.type||"tableDelimiterFiller"===m.type)?(o=!1,0===u[2]&&(0!==l[1]&&(u[0]=u[1],a=SI(p,t,l,s,void 0,a),l=[0,0,0,0]),u[2]=i)):"tableCellDivider"===m.type&&(o?o=!1:(0!==l[1]&&(u[0]=u[1],a=SI(p,t,l,s,void 0,a)),u=[(l=u)[1],i,0,0])):"tableHead"===m.type?(c=!0,d=i):"tableRow"===m.type||"tableDelimiterRow"===m.type?(d=i,0!==l[1]?(u[0]=u[1],a=SI(p,t,l,s,i,a)):0!==u[1]&&(a=SI(p,t,u,s,i,a)),s=0):s&&("data"===m.type||"tableDelimiterMarker"===m.type||"tableDelimiterFiller"===m.type)&&(u[3]=i)}for(0!==d&&SC(p,t,d,r,n),p.consume(t.events),i=-1;++i<t.events.length;){let e=t.events[i];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let r=!1,n=[];for(;t<e.length;){let a=e[t];if(r){if("enter"===a[0])"tableContent"===a[1].type&&n.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===a[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=n.length-1;n[e]="left"===n[e]?"center":"right"}}else if("tableDelimiterRow"===a[1].type)break}else"enter"===a[0]&&"tableDelimiterRow"===a[1].type&&(r=!0);t+=1}return n}(t.events,i))}return e}function SI(e,t,r,n,a,i){0!==r[0]&&(i.end=Object.assign({},SR(t.events,r[0])),e.add(r[0],0,[["exit",i,t]]));let o=SR(t.events,r[1]);if(i={type:1===n?"tableHeader":2===n?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(r[1],0,[["enter",i,t]]),0!==r[2]){let a=SR(t.events,r[2]),i=SR(t.events,r[3]),o={type:"tableContent",start:Object.assign({},a),end:Object.assign({},i)};if(e.add(r[2],0,[["enter",o,t]]),2!==n){let n=t.events[r[2]],a=t.events[r[3]];if(n[1].end=Object.assign({},a[1].end),n[1].type="chunkText",n[1].contentType="text",r[3]>r[2]+1){let t=r[2]+1,n=r[3]-r[2]-1;e.add(t,n,[])}}e.add(r[3]+1,0,[["exit",o,t]])}return void 0!==a&&(i.end=Object.assign({},SR(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function SC(e,t,r,n,a){let i=[],o=SR(t.events,r);a&&(a.end=Object.assign({},o),i.push(["exit",a,t])),n.end=Object.assign({},o),i.push(["exit",n,t]),e.add(r+1,0,i)}function SR(e,t){let r=e[t],n="enter"===r[0]?"start":"end";return r[1][n]}let SO={name:"tasklistCheck",tokenize:function(e,t,r){let n=this;return function(t){return null===n.previous&&n._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),a):r(t)};function a(t){return wA(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),i):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),i):r(t)}function i(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):r(t)}function o(n){return wT(n)?t(n):wN(n)?e.check({tokenize:SL},t,r)(n):r(n)}}};function SL(e,t,r){return wO(e,function(e){return null===e?r(e):t(e)},"whitespace")}let SP={};function SD(e){let t,r,n,a=e||SP,i=this.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),s=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),l=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(wy([{text:Sp},{document:{91:{name:"gfmFootnoteDefinition",tokenize:Sx,continuation:{tokenize:SS},exit:Sk}},text:{91:{name:"gfmFootnoteCall",tokenize:SE},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:S_,resolveTo:Sw}}},(t=(a||{}).singleTilde,r={name:"strikethrough",tokenize:function(e,r,n){let a=this.previous,i=this.events,o=0;return function(s){return 126===a&&"characterEscape"!==i[i.length-1][1].type?n(s):(e.enter("strikethroughSequenceTemporary"),function i(s){let l=wK(a);if(126===s)return o>1?n(s):(e.consume(s),o++,i);if(o<2&&!t)return n(s);let u=e.exit("strikethroughSequenceTemporary"),c=wK(s);return u._open=!c||2===c&&!!l,u._close=!l||2===l&&!!c,r(s)}(s))}},resolveAll:function(e,t){let r=-1;for(;++r<e.length;)if("enter"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._close){let n=r;for(;n--;)if("exit"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._open&&e[r][1].end.offset-e[r][1].start.offset==e[n][1].end.offset-e[n][1].start.offset){e[r][1].type="strikethroughSequence",e[n][1].type="strikethroughSequence";let a={type:"strikethrough",start:Object.assign({},e[n][1].start),end:Object.assign({},e[r][1].end)},i={type:"strikethroughText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[r][1].start)},o=[["enter",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["enter",i,t]],s=t.parser.constructs.insideSpan.null;s&&wh(o,o.length,0,wY(s,e.slice(n+1,r),t)),wh(o,o.length,0,[["exit",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["exit",a,t]]),wh(e,n-1,r-n+3,o),r=n+o.length-2;break}}for(r=-1;++r<e.length;)"strikethroughSequenceTemporary"===e[r][1].type&&(e[r][1].type="data");return e}},null==t&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:SA,resolveAll:SN}}},{text:{91:SO}}])),s.push([{transforms:[xD],enter:{literalAutolink:xI,literalAutolinkEmail:xC,literalAutolinkHttp:xC,literalAutolinkWww:xC},exit:{literalAutolink:xP,literalAutolinkEmail:xL,literalAutolinkHttp:xR,literalAutolinkWww:xO}},{enter:{gfmFootnoteCallString:x$,gfmFootnoteCall:xU,gfmFootnoteDefinitionLabelString:xz,gfmFootnoteDefinition:xB},exit:{gfmFootnoteCallString:xH,gfmFootnoteCall:xG,gfmFootnoteDefinitionLabelString:xV,gfmFootnoteDefinition:xq}},{canContainEols:["delete"],enter:{strikethrough:xX},exit:{strikethrough:xJ}},{enter:{table:x3,tableData:x8,tableHeader:x8,tableRow:x6},exit:{codeText:x7,table:x5,tableData:x9,tableHeader:x9,tableRow:x9}},{exit:{taskListCheckValueChecked:St,taskListCheckValueUnchecked:St,paragraph:Sr}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:xA,notInConstruct:xN},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:xA,notInConstruct:xN},{character:":",before:"[ps]",after:"\\/",inConstruct:xA,notInConstruct:xN}]},(n=!1,a&&a.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:function(e,t,r,a){let i=r.createTracker(a),o=i.move("[^"),s=r.enter("footnoteDefinition"),l=r.enter("label");return o+=i.move(r.safe(r.associationId(e),{before:o,after:"]"})),l(),o+=i.move("]:"),e.children&&e.children.length>0&&(i.shift(4),o+=i.move((n?"\n":" ")+r.indentLines(r.containerFlow(e,i.current()),n?xK:xZ))),s(),o},footnoteReference:xW},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xY}],handlers:{delete:xQ}},function(e){let t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,a=t.stringLength,i=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,r){let n=x2(e,t,r);return r.stack.includes("tableCell")&&(n=n.replace(/\|/g,"\\$&")),n},table:function(e,t,r,n){return s(function(e,t,r){let n=e.children,a=-1,i=[],o=t.enter("table");for(;++a<n.length;)i[a]=l(n[a],t,r);return o(),i}(e,r,n),e.align)},tableCell:o,tableRow:function(e,t,r,n){let a=s([l(e,r,n)]);return a.slice(0,a.indexOf("\n"))}}};function o(e,t,r,n){let a=r.enter("tableCell"),o=r.enter("phrasing"),s=r.containerPhrasing(e,{...n,before:i,after:i});return o(),a(),s}function s(e,t){return function(e,t){let r=t||{},n=(r.align||[]).concat(),a=r.stringLength||x0,i=[],o=[],s=[],l=[],u=0,c=-1;for(;++c<e.length;){let t=[],n=[],i=-1;for(e[c].length>u&&(u=e[c].length);++i<e[c].length;){var d;let o=null==(d=e[c][i])?"":String(d);if(!1!==r.alignDelimiters){let e=a(o);n[i]=e,(void 0===l[i]||e>l[i])&&(l[i]=e)}t.push(o)}o[c]=t,s[c]=n}let p=-1;if("object"==typeof n&&"length"in n)for(;++p<u;)i[p]=x1(n[p]);else{let e=x1(n);for(;++p<u;)i[p]=e}p=-1;let f=[],m=[];for(;++p<u;){let e=i[p],t="",n="";99===e?(t=":",n=":"):108===e?t=":":114===e&&(n=":");let a=!1===r.alignDelimiters?1:Math.max(1,l[p]-t.length-n.length),o=t+"-".repeat(a)+n;!1!==r.alignDelimiters&&((a=t.length+a+n.length)>l[p]&&(l[p]=a),m[p]=a),f[p]=o}o.splice(1,0,f),s.splice(1,0,m),c=-1;let h=[];for(;++c<o.length;){let e=o[c],t=s[c];p=-1;let n=[];for(;++p<u;){let a=e[p]||"",o="",s="";if(!1!==r.alignDelimiters){let e=l[p]-(t[p]||0),r=i[p];114===r?o=" ".repeat(e):99===r?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):s=o=" ".repeat(e/2):s=" ".repeat(e)}!1===r.delimiterStart||p||n.push("|"),!1!==r.padding&&(!1!==r.alignDelimiters||""!==a)&&(!1!==r.delimiterStart||p)&&n.push(" "),!1!==r.alignDelimiters&&n.push(o),n.push(a),!1!==r.alignDelimiters&&n.push(s),!1!==r.padding&&n.push(" "),(!1!==r.delimiterEnd||p!==u-1)&&n.push("|")}h.push(!1===r.delimiterEnd?n.join("").replace(/ +$/,""):n.join(""))}return h.join("\n")}(e,{align:t,alignDelimiters:n,padding:r,stringLength:a})}function l(e,t,r){let n=e.children,a=-1,i=[],s=t.enter("tableRow");for(;++a<n.length;)i[a]=o(n[a],e,t,r);return s(),i}}(a),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Sn}}]})}function SM(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Sj(e){return function(e){if(Array.isArray(e))return SM(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return SM(e,void 0);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?SM(e,void 0):void 0}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function SF(e){return(SF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S$(e,t,r){var n;return(n=function(e,t){if("object"!=SF(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=SF(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==SF(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SU(){return(SU=Object.assign.bind()).apply(null,arguments)}function Sz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function SB(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sz(Object(r),!0).forEach(function(t){S$(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sz(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var SH={},SG=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function SV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Sq(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SV(Object(r),!0).forEach(function(t){S$(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SV(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var SW=/\n/g;function SZ(e){var t,r,n,a,i=e.codeString,o=e.codeStyle,s=e.containerStyle,l=e.numberStyle,u=e.startingLineNumber;return Q.default.createElement("code",{style:Object.assign({},o,void 0===s?{float:"left",paddingRight:"10px"}:s)},(r=(t={lines:i.replace(/\n$/,"").split("\n"),style:void 0===l?{}:l,startingLineNumber:u}).lines,n=t.startingLineNumber,a=t.style,r.map(function(e,t){var r=t+n;return Q.default.createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"==typeof a?a(r):a},"".concat(r,"\n"))})))}function SK(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function SY(e,t,r){var n={display:"inline-block",minWidth:"".concat(r.toString().length,".25em"),paddingRight:"1em",textAlign:"right",userSelect:"none"},a="function"==typeof e?e(t):e;return Sq(Sq({},n),a)}function SX(e){var t=e.children,r=e.lineNumber,n=e.lineNumberStyle,a=e.largestLineNumber,i=e.showInlineLineNumbers,o=e.lineProps,s=void 0===o?{}:o,l=e.className,u=void 0===l?[]:l,c=e.showLineNumbers,d=e.wrapLongLines,p=e.wrapLines,f=void 0!==p&&p?Sq({},"function"==typeof s?s(r):s):{};if(f.className=f.className?[].concat(Sj(f.className.trim().split(/\s+/)),Sj(u)):u,r&&i){var m=SY(n,r,a);t.unshift(SK(r,m))}return d&c&&(f.style=Sq({display:"flex"},f.style)),{type:"element",tagName:"span",properties:f,children:t}}function SJ(e){var t=e.rows,r=e.stylesheet,n=e.useInlineStyles;return t.map(function(e,t){return function e(t){var r=t.node,n=t.stylesheet,a=t.style,i=t.useInlineStyles,o=t.key,s=r.properties,l=r.type,u=r.tagName,c=r.value;if("text"===l)return c;if(u){var d,p,f=(d=0,function(t){return d+=1,t.map(function(t,r){return e({node:t,stylesheet:n,useInlineStyles:i,key:"code-segment-".concat(d,"-").concat(r)})})});if(i){var m=Object.keys(n).reduce(function(e,t){return t.split(".").forEach(function(t){e.includes(t)||e.push(t)}),e},[]),h=s.className&&s.className.includes("token")?["token"]:[],g=s.className&&h.concat(s.className.filter(function(e){return!m.includes(e)}));p=SB(SB({},s),{},{className:g.join(" ")||void 0,style:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return(function(e){if(0===e.length||1===e.length)return e;var t,r=e.join(".");return SH[r]||(SH[r]=0===(t=e.length)||1===t?e:2===t?[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])]:3===t?[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])]:t>=4?[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]:void 0),SH[r]})(e.filter(function(e){return"token"!==e})).reduce(function(e,t){return SB(SB({},e),r[t])},t)}(s.className,Object.assign({},s.style,void 0===a?{}:a),n)})}else p=SB(SB({},s),{},{className:s.className.join(" ")});var b=f(r.children);return Q.default.createElement(u,SU({key:o},p),b)}}({node:e,stylesheet:r,useInlineStyles:n,key:"code-segment-".concat(t)})})}function SQ(e){return e&&void 0!==e.highlightAuto}var S0=($=e.i(16907).default,U={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},namespace:{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},function(e){var t,r,n=e.language,a=e.children,i=e.style,o=void 0===i?U:i,s=e.customStyle,l=void 0===s?{}:s,u=e.codeTagProps,c=void 0===u?{className:n?"language-".concat(n):void 0,style:Sq(Sq({},o['code[class*="language-"]']),o['code[class*="language-'.concat(n,'"]')])}:u,d=e.useInlineStyles,p=void 0===d||d,f=e.showLineNumbers,m=void 0!==f&&f,h=e.showInlineLineNumbers,g=void 0===h||h,b=e.startingLineNumber,y=void 0===b?1:b,v=e.lineNumberContainerStyle,_=e.lineNumberStyle,w=void 0===_?{}:_,E=e.wrapLines,x=e.wrapLongLines,S=void 0!==x&&x,k=e.lineProps,T=e.renderer,A=e.PreTag,N=void 0===A?"pre":A,I=e.CodeTag,C=void 0===I?"code":I,R=e.code,O=void 0===R?(Array.isArray(a)?a[0]:a)||"":R,L=e.astGenerator,P=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(e,SG);L=L||$;var D=m?Q.default.createElement(SZ,{containerStyle:v,codeStyle:c.style||{},numberStyle:w,startingLineNumber:y,codeString:O}):null,M=o.hljs||o['pre[class*="language-"]']||{backgroundColor:"#fff"},j=SQ(L)?"hljs":"prismjs",F=p?Object.assign({},P,{style:Object.assign({},M,l)}):Object.assign({},P,{className:P.className?"".concat(j," ").concat(P.className):j,style:Object.assign({},l)});if(S?c.style=Sq({whiteSpace:"pre-wrap"},c.style):c.style=Sq({whiteSpace:"pre"},c.style),!L)return Q.default.createElement(N,F,D,Q.default.createElement(C,c,O));(void 0===E&&T||S)&&(E=!0),T=T||SJ;var z=[{type:"text",value:O}],B=function(e){var t=e.astGenerator,r=e.language,n=e.code,a=e.defaultCodeValue;if(SQ(t)){var i=-1!==t.listLanguages().indexOf(r);return"text"===r?{value:a,language:"text"}:i?t.highlight(r,n):t.highlightAuto(n)}try{return r&&"text"!==r?{value:t.highlight(n,r)}:{value:a}}catch(e){return{value:a}}}({astGenerator:L,language:n,code:O,defaultCodeValue:z});null===B.language&&(B.value=z);var H=y+(null!=(t=null==(r=O.match(/\n/g))?void 0:r.length)?t:0),G=function(e,t,r,n,a,i,o,s,l){var u,c=function e(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=0;a<t.length;a++){var i=t[a];if("text"===i.type)n.push(SX({children:[i],className:Sj(new Set(r))}));else if(i.children){var o=r.concat(i.properties.className);e(i.children,o).forEach(function(e){return n.push(e)})}}return n}(e.value),d=[],p=-1,f=0;function m(e,i){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t||u.length>0?function(e,i){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return SX({children:e,lineNumber:i,lineNumberStyle:s,largestLineNumber:o,showInlineLineNumbers:a,lineProps:r,className:u,showLineNumbers:n,wrapLongLines:l,wrapLines:t})}(e,i,u):function(e,t){if(n&&t&&a){var r=SY(s,t,o);e.unshift(SK(t,r))}return e}(e,i)}for(;f<c.length;)!function(){var e=c[f],t=e.children[0].value;if(t.match(SW)){var r=t.split("\n");r.forEach(function(t,a){var o=n&&d.length+i,s={type:"text",value:"".concat(t,"\n")};if(0===a){var l=m(c.slice(p+1,f).concat(SX({children:[s],className:e.properties.className})),o);d.push(l)}else if(a===r.length-1){var u=c[f+1]&&c[f+1].children&&c[f+1].children[0],h={type:"text",value:"".concat(t)};if(u){var g=SX({children:[h],className:e.properties.className});c.splice(f+1,0,g)}else{var b=m([h],o,e.properties.className);d.push(b)}}else{var y=m([s],o,e.properties.className);d.push(y)}}),p=f}f++}();if(p!==c.length-1){var h=c.slice(p+1,c.length);if(h&&h.length){var g=m(h,n&&d.length+i);d.push(g)}}return t?d:(u=[]).concat.apply(u,d)}(B,E,void 0===k?{}:k,m,g,y,H,w,S);return Q.default.createElement(N,F,Q.default.createElement(C,c,!g&&D,T({rows:G,stylesheet:o,useInlineStyles:p})))});S0.supportedLanguages=["abap","abnf","actionscript","ada","agda","al","antlr4","apacheconf","apex","apl","applescript","aql","arduino","arff","asciidoc","asm6502","asmatmel","aspnet","autohotkey","autoit","avisynth","avro-idl","bash","basic","batch","bbcode","bicep","birb","bison","bnf","brainfuck","brightscript","bro","bsl","c","cfscript","chaiscript","cil","clike","clojure","cmake","cobol","coffeescript","concurnas","coq","cpp","crystal","csharp","cshtml","csp","css-extras","css","csv","cypher","d","dart","dataweave","dax","dhall","diff","django","dns-zone-file","docker","dot","ebnf","editorconfig","eiffel","ejs","elixir","elm","erb","erlang","etlua","excel-formula","factor","false","firestore-security-rules","flow","fortran","fsharp","ftl","gap","gcode","gdscript","gedcom","gherkin","git","glsl","gml","gn","go-module","go","graphql","groovy","haml","handlebars","haskell","haxe","hcl","hlsl","hoon","hpkp","hsts","http","ichigojam","icon","icu-message-format","idris","iecst","ignore","inform7","ini","io","j","java","javadoc","javadoclike","javascript","javastacktrace","jexl","jolie","jq","js-extras","js-templates","jsdoc","json","json5","jsonp","jsstacktrace","jsx","julia","keepalived","keyman","kotlin","kumir","kusto","latex","latte","less","lilypond","liquid","lisp","livescript","llvm","log","lolcode","lua","magma","makefile","markdown","markup-templating","markup","matlab","maxscript","mel","mermaid","mizar","mongodb","monkey","moonscript","n1ql","n4js","nand2tetris-hdl","naniscript","nasm","neon","nevod","nginx","nim","nix","nsis","objectivec","ocaml","opencl","openqasm","oz","parigp","parser","pascal","pascaligo","pcaxis","peoplecode","perl","php-extras","php","phpdoc","plsql","powerquery","powershell","processing","prolog","promql","properties","protobuf","psl","pug","puppet","pure","purebasic","purescript","python","q","qml","qore","qsharp","r","racket","reason","regex","rego","renpy","rest","rip","roboconf","robotframework","ruby","rust","sas","sass","scala","scheme","scss","shell-session","smali","smalltalk","smarty","sml","solidity","solution-file","soy","sparql","splunk-spl","sqf","sql","squirrel","stan","stylus","swift","systemd","t4-cs","t4-templating","t4-vb","tap","tcl","textile","toml","tremor","tsx","tt2","turtle","twig","typescript","typoscript","unrealscript","uorazor","uri","v","vala","vbnet","velocity","verilog","vhdl","vim","visual-basic","warpscript","wasm","web-idl","wiki","wolfram","wren","xeora","xml-doc","xojo","xquery","yaml","yang","zig"];let S1={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}},S2=Q.default.memo(({content:e,className:t=""})=>(0,J.jsx)("div",{className:rZ("prose min-w-0 max-w-full overflow-hidden break-words text-sm leading-relaxed text-inherit [&_h1:first-child]:mt-0 [&_h1]:mb-4 [&_h1]:mt-6 [&_h1]:font-semibold [&_h2:first-child]:mt-0 [&_h2]:mb-4 [&_h2]:mt-6 [&_h2]:font-semibold [&_h3:first-child]:mt-0 [&_h3]:mb-4 [&_h3]:mt-6 [&_h3]:font-semibold [&_h4:first-child]:mt-0 [&_h4]:mb-4 [&_h4]:mt-6 [&_h4]:font-semibold [&_h5:first-child]:mt-0 [&_h5]:mb-4 [&_h5]:mt-6 [&_h5]:font-semibold [&_h6:first-child]:mt-0 [&_h6]:mb-4 [&_h6]:mt-6 [&_h6]:font-semibold [&_p:last-child]:mb-0 [&_p]:mb-4",t),children:(0,J.jsx)(xS,{remarkPlugins:[SD],components:{code({inline:e,className:t,children:r,...n}){let a=/language-(\w+)/.exec(t||"");return!e&&a?(0,J.jsx)(S0,{style:S1,language:a[1],PreTag:"div",className:"max-w-full rounded-md text-sm",wrapLines:!0,wrapLongLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},customStyle:{margin:0,maxWidth:"100%",overflowX:"auto",fontSize:"0.875rem"},children:String(r).replace(/\n$/,"")}):(0,J.jsx)("code",{className:"bg-surface rounded-sm px-1 py-0.5 font-mono text-[0.9em]",...n,children:r})},pre:({children:e})=>(0,J.jsx)("div",{className:"my-4 max-w-full overflow-hidden last:mb-0",children:e}),a:({href:e,children:t})=>(0,J.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-primary no-underline hover:underline",children:t}),blockquote:({children:e})=>(0,J.jsx)("blockquote",{className:"my-4 border-l-4 border-border pl-4 italic text-[var(--color-text-tertiary)]",children:e}),ul:({children:e})=>(0,J.jsx)("ul",{className:"my-4 pl-6 [&>li:last-child]:mb-0 [&>li]:mb-1",children:e}),ol:({children:e})=>(0,J.jsx)("ol",{className:"my-4 pl-6 [&>li:last-child]:mb-0 [&>li]:mb-1",children:e}),table:({children:e})=>(0,J.jsx)("div",{className:"my-4 overflow-x-auto",children:(0,J.jsx)("table",{className:"[&_th]:bg-surface w-full border-collapse [&_td]:border [&_td]:border-border [&_td]:p-2 [&_th]:border [&_th]:border-border [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold",children:e})})},children:e})}));function S4({steps:e,hideFinalText:t,compact:r=!1}){let n=new Map;for(let t of e)"tool_result"===t.kind&&t.toolCallId&&n.set(t.toolCallId,t.text);let a=-1;if(t){for(let t=e.length-1;t>=0;t--)if("text"===e[t].kind){a=t;break}}return(0,J.jsx)("div",{className:rZ("flex flex-col gap-1",r&&"gap-0.5"),children:e.map((e,t)=>{if(t===a)return null;if("tool_call"===e.kind){let a={id:e.id,name:e.name,args:e.args,result:n.get(e.id),status:n.has(e.id)?"completed":"pending"};return(0,J.jsx)(_c,{toolCall:a,compact:r},e.id||`tc-${t}`)}return"text"===e.kind?(0,J.jsx)("div",{className:rZ("px-2 text-sm",r&&"px-1 text-xs"),children:(0,J.jsx)(S2,{content:e.text,className:r?"text-xs leading-5 [&_blockquote]:my-2 [&_blockquote]:pl-2 [&_h1]:mb-2 [&_h1]:mt-3 [&_h1]:text-base [&_h2]:mb-2 [&_h2]:mt-3 [&_h2]:text-base [&_h3]:mb-1.5 [&_h3]:mt-3 [&_h3]:text-sm [&_h4]:mb-1.5 [&_h4]:mt-3 [&_h4]:text-sm [&_ol]:my-2 [&_ol]:pl-5 [&_p]:mb-2 [&_table]:text-[11px] [&_td]:p-1.5 [&_th]:p-1.5 [&_ul]:my-2 [&_ul]:pl-5":void 0})},`txt-${t}`):null})})}function S3(e){switch(e){case"running":case"pending":case"busy":return"running";case"success":return"success";case"error":case"timeout":return"error";case"cancelled":case"interrupted":return"cancelled";default:return"unknown"}}S2.displayName="MarkdownContent";let S5={"writing-agent":"Writing agent","data-analysis-agent":"Data analysis agent"},S6="[Async tasks update]";function S9(e){return`${e.task_id}:${e.run_id||"legacy"}`}function S8(e){let t=e.trim().split(/\r?\n/);if(t[0]!==S6||!t[1])return null;try{let e=JSON.parse(t[1]);if("string"!=typeof e.task_id||!e.task_id)return null;return{taskId:e.task_id,runId:"string"==typeof e.run_id&&e.run_id?e.run_id:void 0}}catch{return null}}function S7(e,t){let r=S8(e);return!!r&&r.taskId===t.task_id&&(!r.runId||r.runId===t.run_id)}function ke(e){let t=e.liveStatus||e.status||"success";return[S6,JSON.stringify({agent:e.agent_name,kind:"agent",...e.run_id?{run_id:e.run_id}:{},status:t,task_id:e.task_id}),"(Signal only — fetch full result via check_async_task (sub-agents) if relevant to the current step, else acknowledge & continue.)"].join("\n")}let kt={running:{dot:"bg-[var(--color-warning)]",label:"Running",pulse:!0},success:{dot:"bg-[var(--color-success)]",label:"Done",pulse:!1},error:{dot:"bg-[var(--color-error)]",label:"Error",pulse:!1},cancelled:{dot:"bg-muted-foreground",label:"Cancelled",pulse:!1},unknown:{dot:"bg-muted-foreground",label:"Unknown",pulse:!1}};function kr(e){let t=S3(e);return"success"===t||"error"===t||"cancelled"===t}function kn(e){return e.filter(e=>"running"===S3(e.liveStatus??e.status)).length}let ka=ro("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),ki=ro("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),ko=ro("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),ks=ro("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);async function kl(e){try{if("u">typeof navigator&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{if("u"<typeof document)return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}finally{t.remove()}}catch{return!1}}let ku=Q.default.memo(({message:e,toolCalls:t,isLoading:r,actionRequests:n,submittedActionRequestKeys:a,onActionRequestSubmitted:i,reviewConfigsMap:o,ui:s,stream:l,onResumeInterrupt:u,graphId:c,onEditMessage:d,autoApprove:p,subAgentSteps:f})=>{let m="human"===e.type,h=vB(e),g=h&&""!==h.trim(),b=t.length>0,y=(0,Q.useMemo)(()=>{let t=e.additional_kwargs?.reasoning_content;return"string"==typeof t&&t.trim()?t.trim():null},[e.additional_kwargs]),v=(0,Q.useMemo)(()=>t.filter(e=>"task"===e.name&&e.args.subagent_type&&""!==e.args.subagent_type&&null!==e.args.subagent_type).map(e=>{let t=e.args.subagent_type;return{id:e.id,name:e.name,subAgentName:t,input:e.args,output:e.result?{result:e.result}:void 0,status:e.status}}),[t]),_=(0,Q.useMemo)(()=>{let e=new Map;if(!n||0===n.length)return e;let r=new Map;n.forEach((e,t)=>{let n=r.get(e.name),a={actionRequest:e,actionIndex:t};n?n.push(a):r.set(e.name,[a])});let a=new Map;for(let n of t){let t=r.get(n.name);if(!t)continue;let i=a.get(n.name)??0;i<t.length&&(e.set(n.id,t[i]),a.set(n.name,i+1))}return e},[n,t]),w=(0,Q.useMemo)(()=>JSON.stringify((n??[]).map(e=>({name:e.name,args:e.args}))),[n]),E=(0,Q.useRef)({});(0,Q.useEffect)(()=>{E.current={}},[w]);let x=(0,Q.useCallback)((e,t)=>{let r=t?.decisions;if(!Array.isArray(r)||!n?.length||1===n.length||r.length===n.length)return void u?.(t);let a=r[0],i={...E.current,[e]:a};E.current=i,n.every((e,t)=>i[t])&&(E.current={},u?.({decisions:n.map((e,t)=>i[t])}))},[n,u]),[S,k]=(0,Q.useState)(!1),[T,A]=(0,Q.useState)(!1),N=(0,Q.useCallback)(async()=>{h&&(await kl(h)?(A(!0),setTimeout(()=>A(!1),2e3)):u_.toast.error("Couldn't copy to clipboard."))},[h]),[I,C]=(0,Q.useState)({}),R=(0,Q.useCallback)(e=>I[e]??!1,[I]),O=(0,Q.useCallback)(e=>{C(t=>({...t,[e]:!t[e]}))},[]);return m&&null!==S8(h)?(0,J.jsx)("div",{className:"flex w-full justify-center py-1.5",children:(0,J.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-3 py-1 text-xs text-muted-foreground",children:[(0,J.jsx)(ka,{className:"size-3 text-[var(--brand)]","aria-hidden":"true"}),"Background agent reported back"]})}):(0,J.jsx)("div",{className:rZ("group flex w-full max-w-full overflow-x-hidden",m&&"flex-row-reverse"),children:(0,J.jsxs)("div",{className:rZ("min-w-0 max-w-full",m?"max-w-[70%]":"w-full"),children:[!m&&y&&(0,J.jsxs)("div",{className:"mt-4",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>k(e=>!e),"aria-expanded":S,className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground",children:[(0,J.jsx)(ko,{className:rZ("h-3.5 w-3.5 transition-transform",S&&"rotate-90"),"aria-hidden":"true"}),(0,J.jsx)(ki,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Thinking"]}),S&&(0,J.jsx)("div",{className:"mt-2 whitespace-pre-wrap break-words border-l-2 border-border pl-3 text-sm leading-relaxed text-muted-foreground",children:y})]}),g&&(0,J.jsx)("div",{className:rZ("relative flex items-end gap-0"),children:(0,J.jsx)("div",{className:rZ("mt-4 overflow-hidden break-words text-sm font-normal leading-[150%]",m?"rounded-xl rounded-br-none border border-border px-3 py-2 text-foreground":"text-primary"),style:m?{backgroundColor:"var(--color-user-message-bg)"}:void 0,children:m?(0,J.jsx)("p",{className:"m-0 whitespace-pre-wrap break-words text-sm leading-relaxed",children:h}):g?(0,J.jsx)(S2,{content:h}):null})}),!m&&g&&(0,J.jsx)("div",{className:"mt-1",children:(0,J.jsx)("button",{type:"button",onClick:N,"aria-label":T?"Copied":"Copy message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:T?(0,J.jsx)(ln,{className:"h-4 w-4","aria-hidden":"true"}):(0,J.jsx)(ks,{className:"h-4 w-4","aria-hidden":"true"})})}),m&&g&&(0,J.jsxs)("div",{className:"mt-1 flex justify-end gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100",children:[(0,J.jsx)("button",{type:"button",onClick:N,"aria-label":T?"Copied":"Copy message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:T?(0,J.jsx)(ln,{className:"h-4 w-4","aria-hidden":"true"}):(0,J.jsx)(ks,{className:"h-4 w-4","aria-hidden":"true"})}),(0,J.jsx)("button",{type:"button",onClick:()=>d?.(h),"aria-label":"Edit message",className:"inline-flex items-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:(0,J.jsx)(a4,{className:"h-4 w-4","aria-hidden":"true"})})]}),b&&(0,J.jsx)("div",{className:"mt-4 flex w-full flex-col",children:t.map(e=>{if("task"===e.name)return null;let t=s?.find(t=>t.metadata?.tool_call_id===e.id),n=_.get(e.id),d=n?.actionRequest,f=n?e.id:void 0,m=o?.get(e.name);return(0,J.jsx)(_c,{toolCall:e,uiComponent:t,stream:l,graphId:c,actionRequest:d,actionRequestKey:f,actionRequestSubmitted:f?a?.has(f):void 0,onActionRequestSubmitted:i,reviewConfig:m,onResume:n?e=>x(n.actionIndex,e):u,isLoading:r,autoApprove:p},e.id)})}),!m&&v.length>0&&(0,J.jsx)("div",{className:"flex w-fit max-w-full flex-col gap-4",children:v.map(e=>(0,J.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,J.jsx)("div",{className:"flex items-end gap-2",children:(0,J.jsx)("div",{className:"w-[calc(100%-100px)]",children:(0,J.jsx)(v9,{subAgent:e,onClick:()=>O(e.id),isExpanded:R(e.id)})})}),R(e.id)&&(0,J.jsx)("div",{className:"w-full max-w-full",children:(0,J.jsxs)("div",{className:"bg-surface border-border-light rounded-md border p-4",children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Input"}),(0,J.jsx)("div",{className:"mb-4",children:(0,J.jsx)(S2,{content:vH(e.input)})}),(f?.[e.id]?.length??0)>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Steps"}),(0,J.jsx)("div",{className:"mb-4",children:(0,J.jsx)(S4,{steps:f[e.id],hideFinalText:!!e.output})})]}),e.output&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-[var(--color-text-secondary)]",children:"Output"}),(0,J.jsx)(S2,{content:vH(e.output)})]})]})})]},e.id))})]})})});ku.displayName="ChatMessage";let kc=ro("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),kd=Q.default.memo(({content:e,summarizedCount:t})=>{let[r,n]=(0,Q.useState)(!1),a=function(e){if(!e)return"";let t=e.match(/<summary>\s*([\s\S]*?)\s*<\/summary>/);if(t)return t[1].trim();let r=e.match(/Here is a summary of the conversation to date:\s*([\s\S]*)$/);return r?r[1].trim():e.trim()}(e);return(0,J.jsxs)("div",{className:"my-3 w-full",children:[(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[(0,J.jsx)("div",{className:"h-px flex-1 bg-border"}),(0,J.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),"aria-expanded":r,className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-3 py-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:[(0,J.jsx)(kc,{className:"size-3.5 text-[var(--brand)]","aria-hidden":"true"}),"Conversation compacted","number"==typeof t&&t>0&&(0,J.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",t," earlier"," ",1===t?"message":"messages"," summarized"]}),(0,J.jsx)(ko,{className:rZ("size-3.5 transition-transform",r&&"rotate-90"),"aria-hidden":"true"})]}),(0,J.jsx)("div",{className:"h-px flex-1 bg-border"})]}),r&&(0,J.jsx)("div",{className:"mt-2 overflow-hidden rounded-md border border-border bg-muted/20 px-4 py-3",children:(0,J.jsx)(S2,{content:a})})]})});kd.displayName="CompactionSummary";let kp=ro("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),kf="__other__";function km({questions:e,onSubmit:t,onCancel:r,isLoading:n}){let[a,i]=(0,Q.useState)(()=>e.map(()=>"")),[o,s]=(0,Q.useState)(()=>e.map(()=>null)),l=(e,t)=>i(r=>r.map((r,n)=>n===e?t:r)),u=(e,t)=>s(r=>r.map((r,n)=>n===e?t:r)),c=e=>"text"===e.type&&!1===e.required,d=e.every((e,t)=>c(e)||""!==a[t].trim());return(0,J.jsxs)("div",{className:"w-full rounded-lg border border-border bg-muted/30 p-4",children:[(0,J.jsxs)("div",{className:"mb-3 flex items-center gap-2 text-foreground",children:[(0,J.jsx)(kp,{size:16,className:"text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"EvoScientist Needs Your Input"})]}),(0,J.jsx)("div",{className:"space-y-5",children:e.map((e,t)=>(0,J.jsxs)("div",{children:[(0,J.jsxs)("p",{className:"mb-2 text-sm font-medium text-foreground",children:[e.question,!c(e)&&(0,J.jsx)("span",{className:"ml-1 text-destructive",children:"*"})]}),"multiple_choice"===e.type?(0,J.jsxs)("div",{className:"flex flex-col gap-2",children:[e.choices?.map(e=>{let r=o[t]===e.value;return(0,J.jsx)("button",{type:"button",disabled:n,onClick:()=>{u(t,e.value),l(t,e.value)},className:rZ("rounded-md border px-3 py-2 text-left text-sm transition-colors",r?"border-[var(--brand-solid)] bg-[var(--brand-solid)] text-[var(--brand-foreground)]":"border-border bg-background hover:bg-accent"),children:e.value},e.value)}),(0,J.jsx)("button",{type:"button",disabled:n,onClick:()=>{u(t,kf),l(t,"")},className:rZ("rounded-md border px-3 py-2 text-left text-sm transition-colors",o[t]===kf?"border-[var(--brand)] text-foreground":"border-border bg-background hover:bg-accent"),children:"Other…"}),o[t]===kf&&(0,J.jsx)(_l,{value:a[t],onChange:e=>l(t,e.target.value),placeholder:"Type your answer…",className:"text-sm",rows:2,disabled:n})]}):(0,J.jsx)(_l,{value:a[t],onChange:e=>l(t,e.target.value),placeholder:c(e)?"Type your answer… (optional)":"Type your answer…",className:"text-sm",rows:2,disabled:n})]},t))}),(0,J.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,J.jsx)(na,{variant:"outline",size:"sm",onClick:r,disabled:n,children:"Cancel"}),(0,J.jsx)(na,{size:"sm",onClick:()=>t(a),disabled:!d||n,className:"bg-[var(--brand-solid)] text-[var(--brand-foreground)] hover:opacity-90",children:n?"Submitting…":"Submit"})]})]})}let kh="evoscientist-auto-approve",kg="__new__";function kb(){try{let e=localStorage.getItem(kh);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function ky(e){try{localStorage.setItem(kh,JSON.stringify(e))}catch{}}function kv(e){return!0===kb()[e??kg]}function k_(e,t){let r=kb(),n=e??kg;t?r[n]=!0:delete r[n],ky(r)}function kw(e,t){let r=t?.enabled??!0,n=t?.intervalMs??3e3,a=nj(),[i,o]=(0,Q.useState)([]),[s,l]=(0,Q.useState)(!1),[u,c]=(0,Q.useState)(null),d=(0,Q.useRef)(0),p=(0,Q.useRef)(!0),f=(0,Q.useCallback)(async()=>{if(!r||!e){o([]),l(!0);return}let t=++d.current;try{let r=await a.threads.getState(e),n=function(e){if(!e||"object"!=typeof e)return[];let t=[];for(let r of Object.values(e))r&&"object"==typeof r&&"string"==typeof r.task_id&&"string"==typeof r.agent_name&&t.push({task_id:r.task_id,agent_name:r.agent_name,thread_id:"string"==typeof r.thread_id?r.thread_id:r.task_id,run_id:"string"==typeof r.run_id?r.run_id:"",status:"string"==typeof r.status?r.status:"",created_at:"string"==typeof r.created_at?r.created_at:void 0,last_updated_at:"string"==typeof r.last_updated_at?r.last_updated_at:void 0});return t.sort((e,t)=>(t.created_at??"").localeCompare(e.created_at??"")),t}(r.values?.async_tasks),i=await Promise.all(n.map(async e=>{if(!e.run_id)return{...e,liveStatus:e.status,startedAt:e.created_at};try{let t=await a.runs.get(e.thread_id,e.run_id),r=t.status??e.status;return{...e,liveStatus:r,startedAt:t.created_at??e.created_at,endedAt:kr(r)?t.updated_at??e.last_updated_at:void 0}}catch{return{...e,liveStatus:e.status,startedAt:e.created_at}}}));if(t!==d.current||!p.current)return;o(i),c(null)}catch{t===d.current&&p.current&&c("Couldn't load background agents.")}finally{t===d.current&&p.current&&l(!0)}},[a,e,r]);return(0,Q.useEffect)(()=>{if(p.current=!0,!r)return o([]),l(!0),()=>{p.current=!1};l(!1),f();let e=setInterval(()=>{document.hidden||f()},n);return()=>{p.current=!1,clearInterval(e)}},[f,r,n]),{tasks:i,loaded:s,error:u,refresh:f}}let kE="evoscientist-auto-notify",kx="evoscientist-auto-notify-reported",kS="evo-auto-notify-change";function kk(){try{let e=localStorage.getItem(kE);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function kT(){try{let e=localStorage.getItem(kx);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return{}}function kA(e){try{localStorage.setItem(kx,JSON.stringify(e))}catch{}}function kN(e){return!!e&&!1!==kk()[e]}function kI(e,t){if(!e)return;let r=kT(),n=r[e];r[e]={initialized:!0,keys:Array.from(new Set([...n?.keys??[],...t]))},kA(r)}function kC(e,t){if(!e)return;let r=kT(),n=r[e];r[e]={initialized:n?.initialized??!0,keys:Array.from(new Set([...n?.keys??[],t]))},kA(r)}function kR(e){let[t,r]=(0,Q.useState)(()=>kN(e));return(0,Q.useEffect)(()=>{let t=()=>r(kN(e));return t(),window.addEventListener(kS,t),window.addEventListener("storage",t),()=>{window.removeEventListener(kS,t),window.removeEventListener("storage",t)}},[e]),[t,(0,Q.useCallback)(t=>(function(e,t){if(!e)return;let r=kk();t?delete r[e]:r[e]=!1;try{localStorage.setItem(kE,JSON.stringify(r))}catch{}window.dispatchEvent(new Event(kS))})(e,t),[e])]}let kO={damping:.7,stiffness:.05,mass:1.25},kL=1e3/60,kP=!1;function kD(e,t){let r=(0,Q.useCallback)(t=>(r.current=t,e(t)),t);return r}globalThis.document?.addEventListener("mousedown",()=>{kP=!0}),globalThis.document?.addEventListener("mouseup",()=>{kP=!1}),globalThis.document?.addEventListener("click",()=>{kP=!1});let kM=new Map;function kj(...e){let t={...kO},r=!1;for(let n of e){if("instant"===n){r=!0;continue}"object"==typeof n&&(r=!1,t.damping=n.damping??t.damping,t.stiffness=n.stiffness??t.stiffness,t.mass=n.mass??t.mass)}let n=JSON.stringify(t);return kM.has(n)||kM.set(n,Object.freeze(t)),r?"instant":kM.get(n)}let kF=ro("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),k$=ro("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),kU=ro("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),kz=lO?e=>{e()}:Q.default.startTransition,kB=l5(ur,()=>(e,t,r={})=>{let{mutate:n}=l4(),a=(0,Q.useRef)(e),i=(0,Q.useRef)(t),o=(0,Q.useRef)(r),s=(0,Q.useRef)(0),[l,u,c]=(e=>{let[,t]=(0,Q.useState)({}),r=(0,Q.useRef)(!1),n=(0,Q.useRef)(e),a=(0,Q.useRef)({data:!1,error:!1,isValidating:!1}),i=(0,Q.useCallback)(e=>{let i=!1,o=n.current;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&o[t]!==e[t]&&(o[t]=e[t],a.current[t]&&(i=!0));i&&!r.current&&t({})},[]);return lP(()=>(r.current=!1,()=>{r.current=!0})),[n,a.current,i]})({data:lb,error:lb,isMutating:!1}),d=l.current,p=(0,Q.useCallback)(async(e,t)=>{let[r,l]=lz(a.current);if(!i.current)throw Error("Can’t trigger the mutation: missing fetcher.");if(!r)throw Error("Can’t trigger the mutation: missing key.");let u=l_(l_({populateCache:!1,throwOnError:!0},o.current),t),d=lH();s.current=d,c({isMutating:!0});try{let t=await n(r,i.current(l,{arg:e}),l_(u,{throwOnError:!0}));return s.current<=d&&(kz(()=>c({data:t,isMutating:!1,error:void 0})),null==u.onSuccess||u.onSuccess.call(u,t,r,u)),t}catch(e){if(s.current<=d&&(kz(()=>c({error:e,isMutating:!1})),null==u.onError||u.onError.call(u,e,r,u),u.throwOnError))throw e}},[]),f=(0,Q.useCallback)(()=>{s.current=lH(),c({data:lb,error:lb,isMutating:!1})},[]);return lP(()=>{a.current=e,i.current=t,o.current=r}),{trigger:p,reset:f,get data(){return u.data=!0,d.data},get error(){return u.error=!0,d.error},get isMutating(){return u.isMutating=!0,d.isMutating}}}),kH={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",json:"json",xml:"xml",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",dockerfile:"dockerfile",makefile:"makefile"},kG=Q.default.memo(({file:e,onSaveFile:t,onClose:r,editDisabled:n})=>{let[a,i]=(0,Q.useState)(null===e),[o,s]=(0,Q.useState)(String(e?.path||"")),[l,u]=(0,Q.useState)(String(e?.content||"")),c=kB({kind:"files-update",fileName:o,fileContent:l},async({fileName:e,fileContent:r})=>{if(e&&r)return await t(e,r)},{onSuccess:()=>i(!1),onError:e=>u_.toast.error(`Failed to save file: ${e}`)});(0,Q.useEffect)(()=>{s(String(e?.path||"")),u(String(e?.content||"")),i(null===e)},[e]);let d=(0,Q.useMemo)(()=>{let e=String(o||"");return e.split(".").pop()?.toLowerCase()||""},[o]),p=(0,Q.useMemo)(()=>"md"===d||"markdown"===d,[d]),f=(0,Q.useMemo)(()=>kH[d]||"text",[d]),m=(0,Q.useCallback)(()=>{l&&kl(l)},[l]),h=(0,Q.useCallback)(()=>{if(l&&o){let e=new Blob([l],{type:"text/plain"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=o,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t)}},[l,o]),g=(0,Q.useCallback)(()=>{i(!0)},[]),b=(0,Q.useCallback)(()=>{null===e?r():(s(String(e.path)),u(String(e.content)),i(!1))},[e,r]),y=(0,Q.useMemo)(()=>""!==o.trim()&&!o.includes("/")&&!o.includes(" "),[o]);return(0,J.jsx)(rK,{open:!0,onOpenChange:r,children:(0,J.jsxs)(rJ,{"aria-describedby":void 0,className:"flex h-[80vh] max-h-[80vh] min-w-[60vw] flex-col p-6",children:[(0,J.jsx)(r1,{className:"sr-only",children:e?.path||"New File"}),(0,J.jsxs)("div",{className:"mb-4 flex items-center justify-between border-b border-border pb-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(kF,{className:"h-5 w-5 shrink-0 text-[var(--color-text-tertiary)]"}),a&&null===e?(0,J.jsx)(nu,{value:o,onChange:e=>s(e.target.value),placeholder:"Enter filename…",className:"text-base font-medium","aria-invalid":!y}):(0,J.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-base font-medium text-primary",children:e?.path})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:!a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{onClick:g,variant:"ghost",size:"sm",className:"h-8 px-2",disabled:n,children:[(0,J.jsx)(n$,{size:16,className:"mr-1"}),"Edit"]}),(0,J.jsxs)(na,{onClick:m,variant:"ghost",size:"sm",className:"h-8 px-2",children:[(0,J.jsx)(ks,{size:16,className:"mr-1"}),"Copy"]}),(0,J.jsxs)(na,{onClick:h,variant:"ghost",size:"sm",className:"h-8 px-2",children:[(0,J.jsx)(k$,{size:16,className:"mr-1"}),"Download"]})]})})]}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:a?(0,J.jsx)(_l,{value:l,onChange:e=>u(e.target.value),placeholder:"Enter file content…",className:"h-full min-h-[400px] resize-none font-mono text-sm"}):(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"p-4",children:l?p?(0,J.jsx)("div",{className:"rounded-md p-6",children:(0,J.jsx)(S2,{content:l})}):(0,J.jsx)(S0,{language:f,style:S1,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem"},showLineNumbers:!0,wrapLines:!0,lineProps:{style:{whiteSpace:"pre-wrap"}},children:l}):(0,J.jsx)("div",{className:"flex items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"File is empty"})})})})}),a&&(0,J.jsxs)("div",{className:"mt-4 flex justify-end gap-2 border-t border-border pt-4",children:[(0,J.jsxs)(na,{onClick:b,variant:"outline",size:"sm",children:[(0,J.jsx)(rs,{size:16,className:"mr-1"}),"Cancel"]}),(0,J.jsxs)(na,{onClick:()=>c.trigger(),size:"sm",disabled:c.isMutating||!o.trim()||!l.trim()||!y,children:[c.isMutating?(0,J.jsx)(a1,{size:16,className:"mr-1 animate-spin"}):(0,J.jsx)(kU,{size:16,className:"mr-1"}),"Save"]})]})]})})});function kV({files:e,setFiles:t,editDisabled:r}){let[n,a]=(0,Q.useState)(null),i=(0,Q.useCallback)(async(r,n)=>{await t({...e,[r]:n}),a({path:r,content:n})},[e,t]);return(0,J.jsxs)(J.Fragment,{children:[0===Object.keys(e).length?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-4 text-center",children:(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:"No files created yet"})}):(0,J.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(256px,1fr))] gap-2",children:Object.keys(e).map(t=>{let r,n=String(t),i=e[t];if("object"==typeof i&&null!==i&&"content"in i){let e=i.content;r=Array.isArray(e)?e.join("\n"):String(e||"")}else r=String(i||"");return(0,J.jsxs)("button",{type:"button",onClick:()=>a({path:n,content:r}),className:"cursor-pointer space-y-1 truncate rounded-md border border-border px-2 py-3 shadow-sm transition-colors",style:{backgroundColor:"var(--color-file-button)"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="var(--color-file-button-hover)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="var(--color-file-button)"},children:[(0,J.jsx)(kF,{size:24,className:"mx-auto text-muted-foreground"}),(0,J.jsx)("span",{className:"mx-auto block w-full truncate break-words text-center text-sm leading-relaxed text-foreground",children:n})]},n)})}),n&&(0,J.jsx)(kG,{file:n,onSaveFile:i,onClose:()=>a(null),editDisabled:r})]})}kG.displayName="FileViewDialog",Q.default.memo(({todos:e,files:t,setFiles:r})=>{let{isLoading:n,interrupt:a}=vZ(),[i,o]=(0,Q.useState)(!1),[s,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(e.length),c=(0,Q.useRef)(Object.keys(t).length);(0,Q.useEffect)(()=>{0===u.current&&e.length>0&&o(!0),u.current=e.length},[e.length]);let d=Object.keys(t).length;(0,Q.useEffect)(()=>{0===c.current&&d>0&&l(!0),c.current=d},[d]);let p=(0,Q.useCallback)(e=>{switch(e){case"completed":return(0,J.jsx)(vX,{size:12,className:"text-[var(--color-success)]"});case"in_progress":return(0,J.jsx)(vJ,{size:12,className:"text-[var(--color-warning)]"});default:return(0,J.jsx)(vQ,{size:10,className:"text-[var(--color-text-tertiary)]"})}},[]),f=(0,Q.useMemo)(()=>({pending:e.filter(e=>"pending"===e.status),in_progress:e.filter(e=>"in_progress"===e.status),completed:e.filter(e=>"completed"===e.status)}),[e]),m={pending:"Pending",in_progress:"In Progress",completed:"Completed"};return(0,J.jsx)("div",{className:"min-h-0 w-full flex-1",children:(0,J.jsx)("div",{className:"font-inter flex h-full w-full flex-col p-0",children:(0,J.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-hidden",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between px-3 pb-1.5 pt-2",children:[(0,J.jsx)("span",{className:"text-xs font-semibold tracking-wide text-zinc-600",children:"AGENT TASKS"}),(0,J.jsx)("button",{onClick:()=>o(e=>!e),className:rZ("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-transform duration-200 hover:bg-muted",i?"rotate-180":"rotate-0"),"aria-label":"Toggle tasks panel",children:(0,J.jsx)(la,{size:14})})]}),i&&(0,J.jsx)("div",{className:"bg-muted-secondary rounded-xl px-3 pb-2",children:(0,J.jsx)(ij,{className:"h-full",children:0===e.length?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-4 text-center",children:(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:"No tasks created yet"})}):(0,J.jsx)("div",{className:"ml-1 p-0.5",children:Object.entries(f).map(([e,t])=>(0,J.jsxs)("div",{className:"mb-4",children:[(0,J.jsx)("h3",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-tertiary",children:m[e]}),t.map((t,r)=>(0,J.jsxs)("div",{className:"mb-1.5 flex items-start gap-2 rounded-sm p-1 text-sm",children:[p(t.status),(0,J.jsx)("span",{className:"flex-1 break-words leading-relaxed text-inherit",children:t.content})]},`${e}_${t.id}_${r}`))]}))})})}),(0,J.jsxs)("div",{className:"flex items-center justify-between px-3 pb-1.5 pt-2",children:[(0,J.jsx)("span",{className:"text-xs font-semibold tracking-wide text-zinc-600",children:"FILE SYSTEM"}),(0,J.jsx)("button",{onClick:()=>l(e=>!e),className:rZ("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-transform duration-200 hover:bg-muted",s?"rotate-180":"rotate-0"),"aria-label":"Toggle files panel",children:(0,J.jsx)(la,{size:14})})]}),s&&(0,J.jsx)(kV,{files:t,setFiles:r,editDisabled:!0===n||void 0!==a})]})})})}).displayName="TasksFilesSidebar";let kq=ro("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),kW=ro("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),kZ=ro("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),kK=ro("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),kY=ro("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]),kX=ro("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),kJ={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",sh:"bash",bash:"bash",zsh:"bash",json:"json",jsonl:"json",xml:"xml",html:"html",css:"css",scss:"scss",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",tex:"latex",bib:"latex",r:"r"},kQ=new Set(["png","jpg","jpeg","gif","webp","svg","bmp"]),k0=new Set([...Object.keys(kJ),"txt","md","markdown","log","csv","tsv","cfg","conf","env","gitignore"]);function k1(e,t=!1){let r=new URLSearchParams({path:e});return t&&r.set("download","1"),`/api/workspace/file?${r.toString()}`}let k2=Q.default.memo(({path:e,size:t,onClose:r,onChanged:n})=>{let[a,i]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),[c,d]=(0,Q.useState)(!1),[p,f]=(0,Q.useState)(""),[m,h]=(0,Q.useState)(!1),[g,b]=(0,Q.useState)(null),[y,v]=(0,Q.useState)(!1),[_,w]=(0,Q.useState)(!1),[E,x]=(0,Q.useState)(null),S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]);let k=e?e.split("/").pop()||e:"",T=(0,Q.useMemo)(()=>k.includes(".")?k.split(".").pop().toLowerCase():"",[k]),A=kQ.has(T)?"image":"pdf"===T?"pdf":k0.has(T)?"text":"binary",N="text"===A&&null!=t&&t>2097152;if((0,Q.useEffect)(()=>{if(!e||"text"!==A||N)return void i(null);let t=!1;return s(!0),u(null),d(!1),b(null),fetch(k1(e)).then(async e=>{if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||`Failed to load file (${e.status})`)}return e.text()}).then(e=>{t||i(e)}).catch(e=>{t||u(e.message??"Failed to load file.")}).finally(()=>{t||s(!1)}),()=>{t=!0}},[e,A,N]),!e)return null;let I="md"===T||"markdown"===T,C=kJ[T]||"text",R=c&&null!==a&&p!==a,O=e=>{R?x(e):"close"===e?r():d(!1)},L=async()=>{h(!0),b(null);try{let t=await fetch(k1(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:p})}),r=await t.json().catch(()=>null);if(!t.ok)throw Error(r?.error||"Failed to save.");if(!S.current)return;i(p),d(!1),n?.()}catch(e){S.current&&b(e instanceof Error?e.message:"Failed to save.")}finally{S.current&&h(!1)}},P=async()=>{v(!0),b(null);try{let t=await fetch(k1(e),{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to delete.")}n?.(),r()}catch(e){S.current&&(w(!1),b(e instanceof Error?e.message:"Failed to delete."))}finally{S.current&&v(!1)}};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(rK,{open:!0,onOpenChange:e=>{e||O("close")},children:(0,J.jsxs)(rJ,{"aria-describedby":void 0,className:"flex h-[80vh] max-h-[80vh] min-w-[60vw] flex-col p-6",children:[(0,J.jsx)(r1,{className:"sr-only",children:e}),(0,J.jsxs)("div",{className:"mb-4 flex items-center justify-between gap-3 border-b border-border pb-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(kF,{className:"h-5 w-5 shrink-0 text-[var(--color-text-tertiary)]"}),(0,J.jsx)("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap text-base font-medium text-primary",children:e})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:c?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{O("cancel-edit")},disabled:m,children:[(0,J.jsx)(kX,{size:16,className:"mr-1"}),"Cancel"]}),(0,J.jsxs)(na,{size:"sm",className:"h-8 bg-[var(--brand-solid)] px-3 text-[var(--brand-foreground)] hover:opacity-90",onClick:L,disabled:m||!R,children:[m?(0,J.jsx)(a1,{size:16,className:"mr-1 animate-spin"}):(0,J.jsx)(kU,{size:16,className:"mr-1"}),m?"Saving…":"Save"]})]}):(0,J.jsxs)(J.Fragment,{children:["text"===A&&!N&&(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{f(a??""),b(null),d(!0)},disabled:o||null===a,"aria-label":"Edit file",children:[(0,J.jsx)(a4,{size:16,className:"mr-1"}),"Edit"]}),(0,J.jsx)("a",{href:k1(e,!0),download:k,children:(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",asChild:!0,children:(0,J.jsxs)("span",{children:[(0,J.jsx)(k$,{size:16,className:"mr-1"}),"Download"]})})}),(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2 text-muted-foreground hover:text-destructive",onClick:()=>w(!0),disabled:y,"aria-label":"Delete file",title:"Delete file",children:y?(0,J.jsx)(a1,{size:16,className:"animate-spin"}):(0,J.jsx)(a8,{size:16})})]})})]}),g&&(0,J.jsx)("p",{role:"alert",className:"mb-2 text-sm text-destructive",children:g}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:c?(0,J.jsx)("textarea",{value:p,onChange:e=>f(e.target.value),spellCheck:!1,"aria-label":"File content",className:"h-full w-full resize-none rounded-md border border-border bg-background p-4 font-mono text-sm leading-relaxed text-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",placeholder:"File is empty…"}):"image"===A?(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"flex items-center justify-center p-4",children:(0,J.jsx)("img",{src:k1(e),alt:k,className:"max-h-full max-w-full object-contain"})})}):"pdf"===A?(0,J.jsx)("iframe",{src:k1(e),title:k,className:"h-full w-full rounded-md border border-border"}):"binary"===A||N?(0,J.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-12 text-center",children:[(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:N?"This file is too large to preview inline.":"This file type can't be previewed."}),(0,J.jsx)("a",{href:k1(e,!0),download:k,children:(0,J.jsxs)(na,{variant:"outline",size:"sm",children:[(0,J.jsx)(k$,{size:16,className:"mr-1"}),"Download file"]})})]}):o?(0,J.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,J.jsx)(a1,{className:"size-5 animate-spin text-muted-foreground"})}):l?(0,J.jsx)("div",{className:"flex h-full items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-destructive",children:l})}):(0,J.jsx)(ij,{className:"bg-surface h-full rounded-md",children:(0,J.jsx)("div",{className:"p-4",children:a&&a.length>0?I?(0,J.jsx)("div",{className:"rounded-md p-6",children:(0,J.jsx)(S2,{content:a})}):(0,J.jsx)(S0,{language:C,style:S1,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem"},showLineNumbers:!0,wrapLines:!0,lineProps:{style:{whiteSpace:"pre-wrap"}},children:a}):(0,J.jsx)("div",{className:"flex items-center justify-center p-12",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"File is empty"})})})})})]})}),(0,J.jsx)(rK,{open:null!==E,onOpenChange:e=>{e||x(null)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Discard unsaved changes?"}),(0,J.jsxs)(r2,{children:["Your edits to “",k,"” have not been saved."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>x(null),children:"Keep Editing"}),(0,J.jsx)(na,{onClick:()=>{x(null),"close"===E&&r(),"cancel-edit"===E&&d(!1)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})}),(0,J.jsx)(rK,{open:_,onOpenChange:e=>{y||w(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Delete file?"}),(0,J.jsxs)(r2,{children:["“",k,"” will be permanently removed from the workspace. This can't be undone."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>w(!1),disabled:y,children:"Cancel"}),(0,J.jsx)(na,{onClick:P,disabled:y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:y?"Deleting…":"Delete"})]})]})})]})});async function k4(e){let t=await fetch(`/api/workspace?${new URLSearchParams({path:e})}`),r=await t.json().catch(()=>null);if(!t.ok)throw Error(r?.error||"Failed to list workspace.");return r?.entries??[]}async function k3(){let e=await fetch("/api/workspace?recursive=1"),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||"Failed to load workspace.");return{entries:t?.entries??[],truncated:!!t?.truncated}}k2.displayName="WorkspaceFileDialog";let k5=[{key:"docs",label:"Papers & docs",Icon:kF,exts:["pdf","tex","bib","md","markdown","txt","docx","doc","rtf","odt"]},{key:"figures",label:"Figures",Icon:kZ,exts:["png","jpg","jpeg","gif","svg","webp","bmp","tiff","tif","eps"]},{key:"data",label:"Data",Icon:kK,exts:["json","jsonl","csv","tsv","xlsx","xls","parquet","pkl","npy","npz","h5","hdf5","db","sqlite","yaml","yml","xml"]},{key:"code",label:"Code",Icon:kY,exts:["py","ipynb","js","ts","tsx","jsx","sh","bash","r","jl","cpp","cc","c","h","hpp","java","go","rs","m","rb"]}],k6={key:"other",label:"Other",Icon:v0},k9={};for(let e of k5)for(let t of e.exts)k9[t]=e.key;function k8(){let[e,t]=(0,Q.useState)("tree"),[r,n]=(0,Q.useState)({}),[a,i]=(0,Q.useState)(new Set),[o,s]=(0,Q.useState)(new Set),[l,u]=(0,Q.useState)(!1),[c,d]=(0,Q.useState)(null),[p,f]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,b]=(0,Q.useState)(null),[y,v]=(0,Q.useState)(null),_=(0,Q.useCallback)(async e=>{s(t=>new Set(t).add(e));try{let t=await k4(e);return n(r=>({...r,[e]:t})),""===e&&b(null),t}catch(t){throw""===e&&b(t instanceof Error?t.message:"Failed to load."),t}finally{s(t=>{let r=new Set(t);return r.delete(e),r})}},[]),w=(0,Q.useCallback)(async()=>{f(!0);try{let{entries:e,truncated:t}=await k3();d(e),h(t),b(null)}catch(e){b(e instanceof Error?e.message:"Failed to load.")}finally{f(!1)}},[]);(0,Q.useEffect)(()=>{u(!0),_("").catch(()=>{}).finally(()=>u(!1))},[]),(0,Q.useEffect)(()=>{"type"!==e||null!==c||p||w()},[e]);let E=(0,Q.useCallback)(async()=>{(b(null),"type"===e)?await w():(u(!0),await Promise.allSettled(["",...a].map(e=>_(e))),u(!1))},[e,a,_,w]),x=(0,Q.useCallback)(e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):(n.add(e),r[e]||_(e).catch(()=>{})),n})},[r,_]),S=(0,Q.useMemo)(()=>{let e={};for(let t of c??[]){let r=k9[t.ext]??k6.key;(e[r]??=[]).push(t)}for(let t of Object.values(e))t.sort((e,t)=>t.mtime-e.mtime);return e},[c]),k="type"===e?p:l,T=(e,t)=>{let n=r[e];return n?0===n.length&&0===t?(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:"No files in the workspace yet"}):n.map(e=>{let r=a.has(e.path),n=o.has(e.path);return(0,J.jsxs)("div",{children:[(0,J.jsxs)("button",{type:"button",onClick:()=>"dir"===e.type?x(e.path):v({path:e.path,size:e.size}),className:"flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left text-sm text-foreground transition-colors hover:bg-muted",style:{paddingLeft:`${14*t+4}px`},title:e.name,children:["dir"===e.type?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center text-muted-foreground",children:n?(0,J.jsx)(a1,{className:"size-3 animate-spin"}):r?(0,J.jsx)(la,{className:"size-3.5"}):(0,J.jsx)(ko,{className:"size-3.5"})}),(0,J.jsx)(kq,{className:"size-4 shrink-0 text-[var(--brand)]"})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("span",{className:"size-4 shrink-0"}),(0,J.jsx)(kF,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,J.jsx)("span",{className:"truncate",children:e.name})]}),"dir"===e.type&&r&&T(e.path,t+1)]},e.path)}):null};return(0,J.jsxs)("div",{className:"flex min-h-0 flex-col",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between gap-2 pb-1.5",children:[(0,J.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted p-0.5 text-xs",children:["tree","type"].map(r=>(0,J.jsx)("button",{type:"button",onClick:()=>t(r),className:rZ("rounded px-2 py-0.5 font-medium transition-colors",e===r?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),"aria-pressed":e===r,children:"tree"===r?"Tree":"By type"},r))}),(0,J.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,J.jsxs)("a",{href:"/api/workspace/download",download:!0,className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:"Download the whole workspace as a zip",children:[(0,J.jsx)(k$,{className:"size-3.5"}),"All"]}),(0,J.jsx)("button",{type:"button",onClick:E,disabled:k,className:"inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50","aria-label":"Refresh workspace",title:"Refresh",children:(0,J.jsx)(kW,{className:rZ("size-3.5",k&&"animate-spin")})})]})]}),g?(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:g}):"tree"===e?l&&!r[""]?(0,J.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,J.jsx)(a1,{className:"size-4 animate-spin text-muted-foreground"})}):(0,J.jsx)("div",{className:"-mx-1",children:T("",0)}):p&&null===c?(0,J.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,J.jsx)(a1,{className:"size-4 animate-spin text-muted-foreground"})}):(()=>{if(!c)return null;if(0===c.length)return(0,J.jsx)("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:"No files in the workspace yet"});let e=[...k5,k6];return(0,J.jsxs)("div",{className:"space-y-3",children:[m&&(0,J.jsx)("p",{className:"px-1 text-[11px] text-muted-foreground",children:"Showing the first files only — the workspace has more than the limit."}),e.map(e=>{let t=S[e.key];if(!t||0===t.length)return null;let r=e.Icon;return(0,J.jsxs)("div",{children:[(0,J.jsxs)("div",{className:"mb-0.5 flex items-center gap-1.5 px-1 text-[10px] font-semibold uppercase tracking-wider text-tertiary",children:[(0,J.jsx)(r,{className:"size-3.5"}),e.label,(0,J.jsxs)("span",{className:"text-muted-foreground",children:["(",t.length,")"]})]}),t.map(e=>{let t=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,J.jsxs)("button",{type:"button",onClick:()=>v({path:e.path,size:e.size}),className:"flex w-full items-center gap-1.5 rounded-md px-1 py-1 text-left text-sm text-foreground transition-colors hover:bg-muted",title:e.path,children:[(0,J.jsx)(r,{className:"size-4 shrink-0 text-muted-foreground"}),(0,J.jsx)("span",{className:"truncate",children:e.name}),t&&(0,J.jsx)("span",{className:"ml-auto shrink-0 truncate pl-2 text-[11px] text-muted-foreground",children:t})]},e.path)})]},e.key)})]})})(),(0,J.jsx)(k2,{path:y?.path??null,size:y?.size,onClose:()=>v(null),onChanged:E})]})}let k7=["Survey recent papers on a topic","Design an experiment plan","Analyze workspace files"],Te=(e,t)=>{switch(e){case"completed":return(0,J.jsx)(vX,{size:16,className:rZ("text-[var(--color-success)]",t)});case"in_progress":return(0,J.jsx)(vJ,{size:16,className:rZ("text-[var(--color-warning)]",t)});default:return(0,J.jsx)(vQ,{size:16,className:rZ("text-[var(--color-text-tertiary)]",t)})}},Tt=Q.default.memo(({assistant:e,onShowAgents:t,onNotifyReady:r})=>{let n,a,i,o,s,l,u,[c,d]=(0,Q.useState)(null),p=(0,Q.useRef)(null),f=(0,Q.useRef)(null),m=(0,Q.useRef)(null),[h,g]=(0,Q.useState)(""),[b,y]=(0,Q.useState)([]),[v,_]=(0,Q.useState)(!1),[w]=ec("threadId"),[E,x]=(0,Q.useState)(()=>kv(w)),[S,k]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),A=(0,Q.useRef)(w),N=(0,Q.useRef)(!1),{scrollRef:I,contentRef:C,scrollToBottom:R}=((e={})=>{let[t,r]=(0,Q.useState)(!1),[n,a]=(0,Q.useState)(!1!==e.initial),[i,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null);s.current=e;let l=(0,Q.useCallback)(()=>{if(!kP)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),u=(0,Q.useCallback)(e=>{d.isAtBottom=e,a(e)},[]),c=(0,Q.useCallback)(e=>{d.escapedFromLock=e,r(e)},[]),d=(0,Q.useMemo)(()=>{let r;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(scrollTop){if(g.current){let{scrollBehavior:e}=getComputedStyle(g.current);"auto"!==e&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=scrollTop,d.ignoreScrollToTop=g.current.scrollTop,"auto"!==e&&(g.current.style.scrollBehavior=e)}},get targetScrollTop(){if(!g.current||!b.current)return 0;return g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!b.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(r?.targetScrollTop===t)return r.calculatedScrollTop;let n=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:b.current}),t),0);return r={targetScrollTop:t,calculatedScrollTop:n},requestAnimationFrame(()=>{r=void 0}),n},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=70}}},[]),p=(0,Q.useCallback)((e={})=>{let t;"string"==typeof e&&(e={animation:e}),e.preserveScrollPosition||u(!0);let r=Date.now()+(Number(e.wait)||0),n=kj(s.current,e.animation),{ignoreEscapes:a=!1}=e,i=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{t=Date.now()}):t=r+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:u}=d,c=performance.now(),f=(c-(d.lastTick??c))/kL;if(d.animation||(d.animation={behavior:n,promise:e,ignoreEscapes:a}),d.animation.behavior===n&&(d.lastTick=c),l()||r>Date.now())return o();if(u<Math.min(i,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if("instant"===n)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*f,d.scrollTop+=d.accumulated,d.scrollTop!==u&&(d.accumulated=0)}return o()}return t>Date.now()?(i=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop)?p({animation:kj(s.current,s.current.resize),ignoreEscapes:a,duration:Math.max(0,t-Date.now())||void 0}):d.isAtBottom});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return(!0!==e.wait&&(d.animation=void 0),d.animation?.behavior===n)?d.animation.promise:o()},[u,l,d]),f=(0,Q.useCallback)(()=>{c(!0),u(!1)},[c,u]),m=(0,Q.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:r}=d,{lastScrollTop:n=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,r&&r>t&&(n=r),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===r)return;if(l()){c(!0),u(!1);return}let e=t>n,a=t<n;if(d.animation?.ignoreEscapes){d.scrollTop=n;return}a&&(c(!0),u(!1)),e&&c(!1),!d.escapedFromLock&&d.isNearBottom&&u(!0)},1)},[c,u,l,d]),h=(0,Q.useCallback)(({target:e,deltaY:t})=>{let r=e;for(;!["scroll","auto"].includes(getComputedStyle(r).overflow);){if(!r.parentElement)return;r=r.parentElement}r===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(c(!0),u(!1))},[c,u,d]),g=kD(e=>{g.current?.removeEventListener("scroll",m),g.current?.removeEventListener("wheel",h),e?.addEventListener("scroll",m,{passive:!0}),e?.addEventListener("wheel",h,{passive:!0})},[]),b=kD(e=>{let t;d.resizeObserver?.disconnect(),e&&(d.resizeObserver=new ResizeObserver(([e])=>{let{height:r}=e.contentRect,n=r-(t??r);if(d.resizeDifference=n,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),n>=0){let e=kj(s.current,t?s.current.resize:s.current.initial);p({animation:e,wait:!0,preserveScrollPosition:!0,duration:"instant"===e?void 0:350})}else d.isNearBottom&&(c(!1),u(!0));t=r,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===n&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e))},[]);return{contentRef:b,scrollRef:g,scrollToBottom:p,stopScroll:f,isAtBottom:n||i,isNearBottom:i,escapedFromLock:t,state:d}})(),{stream:O,messages:L,todos:P,files:D,ui:M,setFiles:j,isLoading:F,isThreadLoading:$,interrupt:U,sendMessage:z,stopStream:B,resumeInterrupt:H,subAgentActivity:G,asyncTasks:V,summarizationEvent:q}=vZ(),{tasks:W}=kw(w,{enabled:Object.keys(V??{}).length>0}),Z=(0,Q.useMemo)(()=>kn(W),[W]),[K]=kR(w),Y=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{Y.current=!1},[w]),(0,Q.useEffect)(()=>{F&&(Y.current=!1)},[F]),(0,Q.useEffect)(()=>{var e;if(!W||0===W.length||!w||!K)return;if(!(w&&kT()[w]?.initialized===!0))return void kI(w,W.filter(e=>kr(e.liveStatus)).map(S9));if(F||Y.current||h.trim())return;let t=function(e){if(!e)return new Set;let t=kT()[e];return new Set(Array.isArray(t?.keys)?t.keys:[])}(w);for(let r of W){if(!kr(r.liveStatus))continue;let n=S9(r);if(!t.has(n)){if(L.some(e=>"human"===e.type&&S7(vB(e),r))){kC(w,n);continue}Y.current=!0,kC(w,n),z(ke(r)),u_.toast.success(`Auto-reported ${S5[e=r.agent_name]??e} to the main chat.`);break}}},[W,K,F,h,L,z,w]),(0,Q.useEffect)(()=>{F&&R()},[F,R]);let X=(0,Q.useRef)({sendMessage:z,isLoading:F,messages:L,threadId:w});X.current={sendMessage:z,isLoading:F,messages:L,threadId:w};let ee=(0,Q.useRef)(r);ee.current=r,(0,Q.useEffect)(()=>(ee.current?.((e,t)=>{let r=X.current;return r.threadId!==t?"wrong-thread":r.isLoading?"busy":r.messages.some(t=>"human"===t.type&&S7(vB(t),e))?"duplicate":(kC(t,S9(e)),r.sendMessage(ke(e)),"sent")}),()=>ee.current?.(null)),[]);let et=(0,Q.useMemo)(()=>{for(let e=L.length-1;e>=0;e--){let t=L[e];if("ai"!==t.type)continue;let r=t.response_metadata,n=function(e,t){if("string"!=typeof e||!e.trim())return null;let r=e.trim(),n=r.lastIndexOf("/"),a=n>=0?r.slice(0,n):"";n>=0&&(r=r.slice(n+1)),r=r.replace(/-\d{8}$/,"");let i="string"==typeof t&&t.trim()||a;return{name:r,provider:i?i.charAt(0).toUpperCase()+i.slice(1):null}}(r?.model_name??r?.model,r?.model_provider);if(n)return n}return null},[L]),er=(0,Q.useMemo)(()=>{let e={},t=Object.keys(G);if(0===t.length)return e;let r=[],n={};for(let e of L)if("ai"===e.type)for(let t of e.tool_calls??[])"task"===t.name&&t.id&&r.push(t.id);else if("tool"===e.type){let t=e.tool_call_id;t&&(n[t]=vB(e))}let a=e=>e.replace(/\s+/g," ").trim(),i=new Set;for(let o of r){let r=a(n[o]??"");if(!r)continue;let s=t.find(e=>{if(i.has(e))return!1;let t=a(function(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if("text"===r.kind)return r.text}return""}(G[e]));return""!==t&&(r.includes(t)||t.includes(r))});s&&(e[o]=G[s],i.add(s))}let o=t.filter(e=>!i.has(e)),s=0;for(let t of r)e[t]||n[t]||s<o.length&&(e[t]=G[o[s++]]);return e},[L,G]),en=U?.value,ea=en?.type==="ask_user"||Array.isArray(en?.action_requests)&&en.action_requests.length>0,ei=F||!e||ea,eo=(0,Q.useCallback)(()=>{x(!0),k_(w,!0),k(!1)},[w]),es=(0,Q.useCallback)(()=>{x(!1),k_(w,!1),k(!1),T.current=null},[w]);(0,Q.useEffect)(()=>{let e=A.current;if(e!==w){if(null===e&&null!==w&&N.current){let e;(e=kb())[kg]&&(e[w]=!0),kg in e&&(delete e[kg],ky(e))}else null===e&&null!==w&&k_(null,!1);x(kv(w)),T.current=null,k(!1),y([]),N.current=!1,A.current=w}},[w]);let el=(0,Q.useCallback)(async e=>{let t=Array.from(e.target.files??[]);if(e.target.value="",0!==t.length){_(!0);try{let e=new FormData;t.forEach(t=>e.append("files",t));let r=await fetch("/api/workspace/upload",{method:"POST",body:e}),n=await r.json();if(!r.ok||!n.files)throw Error(n.error||"Failed to upload files.");y(e=>[...e,...n.files]),u_.toast.success(`${n.files.length} file${1===n.files.length?"":"s"} uploaded to the workspace.`)}catch(e){u_.toast.error(e instanceof Error?e.message:"Failed to upload files.")}finally{_(!1)}}},[]),eu=(0,Q.useCallback)(e=>{y(t=>t.filter(t=>t.path!==e))},[]),ed=(0,Q.useCallback)(e=>{e&&e.preventDefault();let t=h.trim();if(!t||F||v||ei)return;N.current=null===w&&E;let r=b.length>0?`
|
|
71
71
|
|
|
72
72
|
Workspace files uploaded for this request:
|
|
73
|
-
${b.map(e=>`- ${e.path}`).join("\n")}`:"";z(`${t}${r}`),g(""),y([])},[h,E,F,v,b,z,g,ea,w]),ed=(0,Q.useCallback)(e=>{ea||!e.nativeEvent.isComposing&&229!==e.keyCode&&("Enter"!==e.key||e.shiftKey||(e.preventDefault(),eu()))},[eu,ea]),ep=(0,Q.useCallback)(e=>{g(e),requestAnimationFrame(()=>{let t=f.current;t&&(t.focus(),t.setSelectionRange(e.length,e.length))})},[]),ef=(0,Q.useCallback)(e=>{g(e),requestAnimationFrame(()=>f.current?.focus())},[]);(0,Q.useEffect)(()=>{if(!E)return;let e=U?.value&&U.value.action_requests;if(!U||!Array.isArray(e)||0===e.length){T.current=null;return}T.current!==U&&(T.current=U,H({decisions:e.map(()=>({type:"approve"}))}))},[E,U,H]);let em=(0,Q.useMemo)(()=>{let e=U?.value;return e?.type==="ask_user"&&Array.isArray(e.questions)?e.questions:null},[U]),eh=(0,Q.useCallback)(e=>{H({status:"answered",answers:e})},[H]),eg=(0,Q.useCallback)(()=>{H({status:"cancelled"})},[H]),eb=(0,Q.useMemo)(()=>{let e=new Map,t=new Set;L.filter(e=>{let r,n=O.getMessagesMetadata(e)?.streamMetadata,a=n?.langgraph_checkpoint_ns;if("string"==typeof a&&a.includes("|"))return!1;if("human"!==e.type)return!0;let i=(r=S6(ko(e)))?`${r.taskId}:${r.runId||"legacy"}`:null;return!i||!t.has(i)&&(t.add(i),!0)}).forEach(t=>{if("ai"===t.type){let r,n=(r=[],t.additional_kwargs?.tool_calls&&Array.isArray(t.additional_kwargs.tool_calls)?r.push(...t.additional_kwargs.tool_calls):t.tool_calls&&Array.isArray(t.tool_calls)?r.push(...t.tool_calls.filter(e=>""!==e.name)):Array.isArray(t.content)&&r.push(...t.content.filter(e=>"tool_use"===e.type)),r.map(e=>{let t=e.function?.arguments||e.args||e.input||{};return{id:e.id,name:e.function?.name||e.name||e.type||"",args:t&&"object"==typeof t?t:{}}})).filter(e=>"ToolSelectionResponse"!==e.name||F&&!U).map((e,r)=>{let n=e.name||"unknown";return{id:e.id||`${t.id??"ai-message"}-tool-${r}-${n}`,name:n,args:e.args,status:U?"interrupted":"pending"}});e.set(t.id,{message:t,toolCalls:n})}else if("tool"===t.type){let r=t.tool_call_id;if(!r)return;for(let[,n]of e.entries()){let e=n.toolCalls.findIndex(e=>e.id===r);if(-1!==e){n.toolCalls[e]={...n.toolCalls[e],status:"completed",result:ko(t)};break}}}else"human"===t.type&&e.set(t.id,{message:t,toolCalls:[]})});let r=Array.from(e.values());return r.map((e,t)=>{let n=t>0?r[t-1].message:null;return{...e,showAvatar:e.message.type!==n?.type}})},[L,U,F,O]),ey={in_progress:P.filter(e=>"in_progress"===e.status),pending:P.filter(e=>"pending"===e.status),completed:P.filter(e=>"completed"===e.status)},ev=P.length>0,e_=Object.keys(D).length>0,ew=(0,Q.useMemo)(()=>{let e=U?.value&&U.value.action_requests;return Array.isArray(e)?e:[]},[U]),[eE,ex]=(0,Q.useState)(()=>new Set);(0,Q.useEffect)(()=>{0===ew.length&&ex(new Set)},[ew.length]);let eS=(0,Q.useCallback)(e=>{ex(t=>{let r=new Set(t);return r.add(e),r})},[]),ek=(0,Q.useMemo)(()=>{let e=U?.value&&U.value.review_configs;if(!Array.isArray(e))return new Map;let t=[];for(let r of e){let e=r.actionName??r.action_name;e&&t.push([e,{actionName:e,allowedDecisions:r.allowedDecisions??r.allowed_decisions}])}return new Map(t)},[U]);return(0,J.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,J.jsx)(rK,{open:S,onOpenChange:k,children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Enable Auto-approve?"}),(0,J.jsx)(r2,{children:"EvoScientist will run tool actions in this research without asking you to review each one. Turn this on only when you trust the current task and deployment."})]}),(0,J.jsxs)("div",{className:"flex items-start gap-3 rounded-lg border border-amber-300 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100",children:[(0,J.jsx)(v2,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),(0,J.jsx)("p",{children:"Auto-approve stays on for this research only — it follows this conversation across views and reloads, and other research keeps its own setting. Turn it off here anytime."})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),(0,J.jsx)(na,{onClick:ei,className:"bg-amber-600 text-white hover:bg-amber-700",children:"Enable Auto-approve"})]})]})}),(0,J.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden overscroll-contain",ref:I,children:(0,J.jsx)("div",{className:"mx-auto w-full max-w-[960px] px-4 pb-4 pt-3 sm:px-5",ref:C,children:$?(0,J.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,J.jsx)("p",{className:"text-muted-foreground",children:"Loading…"})}):(0,J.jsxs)(J.Fragment,{children:[0===eb.length&&!F&&(0,J.jsxs)("div",{className:"flex min-h-[42vh] flex-col items-center justify-center px-3 text-center",children:[(0,J.jsx)("h2",{className:"text-pretty text-lg font-semibold sm:text-xl",children:"Start Research"}),(0,J.jsx)("p",{className:"mt-2 max-w-lg text-sm text-muted-foreground",children:"Ask EvoScientist to review literature, inspect workspace files, or plan the next experiment."}),(0,J.jsx)("div",{className:"mt-4 flex max-w-2xl flex-wrap justify-center gap-2",children:k9.map(e=>(0,J.jsx)("button",{type:"button",onClick:()=>ef(e),className:"max-w-full rounded-full border border-border bg-card px-2.5 py-1.5 text-xs text-foreground shadow-sm transition-colors hover:border-[var(--color-border)] hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring sm:text-sm",children:e},e))})]}),eb.map((t,r)=>{let n=M?.filter(e=>e.metadata?.message_id===t.message.id),a=r===eb.length-1;return(0,J.jsx)(ku,{message:t.message,toolCalls:t.toolCalls,isLoading:F,actionRequests:a?ew:void 0,submittedActionRequestKeys:eE,onActionRequestSubmitted:eS,reviewConfigsMap:a?ek:void 0,ui:n,stream:O,onResumeInterrupt:H,graphId:e?.graph_id,onEditMessage:ep,autoApprove:E,subAgentSteps:et},t.message.id)}),em&&(0,J.jsx)("div",{className:"mt-4",children:(0,J.jsx)(kp,{questions:em,onSubmit:eh,onCancel:eg,isLoading:F})})]})})}),(0,J.jsx)("div",{className:"flex-shrink-0 bg-background",children:(0,J.jsxs)("div",{className:rZ("mb-2 flex flex-shrink-0 flex-col overflow-hidden rounded-lg border border-border bg-background sm:mb-4","mx-auto w-[calc(100%-16px)] max-w-[960px] transition-colors duration-200 ease-in-out sm:w-[calc(100%-24px)]","focus-within:ring-2 focus-within:ring-ring"),children:[(0,J.jsxs)("div",{className:"flex max-h-60 flex-col overflow-y-auto border-b border-border bg-sidebar empty:hidden sm:max-h-72",children:[!c&&(0,J.jsx)(J.Fragment,{children:(n=P.find(e=>"in_progress"===e.status),i=(a=P.length)-ey.pending.length,o=a===i,s=ev?(0,J.jsx)("button",{type:"button",onClick:()=>d(e=>"tasks"===e?null:"tasks"),className:"grid w-full cursor-pointer grid-cols-[auto_auto_1fr] items-center gap-2.5 px-3 py-2.5 text-left sm:px-4","aria-expanded":"tasks"===c,children:o?[(0,J.jsx)(vK,{size:16,className:"text-[var(--color-success)]"},"icon"),(0,J.jsx)("span",{className:"ml-[1px] min-w-0 truncate text-sm",children:"All tasks completed"},"label")]:null!=n?[(0,J.jsx)("div",{children:k8(n.status)},"icon"),(0,J.jsxs)("span",{className:"ml-[1px] min-w-0 truncate text-sm",children:["Task"," ",a-ey.pending.length," ","of ",a]},"label"),(0,J.jsx)("span",{className:"min-w-0 gap-2 truncate text-sm text-muted-foreground",children:n.content},"content")]:[(0,J.jsx)(vX,{size:16,className:"text-[var(--color-text-tertiary)]"},"icon"),(0,J.jsxs)("span",{className:"ml-[1px] min-w-0 truncate text-sm",children:["Task"," ",a-ey.pending.length," of"," ",a]},"label")]}):null,l=e_?(0,J.jsxs)("button",{type:"button",onClick:()=>d(e=>"files"===e?null:"files"),className:"flex flex-shrink-0 cursor-pointer items-center gap-2 px-3 py-2.5 text-left text-sm sm:px-4","aria-expanded":"files"===c,children:[(0,J.jsx)(vJ,{size:16}),"Files (State)",(0,J.jsx)("span",{className:"h-4 min-w-4 rounded-full bg-[var(--brand-solid)] px-0.5 text-center text-[10px] leading-[16px] text-[var(--brand-foreground)]",children:Object.keys(D).length})]}):null,u=(0,J.jsxs)("button",{type:"button",onClick:()=>d(e=>"workspace"===e?null:"workspace"),className:"flex flex-shrink-0 cursor-pointer items-center gap-2 px-3 py-2.5 text-left text-sm sm:px-4","aria-expanded":"workspace"===c,"aria-label":"Open workspace",children:[(0,J.jsx)(vQ,{size:16,"aria-hidden":"true"}),(0,J.jsx)("span",{children:"Workspace"})]}),(0,J.jsxs)("div",{className:"flex items-center",children:[(0,J.jsx)("div",{className:"min-w-0 flex-1",children:s}),l,u]}))}),c&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"sticky top-0 flex items-stretch bg-sidebar text-sm",children:[ev&&(0,J.jsx)("button",{type:"button",className:"py-2.5 pr-4 first:pl-3 aria-expanded:font-semibold sm:first:pl-4",onClick:()=>d(e=>"tasks"===e?null:"tasks"),"aria-expanded":"tasks"===c,children:"Tasks"}),e_&&(0,J.jsxs)("button",{type:"button",className:"inline-flex items-center gap-2 py-2.5 pr-4 first:pl-3 aria-expanded:font-semibold sm:first:pl-4",onClick:()=>d(e=>"files"===e?null:"files"),"aria-expanded":"files"===c,children:["Files (State)",(0,J.jsx)("span",{className:"h-4 min-w-4 rounded-full bg-[var(--brand-solid)] px-0.5 text-center text-[10px] leading-[16px] text-[var(--brand-foreground)]",children:Object.keys(D).length})]}),(0,J.jsx)("button",{type:"button",className:"inline-flex items-center gap-2 py-2.5 pr-4 first:pl-3 aria-expanded:font-semibold sm:first:pl-4",onClick:()=>d(e=>"workspace"===e?null:"workspace"),"aria-expanded":"workspace"===c,children:"Workspace"}),(0,J.jsx)("button",{"aria-label":"Close",className:"flex-1",onClick:()=>d(null)})]}),(0,J.jsxs)("div",{ref:p,className:"px-3 sm:px-4",children:["tasks"===c&&Object.entries(ey).filter(([e,t])=>t.length>0).map(([e,t])=>(0,J.jsxs)("div",{className:"mb-4",children:[(0,J.jsx)("h3",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-tertiary",children:{pending:"Pending",in_progress:"In Progress",completed:"Completed"}[e]}),(0,J.jsx)("div",{className:"grid grid-cols-[auto_1fr] gap-3 rounded-sm p-1 pl-0 text-sm",children:t.map((t,r)=>(0,J.jsxs)(Q.Fragment,{children:[k8(t.status,"mt-0.5"),(0,J.jsx)("span",{className:"break-words text-inherit",children:t.content})]},`${e}_${t.id}_${r}`))})]},e)),"files"===c&&(0,J.jsx)("div",{className:"mb-6",children:(0,J.jsx)(kH,{files:D,setFiles:j,editDisabled:!0===F||void 0!==U})}),"workspace"===c&&(0,J.jsx)("div",{className:"mb-6 pt-2",children:(0,J.jsx)(k6,{})})]})]})]}),E&&(0,J.jsxs)("div",{"aria-live":"polite",className:"flex items-center justify-between gap-3 border-b border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100",children:[(0,J.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,J.jsx)(v2,{className:"size-3.5 shrink-0","aria-hidden":"true"}),"Tool actions will run without review."]}),(0,J.jsx)("button",{type:"button",onClick:eo,className:"shrink-0 rounded px-2 py-1 font-semibold transition-colors hover:bg-amber-200 focus-visible:ring-2 focus-visible:ring-amber-700 dark:hover:bg-amber-900",children:"Turn Off"})]}),(ee||W>0)&&(0,J.jsxs)("div",{className:"flex items-center gap-1.5 border-t border-border px-3 py-1.5 text-xs text-muted-foreground",children:[ee&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v1,{className:"size-3.5 shrink-0 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("span",{className:"font-medium text-foreground",children:ee.name}),ee.provider&&(0,J.jsxs)("span",{children:["· ",ee.provider]})]}),W>0&&(0,J.jsxs)("button",{type:"button",onClick:t,title:`${W} background agent${1===W?"":"s"} running — click to view`,"aria-label":`${W} background agent${1===W?"":"s"} running — view`,className:"ml-auto flex shrink-0 items-center gap-1.5 rounded px-1.5 py-0.5 font-medium text-[var(--brand)] transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,J.jsx)("span",{className:"size-2 animate-pulse rounded-full bg-[var(--color-warning)]","aria-hidden":"true"}),W," agent",1===W?"":"s"]})]}),(0,J.jsxs)("form",{onSubmit:eu,className:"flex flex-col",children:[b.length>0&&(0,J.jsx)("div",{"aria-label":"Attached files",className:"flex flex-wrap gap-2 border-b border-border px-3 py-2",children:b.map(e=>(0,J.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2 py-1 text-xs text-foreground",children:[(0,J.jsx)(vJ,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,J.jsx)("span",{className:"max-w-48 truncate",title:e.path,children:e.name}),(0,J.jsx)("button",{type:"button",onClick:()=>el(e.path),"aria-label":`Remove ${e.name} from this message`,title:`Remove ${e.name} from this message`,className:"rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(rs,{className:"size-3.5","aria-hidden":"true"})})]},e.path))}),(0,J.jsx)("textarea",{ref:f,value:h,onChange:e=>g(e.target.value),onKeyDown:ed,"aria-label":"Message",disabled:en,placeholder:en?"Respond to the request above to continue…":F?"Researching…":"Ask EvoScientist anything…",className:"font-inherit field-sizing-content flex-1 resize-none border-0 bg-transparent px-3.5 pb-2.5 pt-3 text-sm leading-6 text-primary outline-none placeholder:text-tertiary disabled:cursor-not-allowed sm:px-4",rows:1}),(0,J.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2 sm:p-2.5",children:[(0,J.jsxs)("div",{className:"flex items-center gap-1",children:[(0,J.jsx)("input",{ref:m,type:"file",multiple:!0,onChange:es,disabled:ea||v,className:"hidden"}),(0,J.jsx)("button",{type:"button",onClick:()=>m.current?.click(),disabled:ea||v,"aria-label":"Upload files to workspace",title:"Upload files to workspace (max 50 MB each)",className:"inline-flex size-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:(0,J.jsx)(v4,{className:"size-4","aria-hidden":"true"})}),(0,J.jsxs)("button",{type:"button",onClick:()=>E?eo():k(!0),"aria-pressed":E,title:"Auto-approve all tool actions in this conversation",className:rZ("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium transition-colors",E?"bg-amber-600 text-white hover:bg-amber-700":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[(0,J.jsx)(v0,{className:"size-3.5","aria-hidden":"true"}),(0,J.jsx)("span",{className:"hidden min-[360px]:inline",children:E?"Auto-approve On":"Auto-approve"})]})]}),(0,J.jsx)("div",{className:"flex justify-end gap-2",children:(0,J.jsx)(na,{type:F?"button":"submit",variant:F?"destructive":"default",onClick:F?B:eu,disabled:!F&&(ea||v||!h.trim()),"aria-label":F?"Stop generating":"Send message",children:F?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(vW,{size:14}),(0,J.jsx)("span",{className:"hidden sm:inline",children:"Stop"})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(vZ,{size:18}),(0,J.jsx)("span",{className:"hidden sm:inline",children:"Send"})]})})})]})]})]})})]})});k7.displayName="ChatInterface";let Te=ro("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),Tt=ro("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]),Tr=ro("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Tn=Q.default.memo(({skill:e,onClose:t})=>{let[r,n]=(0,Q.useState)(null),[a,i]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null);if((0,Q.useEffect)(()=>{if(!e)return;let t=!1;return n(null),s(null),i(!0),fetch(`/api/skills/detail?name=${encodeURIComponent(e.name)}`).then(async e=>{let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||`Failed to load (${e.status})`);return t}).then(e=>{t||n(e)}).catch(e=>{t||s(e.message??"Failed to load skill detail.")}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),!e)return null;let l=r?.title??e.title,u=r?.version??e.version,c=r?.description??e.description,d=r?.installed??e.installed,p=r?.body;return(0,J.jsx)(rK,{open:!0,onOpenChange:t,children:(0,J.jsxs)(rJ,{"aria-describedby":void 0,className:"flex h-[80vh] max-h-[80vh] min-w-[60vw] flex-col p-6",children:[(0,J.jsx)(r1,{className:"sr-only",children:l}),(0,J.jsxs)("div",{className:"mb-3 flex items-start gap-3 border-b border-border pb-4",children:[(0,J.jsx)(a6,{className:"mt-1 size-6 shrink-0 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("div",{className:"min-w-0 flex-1",children:(0,J.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[(0,J.jsx)("h2",{className:"break-words text-lg font-semibold",children:l}),u&&(0,J.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:["v",u]}),null!=e.fileCount&&(0,J.jsxs)("span",{className:"text-xs text-muted-foreground",children:["· ",e.fileCount," file",1===e.fileCount?"":"s"]}),d&&(0,J.jsxs)("span",{className:"bg-[var(--brand)]/10 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-[var(--brand)]",children:[(0,J.jsx)(Tr,{className:"size-3","aria-hidden":"true"}),"Installed"]})]})})]}),(0,J.jsx)(ij,{className:"min-h-0 flex-1",children:(0,J.jsxs)("div",{className:"pr-3",children:[(0,J.jsx)("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-foreground",children:c||"No description."}),(0,J.jsx)("div",{className:"mt-4 border-t border-border pt-4",children:a?(0,J.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading skill contents…"]}):o?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:o}):p?(0,J.jsx)(S0,{content:p}):(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No additional contents."})})]})})]})})});function Ta(){let[e,t]=(0,Q.useState)([]),[r,n]=(0,Q.useState)([]),[a,i]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[c,d]=(0,Q.useState)({}),[p,f]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),g=(0,Q.useCallback)(async(e=!1)=>{i(!0),u(null),s(null);let[r,a]=await Promise.allSettled([fetch(`/api/skills/catalog${e?"?refresh=1":""}`).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||"Failed to load catalog");return t.skills??[]}),fetch("/api/skills").then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||"Failed to load skills");return t.skills??[]})]),o="fulfilled"===r.status?r.value:[];if("rejected"===r.status&&s(r.reason instanceof Error?r.reason.message:"Failed to load the official catalog."),t(o),"fulfilled"===a.status){let e=new Set(o.map(e=>e.name));n(a.value.filter(t=>!e.has(t.name)))}else n([]),u(a.reason instanceof Error?a.reason.message:"Failed to load installed skills.");i(!1)},[]);(0,Q.useEffect)(()=>{g()},[g]);let b=async(e,r="install")=>{d(t=>({...t,[e]:r})),u(null);try{let r=await fetch("/api/skills/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})}),n=await r.json();if(!r.ok)throw Error(n.error||"Failed to install");t(t=>t.map(t=>t.name===e?{...t,installed:!0,updateAvailable:!1,installedVersion:t.latestVersion??t.installedVersion}:t))}catch(e){u(e instanceof Error?e.message:`Failed to ${r}`)}finally{d(t=>{let r={...t};return delete r[e],r})}},y=async(e,r)=>{d(t=>({...t,[e]:"uninstall"})),u(null);try{let a=await fetch(`/api/skills?name=${encodeURIComponent(e)}`,{method:"DELETE"});if(!a.ok){let e=await a.json();throw Error(e.error||"Failed to uninstall")}r?t(t=>t.map(t=>t.name===e?{...t,installed:!1}:t)):n(t=>t.filter(t=>t.name!==e))}catch(e){u(e instanceof Error?e.message:"Failed to uninstall")}finally{d(t=>{let r={...t};return delete r[e],r})}},v=async()=>{m&&(h(null),await y(m.name,m.isCatalog))};return(0,J.jsxs)("div",{className:"h-full overflow-y-auto",children:[(0,J.jsxs)("div",{className:"mx-auto max-w-[960px] px-4 py-5 sm:px-5 sm:py-6",children:[(0,J.jsxs)("header",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,J.jsxs)("div",{children:[(0,J.jsx)("h2",{className:"text-xl font-semibold sm:text-2xl",children:"Research Skills"}),(0,J.jsxs)("p",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:["Install official skills from the"," ",(0,J.jsx)("a",{href:"https://github.com/EvoScientist/EvoSkills",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"EvoSkills"})," ","catalog, or remove ones you don't need."]})]}),(0,J.jsx)("button",{type:"button",onClick:()=>g(!0),disabled:a,"aria-label":"Refresh",className:"rounded-md p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(Te,{className:a?"size-4 animate-spin":"size-4","aria-hidden":"true"})})]}),l&&(0,J.jsx)("p",{role:"alert",className:"mb-4 text-sm text-destructive",children:l}),a?(0,J.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground","aria-live":"polite",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading skills…"]}):(0,J.jsxs)("div",{className:"space-y-6",children:[(0,J.jsxs)("section",{children:[(0,J.jsx)("h3",{className:"mb-2.5 text-xs font-semibold uppercase tracking-wider text-tertiary",children:"Official catalog"}),o?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:o}):0===e.length?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No skills found in the catalog."}):(0,J.jsx)("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",children:e.map(e=>(0,J.jsx)(Ti,{title:e.title,description:e.description,meta:`${e.fileCount} file${1===e.fileCount?"":"s"}`,installed:e.installed,installedVersion:e.installedVersion,latestVersion:e.latestVersion,updateAvailable:e.updateAvailable,busy:c[e.name],onOpen:()=>f({name:e.name,title:e.title,description:e.description,version:e.installed?e.installedVersion:e.latestVersion,fileCount:e.fileCount,installed:e.installed}),onInstall:()=>b(e.name),onUpdate:()=>b(e.name,"update"),onUninstall:()=>h({name:e.name,title:e.title,isCatalog:!0})},e.name))})]}),r.length>0&&(0,J.jsxs)("section",{children:[(0,J.jsx)("h3",{className:"mb-2.5 text-xs font-semibold uppercase tracking-wider text-tertiary",children:"Other installed skills"}),(0,J.jsx)("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",children:r.map(e=>(0,J.jsx)(Ti,{title:e.title,description:e.description,installed:!0,busy:c[e.name],onOpen:()=>f({name:e.name,title:e.title,description:e.description,installed:!0}),onUninstall:()=>h({name:e.name,title:e.title,isCatalog:!1})},e.name))})]})]})]}),(0,J.jsx)(Tn,{skill:p,onClose:()=>f(null)}),(0,J.jsx)(rK,{open:null!==m,onOpenChange:e=>{e||h(null)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Uninstall skill?"}),(0,J.jsxs)(r2,{children:["“",m?.title??m?.name,"” will be removed from this Web UI. You can install it again later."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),(0,J.jsx)(na,{onClick:v,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Uninstall"})]})]})})]})}function Ti({title:e,description:t,meta:r,installed:n,installedVersion:a,latestVersion:i,updateAvailable:o,busy:s,onOpen:l,onInstall:u,onUpdate:c,onUninstall:d}){let p=n?a&&`v${a}`:i&&`v${i}`;return(0,J.jsxs)("div",{className:"flex flex-col rounded-lg border border-border bg-card p-3",children:[(0,J.jsxs)("button",{type:"button",onClick:l,className:"-m-1 flex items-start gap-2.5 rounded-md p-1 text-left transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring",title:"View details",children:[(0,J.jsx)(a6,{className:"mt-0.5 size-5 shrink-0 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,J.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[(0,J.jsx)("h3",{className:"break-words text-lg font-medium leading-tight",children:e}),p&&(0,J.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:p}),r&&(0,J.jsxs)("span",{className:"shrink-0 text-xs text-muted-foreground",children:["· ",r]})]}),(0,J.jsx)("p",{className:"mt-1 line-clamp-2 text-sm leading-6 text-muted-foreground",children:t||"No description."})]})]}),(0,J.jsxs)("div",{className:"mt-2.5 flex items-center justify-end gap-2",children:[n&&o&&(0,J.jsxs)("button",{type:"button",onClick:c,disabled:!!s,className:"inline-flex items-center gap-1.5 rounded-md bg-[var(--brand-solid)] px-2.5 py-1 text-xs font-medium text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",title:i?`Update to v${i}`:"Update",children:["update"===s?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(Tt,{className:"size-3.5","aria-hidden":"true"}),"update"===s?"Updating…":i?`Update → v${i}`:"Update"]}),n?(0,J.jsxs)("button",{type:"button",onClick:d,disabled:!!s,className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:["uninstall"===s?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(a8,{className:"size-3.5","aria-hidden":"true"}),"uninstall"===s?"Removing…":"Uninstall"]}):(0,J.jsxs)("button",{type:"button",onClick:u,disabled:!!s,className:"inline-flex items-center gap-1.5 rounded-md bg-[var(--brand-solid)] px-2.5 py-1 text-xs font-medium text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:["install"===s?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(kj,{className:"size-3.5","aria-hidden":"true"}),"install"===s?"Installing…":"Install"]})]})]})}Tn.displayName="SkillDetailDialog";let To=ro("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Ts=ro("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Tl={json:"json",yaml:"yaml",yml:"yaml",csv:"text",tsv:"text",log:"text",txt:"text",tex:"latex",bib:"latex",rst:"markdown"},Tu=["Core memory","Profile","Projects","Evolution reports"];function Tc(e){let t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}function Td(e){return e.split("/").pop()||e}function Tp(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}let Tf="evoscientist-memory-list-width";function Tm(e,t){return Math.min(Math.max(e,200),t?Math.max(280,t.clientWidth-360):640)}function Th(){var e;let t,[r,n]=(0,Q.useState)(null),[a,i]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[c,d]=(0,Q.useState)(null),[p,f]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,b]=(0,Q.useState)(!1),[y,v]=(0,Q.useState)(""),[_,w]=(0,Q.useState)(!1),[E,x]=(0,Q.useState)(!1),[S,k]=(0,Q.useState)(!1),[T,A]=(0,Q.useState)(""),[N,I]=(0,Q.useState)(!1),[C,R]=(0,Q.useState)(null),[O,L]=(0,Q.useState)(!1),[P,D]=(0,Q.useState)(!1),[M,j]=(0,Q.useState)(!1),F=(0,Q.useRef)(!1),$=(0,Q.useRef)(0),U=(0,Q.useRef)(null),z=function(){let[e,t]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{let e=window.matchMedia("(min-width: 768px)"),r=()=>t(e.matches);return r(),e.addEventListener("change",r),()=>e.removeEventListener("change",r)},[]),e}(),B=(0,Q.useRef)(null),H=(0,Q.useRef)(null),G=(0,Q.useRef)(null),[V,q]=(0,Q.useState)(()=>{let e=Number(window.localStorage.getItem(Tf));return Number.isFinite(e)&&e>=200?e:256});(0,Q.useEffect)(()=>{try{window.localStorage.setItem(Tf,String(V))}catch{}},[V]);let W=(0,Q.useCallback)(e=>{if(B.current=e,G.current?.disconnect(),G.current=null,e&&"u">typeof ResizeObserver){let t=new ResizeObserver(()=>{window.matchMedia("(min-width: 768px)").matches&&q(t=>Tm(t,e))});t.observe(e),G.current=t}},[]);(0,Q.useEffect)(()=>()=>H.current?.(),[]);let Z=(0,Q.useCallback)(e=>{e.preventDefault(),H.current?.();let t=e.clientX,r=new AbortController,n=()=>{r.abort(),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select"),H.current=null},a={signal:r.signal};window.addEventListener("pointermove",e=>{q(Tm(V+(e.clientX-t),B.current))},a),window.addEventListener("pointerup",n,a),window.addEventListener("pointercancel",n,a),window.addEventListener("blur",n,a),document.body.style.cursor="col-resize",document.body.style.userSelect="none",H.current=n},[V]),K=(0,Q.useCallback)(async()=>{i(!0),s(null);try{let e=await fetch("/api/memory"),t=await e.json();if(!e.ok)throw Error(t.error||"Failed to load memory.");n(t);let r=t.entries.reduce((e,t)=>t.mtime>e?t.mtime:e,0);r>0&&uv(r)}catch(e){s(e instanceof Error?e.message:"Failed to load memory.")}finally{i(!1)}},[]);(0,Q.useEffect)(()=>{K()},[K]);let[Y,X]=(0,Q.useState)(()=>Date.now());(0,Q.useEffect)(()=>{let e=setInterval(()=>X(Date.now()),6e4);return()=>clearInterval(e)},[]);let ee=(0,Q.useMemo)(()=>{let e=r?.entries??[],t=new Map;for(let r of e){let e=function(e){let t=e.split("/");return"profile"===t[0]?"projects"===t[1]?"Projects":"Profile":"evolution-reports"===t[0]?"Evolution reports":1===t.length?"Core memory":t[0]}(r.path);(t.get(e)??t.set(e,[]).get(e)).push(r)}return[...t.keys()].sort((e,t)=>{let r=Tu.indexOf(e),n=Tu.indexOf(t);return -1!==r||-1!==n?(-1===r?99:r)-(-1===n?99:n):e.localeCompare(t)}).map(e=>({name:e,files:t.get(e).sort((e,t)=>e.path.localeCompare(t.path))}))},[r]),et=(0,Q.useCallback)(async e=>{let t=++$.current;u(e),b(!1),d(null),h(null),f(!0);try{let r=await fetch(`/api/memory?path=${encodeURIComponent(e)}`),n=await r.json();if(t!==$.current)return;if(!r.ok)throw Error(n.error||"Failed to open file.");d(n)}catch(e){if(t!==$.current)return;h(e instanceof Error?e.message:"Failed to open file.")}finally{t===$.current&&f(!1)}},[]);(0,Q.useEffect)(()=>{if(F.current||l)return;let e=ee[0]?.files[0];e&&(F.current=!0,et(e.path))},[ee,l,et]);let er=async()=>{if(!l)return;let e=$.current;w(!0),h(null);try{let t=await fetch("/api/memory",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:l,content:y})}),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to save.");e===$.current&&(d(r),b(!1)),K()}catch(t){e===$.current&&h(t instanceof Error?t.message:"Failed to save.")}finally{w(!1)}},en=async()=>{if(!l)return;let e=$.current;D(!0);try{let t=await fetch(`/api/memory?path=${encodeURIComponent(l)}`,{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to delete.")}e===$.current&&(u(null),d(null),b(!1)),L(!1),K()}catch(t){e===$.current&&h(t instanceof Error?t.message:"Failed to delete.")}finally{D(!1)}},ea=async()=>{c&&await kl(c.content)&&(x(!0),setTimeout(()=>x(!1),1500))},ei=async()=>{let e=T.trim();if(!e)return void R("Enter a file name.");/\.[A-Za-z0-9]+$/.test(e)||(e+=".md"),I(!0),R(null);try{let t=await fetch("/api/memory",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,content:`# ${Td(e).replace(/\.[^.]+$/,"")}
|
|
73
|
+
${b.map(e=>`- ${e.path}`).join("\n")}`:"";z(`${t}${r}`),g(""),y([])},[h,E,F,v,b,z,g,ei,w]),ep=(0,Q.useCallback)(e=>{ei||!e.nativeEvent.isComposing&&229!==e.keyCode&&("Enter"!==e.key||e.shiftKey||(e.preventDefault(),ed()))},[ed,ei]),ef=(0,Q.useCallback)(e=>{g(e),requestAnimationFrame(()=>{let t=f.current;t&&(t.focus(),t.setSelectionRange(e.length,e.length))})},[]),em=(0,Q.useCallback)(e=>{g(e),requestAnimationFrame(()=>f.current?.focus())},[]);(0,Q.useEffect)(()=>{if(!E)return;let e=U?.value&&U.value.action_requests;if(!U||!Array.isArray(e)||0===e.length){T.current=null;return}T.current!==U&&(T.current=U,H({decisions:e.map(()=>({type:"approve"}))}))},[E,U,H]);let eh=(0,Q.useMemo)(()=>{let e=U?.value;return e?.type==="ask_user"&&Array.isArray(e.questions)?e.questions:null},[U]),eg=(0,Q.useCallback)(e=>{H({status:"answered",answers:e})},[H]),eb=(0,Q.useCallback)(()=>{H({status:"cancelled"})},[H]),ey=(0,Q.useMemo)(()=>{let e=new Map,t=new Set;L.filter(e=>{let r,n=O.getMessagesMetadata(e)?.streamMetadata,a=n?.langgraph_checkpoint_ns;if("string"==typeof a&&a.includes("|")||function(e){if("human"===e.type){var t;if("human"!==e.type)return!1;let r=e.additional_kwargs;return r?.lc_source==="summarization"}return"ai"===e.type&&!!(t=vB(e))&&(!!(/\bconversation that has been summarized\b/.test(t)||/\bHere is a summary of the conversation to date\b/.test(t)||/<summary>[\s\S]*<\/summary>/.test(t))||/##\s+SESSION INTENT\b/.test(t))}(e))return!1;if("human"!==e.type)return!0;let i=(r=S8(vB(e)))?`${r.taskId}:${r.runId||"legacy"}`:null;return!i||!t.has(i)&&(t.add(i),!0)}).forEach(t=>{if("ai"===t.type){let r,n=(r=[],t.additional_kwargs?.tool_calls&&Array.isArray(t.additional_kwargs.tool_calls)?r.push(...t.additional_kwargs.tool_calls):t.tool_calls&&Array.isArray(t.tool_calls)?r.push(...t.tool_calls.filter(e=>""!==e.name)):Array.isArray(t.content)&&r.push(...t.content.filter(e=>"tool_use"===e.type)),r.map(e=>{let t=e.function?.arguments||e.args||e.input||{};return{id:e.id,name:e.function?.name||e.name||e.type||"",args:t&&"object"==typeof t?t:{}}})).filter(e=>"ToolSelectionResponse"!==e.name||F&&!U).map((e,r)=>{let n=e.name||"unknown";return{id:e.id||`${t.id??"ai-message"}-tool-${r}-${n}`,name:n,args:e.args,status:U?"interrupted":"pending"}});e.set(t.id,{message:t,toolCalls:n})}else if("tool"===t.type){let r=t.tool_call_id;if(!r)return;for(let[,n]of e.entries()){let e=n.toolCalls.findIndex(e=>e.id===r);if(-1!==e){n.toolCalls[e]={...n.toolCalls[e],status:"completed",result:vB(t)};break}}}else"human"===t.type&&e.set(t.id,{message:t,toolCalls:[]})});let r=Array.from(e.values());return r.map((e,t)=>{let n=t>0?r[t-1].message:null;return{...e,showAvatar:e.message.type!==n?.type}})},[L,U,F,O]),ev=(0,Q.useMemo)(()=>{if(!q)return null;let e=new Set(ey.map(e=>e.message.id));for(let t=q.cutoffIndex;t<L.length;t++){let r=L[t]?.id;if(null!=r&&e.has(r))return r}return null},[q,L,ey]),e_={in_progress:P.filter(e=>"in_progress"===e.status),pending:P.filter(e=>"pending"===e.status),completed:P.filter(e=>"completed"===e.status)},ew=P.length>0,eE=Object.keys(D).length>0,ex=(0,Q.useMemo)(()=>{let e=U?.value&&U.value.action_requests;return Array.isArray(e)?e:[]},[U]),[eS,ek]=(0,Q.useState)(()=>new Set);(0,Q.useEffect)(()=>{0===ex.length&&ek(new Set)},[ex.length]);let eT=(0,Q.useCallback)(e=>{ek(t=>{let r=new Set(t);return r.add(e),r})},[]),eA=(0,Q.useMemo)(()=>{let e=U?.value&&U.value.review_configs;if(!Array.isArray(e))return new Map;let t=[];for(let r of e){let e=r.actionName??r.action_name;e&&t.push([e,{actionName:e,allowedDecisions:r.allowedDecisions??r.allowed_decisions}])}return new Map(t)},[U]);return(0,J.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,J.jsx)(rK,{open:S,onOpenChange:k,children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Enable Auto-approve?"}),(0,J.jsx)(r2,{children:"EvoScientist will run tool actions in this research without asking you to review each one. Turn this on only when you trust the current task and deployment."})]}),(0,J.jsxs)("div",{className:"flex items-start gap-3 rounded-lg border border-amber-300 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100",children:[(0,J.jsx)(v3,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),(0,J.jsx)("p",{children:"Auto-approve stays on for this research only — it follows this conversation across views and reloads, and other research keeps its own setting. Turn it off here anytime."})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),(0,J.jsx)(na,{onClick:eo,className:"bg-amber-600 text-white hover:bg-amber-700",children:"Enable Auto-approve"})]})]})}),(0,J.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden overscroll-contain",ref:I,children:(0,J.jsx)("div",{className:"mx-auto w-full max-w-[960px] px-4 pb-4 pt-3 sm:px-5",ref:C,children:$?(0,J.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,J.jsx)("p",{className:"text-muted-foreground",children:"Loading…"})}):(0,J.jsxs)(J.Fragment,{children:[0===ey.length&&!F&&(0,J.jsxs)("div",{className:"flex min-h-[42vh] flex-col items-center justify-center px-3 text-center",children:[(0,J.jsx)("h2",{className:"text-pretty text-lg font-semibold sm:text-xl",children:"Start Research"}),(0,J.jsx)("p",{className:"mt-2 max-w-lg text-sm text-muted-foreground",children:"Ask EvoScientist to review literature, inspect workspace files, or plan the next experiment."}),(0,J.jsx)("div",{className:"mt-4 flex max-w-2xl flex-wrap justify-center gap-2",children:k7.map(e=>(0,J.jsx)("button",{type:"button",onClick:()=>em(e),className:"max-w-full rounded-full border border-border bg-card px-2.5 py-1.5 text-xs text-foreground shadow-sm transition-colors hover:border-[var(--color-border)] hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring sm:text-sm",children:e},e))})]}),ey.map((t,r)=>{let n=M?.filter(e=>e.metadata?.message_id===t.message.id),a=r===ey.length-1,i=ev===t.message.id;return(0,J.jsxs)(Q.default.Fragment,{children:[i&&q&&(0,J.jsx)(kd,{content:q.content,summarizedCount:q.cutoffIndex}),(0,J.jsx)(ku,{message:t.message,toolCalls:t.toolCalls,isLoading:F,actionRequests:a?ex:void 0,submittedActionRequestKeys:eS,onActionRequestSubmitted:eT,reviewConfigsMap:a?eA:void 0,ui:n,stream:O,onResumeInterrupt:H,graphId:e?.graph_id,onEditMessage:ef,autoApprove:E,subAgentSteps:er})]},t.message.id)}),q&&!ev&&(0,J.jsx)(kd,{content:q.content,summarizedCount:q.cutoffIndex}),eh&&(0,J.jsx)("div",{className:"mt-4",children:(0,J.jsx)(km,{questions:eh,onSubmit:eg,onCancel:eb,isLoading:F})})]})})}),(0,J.jsx)("div",{className:"flex-shrink-0 bg-background",children:(0,J.jsxs)("div",{className:rZ("mb-2 flex flex-shrink-0 flex-col overflow-hidden rounded-lg border border-border bg-background sm:mb-4","mx-auto w-[calc(100%-16px)] max-w-[960px] transition-colors duration-200 ease-in-out sm:w-[calc(100%-24px)]","focus-within:ring-2 focus-within:ring-ring"),children:[(0,J.jsxs)("div",{className:"flex max-h-60 flex-col overflow-y-auto border-b border-border bg-sidebar empty:hidden sm:max-h-72",children:[!c&&(0,J.jsx)(J.Fragment,{children:(n=P.find(e=>"in_progress"===e.status),i=(a=P.length)-e_.pending.length,o=a===i,s=ew?(0,J.jsx)("button",{type:"button",onClick:()=>d(e=>"tasks"===e?null:"tasks"),className:"grid w-full cursor-pointer grid-cols-[auto_auto_1fr] items-center gap-2.5 px-3 py-2.5 text-left sm:px-4","aria-expanded":"tasks"===c,children:o?[(0,J.jsx)(vX,{size:16,className:"text-[var(--color-success)]"},"icon"),(0,J.jsx)("span",{className:"ml-[1px] min-w-0 truncate text-sm",children:"All tasks completed"},"label")]:null!=n?[(0,J.jsx)("div",{children:Te(n.status)},"icon"),(0,J.jsxs)("span",{className:"ml-[1px] min-w-0 truncate text-sm",children:["Task"," ",a-e_.pending.length," ","of ",a]},"label"),(0,J.jsx)("span",{className:"min-w-0 gap-2 truncate text-sm text-muted-foreground",children:n.content},"content")]:[(0,J.jsx)(vQ,{size:16,className:"text-[var(--color-text-tertiary)]"},"icon"),(0,J.jsxs)("span",{className:"ml-[1px] min-w-0 truncate text-sm",children:["Task"," ",a-e_.pending.length," of"," ",a]},"label")]}):null,l=eE?(0,J.jsxs)("button",{type:"button",onClick:()=>d(e=>"files"===e?null:"files"),className:"flex flex-shrink-0 cursor-pointer items-center gap-2 px-3 py-2.5 text-left text-sm sm:px-4","aria-expanded":"files"===c,children:[(0,J.jsx)(v0,{size:16}),"Files (State)",(0,J.jsx)("span",{className:"h-4 min-w-4 rounded-full bg-[var(--brand-solid)] px-0.5 text-center text-[10px] leading-[16px] text-[var(--brand-foreground)]",children:Object.keys(D).length})]}):null,u=(0,J.jsxs)("button",{type:"button",onClick:()=>d(e=>"workspace"===e?null:"workspace"),className:"flex flex-shrink-0 cursor-pointer items-center gap-2 px-3 py-2.5 text-left text-sm sm:px-4","aria-expanded":"workspace"===c,"aria-label":"Open workspace",children:[(0,J.jsx)(v1,{size:16,"aria-hidden":"true"}),(0,J.jsx)("span",{children:"Workspace"})]}),(0,J.jsxs)("div",{className:"flex items-center",children:[(0,J.jsx)("div",{className:"min-w-0 flex-1",children:s}),l,u]}))}),c&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"sticky top-0 flex items-stretch bg-sidebar text-sm",children:[ew&&(0,J.jsx)("button",{type:"button",className:"py-2.5 pr-4 first:pl-3 aria-expanded:font-semibold sm:first:pl-4",onClick:()=>d(e=>"tasks"===e?null:"tasks"),"aria-expanded":"tasks"===c,children:"Tasks"}),eE&&(0,J.jsxs)("button",{type:"button",className:"inline-flex items-center gap-2 py-2.5 pr-4 first:pl-3 aria-expanded:font-semibold sm:first:pl-4",onClick:()=>d(e=>"files"===e?null:"files"),"aria-expanded":"files"===c,children:["Files (State)",(0,J.jsx)("span",{className:"h-4 min-w-4 rounded-full bg-[var(--brand-solid)] px-0.5 text-center text-[10px] leading-[16px] text-[var(--brand-foreground)]",children:Object.keys(D).length})]}),(0,J.jsx)("button",{type:"button",className:"inline-flex items-center gap-2 py-2.5 pr-4 first:pl-3 aria-expanded:font-semibold sm:first:pl-4",onClick:()=>d(e=>"workspace"===e?null:"workspace"),"aria-expanded":"workspace"===c,children:"Workspace"}),(0,J.jsx)("button",{"aria-label":"Close",className:"flex-1",onClick:()=>d(null)})]}),(0,J.jsxs)("div",{ref:p,className:"px-3 sm:px-4",children:["tasks"===c&&Object.entries(e_).filter(([e,t])=>t.length>0).map(([e,t])=>(0,J.jsxs)("div",{className:"mb-4",children:[(0,J.jsx)("h3",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-tertiary",children:{pending:"Pending",in_progress:"In Progress",completed:"Completed"}[e]}),(0,J.jsx)("div",{className:"grid grid-cols-[auto_1fr] gap-3 rounded-sm p-1 pl-0 text-sm",children:t.map((t,r)=>(0,J.jsxs)(Q.Fragment,{children:[Te(t.status,"mt-0.5"),(0,J.jsx)("span",{className:"break-words text-inherit",children:t.content})]},`${e}_${t.id}_${r}`))})]},e)),"files"===c&&(0,J.jsx)("div",{className:"mb-6",children:(0,J.jsx)(kV,{files:D,setFiles:j,editDisabled:!0===F||void 0!==U})}),"workspace"===c&&(0,J.jsx)("div",{className:"mb-6 pt-2",children:(0,J.jsx)(k8,{})})]})]})]}),E&&(0,J.jsxs)("div",{"aria-live":"polite",className:"flex items-center justify-between gap-3 border-b border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100",children:[(0,J.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,J.jsx)(v3,{className:"size-3.5 shrink-0","aria-hidden":"true"}),"Tool actions will run without review."]}),(0,J.jsx)("button",{type:"button",onClick:es,className:"shrink-0 rounded px-2 py-1 font-semibold transition-colors hover:bg-amber-200 focus-visible:ring-2 focus-visible:ring-amber-700 dark:hover:bg-amber-900",children:"Turn Off"})]}),(et||Z>0)&&(0,J.jsxs)("div",{className:"flex items-center gap-1.5 border-t border-border px-3 py-1.5 text-xs text-muted-foreground",children:[et&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v4,{className:"size-3.5 shrink-0 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("span",{className:"font-medium text-foreground",children:et.name}),et.provider&&(0,J.jsxs)("span",{children:["· ",et.provider]})]}),Z>0&&(0,J.jsxs)("button",{type:"button",onClick:t,title:`${Z} background agent${1===Z?"":"s"} running — click to view`,"aria-label":`${Z} background agent${1===Z?"":"s"} running — view`,className:"ml-auto flex shrink-0 items-center gap-1.5 rounded px-1.5 py-0.5 font-medium text-[var(--brand)] transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,J.jsx)("span",{className:"size-2 animate-pulse rounded-full bg-[var(--color-warning)]","aria-hidden":"true"}),Z," agent",1===Z?"":"s"]})]}),(0,J.jsxs)("form",{onSubmit:ed,className:"flex flex-col",children:[b.length>0&&(0,J.jsx)("div",{"aria-label":"Attached files",className:"flex flex-wrap gap-2 border-b border-border px-3 py-2",children:b.map(e=>(0,J.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2 py-1 text-xs text-foreground",children:[(0,J.jsx)(v0,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,J.jsx)("span",{className:"max-w-48 truncate",title:e.path,children:e.name}),(0,J.jsx)("button",{type:"button",onClick:()=>eu(e.path),"aria-label":`Remove ${e.name} from this message`,title:`Remove ${e.name} from this message`,className:"rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(rs,{className:"size-3.5","aria-hidden":"true"})})]},e.path))}),(0,J.jsx)("textarea",{ref:f,value:h,onChange:e=>g(e.target.value),onKeyDown:ep,"aria-label":"Message",disabled:ea,placeholder:ea?"Respond to the request above to continue…":F?"Researching…":"Ask EvoScientist anything…",className:"font-inherit field-sizing-content flex-1 resize-none border-0 bg-transparent px-3.5 pb-2.5 pt-3 text-sm leading-6 text-primary outline-none placeholder:text-tertiary disabled:cursor-not-allowed sm:px-4",rows:1}),(0,J.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2 sm:p-2.5",children:[(0,J.jsxs)("div",{className:"flex items-center gap-1",children:[(0,J.jsx)("input",{ref:m,type:"file",multiple:!0,onChange:el,disabled:ei||v,className:"hidden"}),(0,J.jsx)("button",{type:"button",onClick:()=>m.current?.click(),disabled:ei||v,"aria-label":"Upload files to workspace",title:"Upload files to workspace (max 50 MB each)",className:"inline-flex size-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:(0,J.jsx)(v5,{className:"size-4","aria-hidden":"true"})}),(0,J.jsxs)("button",{type:"button",onClick:()=>E?es():k(!0),"aria-pressed":E,title:"Auto-approve all tool actions in this conversation",className:rZ("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium transition-colors",E?"bg-amber-600 text-white hover:bg-amber-700":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[(0,J.jsx)(v2,{className:"size-3.5","aria-hidden":"true"}),(0,J.jsx)("span",{className:"hidden min-[360px]:inline",children:E?"Auto-approve On":"Auto-approve"})]})]}),(0,J.jsx)("div",{className:"flex justify-end gap-2",children:(0,J.jsx)(na,{type:F?"button":"submit",variant:F?"destructive":"default",onClick:F?B:ed,disabled:!F&&(ei||v||!h.trim()),"aria-label":F?"Stop generating":"Send message",children:F?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(vK,{size:14}),(0,J.jsx)("span",{className:"hidden sm:inline",children:"Stop"})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(vY,{size:18}),(0,J.jsx)("span",{className:"hidden sm:inline",children:"Send"})]})})})]})]})]})})]})});Tt.displayName="ChatInterface";let Tr=ro("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),Tn=ro("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]),Ta=ro("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Ti=Q.default.memo(({skill:e,onClose:t})=>{let[r,n]=(0,Q.useState)(null),[a,i]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null);if((0,Q.useEffect)(()=>{if(!e)return;let t=!1;return n(null),s(null),i(!0),fetch(`/api/skills/detail?name=${encodeURIComponent(e.name)}`).then(async e=>{let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||`Failed to load (${e.status})`);return t}).then(e=>{t||n(e)}).catch(e=>{t||s(e.message??"Failed to load skill detail.")}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),!e)return null;let l=r?.title??e.title,u=r?.version??e.version,c=r?.description??e.description,d=r?.installed??e.installed,p=r?.body;return(0,J.jsx)(rK,{open:!0,onOpenChange:t,children:(0,J.jsxs)(rJ,{"aria-describedby":void 0,className:"flex h-[80vh] max-h-[80vh] min-w-[60vw] flex-col p-6",children:[(0,J.jsx)(r1,{className:"sr-only",children:l}),(0,J.jsxs)("div",{className:"mb-3 flex items-start gap-3 border-b border-border pb-4",children:[(0,J.jsx)(a6,{className:"mt-1 size-6 shrink-0 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("div",{className:"min-w-0 flex-1",children:(0,J.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[(0,J.jsx)("h2",{className:"break-words text-lg font-semibold",children:l}),u&&(0,J.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:["v",u]}),null!=e.fileCount&&(0,J.jsxs)("span",{className:"text-xs text-muted-foreground",children:["· ",e.fileCount," file",1===e.fileCount?"":"s"]}),d&&(0,J.jsxs)("span",{className:"bg-[var(--brand)]/10 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-[var(--brand)]",children:[(0,J.jsx)(Ta,{className:"size-3","aria-hidden":"true"}),"Installed"]})]})})]}),(0,J.jsx)(ij,{className:"min-h-0 flex-1",children:(0,J.jsxs)("div",{className:"pr-3",children:[(0,J.jsx)("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-foreground",children:c||"No description."}),(0,J.jsx)("div",{className:"mt-4 border-t border-border pt-4",children:a?(0,J.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading skill contents…"]}):o?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:o}):p?(0,J.jsx)(S2,{content:p}):(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No additional contents."})})]})})]})})});function To(){let[e,t]=(0,Q.useState)([]),[r,n]=(0,Q.useState)([]),[a,i]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[c,d]=(0,Q.useState)({}),[p,f]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),g=(0,Q.useCallback)(async(e=!1)=>{i(!0),u(null),s(null);let[r,a]=await Promise.allSettled([fetch(`/api/skills/catalog${e?"?refresh=1":""}`).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||"Failed to load catalog");return t.skills??[]}),fetch("/api/skills").then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||"Failed to load skills");return t.skills??[]})]),o="fulfilled"===r.status?r.value:[];if("rejected"===r.status&&s(r.reason instanceof Error?r.reason.message:"Failed to load the official catalog."),t(o),"fulfilled"===a.status){let e=new Set(o.map(e=>e.name));n(a.value.filter(t=>!e.has(t.name)))}else n([]),u(a.reason instanceof Error?a.reason.message:"Failed to load installed skills.");i(!1)},[]);(0,Q.useEffect)(()=>{g()},[g]);let b=async(e,r="install")=>{d(t=>({...t,[e]:r})),u(null);try{let r=await fetch("/api/skills/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})}),n=await r.json();if(!r.ok)throw Error(n.error||"Failed to install");t(t=>t.map(t=>t.name===e?{...t,installed:!0,updateAvailable:!1,installedVersion:t.latestVersion??t.installedVersion}:t))}catch(e){u(e instanceof Error?e.message:`Failed to ${r}`)}finally{d(t=>{let r={...t};return delete r[e],r})}},y=async(e,r)=>{d(t=>({...t,[e]:"uninstall"})),u(null);try{let a=await fetch(`/api/skills?name=${encodeURIComponent(e)}`,{method:"DELETE"});if(!a.ok){let e=await a.json();throw Error(e.error||"Failed to uninstall")}r?t(t=>t.map(t=>t.name===e?{...t,installed:!1}:t)):n(t=>t.filter(t=>t.name!==e))}catch(e){u(e instanceof Error?e.message:"Failed to uninstall")}finally{d(t=>{let r={...t};return delete r[e],r})}},v=async()=>{m&&(h(null),await y(m.name,m.isCatalog))};return(0,J.jsxs)("div",{className:"h-full overflow-y-auto",children:[(0,J.jsxs)("div",{className:"mx-auto max-w-[960px] px-4 py-5 sm:px-5 sm:py-6",children:[(0,J.jsxs)("header",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,J.jsxs)("div",{children:[(0,J.jsx)("h2",{className:"text-xl font-semibold sm:text-2xl",children:"Research Skills"}),(0,J.jsxs)("p",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:["Install official skills from the"," ",(0,J.jsx)("a",{href:"https://github.com/EvoScientist/EvoSkills",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"EvoSkills"})," ","catalog, or remove ones you don't need."]})]}),(0,J.jsx)("button",{type:"button",onClick:()=>g(!0),disabled:a,"aria-label":"Refresh",className:"rounded-md p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(Tr,{className:a?"size-4 animate-spin":"size-4","aria-hidden":"true"})})]}),l&&(0,J.jsx)("p",{role:"alert",className:"mb-4 text-sm text-destructive",children:l}),a?(0,J.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground","aria-live":"polite",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading skills…"]}):(0,J.jsxs)("div",{className:"space-y-6",children:[(0,J.jsxs)("section",{children:[(0,J.jsx)("h3",{className:"mb-2.5 text-xs font-semibold uppercase tracking-wider text-tertiary",children:"Official catalog"}),o?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:o}):0===e.length?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No skills found in the catalog."}):(0,J.jsx)("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",children:e.map(e=>(0,J.jsx)(Ts,{title:e.title,description:e.description,meta:`${e.fileCount} file${1===e.fileCount?"":"s"}`,installed:e.installed,installedVersion:e.installedVersion,latestVersion:e.latestVersion,updateAvailable:e.updateAvailable,busy:c[e.name],onOpen:()=>f({name:e.name,title:e.title,description:e.description,version:e.installed?e.installedVersion:e.latestVersion,fileCount:e.fileCount,installed:e.installed}),onInstall:()=>b(e.name),onUpdate:()=>b(e.name,"update"),onUninstall:()=>h({name:e.name,title:e.title,isCatalog:!0})},e.name))})]}),r.length>0&&(0,J.jsxs)("section",{children:[(0,J.jsx)("h3",{className:"mb-2.5 text-xs font-semibold uppercase tracking-wider text-tertiary",children:"Other installed skills"}),(0,J.jsx)("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",children:r.map(e=>(0,J.jsx)(Ts,{title:e.title,description:e.description,installed:!0,busy:c[e.name],onOpen:()=>f({name:e.name,title:e.title,description:e.description,installed:!0}),onUninstall:()=>h({name:e.name,title:e.title,isCatalog:!1})},e.name))})]})]})]}),(0,J.jsx)(Ti,{skill:p,onClose:()=>f(null)}),(0,J.jsx)(rK,{open:null!==m,onOpenChange:e=>{e||h(null)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Uninstall skill?"}),(0,J.jsxs)(r2,{children:["“",m?.title??m?.name,"” will be removed from this Web UI. You can install it again later."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),(0,J.jsx)(na,{onClick:v,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Uninstall"})]})]})})]})}function Ts({title:e,description:t,meta:r,installed:n,installedVersion:a,latestVersion:i,updateAvailable:o,busy:s,onOpen:l,onInstall:u,onUpdate:c,onUninstall:d}){let p=n?a&&`v${a}`:i&&`v${i}`;return(0,J.jsxs)("div",{className:"flex flex-col rounded-lg border border-border bg-card p-3",children:[(0,J.jsxs)("button",{type:"button",onClick:l,className:"-m-1 flex items-start gap-2.5 rounded-md p-1 text-left transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring",title:"View details",children:[(0,J.jsx)(a6,{className:"mt-0.5 size-5 shrink-0 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,J.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[(0,J.jsx)("h3",{className:"break-words text-lg font-medium leading-tight",children:e}),p&&(0,J.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:p}),r&&(0,J.jsxs)("span",{className:"shrink-0 text-xs text-muted-foreground",children:["· ",r]})]}),(0,J.jsx)("p",{className:"mt-1 line-clamp-2 text-sm leading-6 text-muted-foreground",children:t||"No description."})]})]}),(0,J.jsxs)("div",{className:"mt-2.5 flex items-center justify-end gap-2",children:[n&&o&&(0,J.jsxs)("button",{type:"button",onClick:c,disabled:!!s,className:"inline-flex items-center gap-1.5 rounded-md bg-[var(--brand-solid)] px-2.5 py-1 text-xs font-medium text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",title:i?`Update to v${i}`:"Update",children:["update"===s?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(Tn,{className:"size-3.5","aria-hidden":"true"}),"update"===s?"Updating…":i?`Update → v${i}`:"Update"]}),n?(0,J.jsxs)("button",{type:"button",onClick:d,disabled:!!s,className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:["uninstall"===s?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(a8,{className:"size-3.5","aria-hidden":"true"}),"uninstall"===s?"Removing…":"Uninstall"]}):(0,J.jsxs)("button",{type:"button",onClick:u,disabled:!!s,className:"inline-flex items-center gap-1.5 rounded-md bg-[var(--brand-solid)] px-2.5 py-1 text-xs font-medium text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:["install"===s?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(k$,{className:"size-3.5","aria-hidden":"true"}),"install"===s?"Installing…":"Install"]})]})]})}Ti.displayName="SkillDetailDialog";let Tl=ro("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Tu=ro("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Tc={json:"json",yaml:"yaml",yml:"yaml",csv:"text",tsv:"text",log:"text",txt:"text",tex:"latex",bib:"latex",rst:"markdown"},Td=["Core memory","Profile","Projects","Evolution reports"];function Tp(e){let t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}function Tf(e){return e.split("/").pop()||e}function Tm(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}let Th="evoscientist-memory-list-width";function Tg(e,t){return Math.min(Math.max(e,200),t?Math.max(280,t.clientWidth-360):640)}function Tb(){var e;let t,[r,n]=(0,Q.useState)(null),[a,i]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[c,d]=(0,Q.useState)(null),[p,f]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,b]=(0,Q.useState)(!1),[y,v]=(0,Q.useState)(""),[_,w]=(0,Q.useState)(!1),[E,x]=(0,Q.useState)(!1),[S,k]=(0,Q.useState)(!1),[T,A]=(0,Q.useState)(""),[N,I]=(0,Q.useState)(!1),[C,R]=(0,Q.useState)(null),[O,L]=(0,Q.useState)(!1),[P,D]=(0,Q.useState)(!1),[M,j]=(0,Q.useState)(!1),F=(0,Q.useRef)(!1),$=(0,Q.useRef)(0),U=(0,Q.useRef)(null),z=function(){let[e,t]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{let e=window.matchMedia("(min-width: 768px)"),r=()=>t(e.matches);return r(),e.addEventListener("change",r),()=>e.removeEventListener("change",r)},[]),e}(),B=(0,Q.useRef)(null),H=(0,Q.useRef)(null),G=(0,Q.useRef)(null),[V,q]=(0,Q.useState)(()=>{let e=Number(window.localStorage.getItem(Th));return Number.isFinite(e)&&e>=200?e:256});(0,Q.useEffect)(()=>{try{window.localStorage.setItem(Th,String(V))}catch{}},[V]);let W=(0,Q.useCallback)(e=>{if(B.current=e,G.current?.disconnect(),G.current=null,e&&"u">typeof ResizeObserver){let t=new ResizeObserver(()=>{window.matchMedia("(min-width: 768px)").matches&&q(t=>Tg(t,e))});t.observe(e),G.current=t}},[]);(0,Q.useEffect)(()=>()=>H.current?.(),[]);let Z=(0,Q.useCallback)(e=>{e.preventDefault(),H.current?.();let t=e.clientX,r=new AbortController,n=()=>{r.abort(),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select"),H.current=null},a={signal:r.signal};window.addEventListener("pointermove",e=>{q(Tg(V+(e.clientX-t),B.current))},a),window.addEventListener("pointerup",n,a),window.addEventListener("pointercancel",n,a),window.addEventListener("blur",n,a),document.body.style.cursor="col-resize",document.body.style.userSelect="none",H.current=n},[V]),K=(0,Q.useCallback)(async()=>{i(!0),s(null);try{let e=await fetch("/api/memory"),t=await e.json();if(!e.ok)throw Error(t.error||"Failed to load memory.");n(t);let r=t.entries.reduce((e,t)=>t.mtime>e?t.mtime:e,0);r>0&&uv(r)}catch(e){s(e instanceof Error?e.message:"Failed to load memory.")}finally{i(!1)}},[]);(0,Q.useEffect)(()=>{K()},[K]);let[Y,X]=(0,Q.useState)(()=>Date.now());(0,Q.useEffect)(()=>{let e=setInterval(()=>X(Date.now()),6e4);return()=>clearInterval(e)},[]);let ee=(0,Q.useMemo)(()=>{let e=r?.entries??[],t=new Map;for(let r of e){let e=function(e){let t=e.split("/");return"profile"===t[0]?"projects"===t[1]?"Projects":"Profile":"evolution-reports"===t[0]?"Evolution reports":1===t.length?"Core memory":t[0]}(r.path);(t.get(e)??t.set(e,[]).get(e)).push(r)}return[...t.keys()].sort((e,t)=>{let r=Td.indexOf(e),n=Td.indexOf(t);return -1!==r||-1!==n?(-1===r?99:r)-(-1===n?99:n):e.localeCompare(t)}).map(e=>({name:e,files:t.get(e).sort((e,t)=>e.path.localeCompare(t.path))}))},[r]),et=(0,Q.useCallback)(async e=>{let t=++$.current;u(e),b(!1),d(null),h(null),f(!0);try{let r=await fetch(`/api/memory?path=${encodeURIComponent(e)}`),n=await r.json();if(t!==$.current)return;if(!r.ok)throw Error(n.error||"Failed to open file.");d(n)}catch(e){if(t!==$.current)return;h(e instanceof Error?e.message:"Failed to open file.")}finally{t===$.current&&f(!1)}},[]);(0,Q.useEffect)(()=>{if(F.current||l)return;let e=ee[0]?.files[0];e&&(F.current=!0,et(e.path))},[ee,l,et]);let er=async()=>{if(!l)return;let e=$.current;w(!0),h(null);try{let t=await fetch("/api/memory",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:l,content:y})}),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to save.");e===$.current&&(d(r),b(!1)),K()}catch(t){e===$.current&&h(t instanceof Error?t.message:"Failed to save.")}finally{w(!1)}},en=async()=>{if(!l)return;let e=$.current;D(!0);try{let t=await fetch(`/api/memory?path=${encodeURIComponent(l)}`,{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to delete.")}e===$.current&&(u(null),d(null),b(!1)),L(!1),K()}catch(t){e===$.current&&h(t instanceof Error?t.message:"Failed to delete.")}finally{D(!1)}},ea=async()=>{c&&await kl(c.content)&&(x(!0),setTimeout(()=>x(!1),1500))},ei=async()=>{let e=T.trim();if(!e)return void R("Enter a file name.");/\.[A-Za-z0-9]+$/.test(e)||(e+=".md"),I(!0),R(null);try{let t=await fetch("/api/memory",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,content:`# ${Tf(e).replace(/\.[^.]+$/,"")}
|
|
74
74
|
|
|
75
|
-
`})}),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to create file.");k(!1),A(""),await K(),await et(r.path),v(r.content),b(!0)}catch(e){R(e instanceof Error?e.message:"Failed to create file.")}finally{I(!1)}},eo=g&&null!=c&&y!==c.content,es=e=>{eo?(U.current=e,j(!0)):e()},el=l&&(t=(e=Td(l)).lastIndexOf("."))>=0?e.slice(t+1).toLowerCase():"";return(0,J.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,J.jsxs)("header",{className:"flex flex-shrink-0 items-start justify-between gap-3 border-b border-border px-4 py-3 sm:px-5",children:[(0,J.jsxs)("div",{className:"min-w-0",children:[(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[(0,J.jsx)(a0,{className:"size-5 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("h2",{className:"text-xl font-semibold",children:"EvoMemory"})]}),(0,J.jsxs)("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-muted-foreground",children:["EvoScientist's"," ",(0,J.jsx)("span",{className:"font-medium text-[var(--brand)]",children:"self-evolving memory system"})," ","— it continuously learns and refines what it knows about you, your research taste, and lessons from past experiments, updating itself after every turn. View or edit it directly."]})]}),(0,J.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-1.5",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>{A(""),R(null),k(!0)},"aria-label":"New memory file",title:"New memory file",className:"inline-flex items-center gap-1.5 rounded-md bg-[var(--brand-solid)] px-2.5 py-1.5 text-xs font-medium text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring",children:[(0,J.jsx)(Ts,{className:"size-3.5","aria-hidden":"true"}),(0,J.jsx)("span",{className:"hidden sm:inline",children:"New"})]}),(0,J.jsx)("button",{type:"button",onClick:K,disabled:a,"aria-label":"Refresh",className:"rounded-md p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(Te,{className:a?"size-4 animate-spin":"size-4","aria-hidden":"true"})})]})]}),o?(0,J.jsx)("div",{className:"flex flex-1 items-center justify-center p-8",children:(0,J.jsx)("p",{className:"text-sm text-destructive",children:o})}):a&&!r?(0,J.jsxs)("div",{className:"flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading memory…"]}):r&&!r.exists||r&&0===r.entries.length?(0,J.jsx)(Tg,{dir:r.dir}):(0,J.jsxs)("div",{ref:W,className:"flex min-h-0 flex-1",children:[(0,J.jsx)("aside",{className:rZ("w-full flex-col md:flex md:flex-shrink-0",l?"hidden md:flex":"flex"),style:z?{width:V}:void 0,children:(0,J.jsx)(ij,{className:"h-0 flex-1",children:(0,J.jsxs)("div",{className:"p-1.5",children:[ee.map(e=>(0,J.jsxs)("div",{className:"mb-2.5",children:[(0,J.jsx)("h4",{className:"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:e.name}),(0,J.jsx)("div",{className:"flex flex-col",children:e.files.map(e=>{var t;let r=Tc(e.path),n=e.path===l,a=(t=e.mtime,t>0&&Y-t<6e5),i=function(e,t){if(!e)return"";let r=Math.max(0,Math.round((t-e)/1e3));if(r<45)return"just now";let n=Math.round(r/60);if(n<60)return`${n}m ago`;let a=Math.round(n/60);return a<24?`${a}h ago`:`${Math.round(a/24)}d ago`}(e.mtime,Y);return(0,J.jsxs)("button",{type:"button",onClick:()=>{es(()=>et(e.path))},className:rZ("flex items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors focus-visible:ring-2 focus-visible:ring-ring",n?"bg-accent":"hover:bg-accent/60"),"aria-current":n,children:[a?(0,J.jsx)("span",{className:"mt-1.5 size-2 shrink-0 rounded-full bg-[var(--brand)]",title:"Recently updated","aria-label":"Recently updated"}):(0,J.jsx)(kM,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,J.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,J.jsx)("span",{className:rZ("block truncate text-sm font-medium",a&&"text-[var(--brand)]"),children:Td(e.path)}),(0,J.jsxs)("span",{className:"mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground",children:[r&&(0,J.jsx)("span",{className:"truncate",children:r}),(0,J.jsx)("span",{className:"shrink-0 tabular-nums",children:Tp(e.size)}),i&&(0,J.jsxs)("span",{className:"shrink-0 tabular-nums",children:["· ",i]})]})]})]},e.path)})})]},e.name)),r?.truncated&&(0,J.jsxs)("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:["Showing the first ",r.entries.length," files."]})]})})}),(0,J.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize file list",onPointerDown:Z,className:"relative hidden w-px shrink-0 cursor-col-resize bg-border transition-colors after:absolute after:inset-y-0 after:left-1/2 after:w-2 after:-translate-x-1/2 hover:bg-[var(--brand)] md:block"}),(0,J.jsx)("section",{className:rZ("min-w-0 flex-1 flex-col",l?"flex":"hidden md:flex"),children:l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"flex flex-shrink-0 flex-wrap items-center gap-2 border-b border-border px-3 py-2 sm:px-4",children:[(0,J.jsx)("button",{type:"button",onClick:()=>{es(()=>{u(null),d(null),b(!1)})},"aria-label":"Back to list",className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring md:hidden",children:(0,J.jsx)(To,{className:"size-4","aria-hidden":"true"})}),(0,J.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,J.jsx)("p",{className:"truncate text-sm font-medium",children:Td(l)}),c&&(0,J.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[Tc(l)&&`${Tc(l)} \xb7 `,Tp(c.size),c.mtime?` \xb7 ${function(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(new Date(e))}catch{return""}}(c.mtime)}`:""]})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:g?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{es(()=>b(!1))},disabled:_,"aria-label":"Cancel editing",children:[(0,J.jsx)(kK,{className:"mr-1 size-4"}),"Cancel"]}),(0,J.jsxs)(na,{size:"sm",className:"h-8 px-3",onClick:er,disabled:_||!eo,"aria-label":"Save memory file",children:[_?(0,J.jsx)(a1,{className:"mr-1 size-4 animate-spin"}):(0,J.jsx)(kF,{className:"mr-1 size-4"}),_?"Saving…":"Save"]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:ea,disabled:!c,"aria-label":E?"Copied memory content":"Copy memory content",title:E?"Copied memory content":"Copy memory content",children:E?(0,J.jsx)(ln,{className:"size-4"}):(0,J.jsx)(ki,{className:"size-4"})}),(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{c&&(v(c.content),b(!0))},disabled:!c,"aria-label":"Edit memory file",children:[(0,J.jsx)(a4,{className:"mr-1 size-4"}),"Edit"]}),(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2 text-muted-foreground hover:text-destructive",onClick:()=>L(!0),disabled:!c,"aria-label":"Delete memory file",title:"Delete memory file",children:(0,J.jsx)(a8,{className:"size-4"})})]})})]}),m&&(0,J.jsx)("p",{role:"alert",className:"px-4 py-2 text-sm text-destructive",children:m}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:p?(0,J.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,J.jsx)(a1,{className:"size-5 animate-spin text-muted-foreground"})}):g?(0,J.jsx)("textarea",{value:y,onChange:e=>v(e.target.value),spellCheck:!1,"aria-label":"Memory file content",className:"h-full w-full resize-none bg-background p-4 font-mono text-sm leading-relaxed text-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",placeholder:"Write memory…"}):c?(0,J.jsx)(ij,{className:"h-full",children:(0,J.jsx)("div",{className:"mx-auto max-w-[780px] px-4 py-4 sm:px-6",children:0===c.content.trim().length?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"This file is empty."}):"md"===el||"markdown"===el?(0,J.jsx)(S0,{content:c.content}):(0,J.jsx)(SJ,{language:Tl[el]||"text",style:SQ,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.85rem"},wrapLongLines:!0,children:c.content})})}):null})]}):(0,J.jsx)("div",{className:"flex flex-1 items-center justify-center p-8",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a memory file to view or edit."})})})]}),(0,J.jsx)(rK,{open:S,onOpenChange:e=>{N||k(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"New memory file"}),(0,J.jsxs)(r2,{children:["Create a markdown file in the memory directory. Use a path like"," ",(0,J.jsx)("code",{className:"font-mono text-xs",children:"notes/idea.md"})," to nest it."]})]}),(0,J.jsx)(nu,{name:"memory-file-path",autoComplete:"off",spellCheck:!1,value:T,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ei())},placeholder:"notes/research-idea.md…",disabled:N,"aria-invalid":!!C||void 0,"aria-describedby":C?"new-memory-error":void 0}),C&&(0,J.jsx)("p",{id:"new-memory-error",role:"alert",className:"text-sm text-destructive",children:C}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>k(!1),disabled:N,children:"Cancel"}),(0,J.jsx)(na,{onClick:ei,disabled:N||!T.trim(),children:N?"Creating…":"Create"})]})]})}),(0,J.jsx)(rK,{open:O,onOpenChange:e=>{P||L(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Delete memory file?"}),(0,J.jsx)(r2,{children:l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("code",{children:l}),"will be permanently deleted. This can't be undone."]}):"This memory file will be permanently deleted."})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>L(!1),disabled:P,children:"Cancel"}),(0,J.jsx)(na,{onClick:en,disabled:P||!l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:P?"Deleting…":"Delete"})]})]})}),(0,J.jsx)(rK,{open:M,onOpenChange:e=>{e||(U.current=null,j(!1))},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Discard unsaved changes?"}),(0,J.jsxs)(r2,{children:["Your edits to “",l?Td(l):"this file","” have not been saved."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>{U.current=null,j(!1)},children:"Keep Editing"}),(0,J.jsx)(na,{onClick:()=>{let e=U.current;U.current=null,j(!1),b(!1),e?.()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}function Tg({dir:e}){return(0,J.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center",children:[(0,J.jsx)(a0,{className:"size-10 text-muted-foreground/40","aria-hidden":"true"}),(0,J.jsx)("p",{className:"text-sm font-medium",children:"No memory yet"}),(0,J.jsxs)("p",{className:"max-w-md text-sm text-muted-foreground",children:["EvoScientist will write what it learns here as you work together. Memory lives at ",(0,J.jsx)("code",{className:"break-all font-mono text-xs",children:e}),"."]})]})}let Tb=ro("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),Ty=ro("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var Tv=e.i(21675);function T_(){let{resolvedTheme:e,setTheme:t}=(0,Tv.useTheme)(),[r,n]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>n(!0),[]);let a=r&&"dark"===e;return(0,J.jsx)(na,{variant:"ghost",size:"icon",className:"size-8 sm:size-9",onClick:()=>t(a?"light":"dark"),"aria-label":a?"Switch to light mode":"Switch to dark mode",title:a?"Switch to light mode":"Switch to dark mode",children:a?(0,J.jsx)(Tb,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(Ty,{className:"size-5","aria-hidden":"true"})})}function Tw(){return(0,J.jsx)("span",{className:"border-[var(--brand)]/30 bg-[var(--brand)]/10 hidden rounded-lg border px-1.5 py-0.5 text-[10px] font-semibold tracking-wide text-[var(--brand)] shadow-sm backdrop-blur-sm min-[420px]:inline-flex",children:"BETA"})}let TE={checking:{dot:"bg-[var(--color-warning)]",label:"Connecting…",pulse:!0},online:{dot:"bg-[var(--color-success)]",label:"Connected",pulse:!1},offline:{dot:"bg-[var(--color-error)]",label:"Offline",pulse:!1}};function Tx(e){return e.trim().replace(/\/+$/,"")}async function TS(e){let t=new AbortController,r=setTimeout(()=>t.abort(),4e3);try{return(await fetch(`${e}/info`,{signal:t.signal,cache:"no-store"})).ok}catch{return!1}finally{clearTimeout(r)}}function Tk({deploymentUrl:e,onReconnect:t}){let[r,n]=(0,Q.useState)("checking"),[a,i]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useRef)(!0),c=(0,Q.useRef)(null),d=(0,Q.useCallback)(async t=>{let r=Tx(e);try{let e=await fetch("/api/evosci-config",{cache:"no-store"}),n=await e.json().catch(()=>null),a=n?.deploymentUrl?Tx(n.deploymentUrl):"";if(t!==l.current||!u.current)return;if(!a||a===r)return void s(null);let i=await TS(a);if(t!==l.current||!u.current)return;s(i?a:null)}catch{t===l.current&&u.current&&s(null)}},[e]),p=(0,Q.useCallback)(async()=>{let t=++l.current,r=Tx(e);if(!r){t===l.current&&u.current&&(i(null),n("offline"),s(null));return}c.current?.abort();let a=new AbortController;c.current=a;let o=setTimeout(()=>a.abort(),4e3);try{let e=await fetch(`${r}/info`,{signal:a.signal,cache:"no-store"});if(t!==l.current||!u.current)return;if(!e.ok){n("offline"),d(t);return}let o=await e.json().catch(()=>null);if(t!==l.current||!u.current)return;i(o),n("online"),s(null)}catch{t===l.current&&u.current&&(n("offline"),d(t))}finally{clearTimeout(o)}},[e,d]);(0,Q.useEffect)(()=>{u.current=!0,n("checking"),p();let e=setInterval(()=>{document.hidden||p()},1e4),t=()=>p(),r=()=>{document.hidden||p()};return window.addEventListener("focus",t),window.addEventListener("online",t),document.addEventListener("visibilitychange",r),()=>{u.current=!1,c.current?.abort(),clearInterval(e),window.removeEventListener("focus",t),window.removeEventListener("online",t),document.removeEventListener("visibilitychange",r)}},[p]);let f=TE[r],m="online"===r?`Connected to ${e}${a?.version?` \xb7 langgraph ${a.version}`:""}`:"offline"===r?`Can't reach the backend at ${e}. Is "EvoSci deploy" running? Click to retry.`:`Checking connection to ${e}…`;return(0,J.jsxs)("div",{className:"flex items-center gap-1",children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:p,title:m,"aria-label":m,className:"h-8 gap-1.5 px-2 text-xs font-normal text-muted-foreground",children:[(0,J.jsx)("span",{className:`size-2 shrink-0 rounded-full ${f.dot} ${f.pulse?"animate-pulse":""}`,"aria-hidden":"true"}),(0,J.jsx)("span",{className:"hidden sm:inline",children:f.label})]}),"offline"===r&&null!==o&&void 0!==t&&(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:()=>{o&&(s(null),n("checking"),t?.(o))},title:`Backend detected at ${o}. Click to reconnect.`,"aria-label":`Reconnect to detected backend ${o}`,className:"h-8 gap-1 px-2 text-xs font-medium text-[var(--brand)] hover:text-[var(--brand)]",children:["Reconnect"," ",(0,J.jsx)("span",{className:"tabular-nums",children:o?function(e){try{let t=new URL(e),r="127.0.0.1"===t.hostname||"localhost"===t.hostname||"0.0.0.0"===t.hostname,n=t.port||("https:"===t.protocol?"443":"80");return r?`:${n}`:`${t.hostname}:${n}`}catch{return e}}(o):""})]})]})}let TT=ro("bell-ring",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]),TA=ro("corner-up-left",[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]]);function TN(e){let t="";for(let r of e)if("human"===r.type){let e=ko(r).trim();if(e){t=e;break}}return{prompt:t,steps:function(e){let t=[];for(let r of e)if("ai"===r.type){let e=vz(r.content).trim();for(let n of(e&&t.push({kind:"text",text:e}),function(e){let t=[];if(Array.isArray(e.tool_calls)&&e.tool_calls.length>0){for(let r of e.tool_calls)t.push({id:r.id??"",name:r.name??"tool",args:r.args&&"object"==typeof r.args?r.args:{}});return t}let r=e.additional_kwargs?.tool_calls;if(Array.isArray(r))for(let e of r){let r={},n=e.function?.arguments;if(n&&"object"==typeof n)r=n;else if("string"==typeof n)try{let e=JSON.parse(n);e&&"object"==typeof e&&(r=e)}catch{r={input:n}}t.push({id:e.id??"",name:e.function?.name??"tool",args:r})}return t}(r)))t.push({kind:"tool_call",id:n.id,name:n.name,args:n.args})}else"tool"===r.type&&t.push({kind:"tool_result",toolCallId:r.tool_call_id??"",name:r.name??"tool",text:vz(r.content).trim()});return t}(e)}}function TI({status:e}){let t=S7[S2(e)];return(0,J.jsx)("span",{className:rZ("size-2 shrink-0 rounded-full",t.dot,t.pulse&&"animate-pulse"),"aria-hidden":"true"})}function TC({onReportToMainChat:e}){let t=nj(),[r]=ec("threadId"),{tasks:n,loaded:a,error:i,refresh:o}=kv(r),[s,l]=(0,Q.useState)(()=>Date.now()),[u,c]=(0,Q.useState)(null),[d,p]=(0,Q.useState)({}),f=(0,Q.useRef)(new Map),[m,h]=(0,Q.useState)({}),[g,b]=kI(r),[y,v]=(0,Q.useState)({}),[_,w]=(0,Q.useState)({}),[E,x]=(0,Q.useState)({}),S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]),(0,Q.useEffect)(()=>{let e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[]);let k=async e=>{let r=(y[e.task_id]??"").trim();if(r&&!_[e.task_id]){w(t=>({...t,[e.task_id]:!0})),x(t=>({...t,[e.task_id]:null}));try{let n=await t.runs.wait(e.thread_id,e.agent_name,{input:{messages:[{type:"human",content:r}]}});if(!S.current)return;v(t=>({...t,[e.task_id]:""}));let{prompt:a,steps:i}=TN(n?.messages??[]);p(t=>({...t,[e.task_id]:{loading:!1,error:null,prompt:a,steps:i}}))}catch{if(!S.current)return;x(t=>({...t,[e.task_id]:"Couldn't reach this agent — try again."}))}finally{S.current&&w(t=>({...t,[e.task_id]:!1}))}}};(0,Q.useEffect)(()=>{if(!u)return;let e=n.find(e=>e.task_id===u);if(!e)return;let r="running"===S2(e.liveStatus),a=[e.run_id,e.last_updated_at,e.endedAt].join(":");if(!r&&f.current.get(u)===a)return;let i=!1;return p(e=>({...e,[u]:{loading:!e[u],error:null,prompt:e[u]?.prompt??"",steps:e[u]?.steps??[]}})),(async()=>{try{let n=await t.threads.getState(e.thread_id);if(i)return;let{prompt:o,steps:s}=TN(n.values?.messages??[]);r||f.current.set(u,a),p(e=>({...e,[u]:{loading:!1,error:null,prompt:o,steps:s}}))}catch{if(i)return;f.current.delete(u),p(e=>({...e,[u]:{loading:!1,error:"Couldn't load this agent's steps.",prompt:e[u]?.prompt??"",steps:e[u]?.steps??[]}}))}})(),()=>{i=!0}},[u,n,t]);let T=(0,Q.useMemo)(()=>kt(n),[n]);return(0,J.jsxs)("div",{className:"flex h-full flex-col",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between gap-2 px-1 pb-2",children:[(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:T>0?`${T} running`:n.length>0?`${n.length} total`:"Background agents"}),(0,J.jsxs)("div",{className:"flex items-center gap-1",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>{r&&(g||kA(r,n.filter(e=>ke(e.liveStatus)).map(S5)),b(!g))},"aria-pressed":g,"aria-label":`Auto-report ${g?"on":"off"}`,title:g?"Auto-report on: finished agents are sent to the main chat automatically":"Auto-report off: use each agent's “Notify main chat” button",className:rZ("inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",g?"bg-accent text-[var(--brand)]":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[(0,J.jsx)(TT,{className:"size-3.5","aria-hidden":"true"}),(0,J.jsxs)("span",{className:"hidden min-[340px]:inline",children:["Auto-report ",g?"On":"Off"]})]}),(0,J.jsx)("button",{type:"button",onClick:o,"aria-label":"Refresh agents",title:"Refresh",className:"rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(kV,{className:"size-3.5","aria-hidden":"true"})})]})]}),i&&(0,J.jsx)("p",{className:"px-1 text-xs text-[var(--color-error)]",children:i}),!a&&(0,J.jsxs)("div",{className:"flex items-center gap-2 px-1 py-4 text-xs text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading…"]}),a&&0===n.length&&(0,J.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-10 text-center",children:[(0,J.jsx)(v3,{className:"size-9 text-muted-foreground/60","aria-hidden":"true"}),(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No background agents yet."}),(0,J.jsx)("p",{className:"text-xs text-muted-foreground/80",children:"When EvoScientist delegates long tasks (writing, data analysis) they run in the background and show up here."})]}),(0,J.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-1.5 overflow-y-auto",children:n.map(t=>{var n;let a,i,o,l,p=S7[S2(t.liveStatus)],f=u===t.task_id,b=d[t.task_id];return(0,J.jsxs)("div",{className:"rounded-md border border-border bg-background",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>c(f?null:t.task_id),className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-expanded":f,children:[f?(0,J.jsx)(la,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}):(0,J.jsx)(ka,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,J.jsx)(TI,{status:t.liveStatus}),(0,J.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:S4[n=t.agent_name]??n}),(0,J.jsxs)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[p.label,(a="running"===S2(t.liveStatus)?s:t.endedAt?Date.parse(t.endedAt):s,(i=function(e,t){if(!e)return"";let r=Date.parse(e);if(Number.isNaN(r))return"";let n=Math.max(0,Math.round((t-r)/1e3)),a=Math.floor(n/60);if(a>=60){let e=Math.floor(a/60);return`${e}h ${a%60}m`}return a>0?`${a}m ${n%60}s`:`${n}s`}(t.startedAt??t.created_at,a))?` \xb7 ${i}`:"")]})]}),f&&(0,J.jsxs)("div",{className:"border-t border-border px-2.5 py-2 text-xs",children:[b?.loading&&(0,J.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Loading steps…"]}),b?.error&&(0,J.jsx)("p",{className:"text-[var(--color-error)]",children:b.error}),b&&!b.loading&&!b.error&&(0,J.jsxs)("div",{className:"flex flex-col gap-2",children:[b.prompt&&(0,J.jsxs)("div",{children:[(0,J.jsx)("p",{className:"font-semibold text-foreground",children:"Task"}),(0,J.jsx)("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:b.prompt.length>600?b.prompt.slice(0,600)+"…":b.prompt})]}),(0,J.jsxs)("div",{children:[(0,J.jsxs)("p",{className:"mb-1 font-semibold text-foreground",children:["Steps"," ",(0,J.jsxs)("span",{className:"font-normal text-muted-foreground",children:["(",b.steps.length,")"]})]}),0===b.steps.length?(0,J.jsx)("p",{className:"text-muted-foreground",children:"No steps yet."}):(0,J.jsx)(S1,{steps:b.steps,compact:!0})]}),ke(t.liveStatus)&&(0,J.jsx)("div",{className:"mt-1 border-t border-border pt-2",children:g?(0,J.jsxs)("p",{className:"inline-flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[(0,J.jsx)(TT,{className:"size-3.5 text-[var(--brand)]","aria-hidden":"true"}),"Auto-report on · future completions notify the main chat"]}):(0,J.jsxs)("button",{type:"button",onClick:()=>(t=>{if(!e||!r)return void u_.toast.error("Open the conversation to notify the main agent.");let n=e(t,r);if("sent"===n){h(e=>({...e,[S5(t)]:!0})),u_.toast.success("Reported to the main chat.");return}if("duplicate"===n){h(e=>({...e,[S5(t)]:!0})),u_.toast.info("This result is already in the main chat.");return}u_.toast.error("wrong-thread"===n?"The active conversation changed — reopen this task and try again.":"Main chat is busy — try again when it's idle.")})(t),disabled:!e||!!m[S5(t)],title:e?"Send this result back to the main agent":"Open the conversation to notify the main agent",className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[11px] font-medium text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[(0,J.jsx)(TA,{className:"size-3.5 text-[var(--brand)]","aria-hidden":"true"}),m[S5(t)]?"Reported to main chat":"Notify main chat"]})}),(o="running"===S2(t.liveStatus),l=!!_[t.task_id],(0,J.jsxs)("div",{className:"mt-1 border-t border-border pt-2",children:[(0,J.jsx)("p",{className:"mb-1 text-[11px] text-muted-foreground",children:"Direct follow-up · Main chat is not notified"}),(0,J.jsxs)("form",{onSubmit:e=>{e.preventDefault(),k(t)},className:"flex items-center gap-1.5",children:[(0,J.jsx)("input",{type:"text",name:`agent-message-${t.task_id}`,autoComplete:"off",value:y[t.task_id]??"",onChange:e=>v(r=>({...r,[t.task_id]:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&(e.nativeEvent.isComposing||229===e.keyCode)&&e.preventDefault()},disabled:o||l,placeholder:o?"Agent is working…":"Send a direct follow-up…","aria-label":"Message this agent",className:"min-w-0 flex-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60"}),(0,J.jsx)("button",{type:"submit",disabled:o||l||!(y[t.task_id]??"").trim(),"aria-label":"Send",title:"Send to this agent",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md bg-[var(--brand-solid)] text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40",children:l?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(vZ,{className:"size-3.5","aria-hidden":"true"})})]}),E[t.task_id]&&(0,J.jsx)("p",{className:"mt-1 text-[var(--color-error)]",role:"status","aria-live":"polite",children:E[t.task_id]})]}))]})]})]},t.task_id)})})]})}function TR({onClose:e,onReportToMainChat:t}){let[r,n]=ec("inspectorTab"),a="agents"===r?"agents":"workspace";return(0,J.jsxs)("div",{className:"flex h-full flex-col border-l border-border bg-sidebar",children:[(0,J.jsxs)("div",{className:"flex h-11 shrink-0 items-center justify-between gap-2 border-b border-border px-2",children:[(0,J.jsxs)("div",{role:"tablist","aria-label":"Inspector",className:"flex items-center gap-1",children:[(0,J.jsxs)("button",{type:"button",role:"tab","aria-selected":"workspace"===a,onClick:()=>n(null),className:rZ("flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","workspace"===a?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,J.jsx)(vQ,{className:"size-4 text-[var(--brand)]","aria-hidden":"true"}),"Workspace"]}),(0,J.jsxs)("button",{type:"button",role:"tab","aria-selected":"agents"===a,onClick:()=>n("agents"),className:rZ("flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","agents"===a?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,J.jsx)(v3,{className:"size-4 text-[var(--brand)]","aria-hidden":"true"}),"Agents"]})]}),(0,J.jsx)(na,{variant:"ghost",size:"icon",className:"size-7",onClick:e,"aria-label":"Close inspector",title:"Close",children:(0,J.jsx)(rs,{className:"size-4","aria-hidden":"true"})})]}),"agents"===a?(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden p-3",children:(0,J.jsx)(TC,{onReportToMainChat:t})}):(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:(0,J.jsx)(k6,{})})]})}function TO({config:e,configDialogOpen:t,setConfigDialogOpen:r,handleSaveConfig:n}){let a=nj(),[,i]=ec("threadId"),[o,s]=ec("sidebar"),[l,u]=ec("view"),[c,d]=ec("inspector"),[,p]=ec("inspectorTab"),[f,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(0),[b,y]=(0,Q.useState)(null),[v,_]=(0,Q.useState)(null),[w,E]=(0,Q.useState)(0),[x,S]=(0,Q.useState)(null),k=(0,Q.useCallback)(async()=>{let t=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e.assistantId),r=async()=>{if(t)return await a.assistants.get(e.assistantId);let r=await a.assistants.search({graphId:e.assistantId,limit:100}),n=r.find(e=>e.metadata?.created_by==="system")??r[0];if(!n)throw Error("No assistant found for this graph.");return n};for(let e=0;e<3;e+=1)try{y(await r());return}catch(t){if(e<2){await new Promise(e=>setTimeout(e,700));continue}console.warn("Couldn't resolve the EvoScientist assistant; addressing the graph by id instead. Is the backend running?",t)}y({assistant_id:e.assistantId,graph_id:e.assistantId,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),config:{},metadata:{},version:1,name:e.assistantId,context:{}})},[a,e.assistantId]);(0,Q.useEffect)(()=>{k()},[k]),(0,Q.useEffect)(()=>{let e=window.matchMedia("(min-width: 768px)"),t=()=>_(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),(0,Q.useEffect)(()=>{!1===v&&o&&c&&d(null)},[c,v,d,o]);let T=(0,Q.useCallback)(()=>s(null),[s]),A=(0,Q.useCallback)(()=>{d(null),p(null)},[d,p]),N=(0,Q.useCallback)(()=>{o?s(null):(!1===v&&A(),s("1"))},[A,v,s,o]),I=(0,Q.useCallback)(()=>{c?A():(!1===v&&s(null),p(null),d("1"))},[A,c,v,d,p,s]),C=(0,Q.useCallback)(()=>{p("agents"),!1===v&&s(null),d("1")},[v,d,s,p]),R=l?o?"Hide navigation":"Show navigation":o?"Hide research":"Show research",O=(0,Q.useCallback)(()=>{ky(null,!1),i(null),u(null),E(e=>e+1)},[i,u]),L=(0,Q.useCallback)(async e=>{ky(null,!1),u(null),await i(e),E(e=>e+1)},[i,u]);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(nc,{open:t,onOpenChange:r,onSave:n,initialConfig:e}),(0,J.jsxs)("div",{className:"flex h-screen flex-col",children:[(0,J.jsxs)("header",{className:"flex h-14 items-center justify-between gap-2 border-b border-border px-2.5 sm:px-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2 sm:gap-3",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(ee.default,{src:"/evoscientist-logo.png",alt:"EvoScientist",width:28,height:28,className:"size-6 shrink-0",priority:!0}),o&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("h1",{className:"truncate text-base font-semibold sm:text-lg",children:"EvoScientist"}),(0,J.jsx)(Tw,{})]})]}),(0,J.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,J.jsxs)(na,{variant:"ghost",size:"icon",onClick:N,"aria-label":R,className:"relative size-8",children:[o?(0,J.jsx)(nz,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(nU,{className:"size-5","aria-hidden":"true"}),h>0&&(0,J.jsx)("span",{className:"absolute right-0 top-0 inline-flex min-h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] text-destructive-foreground",children:h})]}),!o&&(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:O,"aria-label":"New chat",className:"size-8",children:(0,J.jsx)(n$,{className:"size-5","aria-hidden":"true"})})]})]}),(0,J.jsxs)("div",{className:"flex shrink-0 items-center gap-1 sm:gap-2",children:[(0,J.jsx)(Tk,{deploymentUrl:e.deploymentUrl,onReconnect:t=>n({...e,deploymentUrl:t})}),(0,J.jsx)(T_,{}),(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:I,"aria-label":c?"Hide inspector":"Show workspace",title:c?"Hide inspector":"Show workspace",className:"size-8",children:c?(0,J.jsx)(nH,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(nB,{className:"size-5","aria-hidden":"true"})}),(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:()=>r(!0),"aria-label":"Settings",title:"Settings",className:"size-8",children:(0,J.jsx)(nF,{className:"size-5","aria-hidden":"true"})})]})]}),(0,J.jsxs)("div",{className:"relative flex-1 overflow-hidden",children:[o&&!1===v&&(0,J.jsxs)("div",{className:"absolute inset-0 z-40 flex md:hidden",children:[(0,J.jsx)("button",{type:"button","aria-label":"Close research",className:"absolute inset-0 bg-black/40",onClick:T}),(0,J.jsx)("aside",{"aria-label":l?"Navigation":"Research navigation",className:"relative z-10 h-full w-[min(19rem,calc(100vw-2.25rem))] bg-background shadow-xl",children:(0,J.jsx)(uI,{onClose:T,onNewChat:O,onThreadSelect:async e=>{await L(e),T()},onMutateReady:e=>m(()=>e),onInterruptCountChange:g})})]}),c&&!1===v&&(0,J.jsxs)("div",{className:"absolute inset-0 z-40 flex justify-end md:hidden",children:[(0,J.jsx)("button",{type:"button","aria-label":"Close inspector",className:"absolute inset-0 bg-black/40",onClick:A}),(0,J.jsx)("aside",{"aria-label":"Inspector",className:"relative z-10 h-full w-[min(22rem,calc(100vw-2.25rem))] bg-background shadow-xl",children:(0,J.jsx)(TR,{onClose:A,onReportToMainChat:x})})]}),(0,J.jsxs)(aJ,{direction:"horizontal",autoSaveId:"evoscientist-chat",children:[o&&v&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(n2,{id:"thread-history",order:1,defaultSize:23,minSize:18,className:"relative min-w-[260px]",children:(0,J.jsx)(uI,{onNewChat:O,onThreadSelect:L,onMutateReady:e=>m(()=>e),onInterruptCountChange:g})}),(0,J.jsx)(aQ,{})]}),(0,J.jsx)(n2,{id:"chat",className:"relative flex flex-col",order:2,children:"skills"===l?(0,J.jsx)(Ta,{}):"memory"===l?(0,J.jsx)(Th,{}):(0,J.jsx)(vG,{activeAssistant:b,onHistoryRevalidate:()=>f?.(),children:(0,J.jsx)(k7,{assistant:b,onShowAgents:C,onNotifyReady:e=>S(()=>e)})},w)}),c&&v&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(aQ,{}),(0,J.jsx)(n2,{id:"inspector",order:3,defaultSize:26,minSize:20,className:"relative min-w-[300px]",children:(0,J.jsx)(TR,{onClose:A,onReportToMainChat:x})})]})]})]})]})]})}function TL(){let[e,t]=(0,Q.useState)(null),[r,n]=(0,Q.useState)(!1),[a,i]=ec("assistantId");(0,Q.useEffect)(()=>{let e=ef();e?(t(e),a||i(e.assistantId)):n(!0)},[]),(0,Q.useEffect)(()=>{e&&!a&&i(e.assistantId)},[e,a,i]);let o=(0,Q.useCallback)(e=>{localStorage.setItem(ep,JSON.stringify(e)),t(e)},[]),s=e?.langsmithApiKey||X.default.env.NEXT_PUBLIC_LANGSMITH_API_KEY||"";return e?(0,J.jsx)(nM,{deploymentUrl:e.deploymentUrl,apiKey:s,children:(0,J.jsx)(TO,{config:e,configDialogOpen:r,setConfigDialogOpen:n,handleSaveConfig:o})}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(nc,{open:r,onOpenChange:n,onSave:o}),(0,J.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,J.jsxs)("div",{className:"text-center",children:[(0,J.jsx)("h1",{className:"text-2xl font-bold",children:"Welcome to EvoScientist"}),(0,J.jsx)("p",{className:"mt-2 text-muted-foreground",children:"Configure your deployment to get started"}),(0,J.jsx)(na,{onClick:()=>n(!0),className:"mt-4",children:"Open Configuration"})]})})]})}e.s(["default",0,function(){return(0,J.jsx)(Q.Suspense,{fallback:(0,J.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,J.jsx)("p",{className:"text-muted-foreground",children:"Loading…"})}),children:(0,J.jsx)(TL,{})})}],52683)}]);
|
|
75
|
+
`})}),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to create file.");k(!1),A(""),await K(),await et(r.path),v(r.content),b(!0)}catch(e){R(e instanceof Error?e.message:"Failed to create file.")}finally{I(!1)}},eo=g&&null!=c&&y!==c.content,es=e=>{eo?(U.current=e,j(!0)):e()},el=l&&(t=(e=Tf(l)).lastIndexOf("."))>=0?e.slice(t+1).toLowerCase():"";return(0,J.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,J.jsxs)("header",{className:"flex flex-shrink-0 items-start justify-between gap-3 border-b border-border px-4 py-3 sm:px-5",children:[(0,J.jsxs)("div",{className:"min-w-0",children:[(0,J.jsxs)("div",{className:"flex items-center gap-2",children:[(0,J.jsx)(a0,{className:"size-5 text-[var(--brand)]","aria-hidden":"true"}),(0,J.jsx)("h2",{className:"text-xl font-semibold",children:"EvoMemory"})]}),(0,J.jsxs)("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-muted-foreground",children:["EvoScientist's"," ",(0,J.jsx)("span",{className:"font-medium text-[var(--brand)]",children:"self-evolving memory system"})," ","— it continuously learns and refines what it knows about you, your research taste, and lessons from past experiments, updating itself after every turn. View or edit it directly."]})]}),(0,J.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-1.5",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>{A(""),R(null),k(!0)},"aria-label":"New memory file",title:"New memory file",className:"inline-flex items-center gap-1.5 rounded-md bg-[var(--brand-solid)] px-2.5 py-1.5 text-xs font-medium text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring",children:[(0,J.jsx)(Tu,{className:"size-3.5","aria-hidden":"true"}),(0,J.jsx)("span",{className:"hidden sm:inline",children:"New"})]}),(0,J.jsx)("button",{type:"button",onClick:K,disabled:a,"aria-label":"Refresh",className:"rounded-md p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(Tr,{className:a?"size-4 animate-spin":"size-4","aria-hidden":"true"})})]})]}),o?(0,J.jsx)("div",{className:"flex flex-1 items-center justify-center p-8",children:(0,J.jsx)("p",{className:"text-sm text-destructive",children:o})}):a&&!r?(0,J.jsxs)("div",{className:"flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading memory…"]}):r&&!r.exists||r&&0===r.entries.length?(0,J.jsx)(Ty,{dir:r.dir}):(0,J.jsxs)("div",{ref:W,className:"flex min-h-0 flex-1",children:[(0,J.jsx)("aside",{className:rZ("w-full flex-col md:flex md:flex-shrink-0",l?"hidden md:flex":"flex"),style:z?{width:V}:void 0,children:(0,J.jsx)(ij,{className:"h-0 flex-1",children:(0,J.jsxs)("div",{className:"p-1.5",children:[ee.map(e=>(0,J.jsxs)("div",{className:"mb-2.5",children:[(0,J.jsx)("h4",{className:"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:e.name}),(0,J.jsx)("div",{className:"flex flex-col",children:e.files.map(e=>{var t;let r=Tp(e.path),n=e.path===l,a=(t=e.mtime,t>0&&Y-t<6e5),i=function(e,t){if(!e)return"";let r=Math.max(0,Math.round((t-e)/1e3));if(r<45)return"just now";let n=Math.round(r/60);if(n<60)return`${n}m ago`;let a=Math.round(n/60);return a<24?`${a}h ago`:`${Math.round(a/24)}d ago`}(e.mtime,Y);return(0,J.jsxs)("button",{type:"button",onClick:()=>{es(()=>et(e.path))},className:rZ("flex items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors focus-visible:ring-2 focus-visible:ring-ring",n?"bg-accent":"hover:bg-accent/60"),"aria-current":n,children:[a?(0,J.jsx)("span",{className:"mt-1.5 size-2 shrink-0 rounded-full bg-[var(--brand)]",title:"Recently updated","aria-label":"Recently updated"}):(0,J.jsx)(kF,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,J.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,J.jsx)("span",{className:rZ("block truncate text-sm font-medium",a&&"text-[var(--brand)]"),children:Tf(e.path)}),(0,J.jsxs)("span",{className:"mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground",children:[r&&(0,J.jsx)("span",{className:"truncate",children:r}),(0,J.jsx)("span",{className:"shrink-0 tabular-nums",children:Tm(e.size)}),i&&(0,J.jsxs)("span",{className:"shrink-0 tabular-nums",children:["· ",i]})]})]})]},e.path)})})]},e.name)),r?.truncated&&(0,J.jsxs)("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:["Showing the first ",r.entries.length," files."]})]})})}),(0,J.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize file list",onPointerDown:Z,className:"relative hidden w-px shrink-0 cursor-col-resize bg-border transition-colors after:absolute after:inset-y-0 after:left-1/2 after:w-2 after:-translate-x-1/2 hover:bg-[var(--brand)] md:block"}),(0,J.jsx)("section",{className:rZ("min-w-0 flex-1 flex-col",l?"flex":"hidden md:flex"),children:l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"flex flex-shrink-0 flex-wrap items-center gap-2 border-b border-border px-3 py-2 sm:px-4",children:[(0,J.jsx)("button",{type:"button",onClick:()=>{es(()=>{u(null),d(null),b(!1)})},"aria-label":"Back to list",className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring md:hidden",children:(0,J.jsx)(Tl,{className:"size-4","aria-hidden":"true"})}),(0,J.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,J.jsx)("p",{className:"truncate text-sm font-medium",children:Tf(l)}),c&&(0,J.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[Tp(l)&&`${Tp(l)} \xb7 `,Tm(c.size),c.mtime?` \xb7 ${function(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(new Date(e))}catch{return""}}(c.mtime)}`:""]})]}),(0,J.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:g?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{es(()=>b(!1))},disabled:_,"aria-label":"Cancel editing",children:[(0,J.jsx)(kX,{className:"mr-1 size-4"}),"Cancel"]}),(0,J.jsxs)(na,{size:"sm",className:"h-8 px-3",onClick:er,disabled:_||!eo,"aria-label":"Save memory file",children:[_?(0,J.jsx)(a1,{className:"mr-1 size-4 animate-spin"}):(0,J.jsx)(kU,{className:"mr-1 size-4"}),_?"Saving…":"Save"]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:ea,disabled:!c,"aria-label":E?"Copied memory content":"Copy memory content",title:E?"Copied memory content":"Copy memory content",children:E?(0,J.jsx)(ln,{className:"size-4"}):(0,J.jsx)(ks,{className:"size-4"})}),(0,J.jsxs)(na,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{c&&(v(c.content),b(!0))},disabled:!c,"aria-label":"Edit memory file",children:[(0,J.jsx)(a4,{className:"mr-1 size-4"}),"Edit"]}),(0,J.jsx)(na,{variant:"ghost",size:"sm",className:"h-8 px-2 text-muted-foreground hover:text-destructive",onClick:()=>L(!0),disabled:!c,"aria-label":"Delete memory file",title:"Delete memory file",children:(0,J.jsx)(a8,{className:"size-4"})})]})})]}),m&&(0,J.jsx)("p",{role:"alert",className:"px-4 py-2 text-sm text-destructive",children:m}),(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:p?(0,J.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,J.jsx)(a1,{className:"size-5 animate-spin text-muted-foreground"})}):g?(0,J.jsx)("textarea",{value:y,onChange:e=>v(e.target.value),spellCheck:!1,"aria-label":"Memory file content",className:"h-full w-full resize-none bg-background p-4 font-mono text-sm leading-relaxed text-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",placeholder:"Write memory…"}):c?(0,J.jsx)(ij,{className:"h-full",children:(0,J.jsx)("div",{className:"mx-auto max-w-[780px] px-4 py-4 sm:px-6",children:0===c.content.trim().length?(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"This file is empty."}):"md"===el||"markdown"===el?(0,J.jsx)(S2,{content:c.content}):(0,J.jsx)(S0,{language:Tc[el]||"text",style:S1,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.85rem"},wrapLongLines:!0,children:c.content})})}):null})]}):(0,J.jsx)("div",{className:"flex flex-1 items-center justify-center p-8",children:(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a memory file to view or edit."})})})]}),(0,J.jsx)(rK,{open:S,onOpenChange:e=>{N||k(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"New memory file"}),(0,J.jsxs)(r2,{children:["Create a markdown file in the memory directory. Use a path like"," ",(0,J.jsx)("code",{className:"font-mono text-xs",children:"notes/idea.md"})," to nest it."]})]}),(0,J.jsx)(nu,{name:"memory-file-path",autoComplete:"off",spellCheck:!1,value:T,onChange:e=>A(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ei())},placeholder:"notes/research-idea.md…",disabled:N,"aria-invalid":!!C||void 0,"aria-describedby":C?"new-memory-error":void 0}),C&&(0,J.jsx)("p",{id:"new-memory-error",role:"alert",className:"text-sm text-destructive",children:C}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>k(!1),disabled:N,children:"Cancel"}),(0,J.jsx)(na,{onClick:ei,disabled:N||!T.trim(),children:N?"Creating…":"Create"})]})]})}),(0,J.jsx)(rK,{open:O,onOpenChange:e=>{P||L(e)},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Delete memory file?"}),(0,J.jsx)(r2,{children:l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("code",{children:l}),"will be permanently deleted. This can't be undone."]}):"This memory file will be permanently deleted."})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>L(!1),disabled:P,children:"Cancel"}),(0,J.jsx)(na,{onClick:en,disabled:P||!l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:P?"Deleting…":"Delete"})]})]})}),(0,J.jsx)(rK,{open:M,onOpenChange:e=>{e||(U.current=null,j(!1))},children:(0,J.jsxs)(rJ,{className:"sm:max-w-md",children:[(0,J.jsxs)(rQ,{children:[(0,J.jsx)(r1,{children:"Discard unsaved changes?"}),(0,J.jsxs)(r2,{children:["Your edits to “",l?Tf(l):"this file","” have not been saved."]})]}),(0,J.jsxs)(r0,{children:[(0,J.jsx)(na,{variant:"outline",onClick:()=>{U.current=null,j(!1)},children:"Keep Editing"}),(0,J.jsx)(na,{onClick:()=>{let e=U.current;U.current=null,j(!1),b(!1),e?.()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}function Ty({dir:e}){return(0,J.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center",children:[(0,J.jsx)(a0,{className:"size-10 text-muted-foreground/40","aria-hidden":"true"}),(0,J.jsx)("p",{className:"text-sm font-medium",children:"No memory yet"}),(0,J.jsxs)("p",{className:"max-w-md text-sm text-muted-foreground",children:["EvoScientist will write what it learns here as you work together. Memory lives at ",(0,J.jsx)("code",{className:"break-all font-mono text-xs",children:e}),"."]})]})}let Tv=ro("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),T_=ro("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var Tw=e.i(21675);function TE(){let{resolvedTheme:e,setTheme:t}=(0,Tw.useTheme)(),[r,n]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>n(!0),[]);let a=r&&"dark"===e;return(0,J.jsx)(na,{variant:"ghost",size:"icon",className:"size-8 sm:size-9",onClick:()=>t(a?"light":"dark"),"aria-label":a?"Switch to light mode":"Switch to dark mode",title:a?"Switch to light mode":"Switch to dark mode",children:a?(0,J.jsx)(Tv,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(T_,{className:"size-5","aria-hidden":"true"})})}let Tx={checking:{dot:"bg-[var(--color-warning)]",label:"Connecting…",pulse:!0},online:{dot:"bg-[var(--color-success)]",label:"Connected",pulse:!1},offline:{dot:"bg-[var(--color-error)]",label:"Offline",pulse:!1}};function TS(e){return e.trim().replace(/\/+$/,"")}async function Tk(e){let t=new AbortController,r=setTimeout(()=>t.abort(),4e3);try{return(await fetch(`${e}/info`,{signal:t.signal,cache:"no-store"})).ok}catch{return!1}finally{clearTimeout(r)}}function TT({deploymentUrl:e,onReconnect:t}){let[r,n]=(0,Q.useState)("checking"),[a,i]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useRef)(!0),c=(0,Q.useRef)(null),d=(0,Q.useCallback)(async t=>{let r=TS(e);try{let e=await fetch("/api/evosci-config",{cache:"no-store"}),n=await e.json().catch(()=>null),a=n?.deploymentUrl?TS(n.deploymentUrl):"";if(t!==l.current||!u.current)return;if(!a||a===r)return void s(null);let i=await Tk(a);if(t!==l.current||!u.current)return;s(i?a:null)}catch{t===l.current&&u.current&&s(null)}},[e]),p=(0,Q.useCallback)(async()=>{let t=++l.current,r=TS(e);if(!r){t===l.current&&u.current&&(i(null),n("offline"),s(null));return}c.current?.abort();let a=new AbortController;c.current=a;let o=setTimeout(()=>a.abort(),4e3);try{let e=await fetch(`${r}/info`,{signal:a.signal,cache:"no-store"});if(t!==l.current||!u.current)return;if(!e.ok){n("offline"),d(t);return}let o=await e.json().catch(()=>null);if(t!==l.current||!u.current)return;i(o),n("online"),s(null)}catch{t===l.current&&u.current&&(n("offline"),d(t))}finally{clearTimeout(o)}},[e,d]);(0,Q.useEffect)(()=>{u.current=!0,n("checking"),p();let e=setInterval(()=>{document.hidden||p()},1e4),t=()=>p(),r=()=>{document.hidden||p()};return window.addEventListener("focus",t),window.addEventListener("online",t),document.addEventListener("visibilitychange",r),()=>{u.current=!1,c.current?.abort(),clearInterval(e),window.removeEventListener("focus",t),window.removeEventListener("online",t),document.removeEventListener("visibilitychange",r)}},[p]);let f=Tx[r],m="online"===r?`Connected to ${e}${a?.version?` \xb7 langgraph ${a.version}`:""}`:"offline"===r?`Can't reach the backend at ${e}. Is "EvoSci deploy" running? Click to retry.`:`Checking connection to ${e}…`;return(0,J.jsxs)("div",{className:"flex items-center gap-1",children:[(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:p,title:m,"aria-label":m,className:"h-8 gap-1.5 px-2 text-xs font-normal text-muted-foreground",children:[(0,J.jsx)("span",{className:`size-2 shrink-0 rounded-full ${f.dot} ${f.pulse?"animate-pulse":""}`,"aria-hidden":"true"}),(0,J.jsx)("span",{className:"hidden sm:inline",children:f.label})]}),"offline"===r&&null!==o&&void 0!==t&&(0,J.jsxs)(na,{variant:"ghost",size:"sm",onClick:()=>{o&&(s(null),n("checking"),t?.(o))},title:`Backend detected at ${o}. Click to reconnect.`,"aria-label":`Reconnect to detected backend ${o}`,className:"h-8 gap-1 px-2 text-xs font-medium text-[var(--brand)] hover:text-[var(--brand)]",children:["Reconnect"," ",(0,J.jsx)("span",{className:"tabular-nums",children:o?function(e){try{let t=new URL(e),r="127.0.0.1"===t.hostname||"localhost"===t.hostname||"0.0.0.0"===t.hostname,n=t.port||("https:"===t.protocol?"443":"80");return r?`:${n}`:`${t.hostname}:${n}`}catch{return e}}(o):""})]})]})}let TA=ro("bell-ring",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]),TN=ro("corner-up-left",[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]]);function TI(e){let t="";for(let r of e)if("human"===r.type){let e=vB(r).trim();if(e){t=e;break}}return{prompt:t,steps:function(e){let t=[];for(let r of e)if("ai"===r.type){let e=vz(r.content).trim();for(let n of(e&&t.push({kind:"text",text:e}),function(e){let t=[];if(Array.isArray(e.tool_calls)&&e.tool_calls.length>0){for(let r of e.tool_calls)t.push({id:r.id??"",name:r.name??"tool",args:r.args&&"object"==typeof r.args?r.args:{}});return t}let r=e.additional_kwargs?.tool_calls;if(Array.isArray(r))for(let e of r){let r={},n=e.function?.arguments;if(n&&"object"==typeof n)r=n;else if("string"==typeof n)try{let e=JSON.parse(n);e&&"object"==typeof e&&(r=e)}catch{r={input:n}}t.push({id:e.id??"",name:e.function?.name??"tool",args:r})}return t}(r)))t.push({kind:"tool_call",id:n.id,name:n.name,args:n.args})}else"tool"===r.type&&t.push({kind:"tool_result",toolCallId:r.tool_call_id??"",name:r.name??"tool",text:vz(r.content).trim()});return t}(e)}}function TC({status:e}){let t=kt[S3(e)];return(0,J.jsx)("span",{className:rZ("size-2 shrink-0 rounded-full",t.dot,t.pulse&&"animate-pulse"),"aria-hidden":"true"})}function TR({onReportToMainChat:e}){let t=nj(),[r]=ec("threadId"),{tasks:n,loaded:a,error:i,refresh:o}=kw(r),[s,l]=(0,Q.useState)(()=>Date.now()),[u,c]=(0,Q.useState)(null),[d,p]=(0,Q.useState)({}),f=(0,Q.useRef)(new Map),[m,h]=(0,Q.useState)({}),[g,b]=kR(r),[y,v]=(0,Q.useState)({}),[_,w]=(0,Q.useState)({}),[E,x]=(0,Q.useState)({}),S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]),(0,Q.useEffect)(()=>{let e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[]);let k=async e=>{let r=(y[e.task_id]??"").trim();if(r&&!_[e.task_id]){w(t=>({...t,[e.task_id]:!0})),x(t=>({...t,[e.task_id]:null}));try{let n=await t.runs.wait(e.thread_id,e.agent_name,{input:{messages:[{type:"human",content:r}]}});if(!S.current)return;v(t=>({...t,[e.task_id]:""}));let{prompt:a,steps:i}=TI(n?.messages??[]);p(t=>({...t,[e.task_id]:{loading:!1,error:null,prompt:a,steps:i}}))}catch{if(!S.current)return;x(t=>({...t,[e.task_id]:"Couldn't reach this agent — try again."}))}finally{S.current&&w(t=>({...t,[e.task_id]:!1}))}}};(0,Q.useEffect)(()=>{if(!u)return;let e=n.find(e=>e.task_id===u);if(!e)return;let r="running"===S3(e.liveStatus),a=[e.run_id,e.last_updated_at,e.endedAt].join(":");if(!r&&f.current.get(u)===a)return;let i=!1;return p(e=>({...e,[u]:{loading:!e[u],error:null,prompt:e[u]?.prompt??"",steps:e[u]?.steps??[]}})),(async()=>{try{let n=await t.threads.getState(e.thread_id);if(i)return;let{prompt:o,steps:s}=TI(n.values?.messages??[]);r||f.current.set(u,a),p(e=>({...e,[u]:{loading:!1,error:null,prompt:o,steps:s}}))}catch{if(i)return;f.current.delete(u),p(e=>({...e,[u]:{loading:!1,error:"Couldn't load this agent's steps.",prompt:e[u]?.prompt??"",steps:e[u]?.steps??[]}}))}})(),()=>{i=!0}},[u,n,t]);let T=(0,Q.useMemo)(()=>kn(n),[n]);return(0,J.jsxs)("div",{className:"flex h-full flex-col",children:[(0,J.jsxs)("div",{className:"flex items-center justify-between gap-2 px-1 pb-2",children:[(0,J.jsx)("p",{className:"text-xs text-muted-foreground",children:T>0?`${T} running`:n.length>0?`${n.length} total`:"Background agents"}),(0,J.jsxs)("div",{className:"flex items-center gap-1",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>{r&&(g||kI(r,n.filter(e=>kr(e.liveStatus)).map(S9)),b(!g))},"aria-pressed":g,"aria-label":`Auto-report ${g?"on":"off"}`,title:g?"Auto-report on: finished agents are sent to the main chat automatically":"Auto-report off: use each agent's “Notify main chat” button",className:rZ("inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",g?"bg-accent text-[var(--brand)]":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[(0,J.jsx)(TA,{className:"size-3.5","aria-hidden":"true"}),(0,J.jsxs)("span",{className:"hidden min-[340px]:inline",children:["Auto-report ",g?"On":"Off"]})]}),(0,J.jsx)("button",{type:"button",onClick:o,"aria-label":"Refresh agents",title:"Refresh",className:"rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:(0,J.jsx)(kW,{className:"size-3.5","aria-hidden":"true"})})]})]}),i&&(0,J.jsx)("p",{className:"px-1 text-xs text-[var(--color-error)]",children:i}),!a&&(0,J.jsxs)("div",{className:"flex items-center gap-2 px-1 py-4 text-xs text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-4 animate-spin","aria-hidden":"true"}),"Loading…"]}),a&&0===n.length&&(0,J.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-10 text-center",children:[(0,J.jsx)(v6,{className:"size-9 text-muted-foreground/60","aria-hidden":"true"}),(0,J.jsx)("p",{className:"text-sm text-muted-foreground",children:"No background agents yet."}),(0,J.jsx)("p",{className:"text-xs text-muted-foreground/80",children:"When EvoScientist delegates long tasks (writing, data analysis) they run in the background and show up here."})]}),(0,J.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-1.5 overflow-y-auto",children:n.map(t=>{var n;let a,i,o,l,p=kt[S3(t.liveStatus)],f=u===t.task_id,b=d[t.task_id];return(0,J.jsxs)("div",{className:"rounded-md border border-border bg-background",children:[(0,J.jsxs)("button",{type:"button",onClick:()=>c(f?null:t.task_id),className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-expanded":f,children:[f?(0,J.jsx)(la,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}):(0,J.jsx)(ko,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,J.jsx)(TC,{status:t.liveStatus}),(0,J.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:S5[n=t.agent_name]??n}),(0,J.jsxs)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[p.label,(a="running"===S3(t.liveStatus)?s:t.endedAt?Date.parse(t.endedAt):s,(i=function(e,t){if(!e)return"";let r=Date.parse(e);if(Number.isNaN(r))return"";let n=Math.max(0,Math.round((t-r)/1e3)),a=Math.floor(n/60);if(a>=60){let e=Math.floor(a/60);return`${e}h ${a%60}m`}return a>0?`${a}m ${n%60}s`:`${n}s`}(t.startedAt??t.created_at,a))?` \xb7 ${i}`:"")]})]}),f&&(0,J.jsxs)("div",{className:"border-t border-border px-2.5 py-2 text-xs",children:[b?.loading&&(0,J.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Loading steps…"]}),b?.error&&(0,J.jsx)("p",{className:"text-[var(--color-error)]",children:b.error}),b&&!b.loading&&!b.error&&(0,J.jsxs)("div",{className:"flex flex-col gap-2",children:[b.prompt&&(0,J.jsxs)("div",{children:[(0,J.jsx)("p",{className:"font-semibold text-foreground",children:"Task"}),(0,J.jsx)("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:b.prompt.length>600?b.prompt.slice(0,600)+"…":b.prompt})]}),(0,J.jsxs)("div",{children:[(0,J.jsxs)("p",{className:"mb-1 font-semibold text-foreground",children:["Steps"," ",(0,J.jsxs)("span",{className:"font-normal text-muted-foreground",children:["(",b.steps.length,")"]})]}),0===b.steps.length?(0,J.jsx)("p",{className:"text-muted-foreground",children:"No steps yet."}):(0,J.jsx)(S4,{steps:b.steps,compact:!0})]}),kr(t.liveStatus)&&(0,J.jsx)("div",{className:"mt-1 border-t border-border pt-2",children:g?(0,J.jsxs)("p",{className:"inline-flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[(0,J.jsx)(TA,{className:"size-3.5 text-[var(--brand)]","aria-hidden":"true"}),"Auto-report on · future completions notify the main chat"]}):(0,J.jsxs)("button",{type:"button",onClick:()=>(t=>{if(!e||!r)return void u_.toast.error("Open the conversation to notify the main agent.");let n=e(t,r);if("sent"===n){h(e=>({...e,[S9(t)]:!0})),u_.toast.success("Reported to the main chat.");return}if("duplicate"===n){h(e=>({...e,[S9(t)]:!0})),u_.toast.info("This result is already in the main chat.");return}u_.toast.error("wrong-thread"===n?"The active conversation changed — reopen this task and try again.":"Main chat is busy — try again when it's idle.")})(t),disabled:!e||!!m[S9(t)],title:e?"Send this result back to the main agent":"Open the conversation to notify the main agent",className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[11px] font-medium text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[(0,J.jsx)(TN,{className:"size-3.5 text-[var(--brand)]","aria-hidden":"true"}),m[S9(t)]?"Reported to main chat":"Notify main chat"]})}),(o="running"===S3(t.liveStatus),l=!!_[t.task_id],(0,J.jsxs)("div",{className:"mt-1 border-t border-border pt-2",children:[(0,J.jsx)("p",{className:"mb-1 text-[11px] text-muted-foreground",children:"Direct follow-up · Main chat is not notified"}),(0,J.jsxs)("form",{onSubmit:e=>{e.preventDefault(),k(t)},className:"flex items-center gap-1.5",children:[(0,J.jsx)("input",{type:"text",name:`agent-message-${t.task_id}`,autoComplete:"off",value:y[t.task_id]??"",onChange:e=>v(r=>({...r,[t.task_id]:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&(e.nativeEvent.isComposing||229===e.keyCode)&&e.preventDefault()},disabled:o||l,placeholder:o?"Agent is working…":"Send a direct follow-up…","aria-label":"Message this agent",className:"min-w-0 flex-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60"}),(0,J.jsx)("button",{type:"submit",disabled:o||l||!(y[t.task_id]??"").trim(),"aria-label":"Send",title:"Send to this agent",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md bg-[var(--brand-solid)] text-[var(--brand-foreground)] transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40",children:l?(0,J.jsx)(a1,{className:"size-3.5 animate-spin","aria-hidden":"true"}):(0,J.jsx)(vY,{className:"size-3.5","aria-hidden":"true"})})]}),E[t.task_id]&&(0,J.jsx)("p",{className:"mt-1 text-[var(--color-error)]",role:"status","aria-live":"polite",children:E[t.task_id]})]}))]})]})]},t.task_id)})})]})}function TO({onClose:e,onReportToMainChat:t}){let[r,n]=ec("inspectorTab"),a="agents"===r?"agents":"workspace";return(0,J.jsxs)("div",{className:"flex h-full flex-col border-l border-border bg-sidebar",children:[(0,J.jsxs)("div",{className:"flex h-11 shrink-0 items-center justify-between gap-2 border-b border-border px-2",children:[(0,J.jsxs)("div",{role:"tablist","aria-label":"Inspector",className:"flex items-center gap-1",children:[(0,J.jsxs)("button",{type:"button",role:"tab","aria-selected":"workspace"===a,onClick:()=>n(null),className:rZ("flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","workspace"===a?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,J.jsx)(v1,{className:"size-4 text-[var(--brand)]","aria-hidden":"true"}),"Workspace"]}),(0,J.jsxs)("button",{type:"button",role:"tab","aria-selected":"agents"===a,onClick:()=>n("agents"),className:rZ("flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","agents"===a?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,J.jsx)(v6,{className:"size-4 text-[var(--brand)]","aria-hidden":"true"}),"Agents"]})]}),(0,J.jsx)(na,{variant:"ghost",size:"icon",className:"size-7",onClick:e,"aria-label":"Close inspector",title:"Close",children:(0,J.jsx)(rs,{className:"size-4","aria-hidden":"true"})})]}),"agents"===a?(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden p-3",children:(0,J.jsx)(TR,{onReportToMainChat:t})}):(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:(0,J.jsx)(k8,{})})]})}function TL({config:e,configDialogOpen:t,setConfigDialogOpen:r,handleSaveConfig:n}){let a=nj(),[,i]=ec("threadId"),[o,s]=ec("sidebar"),[l,u]=ec("view"),[c,d]=ec("inspector"),[,p]=ec("inspectorTab"),[f,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(0),[b,y]=(0,Q.useState)(null),[v,_]=(0,Q.useState)(null),[w,E]=(0,Q.useState)(0),[x,S]=(0,Q.useState)(null),k=(0,Q.useCallback)(async()=>{let t=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e.assistantId),r=async()=>{if(t)return await a.assistants.get(e.assistantId);let r=await a.assistants.search({graphId:e.assistantId,limit:100}),n=r.find(e=>e.metadata?.created_by==="system")??r[0];if(!n)throw Error("No assistant found for this graph.");return n};for(let e=0;e<3;e+=1)try{y(await r());return}catch(t){if(e<2){await new Promise(e=>setTimeout(e,700));continue}console.warn("Couldn't resolve the EvoScientist assistant; addressing the graph by id instead. Is the backend running?",t)}y({assistant_id:e.assistantId,graph_id:e.assistantId,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),config:{},metadata:{},version:1,name:e.assistantId,context:{}})},[a,e.assistantId]);(0,Q.useEffect)(()=>{k()},[k]),(0,Q.useEffect)(()=>{let e=window.matchMedia("(min-width: 768px)"),t=()=>_(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),(0,Q.useEffect)(()=>{!1===v&&o&&c&&d(null)},[c,v,d,o]);let T=(0,Q.useCallback)(()=>s(null),[s]),A=(0,Q.useCallback)(()=>{d(null),p(null)},[d,p]),N=(0,Q.useCallback)(()=>{o?s(null):(!1===v&&A(),s("1"))},[A,v,s,o]),I=(0,Q.useCallback)(()=>{c?A():(!1===v&&s(null),p(null),d("1"))},[A,c,v,d,p,s]),C=(0,Q.useCallback)(()=>{p("agents"),!1===v&&s(null),d("1")},[v,d,s,p]),R=l?o?"Hide navigation":"Show navigation":o?"Hide research":"Show research",O=(0,Q.useCallback)(()=>{k_(null,!1),i(null),u(null),E(e=>e+1)},[i,u]),L=(0,Q.useCallback)(async e=>{k_(null,!1),u(null),await i(e),E(e=>e+1)},[i,u]);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(nc,{open:t,onOpenChange:r,onSave:n,initialConfig:e}),(0,J.jsxs)("div",{className:"flex h-screen flex-col",children:[(0,J.jsxs)("header",{className:"flex h-14 items-center justify-between gap-2 border-b border-border px-2.5 sm:px-4",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2 sm:gap-3",children:[(0,J.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,J.jsx)(ee.default,{src:"/evoscientist-logo.png",alt:"EvoScientist",width:28,height:28,className:"size-6 shrink-0",priority:!0}),o&&(0,J.jsx)("h1",{className:"truncate text-base font-semibold sm:text-lg",children:"EvoScientist"})]}),(0,J.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,J.jsxs)(na,{variant:"ghost",size:"icon",onClick:N,"aria-label":R,className:"relative size-8",children:[o?(0,J.jsx)(nz,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(nU,{className:"size-5","aria-hidden":"true"}),h>0&&(0,J.jsx)("span",{className:"absolute right-0 top-0 inline-flex min-h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] text-destructive-foreground",children:h})]}),!o&&(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:O,"aria-label":"New chat",className:"size-8",children:(0,J.jsx)(n$,{className:"size-5","aria-hidden":"true"})})]})]}),(0,J.jsxs)("div",{className:"flex shrink-0 items-center gap-1 sm:gap-2",children:[(0,J.jsx)(TT,{deploymentUrl:e.deploymentUrl,onReconnect:t=>n({...e,deploymentUrl:t})}),(0,J.jsx)(TE,{}),(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:I,"aria-label":c?"Hide inspector":"Show workspace",title:c?"Hide inspector":"Show workspace",className:"size-8",children:c?(0,J.jsx)(nH,{className:"size-5","aria-hidden":"true"}):(0,J.jsx)(nB,{className:"size-5","aria-hidden":"true"})}),(0,J.jsx)(na,{variant:"ghost",size:"icon",onClick:()=>r(!0),"aria-label":"Settings",title:"Settings",className:"size-8",children:(0,J.jsx)(nF,{className:"size-5","aria-hidden":"true"})})]})]}),(0,J.jsxs)("div",{className:"relative flex-1 overflow-hidden",children:[o&&!1===v&&(0,J.jsxs)("div",{className:"absolute inset-0 z-40 flex md:hidden",children:[(0,J.jsx)("button",{type:"button","aria-label":"Close research",className:"absolute inset-0 bg-black/40",onClick:T}),(0,J.jsx)("aside",{"aria-label":l?"Navigation":"Research navigation",className:"relative z-10 h-full w-[min(19rem,calc(100vw-2.25rem))] bg-background shadow-xl",children:(0,J.jsx)(uI,{onClose:T,onNewChat:O,onThreadSelect:async e=>{await L(e),T()},onMutateReady:e=>m(()=>e),onInterruptCountChange:g})})]}),c&&!1===v&&(0,J.jsxs)("div",{className:"absolute inset-0 z-40 flex justify-end md:hidden",children:[(0,J.jsx)("button",{type:"button","aria-label":"Close inspector",className:"absolute inset-0 bg-black/40",onClick:A}),(0,J.jsx)("aside",{"aria-label":"Inspector",className:"relative z-10 h-full w-[min(22rem,calc(100vw-2.25rem))] bg-background shadow-xl",children:(0,J.jsx)(TO,{onClose:A,onReportToMainChat:x})})]}),(0,J.jsxs)(aJ,{direction:"horizontal",autoSaveId:"evoscientist-chat",children:[o&&v&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(n2,{id:"thread-history",order:1,defaultSize:23,minSize:18,className:"relative min-w-[260px]",children:(0,J.jsx)(uI,{onNewChat:O,onThreadSelect:L,onMutateReady:e=>m(()=>e),onInterruptCountChange:g})}),(0,J.jsx)(aQ,{})]}),(0,J.jsx)(n2,{id:"chat",className:"relative flex flex-col",order:2,children:"skills"===l?(0,J.jsx)(To,{}):"memory"===l?(0,J.jsx)(Tb,{}):(0,J.jsx)(vq,{activeAssistant:b,onHistoryRevalidate:()=>f?.(),children:(0,J.jsx)(Tt,{assistant:b,onShowAgents:C,onNotifyReady:e=>S(()=>e)})},w)}),c&&v&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(aQ,{}),(0,J.jsx)(n2,{id:"inspector",order:3,defaultSize:26,minSize:20,className:"relative min-w-[300px]",children:(0,J.jsx)(TO,{onClose:A,onReportToMainChat:x})})]})]})]})]})]})}function TP(){let[e,t]=(0,Q.useState)(null),[r,n]=(0,Q.useState)(!1),[a,i]=ec("assistantId");(0,Q.useEffect)(()=>{let e=ef();e?(t(e),a||i(e.assistantId)):n(!0)},[]),(0,Q.useEffect)(()=>{e&&!a&&i(e.assistantId)},[e,a,i]);let o=(0,Q.useCallback)(e=>{localStorage.setItem(ep,JSON.stringify(e)),t(e)},[]),s=e?.langsmithApiKey||X.default.env.NEXT_PUBLIC_LANGSMITH_API_KEY||"";return e?(0,J.jsx)(nM,{deploymentUrl:e.deploymentUrl,apiKey:s,children:(0,J.jsx)(TL,{config:e,configDialogOpen:r,setConfigDialogOpen:n,handleSaveConfig:o})}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(nc,{open:r,onOpenChange:n,onSave:o}),(0,J.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,J.jsxs)("div",{className:"text-center",children:[(0,J.jsx)("h1",{className:"text-2xl font-bold",children:"Welcome to EvoScientist"}),(0,J.jsx)("p",{className:"mt-2 text-muted-foreground",children:"Configure your deployment to get started"}),(0,J.jsx)(na,{onClick:()=>n(!0),className:"mt-4",children:"Open Configuration"})]})})]})}e.s(["default",0,function(){return(0,J.jsx)(Q.Suspense,{fallback:(0,J.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,J.jsx)("p",{className:"text-muted-foreground",children:"Loading…"})}),children:(0,J.jsx)(TP,{})})}],52683)}]);
|