@mcp-use/inspector 0.4.11 → 0.4.12-canary.0

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-ByN-8efJ.js","assets/index-CynUsoYY.js","assets/chunk-VL2OQCWN-Ce71Oujn.js","assets/embeddings-x1-vu32M.js","assets/index-D56cgcLQ.js","assets/index-CLrmeqJ5.js","assets/langfuse-LCJ6VJEP-B8zS6koH.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DbqanY6c.js","assets/index-D-_HYYNB.js","assets/chunk-VL2OQCWN-DDPfe4wt.js","assets/embeddings-YBqRlE4m.js","assets/index-BPuwotMA.js","assets/index-zX0NhVAe.js","assets/langfuse-LCJ6VJEP-DVie-pDz.js"])))=>i.map(i=>d[i]);
2
2
  var FY=Object.defineProperty;var BY=(t,e,r)=>e in t?FY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Tp=(t,e,r)=>BY(t,typeof e!="symbol"?e+"":e,r);function $Y(t,e){for(var r=0;r<e.length;r++){const a=e[r];if(typeof a!="string"&&!Array.isArray(a)){for(const n in a)if(n!=="default"&&!(n in t)){const o=Object.getOwnPropertyDescriptor(a,n);o&&Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>a[n]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function r(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(n){if(n.ep)return;n.ep=!0;const o=r(n);fetch(n.href,o)}})();function wu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Om(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function a(){var n=!1;try{n=this instanceof a}catch{}return n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(a){var n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(r,a,n.get?n:{enumerable:!0,get:function(){return t[a]}})}),r}var Py={exports:{}},Cc={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -352,7 +352,7 @@ Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}
352
352
  *
353
353
  * This source code is licensed under the ISC license.
354
354
  * See the LICENSE file in the root directory of this source tree.
355
- */const Kre=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ed=vt("zap",Kre);function Zre(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}const Xre=t=>{switch(t){case"success":return ene;case"info":return rne;case"warning":return tne;case"error":return nne;default:return null}},Qre=Array(12).fill(0),Jre=({visible:t,className:e})=>je.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},je.createElement("div",{className:"sonner-spinner"},Qre.map((r,a)=>je.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),ene=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),tne=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),rne=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),nne=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),ane=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},je.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),je.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),ine=()=>{const[t,e]=je.useState(document.hidden);return je.useEffect(()=>{const r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t};let gA=1;class one{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;const{message:a,...n}=e,o=typeof e?.id=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:gA++,l=this.toasts.find(c=>c.id===o),u=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),l?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...e,id:o,title:a}),{...c,...e,id:o,dismissible:u,title:a}):c):this.addToast({title:a,...n,dismissible:u,id:o}),o},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:e,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(a=>a({id:r.id,dismiss:!0}))}),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let a;r.loading!==void 0&&(a=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const n=Promise.resolve(e instanceof Function?e():e);let o=a!==void 0,l;const u=n.then(async f=>{if(l=["resolve",f],je.isValidElement(f))o=!1,this.create({id:a,type:"default",message:f});else if(lne(f)&&!f.ok){o=!1;const h=typeof r.error=="function"?await r.error(`HTTP error! status: ${f.status}`):r.error,g=typeof r.description=="function"?await r.description(`HTTP error! status: ${f.status}`):r.description,w=typeof h=="object"&&!je.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...w})}else if(f instanceof Error){o=!1;const h=typeof r.error=="function"?await r.error(f):r.error,g=typeof r.description=="function"?await r.description(f):r.description,w=typeof h=="object"&&!je.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...w})}else if(r.success!==void 0){o=!1;const h=typeof r.success=="function"?await r.success(f):r.success,g=typeof r.description=="function"?await r.description(f):r.description,w=typeof h=="object"&&!je.isValidElement(h)?h:{message:h};this.create({id:a,type:"success",description:g,...w})}}).catch(async f=>{if(l=["reject",f],r.error!==void 0){o=!1;const p=typeof r.error=="function"?await r.error(f):r.error,h=typeof r.description=="function"?await r.description(f):r.description,v=typeof p=="object"&&!je.isValidElement(p)?p:{message:p};this.create({id:a,type:"error",description:h,...v})}}).finally(()=>{o&&(this.dismiss(a),a=void 0),r.finally==null||r.finally.call(r)}),c=()=>new Promise((f,p)=>u.then(()=>l[0]==="reject"?p(l[1]):f(l[1])).catch(p));return typeof a!="string"&&typeof a!="number"?{unwrap:c}:Object.assign(a,{unwrap:c})},this.custom=(e,r)=>{const a=r?.id||gA++;return this.create({jsx:e(a),id:a,...r}),a},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Tn=new one,sne=(t,e)=>{const r=e?.id||gA++;return Tn.addToast({title:t,...e,id:r}),r},lne=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",une=sne,cne=()=>Tn.toasts,dne=()=>Tn.getActiveToasts(),xr=Object.assign(une,{success:Tn.success,info:Tn.info,warning:Tn.warning,error:Tn.error,custom:Tn.custom,message:Tn.message,promise:Tn.promise,dismiss:Tn.dismiss,loading:Tn.loading},{getHistory:cne,getToasts:dne});Zre("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function ah(t){return t.label!==void 0}const fne=3,pne="24px",hne="16px",yj=4e3,mne=356,gne=14,vne=45,yne=200;function La(...t){return t.filter(Boolean).join(" ")}function bne(t){const[e,r]=t.split("-"),a=[];return e&&a.push(e),r&&a.push(r),a}const Ene=t=>{var e,r,a,n,o,l,u,c,f;const{invert:p,toast:h,unstyled:g,interacting:v,setHeights:w,visibleToasts:b,heights:_,index:y,toasts:E,expanded:x,removeToast:T,defaultRichColors:C,closeButton:N,style:O,cancelButtonStyle:I,actionButtonStyle:M,className:D="",descriptionClassName:$="",duration:G,position:V,gap:ee,expandByDefault:ne,classNames:F,icons:z,closeButtonAriaLabel:H="Close toast"}=t,[Q,ae]=je.useState(null),[W,Y]=je.useState(null),[K,te]=je.useState(!1),[ie,P]=je.useState(!1),[U,X]=je.useState(!1),[le,oe]=je.useState(!1),[q,Z]=je.useState(!1),[fe,pe]=je.useState(0),[Te,Ce]=je.useState(0),ve=je.useRef(h.duration||G||yj),Me=je.useRef(null),Be=je.useRef(null),De=y===0,Pe=y+1<=b,Le=h.type,$e=h.dismissible!==!1,We=h.className||"",mt=h.descriptionClassName||"",Pt=je.useMemo(()=>_.findIndex(at=>at.toastId===h.id)||0,[_,h.id]),J=je.useMemo(()=>{var at;return(at=h.closeButton)!=null?at:N},[h.closeButton,N]),L=je.useMemo(()=>h.duration||G||yj,[h.duration,G]),j=je.useRef(0),se=je.useRef(0),ge=je.useRef(0),be=je.useRef(null),[Ne,Qe]=V.split("-"),ht=je.useMemo(()=>_.reduce((at,Ht,ar)=>ar>=Pt?at:at+Ht.height,0),[_,Pt]),pt=ine(),yt=h.invert||p,xt=Le==="loading";se.current=je.useMemo(()=>Pt*ee+ht,[Pt,ht]),je.useEffect(()=>{ve.current=L},[L]),je.useEffect(()=>{te(!0)},[]),je.useEffect(()=>{const at=Be.current;if(at){const Ht=at.getBoundingClientRect().height;return Ce(Ht),w(ar=>[{toastId:h.id,height:Ht,position:h.position},...ar]),()=>w(ar=>ar.filter(jr=>jr.toastId!==h.id))}},[w,h.id]),je.useLayoutEffect(()=>{if(!K)return;const at=Be.current,Ht=at.style.height;at.style.height="auto";const ar=at.getBoundingClientRect().height;at.style.height=Ht,Ce(ar),w(jr=>jr.find(nr=>nr.toastId===h.id)?jr.map(nr=>nr.toastId===h.id?{...nr,height:ar}:nr):[{toastId:h.id,height:ar,position:h.position},...jr])},[K,h.title,h.description,w,h.id,h.jsx,h.action,h.cancel]);const dr=je.useCallback(()=>{P(!0),pe(se.current),w(at=>at.filter(Ht=>Ht.toastId!==h.id)),setTimeout(()=>{T(h)},yne)},[h,T,w,se]);je.useEffect(()=>{if(h.promise&&Le==="loading"||h.duration===1/0||h.type==="loading")return;let at;return x||v||pt?(()=>{if(ge.current<j.current){const jr=new Date().getTime()-j.current;ve.current=ve.current-jr}ge.current=new Date().getTime()})():(()=>{ve.current!==1/0&&(j.current=new Date().getTime(),at=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),dr()},ve.current))})(),()=>clearTimeout(at)},[x,v,h,Le,pt,dr]),je.useEffect(()=>{h.delete&&(dr(),h.onDismiss==null||h.onDismiss.call(h,h))},[dr,h.delete]);function Jt(){var at;if(z?.loading){var Ht;return je.createElement("div",{className:La(F?.loader,h==null||(Ht=h.classNames)==null?void 0:Ht.loader,"sonner-loader"),"data-visible":Le==="loading"},z.loading)}return je.createElement(Jre,{className:La(F?.loader,h==null||(at=h.classNames)==null?void 0:at.loader),visible:Le==="loading"})}const gn=h.icon||z?.[Le]||Xre(Le);var da,ln;return je.createElement("li",{tabIndex:0,ref:Be,className:La(D,We,F?.toast,h==null||(e=h.classNames)==null?void 0:e.toast,F?.default,F?.[Le],h==null||(r=h.classNames)==null?void 0:r[Le]),"data-sonner-toast":"","data-rich-colors":(da=h.richColors)!=null?da:C,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":K,"data-promise":!!h.promise,"data-swiped":q,"data-removed":ie,"data-visible":Pe,"data-y-position":Ne,"data-x-position":Qe,"data-index":y,"data-front":De,"data-swiping":U,"data-dismissible":$e,"data-type":Le,"data-invert":yt,"data-swipe-out":le,"data-swipe-direction":W,"data-expanded":!!(x||ne&&K),"data-testid":h.testId,style:{"--index":y,"--toasts-before":y,"--z-index":E.length-y,"--offset":`${ie?fe:se.current}px`,"--initial-height":ne?"auto":`${Te}px`,...O,...h.style},onDragEnd:()=>{X(!1),ae(null),be.current=null},onPointerDown:at=>{at.button!==2&&(xt||!$e||(Me.current=new Date,pe(se.current),at.target.setPointerCapture(at.pointerId),at.target.tagName!=="BUTTON"&&(X(!0),be.current={x:at.clientX,y:at.clientY})))},onPointerUp:()=>{var at,Ht,ar;if(le||!$e)return;be.current=null;const jr=Number(((at=Be.current)==null?void 0:at.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),qn=Number(((Ht=Be.current)==null?void 0:Ht.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),nr=new Date().getTime()-((ar=Me.current)==null?void 0:ar.getTime()),Jr=Q==="x"?jr:qn,Aa=Math.abs(Jr)/nr;if(Math.abs(Jr)>=vne||Aa>.11){pe(se.current),h.onDismiss==null||h.onDismiss.call(h,h),Y(Q==="x"?jr>0?"right":"left":qn>0?"down":"up"),dr(),oe(!0);return}else{var en,zr;(en=Be.current)==null||en.style.setProperty("--swipe-amount-x","0px"),(zr=Be.current)==null||zr.style.setProperty("--swipe-amount-y","0px")}Z(!1),X(!1),ae(null)},onPointerMove:at=>{var Ht,ar,jr;if(!be.current||!$e||((Ht=window.getSelection())==null?void 0:Ht.toString().length)>0)return;const nr=at.clientY-be.current.y,Jr=at.clientX-be.current.x;var Aa;const en=(Aa=t.swipeDirections)!=null?Aa:bne(V);!Q&&(Math.abs(Jr)>1||Math.abs(nr)>1)&&ae(Math.abs(Jr)>Math.abs(nr)?"x":"y");let zr={x:0,y:0};const de=ue=>1/(1.5+Math.abs(ue)/20);if(Q==="y"){if(en.includes("top")||en.includes("bottom"))if(en.includes("top")&&nr<0||en.includes("bottom")&&nr>0)zr.y=nr;else{const ue=nr*de(nr);zr.y=Math.abs(ue)<Math.abs(nr)?ue:nr}}else if(Q==="x"&&(en.includes("left")||en.includes("right")))if(en.includes("left")&&Jr<0||en.includes("right")&&Jr>0)zr.x=Jr;else{const ue=Jr*de(Jr);zr.x=Math.abs(ue)<Math.abs(Jr)?ue:Jr}(Math.abs(zr.x)>0||Math.abs(zr.y)>0)&&Z(!0),(ar=Be.current)==null||ar.style.setProperty("--swipe-amount-x",`${zr.x}px`),(jr=Be.current)==null||jr.style.setProperty("--swipe-amount-y",`${zr.y}px`)}},J&&!h.jsx&&Le!=="loading"?je.createElement("button",{"aria-label":H,"data-disabled":xt,"data-close-button":!0,onClick:xt||!$e?()=>{}:()=>{dr(),h.onDismiss==null||h.onDismiss.call(h,h)},className:La(F?.closeButton,h==null||(a=h.classNames)==null?void 0:a.closeButton)},(ln=z?.close)!=null?ln:ane):null,(Le||h.icon||h.promise)&&h.icon!==null&&(z?.[Le]!==null||h.icon)?je.createElement("div",{"data-icon":"",className:La(F?.icon,h==null||(n=h.classNames)==null?void 0:n.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Jt():null,h.type!=="loading"?gn:null):null,je.createElement("div",{"data-content":"",className:La(F?.content,h==null||(o=h.classNames)==null?void 0:o.content)},je.createElement("div",{"data-title":"",className:La(F?.title,h==null||(l=h.classNames)==null?void 0:l.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?je.createElement("div",{"data-description":"",className:La($,mt,F?.description,h==null||(u=h.classNames)==null?void 0:u.description)},typeof h.description=="function"?h.description():h.description):null),je.isValidElement(h.cancel)?h.cancel:h.cancel&&ah(h.cancel)?je.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||I,onClick:at=>{ah(h.cancel)&&$e&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,at),dr())},className:La(F?.cancelButton,h==null||(c=h.classNames)==null?void 0:c.cancelButton)},h.cancel.label):null,je.isValidElement(h.action)?h.action:h.action&&ah(h.action)?je.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||M,onClick:at=>{ah(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,at),!at.defaultPrevented&&dr())},className:La(F?.actionButton,h==null||(f=h.classNames)==null?void 0:f.actionButton)},h.action.label):null)};function bj(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Sne(t,e){const r={};return[t,e].forEach((a,n)=>{const o=n===1,l=o?"--mobile-offset":"--offset",u=o?hne:pne;function c(f){["top","right","bottom","left"].forEach(p=>{r[`${l}-${p}`]=typeof f=="number"?`${f}px`:f})}typeof a=="number"||typeof a=="string"?c(a):typeof a=="object"?["top","right","bottom","left"].forEach(f=>{a[f]===void 0?r[`${l}-${f}`]=u:r[`${l}-${f}`]=typeof a[f]=="number"?`${a[f]}px`:a[f]}):c(u)}),r}const wne=je.forwardRef(function(e,r){const{id:a,invert:n,position:o="bottom-right",hotkey:l=["altKey","KeyT"],expand:u,closeButton:c,className:f,offset:p,mobileOffset:h,theme:g="light",richColors:v,duration:w,style:b,visibleToasts:_=fne,toastOptions:y,dir:E=bj(),gap:x=gne,icons:T,containerAriaLabel:C="Notifications"}=e,[N,O]=je.useState([]),I=je.useMemo(()=>a?N.filter(K=>K.toasterId===a):N.filter(K=>!K.toasterId),[N,a]),M=je.useMemo(()=>Array.from(new Set([o].concat(I.filter(K=>K.position).map(K=>K.position)))),[I,o]),[D,$]=je.useState([]),[G,V]=je.useState(!1),[ee,ne]=je.useState(!1),[F,z]=je.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=je.useRef(null),Q=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),ae=je.useRef(null),W=je.useRef(!1),Y=je.useCallback(K=>{O(te=>{var ie;return(ie=te.find(P=>P.id===K.id))!=null&&ie.delete||Tn.dismiss(K.id),te.filter(({id:P})=>P!==K.id)})},[]);return je.useEffect(()=>Tn.subscribe(K=>{if(K.dismiss){requestAnimationFrame(()=>{O(te=>te.map(ie=>ie.id===K.id?{...ie,delete:!0}:ie))});return}setTimeout(()=>{GH.flushSync(()=>{O(te=>{const ie=te.findIndex(P=>P.id===K.id);return ie!==-1?[...te.slice(0,ie),{...te[ie],...K},...te.slice(ie+1)]:[K,...te]})})})}),[N]),je.useEffect(()=>{if(g!=="system"){z(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;const K=window.matchMedia("(prefers-color-scheme: dark)");try{K.addEventListener("change",({matches:te})=>{z(te?"dark":"light")})}catch{K.addListener(({matches:ie})=>{try{z(ie?"dark":"light")}catch(P){console.error(P)}})}},[g]),je.useEffect(()=>{N.length<=1&&V(!1)},[N]),je.useEffect(()=>{const K=te=>{var ie;if(l.every(X=>te[X]||te.code===X)){var U;V(!0),(U=H.current)==null||U.focus()}te.code==="Escape"&&(document.activeElement===H.current||(ie=H.current)!=null&&ie.contains(document.activeElement))&&V(!1)};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[l]),je.useEffect(()=>{if(H.current)return()=>{ae.current&&(ae.current.focus({preventScroll:!0}),ae.current=null,W.current=!1)}},[H.current]),je.createElement("section",{ref:r,"aria-label":`${C} ${Q}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((K,te)=>{var ie;const[P,U]=K.split("-");return I.length?je.createElement("ol",{key:K,dir:E==="auto"?bj():E,tabIndex:-1,ref:H,className:f,"data-sonner-toaster":!0,"data-sonner-theme":F,"data-y-position":P,"data-x-position":U,style:{"--front-toast-height":`${((ie=D[0])==null?void 0:ie.height)||0}px`,"--width":`${mne}px`,"--gap":`${x}px`,...b,...Sne(p,h)},onBlur:X=>{W.current&&!X.currentTarget.contains(X.relatedTarget)&&(W.current=!1,ae.current&&(ae.current.focus({preventScroll:!0}),ae.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||W.current||(W.current=!0,ae.current=X.relatedTarget)},onMouseEnter:()=>V(!0),onMouseMove:()=>V(!0),onMouseLeave:()=>{ee||V(!1)},onDragEnd:()=>V(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||ne(!0)},onPointerUp:()=>ne(!1)},I.filter(X=>!X.position&&te===0||X.position===K).map((X,le)=>{var oe,q;return je.createElement(Ene,{key:X.id,icons:T,index:le,toast:X,defaultRichColors:v,duration:(oe=y?.duration)!=null?oe:w,className:y?.className,descriptionClassName:y?.descriptionClassName,invert:n,visibleToasts:_,closeButton:(q=y?.closeButton)!=null?q:c,interacting:ee,position:K,style:y?.style,unstyled:y?.unstyled,classNames:y?.classNames,cancelButtonStyle:y?.cancelButtonStyle,actionButtonStyle:y?.actionButtonStyle,closeButtonAriaLabel:y?.closeButtonAriaLabel,removeToast:Y,toasts:I.filter(Z=>Z.position==X.position),heights:D.filter(Z=>Z.position==X.position),setHeights:$,expandByDefault:u,gap:x,expanded:G,swipeDirections:e.swipeDirections})})):null}))});function Ej(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Mi(...t){return e=>{let r=!1;const a=t.map(n=>{const o=Ej(n,e);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let n=0;n<a.length;n++){const o=a[n];typeof o=="function"?o():Ej(t[n],null)}}}}function Ut(...t){return R.useCallback(Mi(...t),t)}function Io(t){const e=_ne(t),r=R.forwardRef((a,n)=>{const{children:o,...l}=a,u=R.Children.toArray(o),c=u.find(Tne);if(c){const f=c.props.children,p=u.map(h=>h===c?R.Children.count(f)>1?R.Children.only(null):R.isValidElement(f)?f.props.children:null:h);return S.jsx(e,{...l,ref:n,children:R.isValidElement(f)?R.cloneElement(f,void 0,p):null})}return S.jsx(e,{...l,ref:n,children:o})});return r.displayName=`${t}.Slot`,r}var JH=Io("Slot");function _ne(t){const e=R.forwardRef((r,a)=>{const{children:n,...o}=r;if(R.isValidElement(n)){const l=Ane(n),u=Rne(o,n.props);return n.type!==R.Fragment&&(u.ref=a?Mi(a,l):l),R.cloneElement(n,u)}return R.Children.count(n)>1?R.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var e5=Symbol("radix.slottable");function xne(t){const e=({children:r})=>S.jsx(S.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=e5,e}function Tne(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===e5}function Rne(t,e){const r={...e};for(const a in e){const n=t[a],o=e[a];/^on[A-Z]/.test(a)?n&&o?r[a]=(...u)=>{const c=o(...u);return n(...u),c}:n&&(r[a]=n):a==="style"?r[a]={...n,...o}:a==="className"&&(r[a]=[n,o].filter(Boolean).join(" "))}return{...t,...r}}function Ane(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function t5(t){var e,r,a="";if(typeof t=="string"||typeof t=="number")a+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(e=0;e<n;e++)t[e]&&(r=t5(t[e]))&&(a&&(a+=" "),a+=r)}else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}function r5(){for(var t,e,r=0,a="",n=arguments.length;r<n;r++)(t=arguments[r])&&(e=t5(t))&&(a&&(a+=" "),a+=e);return a}const Sj=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,wj=r5,n5=(t,e)=>r=>{var a;if(e?.variants==null)return wj(t,r?.class,r?.className);const{variants:n,defaultVariants:o}=e,l=Object.keys(n).map(f=>{const p=r?.[f],h=o?.[f];if(p===null)return null;const g=Sj(p)||Sj(h);return n[f][g]}),u=r&&Object.entries(r).reduce((f,p)=>{let[h,g]=p;return g===void 0||(f[h]=g),f},{}),c=e==null||(a=e.compoundVariants)===null||a===void 0?void 0:a.reduce((f,p)=>{let{class:h,className:g,...v}=p;return Object.entries(v).every(w=>{let[b,_]=w;return Array.isArray(_)?_.includes({...o,...u}[b]):{...o,...u}[b]===_})?[...f,h,g]:f},[]);return wj(t,l,c,r?.class,r?.className)},t1="-",Cne=t=>{const e=kne(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=t;return{getClassGroupId:l=>{const u=l.split(t1);return u[0]===""&&u.length!==1&&u.shift(),a5(u,e)||Nne(l)},getConflictingClassGroupIds:(l,u)=>{const c=r[l]||[];return u&&a[l]?[...c,...a[l]]:c}}},a5=(t,e)=>{if(t.length===0)return e.classGroupId;const r=t[0],a=e.nextPart.get(r),n=a?a5(t.slice(1),a):void 0;if(n)return n;if(e.validators.length===0)return;const o=t.join(t1);return e.validators.find(({validator:l})=>l(o))?.classGroupId},_j=/^\[(.+)\]$/,Nne=t=>{if(_j.test(t)){const e=_j.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},kne=t=>{const{theme:e,classGroups:r}=t,a={nextPart:new Map,validators:[]};for(const n in r)vA(r[n],a,n,e);return a},vA=(t,e,r,a)=>{t.forEach(n=>{if(typeof n=="string"){const o=n===""?e:xj(e,n);o.classGroupId=r;return}if(typeof n=="function"){if(One(n)){vA(n(a),e,r,a);return}e.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([o,l])=>{vA(l,xj(e,o),r,a)})})},xj=(t,e)=>{let r=t;return e.split(t1).forEach(a=>{r.nextPart.has(a)||r.nextPart.set(a,{nextPart:new Map,validators:[]}),r=r.nextPart.get(a)}),r},One=t=>t.isThemeGetter,Ine=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,a=new Map;const n=(o,l)=>{r.set(o,l),e++,e>t&&(e=0,a=r,r=new Map)};return{get(o){let l=r.get(o);if(l!==void 0)return l;if((l=a.get(o))!==void 0)return n(o,l),l},set(o,l){r.has(o)?r.set(o,l):n(o,l)}}},yA="!",bA=":",Dne=bA.length,Lne=t=>{const{prefix:e,experimentalParseClassName:r}=t;let a=n=>{const o=[];let l=0,u=0,c=0,f;for(let w=0;w<n.length;w++){let b=n[w];if(l===0&&u===0){if(b===bA){o.push(n.slice(c,w)),c=w+Dne;continue}if(b==="/"){f=w;continue}}b==="["?l++:b==="]"?l--:b==="("?u++:b===")"&&u--}const p=o.length===0?n:n.substring(c),h=Mne(p),g=h!==p,v=f&&f>c?f-c:void 0;return{modifiers:o,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:v}};if(e){const n=e+bA,o=a;a=l=>l.startsWith(n)?o(l.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:l,maybePostfixModifierPosition:void 0}}if(r){const n=a;a=o=>r({className:o,parseClassName:n})}return a},Mne=t=>t.endsWith(yA)?t.substring(0,t.length-1):t.startsWith(yA)?t.substring(1):t,Pne=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const n=[];let o=[];return a.forEach(l=>{l[0]==="["||e[l]?(n.push(...o.sort(),l),o=[]):o.push(l)}),n.push(...o.sort()),n}},jne=t=>({cache:Ine(t.cacheSize),parseClassName:Lne(t),sortModifiers:Pne(t),...Cne(t)}),Une=/\s+/,Fne=(t,e)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:o}=e,l=[],u=t.trim().split(Une);let c="";for(let f=u.length-1;f>=0;f-=1){const p=u[f],{isExternal:h,modifiers:g,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:b}=r(p);if(h){c=p+(c.length>0?" "+c:c);continue}let _=!!b,y=a(_?w.substring(0,b):w);if(!y){if(!_){c=p+(c.length>0?" "+c:c);continue}if(y=a(w),!y){c=p+(c.length>0?" "+c:c);continue}_=!1}const E=o(g).join(":"),x=v?E+yA:E,T=x+y;if(l.includes(T))continue;l.push(T);const C=n(y,_);for(let N=0;N<C.length;++N){const O=C[N];l.push(x+O)}c=p+(c.length>0?" "+c:c)}return c};function Bne(){let t=0,e,r,a="";for(;t<arguments.length;)(e=arguments[t++])&&(r=i5(e))&&(a&&(a+=" "),a+=r);return a}const i5=t=>{if(typeof t=="string")return t;let e,r="";for(let a=0;a<t.length;a++)t[a]&&(e=i5(t[a]))&&(r&&(r+=" "),r+=e);return r};function $ne(t,...e){let r,a,n,o=l;function l(c){const f=e.reduce((p,h)=>h(p),t());return r=jne(f),a=r.cache.get,n=r.cache.set,o=u,u(c)}function u(c){const f=a(c);if(f)return f;const p=Fne(c,r);return n(c,p),p}return function(){return o(Bne.apply(null,arguments))}}const Lr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},o5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,s5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zne=/^\d+\/\d+$/,qne=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Hne=/\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$/,Gne=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Vne=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wne=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,El=t=>zne.test(t),Rt=t=>!!t&&!Number.isNaN(Number(t)),mo=t=>!!t&&Number.isInteger(Number(t)),oS=t=>t.endsWith("%")&&Rt(t.slice(0,-1)),Si=t=>qne.test(t),Yne=()=>!0,Kne=t=>Hne.test(t)&&!Gne.test(t),l5=()=>!1,Zne=t=>Vne.test(t),Xne=t=>Wne.test(t),Qne=t=>!Je(t)&&!et(t),Jne=t=>Ou(t,d5,l5),Je=t=>o5.test(t),cs=t=>Ou(t,f5,Kne),sS=t=>Ou(t,aae,Rt),Tj=t=>Ou(t,u5,l5),eae=t=>Ou(t,c5,Xne),ih=t=>Ou(t,p5,Zne),et=t=>s5.test(t),Mc=t=>Iu(t,f5),tae=t=>Iu(t,iae),Rj=t=>Iu(t,u5),rae=t=>Iu(t,d5),nae=t=>Iu(t,c5),oh=t=>Iu(t,p5,!0),Ou=(t,e,r)=>{const a=o5.exec(t);return a?a[1]?e(a[1]):r(a[2]):!1},Iu=(t,e,r=!1)=>{const a=s5.exec(t);return a?a[1]?e(a[1]):r:!1},u5=t=>t==="position"||t==="percentage",c5=t=>t==="image"||t==="url",d5=t=>t==="length"||t==="size"||t==="bg-size",f5=t=>t==="length",aae=t=>t==="number",iae=t=>t==="family-name",p5=t=>t==="shadow",oae=()=>{const t=Lr("color"),e=Lr("font"),r=Lr("text"),a=Lr("font-weight"),n=Lr("tracking"),o=Lr("leading"),l=Lr("breakpoint"),u=Lr("container"),c=Lr("spacing"),f=Lr("radius"),p=Lr("shadow"),h=Lr("inset-shadow"),g=Lr("text-shadow"),v=Lr("drop-shadow"),w=Lr("blur"),b=Lr("perspective"),_=Lr("aspect"),y=Lr("ease"),E=Lr("animate"),x=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...T(),et,Je],N=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],I=()=>[et,Je,c],M=()=>[El,"full","auto",...I()],D=()=>[mo,"none","subgrid",et,Je],$=()=>["auto",{span:["full",mo,et,Je]},mo,et,Je],G=()=>[mo,"auto",et,Je],V=()=>["auto","min","max","fr",et,Je],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ne=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...I()],z=()=>[El,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],H=()=>[t,et,Je],Q=()=>[...T(),Rj,Tj,{position:[et,Je]}],ae=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",rae,Jne,{size:[et,Je]}],Y=()=>[oS,Mc,cs],K=()=>["","none","full",f,et,Je],te=()=>["",Rt,Mc,cs],ie=()=>["solid","dashed","dotted","double"],P=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],U=()=>[Rt,oS,Rj,Tj],X=()=>["","none",w,et,Je],le=()=>["none",Rt,et,Je],oe=()=>["none",Rt,et,Je],q=()=>[Rt,et,Je],Z=()=>[El,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Si],breakpoint:[Si],color:[Yne],container:[Si],"drop-shadow":[Si],ease:["in","out","in-out"],font:[Qne],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Si],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Si],shadow:[Si],spacing:["px",Rt],text:[Si],"text-shadow":[Si],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",El,Je,et,_]}],container:["container"],columns:[{columns:[Rt,Je,et,u]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"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"],sr:["sr-only","not-sr-only"],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:C()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{start:M()}],end:[{end:M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[mo,"auto",et,Je]}],basis:[{basis:[El,"full","auto",u,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Rt,El,"auto","initial","none",Je]}],grow:[{grow:["",Rt,et,Je]}],shrink:[{shrink:["",Rt,et,Je]}],order:[{order:[mo,"first","last","none",et,Je]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...ne(),"normal"]}],"justify-self":[{"justify-self":["auto",...ne()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...ne(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ne(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...ne(),"baseline"]}],"place-self":[{"place-self":["auto",...ne()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],w:[{w:[u,"screen",...z()]}],"min-w":[{"min-w":[u,"screen","none",...z()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",r,Mc,cs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,et,sS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",oS,Je]}],"font-family":[{font:[tae,Je,e]}],"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:[n,et,Je]}],"line-clamp":[{"line-clamp":[Rt,"none",et,sS]}],leading:[{leading:[o,...I()]}],"list-image":[{"list-image":["none",et,Je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,Je]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[Rt,"from-font","auto",et,cs]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[Rt,"auto",et,Je]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,Je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,Je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},mo,et,Je],radial:["",et,Je],conic:[mo,et,Je]},nae,eae]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Rt,et,Je]}],"outline-w":[{outline:["",Rt,Mc,cs]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",p,oh,ih]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",h,oh,ih]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[Rt,cs]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",g,oh,ih]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[Rt,et,Je]}],"mix-blend":[{"mix-blend":[...P(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":P()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Rt]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[et,Je]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Rt]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,Je]}],filter:[{filter:["","none",et,Je]}],blur:[{blur:X()}],brightness:[{brightness:[Rt,et,Je]}],contrast:[{contrast:[Rt,et,Je]}],"drop-shadow":[{"drop-shadow":["","none",v,oh,ih]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",Rt,et,Je]}],"hue-rotate":[{"hue-rotate":[Rt,et,Je]}],invert:[{invert:["",Rt,et,Je]}],saturate:[{saturate:[Rt,et,Je]}],sepia:[{sepia:["",Rt,et,Je]}],"backdrop-filter":[{"backdrop-filter":["","none",et,Je]}],"backdrop-blur":[{"backdrop-blur":X()}],"backdrop-brightness":[{"backdrop-brightness":[Rt,et,Je]}],"backdrop-contrast":[{"backdrop-contrast":[Rt,et,Je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Rt,et,Je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Rt,et,Je]}],"backdrop-invert":[{"backdrop-invert":["",Rt,et,Je]}],"backdrop-opacity":[{"backdrop-opacity":[Rt,et,Je]}],"backdrop-saturate":[{"backdrop-saturate":[Rt,et,Je]}],"backdrop-sepia":[{"backdrop-sepia":["",Rt,et,Je]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,Je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Rt,"initial",et,Je]}],ease:[{ease:["linear","initial",y,et,Je]}],delay:[{delay:[Rt,et,Je]}],animate:[{animate:["none",E,et,Je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,et,Je]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:q()}],"skew-x":[{"skew-x":q()}],"skew-y":[{"skew-y":q()}],transform:[{transform:[et,Je,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Z()}],"translate-x":[{"translate-x":Z()}],"translate-y":[{"translate-y":Z()}],"translate-z":[{"translate-z":Z()}],"translate-none":["translate-none"],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",et,Je]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",et,Je]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[Rt,Mc,cs,sS]}],stroke:[{stroke:["none",...H()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},sae=$ne(oae);function Ve(...t){return sae(r5(t))}const lae=n5("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-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 transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Ya({className:t,variant:e,asChild:r=!1,...a}){const n=r?JH:"span";return S.jsx(n,{"data-slot":"badge",className:Ve(lae({variant:e}),t),...a})}const uae=n5("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-all 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-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white 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 hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-full gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-full px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function ct({className:t,variant:e,size:r,asChild:a=!1,...n}){const o=a?JH:"button";return S.jsx(o,{"data-slot":"button",className:Ve(uae({variant:e,size:r,className:t})),...n})}var cae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ft=cae.reduce((t,e)=>{const r=Io(`Primitive.${e}`),a=R.forwardRef((n,o)=>{const{asChild:l,...u}=n,c=l?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),S.jsx(c,{...u,ref:o})});return a.displayName=`Primitive.${e}`,{...t,[e]:a}},{});function h5(t,e){t&&ku.flushSync(()=>t.dispatchEvent(e))}var dae="Label",m5=R.forwardRef((t,e)=>S.jsx(ft.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));m5.displayName=dae;var fae=m5;function pr({className:t,...e}){return S.jsx(fae,{"data-slot":"label",className:Ve("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}function r1({message:t,className:e="",vertical:r,noBorder:a}){return S.jsx("div",{className:Ve(`mt-2 rounded-md p-6 ${e}`,!a&&"border"),children:S.jsxs("p",{className:Ve("text-sm text-muted-foreground flex items-center gap-4",r&&"flex-col"),children:[S.jsx("svg",{width:"40",height:"40",viewBox:"0 0 273 273",version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:S.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:S.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[S.jsx("path",{d:"M49.953025,-2.10854389 C63.26892,-2.21867124 76.6185256,2.70621155 86.9019463,12.6653164 L86.9019463,12.6653164 L87.505627,13.2592944 C97.5154947,23.2654892 102.640454,36.3074513 102.880738,49.4222247 C103.08932,77.4533067 113.877287,105.391753 135.242867,126.757333 C156.613383,148.127849 184.559216,158.914875 212.568138,159.119313 L212.568138,159.119313 L213.212264,159.134159 C225.843948,159.517566 238.363557,164.434972 248.121998,173.886137 L248.121998,173.886137 L248.725621,174.480088 C258.982114,184.732164 264.11035,198.171134 264.11035,211.6101 C264.11035,225.04592 258.984514,238.481745 248.732867,248.732867 C238.592792,258.872942 225.336706,263.997882 212.046872,264.107794 C198.731075,264.21792 185.381569,259.293085 175.098248,249.334078 L175.098248,249.334078 L174.494602,248.740134 C163.75802,238.008189 158.640853,223.784027 159.143413,209.719372 C158.258245,182.640933 147.489786,155.83332 126.828333,135.171867 C106.351297,114.694831 79.8363505,103.934873 53.0237258,102.891841 L53.0237258,102.891841 L52.2811438,102.865674 C38.4791718,103.347421 24.5325234,98.4328111 13.8776628,88.1140866 L13.8776628,88.1140866 L13.2739843,87.5201168 C3.12895117,77.3789607 -1.9984796,64.1195994 -2.10841888,50.8264755 C-2.21854669,37.5105567 2.70635908,24.1609269 12.6655135,13.8774565 L12.6655135,13.8774565 L13.2594878,13.2737797 C23.4005926,3.12880025 36.659927,-1.99860507 49.953025,-2.10854389 Z"}),S.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),S.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),t]})})}function g5({className:t,color:e,children:r,grayscaled:a=!1}){const n=R.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return a?0:.2},[e,a]),o=R.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return a?.3:.4},[e,a]),l=R.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[2]||"0")}return Math.floor(Math.random()*360)},[e]),u=R.useMemo(()=>e||`oklch(${Math.min(o,1)} ${n} ${l})`,[l,n,o]),c=R.useMemo(()=>`oklch(${Math.min(o*2,1)} ${n} ${l})`,[l,n,o,e]),f=R.useMemo(()=>Math.floor(Math.random()*360),[l]),p=R.useMemo(()=>"1000%",[]);return S.jsx("section",{className:Ve("relative w-full h-full overflow-hidden",t),style:{background:`${c}`},children:S.jsxs("div",{className:"isolate relative w-full h-full",children:[S.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${f}deg, ${u}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${p})`}}),r&&S.jsx("div",{className:"relative z-10 w-full h-full",children:r})]})})}function Ze(t,e,{checkForDefaultPrevented:r=!0}={}){return function(n){if(t?.(n),r===!1||!n.defaultPrevented)return e?.(n)}}function pae(t,e){const r=R.createContext(e),a=o=>{const{children:l,...u}=o,c=R.useMemo(()=>u,Object.values(u));return S.jsx(r.Provider,{value:c,children:l})};a.displayName=t+"Provider";function n(o){const l=R.useContext(r);if(l)return l;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[a,n]}function ei(t,e=[]){let r=[];function a(o,l){const u=R.createContext(l),c=r.length;r=[...r,l];const f=h=>{const{scope:g,children:v,...w}=h,b=g?.[t]?.[c]||u,_=R.useMemo(()=>w,Object.values(w));return S.jsx(b.Provider,{value:_,children:v})};f.displayName=o+"Provider";function p(h,g){const v=g?.[t]?.[c]||u,w=R.useContext(v);if(w)return w;if(l!==void 0)return l;throw new Error(`\`${h}\` must be used within \`${o}\``)}return[f,p]}const n=()=>{const o=r.map(l=>R.createContext(l));return function(u){const c=u?.[t]||o;return R.useMemo(()=>({[`__scope${t}`]:{...u,[t]:c}}),[u,c])}};return n.scopeName=t,[a,hae(n,...e)]}function hae(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const a=t.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(o){const l=a.reduce((u,{useScope:c,scopeName:f})=>{const h=c(o)[`__scope${f}`];return{...u,...h}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return r.scopeName=e.scopeName,r}var sn=globalThis?.document?R.useLayoutEffect:()=>{},mae=HC[" useInsertionEffect ".trim().toString()]||sn;function Do({prop:t,defaultProp:e,onChange:r=()=>{},caller:a}){const[n,o,l]=gae({defaultProp:e,onChange:r}),u=t!==void 0,c=u?t:n;{const p=R.useRef(t!==void 0);R.useEffect(()=>{const h=p.current;h!==u&&console.warn(`${a} is changing from ${h?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=u},[u,a])}const f=R.useCallback(p=>{if(u){const h=vae(p)?p(t):p;h!==t&&l.current?.(h)}else o(p)},[u,t,o,l]);return[c,f]}function gae({defaultProp:t,onChange:e}){const[r,a]=R.useState(t),n=R.useRef(r),o=R.useRef(e);return mae(()=>{o.current=e},[e]),R.useEffect(()=>{n.current!==r&&(o.current?.(r),n.current=r)},[r,n]),[r,a,o]}function vae(t){return typeof t=="function"}function v5(t){const e=R.useRef({value:t,previous:t});return R.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function y5(t){const[e,r]=R.useState(void 0);return sn(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const a=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const o=n[0];let l,u;if("borderBoxSize"in o){const c=o.borderBoxSize,f=Array.isArray(c)?c[0]:c;l=f.inlineSize,u=f.blockSize}else l=t.offsetWidth,u=t.offsetHeight;r({width:l,height:u})});return a.observe(t,{box:"border-box"}),()=>a.unobserve(t)}else r(void 0)},[t]),e}var Gm="Switch",[yae]=ei(Gm),[bae,Eae]=yae(Gm),b5=R.forwardRef((t,e)=>{const{__scopeSwitch:r,name:a,checked:n,defaultChecked:o,required:l,disabled:u,value:c="on",onCheckedChange:f,form:p,...h}=t,[g,v]=R.useState(null),w=Ut(e,x=>v(x)),b=R.useRef(!1),_=g?p||!!g.closest("form"):!0,[y,E]=Do({prop:n,defaultProp:o??!1,onChange:f,caller:Gm});return S.jsxs(bae,{scope:r,checked:y,disabled:u,children:[S.jsx(ft.button,{type:"button",role:"switch","aria-checked":y,"aria-required":l,"data-state":_5(y),"data-disabled":u?"":void 0,disabled:u,value:c,...h,ref:w,onClick:Ze(t.onClick,x=>{E(T=>!T),_&&(b.current=x.isPropagationStopped(),b.current||x.stopPropagation())})}),_&&S.jsx(w5,{control:g,bubbles:!b.current,name:a,value:c,checked:y,required:l,disabled:u,form:p,style:{transform:"translateX(-100%)"}})]})});b5.displayName=Gm;var E5="SwitchThumb",S5=R.forwardRef((t,e)=>{const{__scopeSwitch:r,...a}=t,n=Eae(E5,r);return S.jsx(ft.span,{"data-state":_5(n.checked),"data-disabled":n.disabled?"":void 0,...a,ref:e})});S5.displayName=E5;var Sae="SwitchBubbleInput",w5=R.forwardRef(({__scopeSwitch:t,control:e,checked:r,bubbles:a=!0,...n},o)=>{const l=R.useRef(null),u=Ut(l,o),c=v5(r),f=y5(e);return R.useEffect(()=>{const p=l.current;if(!p)return;const h=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==r&&v){const w=new Event("click",{bubbles:a});v.call(p,r),p.dispatchEvent(w)}},[c,r,a]),S.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...n,tabIndex:-1,ref:u,style:{...n.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});w5.displayName=Sae;function _5(t){return t?"checked":"unchecked"}var x5=b5,wae=S5;function n1({ref:t,className:e,...r}){return S.jsx(x5,{className:Ve("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:t,children:S.jsx(wae,{className:Ve("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}n1.displayName=x5.displayName;function Ka(t){const e=R.useRef(t);return R.useEffect(()=>{e.current=t}),R.useMemo(()=>(...r)=>e.current?.(...r),[])}function _ae(t,e=globalThis?.document){const r=Ka(t);R.useEffect(()=>{const a=n=>{n.key==="Escape"&&r(n)};return e.addEventListener("keydown",a,{capture:!0}),()=>e.removeEventListener("keydown",a,{capture:!0})},[r,e])}var xae="DismissableLayer",EA="dismissableLayer.update",Tae="dismissableLayer.pointerDownOutside",Rae="dismissableLayer.focusOutside",Aj,T5=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Du=R.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:a,onPointerDownOutside:n,onFocusOutside:o,onInteractOutside:l,onDismiss:u,...c}=t,f=R.useContext(T5),[p,h]=R.useState(null),g=p?.ownerDocument??globalThis?.document,[,v]=R.useState({}),w=Ut(e,O=>h(O)),b=Array.from(f.layers),[_]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),y=b.indexOf(_),E=p?b.indexOf(p):-1,x=f.layersWithOutsidePointerEventsDisabled.size>0,T=E>=y,C=Nae(O=>{const I=O.target,M=[...f.branches].some(D=>D.contains(I));!T||M||(n?.(O),l?.(O),O.defaultPrevented||u?.())},g),N=kae(O=>{const I=O.target;[...f.branches].some(D=>D.contains(I))||(o?.(O),l?.(O),O.defaultPrevented||u?.())},g);return _ae(O=>{E===f.layers.size-1&&(a?.(O),!O.defaultPrevented&&u&&(O.preventDefault(),u()))},g),R.useEffect(()=>{if(p)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Aj=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),Cj(),()=>{r&&f.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Aj)}},[p,g,r,f]),R.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),Cj())},[p,f]),R.useEffect(()=>{const O=()=>v({});return document.addEventListener(EA,O),()=>document.removeEventListener(EA,O)},[]),S.jsx(ft.div,{...c,ref:w,style:{pointerEvents:x?T?"auto":"none":void 0,...t.style},onFocusCapture:Ze(t.onFocusCapture,N.onFocusCapture),onBlurCapture:Ze(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Ze(t.onPointerDownCapture,C.onPointerDownCapture)})});Du.displayName=xae;var Aae="DismissableLayerBranch",Cae=R.forwardRef((t,e)=>{const r=R.useContext(T5),a=R.useRef(null),n=Ut(e,a);return R.useEffect(()=>{const o=a.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),S.jsx(ft.div,{...t,ref:n})});Cae.displayName=Aae;function Nae(t,e=globalThis?.document){const r=Ka(t),a=R.useRef(!1),n=R.useRef(()=>{});return R.useEffect(()=>{const o=u=>{if(u.target&&!a.current){let c=function(){R5(Tae,r,f,{discrete:!0})};const f={originalEvent:u};u.pointerType==="touch"?(e.removeEventListener("click",n.current),n.current=c,e.addEventListener("click",n.current,{once:!0})):c()}else e.removeEventListener("click",n.current);a.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",o),e.removeEventListener("click",n.current)}},[e,r]),{onPointerDownCapture:()=>a.current=!0}}function kae(t,e=globalThis?.document){const r=Ka(t),a=R.useRef(!1);return R.useEffect(()=>{const n=o=>{o.target&&!a.current&&R5(Rae,r,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",n),()=>e.removeEventListener("focusin",n)},[e,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function Cj(){const t=new CustomEvent(EA);document.dispatchEvent(t)}function R5(t,e,r,{discrete:a}){const n=r.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&n.addEventListener(t,e,{once:!0}),a?h5(n,o):n.dispatchEvent(o)}var Oae=HC[" useId ".trim().toString()]||(()=>{}),Iae=0;function Xr(t){const[e,r]=R.useState(Oae());return sn(()=>{r(a=>a??String(Iae++))},[t]),t||(e?`radix-${e}`:"")}const Dae=["top","right","bottom","left"],Lo=Math.min,Bn=Math.max,mm=Math.round,sh=Math.floor,qa=t=>({x:t,y:t}),Lae={left:"right",right:"left",bottom:"top",top:"bottom"},Mae={start:"end",end:"start"};function SA(t,e,r){return Bn(t,Lo(e,r))}function Pi(t,e){return typeof t=="function"?t(e):t}function ji(t){return t.split("-")[0]}function Lu(t){return t.split("-")[1]}function a1(t){return t==="x"?"y":"x"}function i1(t){return t==="y"?"height":"width"}const Pae=new Set(["top","bottom"]);function Fa(t){return Pae.has(ji(t))?"y":"x"}function o1(t){return a1(Fa(t))}function jae(t,e,r){r===void 0&&(r=!1);const a=Lu(t),n=o1(t),o=i1(n);let l=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(l=gm(l)),[l,gm(l)]}function Uae(t){const e=gm(t);return[wA(t),e,wA(e)]}function wA(t){return t.replace(/start|end/g,e=>Mae[e])}const Nj=["left","right"],kj=["right","left"],Fae=["top","bottom"],Bae=["bottom","top"];function $ae(t,e,r){switch(t){case"top":case"bottom":return r?e?kj:Nj:e?Nj:kj;case"left":case"right":return e?Fae:Bae;default:return[]}}function zae(t,e,r,a){const n=Lu(t);let o=$ae(ji(t),r==="start",a);return n&&(o=o.map(l=>l+"-"+n),e&&(o=o.concat(o.map(wA)))),o}function gm(t){return t.replace(/left|right|bottom|top/g,e=>Lae[e])}function qae(t){return{top:0,right:0,bottom:0,left:0,...t}}function A5(t){return typeof t!="number"?qae(t):{top:t,right:t,bottom:t,left:t}}function vm(t){const{x:e,y:r,width:a,height:n}=t;return{width:a,height:n,top:r,left:e,right:e+a,bottom:r+n,x:e,y:r}}function Oj(t,e,r){let{reference:a,floating:n}=t;const o=Fa(e),l=o1(e),u=i1(l),c=ji(e),f=o==="y",p=a.x+a.width/2-n.width/2,h=a.y+a.height/2-n.height/2,g=a[u]/2-n[u]/2;let v;switch(c){case"top":v={x:p,y:a.y-n.height};break;case"bottom":v={x:p,y:a.y+a.height};break;case"right":v={x:a.x+a.width,y:h};break;case"left":v={x:a.x-n.width,y:h};break;default:v={x:a.x,y:a.y}}switch(Lu(e)){case"start":v[l]-=g*(r&&f?-1:1);break;case"end":v[l]+=g*(r&&f?-1:1);break}return v}const Hae=async(t,e,r)=>{const{placement:a="bottom",strategy:n="absolute",middleware:o=[],platform:l}=r,u=o.filter(Boolean),c=await(l.isRTL==null?void 0:l.isRTL(e));let f=await l.getElementRects({reference:t,floating:e,strategy:n}),{x:p,y:h}=Oj(f,a,c),g=a,v={},w=0;for(let b=0;b<u.length;b++){const{name:_,fn:y}=u[b],{x:E,y:x,data:T,reset:C}=await y({x:p,y:h,initialPlacement:a,placement:g,strategy:n,middlewareData:v,rects:f,platform:l,elements:{reference:t,floating:e}});p=E??p,h=x??h,v={...v,[_]:{...v[_],...T}},C&&w<=50&&(w++,typeof C=="object"&&(C.placement&&(g=C.placement),C.rects&&(f=C.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:n}):C.rects),{x:p,y:h}=Oj(f,g,c)),b=-1)}return{x:p,y:h,placement:g,strategy:n,middlewareData:v}};async function Sd(t,e){var r;e===void 0&&(e={});const{x:a,y:n,platform:o,rects:l,elements:u,strategy:c}=t,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:h="floating",altBoundary:g=!1,padding:v=0}=Pi(e,t),w=A5(v),_=u[g?h==="floating"?"reference":"floating":h],y=vm(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(_)))==null||r?_:_.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:f,rootBoundary:p,strategy:c})),E=h==="floating"?{x:a,y:n,width:l.floating.width,height:l.floating.height}:l.reference,x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),T=await(o.isElement==null?void 0:o.isElement(x))?await(o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},C=vm(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:x,strategy:c}):E);return{top:(y.top-C.top+w.top)/T.y,bottom:(C.bottom-y.bottom+w.bottom)/T.y,left:(y.left-C.left+w.left)/T.x,right:(C.right-y.right+w.right)/T.x}}const Gae=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:a,placement:n,rects:o,platform:l,elements:u,middlewareData:c}=e,{element:f,padding:p=0}=Pi(t,e)||{};if(f==null)return{};const h=A5(p),g={x:r,y:a},v=o1(n),w=i1(v),b=await l.getDimensions(f),_=v==="y",y=_?"top":"left",E=_?"bottom":"right",x=_?"clientHeight":"clientWidth",T=o.reference[w]+o.reference[v]-g[v]-o.floating[w],C=g[v]-o.reference[v],N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let O=N?N[x]:0;(!O||!await(l.isElement==null?void 0:l.isElement(N)))&&(O=u.floating[x]||o.floating[w]);const I=T/2-C/2,M=O/2-b[w]/2-1,D=Lo(h[y],M),$=Lo(h[E],M),G=D,V=O-b[w]-$,ee=O/2-b[w]/2+I,ne=SA(G,ee,V),F=!c.arrow&&Lu(n)!=null&&ee!==ne&&o.reference[w]/2-(ee<G?D:$)-b[w]/2<0,z=F?ee<G?ee-G:ee-V:0;return{[v]:g[v]+z,data:{[v]:ne,centerOffset:ee-ne-z,...F&&{alignmentOffset:z}},reset:F}}}),Vae=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,a;const{placement:n,middlewareData:o,rects:l,initialPlacement:u,platform:c,elements:f}=e,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:b=!0,..._}=Pi(t,e);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const y=ji(n),E=Fa(u),x=ji(u)===u,T=await(c.isRTL==null?void 0:c.isRTL(f.floating)),C=g||(x||!b?[gm(u)]:Uae(u)),N=w!=="none";!g&&N&&C.push(...zae(u,b,w,T));const O=[u,...C],I=await Sd(e,_),M=[];let D=((a=o.flip)==null?void 0:a.overflows)||[];if(p&&M.push(I[y]),h){const ee=jae(n,l,T);M.push(I[ee[0]],I[ee[1]])}if(D=[...D,{placement:n,overflows:M}],!M.every(ee=>ee<=0)){var $,G;const ee=((($=o.flip)==null?void 0:$.index)||0)+1,ne=O[ee];if(ne&&(!(h==="alignment"?E!==Fa(ne):!1)||D.every(H=>Fa(H.placement)===E?H.overflows[0]>0:!0)))return{data:{index:ee,overflows:D},reset:{placement:ne}};let F=(G=D.filter(z=>z.overflows[0]<=0).sort((z,H)=>z.overflows[1]-H.overflows[1])[0])==null?void 0:G.placement;if(!F)switch(v){case"bestFit":{var V;const z=(V=D.filter(H=>{if(N){const Q=Fa(H.placement);return Q===E||Q==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(Q=>Q>0).reduce((Q,ae)=>Q+ae,0)]).sort((H,Q)=>H[1]-Q[1])[0])==null?void 0:V[0];z&&(F=z);break}case"initialPlacement":F=u;break}if(n!==F)return{reset:{placement:F}}}return{}}}};function Ij(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Dj(t){return Dae.some(e=>t[e]>=0)}const Wae=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:a="referenceHidden",...n}=Pi(t,e);switch(a){case"referenceHidden":{const o=await Sd(e,{...n,elementContext:"reference"}),l=Ij(o,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Dj(l)}}}case"escaped":{const o=await Sd(e,{...n,altBoundary:!0}),l=Ij(o,r.floating);return{data:{escapedOffsets:l,escaped:Dj(l)}}}default:return{}}}}},C5=new Set(["left","top"]);async function Yae(t,e){const{placement:r,platform:a,elements:n}=t,o=await(a.isRTL==null?void 0:a.isRTL(n.floating)),l=ji(r),u=Lu(r),c=Fa(r)==="y",f=C5.has(l)?-1:1,p=o&&c?-1:1,h=Pi(e,t);let{mainAxis:g,crossAxis:v,alignmentAxis:w}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return u&&typeof w=="number"&&(v=u==="end"?w*-1:w),c?{x:v*p,y:g*f}:{x:g*f,y:v*p}}const Kae=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,a;const{x:n,y:o,placement:l,middlewareData:u}=e,c=await Yae(e,t);return l===((r=u.offset)==null?void 0:r.placement)&&(a=u.arrow)!=null&&a.alignmentOffset?{}:{x:n+c.x,y:o+c.y,data:{...c,placement:l}}}}},Zae=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:a,placement:n}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:_=>{let{x:y,y:E}=_;return{x:y,y:E}}},...c}=Pi(t,e),f={x:r,y:a},p=await Sd(e,c),h=Fa(ji(n)),g=a1(h);let v=f[g],w=f[h];if(o){const _=g==="y"?"top":"left",y=g==="y"?"bottom":"right",E=v+p[_],x=v-p[y];v=SA(E,v,x)}if(l){const _=h==="y"?"top":"left",y=h==="y"?"bottom":"right",E=w+p[_],x=w-p[y];w=SA(E,w,x)}const b=u.fn({...e,[g]:v,[h]:w});return{...b,data:{x:b.x-r,y:b.y-a,enabled:{[g]:o,[h]:l}}}}}},Xae=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:a,placement:n,rects:o,middlewareData:l}=e,{offset:u=0,mainAxis:c=!0,crossAxis:f=!0}=Pi(t,e),p={x:r,y:a},h=Fa(n),g=a1(h);let v=p[g],w=p[h];const b=Pi(u,e),_=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(c){const x=g==="y"?"height":"width",T=o.reference[g]-o.floating[x]+_.mainAxis,C=o.reference[g]+o.reference[x]-_.mainAxis;v<T?v=T:v>C&&(v=C)}if(f){var y,E;const x=g==="y"?"width":"height",T=C5.has(ji(n)),C=o.reference[h]-o.floating[x]+(T&&((y=l.offset)==null?void 0:y[h])||0)+(T?0:_.crossAxis),N=o.reference[h]+o.reference[x]+(T?0:((E=l.offset)==null?void 0:E[h])||0)-(T?_.crossAxis:0);w<C?w=C:w>N&&(w=N)}return{[g]:v,[h]:w}}}},Qae=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,a;const{placement:n,rects:o,platform:l,elements:u}=e,{apply:c=()=>{},...f}=Pi(t,e),p=await Sd(e,f),h=ji(n),g=Lu(n),v=Fa(n)==="y",{width:w,height:b}=o.floating;let _,y;h==="top"||h==="bottom"?(_=h,y=g===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(y=h,_=g==="end"?"top":"bottom");const E=b-p.top-p.bottom,x=w-p.left-p.right,T=Lo(b-p[_],E),C=Lo(w-p[y],x),N=!e.middlewareData.shift;let O=T,I=C;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(I=x),(a=e.middlewareData.shift)!=null&&a.enabled.y&&(O=E),N&&!g){const D=Bn(p.left,0),$=Bn(p.right,0),G=Bn(p.top,0),V=Bn(p.bottom,0);v?I=w-2*(D!==0||$!==0?D+$:Bn(p.left,p.right)):O=b-2*(G!==0||V!==0?G+V:Bn(p.top,p.bottom))}await c({...e,availableWidth:I,availableHeight:O});const M=await l.getDimensions(u.floating);return w!==M.width||b!==M.height?{reset:{rects:!0}}:{}}}};function Vm(){return typeof window<"u"}function Mu(t){return N5(t)?(t.nodeName||"").toLowerCase():"#document"}function $n(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function ti(t){var e;return(e=(N5(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function N5(t){return Vm()?t instanceof Node||t instanceof $n(t).Node:!1}function xa(t){return Vm()?t instanceof Element||t instanceof $n(t).Element:!1}function Za(t){return Vm()?t instanceof HTMLElement||t instanceof $n(t).HTMLElement:!1}function Lj(t){return!Vm()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof $n(t).ShadowRoot}const Jae=new Set(["inline","contents"]);function Zd(t){const{overflow:e,overflowX:r,overflowY:a,display:n}=Ta(t);return/auto|scroll|overlay|hidden|clip/.test(e+a+r)&&!Jae.has(n)}const eie=new Set(["table","td","th"]);function tie(t){return eie.has(Mu(t))}const rie=[":popover-open",":modal"];function Wm(t){return rie.some(e=>{try{return t.matches(e)}catch{return!1}})}const nie=["transform","translate","scale","rotate","perspective"],aie=["transform","translate","scale","rotate","perspective","filter"],iie=["paint","layout","strict","content"];function s1(t){const e=l1(),r=xa(t)?Ta(t):t;return nie.some(a=>r[a]?r[a]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||aie.some(a=>(r.willChange||"").includes(a))||iie.some(a=>(r.contain||"").includes(a))}function oie(t){let e=Mo(t);for(;Za(e)&&!mu(e);){if(s1(e))return e;if(Wm(e))return null;e=Mo(e)}return null}function l1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const sie=new Set(["html","body","#document"]);function mu(t){return sie.has(Mu(t))}function Ta(t){return $n(t).getComputedStyle(t)}function Ym(t){return xa(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Mo(t){if(Mu(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lj(t)&&t.host||ti(t);return Lj(e)?e.host:e}function k5(t){const e=Mo(t);return mu(e)?t.ownerDocument?t.ownerDocument.body:t.body:Za(e)&&Zd(e)?e:k5(e)}function wd(t,e,r){var a;e===void 0&&(e=[]),r===void 0&&(r=!0);const n=k5(t),o=n===((a=t.ownerDocument)==null?void 0:a.body),l=$n(n);if(o){const u=_A(l);return e.concat(l,l.visualViewport||[],Zd(n)?n:[],u&&r?wd(u):[])}return e.concat(n,wd(n,[],r))}function _A(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function O5(t){const e=Ta(t);let r=parseFloat(e.width)||0,a=parseFloat(e.height)||0;const n=Za(t),o=n?t.offsetWidth:r,l=n?t.offsetHeight:a,u=mm(r)!==o||mm(a)!==l;return u&&(r=o,a=l),{width:r,height:a,$:u}}function u1(t){return xa(t)?t:t.contextElement}function Yl(t){const e=u1(t);if(!Za(e))return qa(1);const r=e.getBoundingClientRect(),{width:a,height:n,$:o}=O5(e);let l=(o?mm(r.width):r.width)/a,u=(o?mm(r.height):r.height)/n;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const lie=qa(0);function I5(t){const e=$n(t);return!l1()||!e.visualViewport?lie:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function uie(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==$n(t)?!1:e}function ks(t,e,r,a){e===void 0&&(e=!1),r===void 0&&(r=!1);const n=t.getBoundingClientRect(),o=u1(t);let l=qa(1);e&&(a?xa(a)&&(l=Yl(a)):l=Yl(t));const u=uie(o,r,a)?I5(o):qa(0);let c=(n.left+u.x)/l.x,f=(n.top+u.y)/l.y,p=n.width/l.x,h=n.height/l.y;if(o){const g=$n(o),v=a&&xa(a)?$n(a):a;let w=g,b=_A(w);for(;b&&a&&v!==w;){const _=Yl(b),y=b.getBoundingClientRect(),E=Ta(b),x=y.left+(b.clientLeft+parseFloat(E.paddingLeft))*_.x,T=y.top+(b.clientTop+parseFloat(E.paddingTop))*_.y;c*=_.x,f*=_.y,p*=_.x,h*=_.y,c+=x,f+=T,w=$n(b),b=_A(w)}}return vm({width:p,height:h,x:c,y:f})}function Km(t,e){const r=Ym(t).scrollLeft;return e?e.left+r:ks(ti(t)).left+r}function D5(t,e){const r=t.getBoundingClientRect(),a=r.left+e.scrollLeft-Km(t,r),n=r.top+e.scrollTop;return{x:a,y:n}}function cie(t){let{elements:e,rect:r,offsetParent:a,strategy:n}=t;const o=n==="fixed",l=ti(a),u=e?Wm(e.floating):!1;if(a===l||u&&o)return r;let c={scrollLeft:0,scrollTop:0},f=qa(1);const p=qa(0),h=Za(a);if((h||!h&&!o)&&((Mu(a)!=="body"||Zd(l))&&(c=Ym(a)),Za(a))){const v=ks(a);f=Yl(a),p.x=v.x+a.clientLeft,p.y=v.y+a.clientTop}const g=l&&!h&&!o?D5(l,c):qa(0);return{width:r.width*f.x,height:r.height*f.y,x:r.x*f.x-c.scrollLeft*f.x+p.x+g.x,y:r.y*f.y-c.scrollTop*f.y+p.y+g.y}}function die(t){return Array.from(t.getClientRects())}function fie(t){const e=ti(t),r=Ym(t),a=t.ownerDocument.body,n=Bn(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),o=Bn(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let l=-r.scrollLeft+Km(t);const u=-r.scrollTop;return Ta(a).direction==="rtl"&&(l+=Bn(e.clientWidth,a.clientWidth)-n),{width:n,height:o,x:l,y:u}}const Mj=25;function pie(t,e){const r=$n(t),a=ti(t),n=r.visualViewport;let o=a.clientWidth,l=a.clientHeight,u=0,c=0;if(n){o=n.width,l=n.height;const p=l1();(!p||p&&e==="fixed")&&(u=n.offsetLeft,c=n.offsetTop)}const f=Km(a);if(f<=0){const p=a.ownerDocument,h=p.body,g=getComputedStyle(h),v=p.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,w=Math.abs(a.clientWidth-h.clientWidth-v);w<=Mj&&(o-=w)}else f<=Mj&&(o+=f);return{width:o,height:l,x:u,y:c}}const hie=new Set(["absolute","fixed"]);function mie(t,e){const r=ks(t,!0,e==="fixed"),a=r.top+t.clientTop,n=r.left+t.clientLeft,o=Za(t)?Yl(t):qa(1),l=t.clientWidth*o.x,u=t.clientHeight*o.y,c=n*o.x,f=a*o.y;return{width:l,height:u,x:c,y:f}}function Pj(t,e,r){let a;if(e==="viewport")a=pie(t,r);else if(e==="document")a=fie(ti(t));else if(xa(e))a=mie(e,r);else{const n=I5(t);a={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return vm(a)}function L5(t,e){const r=Mo(t);return r===e||!xa(r)||mu(r)?!1:Ta(r).position==="fixed"||L5(r,e)}function gie(t,e){const r=e.get(t);if(r)return r;let a=wd(t,[],!1).filter(u=>xa(u)&&Mu(u)!=="body"),n=null;const o=Ta(t).position==="fixed";let l=o?Mo(t):t;for(;xa(l)&&!mu(l);){const u=Ta(l),c=s1(l);!c&&u.position==="fixed"&&(n=null),(o?!c&&!n:!c&&u.position==="static"&&!!n&&hie.has(n.position)||Zd(l)&&!c&&L5(t,l))?a=a.filter(p=>p!==l):n=u,l=Mo(l)}return e.set(t,a),a}function vie(t){let{element:e,boundary:r,rootBoundary:a,strategy:n}=t;const l=[...r==="clippingAncestors"?Wm(e)?[]:gie(e,this._c):[].concat(r),a],u=l[0],c=l.reduce((f,p)=>{const h=Pj(e,p,n);return f.top=Bn(h.top,f.top),f.right=Lo(h.right,f.right),f.bottom=Lo(h.bottom,f.bottom),f.left=Bn(h.left,f.left),f},Pj(e,u,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function yie(t){const{width:e,height:r}=O5(t);return{width:e,height:r}}function bie(t,e,r){const a=Za(e),n=ti(e),o=r==="fixed",l=ks(t,!0,o,e);let u={scrollLeft:0,scrollTop:0};const c=qa(0);function f(){c.x=Km(n)}if(a||!a&&!o)if((Mu(e)!=="body"||Zd(n))&&(u=Ym(e)),a){const v=ks(e,!0,o,e);c.x=v.x+e.clientLeft,c.y=v.y+e.clientTop}else n&&f();o&&!a&&n&&f();const p=n&&!a&&!o?D5(n,u):qa(0),h=l.left+u.scrollLeft-c.x-p.x,g=l.top+u.scrollTop-c.y-p.y;return{x:h,y:g,width:l.width,height:l.height}}function lS(t){return Ta(t).position==="static"}function jj(t,e){if(!Za(t)||Ta(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return ti(t)===r&&(r=r.ownerDocument.body),r}function M5(t,e){const r=$n(t);if(Wm(t))return r;if(!Za(t)){let n=Mo(t);for(;n&&!mu(n);){if(xa(n)&&!lS(n))return n;n=Mo(n)}return r}let a=jj(t,e);for(;a&&tie(a)&&lS(a);)a=jj(a,e);return a&&mu(a)&&lS(a)&&!s1(a)?r:a||oie(t)||r}const Eie=async function(t){const e=this.getOffsetParent||M5,r=this.getDimensions,a=await r(t.floating);return{reference:bie(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function Sie(t){return Ta(t).direction==="rtl"}const wie={convertOffsetParentRelativeRectToViewportRelativeRect:cie,getDocumentElement:ti,getClippingRect:vie,getOffsetParent:M5,getElementRects:Eie,getClientRects:die,getDimensions:yie,getScale:Yl,isElement:xa,isRTL:Sie};function P5(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function _ie(t,e){let r=null,a;const n=ti(t);function o(){var u;clearTimeout(a),(u=r)==null||u.disconnect(),r=null}function l(u,c){u===void 0&&(u=!1),c===void 0&&(c=1),o();const f=t.getBoundingClientRect(),{left:p,top:h,width:g,height:v}=f;if(u||e(),!g||!v)return;const w=sh(h),b=sh(n.clientWidth-(p+g)),_=sh(n.clientHeight-(h+v)),y=sh(p),x={rootMargin:-w+"px "+-b+"px "+-_+"px "+-y+"px",threshold:Bn(0,Lo(1,c))||1};let T=!0;function C(N){const O=N[0].intersectionRatio;if(O!==c){if(!T)return l();O?l(!1,O):a=setTimeout(()=>{l(!1,1e-7)},1e3)}O===1&&!P5(f,t.getBoundingClientRect())&&l(),T=!1}try{r=new IntersectionObserver(C,{...x,root:n.ownerDocument})}catch{r=new IntersectionObserver(C,x)}r.observe(t)}return l(!0),o}function xie(t,e,r,a){a===void 0&&(a={});const{ancestorScroll:n=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:c=!1}=a,f=u1(t),p=n||o?[...f?wd(f):[],...wd(e)]:[];p.forEach(y=>{n&&y.addEventListener("scroll",r,{passive:!0}),o&&y.addEventListener("resize",r)});const h=f&&u?_ie(f,r):null;let g=-1,v=null;l&&(v=new ResizeObserver(y=>{let[E]=y;E&&E.target===f&&v&&(v.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var x;(x=v)==null||x.observe(e)})),r()}),f&&!c&&v.observe(f),v.observe(e));let w,b=c?ks(t):null;c&&_();function _(){const y=ks(t);b&&!P5(b,y)&&r(),b=y,w=requestAnimationFrame(_)}return r(),()=>{var y;p.forEach(E=>{n&&E.removeEventListener("scroll",r),o&&E.removeEventListener("resize",r)}),h?.(),(y=v)==null||y.disconnect(),v=null,c&&cancelAnimationFrame(w)}}const Tie=Kae,Rie=Zae,Aie=Vae,Cie=Qae,Nie=Wae,Uj=Gae,kie=Xae,Oie=(t,e,r)=>{const a=new Map,n={platform:wie,...r},o={...n.platform,_c:a};return Hae(t,e,{...n,platform:o})};var Iie=typeof document<"u",Die=function(){},Nh=Iie?R.useLayoutEffect:Die;function ym(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,a,n;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(a=r;a--!==0;)if(!ym(t[a],e[a]))return!1;return!0}if(n=Object.keys(t),r=n.length,r!==Object.keys(e).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(e,n[a]))return!1;for(a=r;a--!==0;){const o=n[a];if(!(o==="_owner"&&t.$$typeof)&&!ym(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function j5(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Fj(t,e){const r=j5(t);return Math.round(e*r)/r}function uS(t){const e=R.useRef(t);return Nh(()=>{e.current=t}),e}function Lie(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:a=[],platform:n,elements:{reference:o,floating:l}={},transform:u=!0,whileElementsMounted:c,open:f}=t,[p,h]=R.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[g,v]=R.useState(a);ym(g,a)||v(a);const[w,b]=R.useState(null),[_,y]=R.useState(null),E=R.useCallback(H=>{H!==N.current&&(N.current=H,b(H))},[]),x=R.useCallback(H=>{H!==O.current&&(O.current=H,y(H))},[]),T=o||w,C=l||_,N=R.useRef(null),O=R.useRef(null),I=R.useRef(p),M=c!=null,D=uS(c),$=uS(n),G=uS(f),V=R.useCallback(()=>{if(!N.current||!O.current)return;const H={placement:e,strategy:r,middleware:g};$.current&&(H.platform=$.current),Oie(N.current,O.current,H).then(Q=>{const ae={...Q,isPositioned:G.current!==!1};ee.current&&!ym(I.current,ae)&&(I.current=ae,ku.flushSync(()=>{h(ae)}))})},[g,e,r,$,G]);Nh(()=>{f===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,h(H=>({...H,isPositioned:!1})))},[f]);const ee=R.useRef(!1);Nh(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Nh(()=>{if(T&&(N.current=T),C&&(O.current=C),T&&C){if(D.current)return D.current(T,C,V);V()}},[T,C,V,D,M]);const ne=R.useMemo(()=>({reference:N,floating:O,setReference:E,setFloating:x}),[E,x]),F=R.useMemo(()=>({reference:T,floating:C}),[T,C]),z=R.useMemo(()=>{const H={position:r,left:0,top:0};if(!F.floating)return H;const Q=Fj(F.floating,p.x),ae=Fj(F.floating,p.y);return u?{...H,transform:"translate("+Q+"px, "+ae+"px)",...j5(F.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:Q,top:ae}},[r,u,F.floating,p.x,p.y]);return R.useMemo(()=>({...p,update:V,refs:ne,elements:F,floatingStyles:z}),[p,V,ne,F,z])}const Mie=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:a,padding:n}=typeof t=="function"?t(r):t;return a&&e(a)?a.current!=null?Uj({element:a.current,padding:n}).fn(r):{}:a?Uj({element:a,padding:n}).fn(r):{}}}},Pie=(t,e)=>({...Tie(t),options:[t,e]}),jie=(t,e)=>({...Rie(t),options:[t,e]}),Uie=(t,e)=>({...kie(t),options:[t,e]}),Fie=(t,e)=>({...Aie(t),options:[t,e]}),Bie=(t,e)=>({...Cie(t),options:[t,e]}),$ie=(t,e)=>({...Nie(t),options:[t,e]}),zie=(t,e)=>({...Mie(t),options:[t,e]});var qie="Arrow",U5=R.forwardRef((t,e)=>{const{children:r,width:a=10,height:n=5,...o}=t;return S.jsx(ft.svg,{...o,ref:e,width:a,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:S.jsx("polygon",{points:"0,0 30,0 15,10"})})});U5.displayName=qie;var Hie=U5,c1="Popper",[F5,Fo]=ei(c1),[Gie,B5]=F5(c1),$5=t=>{const{__scopePopper:e,children:r}=t,[a,n]=R.useState(null);return S.jsx(Gie,{scope:e,anchor:a,onAnchorChange:n,children:r})};$5.displayName=c1;var z5="PopperAnchor",q5=R.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:a,...n}=t,o=B5(z5,r),l=R.useRef(null),u=Ut(e,l),c=R.useRef(null);return R.useEffect(()=>{const f=c.current;c.current=a?.current||l.current,f!==c.current&&o.onAnchorChange(c.current)}),a?null:S.jsx(ft.div,{...n,ref:u})});q5.displayName=z5;var d1="PopperContent",[Vie,Wie]=F5(d1),H5=R.forwardRef((t,e)=>{const{__scopePopper:r,side:a="bottom",sideOffset:n=0,align:o="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:c=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:w,...b}=t,_=B5(d1,r),[y,E]=R.useState(null),x=Ut(e,U=>E(U)),[T,C]=R.useState(null),N=y5(T),O=N?.width??0,I=N?.height??0,M=a+(o!=="center"?"-"+o:""),D=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},$=Array.isArray(f)?f:[f],G=$.length>0,V={padding:D,boundary:$.filter(Kie),altBoundary:G},{refs:ee,floatingStyles:ne,placement:F,isPositioned:z,middlewareData:H}=Lie({strategy:"fixed",placement:M,whileElementsMounted:(...U)=>xie(...U,{animationFrame:v==="always"}),elements:{reference:_.anchor},middleware:[Pie({mainAxis:n+I,alignmentAxis:l}),c&&jie({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Uie():void 0,...V}),c&&Fie({...V}),Bie({...V,apply:({elements:U,rects:X,availableWidth:le,availableHeight:oe})=>{const{width:q,height:Z}=X.reference,fe=U.floating.style;fe.setProperty("--radix-popper-available-width",`${le}px`),fe.setProperty("--radix-popper-available-height",`${oe}px`),fe.setProperty("--radix-popper-anchor-width",`${q}px`),fe.setProperty("--radix-popper-anchor-height",`${Z}px`)}}),T&&zie({element:T,padding:u}),Zie({arrowWidth:O,arrowHeight:I}),g&&$ie({strategy:"referenceHidden",...V})]}),[Q,ae]=W5(F),W=Ka(w);sn(()=>{z&&W?.()},[z,W]);const Y=H.arrow?.x,K=H.arrow?.y,te=H.arrow?.centerOffset!==0,[ie,P]=R.useState();return sn(()=>{y&&P(window.getComputedStyle(y).zIndex)},[y]),S.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...ne,transform:z?ne.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:S.jsx(Vie,{scope:r,placedSide:Q,onArrowChange:C,arrowX:Y,arrowY:K,shouldHideArrow:te,children:S.jsx(ft.div,{"data-side":Q,"data-align":ae,...b,ref:x,style:{...b.style,animation:z?void 0:"none"}})})})});H5.displayName=d1;var G5="PopperArrow",Yie={top:"bottom",right:"left",bottom:"top",left:"right"},V5=R.forwardRef(function(e,r){const{__scopePopper:a,...n}=e,o=Wie(G5,a),l=Yie[o.placedSide];return S.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:S.jsx(Hie,{...n,ref:r,style:{...n.style,display:"block"}})})});V5.displayName=G5;function Kie(t){return t!==null}var Zie=t=>({name:"transformOrigin",options:t,fn(e){const{placement:r,rects:a,middlewareData:n}=e,l=n.arrow?.centerOffset!==0,u=l?0:t.arrowWidth,c=l?0:t.arrowHeight,[f,p]=W5(r),h={start:"0%",center:"50%",end:"100%"}[p],g=(n.arrow?.x??0)+u/2,v=(n.arrow?.y??0)+c/2;let w="",b="";return f==="bottom"?(w=l?h:`${g}px`,b=`${-c}px`):f==="top"?(w=l?h:`${g}px`,b=`${a.floating.height+c}px`):f==="right"?(w=`${-c}px`,b=l?h:`${v}px`):f==="left"&&(w=`${a.floating.width+c}px`,b=l?h:`${v}px`),{data:{x:w,y:b}}}});function W5(t){const[e,r="center"]=t.split("-");return[e,r]}var Zm=$5,Xd=q5,Xm=H5,Qm=V5,Xie="Portal",Pu=R.forwardRef((t,e)=>{const{container:r,...a}=t,[n,o]=R.useState(!1);sn(()=>o(!0),[]);const l=r||n&&globalThis?.document?.body;return l?GH.createPortal(S.jsx(ft.div,{...a,ref:e}),l):null});Pu.displayName=Xie;function Qie(t,e){return R.useReducer((r,a)=>e[r][a]??r,t)}var ca=t=>{const{present:e,children:r}=t,a=Jie(e),n=typeof r=="function"?r({present:a.isPresent}):R.Children.only(r),o=Ut(a.ref,eoe(n));return typeof r=="function"||a.isPresent?R.cloneElement(n,{ref:o}):null};ca.displayName="Presence";function Jie(t){const[e,r]=R.useState(),a=R.useRef(null),n=R.useRef(t),o=R.useRef("none"),l=t?"mounted":"unmounted",[u,c]=Qie(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const f=lh(a.current);o.current=u==="mounted"?f:"none"},[u]),sn(()=>{const f=a.current,p=n.current;if(p!==t){const g=o.current,v=lh(f);t?c("MOUNT"):v==="none"||f?.display==="none"?c("UNMOUNT"):c(p&&g!==v?"ANIMATION_OUT":"UNMOUNT"),n.current=t}},[t,c]),sn(()=>{if(e){let f;const p=e.ownerDocument.defaultView??window,h=v=>{const b=lh(a.current).includes(CSS.escape(v.animationName));if(v.target===e&&b&&(c("ANIMATION_END"),!n.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",f=p.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},g=v=>{v.target===e&&(o.current=lh(a.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{p.clearTimeout(f),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:R.useCallback(f=>{a.current=f?getComputedStyle(f):null,r(f)},[])}}function lh(t){return t?.animationName||"none"}function eoe(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Y5=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"}),toe="VisuallyHidden",K5=R.forwardRef((t,e)=>S.jsx(ft.span,{...t,ref:e,style:{...Y5,...t.style}}));K5.displayName=toe;var roe=K5,[Jm]=ei("Tooltip",[Fo]),eg=Fo(),Z5="TooltipProvider",noe=700,xA="tooltip.open",[aoe,f1]=Jm(Z5),X5=t=>{const{__scopeTooltip:e,delayDuration:r=noe,skipDelayDuration:a=300,disableHoverableContent:n=!1,children:o}=t,l=R.useRef(!0),u=R.useRef(!1),c=R.useRef(0);return R.useEffect(()=>{const f=c.current;return()=>window.clearTimeout(f)},[]),S.jsx(aoe,{scope:e,isOpenDelayedRef:l,delayDuration:r,onOpen:R.useCallback(()=>{window.clearTimeout(c.current),l.current=!1},[]),onClose:R.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>l.current=!0,a)},[a]),isPointerInTransitRef:u,onPointerInTransitChange:R.useCallback(f=>{u.current=f},[]),disableHoverableContent:n,children:o})};X5.displayName=Z5;var _d="Tooltip",[ioe,Qd]=Jm(_d),Q5=t=>{const{__scopeTooltip:e,children:r,open:a,defaultOpen:n,onOpenChange:o,disableHoverableContent:l,delayDuration:u}=t,c=f1(_d,t.__scopeTooltip),f=eg(e),[p,h]=R.useState(null),g=Xr(),v=R.useRef(0),w=l??c.disableHoverableContent,b=u??c.delayDuration,_=R.useRef(!1),[y,E]=Do({prop:a,defaultProp:n??!1,onChange:O=>{O?(c.onOpen(),document.dispatchEvent(new CustomEvent(xA))):c.onClose(),o?.(O)},caller:_d}),x=R.useMemo(()=>y?_.current?"delayed-open":"instant-open":"closed",[y]),T=R.useCallback(()=>{window.clearTimeout(v.current),v.current=0,_.current=!1,E(!0)},[E]),C=R.useCallback(()=>{window.clearTimeout(v.current),v.current=0,E(!1)},[E]),N=R.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{_.current=!0,E(!0),v.current=0},b)},[b,E]);return R.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),S.jsx(Zm,{...f,children:S.jsx(ioe,{scope:e,contentId:g,open:y,stateAttribute:x,trigger:p,onTriggerChange:h,onTriggerEnter:R.useCallback(()=>{c.isOpenDelayedRef.current?N():T()},[c.isOpenDelayedRef,N,T]),onTriggerLeave:R.useCallback(()=>{w?C():(window.clearTimeout(v.current),v.current=0)},[C,w]),onOpen:T,onClose:C,disableHoverableContent:w,children:r})})};Q5.displayName=_d;var TA="TooltipTrigger",J5=R.forwardRef((t,e)=>{const{__scopeTooltip:r,...a}=t,n=Qd(TA,r),o=f1(TA,r),l=eg(r),u=R.useRef(null),c=Ut(e,u,n.onTriggerChange),f=R.useRef(!1),p=R.useRef(!1),h=R.useCallback(()=>f.current=!1,[]);return R.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),S.jsx(Xd,{asChild:!0,...l,children:S.jsx(ft.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...a,ref:c,onPointerMove:Ze(t.onPointerMove,g=>{g.pointerType!=="touch"&&!p.current&&!o.isPointerInTransitRef.current&&(n.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ze(t.onPointerLeave,()=>{n.onTriggerLeave(),p.current=!1}),onPointerDown:Ze(t.onPointerDown,()=>{n.open&&n.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ze(t.onFocus,()=>{f.current||n.onOpen()}),onBlur:Ze(t.onBlur,n.onClose),onClick:Ze(t.onClick,n.onClose)})})});J5.displayName=TA;var p1="TooltipPortal",[ooe,soe]=Jm(p1,{forceMount:void 0}),eG=t=>{const{__scopeTooltip:e,forceMount:r,children:a,container:n}=t,o=Qd(p1,e);return S.jsx(ooe,{scope:e,forceMount:r,children:S.jsx(ca,{present:r||o.open,children:S.jsx(Pu,{asChild:!0,container:n,children:a})})})};eG.displayName=p1;var gu="TooltipContent",tG=R.forwardRef((t,e)=>{const r=soe(gu,t.__scopeTooltip),{forceMount:a=r.forceMount,side:n="top",...o}=t,l=Qd(gu,t.__scopeTooltip);return S.jsx(ca,{present:a||l.open,children:l.disableHoverableContent?S.jsx(rG,{side:n,...o,ref:e}):S.jsx(loe,{side:n,...o,ref:e})})}),loe=R.forwardRef((t,e)=>{const r=Qd(gu,t.__scopeTooltip),a=f1(gu,t.__scopeTooltip),n=R.useRef(null),o=Ut(e,n),[l,u]=R.useState(null),{trigger:c,onClose:f}=r,p=n.current,{onPointerInTransitChange:h}=a,g=R.useCallback(()=>{u(null),h(!1)},[h]),v=R.useCallback((w,b)=>{const _=w.currentTarget,y={x:w.clientX,y:w.clientY},E=foe(y,_.getBoundingClientRect()),x=poe(y,E),T=hoe(b.getBoundingClientRect()),C=goe([...x,...T]);u(C),h(!0)},[h]);return R.useEffect(()=>()=>g(),[g]),R.useEffect(()=>{if(c&&p){const w=_=>v(_,p),b=_=>v(_,c);return c.addEventListener("pointerleave",w),p.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",w),p.removeEventListener("pointerleave",b)}}},[c,p,v,g]),R.useEffect(()=>{if(l){const w=b=>{const _=b.target,y={x:b.clientX,y:b.clientY},E=c?.contains(_)||p?.contains(_),x=!moe(y,l);E?g():x&&(g(),f())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[c,p,l,f,g]),S.jsx(rG,{...t,ref:o})}),[uoe,coe]=Jm(_d,{isInside:!1}),doe=xne("TooltipContent"),rG=R.forwardRef((t,e)=>{const{__scopeTooltip:r,children:a,"aria-label":n,onEscapeKeyDown:o,onPointerDownOutside:l,...u}=t,c=Qd(gu,r),f=eg(r),{onClose:p}=c;return R.useEffect(()=>(document.addEventListener(xA,p),()=>document.removeEventListener(xA,p)),[p]),R.useEffect(()=>{if(c.trigger){const h=g=>{g.target?.contains(c.trigger)&&p()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,p]),S.jsx(Du,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:h=>h.preventDefault(),onDismiss:p,children:S.jsxs(Xm,{"data-state":c.stateAttribute,...f,...u,ref:e,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[S.jsx(doe,{children:a}),S.jsx(uoe,{scope:r,isInside:!0,children:S.jsx(roe,{id:c.contentId,role:"tooltip",children:n||a})})]})})});tG.displayName=gu;var nG="TooltipArrow",aG=R.forwardRef((t,e)=>{const{__scopeTooltip:r,...a}=t,n=eg(r);return coe(nG,r).isInside?null:S.jsx(Qm,{...n,...a,ref:e})});aG.displayName=nG;function foe(t,e){const r=Math.abs(e.top-t.y),a=Math.abs(e.bottom-t.y),n=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(r,a,n,o)){case o:return"left";case n:return"right";case r:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function poe(t,e,r=5){const a=[];switch(e){case"top":a.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":a.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":a.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":a.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return a}function hoe(t){const{top:e,right:r,bottom:a,left:n}=t;return[{x:n,y:e},{x:r,y:e},{x:r,y:a},{x:n,y:a}]}function moe(t,e){const{x:r,y:a}=t;let n=!1;for(let o=0,l=e.length-1;o<e.length;l=o++){const u=e[o],c=e[l],f=u.x,p=u.y,h=c.x,g=c.y;p>a!=g>a&&r<(h-f)*(a-p)/(g-p)+f&&(n=!n)}return n}function goe(t){const e=t.slice();return e.sort((r,a)=>r.x<a.x?-1:r.x>a.x?1:r.y<a.y?-1:r.y>a.y?1:0),voe(e)}function voe(t){if(t.length<=1)return t.slice();const e=[];for(let a=0;a<t.length;a++){const n=t[a];for(;e.length>=2;){const o=e[e.length-1],l=e[e.length-2];if((o.x-l.x)*(n.y-l.y)>=(o.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const r=[];for(let a=t.length-1;a>=0;a--){const n=t[a];for(;r.length>=2;){const o=r[r.length-1],l=r[r.length-2];if((o.x-l.x)*(n.y-l.y)>=(o.y-l.y)*(n.x-l.x))r.pop();else break}r.push(n)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var yoe=X5,boe=Q5,Eoe=J5,Soe=eG,woe=tG,_oe=aG;function iG({delayDuration:t=0,...e}){return S.jsx(yoe,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function rn({...t}){return S.jsx(iG,{children:S.jsx(boe,{"data-slot":"tooltip",...t})})}function nn({...t}){return S.jsx(Eoe,{"data-slot":"tooltip-trigger",...t})}function an({className:t,sideOffset:e=0,children:r,...a}){return S.jsx(Soe,{children:S.jsxs(woe,{"data-slot":"tooltip-content",sideOffset:e,className:Ve("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...a,children:[r,S.jsx(_oe,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class xoe{name="mcp_inspector_open";properties;constructor(e){this.properties={server_url:e.serverUrl,connection_count:e.connectionCount}}}class Bj{name="mcp_tool_execution";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId,success:e.success,duration:e.duration,error:e.error}}}class $j{name="mcp_resource_read";properties;constructor(e){this.properties={resource_uri:e.resourceUri,server_id:e.serverId,success:e.success,error:e.error}}}class zj{name="mcp_prompt_call";properties;constructor(e){this.properties={prompt_name:e.promptName,server_id:e.serverId,success:e.success,error:e.error}}}class qj{name="mcp_chat_message";properties;constructor(e){this.properties={server_id:e.serverId,provider:e.provider,model:e.model,message_count:e.messageCount,tool_calls_count:e.toolCallsCount,success:e.success,execution_mode:e.executionMode,duration:e.duration,error:e.error}}}class Toe{name="mcp_server_added";properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,connection_type:e.connectionType,via_proxy:e.viaProxy}}}class Roe{name="mcp_server_removed";properties;constructor(e){this.properties={server_id:e.serverId}}}class Aoe{name="mcp_command_palette_open";properties;constructor(e){this.properties={trigger:e.trigger}}}class Coe{name="mcp_tool_saved";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId}}}function cS(){try{return"0.4.11"}catch{return"0.0.0"}}var Noe={};function dS(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class Hj{endpoint;timeout;constructor(e,r=3e3){this.endpoint=e,this.timeout=r}async logEvent(e){try{const r=new AbortController,a=setTimeout(()=>r.abort(),this.timeout),n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:r.signal});if(clearTimeout(a),!n.ok)throw new Error(`HTTP error! status: ${n.status}`)}catch{}}}function go(t){return`mcp_inspector_telemetry_${t}`}class Br{static instance=null;POSTHOG_PROXY_URL="/inspector/api/tel/posthog";SCARF_PROXY_URL="/inspector/api/tel/scarf";UNKNOWN_USER_ID="UNKNOWN_USER_ID";_currUserId=null;_posthogClient=null;_scarfClient=null;_source="inspector";constructor(){const e=dS(),r=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||"inspector",r)this._posthogClient=null,this._scarfClient=null;else if(!e)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new Hj(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new Hj(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(go("disabled"))==="true"||typeof process<"u"&&Noe?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(go("source")):null}static getInstance(){return Br.instance||(Br.instance=new Br),Br.instance}setSource(e){this._source=e,typeof localStorage<"u"&&localStorage.setItem(go("source"),e)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!dS())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const e=localStorage.getItem(go("user_id"));if(e)this._currUserId=e;else{const r=this.generateUserId();localStorage.setItem(go("user_id"),r),this._currUserId=r}this.trackPackageDownload({triggered_by:"user_id_property"}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}async capture(e){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{const r={event:e.name,user_id:this.userId,properties:{...e.properties,mcp_use_version:cS(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(r)}catch{}if(this._scarfClient)try{const r={};r.mcp_use_version=cS(),r.user_id=this.userId,r.event=e.name,r.language="typescript",r.source=this._source,r.package="inspector",await this._scarfClient.logEvent(r)}catch{}}}async trackPackageDownload(e){if(this._scarfClient&&dS())try{const r=cS();let a=!1,n=!1;const o=localStorage.getItem(go("download_version"));if(o?r>o&&(a=!0,n=!1,localStorage.setItem(go("download_version"),r)):(a=!0,n=!0,localStorage.setItem(go("download_version"),r)),a){const l={...e||{}};l.mcp_use_version=r,l.user_id=this.userId,l.event="package_download",l.first_download=n,l.language="typescript",l.source=this._source,l.package="inspector",await this._scarfClient.logEvent(l)}}catch{}}async trackInspectorOpen(e){const r=new xoe(e);await this.capture(r)}}const oG=R.createContext(void 0);function koe({url:t,name:e,proxyConfig:r,transportType:a,onUpdate:n,onRemove:o}){const l=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let u=t,c={};if(r?.proxyAddress){const g=new URL(r.proxyAddress),v=new URL(t);u=`${g.origin}${g.pathname}${v.pathname}${v.search}`,c["X-Target-URL"]=t}r?.customHeaders&&(c={...c,...r.customHeaders});const f=GC({url:u,callbackUrl:l,customHeaders:Object.keys(c).length>0?c:void 0,transportType:a||"http"}),p=R.useRef(n),h=R.useRef(null);return R.useEffect(()=>{p.current=n},[n]),R.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{const g={id:t,url:t,name:e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,customHeaders:c,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage,client:f.client},v=h.current;(!v||v.state!==g.state||v.error!==g.error||v.authUrl!==g.authUrl||v.tools.length!==g.tools.length||v.resources.length!==g.resources.length||v.prompts.length!==g.prompts.length||!v.client)&&(h.current=g,p.current(g))});else{const g={id:t,url:t,name:e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,customHeaders:c,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage,client:f.client},v=h.current;(!v||v.state!==g.state||v.error!==g.error||v.authUrl!==g.authUrl||v.tools.length!==g.tools.length||v.resources.length!==g.resources.length||v.prompts.length!==g.prompts.length||!v.client)&&(h.current=g,p.current(g))}},[t,e,f.state,f.tools,f.resources,f.prompts,f.error,f.authUrl,f.client]),null}function Ooe({children:t}){const[e,r]=R.useState([]),[a,n]=R.useState(new Map),[o,l]=R.useState(0),[u,c]=R.useState(!0),[f,p]=R.useState(new Set);R.useEffect(()=>{const T=localStorage.getItem("mcp-inspector-connections");if(T)try{const N=JSON.parse(T),O=Array.isArray(N)?N.filter(M=>M&&typeof M=="object"&&typeof M.id=="string"&&typeof M.url=="string"&&typeof M.name=="string").map(M=>(M.transportType||(M.transportType="http"),M)):[];(O.length!==N.length||O.some(M=>M.transportType==="http"&&!N.find(D=>D.id===M.id&&D.transportType)))&&(console.warn("Updated connections in localStorage with transport type migration"),localStorage.setItem("mcp-inspector-connections",JSON.stringify(O))),r(O)}catch(N){console.error("Failed to parse saved connections:",N),localStorage.removeItem("mcp-inspector-connections")}const C=localStorage.getItem("mcp-inspector-auto-connect");C!==null&&c(C==="true")},[]);const h=R.useCallback(T=>{n(C=>new Map(C).set(T.id,T)),l(C=>C+1)},[]),g=R.useCallback((T,C,N,O)=>{const M={id:T,url:T,name:C||T,proxyConfig:N,transportType:O||"http"};r(D=>{if(D.some(G=>G.id===T))return D;const $=[...D,M];return localStorage.setItem("mcp-inspector-connections",JSON.stringify($)),$})},[]),v=R.useCallback(T=>{Br.getInstance().capture(new Roe({serverId:T})).catch(()=>{}),r(N=>{const O=N.filter(I=>I.id!==T);return localStorage.setItem("mcp-inspector-connections",JSON.stringify(O)),O}),n(N=>{const O=new Map(N),I=O.get(T);if(I){try{I.clearStorage()}catch(M){console.error("Failed to clear storage:",M)}O.delete(T)}return O})},[]),w=R.useCallback(T=>{const C=a.get(T);if(C)return C;const N=e.find(O=>O.id===T);if(N)return{id:N.id,url:N.url,name:N.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,listPrompts:async O=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},client:null}},[a,e]),b=R.useCallback(T=>{c(T),localStorage.setItem("mcp-inspector-auto-connect",String(T)),T||p(new Set)},[]),_=R.useCallback(T=>{p(C=>new Set(C).add(T))},[]),y=R.useCallback(T=>{p(C=>{const N=new Set(C);return N.delete(T),N}),n(C=>{const N=new Map(C),O=N.get(T);if(O){try{O.clearStorage()}catch(I){console.error("Failed to clear storage:",I)}N.delete(T)}return N})},[]),E=R.useMemo(()=>e.map(C=>{const N=a.get(C.id);return N||{id:C.id,url:C.url,name:C.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},listPrompts:async O=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},client:null}}),[a,e,o]),x=R.useMemo(()=>({connections:E,addConnection:g,removeConnection:v,getConnection:w,autoConnect:u,setAutoConnect:b,connectServer:_,disconnectServer:y}),[E,g,v,w,u,b,_,y]);return S.jsxs(oG,{value:x,children:[e.filter(T=>u||f.has(T.id)).map(T=>S.jsx(koe,{url:T.url,name:T.name,proxyConfig:T.proxyConfig,transportType:T.transportType,onUpdate:h,onRemove:()=>v(T.id)},T.id)),t]})}function h1(){const t=R.use(oG);if(!t)throw new Error("useMcpContext must be used within McpProvider");return t}var fS="focusScope.autoFocusOnMount",pS="focusScope.autoFocusOnUnmount",Gj={bubbles:!1,cancelable:!0},Ioe="FocusScope",Jd=R.forwardRef((t,e)=>{const{loop:r=!1,trapped:a=!1,onMountAutoFocus:n,onUnmountAutoFocus:o,...l}=t,[u,c]=R.useState(null),f=Ka(n),p=Ka(o),h=R.useRef(null),g=Ut(e,b=>c(b)),v=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(a){let b=function(x){if(v.paused||!u)return;const T=x.target;u.contains(T)?h.current=T:bo(h.current,{select:!0})},_=function(x){if(v.paused||!u)return;const T=x.relatedTarget;T!==null&&(u.contains(T)||bo(h.current,{select:!0}))},y=function(x){if(document.activeElement===document.body)for(const C of x)C.removedNodes.length>0&&bo(u)};document.addEventListener("focusin",b),document.addEventListener("focusout",_);const E=new MutationObserver(y);return u&&E.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",_),E.disconnect()}}},[a,u,v.paused]),R.useEffect(()=>{if(u){Wj.add(v);const b=document.activeElement;if(!u.contains(b)){const y=new CustomEvent(fS,Gj);u.addEventListener(fS,f),u.dispatchEvent(y),y.defaultPrevented||(Doe(Uoe(sG(u)),{select:!0}),document.activeElement===b&&bo(u))}return()=>{u.removeEventListener(fS,f),setTimeout(()=>{const y=new CustomEvent(pS,Gj);u.addEventListener(pS,p),u.dispatchEvent(y),y.defaultPrevented||bo(b??document.body,{select:!0}),u.removeEventListener(pS,p),Wj.remove(v)},0)}}},[u,f,p,v]);const w=R.useCallback(b=>{if(!r&&!a||v.paused)return;const _=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,y=document.activeElement;if(_&&y){const E=b.currentTarget,[x,T]=Loe(E);x&&T?!b.shiftKey&&y===T?(b.preventDefault(),r&&bo(x,{select:!0})):b.shiftKey&&y===x&&(b.preventDefault(),r&&bo(T,{select:!0})):y===E&&b.preventDefault()}},[r,a,v.paused]);return S.jsx(ft.div,{tabIndex:-1,...l,ref:g,onKeyDown:w})});Jd.displayName=Ioe;function Doe(t,{select:e=!1}={}){const r=document.activeElement;for(const a of t)if(bo(a,{select:e}),document.activeElement!==r)return}function Loe(t){const e=sG(t),r=Vj(e,t),a=Vj(e.reverse(),t);return[r,a]}function sG(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const n=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||n?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function Vj(t,e){for(const r of t)if(!Moe(r,{upTo:e}))return r}function Moe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Poe(t){return t instanceof HTMLInputElement&&"select"in t}function bo(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Poe(t)&&e&&t.select()}}var Wj=joe();function joe(){let t=[];return{add(e){const r=t[0];e!==r&&r?.pause(),t=Yj(t,e),t.unshift(e)},remove(e){t=Yj(t,e),t[0]?.resume()}}}function Yj(t,e){const r=[...t],a=r.indexOf(e);return a!==-1&&r.splice(a,1),r}function Uoe(t){return t.filter(e=>e.tagName!=="A")}var hS=0;function tg(){R.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Kj()),document.body.insertAdjacentElement("beforeend",t[1]??Kj()),hS++,()=>{hS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),hS--}},[])}function Kj(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Ua=function(){return Ua=Object.assign||function(e){for(var r,a=1,n=arguments.length;a<n;a++){r=arguments[a];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},Ua.apply(this,arguments)};function lG(t,e){var r={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(r[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)e.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(r[a[n]]=t[a[n]]);return r}function Foe(t,e,r){if(r||arguments.length===2)for(var a=0,n=e.length,o;a<n;a++)(o||!(a in e))&&(o||(o=Array.prototype.slice.call(e,0,a)),o[a]=e[a]);return t.concat(o||Array.prototype.slice.call(e))}var kh="right-scroll-bar-position",Oh="width-before-scroll-bar",Boe="with-scroll-bars-hidden",$oe="--removed-body-scroll-bar-size";function mS(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function zoe(t,e){var r=R.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(a){var n=r.value;n!==a&&(r.value=a,r.callback(a,n))}}}})[0];return r.callback=e,r.facade}var qoe=typeof window<"u"?R.useLayoutEffect:R.useEffect,Zj=new WeakMap;function Hoe(t,e){var r=zoe(null,function(a){return t.forEach(function(n){return mS(n,a)})});return qoe(function(){var a=Zj.get(r);if(a){var n=new Set(a),o=new Set(t),l=r.current;n.forEach(function(u){o.has(u)||mS(u,null)}),o.forEach(function(u){n.has(u)||mS(u,l)})}Zj.set(r,t)},[t]),r}function Goe(t){return t}function Voe(t,e){e===void 0&&(e=Goe);var r=[],a=!1,n={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(o){var l=e(o,a);return r.push(l),function(){r=r.filter(function(u){return u!==l})}},assignSyncMedium:function(o){for(a=!0;r.length;){var l=r;r=[],l.forEach(o)}r={push:function(u){return o(u)},filter:function(){return r}}},assignMedium:function(o){a=!0;var l=[];if(r.length){var u=r;r=[],u.forEach(o),l=r}var c=function(){var p=l;l=[],p.forEach(o)},f=function(){return Promise.resolve().then(c)};f(),r={push:function(p){l.push(p),f()},filter:function(p){return l=l.filter(p),r}}}};return n}function Woe(t){t===void 0&&(t={});var e=Voe(null);return e.options=Ua({async:!0,ssr:!1},t),e}var uG=function(t){var e=t.sideCar,r=lG(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=e.read();if(!a)throw new Error("Sidecar medium not found");return R.createElement(a,Ua({},r))};uG.isSideCarExport=!0;function Yoe(t,e){return t.useMedium(e),uG}var cG=Woe(),gS=function(){},rg=R.forwardRef(function(t,e){var r=R.useRef(null),a=R.useState({onScrollCapture:gS,onWheelCapture:gS,onTouchMoveCapture:gS}),n=a[0],o=a[1],l=t.forwardProps,u=t.children,c=t.className,f=t.removeScrollBar,p=t.enabled,h=t.shards,g=t.sideCar,v=t.noRelative,w=t.noIsolation,b=t.inert,_=t.allowPinchZoom,y=t.as,E=y===void 0?"div":y,x=t.gapMode,T=lG(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,N=Hoe([r,e]),O=Ua(Ua({},T),n);return R.createElement(R.Fragment,null,p&&R.createElement(C,{sideCar:cG,removeScrollBar:f,shards:h,noRelative:v,noIsolation:w,inert:b,setCallbacks:o,allowPinchZoom:!!_,lockRef:r,gapMode:x}),l?R.cloneElement(R.Children.only(u),Ua(Ua({},O),{ref:N})):R.createElement(E,Ua({},O,{className:c,ref:N}),u))});rg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};rg.classNames={fullWidth:Oh,zeroRight:kh};var Koe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Zoe(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Koe();return e&&t.setAttribute("nonce",e),t}function Xoe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Qoe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Joe=function(){var t=0,e=null;return{add:function(r){t==0&&(e=Zoe())&&(Xoe(e,r),Qoe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},ese=function(){var t=Joe();return function(e,r){R.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},dG=function(){var t=ese(),e=function(r){var a=r.styles,n=r.dynamic;return t(a,n),null};return e},tse={left:0,top:0,right:0,gap:0},vS=function(t){return parseInt(t||"",10)||0},rse=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],a=e[t==="padding"?"paddingTop":"marginTop"],n=e[t==="padding"?"paddingRight":"marginRight"];return[vS(r),vS(a),vS(n)]},nse=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return tse;var e=rse(t),r=document.documentElement.clientWidth,a=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,a-r+e[2]-e[0])}},ase=dG(),Kl="data-scroll-locked",ise=function(t,e,r,a){var n=t.left,o=t.top,l=t.right,u=t.gap;return r===void 0&&(r="margin"),`
355
+ */const Kre=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ed=vt("zap",Kre);function Zre(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}const Xre=t=>{switch(t){case"success":return ene;case"info":return rne;case"warning":return tne;case"error":return nne;default:return null}},Qre=Array(12).fill(0),Jre=({visible:t,className:e})=>je.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},je.createElement("div",{className:"sonner-spinner"},Qre.map((r,a)=>je.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),ene=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),tne=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),rne=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),nne=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),ane=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},je.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),je.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),ine=()=>{const[t,e]=je.useState(document.hidden);return je.useEffect(()=>{const r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t};let gA=1;class one{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;const{message:a,...n}=e,o=typeof e?.id=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:gA++,l=this.toasts.find(c=>c.id===o),u=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),l?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...e,id:o,title:a}),{...c,...e,id:o,dismissible:u,title:a}):c):this.addToast({title:a,...n,dismissible:u,id:o}),o},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:e,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(a=>a({id:r.id,dismiss:!0}))}),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let a;r.loading!==void 0&&(a=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const n=Promise.resolve(e instanceof Function?e():e);let o=a!==void 0,l;const u=n.then(async f=>{if(l=["resolve",f],je.isValidElement(f))o=!1,this.create({id:a,type:"default",message:f});else if(lne(f)&&!f.ok){o=!1;const h=typeof r.error=="function"?await r.error(`HTTP error! status: ${f.status}`):r.error,g=typeof r.description=="function"?await r.description(`HTTP error! status: ${f.status}`):r.description,w=typeof h=="object"&&!je.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...w})}else if(f instanceof Error){o=!1;const h=typeof r.error=="function"?await r.error(f):r.error,g=typeof r.description=="function"?await r.description(f):r.description,w=typeof h=="object"&&!je.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...w})}else if(r.success!==void 0){o=!1;const h=typeof r.success=="function"?await r.success(f):r.success,g=typeof r.description=="function"?await r.description(f):r.description,w=typeof h=="object"&&!je.isValidElement(h)?h:{message:h};this.create({id:a,type:"success",description:g,...w})}}).catch(async f=>{if(l=["reject",f],r.error!==void 0){o=!1;const p=typeof r.error=="function"?await r.error(f):r.error,h=typeof r.description=="function"?await r.description(f):r.description,v=typeof p=="object"&&!je.isValidElement(p)?p:{message:p};this.create({id:a,type:"error",description:h,...v})}}).finally(()=>{o&&(this.dismiss(a),a=void 0),r.finally==null||r.finally.call(r)}),c=()=>new Promise((f,p)=>u.then(()=>l[0]==="reject"?p(l[1]):f(l[1])).catch(p));return typeof a!="string"&&typeof a!="number"?{unwrap:c}:Object.assign(a,{unwrap:c})},this.custom=(e,r)=>{const a=r?.id||gA++;return this.create({jsx:e(a),id:a,...r}),a},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Tn=new one,sne=(t,e)=>{const r=e?.id||gA++;return Tn.addToast({title:t,...e,id:r}),r},lne=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",une=sne,cne=()=>Tn.toasts,dne=()=>Tn.getActiveToasts(),xr=Object.assign(une,{success:Tn.success,info:Tn.info,warning:Tn.warning,error:Tn.error,custom:Tn.custom,message:Tn.message,promise:Tn.promise,dismiss:Tn.dismiss,loading:Tn.loading},{getHistory:cne,getToasts:dne});Zre("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function ah(t){return t.label!==void 0}const fne=3,pne="24px",hne="16px",yj=4e3,mne=356,gne=14,vne=45,yne=200;function La(...t){return t.filter(Boolean).join(" ")}function bne(t){const[e,r]=t.split("-"),a=[];return e&&a.push(e),r&&a.push(r),a}const Ene=t=>{var e,r,a,n,o,l,u,c,f;const{invert:p,toast:h,unstyled:g,interacting:v,setHeights:w,visibleToasts:b,heights:_,index:y,toasts:E,expanded:x,removeToast:T,defaultRichColors:C,closeButton:N,style:O,cancelButtonStyle:I,actionButtonStyle:M,className:D="",descriptionClassName:$="",duration:G,position:V,gap:ee,expandByDefault:ne,classNames:F,icons:z,closeButtonAriaLabel:H="Close toast"}=t,[Q,ae]=je.useState(null),[W,Y]=je.useState(null),[K,te]=je.useState(!1),[ie,P]=je.useState(!1),[U,X]=je.useState(!1),[le,oe]=je.useState(!1),[q,Z]=je.useState(!1),[fe,pe]=je.useState(0),[Te,Ce]=je.useState(0),ve=je.useRef(h.duration||G||yj),Me=je.useRef(null),Be=je.useRef(null),De=y===0,Pe=y+1<=b,Le=h.type,$e=h.dismissible!==!1,We=h.className||"",mt=h.descriptionClassName||"",Pt=je.useMemo(()=>_.findIndex(at=>at.toastId===h.id)||0,[_,h.id]),J=je.useMemo(()=>{var at;return(at=h.closeButton)!=null?at:N},[h.closeButton,N]),L=je.useMemo(()=>h.duration||G||yj,[h.duration,G]),j=je.useRef(0),se=je.useRef(0),ge=je.useRef(0),be=je.useRef(null),[Ne,Qe]=V.split("-"),ht=je.useMemo(()=>_.reduce((at,Ht,ar)=>ar>=Pt?at:at+Ht.height,0),[_,Pt]),pt=ine(),yt=h.invert||p,xt=Le==="loading";se.current=je.useMemo(()=>Pt*ee+ht,[Pt,ht]),je.useEffect(()=>{ve.current=L},[L]),je.useEffect(()=>{te(!0)},[]),je.useEffect(()=>{const at=Be.current;if(at){const Ht=at.getBoundingClientRect().height;return Ce(Ht),w(ar=>[{toastId:h.id,height:Ht,position:h.position},...ar]),()=>w(ar=>ar.filter(jr=>jr.toastId!==h.id))}},[w,h.id]),je.useLayoutEffect(()=>{if(!K)return;const at=Be.current,Ht=at.style.height;at.style.height="auto";const ar=at.getBoundingClientRect().height;at.style.height=Ht,Ce(ar),w(jr=>jr.find(nr=>nr.toastId===h.id)?jr.map(nr=>nr.toastId===h.id?{...nr,height:ar}:nr):[{toastId:h.id,height:ar,position:h.position},...jr])},[K,h.title,h.description,w,h.id,h.jsx,h.action,h.cancel]);const dr=je.useCallback(()=>{P(!0),pe(se.current),w(at=>at.filter(Ht=>Ht.toastId!==h.id)),setTimeout(()=>{T(h)},yne)},[h,T,w,se]);je.useEffect(()=>{if(h.promise&&Le==="loading"||h.duration===1/0||h.type==="loading")return;let at;return x||v||pt?(()=>{if(ge.current<j.current){const jr=new Date().getTime()-j.current;ve.current=ve.current-jr}ge.current=new Date().getTime()})():(()=>{ve.current!==1/0&&(j.current=new Date().getTime(),at=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),dr()},ve.current))})(),()=>clearTimeout(at)},[x,v,h,Le,pt,dr]),je.useEffect(()=>{h.delete&&(dr(),h.onDismiss==null||h.onDismiss.call(h,h))},[dr,h.delete]);function Jt(){var at;if(z?.loading){var Ht;return je.createElement("div",{className:La(F?.loader,h==null||(Ht=h.classNames)==null?void 0:Ht.loader,"sonner-loader"),"data-visible":Le==="loading"},z.loading)}return je.createElement(Jre,{className:La(F?.loader,h==null||(at=h.classNames)==null?void 0:at.loader),visible:Le==="loading"})}const gn=h.icon||z?.[Le]||Xre(Le);var da,ln;return je.createElement("li",{tabIndex:0,ref:Be,className:La(D,We,F?.toast,h==null||(e=h.classNames)==null?void 0:e.toast,F?.default,F?.[Le],h==null||(r=h.classNames)==null?void 0:r[Le]),"data-sonner-toast":"","data-rich-colors":(da=h.richColors)!=null?da:C,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":K,"data-promise":!!h.promise,"data-swiped":q,"data-removed":ie,"data-visible":Pe,"data-y-position":Ne,"data-x-position":Qe,"data-index":y,"data-front":De,"data-swiping":U,"data-dismissible":$e,"data-type":Le,"data-invert":yt,"data-swipe-out":le,"data-swipe-direction":W,"data-expanded":!!(x||ne&&K),"data-testid":h.testId,style:{"--index":y,"--toasts-before":y,"--z-index":E.length-y,"--offset":`${ie?fe:se.current}px`,"--initial-height":ne?"auto":`${Te}px`,...O,...h.style},onDragEnd:()=>{X(!1),ae(null),be.current=null},onPointerDown:at=>{at.button!==2&&(xt||!$e||(Me.current=new Date,pe(se.current),at.target.setPointerCapture(at.pointerId),at.target.tagName!=="BUTTON"&&(X(!0),be.current={x:at.clientX,y:at.clientY})))},onPointerUp:()=>{var at,Ht,ar;if(le||!$e)return;be.current=null;const jr=Number(((at=Be.current)==null?void 0:at.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),qn=Number(((Ht=Be.current)==null?void 0:Ht.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),nr=new Date().getTime()-((ar=Me.current)==null?void 0:ar.getTime()),Jr=Q==="x"?jr:qn,Aa=Math.abs(Jr)/nr;if(Math.abs(Jr)>=vne||Aa>.11){pe(se.current),h.onDismiss==null||h.onDismiss.call(h,h),Y(Q==="x"?jr>0?"right":"left":qn>0?"down":"up"),dr(),oe(!0);return}else{var en,zr;(en=Be.current)==null||en.style.setProperty("--swipe-amount-x","0px"),(zr=Be.current)==null||zr.style.setProperty("--swipe-amount-y","0px")}Z(!1),X(!1),ae(null)},onPointerMove:at=>{var Ht,ar,jr;if(!be.current||!$e||((Ht=window.getSelection())==null?void 0:Ht.toString().length)>0)return;const nr=at.clientY-be.current.y,Jr=at.clientX-be.current.x;var Aa;const en=(Aa=t.swipeDirections)!=null?Aa:bne(V);!Q&&(Math.abs(Jr)>1||Math.abs(nr)>1)&&ae(Math.abs(Jr)>Math.abs(nr)?"x":"y");let zr={x:0,y:0};const de=ue=>1/(1.5+Math.abs(ue)/20);if(Q==="y"){if(en.includes("top")||en.includes("bottom"))if(en.includes("top")&&nr<0||en.includes("bottom")&&nr>0)zr.y=nr;else{const ue=nr*de(nr);zr.y=Math.abs(ue)<Math.abs(nr)?ue:nr}}else if(Q==="x"&&(en.includes("left")||en.includes("right")))if(en.includes("left")&&Jr<0||en.includes("right")&&Jr>0)zr.x=Jr;else{const ue=Jr*de(Jr);zr.x=Math.abs(ue)<Math.abs(Jr)?ue:Jr}(Math.abs(zr.x)>0||Math.abs(zr.y)>0)&&Z(!0),(ar=Be.current)==null||ar.style.setProperty("--swipe-amount-x",`${zr.x}px`),(jr=Be.current)==null||jr.style.setProperty("--swipe-amount-y",`${zr.y}px`)}},J&&!h.jsx&&Le!=="loading"?je.createElement("button",{"aria-label":H,"data-disabled":xt,"data-close-button":!0,onClick:xt||!$e?()=>{}:()=>{dr(),h.onDismiss==null||h.onDismiss.call(h,h)},className:La(F?.closeButton,h==null||(a=h.classNames)==null?void 0:a.closeButton)},(ln=z?.close)!=null?ln:ane):null,(Le||h.icon||h.promise)&&h.icon!==null&&(z?.[Le]!==null||h.icon)?je.createElement("div",{"data-icon":"",className:La(F?.icon,h==null||(n=h.classNames)==null?void 0:n.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Jt():null,h.type!=="loading"?gn:null):null,je.createElement("div",{"data-content":"",className:La(F?.content,h==null||(o=h.classNames)==null?void 0:o.content)},je.createElement("div",{"data-title":"",className:La(F?.title,h==null||(l=h.classNames)==null?void 0:l.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?je.createElement("div",{"data-description":"",className:La($,mt,F?.description,h==null||(u=h.classNames)==null?void 0:u.description)},typeof h.description=="function"?h.description():h.description):null),je.isValidElement(h.cancel)?h.cancel:h.cancel&&ah(h.cancel)?je.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||I,onClick:at=>{ah(h.cancel)&&$e&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,at),dr())},className:La(F?.cancelButton,h==null||(c=h.classNames)==null?void 0:c.cancelButton)},h.cancel.label):null,je.isValidElement(h.action)?h.action:h.action&&ah(h.action)?je.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||M,onClick:at=>{ah(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,at),!at.defaultPrevented&&dr())},className:La(F?.actionButton,h==null||(f=h.classNames)==null?void 0:f.actionButton)},h.action.label):null)};function bj(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Sne(t,e){const r={};return[t,e].forEach((a,n)=>{const o=n===1,l=o?"--mobile-offset":"--offset",u=o?hne:pne;function c(f){["top","right","bottom","left"].forEach(p=>{r[`${l}-${p}`]=typeof f=="number"?`${f}px`:f})}typeof a=="number"||typeof a=="string"?c(a):typeof a=="object"?["top","right","bottom","left"].forEach(f=>{a[f]===void 0?r[`${l}-${f}`]=u:r[`${l}-${f}`]=typeof a[f]=="number"?`${a[f]}px`:a[f]}):c(u)}),r}const wne=je.forwardRef(function(e,r){const{id:a,invert:n,position:o="bottom-right",hotkey:l=["altKey","KeyT"],expand:u,closeButton:c,className:f,offset:p,mobileOffset:h,theme:g="light",richColors:v,duration:w,style:b,visibleToasts:_=fne,toastOptions:y,dir:E=bj(),gap:x=gne,icons:T,containerAriaLabel:C="Notifications"}=e,[N,O]=je.useState([]),I=je.useMemo(()=>a?N.filter(K=>K.toasterId===a):N.filter(K=>!K.toasterId),[N,a]),M=je.useMemo(()=>Array.from(new Set([o].concat(I.filter(K=>K.position).map(K=>K.position)))),[I,o]),[D,$]=je.useState([]),[G,V]=je.useState(!1),[ee,ne]=je.useState(!1),[F,z]=je.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=je.useRef(null),Q=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),ae=je.useRef(null),W=je.useRef(!1),Y=je.useCallback(K=>{O(te=>{var ie;return(ie=te.find(P=>P.id===K.id))!=null&&ie.delete||Tn.dismiss(K.id),te.filter(({id:P})=>P!==K.id)})},[]);return je.useEffect(()=>Tn.subscribe(K=>{if(K.dismiss){requestAnimationFrame(()=>{O(te=>te.map(ie=>ie.id===K.id?{...ie,delete:!0}:ie))});return}setTimeout(()=>{GH.flushSync(()=>{O(te=>{const ie=te.findIndex(P=>P.id===K.id);return ie!==-1?[...te.slice(0,ie),{...te[ie],...K},...te.slice(ie+1)]:[K,...te]})})})}),[N]),je.useEffect(()=>{if(g!=="system"){z(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;const K=window.matchMedia("(prefers-color-scheme: dark)");try{K.addEventListener("change",({matches:te})=>{z(te?"dark":"light")})}catch{K.addListener(({matches:ie})=>{try{z(ie?"dark":"light")}catch(P){console.error(P)}})}},[g]),je.useEffect(()=>{N.length<=1&&V(!1)},[N]),je.useEffect(()=>{const K=te=>{var ie;if(l.every(X=>te[X]||te.code===X)){var U;V(!0),(U=H.current)==null||U.focus()}te.code==="Escape"&&(document.activeElement===H.current||(ie=H.current)!=null&&ie.contains(document.activeElement))&&V(!1)};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[l]),je.useEffect(()=>{if(H.current)return()=>{ae.current&&(ae.current.focus({preventScroll:!0}),ae.current=null,W.current=!1)}},[H.current]),je.createElement("section",{ref:r,"aria-label":`${C} ${Q}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((K,te)=>{var ie;const[P,U]=K.split("-");return I.length?je.createElement("ol",{key:K,dir:E==="auto"?bj():E,tabIndex:-1,ref:H,className:f,"data-sonner-toaster":!0,"data-sonner-theme":F,"data-y-position":P,"data-x-position":U,style:{"--front-toast-height":`${((ie=D[0])==null?void 0:ie.height)||0}px`,"--width":`${mne}px`,"--gap":`${x}px`,...b,...Sne(p,h)},onBlur:X=>{W.current&&!X.currentTarget.contains(X.relatedTarget)&&(W.current=!1,ae.current&&(ae.current.focus({preventScroll:!0}),ae.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||W.current||(W.current=!0,ae.current=X.relatedTarget)},onMouseEnter:()=>V(!0),onMouseMove:()=>V(!0),onMouseLeave:()=>{ee||V(!1)},onDragEnd:()=>V(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||ne(!0)},onPointerUp:()=>ne(!1)},I.filter(X=>!X.position&&te===0||X.position===K).map((X,le)=>{var oe,q;return je.createElement(Ene,{key:X.id,icons:T,index:le,toast:X,defaultRichColors:v,duration:(oe=y?.duration)!=null?oe:w,className:y?.className,descriptionClassName:y?.descriptionClassName,invert:n,visibleToasts:_,closeButton:(q=y?.closeButton)!=null?q:c,interacting:ee,position:K,style:y?.style,unstyled:y?.unstyled,classNames:y?.classNames,cancelButtonStyle:y?.cancelButtonStyle,actionButtonStyle:y?.actionButtonStyle,closeButtonAriaLabel:y?.closeButtonAriaLabel,removeToast:Y,toasts:I.filter(Z=>Z.position==X.position),heights:D.filter(Z=>Z.position==X.position),setHeights:$,expandByDefault:u,gap:x,expanded:G,swipeDirections:e.swipeDirections})})):null}))});function Ej(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Mi(...t){return e=>{let r=!1;const a=t.map(n=>{const o=Ej(n,e);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let n=0;n<a.length;n++){const o=a[n];typeof o=="function"?o():Ej(t[n],null)}}}}function Ut(...t){return R.useCallback(Mi(...t),t)}function Io(t){const e=_ne(t),r=R.forwardRef((a,n)=>{const{children:o,...l}=a,u=R.Children.toArray(o),c=u.find(Tne);if(c){const f=c.props.children,p=u.map(h=>h===c?R.Children.count(f)>1?R.Children.only(null):R.isValidElement(f)?f.props.children:null:h);return S.jsx(e,{...l,ref:n,children:R.isValidElement(f)?R.cloneElement(f,void 0,p):null})}return S.jsx(e,{...l,ref:n,children:o})});return r.displayName=`${t}.Slot`,r}var JH=Io("Slot");function _ne(t){const e=R.forwardRef((r,a)=>{const{children:n,...o}=r;if(R.isValidElement(n)){const l=Ane(n),u=Rne(o,n.props);return n.type!==R.Fragment&&(u.ref=a?Mi(a,l):l),R.cloneElement(n,u)}return R.Children.count(n)>1?R.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var e5=Symbol("radix.slottable");function xne(t){const e=({children:r})=>S.jsx(S.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=e5,e}function Tne(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===e5}function Rne(t,e){const r={...e};for(const a in e){const n=t[a],o=e[a];/^on[A-Z]/.test(a)?n&&o?r[a]=(...u)=>{const c=o(...u);return n(...u),c}:n&&(r[a]=n):a==="style"?r[a]={...n,...o}:a==="className"&&(r[a]=[n,o].filter(Boolean).join(" "))}return{...t,...r}}function Ane(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function t5(t){var e,r,a="";if(typeof t=="string"||typeof t=="number")a+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(e=0;e<n;e++)t[e]&&(r=t5(t[e]))&&(a&&(a+=" "),a+=r)}else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}function r5(){for(var t,e,r=0,a="",n=arguments.length;r<n;r++)(t=arguments[r])&&(e=t5(t))&&(a&&(a+=" "),a+=e);return a}const Sj=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,wj=r5,n5=(t,e)=>r=>{var a;if(e?.variants==null)return wj(t,r?.class,r?.className);const{variants:n,defaultVariants:o}=e,l=Object.keys(n).map(f=>{const p=r?.[f],h=o?.[f];if(p===null)return null;const g=Sj(p)||Sj(h);return n[f][g]}),u=r&&Object.entries(r).reduce((f,p)=>{let[h,g]=p;return g===void 0||(f[h]=g),f},{}),c=e==null||(a=e.compoundVariants)===null||a===void 0?void 0:a.reduce((f,p)=>{let{class:h,className:g,...v}=p;return Object.entries(v).every(w=>{let[b,_]=w;return Array.isArray(_)?_.includes({...o,...u}[b]):{...o,...u}[b]===_})?[...f,h,g]:f},[]);return wj(t,l,c,r?.class,r?.className)},t1="-",Cne=t=>{const e=kne(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=t;return{getClassGroupId:l=>{const u=l.split(t1);return u[0]===""&&u.length!==1&&u.shift(),a5(u,e)||Nne(l)},getConflictingClassGroupIds:(l,u)=>{const c=r[l]||[];return u&&a[l]?[...c,...a[l]]:c}}},a5=(t,e)=>{if(t.length===0)return e.classGroupId;const r=t[0],a=e.nextPart.get(r),n=a?a5(t.slice(1),a):void 0;if(n)return n;if(e.validators.length===0)return;const o=t.join(t1);return e.validators.find(({validator:l})=>l(o))?.classGroupId},_j=/^\[(.+)\]$/,Nne=t=>{if(_j.test(t)){const e=_j.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},kne=t=>{const{theme:e,classGroups:r}=t,a={nextPart:new Map,validators:[]};for(const n in r)vA(r[n],a,n,e);return a},vA=(t,e,r,a)=>{t.forEach(n=>{if(typeof n=="string"){const o=n===""?e:xj(e,n);o.classGroupId=r;return}if(typeof n=="function"){if(One(n)){vA(n(a),e,r,a);return}e.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([o,l])=>{vA(l,xj(e,o),r,a)})})},xj=(t,e)=>{let r=t;return e.split(t1).forEach(a=>{r.nextPart.has(a)||r.nextPart.set(a,{nextPart:new Map,validators:[]}),r=r.nextPart.get(a)}),r},One=t=>t.isThemeGetter,Ine=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,a=new Map;const n=(o,l)=>{r.set(o,l),e++,e>t&&(e=0,a=r,r=new Map)};return{get(o){let l=r.get(o);if(l!==void 0)return l;if((l=a.get(o))!==void 0)return n(o,l),l},set(o,l){r.has(o)?r.set(o,l):n(o,l)}}},yA="!",bA=":",Dne=bA.length,Lne=t=>{const{prefix:e,experimentalParseClassName:r}=t;let a=n=>{const o=[];let l=0,u=0,c=0,f;for(let w=0;w<n.length;w++){let b=n[w];if(l===0&&u===0){if(b===bA){o.push(n.slice(c,w)),c=w+Dne;continue}if(b==="/"){f=w;continue}}b==="["?l++:b==="]"?l--:b==="("?u++:b===")"&&u--}const p=o.length===0?n:n.substring(c),h=Mne(p),g=h!==p,v=f&&f>c?f-c:void 0;return{modifiers:o,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:v}};if(e){const n=e+bA,o=a;a=l=>l.startsWith(n)?o(l.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:l,maybePostfixModifierPosition:void 0}}if(r){const n=a;a=o=>r({className:o,parseClassName:n})}return a},Mne=t=>t.endsWith(yA)?t.substring(0,t.length-1):t.startsWith(yA)?t.substring(1):t,Pne=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const n=[];let o=[];return a.forEach(l=>{l[0]==="["||e[l]?(n.push(...o.sort(),l),o=[]):o.push(l)}),n.push(...o.sort()),n}},jne=t=>({cache:Ine(t.cacheSize),parseClassName:Lne(t),sortModifiers:Pne(t),...Cne(t)}),Une=/\s+/,Fne=(t,e)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:o}=e,l=[],u=t.trim().split(Une);let c="";for(let f=u.length-1;f>=0;f-=1){const p=u[f],{isExternal:h,modifiers:g,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:b}=r(p);if(h){c=p+(c.length>0?" "+c:c);continue}let _=!!b,y=a(_?w.substring(0,b):w);if(!y){if(!_){c=p+(c.length>0?" "+c:c);continue}if(y=a(w),!y){c=p+(c.length>0?" "+c:c);continue}_=!1}const E=o(g).join(":"),x=v?E+yA:E,T=x+y;if(l.includes(T))continue;l.push(T);const C=n(y,_);for(let N=0;N<C.length;++N){const O=C[N];l.push(x+O)}c=p+(c.length>0?" "+c:c)}return c};function Bne(){let t=0,e,r,a="";for(;t<arguments.length;)(e=arguments[t++])&&(r=i5(e))&&(a&&(a+=" "),a+=r);return a}const i5=t=>{if(typeof t=="string")return t;let e,r="";for(let a=0;a<t.length;a++)t[a]&&(e=i5(t[a]))&&(r&&(r+=" "),r+=e);return r};function $ne(t,...e){let r,a,n,o=l;function l(c){const f=e.reduce((p,h)=>h(p),t());return r=jne(f),a=r.cache.get,n=r.cache.set,o=u,u(c)}function u(c){const f=a(c);if(f)return f;const p=Fne(c,r);return n(c,p),p}return function(){return o(Bne.apply(null,arguments))}}const Lr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},o5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,s5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zne=/^\d+\/\d+$/,qne=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Hne=/\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$/,Gne=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Vne=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wne=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,El=t=>zne.test(t),Rt=t=>!!t&&!Number.isNaN(Number(t)),mo=t=>!!t&&Number.isInteger(Number(t)),oS=t=>t.endsWith("%")&&Rt(t.slice(0,-1)),Si=t=>qne.test(t),Yne=()=>!0,Kne=t=>Hne.test(t)&&!Gne.test(t),l5=()=>!1,Zne=t=>Vne.test(t),Xne=t=>Wne.test(t),Qne=t=>!Je(t)&&!et(t),Jne=t=>Ou(t,d5,l5),Je=t=>o5.test(t),cs=t=>Ou(t,f5,Kne),sS=t=>Ou(t,aae,Rt),Tj=t=>Ou(t,u5,l5),eae=t=>Ou(t,c5,Xne),ih=t=>Ou(t,p5,Zne),et=t=>s5.test(t),Mc=t=>Iu(t,f5),tae=t=>Iu(t,iae),Rj=t=>Iu(t,u5),rae=t=>Iu(t,d5),nae=t=>Iu(t,c5),oh=t=>Iu(t,p5,!0),Ou=(t,e,r)=>{const a=o5.exec(t);return a?a[1]?e(a[1]):r(a[2]):!1},Iu=(t,e,r=!1)=>{const a=s5.exec(t);return a?a[1]?e(a[1]):r:!1},u5=t=>t==="position"||t==="percentage",c5=t=>t==="image"||t==="url",d5=t=>t==="length"||t==="size"||t==="bg-size",f5=t=>t==="length",aae=t=>t==="number",iae=t=>t==="family-name",p5=t=>t==="shadow",oae=()=>{const t=Lr("color"),e=Lr("font"),r=Lr("text"),a=Lr("font-weight"),n=Lr("tracking"),o=Lr("leading"),l=Lr("breakpoint"),u=Lr("container"),c=Lr("spacing"),f=Lr("radius"),p=Lr("shadow"),h=Lr("inset-shadow"),g=Lr("text-shadow"),v=Lr("drop-shadow"),w=Lr("blur"),b=Lr("perspective"),_=Lr("aspect"),y=Lr("ease"),E=Lr("animate"),x=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...T(),et,Je],N=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],I=()=>[et,Je,c],M=()=>[El,"full","auto",...I()],D=()=>[mo,"none","subgrid",et,Je],$=()=>["auto",{span:["full",mo,et,Je]},mo,et,Je],G=()=>[mo,"auto",et,Je],V=()=>["auto","min","max","fr",et,Je],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ne=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...I()],z=()=>[El,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],H=()=>[t,et,Je],Q=()=>[...T(),Rj,Tj,{position:[et,Je]}],ae=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",rae,Jne,{size:[et,Je]}],Y=()=>[oS,Mc,cs],K=()=>["","none","full",f,et,Je],te=()=>["",Rt,Mc,cs],ie=()=>["solid","dashed","dotted","double"],P=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],U=()=>[Rt,oS,Rj,Tj],X=()=>["","none",w,et,Je],le=()=>["none",Rt,et,Je],oe=()=>["none",Rt,et,Je],q=()=>[Rt,et,Je],Z=()=>[El,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Si],breakpoint:[Si],color:[Yne],container:[Si],"drop-shadow":[Si],ease:["in","out","in-out"],font:[Qne],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Si],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Si],shadow:[Si],spacing:["px",Rt],text:[Si],"text-shadow":[Si],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",El,Je,et,_]}],container:["container"],columns:[{columns:[Rt,Je,et,u]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"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"],sr:["sr-only","not-sr-only"],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:C()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{start:M()}],end:[{end:M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[mo,"auto",et,Je]}],basis:[{basis:[El,"full","auto",u,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Rt,El,"auto","initial","none",Je]}],grow:[{grow:["",Rt,et,Je]}],shrink:[{shrink:["",Rt,et,Je]}],order:[{order:[mo,"first","last","none",et,Je]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...ne(),"normal"]}],"justify-self":[{"justify-self":["auto",...ne()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...ne(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ne(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...ne(),"baseline"]}],"place-self":[{"place-self":["auto",...ne()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],w:[{w:[u,"screen",...z()]}],"min-w":[{"min-w":[u,"screen","none",...z()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",r,Mc,cs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,et,sS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",oS,Je]}],"font-family":[{font:[tae,Je,e]}],"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:[n,et,Je]}],"line-clamp":[{"line-clamp":[Rt,"none",et,sS]}],leading:[{leading:[o,...I()]}],"list-image":[{"list-image":["none",et,Je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,Je]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[Rt,"from-font","auto",et,cs]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[Rt,"auto",et,Je]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,Je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,Je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},mo,et,Je],radial:["",et,Je],conic:[mo,et,Je]},nae,eae]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Rt,et,Je]}],"outline-w":[{outline:["",Rt,Mc,cs]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",p,oh,ih]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",h,oh,ih]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[Rt,cs]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",g,oh,ih]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[Rt,et,Je]}],"mix-blend":[{"mix-blend":[...P(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":P()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Rt]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[et,Je]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Rt]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,Je]}],filter:[{filter:["","none",et,Je]}],blur:[{blur:X()}],brightness:[{brightness:[Rt,et,Je]}],contrast:[{contrast:[Rt,et,Je]}],"drop-shadow":[{"drop-shadow":["","none",v,oh,ih]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",Rt,et,Je]}],"hue-rotate":[{"hue-rotate":[Rt,et,Je]}],invert:[{invert:["",Rt,et,Je]}],saturate:[{saturate:[Rt,et,Je]}],sepia:[{sepia:["",Rt,et,Je]}],"backdrop-filter":[{"backdrop-filter":["","none",et,Je]}],"backdrop-blur":[{"backdrop-blur":X()}],"backdrop-brightness":[{"backdrop-brightness":[Rt,et,Je]}],"backdrop-contrast":[{"backdrop-contrast":[Rt,et,Je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Rt,et,Je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Rt,et,Je]}],"backdrop-invert":[{"backdrop-invert":["",Rt,et,Je]}],"backdrop-opacity":[{"backdrop-opacity":[Rt,et,Je]}],"backdrop-saturate":[{"backdrop-saturate":[Rt,et,Je]}],"backdrop-sepia":[{"backdrop-sepia":["",Rt,et,Je]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,Je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Rt,"initial",et,Je]}],ease:[{ease:["linear","initial",y,et,Je]}],delay:[{delay:[Rt,et,Je]}],animate:[{animate:["none",E,et,Je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,et,Je]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:q()}],"skew-x":[{"skew-x":q()}],"skew-y":[{"skew-y":q()}],transform:[{transform:[et,Je,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Z()}],"translate-x":[{"translate-x":Z()}],"translate-y":[{"translate-y":Z()}],"translate-z":[{"translate-z":Z()}],"translate-none":["translate-none"],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",et,Je]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",et,Je]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[Rt,Mc,cs,sS]}],stroke:[{stroke:["none",...H()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},sae=$ne(oae);function Ve(...t){return sae(r5(t))}const lae=n5("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-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 transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Ya({className:t,variant:e,asChild:r=!1,...a}){const n=r?JH:"span";return S.jsx(n,{"data-slot":"badge",className:Ve(lae({variant:e}),t),...a})}const uae=n5("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-all 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-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white 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 hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-full gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-full px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function ct({className:t,variant:e,size:r,asChild:a=!1,...n}){const o=a?JH:"button";return S.jsx(o,{"data-slot":"button",className:Ve(uae({variant:e,size:r,className:t})),...n})}var cae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ft=cae.reduce((t,e)=>{const r=Io(`Primitive.${e}`),a=R.forwardRef((n,o)=>{const{asChild:l,...u}=n,c=l?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),S.jsx(c,{...u,ref:o})});return a.displayName=`Primitive.${e}`,{...t,[e]:a}},{});function h5(t,e){t&&ku.flushSync(()=>t.dispatchEvent(e))}var dae="Label",m5=R.forwardRef((t,e)=>S.jsx(ft.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));m5.displayName=dae;var fae=m5;function pr({className:t,...e}){return S.jsx(fae,{"data-slot":"label",className:Ve("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}function r1({message:t,className:e="",vertical:r,noBorder:a}){return S.jsx("div",{className:Ve(`mt-2 rounded-md p-6 ${e}`,!a&&"border"),children:S.jsxs("p",{className:Ve("text-sm text-muted-foreground flex items-center gap-4",r&&"flex-col"),children:[S.jsx("svg",{width:"40",height:"40",viewBox:"0 0 273 273",version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:S.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:S.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[S.jsx("path",{d:"M49.953025,-2.10854389 C63.26892,-2.21867124 76.6185256,2.70621155 86.9019463,12.6653164 L86.9019463,12.6653164 L87.505627,13.2592944 C97.5154947,23.2654892 102.640454,36.3074513 102.880738,49.4222247 C103.08932,77.4533067 113.877287,105.391753 135.242867,126.757333 C156.613383,148.127849 184.559216,158.914875 212.568138,159.119313 L212.568138,159.119313 L213.212264,159.134159 C225.843948,159.517566 238.363557,164.434972 248.121998,173.886137 L248.121998,173.886137 L248.725621,174.480088 C258.982114,184.732164 264.11035,198.171134 264.11035,211.6101 C264.11035,225.04592 258.984514,238.481745 248.732867,248.732867 C238.592792,258.872942 225.336706,263.997882 212.046872,264.107794 C198.731075,264.21792 185.381569,259.293085 175.098248,249.334078 L175.098248,249.334078 L174.494602,248.740134 C163.75802,238.008189 158.640853,223.784027 159.143413,209.719372 C158.258245,182.640933 147.489786,155.83332 126.828333,135.171867 C106.351297,114.694831 79.8363505,103.934873 53.0237258,102.891841 L53.0237258,102.891841 L52.2811438,102.865674 C38.4791718,103.347421 24.5325234,98.4328111 13.8776628,88.1140866 L13.8776628,88.1140866 L13.2739843,87.5201168 C3.12895117,77.3789607 -1.9984796,64.1195994 -2.10841888,50.8264755 C-2.21854669,37.5105567 2.70635908,24.1609269 12.6655135,13.8774565 L12.6655135,13.8774565 L13.2594878,13.2737797 C23.4005926,3.12880025 36.659927,-1.99860507 49.953025,-2.10854389 Z"}),S.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),S.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),t]})})}function g5({className:t,color:e,children:r,grayscaled:a=!1}){const n=R.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return a?0:.2},[e,a]),o=R.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return a?.3:.4},[e,a]),l=R.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[2]||"0")}return Math.floor(Math.random()*360)},[e]),u=R.useMemo(()=>e||`oklch(${Math.min(o,1)} ${n} ${l})`,[l,n,o]),c=R.useMemo(()=>`oklch(${Math.min(o*2,1)} ${n} ${l})`,[l,n,o,e]),f=R.useMemo(()=>Math.floor(Math.random()*360),[l]),p=R.useMemo(()=>"1000%",[]);return S.jsx("section",{className:Ve("relative w-full h-full overflow-hidden",t),style:{background:`${c}`},children:S.jsxs("div",{className:"isolate relative w-full h-full",children:[S.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${f}deg, ${u}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${p})`}}),r&&S.jsx("div",{className:"relative z-10 w-full h-full",children:r})]})})}function Ze(t,e,{checkForDefaultPrevented:r=!0}={}){return function(n){if(t?.(n),r===!1||!n.defaultPrevented)return e?.(n)}}function pae(t,e){const r=R.createContext(e),a=o=>{const{children:l,...u}=o,c=R.useMemo(()=>u,Object.values(u));return S.jsx(r.Provider,{value:c,children:l})};a.displayName=t+"Provider";function n(o){const l=R.useContext(r);if(l)return l;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[a,n]}function ei(t,e=[]){let r=[];function a(o,l){const u=R.createContext(l),c=r.length;r=[...r,l];const f=h=>{const{scope:g,children:v,...w}=h,b=g?.[t]?.[c]||u,_=R.useMemo(()=>w,Object.values(w));return S.jsx(b.Provider,{value:_,children:v})};f.displayName=o+"Provider";function p(h,g){const v=g?.[t]?.[c]||u,w=R.useContext(v);if(w)return w;if(l!==void 0)return l;throw new Error(`\`${h}\` must be used within \`${o}\``)}return[f,p]}const n=()=>{const o=r.map(l=>R.createContext(l));return function(u){const c=u?.[t]||o;return R.useMemo(()=>({[`__scope${t}`]:{...u,[t]:c}}),[u,c])}};return n.scopeName=t,[a,hae(n,...e)]}function hae(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const a=t.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(o){const l=a.reduce((u,{useScope:c,scopeName:f})=>{const h=c(o)[`__scope${f}`];return{...u,...h}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return r.scopeName=e.scopeName,r}var sn=globalThis?.document?R.useLayoutEffect:()=>{},mae=HC[" useInsertionEffect ".trim().toString()]||sn;function Do({prop:t,defaultProp:e,onChange:r=()=>{},caller:a}){const[n,o,l]=gae({defaultProp:e,onChange:r}),u=t!==void 0,c=u?t:n;{const p=R.useRef(t!==void 0);R.useEffect(()=>{const h=p.current;h!==u&&console.warn(`${a} is changing from ${h?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=u},[u,a])}const f=R.useCallback(p=>{if(u){const h=vae(p)?p(t):p;h!==t&&l.current?.(h)}else o(p)},[u,t,o,l]);return[c,f]}function gae({defaultProp:t,onChange:e}){const[r,a]=R.useState(t),n=R.useRef(r),o=R.useRef(e);return mae(()=>{o.current=e},[e]),R.useEffect(()=>{n.current!==r&&(o.current?.(r),n.current=r)},[r,n]),[r,a,o]}function vae(t){return typeof t=="function"}function v5(t){const e=R.useRef({value:t,previous:t});return R.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function y5(t){const[e,r]=R.useState(void 0);return sn(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const a=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const o=n[0];let l,u;if("borderBoxSize"in o){const c=o.borderBoxSize,f=Array.isArray(c)?c[0]:c;l=f.inlineSize,u=f.blockSize}else l=t.offsetWidth,u=t.offsetHeight;r({width:l,height:u})});return a.observe(t,{box:"border-box"}),()=>a.unobserve(t)}else r(void 0)},[t]),e}var Gm="Switch",[yae]=ei(Gm),[bae,Eae]=yae(Gm),b5=R.forwardRef((t,e)=>{const{__scopeSwitch:r,name:a,checked:n,defaultChecked:o,required:l,disabled:u,value:c="on",onCheckedChange:f,form:p,...h}=t,[g,v]=R.useState(null),w=Ut(e,x=>v(x)),b=R.useRef(!1),_=g?p||!!g.closest("form"):!0,[y,E]=Do({prop:n,defaultProp:o??!1,onChange:f,caller:Gm});return S.jsxs(bae,{scope:r,checked:y,disabled:u,children:[S.jsx(ft.button,{type:"button",role:"switch","aria-checked":y,"aria-required":l,"data-state":_5(y),"data-disabled":u?"":void 0,disabled:u,value:c,...h,ref:w,onClick:Ze(t.onClick,x=>{E(T=>!T),_&&(b.current=x.isPropagationStopped(),b.current||x.stopPropagation())})}),_&&S.jsx(w5,{control:g,bubbles:!b.current,name:a,value:c,checked:y,required:l,disabled:u,form:p,style:{transform:"translateX(-100%)"}})]})});b5.displayName=Gm;var E5="SwitchThumb",S5=R.forwardRef((t,e)=>{const{__scopeSwitch:r,...a}=t,n=Eae(E5,r);return S.jsx(ft.span,{"data-state":_5(n.checked),"data-disabled":n.disabled?"":void 0,...a,ref:e})});S5.displayName=E5;var Sae="SwitchBubbleInput",w5=R.forwardRef(({__scopeSwitch:t,control:e,checked:r,bubbles:a=!0,...n},o)=>{const l=R.useRef(null),u=Ut(l,o),c=v5(r),f=y5(e);return R.useEffect(()=>{const p=l.current;if(!p)return;const h=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==r&&v){const w=new Event("click",{bubbles:a});v.call(p,r),p.dispatchEvent(w)}},[c,r,a]),S.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...n,tabIndex:-1,ref:u,style:{...n.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});w5.displayName=Sae;function _5(t){return t?"checked":"unchecked"}var x5=b5,wae=S5;function n1({ref:t,className:e,...r}){return S.jsx(x5,{className:Ve("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:t,children:S.jsx(wae,{className:Ve("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}n1.displayName=x5.displayName;function Ka(t){const e=R.useRef(t);return R.useEffect(()=>{e.current=t}),R.useMemo(()=>(...r)=>e.current?.(...r),[])}function _ae(t,e=globalThis?.document){const r=Ka(t);R.useEffect(()=>{const a=n=>{n.key==="Escape"&&r(n)};return e.addEventListener("keydown",a,{capture:!0}),()=>e.removeEventListener("keydown",a,{capture:!0})},[r,e])}var xae="DismissableLayer",EA="dismissableLayer.update",Tae="dismissableLayer.pointerDownOutside",Rae="dismissableLayer.focusOutside",Aj,T5=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Du=R.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:a,onPointerDownOutside:n,onFocusOutside:o,onInteractOutside:l,onDismiss:u,...c}=t,f=R.useContext(T5),[p,h]=R.useState(null),g=p?.ownerDocument??globalThis?.document,[,v]=R.useState({}),w=Ut(e,O=>h(O)),b=Array.from(f.layers),[_]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),y=b.indexOf(_),E=p?b.indexOf(p):-1,x=f.layersWithOutsidePointerEventsDisabled.size>0,T=E>=y,C=Nae(O=>{const I=O.target,M=[...f.branches].some(D=>D.contains(I));!T||M||(n?.(O),l?.(O),O.defaultPrevented||u?.())},g),N=kae(O=>{const I=O.target;[...f.branches].some(D=>D.contains(I))||(o?.(O),l?.(O),O.defaultPrevented||u?.())},g);return _ae(O=>{E===f.layers.size-1&&(a?.(O),!O.defaultPrevented&&u&&(O.preventDefault(),u()))},g),R.useEffect(()=>{if(p)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Aj=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),Cj(),()=>{r&&f.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Aj)}},[p,g,r,f]),R.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),Cj())},[p,f]),R.useEffect(()=>{const O=()=>v({});return document.addEventListener(EA,O),()=>document.removeEventListener(EA,O)},[]),S.jsx(ft.div,{...c,ref:w,style:{pointerEvents:x?T?"auto":"none":void 0,...t.style},onFocusCapture:Ze(t.onFocusCapture,N.onFocusCapture),onBlurCapture:Ze(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Ze(t.onPointerDownCapture,C.onPointerDownCapture)})});Du.displayName=xae;var Aae="DismissableLayerBranch",Cae=R.forwardRef((t,e)=>{const r=R.useContext(T5),a=R.useRef(null),n=Ut(e,a);return R.useEffect(()=>{const o=a.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),S.jsx(ft.div,{...t,ref:n})});Cae.displayName=Aae;function Nae(t,e=globalThis?.document){const r=Ka(t),a=R.useRef(!1),n=R.useRef(()=>{});return R.useEffect(()=>{const o=u=>{if(u.target&&!a.current){let c=function(){R5(Tae,r,f,{discrete:!0})};const f={originalEvent:u};u.pointerType==="touch"?(e.removeEventListener("click",n.current),n.current=c,e.addEventListener("click",n.current,{once:!0})):c()}else e.removeEventListener("click",n.current);a.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",o),e.removeEventListener("click",n.current)}},[e,r]),{onPointerDownCapture:()=>a.current=!0}}function kae(t,e=globalThis?.document){const r=Ka(t),a=R.useRef(!1);return R.useEffect(()=>{const n=o=>{o.target&&!a.current&&R5(Rae,r,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",n),()=>e.removeEventListener("focusin",n)},[e,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function Cj(){const t=new CustomEvent(EA);document.dispatchEvent(t)}function R5(t,e,r,{discrete:a}){const n=r.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&n.addEventListener(t,e,{once:!0}),a?h5(n,o):n.dispatchEvent(o)}var Oae=HC[" useId ".trim().toString()]||(()=>{}),Iae=0;function Xr(t){const[e,r]=R.useState(Oae());return sn(()=>{r(a=>a??String(Iae++))},[t]),t||(e?`radix-${e}`:"")}const Dae=["top","right","bottom","left"],Lo=Math.min,Bn=Math.max,mm=Math.round,sh=Math.floor,qa=t=>({x:t,y:t}),Lae={left:"right",right:"left",bottom:"top",top:"bottom"},Mae={start:"end",end:"start"};function SA(t,e,r){return Bn(t,Lo(e,r))}function Pi(t,e){return typeof t=="function"?t(e):t}function ji(t){return t.split("-")[0]}function Lu(t){return t.split("-")[1]}function a1(t){return t==="x"?"y":"x"}function i1(t){return t==="y"?"height":"width"}const Pae=new Set(["top","bottom"]);function Fa(t){return Pae.has(ji(t))?"y":"x"}function o1(t){return a1(Fa(t))}function jae(t,e,r){r===void 0&&(r=!1);const a=Lu(t),n=o1(t),o=i1(n);let l=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(l=gm(l)),[l,gm(l)]}function Uae(t){const e=gm(t);return[wA(t),e,wA(e)]}function wA(t){return t.replace(/start|end/g,e=>Mae[e])}const Nj=["left","right"],kj=["right","left"],Fae=["top","bottom"],Bae=["bottom","top"];function $ae(t,e,r){switch(t){case"top":case"bottom":return r?e?kj:Nj:e?Nj:kj;case"left":case"right":return e?Fae:Bae;default:return[]}}function zae(t,e,r,a){const n=Lu(t);let o=$ae(ji(t),r==="start",a);return n&&(o=o.map(l=>l+"-"+n),e&&(o=o.concat(o.map(wA)))),o}function gm(t){return t.replace(/left|right|bottom|top/g,e=>Lae[e])}function qae(t){return{top:0,right:0,bottom:0,left:0,...t}}function A5(t){return typeof t!="number"?qae(t):{top:t,right:t,bottom:t,left:t}}function vm(t){const{x:e,y:r,width:a,height:n}=t;return{width:a,height:n,top:r,left:e,right:e+a,bottom:r+n,x:e,y:r}}function Oj(t,e,r){let{reference:a,floating:n}=t;const o=Fa(e),l=o1(e),u=i1(l),c=ji(e),f=o==="y",p=a.x+a.width/2-n.width/2,h=a.y+a.height/2-n.height/2,g=a[u]/2-n[u]/2;let v;switch(c){case"top":v={x:p,y:a.y-n.height};break;case"bottom":v={x:p,y:a.y+a.height};break;case"right":v={x:a.x+a.width,y:h};break;case"left":v={x:a.x-n.width,y:h};break;default:v={x:a.x,y:a.y}}switch(Lu(e)){case"start":v[l]-=g*(r&&f?-1:1);break;case"end":v[l]+=g*(r&&f?-1:1);break}return v}const Hae=async(t,e,r)=>{const{placement:a="bottom",strategy:n="absolute",middleware:o=[],platform:l}=r,u=o.filter(Boolean),c=await(l.isRTL==null?void 0:l.isRTL(e));let f=await l.getElementRects({reference:t,floating:e,strategy:n}),{x:p,y:h}=Oj(f,a,c),g=a,v={},w=0;for(let b=0;b<u.length;b++){const{name:_,fn:y}=u[b],{x:E,y:x,data:T,reset:C}=await y({x:p,y:h,initialPlacement:a,placement:g,strategy:n,middlewareData:v,rects:f,platform:l,elements:{reference:t,floating:e}});p=E??p,h=x??h,v={...v,[_]:{...v[_],...T}},C&&w<=50&&(w++,typeof C=="object"&&(C.placement&&(g=C.placement),C.rects&&(f=C.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:n}):C.rects),{x:p,y:h}=Oj(f,g,c)),b=-1)}return{x:p,y:h,placement:g,strategy:n,middlewareData:v}};async function Sd(t,e){var r;e===void 0&&(e={});const{x:a,y:n,platform:o,rects:l,elements:u,strategy:c}=t,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:h="floating",altBoundary:g=!1,padding:v=0}=Pi(e,t),w=A5(v),_=u[g?h==="floating"?"reference":"floating":h],y=vm(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(_)))==null||r?_:_.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:f,rootBoundary:p,strategy:c})),E=h==="floating"?{x:a,y:n,width:l.floating.width,height:l.floating.height}:l.reference,x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),T=await(o.isElement==null?void 0:o.isElement(x))?await(o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},C=vm(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:x,strategy:c}):E);return{top:(y.top-C.top+w.top)/T.y,bottom:(C.bottom-y.bottom+w.bottom)/T.y,left:(y.left-C.left+w.left)/T.x,right:(C.right-y.right+w.right)/T.x}}const Gae=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:a,placement:n,rects:o,platform:l,elements:u,middlewareData:c}=e,{element:f,padding:p=0}=Pi(t,e)||{};if(f==null)return{};const h=A5(p),g={x:r,y:a},v=o1(n),w=i1(v),b=await l.getDimensions(f),_=v==="y",y=_?"top":"left",E=_?"bottom":"right",x=_?"clientHeight":"clientWidth",T=o.reference[w]+o.reference[v]-g[v]-o.floating[w],C=g[v]-o.reference[v],N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let O=N?N[x]:0;(!O||!await(l.isElement==null?void 0:l.isElement(N)))&&(O=u.floating[x]||o.floating[w]);const I=T/2-C/2,M=O/2-b[w]/2-1,D=Lo(h[y],M),$=Lo(h[E],M),G=D,V=O-b[w]-$,ee=O/2-b[w]/2+I,ne=SA(G,ee,V),F=!c.arrow&&Lu(n)!=null&&ee!==ne&&o.reference[w]/2-(ee<G?D:$)-b[w]/2<0,z=F?ee<G?ee-G:ee-V:0;return{[v]:g[v]+z,data:{[v]:ne,centerOffset:ee-ne-z,...F&&{alignmentOffset:z}},reset:F}}}),Vae=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,a;const{placement:n,middlewareData:o,rects:l,initialPlacement:u,platform:c,elements:f}=e,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:b=!0,..._}=Pi(t,e);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const y=ji(n),E=Fa(u),x=ji(u)===u,T=await(c.isRTL==null?void 0:c.isRTL(f.floating)),C=g||(x||!b?[gm(u)]:Uae(u)),N=w!=="none";!g&&N&&C.push(...zae(u,b,w,T));const O=[u,...C],I=await Sd(e,_),M=[];let D=((a=o.flip)==null?void 0:a.overflows)||[];if(p&&M.push(I[y]),h){const ee=jae(n,l,T);M.push(I[ee[0]],I[ee[1]])}if(D=[...D,{placement:n,overflows:M}],!M.every(ee=>ee<=0)){var $,G;const ee=((($=o.flip)==null?void 0:$.index)||0)+1,ne=O[ee];if(ne&&(!(h==="alignment"?E!==Fa(ne):!1)||D.every(H=>Fa(H.placement)===E?H.overflows[0]>0:!0)))return{data:{index:ee,overflows:D},reset:{placement:ne}};let F=(G=D.filter(z=>z.overflows[0]<=0).sort((z,H)=>z.overflows[1]-H.overflows[1])[0])==null?void 0:G.placement;if(!F)switch(v){case"bestFit":{var V;const z=(V=D.filter(H=>{if(N){const Q=Fa(H.placement);return Q===E||Q==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(Q=>Q>0).reduce((Q,ae)=>Q+ae,0)]).sort((H,Q)=>H[1]-Q[1])[0])==null?void 0:V[0];z&&(F=z);break}case"initialPlacement":F=u;break}if(n!==F)return{reset:{placement:F}}}return{}}}};function Ij(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Dj(t){return Dae.some(e=>t[e]>=0)}const Wae=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:a="referenceHidden",...n}=Pi(t,e);switch(a){case"referenceHidden":{const o=await Sd(e,{...n,elementContext:"reference"}),l=Ij(o,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Dj(l)}}}case"escaped":{const o=await Sd(e,{...n,altBoundary:!0}),l=Ij(o,r.floating);return{data:{escapedOffsets:l,escaped:Dj(l)}}}default:return{}}}}},C5=new Set(["left","top"]);async function Yae(t,e){const{placement:r,platform:a,elements:n}=t,o=await(a.isRTL==null?void 0:a.isRTL(n.floating)),l=ji(r),u=Lu(r),c=Fa(r)==="y",f=C5.has(l)?-1:1,p=o&&c?-1:1,h=Pi(e,t);let{mainAxis:g,crossAxis:v,alignmentAxis:w}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return u&&typeof w=="number"&&(v=u==="end"?w*-1:w),c?{x:v*p,y:g*f}:{x:g*f,y:v*p}}const Kae=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,a;const{x:n,y:o,placement:l,middlewareData:u}=e,c=await Yae(e,t);return l===((r=u.offset)==null?void 0:r.placement)&&(a=u.arrow)!=null&&a.alignmentOffset?{}:{x:n+c.x,y:o+c.y,data:{...c,placement:l}}}}},Zae=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:a,placement:n}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:_=>{let{x:y,y:E}=_;return{x:y,y:E}}},...c}=Pi(t,e),f={x:r,y:a},p=await Sd(e,c),h=Fa(ji(n)),g=a1(h);let v=f[g],w=f[h];if(o){const _=g==="y"?"top":"left",y=g==="y"?"bottom":"right",E=v+p[_],x=v-p[y];v=SA(E,v,x)}if(l){const _=h==="y"?"top":"left",y=h==="y"?"bottom":"right",E=w+p[_],x=w-p[y];w=SA(E,w,x)}const b=u.fn({...e,[g]:v,[h]:w});return{...b,data:{x:b.x-r,y:b.y-a,enabled:{[g]:o,[h]:l}}}}}},Xae=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:a,placement:n,rects:o,middlewareData:l}=e,{offset:u=0,mainAxis:c=!0,crossAxis:f=!0}=Pi(t,e),p={x:r,y:a},h=Fa(n),g=a1(h);let v=p[g],w=p[h];const b=Pi(u,e),_=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(c){const x=g==="y"?"height":"width",T=o.reference[g]-o.floating[x]+_.mainAxis,C=o.reference[g]+o.reference[x]-_.mainAxis;v<T?v=T:v>C&&(v=C)}if(f){var y,E;const x=g==="y"?"width":"height",T=C5.has(ji(n)),C=o.reference[h]-o.floating[x]+(T&&((y=l.offset)==null?void 0:y[h])||0)+(T?0:_.crossAxis),N=o.reference[h]+o.reference[x]+(T?0:((E=l.offset)==null?void 0:E[h])||0)-(T?_.crossAxis:0);w<C?w=C:w>N&&(w=N)}return{[g]:v,[h]:w}}}},Qae=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,a;const{placement:n,rects:o,platform:l,elements:u}=e,{apply:c=()=>{},...f}=Pi(t,e),p=await Sd(e,f),h=ji(n),g=Lu(n),v=Fa(n)==="y",{width:w,height:b}=o.floating;let _,y;h==="top"||h==="bottom"?(_=h,y=g===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(y=h,_=g==="end"?"top":"bottom");const E=b-p.top-p.bottom,x=w-p.left-p.right,T=Lo(b-p[_],E),C=Lo(w-p[y],x),N=!e.middlewareData.shift;let O=T,I=C;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(I=x),(a=e.middlewareData.shift)!=null&&a.enabled.y&&(O=E),N&&!g){const D=Bn(p.left,0),$=Bn(p.right,0),G=Bn(p.top,0),V=Bn(p.bottom,0);v?I=w-2*(D!==0||$!==0?D+$:Bn(p.left,p.right)):O=b-2*(G!==0||V!==0?G+V:Bn(p.top,p.bottom))}await c({...e,availableWidth:I,availableHeight:O});const M=await l.getDimensions(u.floating);return w!==M.width||b!==M.height?{reset:{rects:!0}}:{}}}};function Vm(){return typeof window<"u"}function Mu(t){return N5(t)?(t.nodeName||"").toLowerCase():"#document"}function $n(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function ti(t){var e;return(e=(N5(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function N5(t){return Vm()?t instanceof Node||t instanceof $n(t).Node:!1}function xa(t){return Vm()?t instanceof Element||t instanceof $n(t).Element:!1}function Za(t){return Vm()?t instanceof HTMLElement||t instanceof $n(t).HTMLElement:!1}function Lj(t){return!Vm()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof $n(t).ShadowRoot}const Jae=new Set(["inline","contents"]);function Zd(t){const{overflow:e,overflowX:r,overflowY:a,display:n}=Ta(t);return/auto|scroll|overlay|hidden|clip/.test(e+a+r)&&!Jae.has(n)}const eie=new Set(["table","td","th"]);function tie(t){return eie.has(Mu(t))}const rie=[":popover-open",":modal"];function Wm(t){return rie.some(e=>{try{return t.matches(e)}catch{return!1}})}const nie=["transform","translate","scale","rotate","perspective"],aie=["transform","translate","scale","rotate","perspective","filter"],iie=["paint","layout","strict","content"];function s1(t){const e=l1(),r=xa(t)?Ta(t):t;return nie.some(a=>r[a]?r[a]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||aie.some(a=>(r.willChange||"").includes(a))||iie.some(a=>(r.contain||"").includes(a))}function oie(t){let e=Mo(t);for(;Za(e)&&!mu(e);){if(s1(e))return e;if(Wm(e))return null;e=Mo(e)}return null}function l1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const sie=new Set(["html","body","#document"]);function mu(t){return sie.has(Mu(t))}function Ta(t){return $n(t).getComputedStyle(t)}function Ym(t){return xa(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Mo(t){if(Mu(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lj(t)&&t.host||ti(t);return Lj(e)?e.host:e}function k5(t){const e=Mo(t);return mu(e)?t.ownerDocument?t.ownerDocument.body:t.body:Za(e)&&Zd(e)?e:k5(e)}function wd(t,e,r){var a;e===void 0&&(e=[]),r===void 0&&(r=!0);const n=k5(t),o=n===((a=t.ownerDocument)==null?void 0:a.body),l=$n(n);if(o){const u=_A(l);return e.concat(l,l.visualViewport||[],Zd(n)?n:[],u&&r?wd(u):[])}return e.concat(n,wd(n,[],r))}function _A(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function O5(t){const e=Ta(t);let r=parseFloat(e.width)||0,a=parseFloat(e.height)||0;const n=Za(t),o=n?t.offsetWidth:r,l=n?t.offsetHeight:a,u=mm(r)!==o||mm(a)!==l;return u&&(r=o,a=l),{width:r,height:a,$:u}}function u1(t){return xa(t)?t:t.contextElement}function Yl(t){const e=u1(t);if(!Za(e))return qa(1);const r=e.getBoundingClientRect(),{width:a,height:n,$:o}=O5(e);let l=(o?mm(r.width):r.width)/a,u=(o?mm(r.height):r.height)/n;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const lie=qa(0);function I5(t){const e=$n(t);return!l1()||!e.visualViewport?lie:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function uie(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==$n(t)?!1:e}function ks(t,e,r,a){e===void 0&&(e=!1),r===void 0&&(r=!1);const n=t.getBoundingClientRect(),o=u1(t);let l=qa(1);e&&(a?xa(a)&&(l=Yl(a)):l=Yl(t));const u=uie(o,r,a)?I5(o):qa(0);let c=(n.left+u.x)/l.x,f=(n.top+u.y)/l.y,p=n.width/l.x,h=n.height/l.y;if(o){const g=$n(o),v=a&&xa(a)?$n(a):a;let w=g,b=_A(w);for(;b&&a&&v!==w;){const _=Yl(b),y=b.getBoundingClientRect(),E=Ta(b),x=y.left+(b.clientLeft+parseFloat(E.paddingLeft))*_.x,T=y.top+(b.clientTop+parseFloat(E.paddingTop))*_.y;c*=_.x,f*=_.y,p*=_.x,h*=_.y,c+=x,f+=T,w=$n(b),b=_A(w)}}return vm({width:p,height:h,x:c,y:f})}function Km(t,e){const r=Ym(t).scrollLeft;return e?e.left+r:ks(ti(t)).left+r}function D5(t,e){const r=t.getBoundingClientRect(),a=r.left+e.scrollLeft-Km(t,r),n=r.top+e.scrollTop;return{x:a,y:n}}function cie(t){let{elements:e,rect:r,offsetParent:a,strategy:n}=t;const o=n==="fixed",l=ti(a),u=e?Wm(e.floating):!1;if(a===l||u&&o)return r;let c={scrollLeft:0,scrollTop:0},f=qa(1);const p=qa(0),h=Za(a);if((h||!h&&!o)&&((Mu(a)!=="body"||Zd(l))&&(c=Ym(a)),Za(a))){const v=ks(a);f=Yl(a),p.x=v.x+a.clientLeft,p.y=v.y+a.clientTop}const g=l&&!h&&!o?D5(l,c):qa(0);return{width:r.width*f.x,height:r.height*f.y,x:r.x*f.x-c.scrollLeft*f.x+p.x+g.x,y:r.y*f.y-c.scrollTop*f.y+p.y+g.y}}function die(t){return Array.from(t.getClientRects())}function fie(t){const e=ti(t),r=Ym(t),a=t.ownerDocument.body,n=Bn(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),o=Bn(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let l=-r.scrollLeft+Km(t);const u=-r.scrollTop;return Ta(a).direction==="rtl"&&(l+=Bn(e.clientWidth,a.clientWidth)-n),{width:n,height:o,x:l,y:u}}const Mj=25;function pie(t,e){const r=$n(t),a=ti(t),n=r.visualViewport;let o=a.clientWidth,l=a.clientHeight,u=0,c=0;if(n){o=n.width,l=n.height;const p=l1();(!p||p&&e==="fixed")&&(u=n.offsetLeft,c=n.offsetTop)}const f=Km(a);if(f<=0){const p=a.ownerDocument,h=p.body,g=getComputedStyle(h),v=p.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,w=Math.abs(a.clientWidth-h.clientWidth-v);w<=Mj&&(o-=w)}else f<=Mj&&(o+=f);return{width:o,height:l,x:u,y:c}}const hie=new Set(["absolute","fixed"]);function mie(t,e){const r=ks(t,!0,e==="fixed"),a=r.top+t.clientTop,n=r.left+t.clientLeft,o=Za(t)?Yl(t):qa(1),l=t.clientWidth*o.x,u=t.clientHeight*o.y,c=n*o.x,f=a*o.y;return{width:l,height:u,x:c,y:f}}function Pj(t,e,r){let a;if(e==="viewport")a=pie(t,r);else if(e==="document")a=fie(ti(t));else if(xa(e))a=mie(e,r);else{const n=I5(t);a={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return vm(a)}function L5(t,e){const r=Mo(t);return r===e||!xa(r)||mu(r)?!1:Ta(r).position==="fixed"||L5(r,e)}function gie(t,e){const r=e.get(t);if(r)return r;let a=wd(t,[],!1).filter(u=>xa(u)&&Mu(u)!=="body"),n=null;const o=Ta(t).position==="fixed";let l=o?Mo(t):t;for(;xa(l)&&!mu(l);){const u=Ta(l),c=s1(l);!c&&u.position==="fixed"&&(n=null),(o?!c&&!n:!c&&u.position==="static"&&!!n&&hie.has(n.position)||Zd(l)&&!c&&L5(t,l))?a=a.filter(p=>p!==l):n=u,l=Mo(l)}return e.set(t,a),a}function vie(t){let{element:e,boundary:r,rootBoundary:a,strategy:n}=t;const l=[...r==="clippingAncestors"?Wm(e)?[]:gie(e,this._c):[].concat(r),a],u=l[0],c=l.reduce((f,p)=>{const h=Pj(e,p,n);return f.top=Bn(h.top,f.top),f.right=Lo(h.right,f.right),f.bottom=Lo(h.bottom,f.bottom),f.left=Bn(h.left,f.left),f},Pj(e,u,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function yie(t){const{width:e,height:r}=O5(t);return{width:e,height:r}}function bie(t,e,r){const a=Za(e),n=ti(e),o=r==="fixed",l=ks(t,!0,o,e);let u={scrollLeft:0,scrollTop:0};const c=qa(0);function f(){c.x=Km(n)}if(a||!a&&!o)if((Mu(e)!=="body"||Zd(n))&&(u=Ym(e)),a){const v=ks(e,!0,o,e);c.x=v.x+e.clientLeft,c.y=v.y+e.clientTop}else n&&f();o&&!a&&n&&f();const p=n&&!a&&!o?D5(n,u):qa(0),h=l.left+u.scrollLeft-c.x-p.x,g=l.top+u.scrollTop-c.y-p.y;return{x:h,y:g,width:l.width,height:l.height}}function lS(t){return Ta(t).position==="static"}function jj(t,e){if(!Za(t)||Ta(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return ti(t)===r&&(r=r.ownerDocument.body),r}function M5(t,e){const r=$n(t);if(Wm(t))return r;if(!Za(t)){let n=Mo(t);for(;n&&!mu(n);){if(xa(n)&&!lS(n))return n;n=Mo(n)}return r}let a=jj(t,e);for(;a&&tie(a)&&lS(a);)a=jj(a,e);return a&&mu(a)&&lS(a)&&!s1(a)?r:a||oie(t)||r}const Eie=async function(t){const e=this.getOffsetParent||M5,r=this.getDimensions,a=await r(t.floating);return{reference:bie(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function Sie(t){return Ta(t).direction==="rtl"}const wie={convertOffsetParentRelativeRectToViewportRelativeRect:cie,getDocumentElement:ti,getClippingRect:vie,getOffsetParent:M5,getElementRects:Eie,getClientRects:die,getDimensions:yie,getScale:Yl,isElement:xa,isRTL:Sie};function P5(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function _ie(t,e){let r=null,a;const n=ti(t);function o(){var u;clearTimeout(a),(u=r)==null||u.disconnect(),r=null}function l(u,c){u===void 0&&(u=!1),c===void 0&&(c=1),o();const f=t.getBoundingClientRect(),{left:p,top:h,width:g,height:v}=f;if(u||e(),!g||!v)return;const w=sh(h),b=sh(n.clientWidth-(p+g)),_=sh(n.clientHeight-(h+v)),y=sh(p),x={rootMargin:-w+"px "+-b+"px "+-_+"px "+-y+"px",threshold:Bn(0,Lo(1,c))||1};let T=!0;function C(N){const O=N[0].intersectionRatio;if(O!==c){if(!T)return l();O?l(!1,O):a=setTimeout(()=>{l(!1,1e-7)},1e3)}O===1&&!P5(f,t.getBoundingClientRect())&&l(),T=!1}try{r=new IntersectionObserver(C,{...x,root:n.ownerDocument})}catch{r=new IntersectionObserver(C,x)}r.observe(t)}return l(!0),o}function xie(t,e,r,a){a===void 0&&(a={});const{ancestorScroll:n=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:c=!1}=a,f=u1(t),p=n||o?[...f?wd(f):[],...wd(e)]:[];p.forEach(y=>{n&&y.addEventListener("scroll",r,{passive:!0}),o&&y.addEventListener("resize",r)});const h=f&&u?_ie(f,r):null;let g=-1,v=null;l&&(v=new ResizeObserver(y=>{let[E]=y;E&&E.target===f&&v&&(v.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var x;(x=v)==null||x.observe(e)})),r()}),f&&!c&&v.observe(f),v.observe(e));let w,b=c?ks(t):null;c&&_();function _(){const y=ks(t);b&&!P5(b,y)&&r(),b=y,w=requestAnimationFrame(_)}return r(),()=>{var y;p.forEach(E=>{n&&E.removeEventListener("scroll",r),o&&E.removeEventListener("resize",r)}),h?.(),(y=v)==null||y.disconnect(),v=null,c&&cancelAnimationFrame(w)}}const Tie=Kae,Rie=Zae,Aie=Vae,Cie=Qae,Nie=Wae,Uj=Gae,kie=Xae,Oie=(t,e,r)=>{const a=new Map,n={platform:wie,...r},o={...n.platform,_c:a};return Hae(t,e,{...n,platform:o})};var Iie=typeof document<"u",Die=function(){},Nh=Iie?R.useLayoutEffect:Die;function ym(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,a,n;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(a=r;a--!==0;)if(!ym(t[a],e[a]))return!1;return!0}if(n=Object.keys(t),r=n.length,r!==Object.keys(e).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(e,n[a]))return!1;for(a=r;a--!==0;){const o=n[a];if(!(o==="_owner"&&t.$$typeof)&&!ym(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function j5(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Fj(t,e){const r=j5(t);return Math.round(e*r)/r}function uS(t){const e=R.useRef(t);return Nh(()=>{e.current=t}),e}function Lie(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:a=[],platform:n,elements:{reference:o,floating:l}={},transform:u=!0,whileElementsMounted:c,open:f}=t,[p,h]=R.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[g,v]=R.useState(a);ym(g,a)||v(a);const[w,b]=R.useState(null),[_,y]=R.useState(null),E=R.useCallback(H=>{H!==N.current&&(N.current=H,b(H))},[]),x=R.useCallback(H=>{H!==O.current&&(O.current=H,y(H))},[]),T=o||w,C=l||_,N=R.useRef(null),O=R.useRef(null),I=R.useRef(p),M=c!=null,D=uS(c),$=uS(n),G=uS(f),V=R.useCallback(()=>{if(!N.current||!O.current)return;const H={placement:e,strategy:r,middleware:g};$.current&&(H.platform=$.current),Oie(N.current,O.current,H).then(Q=>{const ae={...Q,isPositioned:G.current!==!1};ee.current&&!ym(I.current,ae)&&(I.current=ae,ku.flushSync(()=>{h(ae)}))})},[g,e,r,$,G]);Nh(()=>{f===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,h(H=>({...H,isPositioned:!1})))},[f]);const ee=R.useRef(!1);Nh(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Nh(()=>{if(T&&(N.current=T),C&&(O.current=C),T&&C){if(D.current)return D.current(T,C,V);V()}},[T,C,V,D,M]);const ne=R.useMemo(()=>({reference:N,floating:O,setReference:E,setFloating:x}),[E,x]),F=R.useMemo(()=>({reference:T,floating:C}),[T,C]),z=R.useMemo(()=>{const H={position:r,left:0,top:0};if(!F.floating)return H;const Q=Fj(F.floating,p.x),ae=Fj(F.floating,p.y);return u?{...H,transform:"translate("+Q+"px, "+ae+"px)",...j5(F.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:Q,top:ae}},[r,u,F.floating,p.x,p.y]);return R.useMemo(()=>({...p,update:V,refs:ne,elements:F,floatingStyles:z}),[p,V,ne,F,z])}const Mie=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:a,padding:n}=typeof t=="function"?t(r):t;return a&&e(a)?a.current!=null?Uj({element:a.current,padding:n}).fn(r):{}:a?Uj({element:a,padding:n}).fn(r):{}}}},Pie=(t,e)=>({...Tie(t),options:[t,e]}),jie=(t,e)=>({...Rie(t),options:[t,e]}),Uie=(t,e)=>({...kie(t),options:[t,e]}),Fie=(t,e)=>({...Aie(t),options:[t,e]}),Bie=(t,e)=>({...Cie(t),options:[t,e]}),$ie=(t,e)=>({...Nie(t),options:[t,e]}),zie=(t,e)=>({...Mie(t),options:[t,e]});var qie="Arrow",U5=R.forwardRef((t,e)=>{const{children:r,width:a=10,height:n=5,...o}=t;return S.jsx(ft.svg,{...o,ref:e,width:a,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:S.jsx("polygon",{points:"0,0 30,0 15,10"})})});U5.displayName=qie;var Hie=U5,c1="Popper",[F5,Fo]=ei(c1),[Gie,B5]=F5(c1),$5=t=>{const{__scopePopper:e,children:r}=t,[a,n]=R.useState(null);return S.jsx(Gie,{scope:e,anchor:a,onAnchorChange:n,children:r})};$5.displayName=c1;var z5="PopperAnchor",q5=R.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:a,...n}=t,o=B5(z5,r),l=R.useRef(null),u=Ut(e,l),c=R.useRef(null);return R.useEffect(()=>{const f=c.current;c.current=a?.current||l.current,f!==c.current&&o.onAnchorChange(c.current)}),a?null:S.jsx(ft.div,{...n,ref:u})});q5.displayName=z5;var d1="PopperContent",[Vie,Wie]=F5(d1),H5=R.forwardRef((t,e)=>{const{__scopePopper:r,side:a="bottom",sideOffset:n=0,align:o="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:c=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:w,...b}=t,_=B5(d1,r),[y,E]=R.useState(null),x=Ut(e,U=>E(U)),[T,C]=R.useState(null),N=y5(T),O=N?.width??0,I=N?.height??0,M=a+(o!=="center"?"-"+o:""),D=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},$=Array.isArray(f)?f:[f],G=$.length>0,V={padding:D,boundary:$.filter(Kie),altBoundary:G},{refs:ee,floatingStyles:ne,placement:F,isPositioned:z,middlewareData:H}=Lie({strategy:"fixed",placement:M,whileElementsMounted:(...U)=>xie(...U,{animationFrame:v==="always"}),elements:{reference:_.anchor},middleware:[Pie({mainAxis:n+I,alignmentAxis:l}),c&&jie({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Uie():void 0,...V}),c&&Fie({...V}),Bie({...V,apply:({elements:U,rects:X,availableWidth:le,availableHeight:oe})=>{const{width:q,height:Z}=X.reference,fe=U.floating.style;fe.setProperty("--radix-popper-available-width",`${le}px`),fe.setProperty("--radix-popper-available-height",`${oe}px`),fe.setProperty("--radix-popper-anchor-width",`${q}px`),fe.setProperty("--radix-popper-anchor-height",`${Z}px`)}}),T&&zie({element:T,padding:u}),Zie({arrowWidth:O,arrowHeight:I}),g&&$ie({strategy:"referenceHidden",...V})]}),[Q,ae]=W5(F),W=Ka(w);sn(()=>{z&&W?.()},[z,W]);const Y=H.arrow?.x,K=H.arrow?.y,te=H.arrow?.centerOffset!==0,[ie,P]=R.useState();return sn(()=>{y&&P(window.getComputedStyle(y).zIndex)},[y]),S.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...ne,transform:z?ne.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:S.jsx(Vie,{scope:r,placedSide:Q,onArrowChange:C,arrowX:Y,arrowY:K,shouldHideArrow:te,children:S.jsx(ft.div,{"data-side":Q,"data-align":ae,...b,ref:x,style:{...b.style,animation:z?void 0:"none"}})})})});H5.displayName=d1;var G5="PopperArrow",Yie={top:"bottom",right:"left",bottom:"top",left:"right"},V5=R.forwardRef(function(e,r){const{__scopePopper:a,...n}=e,o=Wie(G5,a),l=Yie[o.placedSide];return S.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:S.jsx(Hie,{...n,ref:r,style:{...n.style,display:"block"}})})});V5.displayName=G5;function Kie(t){return t!==null}var Zie=t=>({name:"transformOrigin",options:t,fn(e){const{placement:r,rects:a,middlewareData:n}=e,l=n.arrow?.centerOffset!==0,u=l?0:t.arrowWidth,c=l?0:t.arrowHeight,[f,p]=W5(r),h={start:"0%",center:"50%",end:"100%"}[p],g=(n.arrow?.x??0)+u/2,v=(n.arrow?.y??0)+c/2;let w="",b="";return f==="bottom"?(w=l?h:`${g}px`,b=`${-c}px`):f==="top"?(w=l?h:`${g}px`,b=`${a.floating.height+c}px`):f==="right"?(w=`${-c}px`,b=l?h:`${v}px`):f==="left"&&(w=`${a.floating.width+c}px`,b=l?h:`${v}px`),{data:{x:w,y:b}}}});function W5(t){const[e,r="center"]=t.split("-");return[e,r]}var Zm=$5,Xd=q5,Xm=H5,Qm=V5,Xie="Portal",Pu=R.forwardRef((t,e)=>{const{container:r,...a}=t,[n,o]=R.useState(!1);sn(()=>o(!0),[]);const l=r||n&&globalThis?.document?.body;return l?GH.createPortal(S.jsx(ft.div,{...a,ref:e}),l):null});Pu.displayName=Xie;function Qie(t,e){return R.useReducer((r,a)=>e[r][a]??r,t)}var ca=t=>{const{present:e,children:r}=t,a=Jie(e),n=typeof r=="function"?r({present:a.isPresent}):R.Children.only(r),o=Ut(a.ref,eoe(n));return typeof r=="function"||a.isPresent?R.cloneElement(n,{ref:o}):null};ca.displayName="Presence";function Jie(t){const[e,r]=R.useState(),a=R.useRef(null),n=R.useRef(t),o=R.useRef("none"),l=t?"mounted":"unmounted",[u,c]=Qie(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const f=lh(a.current);o.current=u==="mounted"?f:"none"},[u]),sn(()=>{const f=a.current,p=n.current;if(p!==t){const g=o.current,v=lh(f);t?c("MOUNT"):v==="none"||f?.display==="none"?c("UNMOUNT"):c(p&&g!==v?"ANIMATION_OUT":"UNMOUNT"),n.current=t}},[t,c]),sn(()=>{if(e){let f;const p=e.ownerDocument.defaultView??window,h=v=>{const b=lh(a.current).includes(CSS.escape(v.animationName));if(v.target===e&&b&&(c("ANIMATION_END"),!n.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",f=p.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},g=v=>{v.target===e&&(o.current=lh(a.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{p.clearTimeout(f),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:R.useCallback(f=>{a.current=f?getComputedStyle(f):null,r(f)},[])}}function lh(t){return t?.animationName||"none"}function eoe(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Y5=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"}),toe="VisuallyHidden",K5=R.forwardRef((t,e)=>S.jsx(ft.span,{...t,ref:e,style:{...Y5,...t.style}}));K5.displayName=toe;var roe=K5,[Jm]=ei("Tooltip",[Fo]),eg=Fo(),Z5="TooltipProvider",noe=700,xA="tooltip.open",[aoe,f1]=Jm(Z5),X5=t=>{const{__scopeTooltip:e,delayDuration:r=noe,skipDelayDuration:a=300,disableHoverableContent:n=!1,children:o}=t,l=R.useRef(!0),u=R.useRef(!1),c=R.useRef(0);return R.useEffect(()=>{const f=c.current;return()=>window.clearTimeout(f)},[]),S.jsx(aoe,{scope:e,isOpenDelayedRef:l,delayDuration:r,onOpen:R.useCallback(()=>{window.clearTimeout(c.current),l.current=!1},[]),onClose:R.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>l.current=!0,a)},[a]),isPointerInTransitRef:u,onPointerInTransitChange:R.useCallback(f=>{u.current=f},[]),disableHoverableContent:n,children:o})};X5.displayName=Z5;var _d="Tooltip",[ioe,Qd]=Jm(_d),Q5=t=>{const{__scopeTooltip:e,children:r,open:a,defaultOpen:n,onOpenChange:o,disableHoverableContent:l,delayDuration:u}=t,c=f1(_d,t.__scopeTooltip),f=eg(e),[p,h]=R.useState(null),g=Xr(),v=R.useRef(0),w=l??c.disableHoverableContent,b=u??c.delayDuration,_=R.useRef(!1),[y,E]=Do({prop:a,defaultProp:n??!1,onChange:O=>{O?(c.onOpen(),document.dispatchEvent(new CustomEvent(xA))):c.onClose(),o?.(O)},caller:_d}),x=R.useMemo(()=>y?_.current?"delayed-open":"instant-open":"closed",[y]),T=R.useCallback(()=>{window.clearTimeout(v.current),v.current=0,_.current=!1,E(!0)},[E]),C=R.useCallback(()=>{window.clearTimeout(v.current),v.current=0,E(!1)},[E]),N=R.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{_.current=!0,E(!0),v.current=0},b)},[b,E]);return R.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),S.jsx(Zm,{...f,children:S.jsx(ioe,{scope:e,contentId:g,open:y,stateAttribute:x,trigger:p,onTriggerChange:h,onTriggerEnter:R.useCallback(()=>{c.isOpenDelayedRef.current?N():T()},[c.isOpenDelayedRef,N,T]),onTriggerLeave:R.useCallback(()=>{w?C():(window.clearTimeout(v.current),v.current=0)},[C,w]),onOpen:T,onClose:C,disableHoverableContent:w,children:r})})};Q5.displayName=_d;var TA="TooltipTrigger",J5=R.forwardRef((t,e)=>{const{__scopeTooltip:r,...a}=t,n=Qd(TA,r),o=f1(TA,r),l=eg(r),u=R.useRef(null),c=Ut(e,u,n.onTriggerChange),f=R.useRef(!1),p=R.useRef(!1),h=R.useCallback(()=>f.current=!1,[]);return R.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),S.jsx(Xd,{asChild:!0,...l,children:S.jsx(ft.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...a,ref:c,onPointerMove:Ze(t.onPointerMove,g=>{g.pointerType!=="touch"&&!p.current&&!o.isPointerInTransitRef.current&&(n.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ze(t.onPointerLeave,()=>{n.onTriggerLeave(),p.current=!1}),onPointerDown:Ze(t.onPointerDown,()=>{n.open&&n.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ze(t.onFocus,()=>{f.current||n.onOpen()}),onBlur:Ze(t.onBlur,n.onClose),onClick:Ze(t.onClick,n.onClose)})})});J5.displayName=TA;var p1="TooltipPortal",[ooe,soe]=Jm(p1,{forceMount:void 0}),eG=t=>{const{__scopeTooltip:e,forceMount:r,children:a,container:n}=t,o=Qd(p1,e);return S.jsx(ooe,{scope:e,forceMount:r,children:S.jsx(ca,{present:r||o.open,children:S.jsx(Pu,{asChild:!0,container:n,children:a})})})};eG.displayName=p1;var gu="TooltipContent",tG=R.forwardRef((t,e)=>{const r=soe(gu,t.__scopeTooltip),{forceMount:a=r.forceMount,side:n="top",...o}=t,l=Qd(gu,t.__scopeTooltip);return S.jsx(ca,{present:a||l.open,children:l.disableHoverableContent?S.jsx(rG,{side:n,...o,ref:e}):S.jsx(loe,{side:n,...o,ref:e})})}),loe=R.forwardRef((t,e)=>{const r=Qd(gu,t.__scopeTooltip),a=f1(gu,t.__scopeTooltip),n=R.useRef(null),o=Ut(e,n),[l,u]=R.useState(null),{trigger:c,onClose:f}=r,p=n.current,{onPointerInTransitChange:h}=a,g=R.useCallback(()=>{u(null),h(!1)},[h]),v=R.useCallback((w,b)=>{const _=w.currentTarget,y={x:w.clientX,y:w.clientY},E=foe(y,_.getBoundingClientRect()),x=poe(y,E),T=hoe(b.getBoundingClientRect()),C=goe([...x,...T]);u(C),h(!0)},[h]);return R.useEffect(()=>()=>g(),[g]),R.useEffect(()=>{if(c&&p){const w=_=>v(_,p),b=_=>v(_,c);return c.addEventListener("pointerleave",w),p.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",w),p.removeEventListener("pointerleave",b)}}},[c,p,v,g]),R.useEffect(()=>{if(l){const w=b=>{const _=b.target,y={x:b.clientX,y:b.clientY},E=c?.contains(_)||p?.contains(_),x=!moe(y,l);E?g():x&&(g(),f())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[c,p,l,f,g]),S.jsx(rG,{...t,ref:o})}),[uoe,coe]=Jm(_d,{isInside:!1}),doe=xne("TooltipContent"),rG=R.forwardRef((t,e)=>{const{__scopeTooltip:r,children:a,"aria-label":n,onEscapeKeyDown:o,onPointerDownOutside:l,...u}=t,c=Qd(gu,r),f=eg(r),{onClose:p}=c;return R.useEffect(()=>(document.addEventListener(xA,p),()=>document.removeEventListener(xA,p)),[p]),R.useEffect(()=>{if(c.trigger){const h=g=>{g.target?.contains(c.trigger)&&p()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,p]),S.jsx(Du,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:h=>h.preventDefault(),onDismiss:p,children:S.jsxs(Xm,{"data-state":c.stateAttribute,...f,...u,ref:e,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[S.jsx(doe,{children:a}),S.jsx(uoe,{scope:r,isInside:!0,children:S.jsx(roe,{id:c.contentId,role:"tooltip",children:n||a})})]})})});tG.displayName=gu;var nG="TooltipArrow",aG=R.forwardRef((t,e)=>{const{__scopeTooltip:r,...a}=t,n=eg(r);return coe(nG,r).isInside?null:S.jsx(Qm,{...n,...a,ref:e})});aG.displayName=nG;function foe(t,e){const r=Math.abs(e.top-t.y),a=Math.abs(e.bottom-t.y),n=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(r,a,n,o)){case o:return"left";case n:return"right";case r:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function poe(t,e,r=5){const a=[];switch(e){case"top":a.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":a.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":a.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":a.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return a}function hoe(t){const{top:e,right:r,bottom:a,left:n}=t;return[{x:n,y:e},{x:r,y:e},{x:r,y:a},{x:n,y:a}]}function moe(t,e){const{x:r,y:a}=t;let n=!1;for(let o=0,l=e.length-1;o<e.length;l=o++){const u=e[o],c=e[l],f=u.x,p=u.y,h=c.x,g=c.y;p>a!=g>a&&r<(h-f)*(a-p)/(g-p)+f&&(n=!n)}return n}function goe(t){const e=t.slice();return e.sort((r,a)=>r.x<a.x?-1:r.x>a.x?1:r.y<a.y?-1:r.y>a.y?1:0),voe(e)}function voe(t){if(t.length<=1)return t.slice();const e=[];for(let a=0;a<t.length;a++){const n=t[a];for(;e.length>=2;){const o=e[e.length-1],l=e[e.length-2];if((o.x-l.x)*(n.y-l.y)>=(o.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const r=[];for(let a=t.length-1;a>=0;a--){const n=t[a];for(;r.length>=2;){const o=r[r.length-1],l=r[r.length-2];if((o.x-l.x)*(n.y-l.y)>=(o.y-l.y)*(n.x-l.x))r.pop();else break}r.push(n)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var yoe=X5,boe=Q5,Eoe=J5,Soe=eG,woe=tG,_oe=aG;function iG({delayDuration:t=0,...e}){return S.jsx(yoe,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function rn({...t}){return S.jsx(iG,{children:S.jsx(boe,{"data-slot":"tooltip",...t})})}function nn({...t}){return S.jsx(Eoe,{"data-slot":"tooltip-trigger",...t})}function an({className:t,sideOffset:e=0,children:r,...a}){return S.jsx(Soe,{children:S.jsxs(woe,{"data-slot":"tooltip-content",sideOffset:e,className:Ve("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...a,children:[r,S.jsx(_oe,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class xoe{name="mcp_inspector_open";properties;constructor(e){this.properties={server_url:e.serverUrl,connection_count:e.connectionCount}}}class Bj{name="mcp_tool_execution";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId,success:e.success,duration:e.duration,error:e.error}}}class $j{name="mcp_resource_read";properties;constructor(e){this.properties={resource_uri:e.resourceUri,server_id:e.serverId,success:e.success,error:e.error}}}class zj{name="mcp_prompt_call";properties;constructor(e){this.properties={prompt_name:e.promptName,server_id:e.serverId,success:e.success,error:e.error}}}class qj{name="mcp_chat_message";properties;constructor(e){this.properties={server_id:e.serverId,provider:e.provider,model:e.model,message_count:e.messageCount,tool_calls_count:e.toolCallsCount,success:e.success,execution_mode:e.executionMode,duration:e.duration,error:e.error}}}class Toe{name="mcp_server_added";properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,connection_type:e.connectionType,via_proxy:e.viaProxy}}}class Roe{name="mcp_server_removed";properties;constructor(e){this.properties={server_id:e.serverId}}}class Aoe{name="mcp_command_palette_open";properties;constructor(e){this.properties={trigger:e.trigger}}}class Coe{name="mcp_tool_saved";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId}}}function cS(){try{return"0.4.12-canary.0"}catch{return"0.0.0"}}var Noe={};function dS(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class Hj{endpoint;timeout;constructor(e,r=3e3){this.endpoint=e,this.timeout=r}async logEvent(e){try{const r=new AbortController,a=setTimeout(()=>r.abort(),this.timeout),n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:r.signal});if(clearTimeout(a),!n.ok)throw new Error(`HTTP error! status: ${n.status}`)}catch{}}}function go(t){return`mcp_inspector_telemetry_${t}`}class Br{static instance=null;POSTHOG_PROXY_URL="/inspector/api/tel/posthog";SCARF_PROXY_URL="/inspector/api/tel/scarf";UNKNOWN_USER_ID="UNKNOWN_USER_ID";_currUserId=null;_posthogClient=null;_scarfClient=null;_source="inspector";constructor(){const e=dS(),r=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||"inspector",r)this._posthogClient=null,this._scarfClient=null;else if(!e)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new Hj(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new Hj(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(go("disabled"))==="true"||typeof process<"u"&&Noe?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(go("source")):null}static getInstance(){return Br.instance||(Br.instance=new Br),Br.instance}setSource(e){this._source=e,typeof localStorage<"u"&&localStorage.setItem(go("source"),e)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!dS())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const e=localStorage.getItem(go("user_id"));if(e)this._currUserId=e;else{const r=this.generateUserId();localStorage.setItem(go("user_id"),r),this._currUserId=r}this.trackPackageDownload({triggered_by:"user_id_property"}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}async capture(e){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{const r={event:e.name,user_id:this.userId,properties:{...e.properties,mcp_use_version:cS(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(r)}catch{}if(this._scarfClient)try{const r={};r.mcp_use_version=cS(),r.user_id=this.userId,r.event=e.name,r.language="typescript",r.source=this._source,r.package="inspector",await this._scarfClient.logEvent(r)}catch{}}}async trackPackageDownload(e){if(this._scarfClient&&dS())try{const r=cS();let a=!1,n=!1;const o=localStorage.getItem(go("download_version"));if(o?r>o&&(a=!0,n=!1,localStorage.setItem(go("download_version"),r)):(a=!0,n=!0,localStorage.setItem(go("download_version"),r)),a){const l={...e||{}};l.mcp_use_version=r,l.user_id=this.userId,l.event="package_download",l.first_download=n,l.language="typescript",l.source=this._source,l.package="inspector",await this._scarfClient.logEvent(l)}}catch{}}async trackInspectorOpen(e){const r=new xoe(e);await this.capture(r)}}const oG=R.createContext(void 0);function koe({url:t,name:e,proxyConfig:r,transportType:a,onUpdate:n,onRemove:o}){const l=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let u=t,c={};if(r?.proxyAddress){const g=new URL(r.proxyAddress),v=new URL(t);u=`${g.origin}${g.pathname}${v.pathname}${v.search}`,c["X-Target-URL"]=t}r?.customHeaders&&(c={...c,...r.customHeaders});const f=GC({url:u,callbackUrl:l,customHeaders:Object.keys(c).length>0?c:void 0,transportType:a||"http"}),p=R.useRef(n),h=R.useRef(null);return R.useEffect(()=>{p.current=n},[n]),R.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{const g={id:t,url:t,name:e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,customHeaders:c,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage,client:f.client},v=h.current;(!v||v.state!==g.state||v.error!==g.error||v.authUrl!==g.authUrl||v.tools.length!==g.tools.length||v.resources.length!==g.resources.length||v.prompts.length!==g.prompts.length||!v.client)&&(h.current=g,p.current(g))});else{const g={id:t,url:t,name:e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,customHeaders:c,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage,client:f.client},v=h.current;(!v||v.state!==g.state||v.error!==g.error||v.authUrl!==g.authUrl||v.tools.length!==g.tools.length||v.resources.length!==g.resources.length||v.prompts.length!==g.prompts.length||!v.client)&&(h.current=g,p.current(g))}},[t,e,f.state,f.tools,f.resources,f.prompts,f.error,f.authUrl,f.client]),null}function Ooe({children:t}){const[e,r]=R.useState([]),[a,n]=R.useState(new Map),[o,l]=R.useState(0),[u,c]=R.useState(!0),[f,p]=R.useState(new Set);R.useEffect(()=>{const T=localStorage.getItem("mcp-inspector-connections");if(T)try{const N=JSON.parse(T),O=Array.isArray(N)?N.filter(M=>M&&typeof M=="object"&&typeof M.id=="string"&&typeof M.url=="string"&&typeof M.name=="string").map(M=>(M.transportType||(M.transportType="http"),M)):[];(O.length!==N.length||O.some(M=>M.transportType==="http"&&!N.find(D=>D.id===M.id&&D.transportType)))&&(console.warn("Updated connections in localStorage with transport type migration"),localStorage.setItem("mcp-inspector-connections",JSON.stringify(O))),r(O)}catch(N){console.error("Failed to parse saved connections:",N),localStorage.removeItem("mcp-inspector-connections")}const C=localStorage.getItem("mcp-inspector-auto-connect");C!==null&&c(C==="true")},[]);const h=R.useCallback(T=>{n(C=>new Map(C).set(T.id,T)),l(C=>C+1)},[]),g=R.useCallback((T,C,N,O)=>{const M={id:T,url:T,name:C||T,proxyConfig:N,transportType:O||"http"};r(D=>{if(D.some(G=>G.id===T))return D;const $=[...D,M];return localStorage.setItem("mcp-inspector-connections",JSON.stringify($)),$})},[]),v=R.useCallback(T=>{Br.getInstance().capture(new Roe({serverId:T})).catch(()=>{}),r(N=>{const O=N.filter(I=>I.id!==T);return localStorage.setItem("mcp-inspector-connections",JSON.stringify(O)),O}),n(N=>{const O=new Map(N),I=O.get(T);if(I){try{I.clearStorage()}catch(M){console.error("Failed to clear storage:",M)}O.delete(T)}return O})},[]),w=R.useCallback(T=>{const C=a.get(T);if(C)return C;const N=e.find(O=>O.id===T);if(N)return{id:N.id,url:N.url,name:N.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,listPrompts:async O=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},client:null}},[a,e]),b=R.useCallback(T=>{c(T),localStorage.setItem("mcp-inspector-auto-connect",String(T)),T||p(new Set)},[]),_=R.useCallback(T=>{p(C=>new Set(C).add(T))},[]),y=R.useCallback(T=>{p(C=>{const N=new Set(C);return N.delete(T),N}),n(C=>{const N=new Map(C),O=N.get(T);if(O){try{O.clearStorage()}catch(I){console.error("Failed to clear storage:",I)}N.delete(T)}return N})},[]),E=R.useMemo(()=>e.map(C=>{const N=a.get(C.id);return N||{id:C.id,url:C.url,name:C.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},listPrompts:async O=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},client:null}}),[a,e,o]),x=R.useMemo(()=>({connections:E,addConnection:g,removeConnection:v,getConnection:w,autoConnect:u,setAutoConnect:b,connectServer:_,disconnectServer:y}),[E,g,v,w,u,b,_,y]);return S.jsxs(oG,{value:x,children:[e.filter(T=>u||f.has(T.id)).map(T=>S.jsx(koe,{url:T.url,name:T.name,proxyConfig:T.proxyConfig,transportType:T.transportType,onUpdate:h,onRemove:()=>v(T.id)},T.id)),t]})}function h1(){const t=R.use(oG);if(!t)throw new Error("useMcpContext must be used within McpProvider");return t}var fS="focusScope.autoFocusOnMount",pS="focusScope.autoFocusOnUnmount",Gj={bubbles:!1,cancelable:!0},Ioe="FocusScope",Jd=R.forwardRef((t,e)=>{const{loop:r=!1,trapped:a=!1,onMountAutoFocus:n,onUnmountAutoFocus:o,...l}=t,[u,c]=R.useState(null),f=Ka(n),p=Ka(o),h=R.useRef(null),g=Ut(e,b=>c(b)),v=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(a){let b=function(x){if(v.paused||!u)return;const T=x.target;u.contains(T)?h.current=T:bo(h.current,{select:!0})},_=function(x){if(v.paused||!u)return;const T=x.relatedTarget;T!==null&&(u.contains(T)||bo(h.current,{select:!0}))},y=function(x){if(document.activeElement===document.body)for(const C of x)C.removedNodes.length>0&&bo(u)};document.addEventListener("focusin",b),document.addEventListener("focusout",_);const E=new MutationObserver(y);return u&&E.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",_),E.disconnect()}}},[a,u,v.paused]),R.useEffect(()=>{if(u){Wj.add(v);const b=document.activeElement;if(!u.contains(b)){const y=new CustomEvent(fS,Gj);u.addEventListener(fS,f),u.dispatchEvent(y),y.defaultPrevented||(Doe(Uoe(sG(u)),{select:!0}),document.activeElement===b&&bo(u))}return()=>{u.removeEventListener(fS,f),setTimeout(()=>{const y=new CustomEvent(pS,Gj);u.addEventListener(pS,p),u.dispatchEvent(y),y.defaultPrevented||bo(b??document.body,{select:!0}),u.removeEventListener(pS,p),Wj.remove(v)},0)}}},[u,f,p,v]);const w=R.useCallback(b=>{if(!r&&!a||v.paused)return;const _=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,y=document.activeElement;if(_&&y){const E=b.currentTarget,[x,T]=Loe(E);x&&T?!b.shiftKey&&y===T?(b.preventDefault(),r&&bo(x,{select:!0})):b.shiftKey&&y===x&&(b.preventDefault(),r&&bo(T,{select:!0})):y===E&&b.preventDefault()}},[r,a,v.paused]);return S.jsx(ft.div,{tabIndex:-1,...l,ref:g,onKeyDown:w})});Jd.displayName=Ioe;function Doe(t,{select:e=!1}={}){const r=document.activeElement;for(const a of t)if(bo(a,{select:e}),document.activeElement!==r)return}function Loe(t){const e=sG(t),r=Vj(e,t),a=Vj(e.reverse(),t);return[r,a]}function sG(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const n=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||n?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function Vj(t,e){for(const r of t)if(!Moe(r,{upTo:e}))return r}function Moe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Poe(t){return t instanceof HTMLInputElement&&"select"in t}function bo(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Poe(t)&&e&&t.select()}}var Wj=joe();function joe(){let t=[];return{add(e){const r=t[0];e!==r&&r?.pause(),t=Yj(t,e),t.unshift(e)},remove(e){t=Yj(t,e),t[0]?.resume()}}}function Yj(t,e){const r=[...t],a=r.indexOf(e);return a!==-1&&r.splice(a,1),r}function Uoe(t){return t.filter(e=>e.tagName!=="A")}var hS=0;function tg(){R.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Kj()),document.body.insertAdjacentElement("beforeend",t[1]??Kj()),hS++,()=>{hS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),hS--}},[])}function Kj(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Ua=function(){return Ua=Object.assign||function(e){for(var r,a=1,n=arguments.length;a<n;a++){r=arguments[a];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},Ua.apply(this,arguments)};function lG(t,e){var r={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(r[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)e.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(r[a[n]]=t[a[n]]);return r}function Foe(t,e,r){if(r||arguments.length===2)for(var a=0,n=e.length,o;a<n;a++)(o||!(a in e))&&(o||(o=Array.prototype.slice.call(e,0,a)),o[a]=e[a]);return t.concat(o||Array.prototype.slice.call(e))}var kh="right-scroll-bar-position",Oh="width-before-scroll-bar",Boe="with-scroll-bars-hidden",$oe="--removed-body-scroll-bar-size";function mS(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function zoe(t,e){var r=R.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(a){var n=r.value;n!==a&&(r.value=a,r.callback(a,n))}}}})[0];return r.callback=e,r.facade}var qoe=typeof window<"u"?R.useLayoutEffect:R.useEffect,Zj=new WeakMap;function Hoe(t,e){var r=zoe(null,function(a){return t.forEach(function(n){return mS(n,a)})});return qoe(function(){var a=Zj.get(r);if(a){var n=new Set(a),o=new Set(t),l=r.current;n.forEach(function(u){o.has(u)||mS(u,null)}),o.forEach(function(u){n.has(u)||mS(u,l)})}Zj.set(r,t)},[t]),r}function Goe(t){return t}function Voe(t,e){e===void 0&&(e=Goe);var r=[],a=!1,n={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(o){var l=e(o,a);return r.push(l),function(){r=r.filter(function(u){return u!==l})}},assignSyncMedium:function(o){for(a=!0;r.length;){var l=r;r=[],l.forEach(o)}r={push:function(u){return o(u)},filter:function(){return r}}},assignMedium:function(o){a=!0;var l=[];if(r.length){var u=r;r=[],u.forEach(o),l=r}var c=function(){var p=l;l=[],p.forEach(o)},f=function(){return Promise.resolve().then(c)};f(),r={push:function(p){l.push(p),f()},filter:function(p){return l=l.filter(p),r}}}};return n}function Woe(t){t===void 0&&(t={});var e=Voe(null);return e.options=Ua({async:!0,ssr:!1},t),e}var uG=function(t){var e=t.sideCar,r=lG(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=e.read();if(!a)throw new Error("Sidecar medium not found");return R.createElement(a,Ua({},r))};uG.isSideCarExport=!0;function Yoe(t,e){return t.useMedium(e),uG}var cG=Woe(),gS=function(){},rg=R.forwardRef(function(t,e){var r=R.useRef(null),a=R.useState({onScrollCapture:gS,onWheelCapture:gS,onTouchMoveCapture:gS}),n=a[0],o=a[1],l=t.forwardProps,u=t.children,c=t.className,f=t.removeScrollBar,p=t.enabled,h=t.shards,g=t.sideCar,v=t.noRelative,w=t.noIsolation,b=t.inert,_=t.allowPinchZoom,y=t.as,E=y===void 0?"div":y,x=t.gapMode,T=lG(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,N=Hoe([r,e]),O=Ua(Ua({},T),n);return R.createElement(R.Fragment,null,p&&R.createElement(C,{sideCar:cG,removeScrollBar:f,shards:h,noRelative:v,noIsolation:w,inert:b,setCallbacks:o,allowPinchZoom:!!_,lockRef:r,gapMode:x}),l?R.cloneElement(R.Children.only(u),Ua(Ua({},O),{ref:N})):R.createElement(E,Ua({},O,{className:c,ref:N}),u))});rg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};rg.classNames={fullWidth:Oh,zeroRight:kh};var Koe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Zoe(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Koe();return e&&t.setAttribute("nonce",e),t}function Xoe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Qoe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Joe=function(){var t=0,e=null;return{add:function(r){t==0&&(e=Zoe())&&(Xoe(e,r),Qoe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},ese=function(){var t=Joe();return function(e,r){R.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},dG=function(){var t=ese(),e=function(r){var a=r.styles,n=r.dynamic;return t(a,n),null};return e},tse={left:0,top:0,right:0,gap:0},vS=function(t){return parseInt(t||"",10)||0},rse=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],a=e[t==="padding"?"paddingTop":"marginTop"],n=e[t==="padding"?"paddingRight":"marginRight"];return[vS(r),vS(a),vS(n)]},nse=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return tse;var e=rse(t),r=document.documentElement.clientWidth,a=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,a-r+e[2]-e[0])}},ase=dG(),Kl="data-scroll-locked",ise=function(t,e,r,a){var n=t.left,o=t.top,l=t.right,u=t.gap;return r===void 0&&(r="margin"),`
356
356
  .`.concat(Boe,` {
357
357
  overflow: hidden `).concat(a,`;
358
358
  padding-right: `).concat(u,"px ").concat(a,`;
@@ -1758,7 +1758,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1758
1758
  <\/script>
1759
1759
  </body>
1760
1760
  </html>`,L9=1,Nq=2,M9=3,kq=4,P9=5,Oq=Symbol.for("quilt.threads.serialize"),Ewe=Symbol.for("quilt.threads.transferable");class Swe extends AbortController{constructor(...e){super();const r=e.find(a=>a.aborted);if(r)this.abort(r.reason);else{const a=o=>this.abort(o.target.reason),n={signal:this.signal};for(const o of e)o.addEventListener("abort",a,n)}}}class Iq extends Error{constructor(){super("You attempted to call a function on a closed thread.")}}let wwe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function j9(t=21){let e="",r=crypto.getRandomValues(new Uint8Array(t));for(let a=0;a<t;a++)e+=wwe[63&r[a]];return e}var Yc,Dl,Kc,Wh,oC,U9;class _we{constructor(){Ea(this,oC),Ea(this,Yc,new Map),Ea(this,Dl,new Map),Ea(this,Kc,new Map),Ea(this,Wh,new WeakMap)}get(e){return ur(this,Dl).get(e)}release(e){const r=ur(this,Dl).get(e);return r&&(ur(this,Dl).delete(e),ur(this,Yc).delete(r)),!!r}serialize(e){let r=ur(this,Yc).get(e);return r==null&&(r=j9(),ur(this,Yc).set(e,r),ur(this,Dl).set(r,e)),r}deserialize(e,r){var a,n;let o=(a=ur(this,Kc).get(e))==null?void 0:a.deref();return o||(o=(...l)=>{if(!ur(this,Kc).has(e))throw new Error("You attempted to call a function that was already revoked.");return r.call((u,c,f)=>{r.messages.send([M9,u,e,c],f)},l)},(n=Zr(this,oC,U9).call(this,r))==null||n.register(o,e),ur(this,Kc).set(e,new WeakRef(o)),o)}}Yc=new WeakMap,Dl=new WeakMap,Kc=new WeakMap,Wh=new WeakMap,oC=new WeakSet,U9=function(t){let e=ur(this,Wh).get(t);if(!(typeof FinalizationRegistry>"u"))return e||(e=new FinalizationRegistry(r=>{t.messages.send([P9,r])}),ur(this,Wh).set(t,e)),e};function xwe(t){return t!=null&&(Symbol.asyncIterator in t||Symbol.iterator in t)&&typeof t.next=="function"}function Dq(t){if(t==null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e==null||e===Object.prototype}const AR="_@f",Lq="_@i";var dd,fd,na,Yh,So;class Twe{constructor(e){Ea(this,na),Ea(this,dd),Ea(this,fd),aC(this,dd,e?.serialize),aC(this,fd,e?.deserialize)}serialize(e,r,a){return Zr(this,na,Yh).call(this,e,r,a)}deserialize(e,r){return Zr(this,na,So).call(this,e,r)}}dd=new WeakMap,fd=new WeakMap,na=new WeakSet,Yh=function(t,e,r,a=new Map,n=!1){if(t==null)return t;if(a.has(t))return a.get(t);if(a.set(t,void 0),typeof t=="object"){if(ur(this,dd)&&!n){const u=ur(this,dd).call(this,t,c=>Zr(this,na,Yh).call(this,c,e,r,a,!0),e,r);if(u!==void 0)return a.set(t,u),u}if(t[Ewe])return r?.push(t),a.set(t,t),t;const o=u=>Zr(this,na,Yh).call(this,u,e,r,a);if(typeof t[Oq]=="function"){const u=t[Oq]({serialize:o});return a.set(t,u),u}if(Array.isArray(t)){const u=t.map(c=>o(c));return a.set(t,u),u}if(t instanceof Map){const u=[...t.entries()].map(([f,p])=>[o(f),o(p)]),c=new Map(u);return a.set(t,c),c}if(t instanceof Set){const u=[...t].map(f=>o(f)),c=new Set(u);return a.set(t,c),c}const l=xwe(t);if(Dq(t)||l){const u={};for(const c of Object.keys(t))u[c]=o(t[c]);return l&&(u.next??(u.next=o(t.next.bind(t))),u.return??(u.return=o(t.return.bind(t))),u.throw??(u.throw=o(t.throw.bind(t))),u[Lq]=!0),a.set(t,u),u}}if(typeof t=="function"){const o=e.functions.serialize(t,e,r),l={[AR]:o};return a.set(t,l),l}return a.set(t,t),t},So=function(t,e,r=!1){if(t==null)return t;if(typeof t=="object"){if(ur(this,fd)&&!r){const n=ur(this,fd).call(this,t,o=>Zr(this,na,So).call(this,o,e,!0),e);if(n!==void 0)return n}if(t==null)return t;if(Array.isArray(t))return t.map(n=>Zr(this,na,So).call(this,n,e));if(t instanceof Map)return new Map([...t].map(([n,o])=>[Zr(this,na,So).call(this,n,e),Zr(this,na,So).call(this,o,e)]));if(t instanceof Set)return new Set([...t].map(n=>Zr(this,na,So).call(this,n,e)));if(AR in t)return e.functions.deserialize(t[AR],e);if(!Dq(t))return t;const a={};for(const n of Object.keys(t))n===Lq?a[Symbol.asyncIterator]=()=>a:a[n]=Zr(this,na,So).call(this,t[n],e);return a}return t};var Ll,Es,wo,sC,F9,lC,B9;class Rwe{constructor(e,{imports:r,exports:a,functions:n=new _we,serialization:o=new Twe,signal:l}={}){Ea(this,wo),Ea(this,Ll),Ea(this,Es,new Map);var u,c,f,p;this.messages=e,aC(this,Ll,l?new Swe(l):new AbortController),this.exports=a??{},this.imports=Awe(Zr(this,wo,F9).bind(this),r),this.functions=n,this.serialization=o,(c=(u=this.functions).start)==null||c.call(u,this),(p=(f=this.serialization).start)==null||p.call(f,this),this.signal.addEventListener("abort",()=>{for(const h of ur(this,Es).keys())Zr(this,wo,lC).call(this,h,void 0,new Iq);ur(this,Es).clear()},{once:!0}),e.listen(async h=>{if(!(Array.isArray(h)&&typeof h[0]=="number"))return;const g=h;switch(g[0]){case L9:{const[,v,w,b]=g,_=this.exports[w]??(()=>{throw new Error(`No '${w}' method is exported from this thread`)});await Zr(this,wo,sC).call(this,_,b,(y,E,x)=>{this.messages.send([Nq,v,y,E],x)});break}case M9:{const[,v,w,b]=g,_=this.functions.get(w,this)??Cwe;await Zr(this,wo,sC).call(this,_,b,(y,E,x)=>{this.messages.send([kq,v,y,E],x)});break}case Nq:case kq:{Zr(this,wo,lC).call(this,...g.slice(1));break}case P9:{const v=g[1];this.functions.release(v,this);break}}},{signal:this.signal})}get signal(){return ur(this,Ll).signal}get closed(){return ur(this,Ll).signal.aborted}close(){ur(this,Ll).abort()}call(e,r){if(this.closed)return Promise.reject(new Iq);const a=[],n=this.serialization.serialize(r,this,a),o=j9(),l=Zr(this,wo,B9).call(this,o);return e(o,n,a),l}}Ll=new WeakMap,Es=new WeakMap,wo=new WeakSet,sC=async function(t,e,r){try{const a=this.functions.call?await this.functions.call(t,e,this):await t(...this.serialization.deserialize(e,this)),n=[],o=this.serialization.serialize(a,this,n);r(o,void 0,n)}catch(a){r(void 0,this.serialization.serialize(a,this))}},F9=function(t){return(...e)=>{try{if(typeof t!="string"&&typeof t!="number")throw new Error(`Can’t call a symbol method on a thread: ${t.toString()}`);return this.call((r,a,n)=>{this.messages.send([L9,r,t,a],n)},e)}catch(r){return Promise.reject(r)}}},lC=function(...t){const e=t[0],r=ur(this,Es).get(e);r&&(r(...t),ur(this,Es).delete(e))},B9=function(t){const e=new Promise((r,a)=>{ur(this,Es).set(t,(n,o,l)=>{l==null?r(this.serialization.deserialize(o,this)):a(this.serialization.deserialize(l,this))})});return Object.defineProperty(e,Symbol.asyncIterator,{async*value(){const r=await e;Object.defineProperty(r,Symbol.asyncIterator,{value:()=>r}),yield*r}}),e};function Awe(t,e){let r;if(e==null){if(typeof Proxy!="function")throw new Error("You must pass an array of callable methods in environments without Proxies.");const a=new Map;r=new Proxy({},{get(n,o){if(a.has(o))return a.get(o);const l=t(o);return a.set(o,l),l}})}else{r={};for(const a of e)Object.defineProperty(r,a,{value:t(a),writable:!1,configurable:!0,enumerable:!0})}return r}function Cwe(){throw new Error("You attempted to call a function that is not stored. It may have already been released.")}const Nwe="quilt.threads.ping",Mq="quilt.threads.pong";function kwe(t,{targetOrigin:e="*"}={}){let r=!1;const a=function(o,l){t.postMessage(o,e,l)},n=new Promise(o=>{const l=new AbortController;globalThis.window.addEventListener("message",u=>{u.source===t&&u.data===Mq&&(r=!0,l.abort(),o())},{signal:l.signal}),l.signal.addEventListener("abort",()=>o(),{once:!0}),a(Nwe)});return{send(o,l){return r?a(o,l):n.then(()=>{if(r)return a(o,l)})},listen(o,{signal:l}){self.addEventListener("message",u=>{u.source===t&&u.data!==Mq&&o(u.data)},{signal:l})}}}class Owe extends Rwe{constructor(e,{targetOrigin:r="*",...a}={}){super(kwe(e.contentWindow,{targetOrigin:r}),a),this.iframe=e}}const $9=je.forwardRef(({content:t,children:e,...r},a)=>S.jsx("span",{ref:a,...r,children:t||e}));$9.displayName="UIText";const z9=je.forwardRef(({label:t,onPress:e,onClick:r,children:a,...n},o)=>S.jsx("button",{ref:o,onClick:l=>{e&&e(),r&&r(l)},style:{padding:"8px 16px",backgroundColor:"#007bff",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},...n,children:t||a}));z9.displayName="UIButton";const q9=je.forwardRef(({direction:t="vertical",spacing:e="8",align:r="stretch",justify:a="flex-start",children:n,...o},l)=>S.jsx("div",{ref:l,style:{display:"flex",flexDirection:t==="horizontal"?"row":"column",gap:`${e}px`,alignItems:r,justifyContent:a},...o,children:n}));q9.displayName="UIStack";const H9=je.forwardRef(({src:t,alt:e,width:r,height:a,children:n,...o},l)=>S.jsx("img",{ref:l,src:t,alt:e,width:r,height:a,style:{maxWidth:"100%",height:"auto",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)"},...o}));H9.displayName="UIImage";const TN={name:"basic",elements:[{tagName:"ui-text",component:$9,propMapping:{content:"content"},eventMapping:{}},{tagName:"ui-button",component:z9,propMapping:{label:"label"},eventMapping:{press:"onPress"}},{tagName:"ui-stack",component:q9,propMapping:{direction:"direction",spacing:"spacing",align:"align",justify:"justify"},eventMapping:{}},{tagName:"ui-image",component:H9,propMapping:{src:"src",alt:"alt",width:"width",height:"height"},eventMapping:{}}]},Iwe=({receiver:t})=>{const e=R.useRef(null);return R.useEffect(()=>{if(e.current)return t.connect(e.current),()=>{t.disconnect()}},[t]),S.jsx("div",{ref:e,"data-testid":"standard-dom-renderer-container"})},Dwe=({resource:t,library:e,remoteElements:r=[],onUIAction:a})=>{const n=R.useRef(null),o=R.useRef(null),[l,u]=R.useState(null),c=R.useMemo(()=>(t.mimeType||"").includes("framework=react")?"react":"webcomponents",[t.mimeType]),f=`${e?.name}-${c}`,{receiver:p,components:h}=R.useMemo(()=>{switch(c){case"react":{const v=new cwe,w=e||TN,b=new Map;return w&&w.elements.forEach(_=>{const y=gwe(_.component);b.set(_.tagName,y)}),{receiver:v,components:b}}case"webcomponents":default:return{receiver:new dwe,components:null}}},[t,e,r]);R.useEffect(()=>{function v(w){var b;if(n.current&&w.source===n.current.contentWindow){const _=w.data;if(!_)return;(b=a?.(_))==null||b.catch(y=>{console.error("Error handling UI action result in RemoteDOMResourceRenderer:",y)})}}return window.addEventListener("message",v),()=>window.removeEventListener("message",v)},[a]),R.useEffect(()=>{const v=o.current;return o.current=null,()=>{v?.close()}},[f]);const g=()=>{const v=n.current;if(!v||o.current)return;const w=new Owe(v);o.current=w;const{code:b,error:_}=twe(t);if(_){u(_);return}if(b&&p!=null&&p.connection){const y={code:b,remoteElements:r,useReactRenderer:c==="react",componentLibrary:e?.name};w.imports.render(y,p.connection).catch(E=>console.error("Error calling remote render:",E))}};return l?S.jsx("p",{className:"text-red-500",children:l}):S.jsxs(S.Fragment,{children:[S.jsx("iframe",{ref:n,srcDoc:bwe,sandbox:"allow-scripts",style:{display:"none"},title:"Remote DOM Sandbox",onLoad:g},f),c==="react"&&h?S.jsx(ywe,{receiver:p,components:h}):S.jsx(Iwe,{receiver:p})]})};function Lwe(t){var e;if(t.contentType)return t.contentType;if(t.mimeType==="text/html")return"rawHtml";if(t.mimeType==="text/uri-list")return"externalUrl";if((e=t.mimeType)!=null&&e.startsWith("application/vnd.mcp-ui.remote-dom"))return"remoteDom"}const RN=t=>{const{resource:e,onUIAction:r,supportedContentTypes:a,htmlProps:n,remoteDomProps:o}=t,l=Lwe(e);if(a&&l&&!a.includes(l))return S.jsxs("p",{className:"text-red-500",children:["Unsupported content type: ",l,"."]});switch(l){case"rawHtml":case"externalUrl":return S.jsx(C9,{resource:e,onUIAction:r,...n});case"remoteDom":return S.jsx(Dwe,{resource:e,onUIAction:r,library:o?.library||TN,...o});default:return S.jsx("p",{className:"text-red-500",children:"Unsupported resource type."})}};RN.displayName="UIResourceRenderer";const Mwe={tagName:"ui-button",remoteAttributes:["label"],remoteEvents:["click","press"]},Pwe={tagName:"ui-text",remoteAttributes:["content"]},jwe={tagName:"ui-stack",remoteAttributes:["direction","spacing","align","justify"]},Uwe={tagName:"ui-image",remoteAttributes:["src","alt","width","height"]},Fwe=R.memo(({resource:t})=>{const e=async r=>(r.type==="tool"||r.type==="prompt"||(r.type==="link"?r.payload.url&&window.open(r.payload.url,"_blank"):r.type==="intent"||r.type),{status:"Action received"});return t.uri?.startsWith("ui://")?S.jsx("div",{className:"my-4 p-0 border h-[350px] rounded-2xl border-zinc-200 overflow-hidden bg-card",children:S.jsx(RN,{resource:t,onUIAction:e,htmlProps:{style:{maxWidth:"100%",height:"100%",overflow:"auto"},autoResizeIframe:!0,sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"}})}):null});function Pq({toolName:t,toolArgs:e,result:r,serverId:a,readResource:n}){const[o,l]=R.useState(null),u=R.useMemo(()=>{if(typeof r=="string")try{return JSON.parse(r)}catch(h){return console.error("[ToolResultRenderer] Failed to parse result:",h),r}return r},[r]),c=R.useMemo(()=>!!(u?.content&&Array.isArray(u.content)&&u.content.some(h=>h.type==="resource"&&h.resource?.uri?.startsWith("ui://")&&h.resource?.mimeType==="text/html+skybridge")),[u]),f=R.useMemo(()=>c&&u.content.find(g=>g.type==="resource"&&g.resource?.uri?.startsWith("ui://")&&g.resource?.mimeType==="text/html+skybridge")?.resource||null,[c,u]);if(R.useEffect(()=>{(()=>{f&&l(f)})()},[f]),c&&o&&a&&n)return S.jsx(EN,{componentUrl:o.uri,toolName:t,toolArgs:e,toolResult:u,serverId:a,readResource:n,noWrapper:!0,className:"my-4"});if(c&&!o)return S.jsx("div",{className:"my-4 p-4 bg-blue-50/30 dark:bg-blue-950/20 border border-blue-200/50 dark:border-blue-800/50 rounded-lg",children:S.jsx("p",{className:"text-sm text-blue-600 dark:text-blue-400",children:"Loading component..."})});const p=[];if(u?.content&&Array.isArray(u.content))for(const h of u.content)h.type==="resource"&&h.resource?.uri?.startsWith("ui://")&&h.resource?.mimeType!=="text/html+skybridge"&&p.push(h.resource);return p.length>0?S.jsx(S.Fragment,{children:p.map(h=>S.jsx(Fwe,{resource:h},`${t}-mcp-ui-${h.uri}`))}):null}function Bwe({content:t,timestamp:e}){return!t||t.length===0?null:S.jsx("div",{className:"flex items-start gap-3 justify-end group/user-message",children:S.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-end",children:[S.jsx("div",{className:"bg-zinc-200 dark:bg-zinc-800 text-primary rounded-3xl px-4 py-2 max-w-[80%] break-words",children:S.jsx("p",{className:"text-base leading-7 font-sans text-start break-words",children:t})}),e&&S.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:new Date(e).toLocaleTimeString()})]})})}const $we=R.memo(({messages:t,isLoading:e,serverId:r,readResource:a})=>{const n=R.useRef(null);R.useEffect(()=>{t.length>0&&n.current&&n.current.scrollIntoView({behavior:e?"auto":"smooth",block:"start"})},[t.length,e]);const o=e&&(()=>{if(t.length===0)return!0;const u=t[t.length-1];if(u.role==="user")return!0;if(u.role==="assistant"){const c=typeof u.content=="string"?u.content:Array.isArray(u.content)?u.content.map(p=>typeof p=="string"?p:p.text||JSON.stringify(p)).join(""):JSON.stringify(u.content);return!(c&&c.trim().length>0)}return!1})(),l=u=>{if(!e)return!1;const c=t[t.length-1];return u.id===c.id&&c.role==="assistant"};return S.jsxs("div",{className:"space-y-6 max-w-3xl mx-auto px-2",children:[t.map(u=>{const c=typeof u.content=="string"?u.content:Array.isArray(u.content)?u.content.map(f=>typeof f=="string"?f:f.text||JSON.stringify(f)).join(""):JSON.stringify(u.content);return u.role==="user"?S.jsx(Bwe,{content:c,timestamp:u.timestamp},u.id):u.role==="assistant"?S.jsx("div",{className:"space-y-4",children:u.parts&&u.parts.length>0?u.parts.map((f,p)=>{const h=f.type==="text"?`${u.id}-text-${p}-${f.text?.slice(0,20)}`:`${u.id}-tool-${f.toolInvocation?.toolName}-${p}`;return f.type==="text"?S.jsx(Sq,{content:f.text||"",timestamp:p===u.parts.length-1?u.timestamp:void 0,_isStreaming:l(u)},h):f.type==="tool-invocation"&&f.toolInvocation?S.jsxs("div",{children:[S.jsx(wq,{toolName:f.toolInvocation.toolName,args:f.toolInvocation.args,result:f.toolInvocation.result,state:f.toolInvocation.result?"result":"call"}),f.toolInvocation.result&&S.jsx(Pq,{toolName:f.toolInvocation.toolName,toolArgs:f.toolInvocation.args,result:f.toolInvocation.result,serverId:r,readResource:a})]},h):null}):S.jsxs(S.Fragment,{children:[S.jsx(Sq,{content:c,timestamp:u.timestamp,_isStreaming:l(u)}),u.toolCalls&&u.toolCalls.length>0&&S.jsx("div",{className:"space-y-2",children:u.toolCalls.map(f=>{const p=`${u.id}-${f.toolName}-${JSON.stringify(f.args).slice(0,50)}`;return S.jsxs("div",{children:[S.jsx(wq,{toolName:f.toolName,args:f.args,result:f.result,state:f.result?"result":"call"}),f.result&&S.jsx(Pq,{toolName:f.toolName,toolArgs:f.args,result:f.result,serverId:r,readResource:a})]},p)})})]})},u.id):null}),o&&S.jsx("div",{className:"flex items-start gap-3",children:S.jsx("div",{className:"flex-1",children:S.jsx("div",{className:"rounded-lg p-4 max-w-fit",children:S.jsx("div",{className:"flex items-center gap-2",children:S.jsx("span",{className:"text-sm",children:S.jsx(Vpe,{duration:2,spread:1,children:"Thinking..."})})})})})}),S.jsx("div",{ref:n})]})});function G9(t){let e=0;for(let r=0;r<t.length;r++){const a=t.charCodeAt(r);e=(e<<5)-e+a,e=e&e}return Math.abs(e).toString(16)}function zwe({mcpServerUrl:t,llmConfig:e,authConfig:r,isConnected:a}){const[n,o]=R.useState([]),[l,u]=R.useState(!1),c=R.useCallback(async p=>{if(!p.trim()||!e||!a)return;const h={id:`user-${Date.now()}`,role:"user",content:p.trim(),timestamp:Date.now()};o(g=>[...g,h]),u(!0);try{let g=r;if(r?.type==="oauth")try{const T="mcp:auth",C=G9(t),N=`${T}_${C}_tokens`,O=localStorage.getItem(N);if(O){const I=JSON.parse(O);g={...r,oauthTokens:I}}else console.warn("No OAuth tokens found in localStorage for key:",N)}catch(T){console.warn("Failed to retrieve OAuth tokens:",T)}const v=await fetch("/inspector/api/chat/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mcpServerUrl:t,llmConfig:e,authConfig:g,messages:[...n,h].map(T=>({role:T.role,content:T.content}))})});if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);const w=`assistant-${Date.now()}`;let b="";const _=[];o(T=>[...T,{id:w,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]);const y=v.body?.getReader(),E=new TextDecoder;if(!y)throw new Error("No response body");let x="";for(;;){const{done:T,value:C}=await y.read();if(T)break;x+=E.decode(C,{stream:!0});const N=x.split(`
1761
- `);x=N.pop()||"";for(const O of N)if(O.trim()&&O.startsWith("data: "))try{const I=JSON.parse(O.slice(6));if(console.log("[Client received event]",I.type,I.toolName||I.content?.slice?.(0,30)),I.type==="message")console.log("[Message started]",I.id);else if(I.type==="text"){b+=I.content;const M=_[_.length-1];M&&M.type==="text"?M.text=b:_.push({type:"text",text:b}),console.log("[Parts after text]",_.length,"parts, text length:",b.length),o(D=>D.map($=>$.id===w?{...$,parts:[..._]}:$))}else if(I.type==="tool-call")b&&(b=""),_.push({type:"tool-invocation",toolInvocation:{toolName:I.toolName,args:I.args,state:"pending"}}),console.log("[Parts after tool-call]",_.length,"parts, tool:",I.toolName),o(M=>M.map(D=>D.id===w?{...D,parts:[..._]}:D));else if(I.type==="tool-result"){const M=_.find(D=>D.type==="tool-invocation"&&D.toolInvocation?.toolName===I.toolName&&!D.toolInvocation?.result);M&&M.toolInvocation?(M.toolInvocation.result=I.result,M.toolInvocation.state="result",console.log("[Parts after tool-result]",_.length,"parts, updated:",I.toolName),o(D=>D.map($=>$.id===w?{...$,parts:[..._]}:$))):console.warn("[tool-result] Could not find matching tool part for",I.toolName)}else if(I.type==="done")console.log("[Done] Final parts:",_.length),o(M=>M.map(D=>D.id===w?{...D,parts:[..._],content:""}:D));else if(I.type==="error")throw new Error(I.message||"Streaming error")}catch(I){console.error("Failed to parse streaming event:",I,O)}}}catch(g){let v="Unknown error occurred";if(g instanceof Error){v=g.message;const b=g;b.status&&(v=`HTTP ${b.status}: ${v}`),(b.code===401||v.includes("401")||v.includes("Unauthorized"))&&(v="Authentication failed (401). Check your Authorization header in the connection settings.")}const w={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${v}`,timestamp:Date.now()};o(b=>[...b,w])}finally{u(!1)}},[e,a,t,n,r]),f=R.useCallback(()=>{o([])},[]);return{messages:n,isLoading:l,sendMessage:c,clearMessages:f}}function qwe({connection:t,llmConfig:e,isConnected:r,readResource:a}){const[n,o]=R.useState([]),[l,u]=R.useState(!1),c=R.useRef(null),f=R.useRef(null),p=R.useRef(null),h=R.useCallback(async v=>{if(!v.trim()||!e||!r)return;const w={id:`user-${Date.now()}`,role:"user",content:v.trim(),timestamp:Date.now()};o(y=>[...y,w]),u(!0),c.current=new AbortController;const b=Date.now();let _=0;try{const y=`assistant-${Date.now()}`;let E="";const x=[];if(o(T=>[...T,{id:y,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]),!p.current||p.current.provider!==e.provider||p.current.model!==e.model||p.current.apiKey!==e.apiKey){let T;if(e.provider==="openai"){const{ChatOpenAI:C}=await Pl(async()=>{const{ChatOpenAI:N}=await import("./index-ByN-8efJ.js");return{ChatOpenAI:N}},__vite__mapDeps([0,1,2,3]));T=new C({model:e.model,apiKey:e.apiKey,temperature:e.temperature??.7})}else if(e.provider==="anthropic"){const{ChatAnthropic:C}=await Pl(async()=>{const{ChatAnthropic:N}=await import("./index-D56cgcLQ.js");return{ChatAnthropic:N}},__vite__mapDeps([4,1,2]));T=new C({model:e.model,apiKey:e.apiKey,temperature:e.temperature??.7})}else if(e.provider==="google"){const{ChatGoogleGenerativeAI:C}=await Pl(async()=>{const{ChatGoogleGenerativeAI:N}=await import("./index-CLrmeqJ5.js");return{ChatGoogleGenerativeAI:N}},__vite__mapDeps([5,1,2,3]));T=new C({model:e.model,apiKey:e.apiKey,temperature:e.temperature??.7})}else throw new Error(`Unsupported LLM provider: ${e.provider}`);p.current={instance:T,provider:e.provider,model:e.model,apiKey:e.apiKey}}if(!f.current||f.current.llm!==p.current.instance){const{MCPAgent:T}=await Pl(async()=>{const{MCPAgent:C}=await import("./langfuse-LCJ6VJEP-B8zS6koH.js").then(N=>N.c);return{MCPAgent:C}},__vite__mapDeps([6,2]));f.current=new T({llm:p.current.instance,client:t.client,memoryEnabled:!0,systemPrompt:"You are a helpful assistant with access to MCP tools, prompts, and resources. Help users interact with the MCP server."}),await f.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",f.current.conversationHistory?.length);for await(const T of f.current.streamEvents(v,10,!1,void 0)){if(c.current?.signal.aborted)break;if(T.event==="on_chat_model_stream"&&T.data?.chunk?.text){const C=T.data.chunk.text;if(typeof C=="string"&&C.length>0){E+=C;const N=x[x.length-1];N&&N.type==="text"?N.text=E:x.push({type:"text",text:E}),o(O=>O.map(I=>I.id===y?{...I,parts:[...x]}:I))}}else if(T.event==="on_tool_start"){E&&(E="");let C={};T.data?.input?C=T.data.input:T.data?.tool_input?C=T.data.tool_input:T.data&&(C=T.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:T.name,eventData:T.data,extractedArgs:C}),_++,x.push({type:"tool-invocation",toolInvocation:{toolName:T.name||"unknown",args:C,state:"pending"}}),o(N=>N.map(O=>O.id===y?{...O,parts:[...x]}:O))}else if(T.event==="on_tool_end"){const C=x.find(N=>N.type==="tool-invocation"&&N.toolInvocation?.toolName===T.name&&!N.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:T.name,hasToolPart:!!C,output:T.data?.output}),C&&C.toolInvocation){let N=T.data?.output;if(N?.kwargs?.content&&typeof N.kwargs.content=="string")try{N=JSON.parse(N.kwargs.content)}catch(I){console.warn("[useChatMessagesClientSide] Failed to parse kwargs.content:",I),N=N.kwargs.content}else if(N?.content&&typeof N.content=="string")try{N=JSON.parse(N.content)}catch{N=N.content}C.toolInvocation.result=N,C.toolInvocation.state="result";const O=N?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:T.name,hasMeta:!!N?._meta,hasStructuredContent:!!N?.structuredContent,appsSdkUri:O}),O&&typeof O=="string"&&a){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",O);try{const I=await a(O);console.log("[useChatMessagesClientSide] Resource fetched:",I);const M=N?.structuredContent||null;if(I?.contents&&Array.isArray(I.contents)){const D=I.contents.map(G=>({type:"resource",resource:G}));console.log("[useChatMessagesClientSide] Created MCP resources:",D);const $={...N,content:[...N.content||[],...D],structuredContent:M};C.toolInvocation.result=$,console.log("[useChatMessagesClientSide] Updated result with resources")}else console.warn("[useChatMessagesClientSide] No contents in resourceData:",I)}catch(I){console.error("Failed to fetch Apps SDK resource:",I)}}o(I=>I.map(M=>M.id===y?{...M,parts:[...x]}:M))}}}o(T=>T.map(C=>C.id===y?{...C,parts:[...x],content:""}:C)),e&&Br.getInstance().capture(new qj({serverId:t.url,provider:e.provider,model:e.model,messageCount:n.length+1,toolCallsCount:_,success:!0,executionMode:"client-side",duration:Date.now()-b})).catch(()=>{})}catch(y){console.error("Client-side agent error:",y);let E="Unknown error occurred";if(y instanceof Error){E=y.message;const T=y;T.status&&(E=`HTTP ${T.status}: ${E}`),(T.code===401||E.includes("401")||E.includes("Unauthorized"))&&(E="Authentication failed (401). Check your Authorization header in the connection settings.")}e&&Br.getInstance().capture(new qj({serverId:t.url,provider:e.provider,model:e.model,messageCount:n.length+1,toolCallsCount:_,success:!1,executionMode:"client-side",duration:Date.now()-b,error:E})).catch(()=>{});const x={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${E}`,timestamp:Date.now()};o(T=>[...T,x])}finally{u(!1),c.current=null}},[t,e,r,n,a]),g=R.useCallback(()=>{o([]),f.current&&f.current.clearConversationHistory()},[]);return{messages:n,isLoading:l,sendMessage:h,clearMessages:g}}const jq={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function Hwe({mcpServerUrl:t}){const[e,r]=R.useState(null),[a,n]=R.useState(null),[o,l]=R.useState(!1),[u,c]=R.useState("openai"),[f,p]=R.useState(""),[h,g]=R.useState(jq.openai),[v,w]=R.useState("none"),[b,_]=R.useState(""),[y,E]=R.useState(""),[x,T]=R.useState("");R.useEffect(()=>{const O=localStorage.getItem("mcp-inspector-llm-config");if(O)try{const I=JSON.parse(O);r(I),c(I.provider),p(I.apiKey),g(I.model)}catch(I){console.error("Failed to load LLM config:",I)}},[]),R.useEffect(()=>{const O=localStorage.getItem("mcp-inspector-auth-config");if(O)try{const I=JSON.parse(O);n(I),w(I.type),I.username&&_(I.username),I.password&&E(I.password),I.token&&T(I.token)}catch(I){console.error("Failed to load auth config:",I)}else try{const I="mcp:auth",M=G9(t),D=`${I}_${M}_tokens`;localStorage.getItem(D)&&(n({type:"oauth"}),w("oauth"))}catch(I){console.error("Failed to check for OAuth tokens:",I)}},[t]),R.useEffect(()=>{g(jq[u])},[u]);const C=R.useCallback(()=>{if(!f.trim())return;const O={provider:u,apiKey:f,model:h},I={type:v,...v==="basic"&&{username:b.trim(),password:y.trim()},...v==="bearer"&&{token:x.trim()}};r(O),n(I),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(O)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(I)),l(!1)},[u,f,h,v,b,y,x]),N=R.useCallback(()=>{r(null),n(null),p(""),_(""),E(""),T(""),w("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[]);return{llmConfig:e,authConfig:a,configDialogOpen:o,setConfigDialogOpen:l,tempProvider:u,setTempProvider:c,tempApiKey:f,setTempApiKey:p,tempModel:h,setTempModel:g,tempAuthType:v,saveLLMConfig:C,clearConfig:N}}function Gwe({connection:t,isConnected:e,useClientSide:r=!0,readResource:a}){const[n,o]=R.useState(""),l=R.useRef(null),{llmConfig:u,authConfig:c,configDialogOpen:f,setConfigDialogOpen:p,tempProvider:h,setTempProvider:g,tempApiKey:v,setTempApiKey:w,tempModel:b,setTempModel:_,saveLLMConfig:y,clearConfig:E}=Hwe({mcpServerUrl:t.url}),x={connection:t,llmConfig:u,isConnected:e,readResource:a},T=zwe({mcpServerUrl:t.url,llmConfig:u,authConfig:c,isConnected:e}),C=qwe(x),{messages:N,isLoading:O,sendMessage:I,clearMessages:M}=r?C:T;uV({onNewChat:M}),R.useEffect(()=>{u&&N.length===0&&l.current&&l.current.focus()},[u,N.length]),R.useEffect(()=>{!O&&N.length>0&&l.current&&l.current.focus()},[O,N.length]);const D=R.useCallback(()=>{n.trim()&&(I(n),o(""))},[n,I]),$=R.useCallback(V=>{V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),D())},[D]),G=R.useCallback(()=>{E(),M()},[E,M]);return u&&N.length===0?S.jsxs("div",{className:"flex flex-col h-full",children:[S.jsx("div",{className:"absolute top-4 right-4 z-10",children:S.jsx(J6,{open:f,onOpenChange:p,tempProvider:h,tempModel:b,tempApiKey:v,onProviderChange:g,onModelChange:_,onApiKeyChange:w,onSave:y,onClear:G,showClearButton:!0,buttonLabel:"Change API Key"})}),S.jsx(Hpe,{mcpServerUrl:t.url,inputValue:n,isConnected:e,isLoading:O,textareaRef:l,llmConfig:u,onInputChange:o,onKeyDown:$,onSubmit:V=>{V.preventDefault(),D()},onConfigDialogOpenChange:p})]}):S.jsxs("div",{className:"flex flex-col h-full relative",children:[S.jsx($pe,{llmConfig:u,hasMessages:N.length>0,configDialogOpen:f,onConfigDialogOpenChange:p,onClearChat:M,tempProvider:h,tempModel:b,tempApiKey:v,onProviderChange:g,onModelChange:_,onApiKeyChange:w,onSaveConfig:y,onClearConfig:G}),S.jsx("div",{className:"flex-1 overflow-y-auto p-4 pt-[100px]",children:u?S.jsx($we,{messages:N,isLoading:O,serverId:t.url,readResource:a}):S.jsx(Gpe,{onConfigureClick:()=>p(!0)})}),u&&S.jsx(zpe,{inputValue:n,isConnected:e,isLoading:O,textareaRef:l,onInputChange:o,onKeyDown:$,onSendMessage:D})]})}const Sg=R.createContext(null);Sg.displayName="PanelGroupContext";const br={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},AN=10,xs=R.useLayoutEffect,Uq=HC.useId,Vwe=typeof Uq=="function"?Uq:()=>null;let Wwe=0;function CN(t=null){const e=Vwe(),r=R.useRef(t||e||null);return r.current===null&&(r.current=""+Wwe++),t??r.current}function V9({children:t,className:e="",collapsedSize:r,collapsible:a,defaultSize:n,forwardedRef:o,id:l,maxSize:u,minSize:c,onCollapse:f,onExpand:p,onResize:h,order:g,style:v,tagName:w="div",...b}){const _=R.useContext(Sg);if(_===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:E,getPanelSize:x,getPanelStyle:T,groupId:C,isPanelCollapsed:N,reevaluatePanelConstraints:O,registerPanel:I,resizePanel:M,unregisterPanel:D}=_,$=CN(l),G=R.useRef({callbacks:{onCollapse:f,onExpand:p,onResize:h},constraints:{collapsedSize:r,collapsible:a,defaultSize:n,maxSize:u,minSize:c},id:$,idIsFromProps:l!==void 0,order:g});R.useRef({didLogMissingDefaultSizeWarning:!1}),xs(()=>{const{callbacks:ee,constraints:ne}=G.current,F={...ne};G.current.id=$,G.current.idIsFromProps=l!==void 0,G.current.order=g,ee.onCollapse=f,ee.onExpand=p,ee.onResize=h,ne.collapsedSize=r,ne.collapsible=a,ne.defaultSize=n,ne.maxSize=u,ne.minSize=c,(F.collapsedSize!==ne.collapsedSize||F.collapsible!==ne.collapsible||F.maxSize!==ne.maxSize||F.minSize!==ne.minSize)&&O(G.current,F)}),xs(()=>{const ee=G.current;return I(ee),()=>{D(ee)}},[g,$,I,D]),R.useImperativeHandle(o,()=>({collapse:()=>{y(G.current)},expand:ee=>{E(G.current,ee)},getId(){return $},getSize(){return x(G.current)},isCollapsed(){return N(G.current)},isExpanded(){return!N(G.current)},resize:ee=>{M(G.current,ee)}}),[y,E,x,N,$,M]);const V=T(G.current,n);return R.createElement(w,{...b,children:t,className:e,id:$,style:{...V,...v},[br.groupId]:C,[br.panel]:"",[br.panelCollapsible]:a||void 0,[br.panelId]:$,[br.panelSize]:parseFloat(""+V.flexGrow).toFixed(1)})}const W9=R.forwardRef((t,e)=>R.createElement(V9,{...t,forwardedRef:e}));V9.displayName="Panel";W9.displayName="forwardRef(Panel)";let uC=null,Kh=-1,To=null;function Ywe(t,e,r){const a=(e&Q9)!==0,n=(e&J9)!==0,o=(e&e8)!==0,l=(e&t8)!==0;if(e){if(a)return o?"se-resize":l?"ne-resize":"e-resize";if(n)return o?"sw-resize":l?"nw-resize":"w-resize";if(o)return"s-resize";if(l)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Kwe(){To!==null&&(document.head.removeChild(To),uC=null,To=null,Kh=-1)}function CR(t,e,r){var a,n;const o=Ywe(t,e);if(uC!==o){if(uC=o,To===null&&(To=document.createElement("style"),document.head.appendChild(To)),Kh>=0){var l;(l=To.sheet)===null||l===void 0||l.removeRule(Kh)}Kh=(a=(n=To.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&a!==void 0?a:-1}}function Y9(t){return t.type==="keydown"}function K9(t){return t.type.startsWith("pointer")}function Z9(t){return t.type.startsWith("mouse")}function wg(t){if(K9(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(Z9(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function Zwe(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Xwe(t,e,r){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function Qwe(t,e){if(t===e)throw new Error("Cannot compare node with itself");const r={a:$q(t),b:$q(e)};let a;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),a=t;Tt(a,"Stacking order can only be calculated for elements with a common ancestor");const n={a:Bq(Fq(r.a)),b:Bq(Fq(r.b))};if(n.a===n.b){const o=a.childNodes,l={a:r.a.at(-1),b:r.b.at(-1)};let u=o.length;for(;u--;){const c=o[u];if(c===l.a)return 1;if(c===l.b)return-1}}return Math.sign(n.a-n.b)}const Jwe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function e_e(t){var e;const r=getComputedStyle((e=X9(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function t_e(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||e_e(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||Jwe.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function Fq(t){let e=t.length;for(;e--;){const r=t[e];if(Tt(r,"Missing node"),t_e(r))return r}return null}function Bq(t){return t&&Number(getComputedStyle(t).zIndex)||0}function $q(t){const e=[];for(;t;)e.push(t),t=X9(t);return e}function X9(t){const{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}const Q9=1,J9=2,e8=4,t8=8,r_e=Zwe()==="coarse";let wa=[],Xl=!1,Ro=new Map,_g=new Map;const Id=new Set;function n_e(t,e,r,a,n){var o;const{ownerDocument:l}=e,u={direction:r,element:e,hitAreaMargins:a,setResizeHandlerState:n},c=(o=Ro.get(l))!==null&&o!==void 0?o:0;return Ro.set(l,c+1),Id.add(u),Am(),function(){var p;_g.delete(t),Id.delete(u);const h=(p=Ro.get(l))!==null&&p!==void 0?p:1;if(Ro.set(l,h-1),Am(),h===1&&Ro.delete(l),wa.includes(u)){const g=wa.indexOf(u);g>=0&&wa.splice(g,1),xg(),n("up",!0,null)}}}function a_e(t){const{target:e}=t,{x:r,y:a}=wg(t);Xl=!0,NN({target:e,x:r,y:a}),Am(),wa.length>0&&(Cm("down",t),xg(),t.preventDefault(),r8(e)||t.stopImmediatePropagation())}function NR(t){const{x:e,y:r}=wg(t);if(Xl&&t.type!=="pointerleave"&&t.buttons===0&&(Xl=!1,Cm("up",t)),!Xl){const{target:a}=t;NN({target:a,x:e,y:r})}Cm("move",t),xg(),wa.length>0&&t.preventDefault()}function kR(t){const{target:e}=t,{x:r,y:a}=wg(t);_g.clear(),Xl=!1,wa.length>0&&(t.preventDefault(),r8(e)||t.stopImmediatePropagation()),Cm("up",t),NN({target:e,x:r,y:a}),xg(),Am()}function r8(t){let e=t;for(;e;){if(e.hasAttribute(br.resizeHandle))return!0;e=e.parentElement}return!1}function NN({target:t,x:e,y:r}){wa.splice(0);let a=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(a=t),Id.forEach(n=>{const{element:o,hitAreaMargins:l}=n,u=o.getBoundingClientRect(),{bottom:c,left:f,right:p,top:h}=u,g=r_e?l.coarse:l.fine;if(e>=f-g&&e<=p+g&&r>=h-g&&r<=c+g){if(a!==null&&document.contains(a)&&o!==a&&!o.contains(a)&&!a.contains(o)&&Qwe(a,o)>0){let w=a,b=!1;for(;w&&!w.contains(o);){if(Xwe(w.getBoundingClientRect(),u)){b=!0;break}w=w.parentElement}if(b)return}wa.push(n)}})}function OR(t,e){_g.set(t,e)}function xg(){let t=!1,e=!1;wa.forEach(a=>{const{direction:n}=a;n==="horizontal"?t=!0:e=!0});let r=0;_g.forEach(a=>{r|=a}),t&&e?CR("intersection",r):t?CR("horizontal",r):e?CR("vertical",r):Kwe()}let IR;function Am(){var t;(t=IR)===null||t===void 0||t.abort(),IR=new AbortController;const e={capture:!0,signal:IR.signal};Id.size&&(Xl?(wa.length>0&&Ro.forEach((r,a)=>{const{body:n}=a;r>0&&(n.addEventListener("contextmenu",kR,e),n.addEventListener("pointerleave",NR,e),n.addEventListener("pointermove",NR,e))}),Ro.forEach((r,a)=>{const{body:n}=a;n.addEventListener("pointerup",kR,e),n.addEventListener("pointercancel",kR,e)})):Ro.forEach((r,a)=>{const{body:n}=a;r>0&&(n.addEventListener("pointerdown",a_e,e),n.addEventListener("pointermove",NR,e))}))}function Cm(t,e){Id.forEach(r=>{const{setResizeHandlerState:a}=r,n=wa.includes(r);a(t,n,e)})}function i_e(){const[t,e]=R.useState(0);return R.useCallback(()=>e(r=>r+1),[])}function Tt(t,e){if(!t)throw console.error(e),Error(e)}function Ms(t,e,r=AN){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function Ci(t,e,r=AN){return Ms(t,e,r)===0}function Fn(t,e,r){return Ms(t,e,r)===0}function o_e(t,e,r){if(t.length!==e.length)return!1;for(let a=0;a<t.length;a++){const n=t[a],o=e[a];if(!Fn(n,o,r))return!1}return!0}function Gl({panelConstraints:t,panelIndex:e,size:r}){const a=t[e];Tt(a!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:n=0,collapsible:o,maxSize:l=100,minSize:u=0}=a;if(Ms(r,u)<0)if(o){const c=(n+u)/2;Ms(r,c)<0?r=n:r=u}else r=u;return r=Math.min(l,r),r=parseFloat(r.toFixed(AN)),r}function Zc({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:a,prevLayout:n,trigger:o}){if(Fn(t,0))return e;const l=[...e],[u,c]=a;Tt(u!=null,"Invalid first pivot index"),Tt(c!=null,"Invalid second pivot index");let f=0;if(o==="keyboard"){{const h=t<0?c:u,g=r[h];Tt(g,`Panel constraints not found for index ${h}`);const{collapsedSize:v=0,collapsible:w,minSize:b=0}=g;if(w){const _=e[h];if(Tt(_!=null,`Previous layout not found for panel index ${h}`),Fn(_,v)){const y=b-_;Ms(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{const h=t<0?u:c,g=r[h];Tt(g,`No panel constraints found for index ${h}`);const{collapsedSize:v=0,collapsible:w,minSize:b=0}=g;if(w){const _=e[h];if(Tt(_!=null,`Previous layout not found for panel index ${h}`),Fn(_,b)){const y=_-v;Ms(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}}{const h=t<0?1:-1;let g=t<0?c:u,v=0;for(;;){const b=e[g];Tt(b!=null,`Previous layout not found for panel index ${g}`);const y=Gl({panelConstraints:r,panelIndex:g,size:100})-b;if(v+=y,g+=h,g<0||g>=r.length)break}const w=Math.min(Math.abs(t),Math.abs(v));t=t<0?0-w:w}{let g=t<0?u:c;for(;g>=0&&g<r.length;){const v=Math.abs(t)-Math.abs(f),w=e[g];Tt(w!=null,`Previous layout not found for panel index ${g}`);const b=w-v,_=Gl({panelConstraints:r,panelIndex:g,size:b});if(!Fn(w,_)&&(f+=w-_,l[g]=_,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(o_e(n,l))return n;{const h=t<0?c:u,g=e[h];Tt(g!=null,`Previous layout not found for panel index ${h}`);const v=g+f,w=Gl({panelConstraints:r,panelIndex:h,size:v});if(l[h]=w,!Fn(w,v)){let b=v-w,y=t<0?c:u;for(;y>=0&&y<r.length;){const E=l[y];Tt(E!=null,`Previous layout not found for panel index ${y}`);const x=E+b,T=Gl({panelConstraints:r,panelIndex:y,size:x});if(Fn(E,T)||(b-=T-E,l[y]=T),Fn(b,0))break;t>0?y--:y++}}}const p=l.reduce((h,g)=>g+h,0);return Fn(p,100)?l:n}function s_e({layout:t,panelsArray:e,pivotIndices:r}){let a=0,n=100,o=0,l=0;const u=r[0];Tt(u!=null,"No pivot index found"),e.forEach((h,g)=>{const{constraints:v}=h,{maxSize:w=100,minSize:b=0}=v;g===u?(a=b,n=w):(o+=b,l+=w)});const c=Math.min(n,100-o),f=Math.max(a,100-l),p=t[u];return{valueMax:c,valueMin:f,valueNow:p}}function Dd(t,e=document){return Array.from(e.querySelectorAll(`[${br.resizeHandleId}][data-panel-group-id="${t}"]`))}function n8(t,e,r=document){const n=Dd(t,r).findIndex(o=>o.getAttribute(br.resizeHandleId)===e);return n??null}function a8(t,e,r){const a=n8(t,e,r);return a!=null?[a,a+1]:[-1,-1]}function l_e(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function i8(t,e=document){if(l_e(e)&&e.dataset.panelGroupId==t)return e;const r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function Tg(t,e=document){const r=e.querySelector(`[${br.resizeHandleId}="${t}"]`);return r||null}function u_e(t,e,r,a=document){var n,o,l,u;const c=Tg(e,a),f=Dd(t,a),p=c?f.indexOf(c):-1,h=(n=(o=r[p])===null||o===void 0?void 0:o.id)!==null&&n!==void 0?n:null,g=(l=(u=r[p+1])===null||u===void 0?void 0:u.id)!==null&&l!==void 0?l:null;return[h,g]}function c_e({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:a,panelDataArray:n,panelGroupElement:o,setLayout:l}){R.useRef({didWarnAboutMissingResizeHandle:!1}),xs(()=>{if(!o)return;const u=Dd(r,o);for(let c=0;c<n.length-1;c++){const{valueMax:f,valueMin:p,valueNow:h}=s_e({layout:a,panelsArray:n,pivotIndices:[c,c+1]}),g=u[c];if(g!=null){const v=n[c];Tt(v,`No panel data found for index "${c}"`),g.setAttribute("aria-controls",v.id),g.setAttribute("aria-valuemax",""+Math.round(f)),g.setAttribute("aria-valuemin",""+Math.round(p)),g.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{u.forEach((c,f)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[r,a,n,o]),R.useEffect(()=>{if(!o)return;const u=e.current;Tt(u,"Eager values not found");const{panelDataArray:c}=u,f=i8(r,o);Tt(f!=null,`No group found for id "${r}"`);const p=Dd(r,o);Tt(p,`No resize handles found for group id "${r}"`);const h=p.map(g=>{const v=g.getAttribute(br.resizeHandleId);Tt(v,"Resize handle element has no handle id attribute");const[w,b]=u_e(r,v,c,o);if(w==null||b==null)return()=>{};const _=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();const E=c.findIndex(x=>x.id===w);if(E>=0){const x=c[E];Tt(x,`No panel data found for index ${E}`);const T=a[E],{collapsedSize:C=0,collapsible:N,minSize:O=0}=x.constraints;if(T!=null&&N){const I=Zc({delta:Fn(T,C)?O-C:C-T,initialLayout:a,panelConstraints:c.map(M=>M.constraints),pivotIndices:a8(r,v,o),prevLayout:a,trigger:"keyboard"});a!==I&&l(I)}}break}}};return g.addEventListener("keydown",_),()=>{g.removeEventListener("keydown",_)}});return()=>{h.forEach(g=>g())}},[o,t,e,r,a,n,l])}function zq(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function o8(t,e){const r=t==="horizontal",{x:a,y:n}=wg(e);return r?a:n}function d_e(t,e,r,a,n){const o=r==="horizontal",l=Tg(e,n);Tt(l,`No resize handle element found for id "${e}"`);const u=l.getAttribute(br.groupId);Tt(u,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=a;const f=o8(r,t),p=i8(u,n);Tt(p,`No group element found for id "${u}"`);const h=p.getBoundingClientRect(),g=o?h.width:h.height;return(f-c)/g*100}function f_e(t,e,r,a,n,o){if(Y9(t)){const l=r==="horizontal";let u=0;t.shiftKey?u=100:n!=null?u=n:u=10;let c=0;switch(t.key){case"ArrowDown":c=l?0:u;break;case"ArrowLeft":c=l?-u:0;break;case"ArrowRight":c=l?u:0;break;case"ArrowUp":c=l?0:-u;break;case"End":c=100;break;case"Home":c=-100;break}return c}else return a==null?0:d_e(t,e,r,a,o)}function p_e({panelDataArray:t}){const e=Array(t.length),r=t.map(o=>o.constraints);let a=0,n=100;for(let o=0;o<t.length;o++){const l=r[o];Tt(l,`Panel constraints not found for index ${o}`);const{defaultSize:u}=l;u!=null&&(a++,e[o]=u,n-=u)}for(let o=0;o<t.length;o++){const l=r[o];Tt(l,`Panel constraints not found for index ${o}`);const{defaultSize:u}=l;if(u!=null)continue;const c=t.length-a,f=n/c;a++,e[o]=f,n-=f}return e}function xl(t,e,r){e.forEach((a,n)=>{const o=t[n];Tt(o,`Panel data not found for index ${n}`);const{callbacks:l,constraints:u,id:c}=o,{collapsedSize:f=0,collapsible:p}=u,h=r[c];if(h==null||a!==h){r[c]=a;const{onCollapse:g,onExpand:v,onResize:w}=l;w&&w(a,h),p&&(g||v)&&(v&&(h==null||Ci(h,f))&&!Ci(a,f)&&v(),g&&(h==null||!Ci(h,f))&&Ci(a,f)&&g())}})}function wh(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!=e[r])return!1;return!0}function h_e({defaultSize:t,dragState:e,layout:r,panelData:a,panelIndex:n,precision:o=3}){const l=r[n];let u;return l==null?u=t!=null?t.toFixed(o):"1":a.length===1?u="1":u=l.toFixed(o),{flexBasis:0,flexGrow:u,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function m_e(t,e=10){let r=null;return(...n)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...n)},e)}}function qq(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,r)=>{localStorage.setItem(e,r)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function s8(t){return`react-resizable-panels:${t}`}function l8(t){return t.map(e=>{const{constraints:r,id:a,idIsFromProps:n,order:o}=e;return n?a:o?`${o}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((e,r)=>e.localeCompare(r)).join(",")}function u8(t,e){try{const r=s8(t),a=e.getItem(r);if(a){const n=JSON.parse(a);if(typeof n=="object"&&n!=null)return n}}catch{}return null}function g_e(t,e,r){var a,n;const o=(a=u8(t,r))!==null&&a!==void 0?a:{},l=l8(e);return(n=o[l])!==null&&n!==void 0?n:null}function v_e(t,e,r,a,n){var o;const l=s8(t),u=l8(e),c=(o=u8(t,n))!==null&&o!==void 0?o:{};c[u]={expandToSizes:Object.fromEntries(r.entries()),layout:a};try{n.setItem(l,JSON.stringify(c))}catch(f){console.error(f)}}function Hq({layout:t,panelConstraints:e}){const r=[...t],a=r.reduce((o,l)=>o+l,0);if(r.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${r.map(o=>`${o}%`).join(", ")}`);if(!Fn(a,100)&&r.length>0)for(let o=0;o<e.length;o++){const l=r[o];Tt(l!=null,`No layout data found for index ${o}`);const u=100/a*l;r[o]=u}let n=0;for(let o=0;o<e.length;o++){const l=r[o];Tt(l!=null,`No layout data found for index ${o}`);const u=Gl({panelConstraints:e,panelIndex:o,size:l});l!=u&&(n+=l-u,r[o]=u)}if(!Fn(n,0))for(let o=0;o<e.length;o++){const l=r[o];Tt(l!=null,`No layout data found for index ${o}`);const u=l+n,c=Gl({panelConstraints:e,panelIndex:o,size:u});if(l!==c&&(n-=c-l,r[o]=c,Fn(n,0)))break}return r}const y_e=100,Xc={getItem:t=>(qq(Xc),Xc.getItem(t)),setItem:(t,e)=>{qq(Xc),Xc.setItem(t,e)}},Gq={};function c8({autoSaveId:t=null,children:e,className:r="",direction:a,forwardedRef:n,id:o=null,onLayout:l=null,keyboardResizeBy:u=null,storage:c=Xc,style:f,tagName:p="div",...h}){const g=CN(o),v=R.useRef(null),[w,b]=R.useState(null),[_,y]=R.useState([]),E=i_e(),x=R.useRef({}),T=R.useRef(new Map),C=R.useRef(0),N=R.useRef({autoSaveId:t,direction:a,dragState:w,id:g,keyboardResizeBy:u,onLayout:l,storage:c}),O=R.useRef({layout:_,panelDataArray:[],panelDataArrayChanged:!1});R.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),R.useImperativeHandle(n,()=>({getId:()=>N.current.id,getLayout:()=>{const{layout:K}=O.current;return K},setLayout:K=>{const{onLayout:te}=N.current,{layout:ie,panelDataArray:P}=O.current,U=Hq({layout:K,panelConstraints:P.map(X=>X.constraints)});zq(ie,U)||(y(U),O.current.layout=U,te&&te(U),xl(P,U,x.current))}}),[]),xs(()=>{N.current.autoSaveId=t,N.current.direction=a,N.current.dragState=w,N.current.id=g,N.current.onLayout=l,N.current.storage=c}),c_e({committedValuesRef:N,eagerValuesRef:O,groupId:g,layout:_,panelDataArray:O.current.panelDataArray,setLayout:y,panelGroupElement:v.current}),R.useEffect(()=>{const{panelDataArray:K}=O.current;if(t){if(_.length===0||_.length!==K.length)return;let te=Gq[t];te==null&&(te=m_e(v_e,y_e),Gq[t]=te);const ie=[...K],P=new Map(T.current);te(t,ie,P,_,c)}},[t,_,c]),R.useEffect(()=>{});const I=R.useCallback(K=>{const{onLayout:te}=N.current,{layout:ie,panelDataArray:P}=O.current;if(K.constraints.collapsible){const U=P.map(q=>q.constraints),{collapsedSize:X=0,panelSize:le,pivotIndices:oe}=hs(P,K,ie);if(Tt(le!=null,`Panel size not found for panel "${K.id}"`),!Ci(le,X)){T.current.set(K.id,le);const Z=Ml(P,K)===P.length-1?le-X:X-le,fe=Zc({delta:Z,initialLayout:ie,panelConstraints:U,pivotIndices:oe,prevLayout:ie,trigger:"imperative-api"});wh(ie,fe)||(y(fe),O.current.layout=fe,te&&te(fe),xl(P,fe,x.current))}}},[]),M=R.useCallback((K,te)=>{const{onLayout:ie}=N.current,{layout:P,panelDataArray:U}=O.current;if(K.constraints.collapsible){const X=U.map(pe=>pe.constraints),{collapsedSize:le=0,panelSize:oe=0,minSize:q=0,pivotIndices:Z}=hs(U,K,P),fe=te??q;if(Ci(oe,le)){const pe=T.current.get(K.id),Te=pe!=null&&pe>=fe?pe:fe,ve=Ml(U,K)===U.length-1?oe-Te:Te-oe,Me=Zc({delta:ve,initialLayout:P,panelConstraints:X,pivotIndices:Z,prevLayout:P,trigger:"imperative-api"});wh(P,Me)||(y(Me),O.current.layout=Me,ie&&ie(Me),xl(U,Me,x.current))}}},[]),D=R.useCallback(K=>{const{layout:te,panelDataArray:ie}=O.current,{panelSize:P}=hs(ie,K,te);return Tt(P!=null,`Panel size not found for panel "${K.id}"`),P},[]),$=R.useCallback((K,te)=>{const{panelDataArray:ie}=O.current,P=Ml(ie,K);return h_e({defaultSize:te,dragState:w,layout:_,panelData:ie,panelIndex:P})},[w,_]),G=R.useCallback(K=>{const{layout:te,panelDataArray:ie}=O.current,{collapsedSize:P=0,collapsible:U,panelSize:X}=hs(ie,K,te);return Tt(X!=null,`Panel size not found for panel "${K.id}"`),U===!0&&Ci(X,P)},[]),V=R.useCallback(K=>{const{layout:te,panelDataArray:ie}=O.current,{collapsedSize:P=0,collapsible:U,panelSize:X}=hs(ie,K,te);return Tt(X!=null,`Panel size not found for panel "${K.id}"`),!U||Ms(X,P)>0},[]),ee=R.useCallback(K=>{const{panelDataArray:te}=O.current;te.push(K),te.sort((ie,P)=>{const U=ie.order,X=P.order;return U==null&&X==null?0:U==null?-1:X==null?1:U-X}),O.current.panelDataArrayChanged=!0,E()},[E]);xs(()=>{if(O.current.panelDataArrayChanged){O.current.panelDataArrayChanged=!1;const{autoSaveId:K,onLayout:te,storage:ie}=N.current,{layout:P,panelDataArray:U}=O.current;let X=null;if(K){const oe=g_e(K,U,ie);oe&&(T.current=new Map(Object.entries(oe.expandToSizes)),X=oe.layout)}X==null&&(X=p_e({panelDataArray:U}));const le=Hq({layout:X,panelConstraints:U.map(oe=>oe.constraints)});zq(P,le)||(y(le),O.current.layout=le,te&&te(le),xl(U,le,x.current))}}),xs(()=>{const K=O.current;return()=>{K.layout=[]}},[]);const ne=R.useCallback(K=>{let te=!1;const ie=v.current;return ie&&window.getComputedStyle(ie,null).getPropertyValue("direction")==="rtl"&&(te=!0),function(U){U.preventDefault();const X=v.current;if(!X)return()=>null;const{direction:le,dragState:oe,id:q,keyboardResizeBy:Z,onLayout:fe}=N.current,{layout:pe,panelDataArray:Te}=O.current,{initialLayout:Ce}=oe??{},ve=a8(q,K,X);let Me=f_e(U,K,le,oe,Z,X);const Be=le==="horizontal";Be&&te&&(Me=-Me);const De=Te.map($e=>$e.constraints),Pe=Zc({delta:Me,initialLayout:Ce??pe,panelConstraints:De,pivotIndices:ve,prevLayout:pe,trigger:Y9(U)?"keyboard":"mouse-or-touch"}),Le=!wh(pe,Pe);(K9(U)||Z9(U))&&C.current!=Me&&(C.current=Me,!Le&&Me!==0?Be?OR(K,Me<0?Q9:J9):OR(K,Me<0?e8:t8):OR(K,0)),Le&&(y(Pe),O.current.layout=Pe,fe&&fe(Pe),xl(Te,Pe,x.current))}},[]),F=R.useCallback((K,te)=>{const{onLayout:ie}=N.current,{layout:P,panelDataArray:U}=O.current,X=U.map(pe=>pe.constraints),{panelSize:le,pivotIndices:oe}=hs(U,K,P);Tt(le!=null,`Panel size not found for panel "${K.id}"`);const Z=Ml(U,K)===U.length-1?le-te:te-le,fe=Zc({delta:Z,initialLayout:P,panelConstraints:X,pivotIndices:oe,prevLayout:P,trigger:"imperative-api"});wh(P,fe)||(y(fe),O.current.layout=fe,ie&&ie(fe),xl(U,fe,x.current))},[]),z=R.useCallback((K,te)=>{const{layout:ie,panelDataArray:P}=O.current,{collapsedSize:U=0,collapsible:X}=te,{collapsedSize:le=0,collapsible:oe,maxSize:q=100,minSize:Z=0}=K.constraints,{panelSize:fe}=hs(P,K,ie);fe!=null&&(X&&oe&&Ci(fe,U)?Ci(U,le)||F(K,le):fe<Z?F(K,Z):fe>q&&F(K,q))},[F]),H=R.useCallback((K,te)=>{const{direction:ie}=N.current,{layout:P}=O.current;if(!v.current)return;const U=Tg(K,v.current);Tt(U,`Drag handle element not found for id "${K}"`);const X=o8(ie,te);b({dragHandleId:K,dragHandleRect:U.getBoundingClientRect(),initialCursorPosition:X,initialLayout:P})},[]),Q=R.useCallback(()=>{b(null)},[]),ae=R.useCallback(K=>{const{panelDataArray:te}=O.current,ie=Ml(te,K);ie>=0&&(te.splice(ie,1),delete x.current[K.id],O.current.panelDataArrayChanged=!0,E())},[E]),W=R.useMemo(()=>({collapsePanel:I,direction:a,dragState:w,expandPanel:M,getPanelSize:D,getPanelStyle:$,groupId:g,isPanelCollapsed:G,isPanelExpanded:V,reevaluatePanelConstraints:z,registerPanel:ee,registerResizeHandle:ne,resizePanel:F,startDragging:H,stopDragging:Q,unregisterPanel:ae,panelGroupElement:v.current}),[I,w,a,M,D,$,g,G,V,z,ee,ne,F,H,Q,ae]),Y={display:"flex",flexDirection:a==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return R.createElement(Sg.Provider,{value:W},R.createElement(p,{...h,children:e,className:r,id:o,ref:v,style:{...Y,...f},[br.group]:"",[br.groupDirection]:a,[br.groupId]:g}))}const d8=R.forwardRef((t,e)=>R.createElement(c8,{...t,forwardedRef:e}));c8.displayName="PanelGroup";d8.displayName="forwardRef(PanelGroup)";function Ml(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function hs(t,e,r){const a=Ml(t,e),o=a===t.length-1?[a-1,a]:[a,a+1],l=r[a];return{...e.constraints,panelSize:l,pivotIndices:o}}function b_e({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:a}){R.useEffect(()=>{if(t||r==null||a==null)return;const n=Tg(e,a);if(n==null)return;const o=l=>{if(!l.defaultPrevented)switch(l.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{l.preventDefault(),r(l);break}case"F6":{l.preventDefault();const u=n.getAttribute(br.groupId);Tt(u,`No group element found for id "${u}"`);const c=Dd(u,a),f=n8(u,e,a);Tt(f!==null,`No resize element found for id "${e}"`);const p=l.shiftKey?f>0?f-1:c.length-1:f+1<c.length?f+1:0;c[p].focus();break}}};return n.addEventListener("keydown",o),()=>{n.removeEventListener("keydown",o)}},[a,t,e,r])}function f8({children:t=null,className:e="",disabled:r=!1,hitAreaMargins:a,id:n,onBlur:o,onClick:l,onDragging:u,onFocus:c,onPointerDown:f,onPointerUp:p,style:h={},tabIndex:g=0,tagName:v="div",...w}){var b,_;const y=R.useRef(null),E=R.useRef({onClick:l,onDragging:u,onPointerDown:f,onPointerUp:p});R.useEffect(()=>{E.current.onClick=l,E.current.onDragging=u,E.current.onPointerDown=f,E.current.onPointerUp=p});const x=R.useContext(Sg);if(x===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:T,groupId:C,registerResizeHandle:N,startDragging:O,stopDragging:I,panelGroupElement:M}=x,D=CN(n),[$,G]=R.useState("inactive"),[V,ee]=R.useState(!1),[ne,F]=R.useState(null),z=R.useRef({state:$});xs(()=>{z.current.state=$}),R.useEffect(()=>{if(r)F(null);else{const W=N(D);F(()=>W)}},[r,D,N]);const H=(b=a?.coarse)!==null&&b!==void 0?b:15,Q=(_=a?.fine)!==null&&_!==void 0?_:5;R.useEffect(()=>{if(r||ne==null)return;const W=y.current;Tt(W,"Element ref not attached");let Y=!1;return n_e(D,W,T,{coarse:H,fine:Q},(te,ie,P)=>{if(!ie){G("inactive");return}switch(te){case"down":{G("drag"),Y=!1,Tt(P,'Expected event to be defined for "down" action'),O(D,P);const{onDragging:U,onPointerDown:X}=E.current;U?.(!0),X?.();break}case"move":{const{state:U}=z.current;Y=!0,U!=="drag"&&G("hover"),Tt(P,'Expected event to be defined for "move" action'),ne(P);break}case"up":{G("hover"),I();const{onClick:U,onDragging:X,onPointerUp:le}=E.current;X?.(!1),le?.(),Y||U?.();break}}})},[H,T,r,Q,N,D,ne,O,I]),b_e({disabled:r,handleId:D,resizeHandler:ne,panelGroupElement:M});const ae={touchAction:"none",userSelect:"none"};return R.createElement(v,{...w,children:t,className:e,id:n,onBlur:()=>{ee(!1),o?.()},onFocus:()=>{ee(!0),c?.()},ref:y,role:"separator",style:{...ae,...h},tabIndex:g,[br.groupDirection]:T,[br.groupId]:C,[br.resizeHandle]:"",[br.resizeHandleActive]:$==="drag"?"pointer":V?"keyboard":void 0,[br.resizeHandleEnabled]:!r,[br.resizeHandleId]:D,[br.resizeHandleState]:$})}f8.displayName="PanelResizeHandle";function Ld({className:t,...e}){return S.jsx(d8,{"data-slot":"resizable-panel-group",className:Ve("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...e})}function Ba({...t}){return S.jsx(W9,{"data-slot":"resizable-panel",...t})}function Md({withHandle:t,className:e,...r}){return S.jsx(f8,{"data-slot":"resizable-handle",className:Ve("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden 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-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",e),...r,children:t&&S.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:S.jsx(Sre,{className:"size-2.5"})})})}function uf({id:t,isSelected:e,isFocused:r,icon:a,title:n,description:o,metadata:l,onClick:u,className:c}){return S.jsx("button",{id:t,type:"button",onClick:u,className:Ve("w-full text-left cursor-pointer p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group",e&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",r&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",c),children:S.jsxs("div",{className:"flex items-start gap-3",children:[S.jsx("div",{className:"flex-shrink-0 mt-1",children:S.jsx("div",{className:Ve("p-2.5 rounded-full transition-colors",e?"bg-zinc-500 dark:bg-zinc-100/80 text-zinc-100 dark:text-zinc-900":"bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600"),children:a})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("div",{className:"flex items-center gap-2 mb-1",children:S.jsx("h3",{className:Ve("font-medium truncate font-mono text-sm"),children:n})}),o&&S.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:o})]})]})})}function p8({className:t,...e}){return S.jsx("kbd",{"data-slot":"kbd",className:Ve("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",t),...e})}function h8({activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabTitle:a,secondaryTabTitle:n,primaryCount:o,secondaryCount:l,secondaryIcon:u,primaryIcon:c,searchPlaceholder:f="Search...",onSearchExpand:p,onSearchChange:h,onSearchBlur:g,onTabSwitch:v,searchInputRef:w,primaryTabName:b}){const _=t===b;return S.jsxs("div",{className:"flex items-center justify-between p-4 py-3 border-r dark:border-zinc-700",children:[S.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?S.jsx(Mr,{ref:w,placeholder:f,value:r,onChange:y=>h(y.target.value),onBlur:g,className:"h-8 border-gray-300 dark:border-zinc-600"}):S.jsxs(S.Fragment,{children:[S.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:_?a:n}),_&&S.jsxs(S.Fragment,{children:[S.jsx(Ya,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:o}),S.jsxs(rn,{children:[S.jsx(nn,{asChild:!0,children:S.jsx(ct,{variant:"ghost",size:"sm",onClick:p,className:"h-8 w-8 p-0",children:S.jsx(JC,{className:"h-4 w-4"})})}),S.jsxs(an,{side:"bottom",className:"flex gap-2",children:["Search",S.jsx(p8,{children:"F"})]})]})]})]})}),S.jsxs(ct,{variant:"ghost",size:"sm",onClick:v,className:"gap-2",children:[_?S.jsx(u,{}):S.jsx(c,{}),S.jsx("span",{children:_?n:a}),_&&l>0&&S.jsx(Ya,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:l})]})]})}function E_e({prompts:t,selectedPrompt:e,onPromptSelect:r,focusedIndex:a}){return t.length===0?S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx(bd,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),S.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):S.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,o)=>S.jsx(uf,{id:`prompt-${n.name}`,isSelected:e?.name===n.name,isFocused:a===o,icon:S.jsx(bd,{className:"h-4 w-4"}),title:n.name,description:n.description,metadata:n.arguments&&n.arguments.length>0&&S.jsxs(Ya,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[n.arguments.length," args"]}),onClick:()=>r(n)},n.name))})}function S_e({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredPromptsCount:a,savedPromptsCount:n,onSearchExpand:o,onSearchChange:l,onSearchBlur:u,onTabSwitch:c,searchInputRef:f}){return S.jsx(h8,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:a,secondaryCount:n,primaryIcon:bd,secondaryIcon:hu,searchPlaceholder:"Search prompts...",onSearchExpand:o,onSearchChange:l,onSearchBlur:u,onTabSwitch:c,searchInputRef:f})}function w_e({savedPrompts:t,selectedPrompt:e,onLoadPrompt:r,onDeletePrompt:a,focusedIndex:n}){return t.length===0?S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx(hu,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),S.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),S.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):S.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((o,l)=>S.jsx(uf,{id:`saved-prompt-${o.id}`,isSelected:e?.id===o.id,isFocused:n===l,icon:S.jsx(hu,{className:"h-4 w-4"}),title:o.name,description:`${o.promptName} - ${new Date(o.savedAt).toLocaleString()}`,onClick:()=>r(o)},o.id))})}function __e({selectedPrompt:t,promptArgs:e,onArgChange:r}){const a=t?.arguments||[];if(!(a.length>0))return S.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const o=l=>{const u=l.name,c=e[u],f=typeof c=="string"?c:JSON.stringify(c);return l.type==="boolean"?S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:u,className:"text-sm font-medium",children:[u,l.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsxs("div",{className:"flex items-center space-x-2",children:[S.jsx("input",{id:u,type:"checkbox",checked:!!c,onChange:p=>r(u,p.target.checked),className:"rounded","aria-label":`Toggle ${u}`}),S.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:l.description})]})]},u):l.type==="number"?S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:u,className:"text-sm font-medium",children:[u,l.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsx(Mr,{id:u,type:"number",value:Number(c)||0,onChange:p=>r(u,Number(p.target.value)),placeholder:l.description||`Enter ${u}`}),l.description&&S.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},u):l.type==="array"||l.type==="object"?S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:u,className:"text-sm font-medium",children:[u,l.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsx(pg,{id:u,value:f,onChange:p=>{try{const h=JSON.parse(p.target.value);r(u,h)}catch{r(u,p.target.value)}},placeholder:l.description||`Enter ${u} as JSON`,className:"font-mono text-sm min-h-[100px]"}),l.description&&S.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},u):S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:u,className:"text-sm font-medium",children:[u,l.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsx(Mr,{id:u,value:f,onChange:p=>r(u,p.target.value),placeholder:l.description||`Enter ${u}`}),l.description&&S.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},u)};return S.jsx("div",{className:"space-y-4",children:a.map(l=>o(l))})}function x_e({selectedPrompt:t,promptArgs:e,isExecuting:r,isConnected:a,onArgChange:n,onExecute:o,onSave:l}){return t?S.jsxs("div",{className:"flex flex-col h-full",children:[S.jsx("div",{className:"flex-shrink-0 p-6 pt-3 pb-4 pr-3",children:S.jsxs("div",{children:[S.jsxs("div",{className:"flex items-center justify-between mb-0",children:[S.jsx("h3",{className:"text-lg font-semibold mb-2",children:t.name}),S.jsxs("div",{className:"flex gap-2",children:[S.jsx(ct,{onClick:o,disabled:r||!a,children:r?S.jsxs(S.Fragment,{children:[S.jsx(Ui,{className:"mr-2"}),"Executing..."]}):S.jsxs(S.Fragment,{children:[S.jsx(ZH,{className:"h-4 w-4 mr-2"}),"Execute"]})}),S.jsxs(ct,{variant:"outline",onClick:l,disabled:r,className:"gap-2",children:[S.jsx(QC,{className:"h-4 w-4"}),"Save"]})]})]}),t.description&&S.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed",children:t.description})]})}),S.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4 pr-3",children:S.jsx(__e,{selectedPrompt:t,promptArgs:e,onArgChange:n})})]}):S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),S.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a prompt from the list to view its details and execute it"})]})}function T_e({results:t,copiedResult:e,onCopy:r}){const{prismStyle:a}=Eg();return S.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:S.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?S.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((n,o)=>S.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[S.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[S.jsx("h3",{className:"text-sm font-medium",children:"Response"}),S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(hu,{className:"h-3 w-3 text-gray-400"}),S.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(n.timestamp).toLocaleTimeString()})]}),n.duration!==void 0&&S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),S.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[n.duration,"ms"]})]}),S.jsx("div",{className:"flex gap-2 ml-auto",children:S.jsx(ct,{variant:"ghost",size:"sm",onClick:()=>r(o,n.result),className:"h-6 px-2",children:e===o?S.jsx(Oo,{className:"h-4 w-4"}):S.jsx(_a,{className:"h-4 w-4"})})})]}),n.error?S.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[S.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),S.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:n.error})]}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:a,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(n.result,null,2)})})]},o))}):S.jsx("div",{className:"flex items-center justify-center h-full",children:S.jsx("div",{className:"text-center",children:S.jsx(r1,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}const Vq="mcp-inspector-saved-prompts";function m8({ref:t,prompts:e,callPrompt:r,serverId:a,isConnected:n}){const[o,l]=R.useState(null),[u,c]=R.useState(null),{selectedPromptName:f,setSelectedPromptName:p}=tf(),[h,g]=R.useState({}),[v,w]=R.useState([]),[b,_]=R.useState(!1),[y,E]=R.useState(null),[x,T]=R.useState(""),[C,N]=R.useState("prompts"),[O,I]=R.useState([]),[M,D]=R.useState(!1),[$,G]=R.useState(""),[V,ee]=R.useState(!1),[ne,F]=R.useState(-1),z=R.useRef(null);R.useImperativeHandle(t,()=>({focusSearch:()=>{ee(!0),setTimeout(()=>{z.current&&z.current.focus()},0)},blurSearch:()=>{T(""),ee(!1),z.current&&z.current.blur()}})),R.useEffect(()=>{try{const X=localStorage.getItem(Vq);if(X){const le=JSON.parse(X);I(le)}}catch(X){console.error("[PromptsTab] Failed to load saved prompts:",X)}},[]);const H=R.useCallback(X=>{try{localStorage.setItem(Vq,JSON.stringify(X))}catch(le){console.error("[PromptsTab] Failed to save prompts:",le)}},[]);R.useEffect(()=>{V&&z.current&&z.current.focus()},[V]);const Q=R.useCallback(()=>{x.trim()||ee(!1)},[x]),ae=R.useMemo(()=>{if(!x.trim())return e;const X=x.toLowerCase();return e.filter(le=>le.name.toLowerCase().includes(X)||le.description?.toLowerCase().includes(X))},[e,x]),W=R.useCallback(X=>{l(X);const le={};X.arguments&&X.arguments.forEach(oe=>{oe.default!==void 0?le[oe.name]=oe.default:oe.type==="string"?le[oe.name]="":oe.type==="number"?le[oe.name]=0:oe.type==="boolean"?le[oe.name]=!1:oe.type==="array"?le[oe.name]=[]:oe.type==="object"&&(le[oe.name]={})}),g(le)},[]),Y=R.useCallback(X=>{const le=e.find(oe=>oe.name===X.promptName);le&&(l(le),g(X.args),c(X))},[e]);R.useEffect(()=>{F(-1)},[x,C]),R.useEffect(()=>{const X=le=>{const oe=le.target;if(oe.tagName==="INPUT"||oe.tagName==="TEXTAREA"||oe.contentEditable==="true"||le.metaKey||le.ctrlKey||le.altKey)return;const Z=C==="prompts"?ae:O;if(le.key==="ArrowDown")le.preventDefault(),F(fe=>{const pe=fe+1;return pe>=Z.length?0:pe});else if(le.key==="ArrowUp")le.preventDefault(),F(fe=>{const pe=fe-1;return pe<0?Z.length-1:pe});else if(le.key==="Enter"&&ne>=0)if(le.preventDefault(),C==="prompts"){const fe=ae[ne];fe&&W(fe)}else{const fe=O[ne];fe&&Y(fe)}};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[ne,ae,O,C,W,Y]),R.useEffect(()=>{if(ne>=0){const X=C==="prompts"?`prompt-${ae[ne]?.name}`:`saved-prompt-${O[ne]?.id}`,le=document.getElementById(X);le&&le.scrollIntoView({behavior:"smooth",block:"nearest"})}},[ne,ae,O,C]),R.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:f,promptsCount:e.length,currentSelectedPrompt:o?.name}),f&&e.length>0){const X=e.find(le=>le.name===f);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:f,promptFound:!!X,promptName:X?.name,shouldSelect:X&&o?.name!==X.name}),X&&o?.name!==X.name){console.warn("[PromptsTab] Selecting prompt:",X.name),p(null);const le=setTimeout(()=>{W(X);const oe=document.getElementById(`prompt-${X.name}`);oe&&(console.warn("[PromptsTab] Scrolling to prompt element"),oe.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(le)}}},[f,e,o,W,p]);const K=R.useCallback((X,le)=>{g(oe=>({...oe,[X]:le}))},[]),te=R.useCallback(async()=>{if(!o||b)return;_(!0);const X=Date.now();try{const le=await r(o.name,h),oe=Date.now()-X;Br.getInstance().capture(new zj({promptName:o.name,serverId:a,success:!0})).catch(()=>{}),w(Z=>[{promptName:o.name,args:h,result:le,timestamp:X,duration:oe},...Z])}catch(le){Br.getInstance().capture(new zj({promptName:o.name,serverId:a,success:!1,error:le instanceof Error?le.message:"Unknown error"})).catch(()=>{});const q={promptName:o.name,args:h,result:null,error:le instanceof Error?le.message:String(le),timestamp:X,duration:Date.now()-X};w(Z=>[q,...Z])}finally{_(!1)}},[o,h,b,r,a]),ie=R.useCallback(async(X,le)=>{try{await navigator.clipboard.writeText(JSON.stringify(le,null,2)),E(X),setTimeout(()=>E(null),2e3)}catch(oe){console.error("[PromptsTab] Failed to copy result:",oe)}},[]),P=R.useCallback(()=>{o&&(G(""),D(!0))},[o]),U=R.useCallback(X=>{H(O.filter(le=>le.id!==X)),u?.id===X&&c(null)},[O,H,u]);return S.jsxs(Ld,{direction:"horizontal",className:"h-full",children:[S.jsxs(Ba,{defaultSize:33,className:"flex flex-col h-full relative",children:[S.jsx(S_e,{activeTab:C,isSearchExpanded:V,searchQuery:x,filteredPromptsCount:ae.length,savedPromptsCount:O.length,onSearchExpand:()=>ee(!0),onSearchChange:T,onSearchBlur:Q,onTabSwitch:()=>N(C==="prompts"?"saved":"prompts"),searchInputRef:z}),C==="prompts"?S.jsx(E_e,{prompts:ae,selectedPrompt:o,onPromptSelect:W,focusedIndex:ne}):S.jsx(w_e,{savedPrompts:O,selectedPrompt:u,onLoadPrompt:Y,onDeletePrompt:U,focusedIndex:ne})]}),S.jsx(Md,{withHandle:!0}),S.jsx(Ba,{defaultSize:67,children:S.jsxs(Ld,{direction:"vertical",children:[S.jsx(Ba,{defaultSize:40,children:S.jsx(x_e,{selectedPrompt:o,promptArgs:h,isExecuting:b,isConnected:n,onArgChange:K,onExecute:te,onSave:P})}),S.jsx(Md,{withHandle:!0}),S.jsx(Ba,{defaultSize:60,children:S.jsx("div",{className:"flex flex-col h-full",children:S.jsx(T_e,{results:v,copiedResult:y,onCopy:ie})})})]})})]})}m8.displayName="PromptsTab";function Ql(t){if(!t?.mimeType)return!1;const e=t.mimeType.toLowerCase();return e==="text/html"||e==="text/html+skybridge"||e==="text/uri-list"||e.startsWith("application/vnd.mcp-ui.remote-dom")}function R_e(t){return{uri:t.uri,mimeType:t.mimeType,text:t.text,blob:t.blob}}function g8({resource:t,onUIAction:e,className:r}){const a=async o=>e?.(o),n=R_e(t);return S.jsx("div",{className:r,children:S.jsx(RN,{resource:n,onUIAction:a,htmlProps:{autoResizeIframe:{width:!0,height:!0},style:{width:"100%",minHeight:"200px"},sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"},remoteDomProps:{remoteElements:[Pwe,Mwe,jwe,Uwe],library:TN}})})}function A_e({result:t,isLoading:e,previewMode:r,serverId:a,readResource:n,onTogglePreview:o,onCopy:l,onDownload:u,onFullscreen:c}){const{prismStyle:f}=Eg();let p=[],h;if(t?.resourceAnnotations&&(p=Object.keys(t.resourceAnnotations).filter(b=>b.startsWith("openai/")),h=t.resourceAnnotations["openai/outputTemplate"]),t?.result?.contents?.[0]?._meta){const b=t.result.contents[0]._meta,_=Object.keys(b).filter(y=>y.startsWith("openai/"));_.length>0&&(p=[...p,..._]),!h&&b["openai/outputTemplate"]&&(h=b["openai/outputTemplate"]),!h&&t.uri&&t.uri.startsWith("ui://widget/")&&(h=t.uri)}const g=!!(p.length>0&&h&&typeof h=="string"&&a&&n);if(e)return S.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:S.jsx(Ui,{className:"size-5"})});if(!t)return S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),S.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});if(t.error)return S.jsx("div",{className:"p-4",children:S.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[S.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),S.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:t.error})]})});const v=t?.result?.contents&&Array.isArray(t.result.contents)&&t.result.contents.some(b=>b.mimeType&&Ql(b)),w=v?t.result.contents.filter(b=>b.mimeType&&Ql(b)):[];return S.jsxs("div",{className:"flex flex-col h-full",children:[S.jsxs("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(hu,{className:"h-3 w-3 text-gray-400"}),S.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(t.timestamp).toLocaleTimeString()})]}),(()=>{const b=t?.duration??t.result?.duration??t.result?.metrics?.durationMs;return b!==void 0?S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),S.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[b,"ms"]})]}):null})(),v&&S.jsx(Ya,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 border-none border-purple-200 dark:border-purple-800/50 text-purple-600 dark:text-purple-400",children:"MCP UI"}),g&&S.jsx(Ya,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-900/20 border-none border-blue-200 dark:border-blue-800/50 text-blue-600 dark:text-blue-400",children:"OpenAI Widget"})]}),S.jsxs("div",{className:"flex items-center gap-1",children:[(v||g)&&S.jsxs(ct,{variant:"ghost",size:"sm",onClick:o,className:r?"":"text-purple-600 dark:text-purple-400",children:[r?S.jsx(Zte,{className:"h-4 w-4 mr-1"}):S.jsx($te,{className:"h-4 w-4 mr-1"}),r?"JSON":g?"Component":"Preview"]}),S.jsx(ct,{variant:"ghost",size:"sm",onClick:l,children:S.jsx(_a,{className:"h-4 w-4"})}),S.jsx(ct,{variant:"ghost",size:"sm",onClick:u,children:S.jsx(are,{className:"h-4 w-4"})}),S.jsx(ct,{variant:"ghost",size:"sm",onClick:c,children:S.jsx(Rre,{className:"h-4 w-4"})})]})]}),S.jsx("div",{className:"flex-1 overflow-y-auto",children:g&&a&&n&&h?r?S.jsx("div",{className:"flex-1 h-full",children:S.jsx(EN,{componentUrl:h,toolName:t.uri,toolArgs:{},toolResult:t.result,serverId:a,readResource:n,className:"w-full h-full relative flex p-4"})}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})}):v?r?S.jsxs("div",{className:"space-y-0 h-full",children:[w.map((b,_)=>S.jsx("div",{className:"mx-0 size-full",children:S.jsx("div",{className:"w-full h-full",children:S.jsx(g8,{resource:b,className:"w-full h-full"})})},`mcp-ui-${b.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(t.result.contents&&Array.isArray(t.result.contents)){const b=t.result.contents.filter(_=>!(_.mimeType&&Ql(_)));if(b.length>0)return S.jsx("div",{className:"px-4",children:S.jsx(Sa,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(b,null,2)})})}return null})()]}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})})})]})}function C_e(t,e){if(!t&&!e)return S.jsx(mre,{className:"h-5 w-5"});const r=(t||e||"").toLowerCase();return r.includes("image")?S.jsx(fre,{className:"h-5 w-5"}):r.includes("json")||r.includes("javascript")||r.includes("typescript")?S.jsx(cre,{className:"h-5 w-5"}):r.includes("html")||r.includes("xml")?S.jsx(bre,{className:"h-5 w-5"}):r.includes("database")||r.includes("sql")?S.jsx(qm,{className:"h-5 w-5"}):S.jsx(XC,{className:"h-5 w-5"})}function N_e({resources:t,selectedResource:e,onResourceSelect:r,focusedIndex:a}){return t.length===0?S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx(qm,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),S.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):S.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,o)=>{const l=C_e(n.mimeType,n.uri),u=[n.description,n.mimeType&&S.jsx("span",{className:"font-mono",children:n.mimeType},"mime")].filter(Boolean);return S.jsx(uf,{id:`resource-${n.uri}`,isSelected:e?.uri===n.uri,isFocused:a===o,icon:l,title:n.name,description:u.length>0?S.jsxs("span",{className:"flex flex-col gap-1",children:[n.description&&S.jsx("span",{children:n.description}),n.mimeType&&S.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:n.mimeType})]}):void 0,onClick:()=>r(n)},n.uri)})})}function k_e({isSearchExpanded:t,searchQuery:e,filteredResourcesCount:r,onSearchExpand:a,onSearchChange:n,onSearchBlur:o,searchInputRef:l}){return S.jsx("div",{className:"flex items-center justify-between p-4 py-3 border-r dark:border-zinc-700",children:S.jsx("div",{className:"flex items-center gap-2 flex-1",children:t?S.jsx(Mr,{ref:l,placeholder:"Search resources...",value:e,onChange:u=>n(u.target.value),onBlur:o,className:"h-8 border-gray-300 dark:border-zinc-600"}):S.jsxs(S.Fragment,{children:[S.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),S.jsx(Ya,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:r}),S.jsxs(rn,{children:[S.jsx(nn,{asChild:!0,children:S.jsx(ct,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:S.jsx(JC,{className:"h-4 w-4"})})}),S.jsxs(an,{side:"bottom",className:"flex gap-2",children:["Search",S.jsx(p8,{children:"F"})]})]})]})})})}function v8({ref:t,resources:e,readResource:r,serverId:a,isConnected:n}){const[o,l]=R.useState(null),{selectedResourceUri:u,setSelectedResourceUri:c}=tf(),[f,p]=R.useState(null),[h,g]=R.useState(!1),[v,w]=R.useState(""),[b]=R.useState("resources"),[_,y]=R.useState(!0),[E,x]=R.useState(!1),[T,C]=R.useState(-1),N=R.useRef(null),O=R.useRef(null);R.useImperativeHandle(t,()=>({focusSearch:()=>{x(!0),setTimeout(()=>{N.current&&N.current.focus()},0)},blurSearch:()=>{w(""),x(!1),N.current&&N.current.blur()}})),R.useEffect(()=>{E&&N.current&&N.current.focus()},[E]);const I=R.useCallback(()=>{v.trim()||x(!1)},[v]),M=R.useMemo(()=>{if(!v)return e;const ee=v.toLowerCase();return e.filter(ne=>ne.name.toLowerCase().includes(ee)||ne.description?.toLowerCase().includes(ee)||ne.uri.toLowerCase().includes(ee))},[e,v]),D=R.useCallback(async ee=>{if(l(ee),n){g(!0);const ne=Date.now();try{const F=await r(ee.uri);Br.getInstance().capture(new $j({resourceUri:ee.uri,serverId:a,success:!0})).catch(()=>{}),p({uri:ee.uri,result:F,timestamp:ne,resourceAnnotations:ee.annotations})}catch(F){Br.getInstance().capture(new $j({resourceUri:ee.uri,serverId:a,success:!1,error:F instanceof Error?F.message:"Unknown error"})).catch(()=>{}),p({uri:ee.uri,result:null,error:F instanceof Error?F.message:"Unknown error",timestamp:ne,resourceAnnotations:ee.annotations})}finally{g(!1)}}},[r,a,n]);R.useEffect(()=>{C(-1)},[v,b]),R.useEffect(()=>{const ee=ne=>{const F=ne.target;if(F.tagName==="INPUT"||F.tagName==="TEXTAREA"||F.contentEditable==="true"||ne.metaKey||ne.ctrlKey||ne.altKey)return;const H=M;if(ne.key==="ArrowDown")ne.preventDefault(),C(Q=>{const ae=Q+1;return ae>=H.length?0:ae});else if(ne.key==="ArrowUp")ne.preventDefault(),C(Q=>{const ae=Q-1;return ae<0?H.length-1:ae});else if(ne.key==="Enter"&&T>=0){ne.preventDefault();const Q=M[T];Q&&D(Q)}};return document.addEventListener("keydown",ee),()=>document.removeEventListener("keydown",ee)},[T,M,D]),R.useEffect(()=>{if(T>=0){const ee=`resource-${M[T]?.uri}`,ne=document.getElementById(ee);ne&&ne.scrollIntoView({behavior:"smooth",block:"nearest"})}},[T,M]),R.useEffect(()=>{if(u&&e.length>0){const ee=e.find(ne=>ne.uri===u);ee&&o?.uri!==ee.uri&&(c(null),setTimeout(()=>{D(ee);const ne=document.getElementById(`resource-${ee.uri}`);ne&&ne.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[u,e,o,D,c]);const $=R.useCallback(async()=>{if(f)try{await navigator.clipboard.writeText(JSON.stringify(f.result,null,2))}catch(ee){console.error("[ResourcesTab] Failed to copy result:",ee)}},[f]),G=R.useCallback(()=>{if(f)try{const ee=new globalThis.Blob([JSON.stringify(f.result,null,2)],{type:"application/json"}),ne=URL.createObjectURL(ee),F=document.createElement("a");F.href=ne,F.download=`resource-${Date.now()}.json`,document.body.appendChild(F),F.click(),document.body.removeChild(F),URL.revokeObjectURL(ne)}catch(ee){console.error("[ResourcesTab] Failed to download result:",ee)}},[f]),V=R.useCallback(async()=>{if(O.current)try{document.fullscreenElement?await document.exitFullscreen():await O.current.requestFullscreen()}catch(ee){console.error("[ResourcesTab] Failed to toggle fullscreen:",ee)}},[]);return S.jsxs(Ld,{direction:"horizontal",className:"h-full",children:[S.jsxs(Ba,{defaultSize:25,children:[S.jsx(k_e,{activeTab:b,isSearchExpanded:E,searchQuery:v,filteredResourcesCount:M.length,onSearchExpand:()=>x(!0),onSearchChange:w,onSearchBlur:I,onTabSwitch:()=>{},searchInputRef:N}),S.jsx("div",{className:"flex flex-col h-full",children:S.jsx(N_e,{resources:M,selectedResource:o,onResourceSelect:D,focusedIndex:T})})]}),S.jsx(Md,{}),S.jsx(Ba,{defaultSize:50,children:S.jsx("div",{ref:O,className:"h-full bg-white dark:bg-zinc-900",children:S.jsx(A_e,{result:f,isLoading:h,previewMode:_,serverId:a,readResource:r,onTogglePreview:()=>y(!_),onCopy:$,onDownload:G,onFullscreen:V})})})]})}v8.displayName="ResourcesTab";function O_e({savedRequests:t,selectedRequest:e,onLoadRequest:r,onDeleteRequest:a,focusedIndex:n}){if(t.length===0)return S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx(qm,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),S.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),S.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const o=(l,u)=>{l.stopPropagation(),u()};return S.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((l,u)=>S.jsxs("div",{className:"relative group",children:[S.jsx(uf,{id:`saved-${l.id}`,isSelected:e?.id===l.id,isFocused:n===u,icon:S.jsx(YH,{className:"h-4 w-4"}),title:l.name,description:l.toolName,metadata:S.jsx("div",{className:"flex flex-col gap-1",children:S.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(l.savedAt).toLocaleString()})}),onClick:()=>r(l)}),S.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:S.jsxs(rn,{children:[S.jsx(nn,{asChild:!0,children:S.jsx(ct,{variant:"secondary",size:"sm",onClick:c=>o(c,()=>a(l.id)),className:"h-8 w-8 p-0",children:S.jsx(mA,{className:"h-4 w-4"})})}),S.jsx(an,{children:S.jsx("p",{children:"Delete saved request"})})]})})]},l.id))})}function I_e({isOpen:t,requestName:e,defaultPlaceholder:r,onRequestNameChange:a,onSave:n,onCancel:o}){return t?S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:o,children:S.jsxs("div",{className:"bg-white dark:bg-zinc-800 rounded-lg p-6 w-[400px] shadow-xl border border-gray-200 dark:border-zinc-700",onClick:l=>l.stopPropagation(),children:[S.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{children:[S.jsx(pr,{htmlFor:"request-name",children:"Request Name (optional)"}),S.jsx(Mr,{id:"request-name",value:e,onChange:l=>a(l.target.value),placeholder:r,className:"mt-2",onKeyDown:l=>{l.key==="Enter"&&n()},autoFocus:!0})]}),S.jsxs("div",{className:"flex justify-end gap-2",children:[S.jsx(ct,{variant:"outline",onClick:o,children:"Cancel"}),S.jsxs(ct,{onClick:n,children:[S.jsx(QC,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function D_e({selectedTool:t,toolArgs:e,onArgChange:r}){const a=t?.inputSchema?.properties||{},n=t?.inputSchema?.required||[];return Object.keys(a).length>0?S.jsx("div",{className:"space-y-4",children:Object.entries(a).map(([l,u])=>{const c=u;c.required=n.includes(l);const f=e[l];let p="";return f!=null&&(typeof f=="string"?p=f:p=JSON.stringify(f,null,2)),c.type==="object"||c.type==="array"||typeof f=="object"&&f!==null?S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:l,className:"text-sm font-medium",children:[l,c?.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsx(pg,{id:l,value:p,onChange:h=>r(l,h.target.value),placeholder:c?.description||`Enter ${l}`,className:"min-h-[100px]"}),c?.description&&S.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:c.description})]},l):S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:l,className:"text-sm font-medium",children:[l,c?.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsx(Mr,{id:l,value:p,onChange:h=>r(l,h.target.value),placeholder:c?.description||`Enter ${l}`}),c?.description&&S.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:c.description})]},l)})}):S.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function L_e({selectedTool:t,toolArgs:e,isExecuting:r,isConnected:a,onArgChange:n,onExecute:o,onSave:l}){return t?S.jsxs("div",{className:"flex flex-col h-full",children:[S.jsx("div",{className:"flex-shrink-0 p-6 pt-3 pb-4 pr-3",children:S.jsxs("div",{children:[S.jsxs("div",{className:"flex items-center justify-between mb-0",children:[S.jsx("h3",{className:"text-lg font-semibold mb-2",children:t.name}),S.jsxs("div",{className:"flex gap-2",children:[S.jsx(ct,{onClick:o,disabled:r||!a,children:r?S.jsxs(S.Fragment,{children:[S.jsx(Ui,{className:"mr-2"}),"Executing..."]}):S.jsxs(S.Fragment,{children:[S.jsx(ZH,{className:"h-4 w-4 mr-2"}),"Execute"]})}),S.jsxs(ct,{variant:"outline",onClick:l,disabled:r,className:"gap-2",children:[S.jsx(QC,{className:"h-4 w-4"}),"Save"]})]})]}),t.description&&S.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed",children:t.description})]})}),S.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4 pr-3",children:S.jsx(D_e,{selectedTool:t,toolArgs:e,onArgChange:n})})]}):S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),S.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a tool from the list to view its details and execute it"})]})}function M_e({results:t,copiedResult:e,previewMode:r,serverId:a,readResource:n,onCopy:o,onTogglePreview:l}){const{prismStyle:u}=Eg();return S.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:S.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?S.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((c,f)=>{const p=c.toolMeta?.["openai/outputTemplate"],h=!!(p&&typeof p=="string"&&c.appsSdkResource),g=p,v=c.result?.content||[],w=v.filter(_=>_.type==="resource"&&Ql(_.resource)),b=w.length>0;return S.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[S.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${b||h?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[S.jsx("h3",{className:"text-sm font-medium",children:"Response"}),S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(hu,{className:"h-3 w-3 text-gray-400"}),S.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(c.timestamp).toLocaleTimeString()})]}),c.duration!==void 0&&S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),S.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[c.duration,"ms"]})]}),h&&S.jsxs("div",{className:"flex items-center gap-4 ml-4",children:[S.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["URI: ",g||"No URI"]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),S.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),S.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),b&&!h&&S.jsxs("div",{className:"flex items-center gap-4 ml-4",children:[S.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["URI: ",w[0]?.resource?.uri||"No URI"]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),S.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),S.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),S.jsx(ct,{variant:"ghost",size:"sm",onClick:()=>o(f,c.result),className:"ml-auto",children:e===f?S.jsx(Oo,{className:"h-4 w-4"}):S.jsx(_a,{className:"h-4 w-4"})})]}),c.error?S.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[S.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),S.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:c.error})]}):(()=>{if(h){const _=c.appsSdkResource;return _.isLoading?S.jsx(S.Fragment,{}):_.error?S.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[S.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),S.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:_.error})]}):r?S.jsx("div",{className:"flex-1",children:S.jsx(EN,{componentUrl:g,toolName:c.toolName,toolArgs:c.args,toolResult:c.result,resource:_.resourceData,serverId:a,readResource:n,className:"w-full h-full relative p-4"})}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:u,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(c.result,null,2)})})}return b?r?S.jsxs("div",{className:"space-y-0 h-full",children:[w.map((_,y)=>S.jsx("div",{className:"mx-0 size-full",children:S.jsx(g8,{resource:_.resource,onUIAction:E=>{},className:"w-full h-full relative"})},y)),v.filter(_=>!(_.type==="resource"&&Ql(_.resource))).length>0&&S.jsx("div",{className:"px-4",children:S.jsx(Sa,{language:"json",style:u,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(v.filter(_=>!(_.type==="resource"&&Ql(_.resource))),null,2)})})]}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:u,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(c.result,null,2)})}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:u,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(c.result,null,2)})})})()]},f)})}):S.jsx("div",{className:"flex items-center justify-center h-full",children:S.jsx("div",{className:"text-center",children:S.jsx(r1,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function P_e({tools:t,selectedTool:e,onToolSelect:r,focusedIndex:a}){return t.length===0?S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx(Ns,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),S.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):S.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,o)=>S.jsx(uf,{id:`tool-${n.name}`,isSelected:e?.name===n.name,isFocused:a===o,icon:S.jsx(Ns,{className:"h-4 w-4"}),title:n.name,description:n.description,metadata:n.inputSchema?.properties&&S.jsxs(Ya,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[Object.keys(n.inputSchema.properties).length," params"]}),onClick:()=>r(n)},n.name))})}function j_e({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredToolsCount:a,savedRequestsCount:n,onSearchExpand:o,onSearchChange:l,onSearchBlur:u,onTabSwitch:c,searchInputRef:f}){return S.jsx(h8,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:a,secondaryCount:n,primaryIcon:Ns,secondaryIcon:qm,searchPlaceholder:"Search tools...",onSearchExpand:o,onSearchChange:l,onSearchBlur:u,onTabSwitch:c,searchInputRef:f})}const Wq="mcp-inspector-saved-requests";function y8({ref:t,tools:e,callTool:r,readResource:a,serverId:n,isConnected:o}){const[l,u]=R.useState(null),[c,f]=R.useState(null),{selectedToolName:p,setSelectedToolName:h}=tf(),[g,v]=R.useState({}),[w,b]=R.useState([]),[_,y]=R.useState(!1),[E,x]=R.useState(null),[T,C]=R.useState(""),[N,O]=R.useState("tools"),[I,M]=R.useState([]),[D,$]=R.useState(!1),[G,V]=R.useState(""),[ee,ne]=R.useState(!0),[F,z]=R.useState(!1),[H,Q]=R.useState(-1),ae=R.useRef(null);R.useImperativeHandle(t,()=>({focusSearch:()=>{z(!0),setTimeout(()=>{ae.current&&ae.current.focus()},0)},blurSearch:()=>{C(""),z(!1),ae.current&&ae.current.blur()}})),R.useEffect(()=>{try{const pe=localStorage.getItem(Wq);pe&&M(JSON.parse(pe))}catch(pe){console.error("[ToolsTab] Failed to load saved requests:",pe)}},[]);const W=R.useCallback(pe=>{try{localStorage.setItem(Wq,JSON.stringify(pe)),M(pe)}catch(Te){console.error("[ToolsTab] Failed to save requests:",Te)}},[]),Y=R.useMemo(()=>{if(!T.trim())return e;const pe=T.toLowerCase();return e.filter(Te=>Te.name.toLowerCase().includes(pe)||Te.description?.toLowerCase().includes(pe))},[e,T]),K=R.useCallback(pe=>{u(pe);const Te={};pe.inputSchema?.properties&&Object.entries(pe.inputSchema.properties).forEach(([Ce,ve])=>{const Me=ve;Me.default!==void 0?Te[Ce]=Me.default:Me.type==="string"?Te[Ce]="":Me.type==="number"?Te[Ce]=0:Me.type==="boolean"?Te[Ce]=!1:Me.type==="array"?Te[Ce]=[]:Me.type==="object"&&(Te[Ce]={})}),v(Te)},[]),te=R.useCallback(pe=>{const Te=e.find(Ce=>Ce.name===pe.toolName);Te&&(u(Te),v(pe.args),f(pe))},[e]);R.useEffect(()=>{F&&ae.current&&ae.current.focus()},[F]);const ie=R.useCallback(()=>{T.trim()||z(!1)},[T]);R.useEffect(()=>{N!=="tools"&&z(!1)},[N]),R.useEffect(()=>{Q(-1)},[T,N]),R.useEffect(()=>{const pe=Te=>{const Ce=Te.target;if(Ce.tagName==="INPUT"||Ce.tagName==="TEXTAREA"||Ce.contentEditable==="true"||Te.metaKey||Te.ctrlKey||Te.altKey)return;const Me=N==="tools"?Y:I;if(Te.key==="ArrowDown")Te.preventDefault(),Q(Be=>{const De=Be+1;return De>=Me.length?0:De});else if(Te.key==="ArrowUp")Te.preventDefault(),Q(Be=>{const De=Be-1;return De<0?Me.length-1:De});else if(Te.key==="Enter"&&H>=0)if(Te.preventDefault(),N==="tools"){const Be=Y[H];Be&&K(Be)}else{const Be=I[H];Be&&te(Be)}};return document.addEventListener("keydown",pe),()=>document.removeEventListener("keydown",pe)},[H,Y,I,N,K,te]),R.useEffect(()=>{if(H>=0){const pe=N==="tools"?`tool-${Y[H]?.name}`:`saved-${I[H]?.id}`,Te=document.getElementById(pe);Te&&Te.scrollIntoView({behavior:"smooth",block:"nearest"})}},[H,Y,I,N]),R.useEffect(()=>{if(p&&e.length>0){const pe=e.find(Te=>Te.name===p);if(pe&&l?.name!==pe.name){h(null);const Te=setTimeout(()=>{K(pe);const Ce=document.getElementById(`tool-${pe.name}`);Ce&&Ce.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(Te)}}},[p,e,l,K,h]);const P=R.useCallback((pe,Te)=>{v(Ce=>{const ve={...Ce};if(l?.inputSchema?.properties?.[pe])if(l.inputSchema.properties[pe].type==="string")ve[pe]=Te;else try{ve[pe]=JSON.parse(Te)}catch{ve[pe]=Te}else try{ve[pe]=JSON.parse(Te)}catch{ve[pe]=Te}return ve})},[l]),U=R.useCallback(async()=>{if(!l||_)return;y(!0);const pe=Date.now();try{const Te=await r(l.name,g),Ce=Date.now()-pe;Br.getInstance().capture(new Bj({toolName:l.name,serverId:n,success:!0,duration:Ce})).catch(()=>{});const Me=l?._meta||l?.metadata,Be=Me?.["openai/outputTemplate"];let De;if(Be&&typeof Be=="string"){const Pe={toolName:l.name,args:g,result:Te,timestamp:pe,duration:Ce,toolMeta:Me,appsSdkResource:{uri:Be,resourceData:null,isLoading:!0}};b([Pe]);try{const Le=await a(Be);let $e=null;if(Te?.structuredContent)$e=Te.structuredContent;else if(Array.isArray(Te)&&Te[0]){const We=Te[0];We.output?.value?.structuredContent?$e=We.output.value.structuredContent:We.structuredContent?$e=We.structuredContent:We.output?.value&&($e=We.output.value)}$e||($e=Te),De={uri:Be,resourceData:{...Le,structuredContent:$e},isLoading:!1}}catch(Le){De={uri:Be,resourceData:null,isLoading:!1,error:Le instanceof Error?Le.message:String(Le)}}b(Le=>Le.map(($e,We)=>We===0?{...$e,appsSdkResource:De}:$e))}else b(Pe=>[{toolName:l.name,args:g,result:Te,timestamp:pe,duration:Ce,toolMeta:Me},...Pe])}catch(Te){const Ce=Date.now()-pe;Br.getInstance().capture(new Bj({toolName:l.name,serverId:n,success:!1,duration:Ce,error:Te instanceof Error?Te.message:String(Te)})).catch(()=>{});const Me=l?._meta||l?.metadata,Be={toolName:l.name,args:g,result:null,error:Te instanceof Error?Te.message:String(Te),timestamp:pe,duration:Ce,toolMeta:Me},De=Me?.["openai/outputTemplate"];b(De?[Be]:Pe=>[Be,...Pe])}finally{y(!1)}},[l,g,_,r,a,n]),X=R.useCallback(async(pe,Te)=>{try{await navigator.clipboard.writeText(JSON.stringify(Te,null,2)),x(pe),setTimeout(()=>x(null),2e3)}catch(Ce){console.error("[ToolsTab] Failed to copy result:",Ce)}},[]),le=R.useCallback(pe=>{b(Te=>Te.filter((Ce,ve)=>ve!==pe))},[]),oe=R.useCallback(pe=>{const Te=w[pe];if(Te){const Ce=window.open("","_blank","width=800,height=600");Ce&&(Ce.document.write(`
1761
+ `);x=N.pop()||"";for(const O of N)if(O.trim()&&O.startsWith("data: "))try{const I=JSON.parse(O.slice(6));if(console.log("[Client received event]",I.type,I.toolName||I.content?.slice?.(0,30)),I.type==="message")console.log("[Message started]",I.id);else if(I.type==="text"){b+=I.content;const M=_[_.length-1];M&&M.type==="text"?M.text=b:_.push({type:"text",text:b}),console.log("[Parts after text]",_.length,"parts, text length:",b.length),o(D=>D.map($=>$.id===w?{...$,parts:[..._]}:$))}else if(I.type==="tool-call")b&&(b=""),_.push({type:"tool-invocation",toolInvocation:{toolName:I.toolName,args:I.args,state:"pending"}}),console.log("[Parts after tool-call]",_.length,"parts, tool:",I.toolName),o(M=>M.map(D=>D.id===w?{...D,parts:[..._]}:D));else if(I.type==="tool-result"){const M=_.find(D=>D.type==="tool-invocation"&&D.toolInvocation?.toolName===I.toolName&&!D.toolInvocation?.result);M&&M.toolInvocation?(M.toolInvocation.result=I.result,M.toolInvocation.state="result",console.log("[Parts after tool-result]",_.length,"parts, updated:",I.toolName),o(D=>D.map($=>$.id===w?{...$,parts:[..._]}:$))):console.warn("[tool-result] Could not find matching tool part for",I.toolName)}else if(I.type==="done")console.log("[Done] Final parts:",_.length),o(M=>M.map(D=>D.id===w?{...D,parts:[..._],content:""}:D));else if(I.type==="error")throw new Error(I.message||"Streaming error")}catch(I){console.error("Failed to parse streaming event:",I,O)}}}catch(g){let v="Unknown error occurred";if(g instanceof Error){v=g.message;const b=g;b.status&&(v=`HTTP ${b.status}: ${v}`),(b.code===401||v.includes("401")||v.includes("Unauthorized"))&&(v="Authentication failed (401). Check your Authorization header in the connection settings.")}const w={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${v}`,timestamp:Date.now()};o(b=>[...b,w])}finally{u(!1)}},[e,a,t,n,r]),f=R.useCallback(()=>{o([])},[]);return{messages:n,isLoading:l,sendMessage:c,clearMessages:f}}function qwe({connection:t,llmConfig:e,isConnected:r,readResource:a}){const[n,o]=R.useState([]),[l,u]=R.useState(!1),c=R.useRef(null),f=R.useRef(null),p=R.useRef(null),h=R.useCallback(async v=>{if(!v.trim()||!e||!r)return;const w={id:`user-${Date.now()}`,role:"user",content:v.trim(),timestamp:Date.now()};o(y=>[...y,w]),u(!0),c.current=new AbortController;const b=Date.now();let _=0;try{const y=`assistant-${Date.now()}`;let E="";const x=[];if(o(T=>[...T,{id:y,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]),!p.current||p.current.provider!==e.provider||p.current.model!==e.model||p.current.apiKey!==e.apiKey){let T;if(e.provider==="openai"){const{ChatOpenAI:C}=await Pl(async()=>{const{ChatOpenAI:N}=await import("./index-DbqanY6c.js");return{ChatOpenAI:N}},__vite__mapDeps([0,1,2,3]));T=new C({model:e.model,apiKey:e.apiKey,temperature:e.temperature??.7})}else if(e.provider==="anthropic"){const{ChatAnthropic:C}=await Pl(async()=>{const{ChatAnthropic:N}=await import("./index-BPuwotMA.js");return{ChatAnthropic:N}},__vite__mapDeps([4,1,2]));T=new C({model:e.model,apiKey:e.apiKey,temperature:e.temperature??.7})}else if(e.provider==="google"){const{ChatGoogleGenerativeAI:C}=await Pl(async()=>{const{ChatGoogleGenerativeAI:N}=await import("./index-zX0NhVAe.js");return{ChatGoogleGenerativeAI:N}},__vite__mapDeps([5,1,2,3]));T=new C({model:e.model,apiKey:e.apiKey,temperature:e.temperature??.7})}else throw new Error(`Unsupported LLM provider: ${e.provider}`);p.current={instance:T,provider:e.provider,model:e.model,apiKey:e.apiKey}}if(!f.current||f.current.llm!==p.current.instance){const{MCPAgent:T}=await Pl(async()=>{const{MCPAgent:C}=await import("./langfuse-LCJ6VJEP-DVie-pDz.js").then(N=>N.c);return{MCPAgent:C}},__vite__mapDeps([6,2]));f.current=new T({llm:p.current.instance,client:t.client,memoryEnabled:!0,systemPrompt:"You are a helpful assistant with access to MCP tools, prompts, and resources. Help users interact with the MCP server."}),await f.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",f.current.conversationHistory?.length);for await(const T of f.current.streamEvents(v,10,!1,void 0)){if(c.current?.signal.aborted)break;if(T.event==="on_chat_model_stream"&&T.data?.chunk?.text){const C=T.data.chunk.text;if(typeof C=="string"&&C.length>0){E+=C;const N=x[x.length-1];N&&N.type==="text"?N.text=E:x.push({type:"text",text:E}),o(O=>O.map(I=>I.id===y?{...I,parts:[...x]}:I))}}else if(T.event==="on_tool_start"){E&&(E="");let C={};T.data?.input?C=T.data.input:T.data?.tool_input?C=T.data.tool_input:T.data&&(C=T.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:T.name,eventData:T.data,extractedArgs:C}),_++,x.push({type:"tool-invocation",toolInvocation:{toolName:T.name||"unknown",args:C,state:"pending"}}),o(N=>N.map(O=>O.id===y?{...O,parts:[...x]}:O))}else if(T.event==="on_tool_end"){const C=x.find(N=>N.type==="tool-invocation"&&N.toolInvocation?.toolName===T.name&&!N.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:T.name,hasToolPart:!!C,output:T.data?.output}),C&&C.toolInvocation){let N=T.data?.output;if(N?.kwargs?.content&&typeof N.kwargs.content=="string")try{N=JSON.parse(N.kwargs.content)}catch(I){console.warn("[useChatMessagesClientSide] Failed to parse kwargs.content:",I),N=N.kwargs.content}else if(N?.content&&typeof N.content=="string")try{N=JSON.parse(N.content)}catch{N=N.content}C.toolInvocation.result=N,C.toolInvocation.state="result";const O=N?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:T.name,hasMeta:!!N?._meta,hasStructuredContent:!!N?.structuredContent,appsSdkUri:O}),O&&typeof O=="string"&&a){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",O);try{const I=await a(O);console.log("[useChatMessagesClientSide] Resource fetched:",I);const M=N?.structuredContent||null;if(I?.contents&&Array.isArray(I.contents)){const D=I.contents.map(G=>({type:"resource",resource:G}));console.log("[useChatMessagesClientSide] Created MCP resources:",D);const $={...N,content:[...N.content||[],...D],structuredContent:M};C.toolInvocation.result=$,console.log("[useChatMessagesClientSide] Updated result with resources")}else console.warn("[useChatMessagesClientSide] No contents in resourceData:",I)}catch(I){console.error("Failed to fetch Apps SDK resource:",I)}}o(I=>I.map(M=>M.id===y?{...M,parts:[...x]}:M))}}}o(T=>T.map(C=>C.id===y?{...C,parts:[...x],content:""}:C)),e&&Br.getInstance().capture(new qj({serverId:t.url,provider:e.provider,model:e.model,messageCount:n.length+1,toolCallsCount:_,success:!0,executionMode:"client-side",duration:Date.now()-b})).catch(()=>{})}catch(y){console.error("Client-side agent error:",y);let E="Unknown error occurred";if(y instanceof Error){E=y.message;const T=y;T.status&&(E=`HTTP ${T.status}: ${E}`),(T.code===401||E.includes("401")||E.includes("Unauthorized"))&&(E="Authentication failed (401). Check your Authorization header in the connection settings.")}e&&Br.getInstance().capture(new qj({serverId:t.url,provider:e.provider,model:e.model,messageCount:n.length+1,toolCallsCount:_,success:!1,executionMode:"client-side",duration:Date.now()-b,error:E})).catch(()=>{});const x={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${E}`,timestamp:Date.now()};o(T=>[...T,x])}finally{u(!1),c.current=null}},[t,e,r,n,a]),g=R.useCallback(()=>{o([]),f.current&&f.current.clearConversationHistory()},[]);return{messages:n,isLoading:l,sendMessage:h,clearMessages:g}}const jq={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function Hwe({mcpServerUrl:t}){const[e,r]=R.useState(null),[a,n]=R.useState(null),[o,l]=R.useState(!1),[u,c]=R.useState("openai"),[f,p]=R.useState(""),[h,g]=R.useState(jq.openai),[v,w]=R.useState("none"),[b,_]=R.useState(""),[y,E]=R.useState(""),[x,T]=R.useState("");R.useEffect(()=>{const O=localStorage.getItem("mcp-inspector-llm-config");if(O)try{const I=JSON.parse(O);r(I),c(I.provider),p(I.apiKey),g(I.model)}catch(I){console.error("Failed to load LLM config:",I)}},[]),R.useEffect(()=>{const O=localStorage.getItem("mcp-inspector-auth-config");if(O)try{const I=JSON.parse(O);n(I),w(I.type),I.username&&_(I.username),I.password&&E(I.password),I.token&&T(I.token)}catch(I){console.error("Failed to load auth config:",I)}else try{const I="mcp:auth",M=G9(t),D=`${I}_${M}_tokens`;localStorage.getItem(D)&&(n({type:"oauth"}),w("oauth"))}catch(I){console.error("Failed to check for OAuth tokens:",I)}},[t]),R.useEffect(()=>{g(jq[u])},[u]);const C=R.useCallback(()=>{if(!f.trim())return;const O={provider:u,apiKey:f,model:h},I={type:v,...v==="basic"&&{username:b.trim(),password:y.trim()},...v==="bearer"&&{token:x.trim()}};r(O),n(I),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(O)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(I)),l(!1)},[u,f,h,v,b,y,x]),N=R.useCallback(()=>{r(null),n(null),p(""),_(""),E(""),T(""),w("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[]);return{llmConfig:e,authConfig:a,configDialogOpen:o,setConfigDialogOpen:l,tempProvider:u,setTempProvider:c,tempApiKey:f,setTempApiKey:p,tempModel:h,setTempModel:g,tempAuthType:v,saveLLMConfig:C,clearConfig:N}}function Gwe({connection:t,isConnected:e,useClientSide:r=!0,readResource:a}){const[n,o]=R.useState(""),l=R.useRef(null),{llmConfig:u,authConfig:c,configDialogOpen:f,setConfigDialogOpen:p,tempProvider:h,setTempProvider:g,tempApiKey:v,setTempApiKey:w,tempModel:b,setTempModel:_,saveLLMConfig:y,clearConfig:E}=Hwe({mcpServerUrl:t.url}),x={connection:t,llmConfig:u,isConnected:e,readResource:a},T=zwe({mcpServerUrl:t.url,llmConfig:u,authConfig:c,isConnected:e}),C=qwe(x),{messages:N,isLoading:O,sendMessage:I,clearMessages:M}=r?C:T;uV({onNewChat:M}),R.useEffect(()=>{u&&N.length===0&&l.current&&l.current.focus()},[u,N.length]),R.useEffect(()=>{!O&&N.length>0&&l.current&&l.current.focus()},[O,N.length]);const D=R.useCallback(()=>{n.trim()&&(I(n),o(""))},[n,I]),$=R.useCallback(V=>{V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),D())},[D]),G=R.useCallback(()=>{E(),M()},[E,M]);return u&&N.length===0?S.jsxs("div",{className:"flex flex-col h-full",children:[S.jsx("div",{className:"absolute top-4 right-4 z-10",children:S.jsx(J6,{open:f,onOpenChange:p,tempProvider:h,tempModel:b,tempApiKey:v,onProviderChange:g,onModelChange:_,onApiKeyChange:w,onSave:y,onClear:G,showClearButton:!0,buttonLabel:"Change API Key"})}),S.jsx(Hpe,{mcpServerUrl:t.url,inputValue:n,isConnected:e,isLoading:O,textareaRef:l,llmConfig:u,onInputChange:o,onKeyDown:$,onSubmit:V=>{V.preventDefault(),D()},onConfigDialogOpenChange:p})]}):S.jsxs("div",{className:"flex flex-col h-full relative",children:[S.jsx($pe,{llmConfig:u,hasMessages:N.length>0,configDialogOpen:f,onConfigDialogOpenChange:p,onClearChat:M,tempProvider:h,tempModel:b,tempApiKey:v,onProviderChange:g,onModelChange:_,onApiKeyChange:w,onSaveConfig:y,onClearConfig:G}),S.jsx("div",{className:"flex-1 overflow-y-auto p-4 pt-[100px]",children:u?S.jsx($we,{messages:N,isLoading:O,serverId:t.url,readResource:a}):S.jsx(Gpe,{onConfigureClick:()=>p(!0)})}),u&&S.jsx(zpe,{inputValue:n,isConnected:e,isLoading:O,textareaRef:l,onInputChange:o,onKeyDown:$,onSendMessage:D})]})}const Sg=R.createContext(null);Sg.displayName="PanelGroupContext";const br={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},AN=10,xs=R.useLayoutEffect,Uq=HC.useId,Vwe=typeof Uq=="function"?Uq:()=>null;let Wwe=0;function CN(t=null){const e=Vwe(),r=R.useRef(t||e||null);return r.current===null&&(r.current=""+Wwe++),t??r.current}function V9({children:t,className:e="",collapsedSize:r,collapsible:a,defaultSize:n,forwardedRef:o,id:l,maxSize:u,minSize:c,onCollapse:f,onExpand:p,onResize:h,order:g,style:v,tagName:w="div",...b}){const _=R.useContext(Sg);if(_===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:E,getPanelSize:x,getPanelStyle:T,groupId:C,isPanelCollapsed:N,reevaluatePanelConstraints:O,registerPanel:I,resizePanel:M,unregisterPanel:D}=_,$=CN(l),G=R.useRef({callbacks:{onCollapse:f,onExpand:p,onResize:h},constraints:{collapsedSize:r,collapsible:a,defaultSize:n,maxSize:u,minSize:c},id:$,idIsFromProps:l!==void 0,order:g});R.useRef({didLogMissingDefaultSizeWarning:!1}),xs(()=>{const{callbacks:ee,constraints:ne}=G.current,F={...ne};G.current.id=$,G.current.idIsFromProps=l!==void 0,G.current.order=g,ee.onCollapse=f,ee.onExpand=p,ee.onResize=h,ne.collapsedSize=r,ne.collapsible=a,ne.defaultSize=n,ne.maxSize=u,ne.minSize=c,(F.collapsedSize!==ne.collapsedSize||F.collapsible!==ne.collapsible||F.maxSize!==ne.maxSize||F.minSize!==ne.minSize)&&O(G.current,F)}),xs(()=>{const ee=G.current;return I(ee),()=>{D(ee)}},[g,$,I,D]),R.useImperativeHandle(o,()=>({collapse:()=>{y(G.current)},expand:ee=>{E(G.current,ee)},getId(){return $},getSize(){return x(G.current)},isCollapsed(){return N(G.current)},isExpanded(){return!N(G.current)},resize:ee=>{M(G.current,ee)}}),[y,E,x,N,$,M]);const V=T(G.current,n);return R.createElement(w,{...b,children:t,className:e,id:$,style:{...V,...v},[br.groupId]:C,[br.panel]:"",[br.panelCollapsible]:a||void 0,[br.panelId]:$,[br.panelSize]:parseFloat(""+V.flexGrow).toFixed(1)})}const W9=R.forwardRef((t,e)=>R.createElement(V9,{...t,forwardedRef:e}));V9.displayName="Panel";W9.displayName="forwardRef(Panel)";let uC=null,Kh=-1,To=null;function Ywe(t,e,r){const a=(e&Q9)!==0,n=(e&J9)!==0,o=(e&e8)!==0,l=(e&t8)!==0;if(e){if(a)return o?"se-resize":l?"ne-resize":"e-resize";if(n)return o?"sw-resize":l?"nw-resize":"w-resize";if(o)return"s-resize";if(l)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Kwe(){To!==null&&(document.head.removeChild(To),uC=null,To=null,Kh=-1)}function CR(t,e,r){var a,n;const o=Ywe(t,e);if(uC!==o){if(uC=o,To===null&&(To=document.createElement("style"),document.head.appendChild(To)),Kh>=0){var l;(l=To.sheet)===null||l===void 0||l.removeRule(Kh)}Kh=(a=(n=To.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&a!==void 0?a:-1}}function Y9(t){return t.type==="keydown"}function K9(t){return t.type.startsWith("pointer")}function Z9(t){return t.type.startsWith("mouse")}function wg(t){if(K9(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(Z9(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function Zwe(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Xwe(t,e,r){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function Qwe(t,e){if(t===e)throw new Error("Cannot compare node with itself");const r={a:$q(t),b:$q(e)};let a;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),a=t;Tt(a,"Stacking order can only be calculated for elements with a common ancestor");const n={a:Bq(Fq(r.a)),b:Bq(Fq(r.b))};if(n.a===n.b){const o=a.childNodes,l={a:r.a.at(-1),b:r.b.at(-1)};let u=o.length;for(;u--;){const c=o[u];if(c===l.a)return 1;if(c===l.b)return-1}}return Math.sign(n.a-n.b)}const Jwe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function e_e(t){var e;const r=getComputedStyle((e=X9(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function t_e(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||e_e(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||Jwe.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function Fq(t){let e=t.length;for(;e--;){const r=t[e];if(Tt(r,"Missing node"),t_e(r))return r}return null}function Bq(t){return t&&Number(getComputedStyle(t).zIndex)||0}function $q(t){const e=[];for(;t;)e.push(t),t=X9(t);return e}function X9(t){const{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}const Q9=1,J9=2,e8=4,t8=8,r_e=Zwe()==="coarse";let wa=[],Xl=!1,Ro=new Map,_g=new Map;const Id=new Set;function n_e(t,e,r,a,n){var o;const{ownerDocument:l}=e,u={direction:r,element:e,hitAreaMargins:a,setResizeHandlerState:n},c=(o=Ro.get(l))!==null&&o!==void 0?o:0;return Ro.set(l,c+1),Id.add(u),Am(),function(){var p;_g.delete(t),Id.delete(u);const h=(p=Ro.get(l))!==null&&p!==void 0?p:1;if(Ro.set(l,h-1),Am(),h===1&&Ro.delete(l),wa.includes(u)){const g=wa.indexOf(u);g>=0&&wa.splice(g,1),xg(),n("up",!0,null)}}}function a_e(t){const{target:e}=t,{x:r,y:a}=wg(t);Xl=!0,NN({target:e,x:r,y:a}),Am(),wa.length>0&&(Cm("down",t),xg(),t.preventDefault(),r8(e)||t.stopImmediatePropagation())}function NR(t){const{x:e,y:r}=wg(t);if(Xl&&t.type!=="pointerleave"&&t.buttons===0&&(Xl=!1,Cm("up",t)),!Xl){const{target:a}=t;NN({target:a,x:e,y:r})}Cm("move",t),xg(),wa.length>0&&t.preventDefault()}function kR(t){const{target:e}=t,{x:r,y:a}=wg(t);_g.clear(),Xl=!1,wa.length>0&&(t.preventDefault(),r8(e)||t.stopImmediatePropagation()),Cm("up",t),NN({target:e,x:r,y:a}),xg(),Am()}function r8(t){let e=t;for(;e;){if(e.hasAttribute(br.resizeHandle))return!0;e=e.parentElement}return!1}function NN({target:t,x:e,y:r}){wa.splice(0);let a=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(a=t),Id.forEach(n=>{const{element:o,hitAreaMargins:l}=n,u=o.getBoundingClientRect(),{bottom:c,left:f,right:p,top:h}=u,g=r_e?l.coarse:l.fine;if(e>=f-g&&e<=p+g&&r>=h-g&&r<=c+g){if(a!==null&&document.contains(a)&&o!==a&&!o.contains(a)&&!a.contains(o)&&Qwe(a,o)>0){let w=a,b=!1;for(;w&&!w.contains(o);){if(Xwe(w.getBoundingClientRect(),u)){b=!0;break}w=w.parentElement}if(b)return}wa.push(n)}})}function OR(t,e){_g.set(t,e)}function xg(){let t=!1,e=!1;wa.forEach(a=>{const{direction:n}=a;n==="horizontal"?t=!0:e=!0});let r=0;_g.forEach(a=>{r|=a}),t&&e?CR("intersection",r):t?CR("horizontal",r):e?CR("vertical",r):Kwe()}let IR;function Am(){var t;(t=IR)===null||t===void 0||t.abort(),IR=new AbortController;const e={capture:!0,signal:IR.signal};Id.size&&(Xl?(wa.length>0&&Ro.forEach((r,a)=>{const{body:n}=a;r>0&&(n.addEventListener("contextmenu",kR,e),n.addEventListener("pointerleave",NR,e),n.addEventListener("pointermove",NR,e))}),Ro.forEach((r,a)=>{const{body:n}=a;n.addEventListener("pointerup",kR,e),n.addEventListener("pointercancel",kR,e)})):Ro.forEach((r,a)=>{const{body:n}=a;r>0&&(n.addEventListener("pointerdown",a_e,e),n.addEventListener("pointermove",NR,e))}))}function Cm(t,e){Id.forEach(r=>{const{setResizeHandlerState:a}=r,n=wa.includes(r);a(t,n,e)})}function i_e(){const[t,e]=R.useState(0);return R.useCallback(()=>e(r=>r+1),[])}function Tt(t,e){if(!t)throw console.error(e),Error(e)}function Ms(t,e,r=AN){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function Ci(t,e,r=AN){return Ms(t,e,r)===0}function Fn(t,e,r){return Ms(t,e,r)===0}function o_e(t,e,r){if(t.length!==e.length)return!1;for(let a=0;a<t.length;a++){const n=t[a],o=e[a];if(!Fn(n,o,r))return!1}return!0}function Gl({panelConstraints:t,panelIndex:e,size:r}){const a=t[e];Tt(a!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:n=0,collapsible:o,maxSize:l=100,minSize:u=0}=a;if(Ms(r,u)<0)if(o){const c=(n+u)/2;Ms(r,c)<0?r=n:r=u}else r=u;return r=Math.min(l,r),r=parseFloat(r.toFixed(AN)),r}function Zc({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:a,prevLayout:n,trigger:o}){if(Fn(t,0))return e;const l=[...e],[u,c]=a;Tt(u!=null,"Invalid first pivot index"),Tt(c!=null,"Invalid second pivot index");let f=0;if(o==="keyboard"){{const h=t<0?c:u,g=r[h];Tt(g,`Panel constraints not found for index ${h}`);const{collapsedSize:v=0,collapsible:w,minSize:b=0}=g;if(w){const _=e[h];if(Tt(_!=null,`Previous layout not found for panel index ${h}`),Fn(_,v)){const y=b-_;Ms(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{const h=t<0?u:c,g=r[h];Tt(g,`No panel constraints found for index ${h}`);const{collapsedSize:v=0,collapsible:w,minSize:b=0}=g;if(w){const _=e[h];if(Tt(_!=null,`Previous layout not found for panel index ${h}`),Fn(_,b)){const y=_-v;Ms(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}}{const h=t<0?1:-1;let g=t<0?c:u,v=0;for(;;){const b=e[g];Tt(b!=null,`Previous layout not found for panel index ${g}`);const y=Gl({panelConstraints:r,panelIndex:g,size:100})-b;if(v+=y,g+=h,g<0||g>=r.length)break}const w=Math.min(Math.abs(t),Math.abs(v));t=t<0?0-w:w}{let g=t<0?u:c;for(;g>=0&&g<r.length;){const v=Math.abs(t)-Math.abs(f),w=e[g];Tt(w!=null,`Previous layout not found for panel index ${g}`);const b=w-v,_=Gl({panelConstraints:r,panelIndex:g,size:b});if(!Fn(w,_)&&(f+=w-_,l[g]=_,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(o_e(n,l))return n;{const h=t<0?c:u,g=e[h];Tt(g!=null,`Previous layout not found for panel index ${h}`);const v=g+f,w=Gl({panelConstraints:r,panelIndex:h,size:v});if(l[h]=w,!Fn(w,v)){let b=v-w,y=t<0?c:u;for(;y>=0&&y<r.length;){const E=l[y];Tt(E!=null,`Previous layout not found for panel index ${y}`);const x=E+b,T=Gl({panelConstraints:r,panelIndex:y,size:x});if(Fn(E,T)||(b-=T-E,l[y]=T),Fn(b,0))break;t>0?y--:y++}}}const p=l.reduce((h,g)=>g+h,0);return Fn(p,100)?l:n}function s_e({layout:t,panelsArray:e,pivotIndices:r}){let a=0,n=100,o=0,l=0;const u=r[0];Tt(u!=null,"No pivot index found"),e.forEach((h,g)=>{const{constraints:v}=h,{maxSize:w=100,minSize:b=0}=v;g===u?(a=b,n=w):(o+=b,l+=w)});const c=Math.min(n,100-o),f=Math.max(a,100-l),p=t[u];return{valueMax:c,valueMin:f,valueNow:p}}function Dd(t,e=document){return Array.from(e.querySelectorAll(`[${br.resizeHandleId}][data-panel-group-id="${t}"]`))}function n8(t,e,r=document){const n=Dd(t,r).findIndex(o=>o.getAttribute(br.resizeHandleId)===e);return n??null}function a8(t,e,r){const a=n8(t,e,r);return a!=null?[a,a+1]:[-1,-1]}function l_e(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function i8(t,e=document){if(l_e(e)&&e.dataset.panelGroupId==t)return e;const r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function Tg(t,e=document){const r=e.querySelector(`[${br.resizeHandleId}="${t}"]`);return r||null}function u_e(t,e,r,a=document){var n,o,l,u;const c=Tg(e,a),f=Dd(t,a),p=c?f.indexOf(c):-1,h=(n=(o=r[p])===null||o===void 0?void 0:o.id)!==null&&n!==void 0?n:null,g=(l=(u=r[p+1])===null||u===void 0?void 0:u.id)!==null&&l!==void 0?l:null;return[h,g]}function c_e({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:a,panelDataArray:n,panelGroupElement:o,setLayout:l}){R.useRef({didWarnAboutMissingResizeHandle:!1}),xs(()=>{if(!o)return;const u=Dd(r,o);for(let c=0;c<n.length-1;c++){const{valueMax:f,valueMin:p,valueNow:h}=s_e({layout:a,panelsArray:n,pivotIndices:[c,c+1]}),g=u[c];if(g!=null){const v=n[c];Tt(v,`No panel data found for index "${c}"`),g.setAttribute("aria-controls",v.id),g.setAttribute("aria-valuemax",""+Math.round(f)),g.setAttribute("aria-valuemin",""+Math.round(p)),g.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{u.forEach((c,f)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[r,a,n,o]),R.useEffect(()=>{if(!o)return;const u=e.current;Tt(u,"Eager values not found");const{panelDataArray:c}=u,f=i8(r,o);Tt(f!=null,`No group found for id "${r}"`);const p=Dd(r,o);Tt(p,`No resize handles found for group id "${r}"`);const h=p.map(g=>{const v=g.getAttribute(br.resizeHandleId);Tt(v,"Resize handle element has no handle id attribute");const[w,b]=u_e(r,v,c,o);if(w==null||b==null)return()=>{};const _=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();const E=c.findIndex(x=>x.id===w);if(E>=0){const x=c[E];Tt(x,`No panel data found for index ${E}`);const T=a[E],{collapsedSize:C=0,collapsible:N,minSize:O=0}=x.constraints;if(T!=null&&N){const I=Zc({delta:Fn(T,C)?O-C:C-T,initialLayout:a,panelConstraints:c.map(M=>M.constraints),pivotIndices:a8(r,v,o),prevLayout:a,trigger:"keyboard"});a!==I&&l(I)}}break}}};return g.addEventListener("keydown",_),()=>{g.removeEventListener("keydown",_)}});return()=>{h.forEach(g=>g())}},[o,t,e,r,a,n,l])}function zq(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function o8(t,e){const r=t==="horizontal",{x:a,y:n}=wg(e);return r?a:n}function d_e(t,e,r,a,n){const o=r==="horizontal",l=Tg(e,n);Tt(l,`No resize handle element found for id "${e}"`);const u=l.getAttribute(br.groupId);Tt(u,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=a;const f=o8(r,t),p=i8(u,n);Tt(p,`No group element found for id "${u}"`);const h=p.getBoundingClientRect(),g=o?h.width:h.height;return(f-c)/g*100}function f_e(t,e,r,a,n,o){if(Y9(t)){const l=r==="horizontal";let u=0;t.shiftKey?u=100:n!=null?u=n:u=10;let c=0;switch(t.key){case"ArrowDown":c=l?0:u;break;case"ArrowLeft":c=l?-u:0;break;case"ArrowRight":c=l?u:0;break;case"ArrowUp":c=l?0:-u;break;case"End":c=100;break;case"Home":c=-100;break}return c}else return a==null?0:d_e(t,e,r,a,o)}function p_e({panelDataArray:t}){const e=Array(t.length),r=t.map(o=>o.constraints);let a=0,n=100;for(let o=0;o<t.length;o++){const l=r[o];Tt(l,`Panel constraints not found for index ${o}`);const{defaultSize:u}=l;u!=null&&(a++,e[o]=u,n-=u)}for(let o=0;o<t.length;o++){const l=r[o];Tt(l,`Panel constraints not found for index ${o}`);const{defaultSize:u}=l;if(u!=null)continue;const c=t.length-a,f=n/c;a++,e[o]=f,n-=f}return e}function xl(t,e,r){e.forEach((a,n)=>{const o=t[n];Tt(o,`Panel data not found for index ${n}`);const{callbacks:l,constraints:u,id:c}=o,{collapsedSize:f=0,collapsible:p}=u,h=r[c];if(h==null||a!==h){r[c]=a;const{onCollapse:g,onExpand:v,onResize:w}=l;w&&w(a,h),p&&(g||v)&&(v&&(h==null||Ci(h,f))&&!Ci(a,f)&&v(),g&&(h==null||!Ci(h,f))&&Ci(a,f)&&g())}})}function wh(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!=e[r])return!1;return!0}function h_e({defaultSize:t,dragState:e,layout:r,panelData:a,panelIndex:n,precision:o=3}){const l=r[n];let u;return l==null?u=t!=null?t.toFixed(o):"1":a.length===1?u="1":u=l.toFixed(o),{flexBasis:0,flexGrow:u,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function m_e(t,e=10){let r=null;return(...n)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...n)},e)}}function qq(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,r)=>{localStorage.setItem(e,r)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function s8(t){return`react-resizable-panels:${t}`}function l8(t){return t.map(e=>{const{constraints:r,id:a,idIsFromProps:n,order:o}=e;return n?a:o?`${o}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((e,r)=>e.localeCompare(r)).join(",")}function u8(t,e){try{const r=s8(t),a=e.getItem(r);if(a){const n=JSON.parse(a);if(typeof n=="object"&&n!=null)return n}}catch{}return null}function g_e(t,e,r){var a,n;const o=(a=u8(t,r))!==null&&a!==void 0?a:{},l=l8(e);return(n=o[l])!==null&&n!==void 0?n:null}function v_e(t,e,r,a,n){var o;const l=s8(t),u=l8(e),c=(o=u8(t,n))!==null&&o!==void 0?o:{};c[u]={expandToSizes:Object.fromEntries(r.entries()),layout:a};try{n.setItem(l,JSON.stringify(c))}catch(f){console.error(f)}}function Hq({layout:t,panelConstraints:e}){const r=[...t],a=r.reduce((o,l)=>o+l,0);if(r.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${r.map(o=>`${o}%`).join(", ")}`);if(!Fn(a,100)&&r.length>0)for(let o=0;o<e.length;o++){const l=r[o];Tt(l!=null,`No layout data found for index ${o}`);const u=100/a*l;r[o]=u}let n=0;for(let o=0;o<e.length;o++){const l=r[o];Tt(l!=null,`No layout data found for index ${o}`);const u=Gl({panelConstraints:e,panelIndex:o,size:l});l!=u&&(n+=l-u,r[o]=u)}if(!Fn(n,0))for(let o=0;o<e.length;o++){const l=r[o];Tt(l!=null,`No layout data found for index ${o}`);const u=l+n,c=Gl({panelConstraints:e,panelIndex:o,size:u});if(l!==c&&(n-=c-l,r[o]=c,Fn(n,0)))break}return r}const y_e=100,Xc={getItem:t=>(qq(Xc),Xc.getItem(t)),setItem:(t,e)=>{qq(Xc),Xc.setItem(t,e)}},Gq={};function c8({autoSaveId:t=null,children:e,className:r="",direction:a,forwardedRef:n,id:o=null,onLayout:l=null,keyboardResizeBy:u=null,storage:c=Xc,style:f,tagName:p="div",...h}){const g=CN(o),v=R.useRef(null),[w,b]=R.useState(null),[_,y]=R.useState([]),E=i_e(),x=R.useRef({}),T=R.useRef(new Map),C=R.useRef(0),N=R.useRef({autoSaveId:t,direction:a,dragState:w,id:g,keyboardResizeBy:u,onLayout:l,storage:c}),O=R.useRef({layout:_,panelDataArray:[],panelDataArrayChanged:!1});R.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),R.useImperativeHandle(n,()=>({getId:()=>N.current.id,getLayout:()=>{const{layout:K}=O.current;return K},setLayout:K=>{const{onLayout:te}=N.current,{layout:ie,panelDataArray:P}=O.current,U=Hq({layout:K,panelConstraints:P.map(X=>X.constraints)});zq(ie,U)||(y(U),O.current.layout=U,te&&te(U),xl(P,U,x.current))}}),[]),xs(()=>{N.current.autoSaveId=t,N.current.direction=a,N.current.dragState=w,N.current.id=g,N.current.onLayout=l,N.current.storage=c}),c_e({committedValuesRef:N,eagerValuesRef:O,groupId:g,layout:_,panelDataArray:O.current.panelDataArray,setLayout:y,panelGroupElement:v.current}),R.useEffect(()=>{const{panelDataArray:K}=O.current;if(t){if(_.length===0||_.length!==K.length)return;let te=Gq[t];te==null&&(te=m_e(v_e,y_e),Gq[t]=te);const ie=[...K],P=new Map(T.current);te(t,ie,P,_,c)}},[t,_,c]),R.useEffect(()=>{});const I=R.useCallback(K=>{const{onLayout:te}=N.current,{layout:ie,panelDataArray:P}=O.current;if(K.constraints.collapsible){const U=P.map(q=>q.constraints),{collapsedSize:X=0,panelSize:le,pivotIndices:oe}=hs(P,K,ie);if(Tt(le!=null,`Panel size not found for panel "${K.id}"`),!Ci(le,X)){T.current.set(K.id,le);const Z=Ml(P,K)===P.length-1?le-X:X-le,fe=Zc({delta:Z,initialLayout:ie,panelConstraints:U,pivotIndices:oe,prevLayout:ie,trigger:"imperative-api"});wh(ie,fe)||(y(fe),O.current.layout=fe,te&&te(fe),xl(P,fe,x.current))}}},[]),M=R.useCallback((K,te)=>{const{onLayout:ie}=N.current,{layout:P,panelDataArray:U}=O.current;if(K.constraints.collapsible){const X=U.map(pe=>pe.constraints),{collapsedSize:le=0,panelSize:oe=0,minSize:q=0,pivotIndices:Z}=hs(U,K,P),fe=te??q;if(Ci(oe,le)){const pe=T.current.get(K.id),Te=pe!=null&&pe>=fe?pe:fe,ve=Ml(U,K)===U.length-1?oe-Te:Te-oe,Me=Zc({delta:ve,initialLayout:P,panelConstraints:X,pivotIndices:Z,prevLayout:P,trigger:"imperative-api"});wh(P,Me)||(y(Me),O.current.layout=Me,ie&&ie(Me),xl(U,Me,x.current))}}},[]),D=R.useCallback(K=>{const{layout:te,panelDataArray:ie}=O.current,{panelSize:P}=hs(ie,K,te);return Tt(P!=null,`Panel size not found for panel "${K.id}"`),P},[]),$=R.useCallback((K,te)=>{const{panelDataArray:ie}=O.current,P=Ml(ie,K);return h_e({defaultSize:te,dragState:w,layout:_,panelData:ie,panelIndex:P})},[w,_]),G=R.useCallback(K=>{const{layout:te,panelDataArray:ie}=O.current,{collapsedSize:P=0,collapsible:U,panelSize:X}=hs(ie,K,te);return Tt(X!=null,`Panel size not found for panel "${K.id}"`),U===!0&&Ci(X,P)},[]),V=R.useCallback(K=>{const{layout:te,panelDataArray:ie}=O.current,{collapsedSize:P=0,collapsible:U,panelSize:X}=hs(ie,K,te);return Tt(X!=null,`Panel size not found for panel "${K.id}"`),!U||Ms(X,P)>0},[]),ee=R.useCallback(K=>{const{panelDataArray:te}=O.current;te.push(K),te.sort((ie,P)=>{const U=ie.order,X=P.order;return U==null&&X==null?0:U==null?-1:X==null?1:U-X}),O.current.panelDataArrayChanged=!0,E()},[E]);xs(()=>{if(O.current.panelDataArrayChanged){O.current.panelDataArrayChanged=!1;const{autoSaveId:K,onLayout:te,storage:ie}=N.current,{layout:P,panelDataArray:U}=O.current;let X=null;if(K){const oe=g_e(K,U,ie);oe&&(T.current=new Map(Object.entries(oe.expandToSizes)),X=oe.layout)}X==null&&(X=p_e({panelDataArray:U}));const le=Hq({layout:X,panelConstraints:U.map(oe=>oe.constraints)});zq(P,le)||(y(le),O.current.layout=le,te&&te(le),xl(U,le,x.current))}}),xs(()=>{const K=O.current;return()=>{K.layout=[]}},[]);const ne=R.useCallback(K=>{let te=!1;const ie=v.current;return ie&&window.getComputedStyle(ie,null).getPropertyValue("direction")==="rtl"&&(te=!0),function(U){U.preventDefault();const X=v.current;if(!X)return()=>null;const{direction:le,dragState:oe,id:q,keyboardResizeBy:Z,onLayout:fe}=N.current,{layout:pe,panelDataArray:Te}=O.current,{initialLayout:Ce}=oe??{},ve=a8(q,K,X);let Me=f_e(U,K,le,oe,Z,X);const Be=le==="horizontal";Be&&te&&(Me=-Me);const De=Te.map($e=>$e.constraints),Pe=Zc({delta:Me,initialLayout:Ce??pe,panelConstraints:De,pivotIndices:ve,prevLayout:pe,trigger:Y9(U)?"keyboard":"mouse-or-touch"}),Le=!wh(pe,Pe);(K9(U)||Z9(U))&&C.current!=Me&&(C.current=Me,!Le&&Me!==0?Be?OR(K,Me<0?Q9:J9):OR(K,Me<0?e8:t8):OR(K,0)),Le&&(y(Pe),O.current.layout=Pe,fe&&fe(Pe),xl(Te,Pe,x.current))}},[]),F=R.useCallback((K,te)=>{const{onLayout:ie}=N.current,{layout:P,panelDataArray:U}=O.current,X=U.map(pe=>pe.constraints),{panelSize:le,pivotIndices:oe}=hs(U,K,P);Tt(le!=null,`Panel size not found for panel "${K.id}"`);const Z=Ml(U,K)===U.length-1?le-te:te-le,fe=Zc({delta:Z,initialLayout:P,panelConstraints:X,pivotIndices:oe,prevLayout:P,trigger:"imperative-api"});wh(P,fe)||(y(fe),O.current.layout=fe,ie&&ie(fe),xl(U,fe,x.current))},[]),z=R.useCallback((K,te)=>{const{layout:ie,panelDataArray:P}=O.current,{collapsedSize:U=0,collapsible:X}=te,{collapsedSize:le=0,collapsible:oe,maxSize:q=100,minSize:Z=0}=K.constraints,{panelSize:fe}=hs(P,K,ie);fe!=null&&(X&&oe&&Ci(fe,U)?Ci(U,le)||F(K,le):fe<Z?F(K,Z):fe>q&&F(K,q))},[F]),H=R.useCallback((K,te)=>{const{direction:ie}=N.current,{layout:P}=O.current;if(!v.current)return;const U=Tg(K,v.current);Tt(U,`Drag handle element not found for id "${K}"`);const X=o8(ie,te);b({dragHandleId:K,dragHandleRect:U.getBoundingClientRect(),initialCursorPosition:X,initialLayout:P})},[]),Q=R.useCallback(()=>{b(null)},[]),ae=R.useCallback(K=>{const{panelDataArray:te}=O.current,ie=Ml(te,K);ie>=0&&(te.splice(ie,1),delete x.current[K.id],O.current.panelDataArrayChanged=!0,E())},[E]),W=R.useMemo(()=>({collapsePanel:I,direction:a,dragState:w,expandPanel:M,getPanelSize:D,getPanelStyle:$,groupId:g,isPanelCollapsed:G,isPanelExpanded:V,reevaluatePanelConstraints:z,registerPanel:ee,registerResizeHandle:ne,resizePanel:F,startDragging:H,stopDragging:Q,unregisterPanel:ae,panelGroupElement:v.current}),[I,w,a,M,D,$,g,G,V,z,ee,ne,F,H,Q,ae]),Y={display:"flex",flexDirection:a==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return R.createElement(Sg.Provider,{value:W},R.createElement(p,{...h,children:e,className:r,id:o,ref:v,style:{...Y,...f},[br.group]:"",[br.groupDirection]:a,[br.groupId]:g}))}const d8=R.forwardRef((t,e)=>R.createElement(c8,{...t,forwardedRef:e}));c8.displayName="PanelGroup";d8.displayName="forwardRef(PanelGroup)";function Ml(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function hs(t,e,r){const a=Ml(t,e),o=a===t.length-1?[a-1,a]:[a,a+1],l=r[a];return{...e.constraints,panelSize:l,pivotIndices:o}}function b_e({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:a}){R.useEffect(()=>{if(t||r==null||a==null)return;const n=Tg(e,a);if(n==null)return;const o=l=>{if(!l.defaultPrevented)switch(l.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{l.preventDefault(),r(l);break}case"F6":{l.preventDefault();const u=n.getAttribute(br.groupId);Tt(u,`No group element found for id "${u}"`);const c=Dd(u,a),f=n8(u,e,a);Tt(f!==null,`No resize element found for id "${e}"`);const p=l.shiftKey?f>0?f-1:c.length-1:f+1<c.length?f+1:0;c[p].focus();break}}};return n.addEventListener("keydown",o),()=>{n.removeEventListener("keydown",o)}},[a,t,e,r])}function f8({children:t=null,className:e="",disabled:r=!1,hitAreaMargins:a,id:n,onBlur:o,onClick:l,onDragging:u,onFocus:c,onPointerDown:f,onPointerUp:p,style:h={},tabIndex:g=0,tagName:v="div",...w}){var b,_;const y=R.useRef(null),E=R.useRef({onClick:l,onDragging:u,onPointerDown:f,onPointerUp:p});R.useEffect(()=>{E.current.onClick=l,E.current.onDragging=u,E.current.onPointerDown=f,E.current.onPointerUp=p});const x=R.useContext(Sg);if(x===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:T,groupId:C,registerResizeHandle:N,startDragging:O,stopDragging:I,panelGroupElement:M}=x,D=CN(n),[$,G]=R.useState("inactive"),[V,ee]=R.useState(!1),[ne,F]=R.useState(null),z=R.useRef({state:$});xs(()=>{z.current.state=$}),R.useEffect(()=>{if(r)F(null);else{const W=N(D);F(()=>W)}},[r,D,N]);const H=(b=a?.coarse)!==null&&b!==void 0?b:15,Q=(_=a?.fine)!==null&&_!==void 0?_:5;R.useEffect(()=>{if(r||ne==null)return;const W=y.current;Tt(W,"Element ref not attached");let Y=!1;return n_e(D,W,T,{coarse:H,fine:Q},(te,ie,P)=>{if(!ie){G("inactive");return}switch(te){case"down":{G("drag"),Y=!1,Tt(P,'Expected event to be defined for "down" action'),O(D,P);const{onDragging:U,onPointerDown:X}=E.current;U?.(!0),X?.();break}case"move":{const{state:U}=z.current;Y=!0,U!=="drag"&&G("hover"),Tt(P,'Expected event to be defined for "move" action'),ne(P);break}case"up":{G("hover"),I();const{onClick:U,onDragging:X,onPointerUp:le}=E.current;X?.(!1),le?.(),Y||U?.();break}}})},[H,T,r,Q,N,D,ne,O,I]),b_e({disabled:r,handleId:D,resizeHandler:ne,panelGroupElement:M});const ae={touchAction:"none",userSelect:"none"};return R.createElement(v,{...w,children:t,className:e,id:n,onBlur:()=>{ee(!1),o?.()},onFocus:()=>{ee(!0),c?.()},ref:y,role:"separator",style:{...ae,...h},tabIndex:g,[br.groupDirection]:T,[br.groupId]:C,[br.resizeHandle]:"",[br.resizeHandleActive]:$==="drag"?"pointer":V?"keyboard":void 0,[br.resizeHandleEnabled]:!r,[br.resizeHandleId]:D,[br.resizeHandleState]:$})}f8.displayName="PanelResizeHandle";function Ld({className:t,...e}){return S.jsx(d8,{"data-slot":"resizable-panel-group",className:Ve("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...e})}function Ba({...t}){return S.jsx(W9,{"data-slot":"resizable-panel",...t})}function Md({withHandle:t,className:e,...r}){return S.jsx(f8,{"data-slot":"resizable-handle",className:Ve("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden 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-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",e),...r,children:t&&S.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:S.jsx(Sre,{className:"size-2.5"})})})}function uf({id:t,isSelected:e,isFocused:r,icon:a,title:n,description:o,metadata:l,onClick:u,className:c}){return S.jsx("button",{id:t,type:"button",onClick:u,className:Ve("w-full text-left cursor-pointer p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group",e&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",r&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",c),children:S.jsxs("div",{className:"flex items-start gap-3",children:[S.jsx("div",{className:"flex-shrink-0 mt-1",children:S.jsx("div",{className:Ve("p-2.5 rounded-full transition-colors",e?"bg-zinc-500 dark:bg-zinc-100/80 text-zinc-100 dark:text-zinc-900":"bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600"),children:a})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("div",{className:"flex items-center gap-2 mb-1",children:S.jsx("h3",{className:Ve("font-medium truncate font-mono text-sm"),children:n})}),o&&S.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:o})]})]})})}function p8({className:t,...e}){return S.jsx("kbd",{"data-slot":"kbd",className:Ve("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",t),...e})}function h8({activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabTitle:a,secondaryTabTitle:n,primaryCount:o,secondaryCount:l,secondaryIcon:u,primaryIcon:c,searchPlaceholder:f="Search...",onSearchExpand:p,onSearchChange:h,onSearchBlur:g,onTabSwitch:v,searchInputRef:w,primaryTabName:b}){const _=t===b;return S.jsxs("div",{className:"flex items-center justify-between p-4 py-3 border-r dark:border-zinc-700",children:[S.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?S.jsx(Mr,{ref:w,placeholder:f,value:r,onChange:y=>h(y.target.value),onBlur:g,className:"h-8 border-gray-300 dark:border-zinc-600"}):S.jsxs(S.Fragment,{children:[S.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:_?a:n}),_&&S.jsxs(S.Fragment,{children:[S.jsx(Ya,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:o}),S.jsxs(rn,{children:[S.jsx(nn,{asChild:!0,children:S.jsx(ct,{variant:"ghost",size:"sm",onClick:p,className:"h-8 w-8 p-0",children:S.jsx(JC,{className:"h-4 w-4"})})}),S.jsxs(an,{side:"bottom",className:"flex gap-2",children:["Search",S.jsx(p8,{children:"F"})]})]})]})]})}),S.jsxs(ct,{variant:"ghost",size:"sm",onClick:v,className:"gap-2",children:[_?S.jsx(u,{}):S.jsx(c,{}),S.jsx("span",{children:_?n:a}),_&&l>0&&S.jsx(Ya,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:l})]})]})}function E_e({prompts:t,selectedPrompt:e,onPromptSelect:r,focusedIndex:a}){return t.length===0?S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx(bd,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),S.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):S.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,o)=>S.jsx(uf,{id:`prompt-${n.name}`,isSelected:e?.name===n.name,isFocused:a===o,icon:S.jsx(bd,{className:"h-4 w-4"}),title:n.name,description:n.description,metadata:n.arguments&&n.arguments.length>0&&S.jsxs(Ya,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[n.arguments.length," args"]}),onClick:()=>r(n)},n.name))})}function S_e({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredPromptsCount:a,savedPromptsCount:n,onSearchExpand:o,onSearchChange:l,onSearchBlur:u,onTabSwitch:c,searchInputRef:f}){return S.jsx(h8,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:a,secondaryCount:n,primaryIcon:bd,secondaryIcon:hu,searchPlaceholder:"Search prompts...",onSearchExpand:o,onSearchChange:l,onSearchBlur:u,onTabSwitch:c,searchInputRef:f})}function w_e({savedPrompts:t,selectedPrompt:e,onLoadPrompt:r,onDeletePrompt:a,focusedIndex:n}){return t.length===0?S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx(hu,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),S.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),S.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):S.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((o,l)=>S.jsx(uf,{id:`saved-prompt-${o.id}`,isSelected:e?.id===o.id,isFocused:n===l,icon:S.jsx(hu,{className:"h-4 w-4"}),title:o.name,description:`${o.promptName} - ${new Date(o.savedAt).toLocaleString()}`,onClick:()=>r(o)},o.id))})}function __e({selectedPrompt:t,promptArgs:e,onArgChange:r}){const a=t?.arguments||[];if(!(a.length>0))return S.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const o=l=>{const u=l.name,c=e[u],f=typeof c=="string"?c:JSON.stringify(c);return l.type==="boolean"?S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:u,className:"text-sm font-medium",children:[u,l.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsxs("div",{className:"flex items-center space-x-2",children:[S.jsx("input",{id:u,type:"checkbox",checked:!!c,onChange:p=>r(u,p.target.checked),className:"rounded","aria-label":`Toggle ${u}`}),S.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:l.description})]})]},u):l.type==="number"?S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:u,className:"text-sm font-medium",children:[u,l.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsx(Mr,{id:u,type:"number",value:Number(c)||0,onChange:p=>r(u,Number(p.target.value)),placeholder:l.description||`Enter ${u}`}),l.description&&S.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},u):l.type==="array"||l.type==="object"?S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:u,className:"text-sm font-medium",children:[u,l.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsx(pg,{id:u,value:f,onChange:p=>{try{const h=JSON.parse(p.target.value);r(u,h)}catch{r(u,p.target.value)}},placeholder:l.description||`Enter ${u} as JSON`,className:"font-mono text-sm min-h-[100px]"}),l.description&&S.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},u):S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:u,className:"text-sm font-medium",children:[u,l.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsx(Mr,{id:u,value:f,onChange:p=>r(u,p.target.value),placeholder:l.description||`Enter ${u}`}),l.description&&S.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},u)};return S.jsx("div",{className:"space-y-4",children:a.map(l=>o(l))})}function x_e({selectedPrompt:t,promptArgs:e,isExecuting:r,isConnected:a,onArgChange:n,onExecute:o,onSave:l}){return t?S.jsxs("div",{className:"flex flex-col h-full",children:[S.jsx("div",{className:"flex-shrink-0 p-6 pt-3 pb-4 pr-3",children:S.jsxs("div",{children:[S.jsxs("div",{className:"flex items-center justify-between mb-0",children:[S.jsx("h3",{className:"text-lg font-semibold mb-2",children:t.name}),S.jsxs("div",{className:"flex gap-2",children:[S.jsx(ct,{onClick:o,disabled:r||!a,children:r?S.jsxs(S.Fragment,{children:[S.jsx(Ui,{className:"mr-2"}),"Executing..."]}):S.jsxs(S.Fragment,{children:[S.jsx(ZH,{className:"h-4 w-4 mr-2"}),"Execute"]})}),S.jsxs(ct,{variant:"outline",onClick:l,disabled:r,className:"gap-2",children:[S.jsx(QC,{className:"h-4 w-4"}),"Save"]})]})]}),t.description&&S.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed",children:t.description})]})}),S.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4 pr-3",children:S.jsx(__e,{selectedPrompt:t,promptArgs:e,onArgChange:n})})]}):S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),S.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a prompt from the list to view its details and execute it"})]})}function T_e({results:t,copiedResult:e,onCopy:r}){const{prismStyle:a}=Eg();return S.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:S.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?S.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((n,o)=>S.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[S.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[S.jsx("h3",{className:"text-sm font-medium",children:"Response"}),S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(hu,{className:"h-3 w-3 text-gray-400"}),S.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(n.timestamp).toLocaleTimeString()})]}),n.duration!==void 0&&S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),S.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[n.duration,"ms"]})]}),S.jsx("div",{className:"flex gap-2 ml-auto",children:S.jsx(ct,{variant:"ghost",size:"sm",onClick:()=>r(o,n.result),className:"h-6 px-2",children:e===o?S.jsx(Oo,{className:"h-4 w-4"}):S.jsx(_a,{className:"h-4 w-4"})})})]}),n.error?S.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[S.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),S.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:n.error})]}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:a,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(n.result,null,2)})})]},o))}):S.jsx("div",{className:"flex items-center justify-center h-full",children:S.jsx("div",{className:"text-center",children:S.jsx(r1,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}const Vq="mcp-inspector-saved-prompts";function m8({ref:t,prompts:e,callPrompt:r,serverId:a,isConnected:n}){const[o,l]=R.useState(null),[u,c]=R.useState(null),{selectedPromptName:f,setSelectedPromptName:p}=tf(),[h,g]=R.useState({}),[v,w]=R.useState([]),[b,_]=R.useState(!1),[y,E]=R.useState(null),[x,T]=R.useState(""),[C,N]=R.useState("prompts"),[O,I]=R.useState([]),[M,D]=R.useState(!1),[$,G]=R.useState(""),[V,ee]=R.useState(!1),[ne,F]=R.useState(-1),z=R.useRef(null);R.useImperativeHandle(t,()=>({focusSearch:()=>{ee(!0),setTimeout(()=>{z.current&&z.current.focus()},0)},blurSearch:()=>{T(""),ee(!1),z.current&&z.current.blur()}})),R.useEffect(()=>{try{const X=localStorage.getItem(Vq);if(X){const le=JSON.parse(X);I(le)}}catch(X){console.error("[PromptsTab] Failed to load saved prompts:",X)}},[]);const H=R.useCallback(X=>{try{localStorage.setItem(Vq,JSON.stringify(X))}catch(le){console.error("[PromptsTab] Failed to save prompts:",le)}},[]);R.useEffect(()=>{V&&z.current&&z.current.focus()},[V]);const Q=R.useCallback(()=>{x.trim()||ee(!1)},[x]),ae=R.useMemo(()=>{if(!x.trim())return e;const X=x.toLowerCase();return e.filter(le=>le.name.toLowerCase().includes(X)||le.description?.toLowerCase().includes(X))},[e,x]),W=R.useCallback(X=>{l(X);const le={};X.arguments&&X.arguments.forEach(oe=>{oe.default!==void 0?le[oe.name]=oe.default:oe.type==="string"?le[oe.name]="":oe.type==="number"?le[oe.name]=0:oe.type==="boolean"?le[oe.name]=!1:oe.type==="array"?le[oe.name]=[]:oe.type==="object"&&(le[oe.name]={})}),g(le)},[]),Y=R.useCallback(X=>{const le=e.find(oe=>oe.name===X.promptName);le&&(l(le),g(X.args),c(X))},[e]);R.useEffect(()=>{F(-1)},[x,C]),R.useEffect(()=>{const X=le=>{const oe=le.target;if(oe.tagName==="INPUT"||oe.tagName==="TEXTAREA"||oe.contentEditable==="true"||le.metaKey||le.ctrlKey||le.altKey)return;const Z=C==="prompts"?ae:O;if(le.key==="ArrowDown")le.preventDefault(),F(fe=>{const pe=fe+1;return pe>=Z.length?0:pe});else if(le.key==="ArrowUp")le.preventDefault(),F(fe=>{const pe=fe-1;return pe<0?Z.length-1:pe});else if(le.key==="Enter"&&ne>=0)if(le.preventDefault(),C==="prompts"){const fe=ae[ne];fe&&W(fe)}else{const fe=O[ne];fe&&Y(fe)}};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[ne,ae,O,C,W,Y]),R.useEffect(()=>{if(ne>=0){const X=C==="prompts"?`prompt-${ae[ne]?.name}`:`saved-prompt-${O[ne]?.id}`,le=document.getElementById(X);le&&le.scrollIntoView({behavior:"smooth",block:"nearest"})}},[ne,ae,O,C]),R.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:f,promptsCount:e.length,currentSelectedPrompt:o?.name}),f&&e.length>0){const X=e.find(le=>le.name===f);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:f,promptFound:!!X,promptName:X?.name,shouldSelect:X&&o?.name!==X.name}),X&&o?.name!==X.name){console.warn("[PromptsTab] Selecting prompt:",X.name),p(null);const le=setTimeout(()=>{W(X);const oe=document.getElementById(`prompt-${X.name}`);oe&&(console.warn("[PromptsTab] Scrolling to prompt element"),oe.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(le)}}},[f,e,o,W,p]);const K=R.useCallback((X,le)=>{g(oe=>({...oe,[X]:le}))},[]),te=R.useCallback(async()=>{if(!o||b)return;_(!0);const X=Date.now();try{const le=await r(o.name,h),oe=Date.now()-X;Br.getInstance().capture(new zj({promptName:o.name,serverId:a,success:!0})).catch(()=>{}),w(Z=>[{promptName:o.name,args:h,result:le,timestamp:X,duration:oe},...Z])}catch(le){Br.getInstance().capture(new zj({promptName:o.name,serverId:a,success:!1,error:le instanceof Error?le.message:"Unknown error"})).catch(()=>{});const q={promptName:o.name,args:h,result:null,error:le instanceof Error?le.message:String(le),timestamp:X,duration:Date.now()-X};w(Z=>[q,...Z])}finally{_(!1)}},[o,h,b,r,a]),ie=R.useCallback(async(X,le)=>{try{await navigator.clipboard.writeText(JSON.stringify(le,null,2)),E(X),setTimeout(()=>E(null),2e3)}catch(oe){console.error("[PromptsTab] Failed to copy result:",oe)}},[]),P=R.useCallback(()=>{o&&(G(""),D(!0))},[o]),U=R.useCallback(X=>{H(O.filter(le=>le.id!==X)),u?.id===X&&c(null)},[O,H,u]);return S.jsxs(Ld,{direction:"horizontal",className:"h-full",children:[S.jsxs(Ba,{defaultSize:33,className:"flex flex-col h-full relative",children:[S.jsx(S_e,{activeTab:C,isSearchExpanded:V,searchQuery:x,filteredPromptsCount:ae.length,savedPromptsCount:O.length,onSearchExpand:()=>ee(!0),onSearchChange:T,onSearchBlur:Q,onTabSwitch:()=>N(C==="prompts"?"saved":"prompts"),searchInputRef:z}),C==="prompts"?S.jsx(E_e,{prompts:ae,selectedPrompt:o,onPromptSelect:W,focusedIndex:ne}):S.jsx(w_e,{savedPrompts:O,selectedPrompt:u,onLoadPrompt:Y,onDeletePrompt:U,focusedIndex:ne})]}),S.jsx(Md,{withHandle:!0}),S.jsx(Ba,{defaultSize:67,children:S.jsxs(Ld,{direction:"vertical",children:[S.jsx(Ba,{defaultSize:40,children:S.jsx(x_e,{selectedPrompt:o,promptArgs:h,isExecuting:b,isConnected:n,onArgChange:K,onExecute:te,onSave:P})}),S.jsx(Md,{withHandle:!0}),S.jsx(Ba,{defaultSize:60,children:S.jsx("div",{className:"flex flex-col h-full",children:S.jsx(T_e,{results:v,copiedResult:y,onCopy:ie})})})]})})]})}m8.displayName="PromptsTab";function Ql(t){if(!t?.mimeType)return!1;const e=t.mimeType.toLowerCase();return e==="text/html"||e==="text/html+skybridge"||e==="text/uri-list"||e.startsWith("application/vnd.mcp-ui.remote-dom")}function R_e(t){return{uri:t.uri,mimeType:t.mimeType,text:t.text,blob:t.blob}}function g8({resource:t,onUIAction:e,className:r}){const a=async o=>e?.(o),n=R_e(t);return S.jsx("div",{className:r,children:S.jsx(RN,{resource:n,onUIAction:a,htmlProps:{autoResizeIframe:{width:!0,height:!0},style:{width:"100%",minHeight:"200px"},sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"},remoteDomProps:{remoteElements:[Pwe,Mwe,jwe,Uwe],library:TN}})})}function A_e({result:t,isLoading:e,previewMode:r,serverId:a,readResource:n,onTogglePreview:o,onCopy:l,onDownload:u,onFullscreen:c}){const{prismStyle:f}=Eg();let p=[],h;if(t?.resourceAnnotations&&(p=Object.keys(t.resourceAnnotations).filter(b=>b.startsWith("openai/")),h=t.resourceAnnotations["openai/outputTemplate"]),t?.result?.contents?.[0]?._meta){const b=t.result.contents[0]._meta,_=Object.keys(b).filter(y=>y.startsWith("openai/"));_.length>0&&(p=[...p,..._]),!h&&b["openai/outputTemplate"]&&(h=b["openai/outputTemplate"]),!h&&t.uri&&t.uri.startsWith("ui://widget/")&&(h=t.uri)}const g=!!(p.length>0&&h&&typeof h=="string"&&a&&n);if(e)return S.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:S.jsx(Ui,{className:"size-5"})});if(!t)return S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),S.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});if(t.error)return S.jsx("div",{className:"p-4",children:S.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[S.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),S.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:t.error})]})});const v=t?.result?.contents&&Array.isArray(t.result.contents)&&t.result.contents.some(b=>b.mimeType&&Ql(b)),w=v?t.result.contents.filter(b=>b.mimeType&&Ql(b)):[];return S.jsxs("div",{className:"flex flex-col h-full",children:[S.jsxs("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(hu,{className:"h-3 w-3 text-gray-400"}),S.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(t.timestamp).toLocaleTimeString()})]}),(()=>{const b=t?.duration??t.result?.duration??t.result?.metrics?.durationMs;return b!==void 0?S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),S.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[b,"ms"]})]}):null})(),v&&S.jsx(Ya,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 border-none border-purple-200 dark:border-purple-800/50 text-purple-600 dark:text-purple-400",children:"MCP UI"}),g&&S.jsx(Ya,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-900/20 border-none border-blue-200 dark:border-blue-800/50 text-blue-600 dark:text-blue-400",children:"OpenAI Widget"})]}),S.jsxs("div",{className:"flex items-center gap-1",children:[(v||g)&&S.jsxs(ct,{variant:"ghost",size:"sm",onClick:o,className:r?"":"text-purple-600 dark:text-purple-400",children:[r?S.jsx(Zte,{className:"h-4 w-4 mr-1"}):S.jsx($te,{className:"h-4 w-4 mr-1"}),r?"JSON":g?"Component":"Preview"]}),S.jsx(ct,{variant:"ghost",size:"sm",onClick:l,children:S.jsx(_a,{className:"h-4 w-4"})}),S.jsx(ct,{variant:"ghost",size:"sm",onClick:u,children:S.jsx(are,{className:"h-4 w-4"})}),S.jsx(ct,{variant:"ghost",size:"sm",onClick:c,children:S.jsx(Rre,{className:"h-4 w-4"})})]})]}),S.jsx("div",{className:"flex-1 overflow-y-auto",children:g&&a&&n&&h?r?S.jsx("div",{className:"flex-1 h-full",children:S.jsx(EN,{componentUrl:h,toolName:t.uri,toolArgs:{},toolResult:t.result,serverId:a,readResource:n,className:"w-full h-full relative flex p-4"})}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})}):v?r?S.jsxs("div",{className:"space-y-0 h-full",children:[w.map((b,_)=>S.jsx("div",{className:"mx-0 size-full",children:S.jsx("div",{className:"w-full h-full",children:S.jsx(g8,{resource:b,className:"w-full h-full"})})},`mcp-ui-${b.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(t.result.contents&&Array.isArray(t.result.contents)){const b=t.result.contents.filter(_=>!(_.mimeType&&Ql(_)));if(b.length>0)return S.jsx("div",{className:"px-4",children:S.jsx(Sa,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(b,null,2)})})}return null})()]}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})})})]})}function C_e(t,e){if(!t&&!e)return S.jsx(mre,{className:"h-5 w-5"});const r=(t||e||"").toLowerCase();return r.includes("image")?S.jsx(fre,{className:"h-5 w-5"}):r.includes("json")||r.includes("javascript")||r.includes("typescript")?S.jsx(cre,{className:"h-5 w-5"}):r.includes("html")||r.includes("xml")?S.jsx(bre,{className:"h-5 w-5"}):r.includes("database")||r.includes("sql")?S.jsx(qm,{className:"h-5 w-5"}):S.jsx(XC,{className:"h-5 w-5"})}function N_e({resources:t,selectedResource:e,onResourceSelect:r,focusedIndex:a}){return t.length===0?S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx(qm,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),S.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):S.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,o)=>{const l=C_e(n.mimeType,n.uri),u=[n.description,n.mimeType&&S.jsx("span",{className:"font-mono",children:n.mimeType},"mime")].filter(Boolean);return S.jsx(uf,{id:`resource-${n.uri}`,isSelected:e?.uri===n.uri,isFocused:a===o,icon:l,title:n.name,description:u.length>0?S.jsxs("span",{className:"flex flex-col gap-1",children:[n.description&&S.jsx("span",{children:n.description}),n.mimeType&&S.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:n.mimeType})]}):void 0,onClick:()=>r(n)},n.uri)})})}function k_e({isSearchExpanded:t,searchQuery:e,filteredResourcesCount:r,onSearchExpand:a,onSearchChange:n,onSearchBlur:o,searchInputRef:l}){return S.jsx("div",{className:"flex items-center justify-between p-4 py-3 border-r dark:border-zinc-700",children:S.jsx("div",{className:"flex items-center gap-2 flex-1",children:t?S.jsx(Mr,{ref:l,placeholder:"Search resources...",value:e,onChange:u=>n(u.target.value),onBlur:o,className:"h-8 border-gray-300 dark:border-zinc-600"}):S.jsxs(S.Fragment,{children:[S.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),S.jsx(Ya,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:r}),S.jsxs(rn,{children:[S.jsx(nn,{asChild:!0,children:S.jsx(ct,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:S.jsx(JC,{className:"h-4 w-4"})})}),S.jsxs(an,{side:"bottom",className:"flex gap-2",children:["Search",S.jsx(p8,{children:"F"})]})]})]})})})}function v8({ref:t,resources:e,readResource:r,serverId:a,isConnected:n}){const[o,l]=R.useState(null),{selectedResourceUri:u,setSelectedResourceUri:c}=tf(),[f,p]=R.useState(null),[h,g]=R.useState(!1),[v,w]=R.useState(""),[b]=R.useState("resources"),[_,y]=R.useState(!0),[E,x]=R.useState(!1),[T,C]=R.useState(-1),N=R.useRef(null),O=R.useRef(null);R.useImperativeHandle(t,()=>({focusSearch:()=>{x(!0),setTimeout(()=>{N.current&&N.current.focus()},0)},blurSearch:()=>{w(""),x(!1),N.current&&N.current.blur()}})),R.useEffect(()=>{E&&N.current&&N.current.focus()},[E]);const I=R.useCallback(()=>{v.trim()||x(!1)},[v]),M=R.useMemo(()=>{if(!v)return e;const ee=v.toLowerCase();return e.filter(ne=>ne.name.toLowerCase().includes(ee)||ne.description?.toLowerCase().includes(ee)||ne.uri.toLowerCase().includes(ee))},[e,v]),D=R.useCallback(async ee=>{if(l(ee),n){g(!0);const ne=Date.now();try{const F=await r(ee.uri);Br.getInstance().capture(new $j({resourceUri:ee.uri,serverId:a,success:!0})).catch(()=>{}),p({uri:ee.uri,result:F,timestamp:ne,resourceAnnotations:ee.annotations})}catch(F){Br.getInstance().capture(new $j({resourceUri:ee.uri,serverId:a,success:!1,error:F instanceof Error?F.message:"Unknown error"})).catch(()=>{}),p({uri:ee.uri,result:null,error:F instanceof Error?F.message:"Unknown error",timestamp:ne,resourceAnnotations:ee.annotations})}finally{g(!1)}}},[r,a,n]);R.useEffect(()=>{C(-1)},[v,b]),R.useEffect(()=>{const ee=ne=>{const F=ne.target;if(F.tagName==="INPUT"||F.tagName==="TEXTAREA"||F.contentEditable==="true"||ne.metaKey||ne.ctrlKey||ne.altKey)return;const H=M;if(ne.key==="ArrowDown")ne.preventDefault(),C(Q=>{const ae=Q+1;return ae>=H.length?0:ae});else if(ne.key==="ArrowUp")ne.preventDefault(),C(Q=>{const ae=Q-1;return ae<0?H.length-1:ae});else if(ne.key==="Enter"&&T>=0){ne.preventDefault();const Q=M[T];Q&&D(Q)}};return document.addEventListener("keydown",ee),()=>document.removeEventListener("keydown",ee)},[T,M,D]),R.useEffect(()=>{if(T>=0){const ee=`resource-${M[T]?.uri}`,ne=document.getElementById(ee);ne&&ne.scrollIntoView({behavior:"smooth",block:"nearest"})}},[T,M]),R.useEffect(()=>{if(u&&e.length>0){const ee=e.find(ne=>ne.uri===u);ee&&o?.uri!==ee.uri&&(c(null),setTimeout(()=>{D(ee);const ne=document.getElementById(`resource-${ee.uri}`);ne&&ne.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[u,e,o,D,c]);const $=R.useCallback(async()=>{if(f)try{await navigator.clipboard.writeText(JSON.stringify(f.result,null,2))}catch(ee){console.error("[ResourcesTab] Failed to copy result:",ee)}},[f]),G=R.useCallback(()=>{if(f)try{const ee=new globalThis.Blob([JSON.stringify(f.result,null,2)],{type:"application/json"}),ne=URL.createObjectURL(ee),F=document.createElement("a");F.href=ne,F.download=`resource-${Date.now()}.json`,document.body.appendChild(F),F.click(),document.body.removeChild(F),URL.revokeObjectURL(ne)}catch(ee){console.error("[ResourcesTab] Failed to download result:",ee)}},[f]),V=R.useCallback(async()=>{if(O.current)try{document.fullscreenElement?await document.exitFullscreen():await O.current.requestFullscreen()}catch(ee){console.error("[ResourcesTab] Failed to toggle fullscreen:",ee)}},[]);return S.jsxs(Ld,{direction:"horizontal",className:"h-full",children:[S.jsxs(Ba,{defaultSize:25,children:[S.jsx(k_e,{activeTab:b,isSearchExpanded:E,searchQuery:v,filteredResourcesCount:M.length,onSearchExpand:()=>x(!0),onSearchChange:w,onSearchBlur:I,onTabSwitch:()=>{},searchInputRef:N}),S.jsx("div",{className:"flex flex-col h-full",children:S.jsx(N_e,{resources:M,selectedResource:o,onResourceSelect:D,focusedIndex:T})})]}),S.jsx(Md,{}),S.jsx(Ba,{defaultSize:50,children:S.jsx("div",{ref:O,className:"h-full bg-white dark:bg-zinc-900",children:S.jsx(A_e,{result:f,isLoading:h,previewMode:_,serverId:a,readResource:r,onTogglePreview:()=>y(!_),onCopy:$,onDownload:G,onFullscreen:V})})})]})}v8.displayName="ResourcesTab";function O_e({savedRequests:t,selectedRequest:e,onLoadRequest:r,onDeleteRequest:a,focusedIndex:n}){if(t.length===0)return S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx(qm,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),S.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),S.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const o=(l,u)=>{l.stopPropagation(),u()};return S.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((l,u)=>S.jsxs("div",{className:"relative group",children:[S.jsx(uf,{id:`saved-${l.id}`,isSelected:e?.id===l.id,isFocused:n===u,icon:S.jsx(YH,{className:"h-4 w-4"}),title:l.name,description:l.toolName,metadata:S.jsx("div",{className:"flex flex-col gap-1",children:S.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(l.savedAt).toLocaleString()})}),onClick:()=>r(l)}),S.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:S.jsxs(rn,{children:[S.jsx(nn,{asChild:!0,children:S.jsx(ct,{variant:"secondary",size:"sm",onClick:c=>o(c,()=>a(l.id)),className:"h-8 w-8 p-0",children:S.jsx(mA,{className:"h-4 w-4"})})}),S.jsx(an,{children:S.jsx("p",{children:"Delete saved request"})})]})})]},l.id))})}function I_e({isOpen:t,requestName:e,defaultPlaceholder:r,onRequestNameChange:a,onSave:n,onCancel:o}){return t?S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:o,children:S.jsxs("div",{className:"bg-white dark:bg-zinc-800 rounded-lg p-6 w-[400px] shadow-xl border border-gray-200 dark:border-zinc-700",onClick:l=>l.stopPropagation(),children:[S.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{children:[S.jsx(pr,{htmlFor:"request-name",children:"Request Name (optional)"}),S.jsx(Mr,{id:"request-name",value:e,onChange:l=>a(l.target.value),placeholder:r,className:"mt-2",onKeyDown:l=>{l.key==="Enter"&&n()},autoFocus:!0})]}),S.jsxs("div",{className:"flex justify-end gap-2",children:[S.jsx(ct,{variant:"outline",onClick:o,children:"Cancel"}),S.jsxs(ct,{onClick:n,children:[S.jsx(QC,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function D_e({selectedTool:t,toolArgs:e,onArgChange:r}){const a=t?.inputSchema?.properties||{},n=t?.inputSchema?.required||[];return Object.keys(a).length>0?S.jsx("div",{className:"space-y-4",children:Object.entries(a).map(([l,u])=>{const c=u;c.required=n.includes(l);const f=e[l];let p="";return f!=null&&(typeof f=="string"?p=f:p=JSON.stringify(f,null,2)),c.type==="object"||c.type==="array"||typeof f=="object"&&f!==null?S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:l,className:"text-sm font-medium",children:[l,c?.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsx(pg,{id:l,value:p,onChange:h=>r(l,h.target.value),placeholder:c?.description||`Enter ${l}`,className:"min-h-[100px]"}),c?.description&&S.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:c.description})]},l):S.jsxs("div",{className:"space-y-2",children:[S.jsxs(pr,{htmlFor:l,className:"text-sm font-medium",children:[l,c?.required&&S.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),S.jsx(Mr,{id:l,value:p,onChange:h=>r(l,h.target.value),placeholder:c?.description||`Enter ${l}`}),c?.description&&S.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:c.description})]},l)})}):S.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function L_e({selectedTool:t,toolArgs:e,isExecuting:r,isConnected:a,onArgChange:n,onExecute:o,onSave:l}){return t?S.jsxs("div",{className:"flex flex-col h-full",children:[S.jsx("div",{className:"flex-shrink-0 p-6 pt-3 pb-4 pr-3",children:S.jsxs("div",{children:[S.jsxs("div",{className:"flex items-center justify-between mb-0",children:[S.jsx("h3",{className:"text-lg font-semibold mb-2",children:t.name}),S.jsxs("div",{className:"flex gap-2",children:[S.jsx(ct,{onClick:o,disabled:r||!a,children:r?S.jsxs(S.Fragment,{children:[S.jsx(Ui,{className:"mr-2"}),"Executing..."]}):S.jsxs(S.Fragment,{children:[S.jsx(ZH,{className:"h-4 w-4 mr-2"}),"Execute"]})}),S.jsxs(ct,{variant:"outline",onClick:l,disabled:r,className:"gap-2",children:[S.jsx(QC,{className:"h-4 w-4"}),"Save"]})]})]}),t.description&&S.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed",children:t.description})]})}),S.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4 pr-3",children:S.jsx(D_e,{selectedTool:t,toolArgs:e,onArgChange:n})})]}):S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),S.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a tool from the list to view its details and execute it"})]})}function M_e({results:t,copiedResult:e,previewMode:r,serverId:a,readResource:n,onCopy:o,onTogglePreview:l}){const{prismStyle:u}=Eg();return S.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:S.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?S.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((c,f)=>{const p=c.toolMeta?.["openai/outputTemplate"],h=!!(p&&typeof p=="string"&&c.appsSdkResource),g=p,v=c.result?.content||[],w=v.filter(_=>_.type==="resource"&&Ql(_.resource)),b=w.length>0;return S.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[S.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${b||h?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[S.jsx("h3",{className:"text-sm font-medium",children:"Response"}),S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(hu,{className:"h-3 w-3 text-gray-400"}),S.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(c.timestamp).toLocaleTimeString()})]}),c.duration!==void 0&&S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx(Ed,{className:"h-3 w-3 text-gray-400"}),S.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[c.duration,"ms"]})]}),h&&S.jsxs("div",{className:"flex items-center gap-4 ml-4",children:[S.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["URI: ",g||"No URI"]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),S.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),S.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),b&&!h&&S.jsxs("div",{className:"flex items-center gap-4 ml-4",children:[S.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["URI: ",w[0]?.resource?.uri||"No URI"]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),S.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),S.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),S.jsx(ct,{variant:"ghost",size:"sm",onClick:()=>o(f,c.result),className:"ml-auto",children:e===f?S.jsx(Oo,{className:"h-4 w-4"}):S.jsx(_a,{className:"h-4 w-4"})})]}),c.error?S.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[S.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),S.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:c.error})]}):(()=>{if(h){const _=c.appsSdkResource;return _.isLoading?S.jsx(S.Fragment,{}):_.error?S.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[S.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),S.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:_.error})]}):r?S.jsx("div",{className:"flex-1",children:S.jsx(EN,{componentUrl:g,toolName:c.toolName,toolArgs:c.args,toolResult:c.result,resource:_.resourceData,serverId:a,readResource:n,className:"w-full h-full relative p-4"})}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:u,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(c.result,null,2)})})}return b?r?S.jsxs("div",{className:"space-y-0 h-full",children:[w.map((_,y)=>S.jsx("div",{className:"mx-0 size-full",children:S.jsx(g8,{resource:_.resource,onUIAction:E=>{},className:"w-full h-full relative"})},y)),v.filter(_=>!(_.type==="resource"&&Ql(_.resource))).length>0&&S.jsx("div",{className:"px-4",children:S.jsx(Sa,{language:"json",style:u,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(v.filter(_=>!(_.type==="resource"&&Ql(_.resource))),null,2)})})]}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:u,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(c.result,null,2)})}):S.jsx("div",{className:"px-4 pt-4",children:S.jsx(Sa,{language:"json",style:u,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(c.result,null,2)})})})()]},f)})}):S.jsx("div",{className:"flex items-center justify-center h-full",children:S.jsx("div",{className:"text-center",children:S.jsx(r1,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function P_e({tools:t,selectedTool:e,onToolSelect:r,focusedIndex:a}){return t.length===0?S.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[S.jsx(Ns,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),S.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):S.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,o)=>S.jsx(uf,{id:`tool-${n.name}`,isSelected:e?.name===n.name,isFocused:a===o,icon:S.jsx(Ns,{className:"h-4 w-4"}),title:n.name,description:n.description,metadata:n.inputSchema?.properties&&S.jsxs(Ya,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[Object.keys(n.inputSchema.properties).length," params"]}),onClick:()=>r(n)},n.name))})}function j_e({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredToolsCount:a,savedRequestsCount:n,onSearchExpand:o,onSearchChange:l,onSearchBlur:u,onTabSwitch:c,searchInputRef:f}){return S.jsx(h8,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:a,secondaryCount:n,primaryIcon:Ns,secondaryIcon:qm,searchPlaceholder:"Search tools...",onSearchExpand:o,onSearchChange:l,onSearchBlur:u,onTabSwitch:c,searchInputRef:f})}const Wq="mcp-inspector-saved-requests";function y8({ref:t,tools:e,callTool:r,readResource:a,serverId:n,isConnected:o}){const[l,u]=R.useState(null),[c,f]=R.useState(null),{selectedToolName:p,setSelectedToolName:h}=tf(),[g,v]=R.useState({}),[w,b]=R.useState([]),[_,y]=R.useState(!1),[E,x]=R.useState(null),[T,C]=R.useState(""),[N,O]=R.useState("tools"),[I,M]=R.useState([]),[D,$]=R.useState(!1),[G,V]=R.useState(""),[ee,ne]=R.useState(!0),[F,z]=R.useState(!1),[H,Q]=R.useState(-1),ae=R.useRef(null);R.useImperativeHandle(t,()=>({focusSearch:()=>{z(!0),setTimeout(()=>{ae.current&&ae.current.focus()},0)},blurSearch:()=>{C(""),z(!1),ae.current&&ae.current.blur()}})),R.useEffect(()=>{try{const pe=localStorage.getItem(Wq);pe&&M(JSON.parse(pe))}catch(pe){console.error("[ToolsTab] Failed to load saved requests:",pe)}},[]);const W=R.useCallback(pe=>{try{localStorage.setItem(Wq,JSON.stringify(pe)),M(pe)}catch(Te){console.error("[ToolsTab] Failed to save requests:",Te)}},[]),Y=R.useMemo(()=>{if(!T.trim())return e;const pe=T.toLowerCase();return e.filter(Te=>Te.name.toLowerCase().includes(pe)||Te.description?.toLowerCase().includes(pe))},[e,T]),K=R.useCallback(pe=>{u(pe);const Te={};pe.inputSchema?.properties&&Object.entries(pe.inputSchema.properties).forEach(([Ce,ve])=>{const Me=ve;Me.default!==void 0?Te[Ce]=Me.default:Me.type==="string"?Te[Ce]="":Me.type==="number"?Te[Ce]=0:Me.type==="boolean"?Te[Ce]=!1:Me.type==="array"?Te[Ce]=[]:Me.type==="object"&&(Te[Ce]={})}),v(Te)},[]),te=R.useCallback(pe=>{const Te=e.find(Ce=>Ce.name===pe.toolName);Te&&(u(Te),v(pe.args),f(pe))},[e]);R.useEffect(()=>{F&&ae.current&&ae.current.focus()},[F]);const ie=R.useCallback(()=>{T.trim()||z(!1)},[T]);R.useEffect(()=>{N!=="tools"&&z(!1)},[N]),R.useEffect(()=>{Q(-1)},[T,N]),R.useEffect(()=>{const pe=Te=>{const Ce=Te.target;if(Ce.tagName==="INPUT"||Ce.tagName==="TEXTAREA"||Ce.contentEditable==="true"||Te.metaKey||Te.ctrlKey||Te.altKey)return;const Me=N==="tools"?Y:I;if(Te.key==="ArrowDown")Te.preventDefault(),Q(Be=>{const De=Be+1;return De>=Me.length?0:De});else if(Te.key==="ArrowUp")Te.preventDefault(),Q(Be=>{const De=Be-1;return De<0?Me.length-1:De});else if(Te.key==="Enter"&&H>=0)if(Te.preventDefault(),N==="tools"){const Be=Y[H];Be&&K(Be)}else{const Be=I[H];Be&&te(Be)}};return document.addEventListener("keydown",pe),()=>document.removeEventListener("keydown",pe)},[H,Y,I,N,K,te]),R.useEffect(()=>{if(H>=0){const pe=N==="tools"?`tool-${Y[H]?.name}`:`saved-${I[H]?.id}`,Te=document.getElementById(pe);Te&&Te.scrollIntoView({behavior:"smooth",block:"nearest"})}},[H,Y,I,N]),R.useEffect(()=>{if(p&&e.length>0){const pe=e.find(Te=>Te.name===p);if(pe&&l?.name!==pe.name){h(null);const Te=setTimeout(()=>{K(pe);const Ce=document.getElementById(`tool-${pe.name}`);Ce&&Ce.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(Te)}}},[p,e,l,K,h]);const P=R.useCallback((pe,Te)=>{v(Ce=>{const ve={...Ce};if(l?.inputSchema?.properties?.[pe])if(l.inputSchema.properties[pe].type==="string")ve[pe]=Te;else try{ve[pe]=JSON.parse(Te)}catch{ve[pe]=Te}else try{ve[pe]=JSON.parse(Te)}catch{ve[pe]=Te}return ve})},[l]),U=R.useCallback(async()=>{if(!l||_)return;y(!0);const pe=Date.now();try{const Te=await r(l.name,g),Ce=Date.now()-pe;Br.getInstance().capture(new Bj({toolName:l.name,serverId:n,success:!0,duration:Ce})).catch(()=>{});const Me=l?._meta||l?.metadata,Be=Me?.["openai/outputTemplate"];let De;if(Be&&typeof Be=="string"){const Pe={toolName:l.name,args:g,result:Te,timestamp:pe,duration:Ce,toolMeta:Me,appsSdkResource:{uri:Be,resourceData:null,isLoading:!0}};b([Pe]);try{const Le=await a(Be);let $e=null;if(Te?.structuredContent)$e=Te.structuredContent;else if(Array.isArray(Te)&&Te[0]){const We=Te[0];We.output?.value?.structuredContent?$e=We.output.value.structuredContent:We.structuredContent?$e=We.structuredContent:We.output?.value&&($e=We.output.value)}$e||($e=Te),De={uri:Be,resourceData:{...Le,structuredContent:$e},isLoading:!1}}catch(Le){De={uri:Be,resourceData:null,isLoading:!1,error:Le instanceof Error?Le.message:String(Le)}}b(Le=>Le.map(($e,We)=>We===0?{...$e,appsSdkResource:De}:$e))}else b(Pe=>[{toolName:l.name,args:g,result:Te,timestamp:pe,duration:Ce,toolMeta:Me},...Pe])}catch(Te){const Ce=Date.now()-pe;Br.getInstance().capture(new Bj({toolName:l.name,serverId:n,success:!1,duration:Ce,error:Te instanceof Error?Te.message:String(Te)})).catch(()=>{});const Me=l?._meta||l?.metadata,Be={toolName:l.name,args:g,result:null,error:Te instanceof Error?Te.message:String(Te),timestamp:pe,duration:Ce,toolMeta:Me},De=Me?.["openai/outputTemplate"];b(De?[Be]:Pe=>[Be,...Pe])}finally{y(!1)}},[l,g,_,r,a,n]),X=R.useCallback(async(pe,Te)=>{try{await navigator.clipboard.writeText(JSON.stringify(Te,null,2)),x(pe),setTimeout(()=>x(null),2e3)}catch(Ce){console.error("[ToolsTab] Failed to copy result:",Ce)}},[]),le=R.useCallback(pe=>{b(Te=>Te.filter((Ce,ve)=>ve!==pe))},[]),oe=R.useCallback(pe=>{const Te=w[pe];if(Te){const Ce=window.open("","_blank","width=800,height=600");Ce&&(Ce.document.write(`
1762
1762
  <html>
1763
1763
  <head>
1764
1764
  <title>${Te.toolName} Result</title>