@evoscientist/webui 0.0.8 → 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 +2 -2
- 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/{11ms2szeastrp.css → 0njfd4s35t8hg.css} +1 -1
- package/dist/.next/static/chunks/{01.o8qmzb7x8w.js → 0r0k~7apz1g3~.js} +2 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
- /package/dist/.next/static/{8wgKT0WPKJdF4mmOVB0HI → _leTiU4W6HEDdB5K1SmTt}/_buildManifest.js +0 -0
- /package/dist/.next/static/{8wgKT0WPKJdF4mmOVB0HI → _leTiU4W6HEDdB5K1SmTt}/_clientMiddlewareManifest.js +0 -0
- /package/dist/.next/static/{8wgKT0WPKJdF4mmOVB0HI → _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}
|
|
@@ -72,4 +72,4 @@ ${a.content}`),t.push(function(e){let t,r=e.getType(),n=Object.fromEntries(Objec
|
|
|
72
72
|
Workspace files uploaded for this request:
|
|
73
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=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"})})}function Tx(){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 TS={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 Tk(e){return e.trim().replace(/\/+$/,"")}async function TT(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 TA({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=Tk(e);try{let e=await fetch("/api/evosci-config",{cache:"no-store"}),n=await e.json().catch(()=>null),a=n?.deploymentUrl?Tk(n.deploymentUrl):"";if(t!==l.current||!u.current)return;if(!a||a===r)return void s(null);let i=await TT(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=Tk(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=TS[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 TN=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"}]]),TI=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 TC(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 TR({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 TO({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}=TC(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}=TC(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)(TN,{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)(TR,{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)(TN,{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)(TI,{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 TL({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)(TO,{onReportToMainChat:t})}):(0,J.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:(0,J.jsx)(k8,{})})]})}function TP({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.jsxs)(J.Fragment,{children:[(0,J.jsx)("h1",{className:"truncate text-base font-semibold sm:text-lg",children:"EvoScientist"}),(0,J.jsx)(Tx,{})]})]}),(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)(TA,{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)(TL,{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)(TL,{onClose:A,onReportToMainChat:x})})]})]})]})]})]})}function TD(){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)(TP,{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)(TD,{})})}],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)}]);
|