vibepulse 0.1.3 → 0.1.4

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.
Files changed (89) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/cache/.previewinfo +1 -1
  4. package/.next/cache/.rscinfo +1 -1
  5. package/.next/cache/config.json +3 -3
  6. package/.next/fallback-build-manifest.json +2 -2
  7. package/.next/prerender-manifest.json +3 -3
  8. package/.next/server/app/_global-error.html +2 -2
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/server/app/index.html +1 -1
  24. package/.next/server/app/index.rsc +1 -1
  25. package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  26. package/.next/server/app/index.segments/_full.segment.rsc +1 -1
  27. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  28. package/.next/server/app/index.segments/_index.segment.rsc +1 -1
  29. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  30. package/.next/server/pages/404.html +1 -1
  31. package/.next/server/pages/500.html +2 -2
  32. package/.next/server/server-reference-manifest.js +1 -1
  33. package/.next/server/server-reference-manifest.json +1 -1
  34. package/.next/standalone/.next/BUILD_ID +1 -1
  35. package/.next/standalone/.next/build-manifest.json +2 -2
  36. package/.next/standalone/.next/prerender-manifest.json +3 -3
  37. package/.next/standalone/.next/server/app/_global-error.html +2 -2
  38. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  39. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  40. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  41. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  42. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  43. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  44. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  45. package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  46. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  47. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  48. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  49. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  50. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  51. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  52. package/.next/standalone/.next/server/app/index.html +1 -1
  53. package/.next/standalone/.next/server/app/index.rsc +1 -1
  54. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  55. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  56. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  57. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  58. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  59. package/.next/standalone/.next/server/pages/404.html +1 -1
  60. package/.next/standalone/.next/server/pages/500.html +2 -2
  61. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  62. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  63. package/.next/standalone/.next/static/chunks/1b6041c1a56c6903.js +14 -0
  64. package/.next/standalone/.next/static/chunks/2b88a212f25cfb8c.js +5 -0
  65. package/.next/standalone/.next/static/chunks/2f236954d6a65e12.js +1 -0
  66. package/.next/standalone/.next/static/chunks/4ea83956c15c04d4.js +1 -0
  67. package/.next/standalone/.next/static/chunks/a6dad97d9634a72d.js +1 -0
  68. package/.next/standalone/.next/static/chunks/a6dad97d9634a72d.js.map +1 -0
  69. package/.next/standalone/.next/static/chunks/c39637bc9d8cb116.js +1 -0
  70. package/.next/standalone/.next/static/chunks/d454a03c72a6bd1e.css +3 -0
  71. package/.next/standalone/.next/static/chunks/f2f58a7e93290fbb.js +1 -0
  72. package/.next/standalone/.next/static/chunks/turbopack-f929be99d0f2b8fe.js +4 -0
  73. package/.next/standalone/.next/static/media/4fa387ec64143e14-s.c1fdd6c2.woff2 +0 -0
  74. package/.next/standalone/.next/static/media/7178b3e590c64307-s.b97b3418.woff2 +0 -0
  75. package/.next/standalone/.next/static/media/797e433ab948586e-s.p.dbea232f.woff2 +0 -0
  76. package/.next/standalone/.next/static/media/8a480f0b521d4e75-s.8e0177b5.woff2 +0 -0
  77. package/.next/standalone/.next/static/media/bbc41e54d2fcbd21-s.799d8ef8.woff2 +0 -0
  78. package/.next/standalone/.next/static/media/caa3a2e1cccd8315-s.p.853070df.woff2 +0 -0
  79. package/.next/standalone/.next/static/media/favicon.0b3bf435.ico +0 -0
  80. package/.next/standalone/package.json +1 -1
  81. package/.next/static/NL1TPpfjInCfRsfIRT9Gu/_buildManifest.js +11 -0
  82. package/.next/static/NL1TPpfjInCfRsfIRT9Gu/_clientMiddlewareManifest.json +1 -0
  83. package/.next/static/NL1TPpfjInCfRsfIRT9Gu/_ssgManifest.js +1 -0
  84. package/.next/trace +1 -1
  85. package/.next/trace-build +1 -1
  86. package/package.json +1 -1
  87. /package/.next/{static/f7tH1b_QStK8T4Ubih8bn → standalone/.next/static/NL1TPpfjInCfRsfIRT9Gu}/_buildManifest.js +0 -0
  88. /package/.next/{static/f7tH1b_QStK8T4Ubih8bn → standalone/.next/static/NL1TPpfjInCfRsfIRT9Gu}/_clientMiddlewareManifest.json +0 -0
  89. /package/.next/{static/f7tH1b_QStK8T4Ubih8bn → standalone/.next/static/NL1TPpfjInCfRsfIRT9Gu}/_ssgManifest.js +0 -0
@@ -0,0 +1,14 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,52683,e=>{"use strict";let t,r,n;var a,s,i,l,o,c,d,u,m=e.i(43476),f=e.i(71645),p=e.i(75555),h=e.i(40143),x=e.i(86491),g=e.i(15823),b=e.i(93803),y=e.i(19273),v=e.i(80166),w=class extends g.Subscribable{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#r=(0,b.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#e;#n=void 0;#a=void 0;#s=void 0;#i;#l;#r;#t;#o;#c;#d;#u;#m;#f;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#n.addObserver(this),k(this.#n,this.options)?this.#h():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return j(this.#n,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return j(this.#n,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#b(),this.#n.removeObserver(this)}setOptions(e){let t=this.options,r=this.#n;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,y.resolveEnabled)(this.options.enabled,this.#n))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#y(),this.#n.setOptions(this.options),t._defaulted&&!(0,y.shallowEqualObjects)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#n,observer:this});let n=this.hasListeners();n&&z(this.#n,r,this.options,t)&&this.#h(),this.updateResult(),n&&(this.#n!==r||(0,y.resolveEnabled)(this.options.enabled,this.#n)!==(0,y.resolveEnabled)(t.enabled,this.#n)||(0,y.resolveStaleTime)(this.options.staleTime,this.#n)!==(0,y.resolveStaleTime)(t.staleTime,this.#n))&&this.#v();let a=this.#w();n&&(this.#n!==r||(0,y.resolveEnabled)(this.options.enabled,this.#n)!==(0,y.resolveEnabled)(t.enabled,this.#n)||a!==this.#f)&&this.#k(a)}getOptimisticResult(e){var t,r;let n=this.#e.getQueryCache().build(this.#e,e),a=this.createResult(n,e);return t=this,r=a,(0,y.shallowEqualObjects)(t.getCurrentResult(),r)||(this.#s=a,this.#l=this.options,this.#i=this.#n.state),a}getCurrentResult(){return this.#s}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#r.status||this.#r.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#n}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#h(e){this.#y();let t=this.#n.fetch(this.options,e);return e?.throwOnError||(t=t.catch(y.noop)),t}#v(){this.#g();let e=(0,y.resolveStaleTime)(this.options.staleTime,this.#n);if(y.isServer||this.#s.isStale||!(0,y.isValidTimeout)(e))return;let t=(0,y.timeUntilStale)(this.#s.dataUpdatedAt,e);this.#u=v.timeoutManager.setTimeout(()=>{this.#s.isStale||this.updateResult()},t+1)}#w(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#n):this.options.refetchInterval)??!1}#k(e){this.#b(),this.#f=e,!y.isServer&&!1!==(0,y.resolveEnabled)(this.options.enabled,this.#n)&&(0,y.isValidTimeout)(this.#f)&&0!==this.#f&&(this.#m=v.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||p.focusManager.isFocused())&&this.#h()},this.#f))}#x(){this.#v(),this.#k(this.#w())}#g(){this.#u&&(v.timeoutManager.clearTimeout(this.#u),this.#u=void 0)}#b(){this.#m&&(v.timeoutManager.clearInterval(this.#m),this.#m=void 0)}createResult(e,t){let r,n=this.#n,a=this.options,s=this.#s,i=this.#i,l=this.#l,o=e!==n?e.state:this.#a,{state:c}=e,d={...c},u=!1;if(t._optimisticResults){let r=this.hasListeners(),s=!r&&k(e,t),i=r&&z(e,n,t,a);(s||i)&&(d={...d,...(0,x.fetchState)(c.data,e.options)}),"isRestoring"===t._optimisticResults&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:f,status:p}=d;r=d.data;let h=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===p){let e;s?.isPlaceholderData&&t.placeholderData===l?.placeholderData?(e=s.data,h=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#d?.state.data,this.#d):t.placeholderData,void 0!==e&&(p="success",r=(0,y.replaceData)(s?.data,e,t),u=!0)}if(t.select&&void 0!==r&&!h)if(s&&r===i?.data&&t.select===this.#o)r=this.#c;else try{this.#o=t.select,r=t.select(r),r=(0,y.replaceData)(s?.data,r,t),this.#c=r,this.#t=null}catch(e){this.#t=e}this.#t&&(m=this.#t,r=this.#c,f=Date.now(),p="error");let g="fetching"===d.fetchStatus,v="pending"===p,w="error"===p,j=v&&g,S=void 0!==r,C={status:p,fetchStatus:d.fetchStatus,isPending:v,isSuccess:"success"===p,isError:w,isInitialLoading:j,isLoading:j,data:r,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:f,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>o.dataUpdateCount||d.errorUpdateCount>o.errorUpdateCount,isFetching:g,isRefetching:g&&!v,isLoadingError:w&&!S,isPaused:"paused"===d.fetchStatus,isPlaceholderData:u,isRefetchError:w&&S,isStale:N(e,t),refetch:this.refetch,promise:this.#r,isEnabled:!1!==(0,y.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==C.data,r="error"===C.status&&!t,a=e=>{r?e.reject(C.error):t&&e.resolve(C.data)},s=()=>{a(this.#r=C.promise=(0,b.pendingThenable)())},i=this.#r;switch(i.status){case"pending":e.queryHash===n.queryHash&&a(i);break;case"fulfilled":(r||C.data!==i.value)&&s();break;case"rejected":r&&C.error===i.reason||s()}}return C}updateResult(){let e=this.#s,t=this.createResult(this.#n,this.options);if(this.#i=this.#n.state,this.#l=this.options,void 0!==this.#i.data&&(this.#d=this.#n),(0,y.shallowEqualObjects)(t,e))return;this.#s=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#p.size)return!0;let n=new Set(r??this.#p);return this.options.throwOnError&&n.add("error"),Object.keys(this.#s).some(t=>this.#s[t]!==e[t]&&n.has(t))};this.#j({listeners:r()})}#y(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#n)return;let t=this.#n;this.#n=e,this.#a=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#j(e){h.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#s)}),this.#e.getQueryCache().notify({query:this.#n,type:"observerResultsUpdated"})})}};function k(e,t){return!1!==(0,y.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&j(e,t,t.refetchOnMount)}function j(e,t,r){if(!1!==(0,y.resolveEnabled)(t.enabled,e)&&"static"!==(0,y.resolveStaleTime)(t.staleTime,e)){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&N(e,t)}return!1}function z(e,t,r,n){return(e!==t||!1===(0,y.resolveEnabled)(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&N(e,r)}function N(e,t){return!1!==(0,y.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,y.resolveStaleTime)(t.staleTime,e))}e.i(47167);var S=e.i(12598),C=f.createContext((r=!1,{clearReset:()=>{r=!1},reset:()=>{r=!0},isReset:()=>r})),E=f.createContext(!1);E.Provider;var R=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function A(e,t){return function(e,t,r){let n,a=f.useContext(E),s=f.useContext(C),i=(0,S.useQueryClient)(r),l=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(l);let o=i.getQueryCache().get(l.queryHash);if(l._optimisticResults=a?"isRestoring":"optimistic",l.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=l.staleTime;l.staleTime="function"==typeof t?(...r)=>e(t(...r)):e(t),"number"==typeof l.gcTime&&(l.gcTime=Math.max(l.gcTime,1e3))}n=o?.state.error&&"function"==typeof l.throwOnError?(0,y.shouldThrowError)(l.throwOnError,[o.state.error,o]):l.throwOnError,(l.suspense||l.experimental_prefetchInRender||n)&&!s.isReset()&&(l.retryOnMount=!1),f.useEffect(()=>{s.clearReset()},[s]);let c=!i.getQueryCache().get(l.queryHash),[d]=f.useState(()=>new t(i,l)),u=d.getOptimisticResult(l),m=!a&&!1!==e.subscribed;if(f.useSyncExternalStore(f.useCallback(e=>{let t=m?d.subscribe(h.notifyManager.batchCalls(e)):y.noop;return d.updateResult(),t},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),f.useEffect(()=>{d.setOptions(l)},[l,d]),l?.suspense&&u.isPending)throw R(l,d,s);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&void 0===e.data||(0,y.shouldThrowError)(r,[e.error,n])))({result:u,errorResetBoundary:s,throwOnError:l.throwOnError,query:o,suspense:l.suspense}))throw u.error;if(i.getDefaultOptions().queries?._experimental_afterQuery?.(l,u),l.experimental_prefetchInRender&&!y.isServer&&u.isLoading&&u.isFetching&&!a){let e=c?R(l,d,s):o?.promise;e?.catch(y.noop).finally(()=>{d.updateResult()})}return l.notifyOnChangeProps?u:d.trackResult(u)}(e,w,t)}function T(e){let t=Date.now()-e,r=Math.floor(t/6e4),n=Math.floor(t/36e5),a=Math.floor(t/864e5);return r<1?"<1m":n<1?`${r}m`:a<1?`${n}h`:`${a}d`}function O({status:e,waitingForUser:t}){if(t)return(0,m.jsxs)("span",{className:"relative flex h-2 w-2 flex-shrink-0",title:"Waiting",children:[(0,m.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-amber-400 opacity-75"}),(0,m.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-amber-500"})]});switch(e){case"busy":return(0,m.jsxs)("span",{className:"relative flex h-2 w-2 flex-shrink-0",title:"Running",children:[(0,m.jsx)("span",{className:"animate-pulse absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,m.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]});case"retry":return(0,m.jsxs)("span",{className:"relative flex h-2 w-2 flex-shrink-0",title:"Retrying",children:[(0,m.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),(0,m.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-red-500"})]});default:return(0,m.jsx)("span",{className:"inline-flex rounded-full h-2 w-2 bg-gray-400 flex-shrink-0",title:"Idle"})}}function M({cards:e,readOnly:t=!1}){let r=(0,S.useQueryClient)(),[n,a]=(0,f.useState)(!1),s=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!n)return;let e=e=>{s.current&&!s.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n]);let i=e.some(e=>"done"!==e.status),l=async t=>{t.stopPropagation();let n=e.filter(e=>"done"!==e.status);await Promise.all(n.map(e=>fetch(`/api/sessions/${e.id}/archive`,{method:"POST"}))),a(!1),r.invalidateQueries({queryKey:["sessions"]})},o=async t=>{t.stopPropagation(),confirm(`Delete ${e.length} session(s)? This cannot be undone.`)&&(await Promise.all(e.map(e=>fetch(`/api/sessions/${e.id}/delete`,{method:"POST"}))),a(!1),r.invalidateQueries({queryKey:["sessions"]}))};return t?null:(0,m.jsxs)("div",{className:"relative",ref:s,children:[(0,m.jsx)("button",{type:"button",className:"w-5 h-5 flex items-center justify-center rounded text-gray-400 hover:text-gray-600 hover:bg-gray-200 dark:text-gray-500 dark:hover:text-gray-300 dark:hover:bg-zinc-600 transition-colors",onClick:e=>{e.stopPropagation(),a(!n)},title:"Batch actions",children:(0,m.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,m.jsx)("path",{d:"M5 10a2 2 0 110 4 2 2 0 010-4zm7 0a2 2 0 110 4 2 2 0 010-4zm7 0a2 2 0 110 4 2 2 0 010-4z"})})}),n&&(0,m.jsxs)("div",{className:"absolute right-0 top-6 w-32 rounded-md border border-gray-200 bg-white shadow-lg dark:border-zinc-700 dark:bg-zinc-900 z-20",children:[i&&(0,m.jsx)("button",{type:"button",className:"w-full text-left px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-50 dark:text-gray-200 dark:hover:bg-zinc-800",onClick:l,children:"Archive all"}),(0,m.jsx)("button",{type:"button",className:"w-full text-left px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20",onClick:o,children:"Delete all"})]})]})}function F({cardId:e,archived:t}){let r=(0,S.useQueryClient)(),[n,a]=(0,f.useState)(!1),s=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!n)return;let e=e=>{s.current&&!s.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n]);let i=async t=>{t.stopPropagation();try{await fetch(`/api/sessions/${e}/archive`,{method:"POST"})}finally{a(!1),r.invalidateQueries({queryKey:["sessions"]})}},l=async t=>{t.stopPropagation();try{await fetch(`/api/sessions/${e}/delete`,{method:"POST"})}finally{a(!1),r.invalidateQueries({queryKey:["sessions"]})}};return(0,m.jsxs)("div",{className:"relative flex-shrink-0",ref:s,children:[(0,m.jsx)("button",{type:"button",className:"w-5 h-5 flex items-center justify-center rounded text-gray-400 hover:text-gray-600 hover:bg-gray-200 dark:text-gray-500 dark:hover:text-gray-300 dark:hover:bg-zinc-600 transition-colors",onClick:e=>{e.stopPropagation(),a(!n)},title:"Actions",children:(0,m.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,m.jsx)("path",{d:"M5 10a2 2 0 110 4 2 2 0 010-4zm7 0a2 2 0 110 4 2 2 0 010-4zm7 0a2 2 0 110 4 2 2 0 010-4z"})})}),n&&(0,m.jsxs)("div",{className:"absolute right-0 top-6 w-28 rounded-md border border-gray-200 bg-white shadow-lg dark:border-zinc-700 dark:bg-zinc-900 z-20",children:[t?null:(0,m.jsx)("button",{type:"button",className:"w-full text-left px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-50 dark:text-gray-200 dark:hover:bg-zinc-800",onClick:i,children:"Archive"}),(0,m.jsx)("button",{type:"button",className:"w-full text-left px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20",onClick:l,children:"Delete"})]})]})}function P({card:e,isLast:t,readOnly:r=!1}){let[n,a]=(0,f.useState)(!0),s=(e.children||[]).filter(e=>"idle"!==e.realTimeStatus||e.waitingForUser),i=s.length>0;return(0,m.jsxs)("div",{className:t?"":"border-b border-gray-50 dark:border-zinc-700/30",children:[(0,m.jsxs)("div",{className:"group/row flex items-center gap-2.5 px-3 py-2 hover:bg-gray-50 dark:hover:bg-zinc-700/30 transition-colors",title:`${e.title||"Untitled Session"}
2
+ Active ${T(e.updatedAt)} ago \xb7 Started ${T(e.createdAt)} ago`,children:[i&&(0,m.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),a(!n)},className:"w-3 h-3 flex items-center justify-center text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 flex-shrink-0 transition-transform",title:n?"Collapse subagents":"Expand subagents",children:(0,m.jsx)("svg",{className:`w-2.5 h-2.5 transition-transform duration-150 ${n?"rotate-90":""}`,viewBox:"0 0 6 10",fill:"currentColor","aria-hidden":"true",children:(0,m.jsx)("path",{d:"M1 1l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,m.jsx)(O,{status:e.opencodeStatus,waitingForUser:e.waitingForUser}),(0,m.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate flex-1 min-w-0",children:e.title||"Untitled Session"}),i&&!n&&(0,m.jsxs)("span",{className:"text-[9px] font-medium text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-zinc-700 px-1 py-0.5 rounded flex-shrink-0",children:[s.length," sub"]}),(0,m.jsx)("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 flex-shrink-0 tabular-nums group-hover/row:hidden",children:T(e.updatedAt)}),r?null:(0,m.jsx)("div",{className:"hidden group-hover/row:flex flex-shrink-0",children:(0,m.jsx)(F,{cardId:e.id,archived:"done"===e.status})})]}),i&&n&&(0,m.jsx)("div",{className:"bg-gray-50/50 dark:bg-zinc-800/30",children:s.map((e,t)=>(0,m.jsxs)("div",{className:"flex items-center gap-2 pl-8 pr-3 py-1.5 hover:bg-gray-100/50 dark:hover:bg-zinc-700/20 transition-colors",title:e.title||"Subagent",children:[(0,m.jsx)("span",{className:"text-gray-300 dark:text-zinc-600 text-xs flex-shrink-0 font-mono leading-none",children:t===s.length-1?"└":"├"}),(0,m.jsx)(O,{status:e.realTimeStatus,waitingForUser:e.waitingForUser}),(0,m.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate flex-1 min-w-0",children:e.title||"Subagent"})]},e.id))})]})}function D({projectName:e,branch:t,cards:r,readOnly:n=!1}){let[a,s]=(0,f.useState)(()=>window.localStorage.getItem("vibepulse:open-tool")||"vscode"),[i]=(0,f.useState)(()=>{let e=window.localStorage.getItem("vibepulse:ssh-host");if(e)return e;let t=window.location.hostname;return t&&"localhost"!==t&&"127.0.0.1"!==t?t:""});return(0,m.jsxs)("article",{className:"w-full bg-white dark:bg-zinc-800 rounded-xl shadow-sm border border-gray-200 dark:border-zinc-700 hover:shadow-lg hover:border-gray-300 dark:hover:border-zinc-600 transition-all duration-200 overflow-visible",children:[(0,m.jsxs)("div",{className:"group/header flex items-center gap-2 px-3 py-2.5 hover:bg-gray-50 dark:hover:bg-zinc-700/30 transition-colors",children:[(0,m.jsx)("svg",{className:"w-4 h-4 text-blue-500 dark:text-blue-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,m.jsx)("span",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 truncate flex-1",children:e}),t&&(0,m.jsx)("span",{className:"text-[10px] bg-gray-100 dark:bg-zinc-700 text-gray-500 dark:text-gray-400 px-1.5 py-0.5 rounded flex-shrink-0",children:t}),r.length>1&&(0,m.jsx)("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 font-medium bg-gray-100 dark:bg-zinc-700 px-1.5 py-0.5 rounded-full flex-shrink-0",children:r.length}),!n&&(0,m.jsx)("div",{className:"hidden group-hover/header:flex flex-shrink-0",children:(0,m.jsx)(M,{cards:r,readOnly:n})})]}),(0,m.jsx)("div",{className:"border-t border-gray-100 dark:border-zinc-700/50",children:r.map((e,t)=>(0,m.jsx)(P,{card:e,isLast:t===r.length-1,readOnly:n},e.id))}),(0,m.jsxs)("div",{className:"flex items-center justify-end gap-1.5 px-3 py-1.5 border-t border-gray-100 dark:border-zinc-700/50 bg-gray-50/50 dark:bg-zinc-800/50",children:[(0,m.jsxs)("select",{className:"text-[10px] rounded border border-gray-200 bg-white px-1 py-0.5 text-gray-500 dark:border-zinc-700 dark:bg-zinc-900 dark:text-gray-400 focus:outline-none",value:a,onClick:e=>e.stopPropagation(),onChange:e=>{s(e.target.value),window.localStorage.setItem("vibepulse:open-tool",e.target.value)},title:"Select open tool",children:[(0,m.jsx)("option",{value:"vscode",children:"VSCode"}),(0,m.jsx)("option",{value:"antigravity",children:"Antigravity"})]}),(0,m.jsxs)("button",{type:"button",onClick:()=>{let e,t=r[0]?.directory;if(!t)return;let n="antigravity"===a?`antigravity://file${t}`:(e=encodeURI(t.replace(/\\/g,"/")),i?`vscode://vscode-remote/ssh-remote+${i}${e.startsWith("/")?"":"/"}${e}`:`vscode://file${e.startsWith("/")?e:`/${e}`}`);window.location.href=n},className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium text-gray-500 hover:text-blue-600 hover:bg-blue-50 dark:text-gray-400 dark:hover:text-blue-400 dark:hover:bg-blue-900/20 transition-colors",title:"Open project",children:[(0,m.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),"Open"]})]})]})}function L(e){let t,r,n=e.realTimeStatus||"idle",a=(e.children||[]).some(e=>{let t=e.realTimeStatus||"idle";return"busy"===t||"retry"===t}),s="retry"===n?"retry":"busy"===n||a?"busy":"idle",i=(e.children||[]).some(e=>{let t=e.realTimeStatus||"idle";return"retry"===t||"idle"!==t&&!!e.waitingForUser}),l="retry"===s||"busy"===s&&(!!e.waitingForUser||i);return r=e.time?.archived?"done":l?"review":"busy"===s?"busy":"idle",{id:e.id,sessionSlug:e.slug,title:e.title||"Untitled Session",directory:e.directory,projectName:e.projectName||"Unknown Project",branch:e.branch,agents:(t=e.slug.split("_")).length>=3?t[t.length-1].split("-").filter(Boolean):[],messageCount:e.messageCount||0,status:r,opencodeStatus:s,waitingForUser:l,todosTotal:0,todosCompleted:0,createdAt:e.time.created,updatedAt:e.time.updated,archivedAt:e.time.archived,sortOrder:0,children:(e.children||[]).map(e=>({id:e.id,title:e.title,realTimeStatus:e.realTimeStatus||"idle",waitingForUser:"retry"===(e.realTimeStatus||"idle")||"busy"===(e.realTimeStatus||"idle")&&!!e.waitingForUser}))}}function _(){return(0,m.jsx)("div",{className:"h-[calc(100vh-8rem)] overflow-x-auto",children:(0,m.jsx)("div",{className:"flex gap-4 h-full min-w-max p-4",children:[1,2,3,4].map(e=>(0,m.jsxs)("div",{className:"flex-shrink-0 w-80 bg-gray-100 dark:bg-zinc-800 rounded-lg p-4 animate-pulse",children:[(0,m.jsx)("div",{className:"h-6 bg-gray-200 dark:bg-zinc-700 rounded w-24 mb-4"}),(0,m.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,m.jsxs)("div",{className:"p-4 bg-white dark:bg-zinc-900 rounded-lg shadow border border-gray-200 dark:border-zinc-700",children:[(0,m.jsx)("div",{className:"h-5 bg-gray-200 dark:bg-zinc-700 rounded w-3/4 mb-3"}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)("div",{className:"h-4 bg-gray-200 dark:bg-zinc-700 rounded w-20"}),(0,m.jsx)("div",{className:"h-4 bg-gray-200 dark:bg-zinc-700 rounded w-16"})]})]},e))})]},e))})})}let V=null,I="vibepulse:sound-muted",$=new Map;function q(e){let t=Date.now();return!(t-($.get(e)??0)<1e4)&&($.set(e,t),!0)}function U(e,t,r){q(`warn:${e}`)&&console.warn(`[VibePulse sound] ${t}`,r)}function B(){return V||(V=new AudioContext),V}function W(e,t,r,n){if(H()){var a;return void(a=`${e}-muted`,q(`info:${a}`)&&console.info(`[VibePulse sound] ${t}`))}try{let t=B(),a=()=>{try{n(t,t.currentTime)}catch(t){U(e,r,t)}};if("running"===t.state)return void a();t.resume().then(()=>{"running"===t.state?a():U(`${e}-state`,`${r} (AudioContext not running after resume)`,Error(t.state))}).catch(t=>{U(`${e}-resume`,`${r} (AudioContext resume failed)`,t)})}catch(t){U(e,r,t)}}function H(){return"true"===window.localStorage.getItem(I)}function Q(){try{let e=B(),t=()=>{let t=e.createBuffer(1,1,22050),r=e.createBufferSource();r.buffer=t,r.connect(e.destination),r.start(0)};if("running"===e.state)return void t();e.resume().then(()=>{"running"===e.state?t():U("unlock-state","unlockAudio() resume did not reach running state",Error(e.state))}).catch(e=>{U("unlock-resume","Failed to resume AudioContext in unlockAudio()",e)})}catch(e){U("unlock-audio","unlockAudio() failed",e)}}function K(){W("play-attention","Skipped playAttentionSound() because muted","playAttentionSound() failed",(e,t)=>{let r=e.createOscillator(),n=e.createGain();r.type="sine",r.frequency.value=523,n.gain.setValueAtTime(.3,t),n.gain.exponentialRampToValueAtTime(.001,t+.2),r.connect(n),n.connect(e.destination),r.start(t),r.stop(t+.2);let a=e.createOscillator(),s=e.createGain();a.type="sine",a.frequency.value=659,s.gain.setValueAtTime(.3,t+.15),s.gain.exponentialRampToValueAtTime(.001,t+.4),a.connect(s),s.connect(e.destination),a.start(t+.15),a.stop(t+.4);let i=e.createOscillator(),l=e.createGain();i.type="sine",i.frequency.value=784,l.gain.setValueAtTime(.25,t+.3),l.gain.exponentialRampToValueAtTime(.001,t+.55),i.connect(l),l.connect(e.destination),i.start(t+.3),i.stop(t+.55)})}function G(){W("play-complete","Skipped playCompleteSound() because muted","playCompleteSound() failed",(e,t)=>{let r=e.createOscillator(),n=e.createGain();r.type="sine",r.frequency.setValueAtTime(659,t),r.frequency.exponentialRampToValueAtTime(988,t+.18),n.gain.setValueAtTime(.22,t),n.gain.exponentialRampToValueAtTime(.001,t+.22),r.connect(n),n.connect(e.destination),r.start(t),r.stop(t+.22);let a=e.createOscillator(),s=e.createGain();a.type="sine",a.frequency.setValueAtTime(988,t+.12),a.frequency.exponentialRampToValueAtTime(1318,t+.32),s.gain.setValueAtTime(.18,t+.12),s.gain.exponentialRampToValueAtTime(.001,t+.36),a.connect(s),s.connect(e.destination),a.start(t+.12),a.stop(t+.36)})}let Y="vibepulse:waiting-sessions",X="vibepulse:last-sessions-snapshot",J=[{id:"idle",title:"Idle"},{id:"busy",title:"Busy"},{id:"review",title:"Needs Attention"},{id:"done",title:"Archived"}];function Z({filterDays:e,onProcessHintsChange:t}){let r=(0,f.useRef)({}),n=(0,f.useRef)(!1),a=(0,f.useRef)({}),s=(0,f.useRef)(!1),[i,l]=(0,f.useState)("idle"),[o,c]=(0,f.useState)(null),{data:d,isLoading:u,error:p,dataUpdatedAt:h,refetch:x,isFetching:g}=A({queryKey:["sessions"],queryFn:async()=>{try{let e=await fetch("/api/sessions");if(!e.ok){let t=null;try{t=await e.json()}catch{t=null}let r=503===e.status&&t?.error==="OpenCode server not found",n=Error(r?t?.error||"OpenCode server not found":t?.error||`Failed to load sessions (${e.status})`);throw n.kind=r?"opencode_unavailable":"request_failed",n.hint=t?.hint,n.status=e.status,n}return e.json()}catch(t){if(t instanceof Error&&t.kind)throw t;let e=Error("Unable to connect to session service");throw e.kind="request_failed",e}},refetchInterval:5e3,refetchIntervalInBackground:!0,refetchOnReconnect:!0});(0,f.useEffect)(()=>{try{let e=localStorage.getItem(X);if(!e)return;let t=JSON.parse(e);if(!t||!Array.isArray(t.sessions)||"number"!=typeof t.savedAt||(Array.isArray(t.processHints)||(t.processHints=[]),0===t.sessions.length))return;c(t)}catch{c(null)}},[]),(0,f.useEffect)(()=>{if(!d?.sessions||0===d.sessions.length)return;let e={savedAt:Date.now(),sessions:d.sessions,processHints:d.processHints??[]};try{localStorage.setItem(X,JSON.stringify(e)),c(e)}catch{c(e)}},[d?.processHints,d?.sessions]);let b=async()=>{try{await navigator.clipboard.writeText("opencode --port <PORT>"),l("copied"),setTimeout(()=>l("idle"),1500)}catch{l("failed"),setTimeout(()=>l("idle"),2e3)}},y=(0,f.useMemo)(()=>d?.sessions?d.sessions:p&&o?.sessions?.length?o.sessions:[],[p,d?.sessions,o?.sessions]),v=!!p&&!d?.sessions&&!!o?.sessions?.length,w=(0,f.useMemo)(()=>d?.processHints?d.processHints:v&&o?.processHints?o.processHints:[],[d?.processHints,v,o?.processHints]);(0,f.useEffect)(()=>{t?.(w)},[t,w]);let k=(0,f.useMemo)(()=>{if(!y.length)return[];let e={};try{e=JSON.parse(localStorage.getItem(Y)||"{}")}catch{e={}}return y.map(t=>{let r=!!e[t.id];return{...t,waitingForUser:!!t.waitingForUser||"retry"===t.realTimeStatus&&r}})},[y]);(0,f.useEffect)(()=>{let e={};for(let t of k)t.waitingForUser&&(e[t.id]=!0);localStorage.setItem(Y,JSON.stringify(e))},[k]),(0,f.useEffect)(()=>{let e={},t=!1;for(let a of k){let s=!!a.waitingForUser;e[a.id]=s,n.current&&s&&!r.current[a.id]&&(t=!0)}if(r.current=e,!n.current){n.current=!0;return}t&&setTimeout(()=>K(),250)},[k]),(0,f.useEffect)(()=>{let e={};for(let t of k){let r="busy"===t.realTimeStatus||"retry"===t.realTimeStatus?t.realTimeStatus:"idle";e[t.id]=r}if(!s.current){s.current=!0,a.current=e;return}let t=!1;for(let[r,n]of Object.entries(e)){let e=a.current[r];if(("busy"===e||"retry"===e)&&"idle"===n){t=!0;break}}a.current=e,t&&!v&&setTimeout(()=>G(),250)},[k,v]);let j=(0,f.useMemo)(()=>{let t=k.map(L);if(0===e)return t;let r=h-24*e*36e5;return t.filter(e=>e.updatedAt>=r)},[h,k,e]);if(u)return(0,m.jsx)(_,{});if(p&&!v){let e=p?.kind==="opencode_unavailable",t=e?p?.hint||"Run OpenCode with an exposed API port, for example `opencode --port <PORT>`.":p?.message||"An error occurred while loading sessions";return(0,m.jsx)("div",{className:"flex-1 flex items-center justify-center p-8",children:(0,m.jsxs)("div",{className:"max-w-md w-full text-center",children:[(0,m.jsx)("div",{className:"flex items-center justify-center w-12 h-12 mx-auto mb-4 bg-red-100 dark:bg-red-900/30 rounded-full",children:(0,m.jsx)("svg",{className:"w-6 h-6 text-red-600 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,m.jsx)("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:e?"OpenCode is not running":"Failed to load sessions"}),(0,m.jsx)("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:t}),(0,m.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,m.jsx)("button",{type:"button",onClick:()=>x(),className:"px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:g,children:g?"Retrying...":"Retry"}),e?(0,m.jsx)("button",{type:"button",onClick:b,className:"px-3 py-1.5 bg-gray-100 hover:bg-gray-200 dark:bg-zinc-800 dark:hover:bg-zinc-700 text-gray-700 dark:text-gray-300 text-sm font-medium rounded-md transition-colors",children:"copied"===i?"Copied":"failed"===i?"Copy Failed":"Copy Start Command"}):null]})]})})}return j&&0!==j.length?(0,m.jsxs)("div",{className:"flex-1 overflow-x-auto scrollbar-thin scroll-smooth",children:[v?(0,m.jsx)("div",{className:"px-4 pt-4 pb-0",children:(0,m.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-amber-800 dark:border-amber-900/40 dark:bg-amber-900/20 dark:text-amber-200",children:(0,m.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium",children:[(0,m.jsx)("span",{className:"inline-flex items-center rounded-full bg-amber-100 px-2 py-0.5 text-[10px] uppercase tracking-wide dark:bg-amber-900/40",children:"Stale Data"}),(0,m.jsxs)("span",{children:["Last seen at ",o?new Date(o.savedAt).toLocaleString():"--"]}),(0,m.jsx)("span",{className:"text-amber-700/80 dark:text-amber-300/80",children:"Read-only snapshot while OpenCode is unreachable."})]})})}):null,(0,m.jsx)("div",{className:"flex gap-6 h-full min-w-max p-4",children:J.map(e=>{let t=j.filter(t=>t.status===e.id).sort((e,t)=>e.sortOrder-t.sortOrder),r=(e=>{let t=new Map;for(let r of e){let e=r.projectName||"Unknown Project";t.has(e)||t.set(e,[]),t.get(e).push(r)}return t})(t);return(0,m.jsxs)("div",{className:"flex-shrink-0 w-80 bg-gray-100 dark:bg-zinc-800/80 rounded-xl p-4 flex flex-col shadow-sm",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-4 pb-3 border-b border-gray-200 dark:border-zinc-700",children:[(0,m.jsx)("h2",{className:"font-semibold text-gray-700 dark:text-gray-300",children:e.title}),(0,m.jsx)("span",{className:"px-2.5 py-0.5 bg-gray-200 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 text-xs font-medium rounded-full",children:t.length})]}),(0,m.jsx)("div",{className:"flex-1 overflow-y-auto scrollbar-thin pr-1",children:(0,m.jsx)("div",{className:"space-y-3",children:Array.from(r.entries()).map(([e,t])=>(0,m.jsx)(D,{projectName:e,branch:t[0].branch,cards:t,readOnly:v},e))})})]},e.id)})})]}):(0,m.jsx)("div",{className:"flex-1 flex items-center justify-center p-8",children:(0,m.jsxs)("div",{className:"max-w-md w-full text-center",children:[(0,m.jsx)("div",{className:"flex items-center justify-center w-12 h-12 mx-auto mb-4 bg-gray-100 dark:bg-zinc-800 rounded-full",children:(0,m.jsx)("svg",{className:"w-6 h-6 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})})}),(0,m.jsx)("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"No sessions yet"}),(0,m.jsx)("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:"OpenCode is running, but no sessions are available."}),(0,m.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-500",children:"Start a conversation in OpenCode and this board will update automatically."})]})})}var ee=f;class et extends ee.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("ErrorBoundary caught an error:",e,t)}render(){return this.state.hasError?(0,m.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-zinc-50 dark:bg-black",children:(0,m.jsxs)("div",{className:"max-w-md w-full mx-4 p-8 bg-white dark:bg-zinc-900 rounded-lg shadow-lg border border-gray-200 dark:border-zinc-800",children:[(0,m.jsx)("div",{className:"flex items-center justify-center w-12 h-12 mx-auto mb-4 bg-red-100 dark:bg-red-900/30 rounded-full",children:(0,m.jsx)("svg",{className:"w-6 h-6 text-red-600 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),(0,m.jsx)("h2",{className:"text-xl font-semibold text-center text-gray-900 dark:text-white mb-2",children:"Something went wrong"}),(0,m.jsx)("p",{className:"text-center text-gray-600 dark:text-gray-400 mb-6",children:"An unexpected error occurred. Please try refreshing the page."}),this.state.error&&(0,m.jsx)("div",{className:"p-3 bg-gray-100 dark:bg-zinc-800 rounded text-sm text-gray-700 dark:text-gray-300 font-mono overflow-auto",children:this.state.error.message}),(0,m.jsx)("button",{onClick:()=>window.location.reload(),className:"mt-6 w-full py-2 px-4 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors",children:"Refresh Page"})]})}):this.props.children}}let er="vibepulse:waiting-sessions";function en(e,t){let r=function(){try{return JSON.parse(localStorage.getItem(er)||"{}")}catch{return{}}}();t?r[e]=!0:delete r[e],localStorage.setItem(er,JSON.stringify(r))}function ea(e){let t=Date.now();return{...e,slug:e.slug||e.id,title:e.title||"Untitled Session",directory:e.directory||"",projectName:e.projectName||function(e){if(!e)return"Unknown Project";let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]||"Unknown Project"}(e.directory),time:e.time||{created:t,updated:t},realTimeStatus:e.realTimeStatus||"busy",waitingForUser:!!e.waitingForUser,children:e.children||[]}}let es=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),ei=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var el={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let eo=(0,f.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:s,iconNode:i,...l},o)=>(0,f.createElement)("svg",{ref:o,...el,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:es("lucide",a),...!s&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(l)&&{"aria-hidden":"true"},...l},[...i.map(([e,t])=>(0,f.createElement)(e,t)),...Array.isArray(s)?s:[s]])),ec=(e,t)=>{let r=(0,f.forwardRef)(({className:r,...n},a)=>(0,f.createElement)(eo,{ref:a,iconNode:t,className:es(`lucide-${ei(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...n}));return r.displayName=ei(e),r},ed=ec("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),eu=ec("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function em({onClick:e}){let{data:t}=A({queryKey:["opencode-config","status"],queryFn:async()=>{let e=await fetch("/api/opencode-config/status");if(!e.ok)throw Error("Failed to fetch config status");return e.json()}});return t?.hasPlugin?(0,m.jsx)("button",{type:"button",onClick:e,className:"inline-flex items-center justify-center w-9 h-9 rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-zinc-800 transition-colors duration-200","aria-label":"OpenCode Settings",title:"OpenCode Settings",children:(0,m.jsx)(eu,{className:"w-5 h-5"})}):null}let ef=ec("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ep=ec("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),eh=ec("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),ex=ec("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),eg=ec("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var eb=e.i(14272),ey=g,ev=class extends ey.Subscribable{#e;#s=void 0;#z;#N;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#S()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,y.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#z,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,y.hashKey)(t.mutationKey)!==(0,y.hashKey)(this.options.mutationKey)?this.reset():this.#z?.state.status==="pending"&&this.#z.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#z?.removeObserver(this)}onMutationUpdate(e){this.#S(),this.#j(e)}getCurrentResult(){return this.#s}reset(){this.#z?.removeObserver(this),this.#z=void 0,this.#S(),this.#j()}mutate(e,t){return this.#N=t,this.#z?.removeObserver(this),this.#z=this.#e.getMutationCache().build(this.#e,this.options),this.#z.addObserver(this),this.#z.execute(e)}#S(){let e=this.#z?.state??(0,eb.getDefaultState)();this.#s={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#j(e){h.notifyManager.batch(()=>{if(this.#N&&this.hasListeners()){let t=this.#s.variables,r=this.#s.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#N.onSuccess?.(e.data,t,r,n)}catch(e){Promise.reject(e)}try{this.#N.onSettled?.(e.data,null,t,r,n)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#N.onError?.(e.error,t,r,n)}catch(e){Promise.reject(e)}try{this.#N.onSettled?.(void 0,e.error,t,r,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#s)})})}};function ew(e,t){let r=(0,S.useQueryClient)(t),[n]=f.useState(()=>new ev(r,e));f.useEffect(()=>{n.setOptions(e)},[n,e]);let a=f.useSyncExternalStore(f.useCallback(e=>n.subscribe(h.notifyManager.batchCalls(e)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),s=f.useCallback((e,t)=>{n.mutate(e,t).catch(y.noop)},[n]);if(a.error&&(0,y.shouldThrowError)(n.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:s,mutateAsync:a.mutate}}let ek=ec("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),ej=ec("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),ez=ec("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),eN=ec("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),eS=ec("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),eC=ec("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),eE=[{key:"visual-engineering",name:"Visual Engineering",description:"Visual and UI component engineering tasks"},{key:"ultrabrain",name:"Ultrabrain",description:"Complex reasoning and deep analysis tasks"},{key:"deep",name:"Deep",description:"Deep research and comprehensive tasks"},{key:"artistry",name:"Artistry",description:"Creative and design-focused tasks"},{key:"quick",name:"Quick",description:"Fast, simple tasks requiring minimal processing"},{key:"unspecified-low",name:"Unspecified Low",description:"Default low-complexity tasks"},{key:"unspecified-high",name:"Unspecified High",description:"Default high-complexity tasks"},{key:"writing",name:"Writing",description:"Content creation and writing tasks"}];function eR({categoryKey:e,config:t,isBuiltIn:r,availableModels:n,onEdit:a,onDelete:s}){var i;let l,o=(l=eE.find(t=>t.key===e))||{key:e,name:e,description:"Custom category"},c=!!(t.model||t.variant),d=t.model&&n&&n.size>0&&!n.has(t.model),u=c?"bg-white border-zinc-200 dark:bg-zinc-900 dark:border-zinc-700 hover:border-zinc-300 dark:hover:border-zinc-600":"bg-zinc-50/50 border-zinc-200/50 dark:bg-zinc-900/50 dark:border-zinc-800/50 hover:border-zinc-300 dark:hover:border-zinc-600";return d&&(u="bg-amber-50/50 border-amber-200 dark:bg-amber-900/10 dark:border-amber-800/50 hover:border-amber-300 dark:hover:border-amber-700"),(0,m.jsxs)("div",{className:`
3
+ group relative flex items-center justify-between p-4 rounded-lg border flex-col sm:flex-row items-start sm:items-center gap-4
4
+ transition-all duration-200
5
+ ${u}
6
+ `,children:[(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("h4",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate",children:o.name}),!r&&(0,m.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",children:"Custom"}),d&&(0,m.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",children:[(0,m.jsx)(eg,{className:"h-3 w-3"}),"Model Unavailable"]}),!d&&c&&(0,m.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300",children:"Configured"}),!c&&(0,m.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400",children:[(0,m.jsx)(ej,{className:"h-3 w-3"}),"Default fallback"]})]}),(0,m.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400 truncate",children:o.description}),(0,m.jsxs)("div",{className:"mt-2 flex items-center gap-3 text-xs",children:[(0,m.jsxs)("span",{className:"text-zinc-600 dark:text-zinc-400",children:[(0,m.jsx)("span",{className:"text-zinc-400 dark:text-zinc-500",children:"Model:"})," ",function(e){if(!e)return"Default model";let t=e.split("/");return t[t.length-1]}(t.model)]}),t.variant&&(0,m.jsxs)("span",{className:"text-zinc-600 dark:text-zinc-400",children:[(0,m.jsx)("span",{className:"text-zinc-400 dark:text-zinc-500",children:"Variant:"})," ",(i=t.variant)?i:"—"]})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1 ml-4 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,m.jsx)("button",{type:"button",onClick:()=>a(e,t),className:"p-1.5 rounded-md text-zinc-500 hover:text-zinc-900 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:text-zinc-100 dark:hover:bg-zinc-800 transition-colors","aria-label":`Edit ${o.name} category`,title:`Edit ${o.name}`,children:(0,m.jsx)(eN,{className:"h-4 w-4"})}),!r&&(0,m.jsx)("button",{type:"button",onClick:()=>s(e),className:"p-1.5 rounded-md text-zinc-500 hover:text-red-600 hover:bg-red-50 dark:text-zinc-400 dark:hover:text-red-400 dark:hover:bg-red-900/20 transition-colors","aria-label":`Delete ${o.name} category`,title:`Delete ${o.name}`,children:(0,m.jsx)(eS,{className:"h-4 w-4"})})]})]})}function eA({categories:e,onEdit:t,onDelete:r}){let{data:n}=A({queryKey:["opencode-models"],queryFn:async()=>{let e=await fetch("/api/opencode-models");if(!e.ok)throw Error("Failed to fetch models");return e.json()}}),a=f.useMemo(()=>n?new Set(n.models):null,[n]),{builtIn:s,custom:i}=f.useMemo(()=>{let t=[],r=[];return eE.forEach(r=>{t.push({key:r.key,config:e[r.key]||{}})}),Object.entries(e).forEach(([e,t])=>{eE.some(t=>t.key===e)||r.push({key:e,config:t})}),{builtIn:t,custom:r}},[e]),l=i.length>0;return(0,m.jsxs)("div",{className:"space-y-6",children:[(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,m.jsx)(eC,{className:"h-4 w-4 text-zinc-500 dark:text-zinc-400"}),(0,m.jsx)("h3",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:"Built-in Categories"}),(0,m.jsxs)("span",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:["(",s.length,")"]})]}),(0,m.jsx)("div",{className:"space-y-2",children:s.map(({key:e,config:n})=>(0,m.jsx)(eR,{categoryKey:e,config:n,isBuiltIn:!0,availableModels:a,onEdit:t,onDelete:r},e))})]}),l&&(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,m.jsx)(eC,{className:"h-4 w-4 text-blue-500"}),(0,m.jsx)("h3",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:"Custom Categories"}),(0,m.jsxs)("span",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:["(",i.length,")"]})]}),(0,m.jsx)("div",{className:"space-y-2",children:i.map(({key:e,config:n})=>(0,m.jsx)(eR,{categoryKey:e,config:n,isBuiltIn:!1,availableModels:a,onEdit:t,onDelete:r},e))})]}),0===s.length&&!l&&(0,m.jsxs)("div",{className:"text-center py-8",children:[(0,m.jsx)(eC,{className:"h-8 w-8 mx-auto text-zinc-300 dark:text-zinc-600 mb-2"}),(0,m.jsx)("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"No categories configured"})]})]})}var eT=e=>e instanceof Date,eO=e=>null==e,eM=e=>!eO(e)&&!Array.isArray(e)&&"object"==typeof e&&!eT(e),eF=e=>eM(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,eP=(e,t)=>e.has(t.substring(0,t.search(/\.\d+(\.|$)/))||t),eD="u">typeof window&&void 0!==window.HTMLElement&&"u">typeof document;function eL(e){let t;if(e instanceof Date)return new Date(e);let r="u">typeof FileList&&e instanceof FileList;if(eD&&(e instanceof Blob||r))return e;let n=Array.isArray(e);if(!n&&!(eM(e)&&eM(t=e.constructor&&e.constructor.prototype)&&t.hasOwnProperty("isPrototypeOf")))return e;let a=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=eL(e[t]));return a}var e_=e=>void 0===e,eV=e=>Array.isArray(e)?e.filter(Boolean):[],eI=e=>eV(e.replace(/["|']|\]/g,"").split(/\.|\[/)),e$=(e,t,r)=>{if(!t||!eM(e))return r;let n=(/^\w*$/.test(t)?[t]:eI(t)).reduce((e,t)=>eO(e)?e:e[t],e);return e_(n)||n===e?e_(e[t])?r:e[t]:n},eq=e=>"function"==typeof e,eU=(e,t,r)=>{let n=-1,a=/^\w*$/.test(t)?[t]:eI(t),s=a.length,i=s-1;for(;++n<s;){let t=a[n],s=r;if(n!==i){let r=e[t];s=eM(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}};let eB="blur",eW="onChange",eH="onSubmit",eQ="maxLength",eK="minLength",eG="pattern",eY="required",eX=f.default.createContext(null);eX.displayName="HookFormControlContext";var eJ=(e,t,r,n=!0)=>{let a={defaultValues:t._defaultValues};for(let s in e)Object.defineProperty(a,s,{get:()=>("all"!==t._proxyFormState[s]&&(t._proxyFormState[s]=!n||"all"),r&&(r[s]=!0),e[s])});return a};let eZ="u">typeof window?f.default.useLayoutEffect:f.default.useEffect;var e0=e=>"string"==typeof e,e1=(e,t,r,n,a)=>e0(e)?(n&&t.watch.add(e),e$(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),e$(r,e))):(n&&(t.watchAll=!0),r),e2=e=>eO(e)||"object"!=typeof e;function e5(e,t,r=new WeakSet){if(e2(e)||e2(t))return Object.is(e,t);if(eT(e)&&eT(t))return Object.is(e.getTime(),t.getTime());let n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;for(let s of(r.add(e),r.add(t),n)){let n=e[s];if(!a.includes(s))return!1;if("ref"!==s){let e=t[s];if(eT(n)&&eT(e)||eM(n)&&eM(e)||Array.isArray(n)&&Array.isArray(e)?!e5(n,e,r):!Object.is(n,e))return!1}}return!0}let e4=e=>e.render(function(e){let t=f.default.useContext(eX),{name:r,disabled:n,control:a=t,shouldUnregister:s,defaultValue:i,exact:l=!0}=e,o=eP(a._names.array,r),c=f.default.useMemo(()=>e$(a._formValues,r,e$(a._defaultValues,r,i)),[a,r,i]),d=function(e){let t=f.default.useContext(eX),{control:r=t,name:n,defaultValue:a,disabled:s,exact:i,compute:l}=e||{},o=f.default.useRef(a),c=f.default.useRef(l),d=f.default.useRef(void 0),u=f.default.useRef(r),m=f.default.useRef(n);c.current=l;let[p,h]=f.default.useState(()=>{let e=r._getWatch(n,o.current);return c.current?c.current(e):e}),x=f.default.useCallback(e=>{let t=e1(n,r._names,e||r._formValues,!1,o.current);return c.current?c.current(t):t},[r._formValues,r._names,n]),g=f.default.useCallback(e=>{if(!s){let t=e1(n,r._names,e||r._formValues,!1,o.current);if(c.current){let e=c.current(t);e5(e,d.current)||(h(e),d.current=e)}else h(t)}},[r._formValues,r._names,s,n]);eZ(()=>(u.current===r&&e5(m.current,n)||(u.current=r,m.current=n,g()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:e=>{g(e.values)}})),[r,i,n,g]),f.default.useEffect(()=>r._removeUnmounted());let b=u.current!==r,y=m.current,v=f.default.useMemo(()=>{if(s)return null;let e=!b&&!e5(y,n);return b||e?x():null},[s,b,n,y,x]);return null!==v?v:p}({control:a,name:r,defaultValue:c,exact:l}),u=function(e){let t=f.default.useContext(eX),{control:r=t,disabled:n,name:a,exact:s}=e||{},[i,l]=f.default.useState(r._formState),o=f.default.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return eZ(()=>r._subscribe({name:a,formState:o.current,exact:s,callback:e=>{n||l({...r._formState,...e})}}),[a,n,s]),f.default.useEffect(()=>{o.current.isValid&&r._setValid(!0)},[r]),f.default.useMemo(()=>eJ(i,r,o.current,!1),[i,r])}({control:a,name:r,exact:l}),m=f.default.useRef(e),p=f.default.useRef(void 0),h=f.default.useRef(a.register(r,{...e.rules,value:d,..."boolean"==typeof e.disabled?{disabled:e.disabled}:{}}));m.current=e;let x=f.default.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!e$(u.errors,r)},isDirty:{enumerable:!0,get:()=>!!e$(u.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!e$(u.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!e$(u.validatingFields,r)},error:{enumerable:!0,get:()=>e$(u.errors,r)}}),[u,r]),g=f.default.useCallback(e=>h.current.onChange({target:{value:eF(e),name:r},type:"change"}),[r]),b=f.default.useCallback(()=>h.current.onBlur({target:{value:e$(a._formValues,r),name:r},type:eB}),[r,a._formValues]),y=f.default.useCallback(e=>{let t=e$(a._fields,r);t&&t._f&&e&&(t._f.ref={focus:()=>eq(e.focus)&&e.focus(),select:()=>eq(e.select)&&e.select(),setCustomValidity:t=>eq(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>eq(e.reportValidity)&&e.reportValidity()})},[a._fields,r]),v=f.default.useMemo(()=>({name:r,value:d,..."boolean"==typeof n||u.disabled?{disabled:u.disabled||n}:{},onChange:g,onBlur:b,ref:y}),[r,n,u.disabled,g,b,y,d]);return f.default.useEffect(()=>{let e=a._options.shouldUnregister||s,t=p.current;t&&t!==r&&!o&&a.unregister(t),a.register(r,{...m.current.rules,..."boolean"==typeof m.current.disabled?{disabled:m.current.disabled}:{}});let n=(e,t)=>{let r=e$(a._fields,e);r&&r._f&&(r._f.mount=t)};if(n(r,!0),e){let e=eL(e$(a._options.defaultValues,r,m.current.defaultValue));eU(a._defaultValues,r,e),e_(e$(a._formValues,r))&&eU(a._formValues,r,e)}return o||a.register(r),p.current=r,()=>{(o?e&&!a._state.action:e)?a.unregister(r):n(r,!1)}},[r,a,o,s]),f.default.useEffect(()=>{a._setDisabledField({disabled:n,name:r})},[n,r,a]),f.default.useMemo(()=>({field:v,formState:u,fieldState:x}),[v,u,x])}(e));f.default.createContext(null).displayName="HookFormContext";var e3=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},e9=e=>Array.isArray(e)?e:[e],e6=()=>{let e=[];return{get observers(){return e},next:t=>{for(let r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},e8=e=>eM(e)&&!Object.keys(e).length,e7=e=>{if(!eD)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},te=e=>e7(e)&&e.isConnected;function tt(e,t){let r=Array.isArray(t)?t:/^\w*$/.test(t)?[t]:eI(t),n=1===r.length?e:function(e,t){let r=t.slice(0,-1).length,n=0;for(;n<r;)e=e_(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,s=r[a];return n&&delete n[s],0!==a&&(eM(n)&&e8(n)||Array.isArray(n)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!e_(e[t]))return!1;return!0}(n))&&tt(e,r.slice(0,-1)),e}function tr(e){return Array.isArray(e)||eM(e)&&!(e=>{for(let t in e)if(eq(e[t]))return!0;return!1})(e)}function tn(e,t={}){for(let r in e){let n=e[r];tr(n)?(t[r]=Array.isArray(n)?[]:{},tn(n,t[r])):e_(n)||(t[r]=!0)}return t}function ta(e,t,r){for(let n in r||(r=tn(t)),e){let a=e[n];if(tr(a))e_(t)||e2(r[n])?r[n]=tn(a,Array.isArray(a)?[]:{}):ta(a,eO(t)?{}:t[n],r[n]);else{let e=t[n];r[n]=!e5(a,e)}}return r}let ts={value:!1,isValid:!1},ti={value:!0,isValid:!0};var tl=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!e_(e[0].attributes.value)?e_(e[0].value)||""===e[0].value?ti:{value:e[0].value,isValid:!0}:ti:ts}return ts},to=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>e_(e)?e:t?""===e?NaN:e?+e:e:r&&e0(e)?new Date(e):n?n(e):e;let tc={isValid:!1,value:null};var td=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,tc):tc;function tu(e){let t=e.ref;return"file"===t.type?t.files:"radio"===t.type?td(e.refs).value:"select-multiple"===t.type?[...t.selectedOptions].map(({value:e})=>e):"checkbox"===t.type?tl(e.refs).value:to(e_(t.value)?e.ref.value:t.value,e)}var tm=e=>e_(e)?e:e instanceof RegExp?e.source:eM(e)?e.value instanceof RegExp?e.value.source:e.value:e,tf=e=>({isOnSubmit:!e||e===eH,isOnBlur:"onBlur"===e,isOnChange:e===eW,isOnAll:"all"===e,isOnTouch:"onTouched"===e});let tp="AsyncFunction";var th=e=>!!e&&!!e.validate&&!!(eq(e.validate)&&e.validate.constructor.name===tp||eM(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===tp)),tx=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let tg=(e,t,r,n)=>{for(let a of r||Object.keys(e)){let r=e$(e,a);if(r){let{_f:e,...s}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;else if(e.ref&&t(e.ref,e.name)&&!n)return!0;else if(tg(s,t))break}else if(eM(s)&&tg(s,t))break}}};function tb(e,t,r){let n=e$(e,r);if(n||/^\w*$/.test(r))return{error:n,name:r};let a=r.split(".");for(;a.length;){let n=a.join("."),s=e$(t,n),i=e$(e,n);if(s&&!Array.isArray(s)&&r!==n)break;if(i&&i.type)return{name:n,error:i};if(i&&i.root&&i.root.type)return{name:`${n}.root`,error:i.root};a.pop()}return{name:r}}var ty=(e,t,r)=>{let n=e9(e$(e,r));return eU(n,"root",t[r]),eU(e,r,n),e};function tv(e,t,r="validate"){if(e0(e)||Array.isArray(e)&&e.every(e0)||"boolean"==typeof e&&!e)return{type:r,message:e0(e)?e:"",ref:t}}var tw=e=>!eM(e)||e instanceof RegExp?{value:e,message:""}:e,tk=async(e,t,r,n,a,s)=>{let{ref:i,refs:l,required:o,maxLength:c,minLength:d,min:u,max:m,pattern:f,validate:p,name:h,valueAsNumber:x,mount:g}=e._f,b=e$(r,h);if(!g||t.has(h))return{};let y=l?l[0]:i,v=e=>{a&&y.reportValidity&&(y.setCustomValidity("boolean"==typeof e?"":e||""),y.reportValidity())},w={},k="radio"===i.type,j="checkbox"===i.type,z=(x||"file"===i.type)&&e_(i.value)&&e_(b)||e7(i)&&""===i.value||""===b||Array.isArray(b)&&!b.length,N=e3.bind(null,h,n,w),S=(e,t,r,n=eQ,a=eK)=>{let s=e?t:r;w[h]={type:e?n:a,message:s,ref:i,...N(e?n:a,s)}};if(s?!Array.isArray(b)||!b.length:o&&(!(k||j)&&(z||eO(b))||"boolean"==typeof b&&!b||j&&!tl(l).isValid||k&&!td(l).isValid)){let{value:e,message:t}=e0(o)?{value:!!o,message:o}:tw(o);if(e&&(w[h]={type:eY,message:t,ref:y,...N(eY,t)},!n))return v(t),w}if(!z&&(!eO(u)||!eO(m))){let e,t,r=tw(m),a=tw(u);if(eO(b)||isNaN(b)){let n=i.valueAsDate||new Date(b),s=e=>new Date(new Date().toDateString()+" "+e),l="time"==i.type,o="week"==i.type;e0(r.value)&&b&&(e=l?s(b)>s(r.value):o?b>r.value:n>new Date(r.value)),e0(a.value)&&b&&(t=l?s(b)<s(a.value):o?b<a.value:n<new Date(a.value))}else{let n=i.valueAsNumber||(b?+b:b);eO(r.value)||(e=n>r.value),eO(a.value)||(t=n<a.value)}if((e||t)&&(S(!!e,r.message,a.message,"max","min"),!n))return v(w[h].message),w}if((c||d)&&!z&&(e0(b)||s&&Array.isArray(b))){let e=tw(c),t=tw(d),r=!eO(e.value)&&b.length>+e.value,a=!eO(t.value)&&b.length<+t.value;if((r||a)&&(S(r,e.message,t.message),!n))return v(w[h].message),w}if(f&&!z&&e0(b)){let{value:e,message:t}=tw(f);if(e instanceof RegExp&&!b.match(e)&&(w[h]={type:eG,message:t,ref:i,...N(eG,t)},!n))return v(t),w}if(p){if(eq(p)){let e=tv(await p(b,r),y);if(e&&(w[h]={...e,...N("validate",e.message)},!n))return v(e.message),w}else if(eM(p)){let e={};for(let t in p){if(!e8(e)&&!n)break;let a=tv(await p[t](b,r),y,t);a&&(e={...a,...N(t,a.message)},v(a.message),n&&(w[h]=e))}if(!e8(e)&&(w[h]={ref:y,...e},!n))return w}}return v(!0),w};let tj={mode:eH,reValidateMode:eW,shouldFocusError:!0};function tz(e={}){let t=f.default.useRef(void 0),r=f.default.useRef(void 0),[n,a]=f.default.useState({isDirty:!1,isValidating:!1,isLoading:eq(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:eq(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!eq(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:r,...a}=function(e={}){let t,r={...tj,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:eq(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},s=(eM(r.defaultValues)||eM(r.values))&&eL(r.defaultValues||r.values)||{},i=r.shouldUnregister?{}:eL(s),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c=0,d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={...d},m={...u},f={array:e6(),state:e6()},p="all"===r.criteriaMode,h=async e=>{if(!l.keepIsValid&&!r.disabled&&(u.isValid||m.isValid||e)){let e;r.resolver?(e=e8((await y()).errors),x()):e=await w(a,!0),e!==n.isValid&&f.state.next({isValid:e})}},x=(e,t)=>{!r.disabled&&(u.isValidating||u.validatingFields||m.isValidating||m.validatingFields)&&((e||Array.from(o.mount)).forEach(e=>{e&&(t?eU(n.validatingFields,e,t):tt(n.validatingFields,e))}),f.state.next({validatingFields:n.validatingFields,isValidating:!e8(n.validatingFields)}))},g=(e,t,r,n)=>{let o=e$(a,e);if(o){let a=e$(i,e,e_(r)?e$(s,e):r);e_(a)||n&&n.defaultChecked||t?eU(i,e,t?a:tu(o._f)):z(e,a),l.mount&&!l.action&&h()}},b=(e,t,a,i,l)=>{let o=!1,c=!1,d={name:e};if(!r.disabled){if(!a||i){(u.isDirty||m.isDirty)&&(c=n.isDirty,n.isDirty=d.isDirty=k(),o=c!==d.isDirty);let r=e5(e$(s,e),t);c=!!e$(n.dirtyFields,e),r?tt(n.dirtyFields,e):eU(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,o=o||(u.dirtyFields||m.dirtyFields)&&!r!==c}if(a){let t=e$(n.touchedFields,e);t||(eU(n.touchedFields,e,a),d.touchedFields=n.touchedFields,o=o||(u.touchedFields||m.touchedFields)&&t!==a)}o&&l&&f.state.next(d)}return o?d:{}},y=async e=>(x(e,!0),await r.resolver(i,r.context,((e,t,r,n)=>{let a={};for(let r of e){let e=e$(t,r);e&&eU(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||o.mount,a,r.criteriaMode,r.shouldUseNativeValidation))),v=async e=>{let{errors:t}=await y(e);if(x(e),e)for(let r of e){let e=e$(t,r);e?eU(n.errors,r,e):tt(n.errors,r)}else n.errors=t;return t},w=async(t,a,s={valid:!0})=>{for(let l in t){let c=t[l];if(c){let{_f:t,...l}=c;if(t){let l=o.array.has(t.name),d=c._f&&th(c._f);d&&u.validatingFields&&x([t.name],!0);let m=await tk(c,o.disabled,i,p,r.shouldUseNativeValidation&&!a,l);if(d&&u.validatingFields&&x([t.name]),m[t.name]&&(s.valid=!1,a||e.shouldUseNativeValidation))break;a||(e$(m,t.name)?l?ty(n.errors,m,t.name):eU(n.errors,t.name,m[t.name]):tt(n.errors,t.name))}e8(l)||await w(l,a,s)}}return s.valid},k=(e,t)=>!r.disabled&&(e&&t&&eU(i,e,t),!e5(A(),s)),j=(e,t,r)=>e1(e,o,{...l.mount?i:e_(t)?s:e0(e)?{[e]:t}:t},r,t),z=(e,t,r={})=>{let n=e$(a,e),s=t;if(n){let r=n._f;r&&(r.disabled||eU(i,e,to(t,r)),s=e7(r.ref)&&eO(t)?"":t,"select-multiple"===r.ref.type?[...r.ref.options].forEach(e=>e.selected=s.includes(e.value)):r.refs?"checkbox"===r.ref.type?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):r.refs.forEach(e=>e.checked=e.value===s):"file"===r.ref.type?r.ref.value="":(r.ref.value=s,r.ref.type||f.state.next({name:e,values:eL(i)})))}(r.shouldDirty||r.shouldTouch)&&b(e,s,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&R(e)},N=(e,t,r)=>{for(let n in t){if(!t.hasOwnProperty(n))return;let s=t[n],i=e+"."+n,l=e$(a,i);(o.array.has(e)||eM(s)||l&&!l._f)&&!eT(s)?N(i,s,r):z(i,s,r)}},S=(e,t,r={})=>{let c=e$(a,e),d=o.array.has(e),p=eL(t);eU(i,e,p),d?(f.array.next({name:e,values:eL(i)}),(u.isDirty||u.dirtyFields||m.isDirty||m.dirtyFields)&&r.shouldDirty&&f.state.next({name:e,dirtyFields:ta(s,i),isDirty:k(e,p)})):!c||c._f||eO(p)?z(e,p,r):N(e,p,r),tx(e,o)?f.state.next({...n,name:e,values:eL(i)}):f.state.next({name:l.mount?e:void 0,values:eL(i)})},C=async e=>{l.mount=!0;let s=e.target,d=s.name,g=!0,v=e$(a,d),k=e=>{g=Number.isNaN(e)||eT(e)&&isNaN(e.getTime())||e5(e,e$(i,d,e))},j=tf(r.mode),z=tf(r.reValidateMode);if(v){var N,S,C,E,A;let l,F,P,D=s.type?tu(v._f):eF(e),L=e.type===eB||"focusout"===e.type,_=!((P=v._f).mount&&(P.required||P.min||P.max||P.maxLength||P.minLength||P.pattern||P.validate))&&!r.resolver&&!e$(n.errors,d)&&!v._f.deps||(N=L,S=e$(n.touchedFields,d),C=n.isSubmitted,E=z,!(A=j).isOnAll&&(!C&&A.isOnTouch?!(S||N):(C?E.isOnBlur:A.isOnBlur)?!N:(C?!E.isOnChange:!A.isOnChange)||N)),V=tx(d,o,L);eU(i,d,D),L?s&&s.readOnly||(v._f.onBlur&&v._f.onBlur(e),t&&t(0)):v._f.onChange&&v._f.onChange(e);let I=b(d,D,L),$=!e8(I)||V;if(L||f.state.next({name:d,type:e.type,values:eL(i)}),_)return(u.isValid||m.isValid)&&("onBlur"===r.mode?L&&h():L||h()),$&&f.state.next({name:d,...V?{}:I});if(!L&&V&&f.state.next({...n}),r.resolver){let{errors:e}=await y([d]);if(x([d]),k(D),g){let t=tb(n.errors,a,d),r=tb(e,a,t.name||d);l=r.error,d=r.name,F=e8(e)}}else x([d],!0),l=(await tk(v,o.disabled,i,p,r.shouldUseNativeValidation))[d],x([d]),k(D),g&&(l?F=!1:(u.isValid||m.isValid)&&(F=await w(a,!0)));if(g){v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&R(v._f.deps);var T=d,O=F,M=l;let e=e$(n.errors,T),a=(u.isValid||m.isValid)&&"boolean"==typeof O&&n.isValid!==O;if(r.delayError&&M){let e;e=()=>{eU(n.errors,T,M),f.state.next({errors:n.errors})},(t=t=>{clearTimeout(c),c=setTimeout(e,t)})(r.delayError)}else clearTimeout(c),t=null,M?eU(n.errors,T,M):tt(n.errors,T);if((M?!e5(e,M):e)||!e8(I)||a){let e={...I,...a&&"boolean"==typeof O?{isValid:O}:{},errors:n.errors,name:T};n={...n,...e},f.state.next(e)}}}},E=(e,t)=>{if(e$(n.errors,t)&&e.focus)return e.focus(),1},R=async(e,t={})=>{let s,i,l=e9(e);if(r.resolver){let t=await v(e_(e)?e:l);s=e8(t),i=e?!l.some(e=>e$(t,e)):s}else e?((i=(await Promise.all(l.map(async e=>{let t=e$(a,e);return await w(t&&t._f?{[e]:t}:t)}))).every(Boolean))||n.isValid)&&h():i=s=await w(a);return f.state.next({...!e0(e)||(u.isValid||m.isValid)&&s!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:s}:{},errors:n.errors}),t.shouldFocus&&!i&&tg(a,E,e?l:o.mount),i},A=(e,t)=>{let r={...l.mount?i:s};return t&&(r=function e(t,r){let n={};for(let a in t)if(t.hasOwnProperty(a)){let s=t[a],i=r[a];if(s&&eM(s)&&i){let t=e(s,i);eM(t)&&(n[a]=t)}else t[a]&&(n[a]=i)}return n}(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),e_(e)?r:e0(e)?e$(r,e):e.map(e=>e$(r,e))},T=(e,t)=>({invalid:!!e$((t||n).errors,e),isDirty:!!e$((t||n).dirtyFields,e),error:e$((t||n).errors,e),isValidating:!!e$(n.validatingFields,e),isTouched:!!e$((t||n).touchedFields,e)}),O=(e,t,r)=>{let s=(e$(a,e,{_f:{}})._f||{}).ref,{ref:i,message:l,type:o,...c}=e$(n.errors,e)||{};eU(n.errors,e,{...c,...t,ref:s}),f.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},M=e=>f.state.subscribe({next:t=>{let r,a,l;r=e.name,a=t.name,l=e.exact,(!r||!a||r===a||e9(r).some(e=>e&&(l?e===a:e.startsWith(a)||a.startsWith(e))))&&((e,t,r,n)=>{r(e);let{name:a,...s}=e;return e8(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(e=>t[e]===(!n||"all"))})(t,e.formState||u,$,e.reRenderRoot)&&e.callback({values:{...i},...n,...t,defaultValues:s})}}).unsubscribe,F=(e,t={})=>{for(let l of e?e9(e):o.mount)o.mount.delete(l),o.array.delete(l),t.keepValue||(tt(a,l),tt(i,l)),t.keepError||tt(n.errors,l),t.keepDirty||tt(n.dirtyFields,l),t.keepTouched||tt(n.touchedFields,l),t.keepIsValidating||tt(n.validatingFields,l),r.shouldUnregister||t.keepDefaultValue||tt(s,l);f.state.next({values:eL(i)}),f.state.next({...n,...!t.keepDirty?{}:{isDirty:k()}}),t.keepIsValid||h()},P=({disabled:e,name:t})=>{if("boolean"==typeof e&&l.mount||e||o.disabled.has(t)){let r=o.disabled.has(t);e?o.disabled.add(t):o.disabled.delete(t),!!e!==r&&l.mount&&!l.action&&h()}},D=(e,t={})=>{let n=e$(a,e),i="boolean"==typeof t.disabled||"boolean"==typeof r.disabled;return(eU(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),o.mount.add(e),n)?P({disabled:"boolean"==typeof t.disabled?t.disabled:r.disabled,name:e}):g(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:tm(t.min),max:tm(t.max),minLength:tm(t.minLength),maxLength:tm(t.maxLength),pattern:tm(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:i=>{if(i){let r;D(e,t),n=e$(a,e);let l=e_(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,o="radio"===(r=l).type||"checkbox"===r.type,c=n._f.refs||[];(o?c.find(e=>e===l):l===n._f.ref)||(eU(a,e,{_f:{...n._f,...o?{refs:[...c.filter(te),l,...Array.isArray(e$(s,e))?[{}]:[]],ref:{type:l.type,name:e}}:{ref:l}}}),g(e,!1,void 0,l))}else(n=e$(a,e,{}))._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&!(eP(o.array,e)&&l.action)&&o.unMount.add(e)}}},L=()=>r.shouldFocusError&&tg(a,E,o.mount),_=(e,t)=>async s=>{let l;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let c=eL(i);if(f.state.next({isSubmitting:!0}),r.resolver){let{errors:e,values:t}=await y();x(),n.errors=e,c=eL(t)}else await w(a);if(o.disabled.size)for(let e of o.disabled)tt(c,e);if(tt(n.errors,"root"),e8(n.errors)){f.state.next({errors:{}});try{await e(c,s)}catch(e){l=e}}else t&&await t({...n.errors},s),L(),setTimeout(L);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:e8(n.errors)&&!l,submitCount:n.submitCount+1,errors:n.errors}),l)throw l},V=(e,t={})=>{let c=e?eL(e):s,d=eL(c),m=e8(e),p=m?s:d;if(t.keepDefaultValues||(s=c),!t.keepValues){if(t.keepDirtyValues)for(let e of Array.from(new Set([...o.mount,...Object.keys(ta(s,i))]))){let t=e$(n.dirtyFields,e),r=e$(i,e),a=e$(p,e);t&&!e_(r)?eU(p,e,r):t||e_(a)||S(e,a)}else{if(eD&&e_(e))for(let e of o.mount){let t=e$(a,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(e7(e)){let t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(let e of o.mount)S(e,e$(p,e));else a={}}i=r.shouldUnregister?t.keepDefaultValues?eL(s):{}:eL(p),f.array.next({values:{...p}}),f.state.next({values:{...p}})}o={mount:t.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!e8(p),l.watch=!!r.shouldUnregister,l.keepIsValid=!!t.keepIsValid,l.action=!1,t.keepErrors||(n.errors={}),f.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!m&&(t.keepDirty?n.isDirty:!!(t.keepDefaultValues&&!e5(e,s))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:m?{}:t.keepDirtyValues?t.keepDefaultValues&&i?ta(s,i):n.dirtyFields:t.keepDefaultValues&&e?ta(s,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:s})},I=(e,t)=>V(eq(e)?e(i):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},q={control:{register:D,unregister:F,getFieldState:T,handleSubmit:_,setError:O,_subscribe:M,_runSchema:y,_updateIsValidating:x,_focusError:L,_getWatch:j,_getDirty:k,_setValid:h,_setFieldArray:(e,t=[],o,c,d=!0,p=!0)=>{if(c&&o&&!r.disabled){if(l.action=!0,p&&Array.isArray(e$(a,e))){let t=o(e$(a,e),c.argA,c.argB);d&&eU(a,e,t)}if(p&&Array.isArray(e$(n.errors,e))){let t,r=o(e$(n.errors,e),c.argA,c.argB);d&&eU(n.errors,e,r),eV(e$(t=n.errors,e)).length||tt(t,e)}if((u.touchedFields||m.touchedFields)&&p&&Array.isArray(e$(n.touchedFields,e))){let t=o(e$(n.touchedFields,e),c.argA,c.argB);d&&eU(n.touchedFields,e,t)}(u.dirtyFields||m.dirtyFields)&&(n.dirtyFields=ta(s,i)),f.state.next({name:e,isDirty:k(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else eU(i,e,t)},_setDisabledField:P,_setErrors:e=>{n.errors=e,f.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>eV(e$(l.mount?i:s,e,r.shouldUnregister?e$(s,e,[]):[])),_reset:V,_resetDefaultValues:()=>eq(r.defaultValues)&&r.defaultValues().then(e=>{I(e,r.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(let e of o.unMount){let t=e$(a,e);t&&(t._f.refs?t._f.refs.every(e=>!te(e)):!te(t._f.ref))&&F(e)}o.unMount=new Set},_disableForm:e=>{"boolean"==typeof e&&(f.state.next({disabled:e}),tg(a,(t,r)=>{let n=e$(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:f,_proxyFormState:u,get _fields(){return a},get _formValues(){return i},get _state(){return l},set _state(value){l=value},get _defaultValues(){return s},get _names(){return o},set _names(value){o=value},get _formState(){return n},get _options(){return r},set _options(value){r={...r,...value}}},subscribe:e=>(l.mount=!0,m={...m,...e.formState},M({...e,formState:{...d,...e.formState}})),trigger:R,register:D,handleSubmit:_,watch:(e,t)=>eq(e)?f.state.subscribe({next:r=>"values"in r&&e(j(void 0,t),r)}):j(e,t,!0),setValue:S,getValues:A,reset:I,resetField:(e,t={})=>{e$(a,e)&&(e_(t.defaultValue)?S(e,eL(e$(s,e))):(S(e,t.defaultValue),eU(s,e,eL(t.defaultValue))),t.keepTouched||tt(n.touchedFields,e),t.keepDirty||(tt(n.dirtyFields,e),n.isDirty=t.defaultValue?k(e,eL(e$(s,e))):k()),!t.keepError&&(tt(n.errors,e),u.isValid&&h()),f.state.next({...n}))},clearErrors:e=>{let t=e?e9(e):void 0;null==t||t.forEach(e=>tt(n.errors,e)),t?t.forEach(e=>{f.state.next({name:e,errors:n.errors})}):f.state.next({errors:{}})},unregister:F,setError:O,setFocus:(e,t={})=>{let r=e$(a,e),n=r&&r._f;if(n){let e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&eq(e.select)&&e.select()})}},getFieldState:T};return{...q,formControl:q}}(e);t.current={...a,formState:n}}let s=t.current.control;return s._options=e,eZ(()=>{let e=s._subscribe({formState:s._proxyFormState,callback:()=>a({...s._formState}),reRenderRoot:!0});return a(e=>({...e,isReady:!0})),s._formState.isReady=!0,e},[s]),f.default.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),f.default.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),f.default.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),f.default.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),f.default.useEffect(()=>{if(s._proxyFormState.isDirty){let e=s._getDirty();e!==n.isDirty&&s._subjects.state.next({isDirty:e})}},[s,n.isDirty]),f.default.useEffect(()=>{var t;e.values&&!e5(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),(null==(t=s._options.resetOptions)?void 0:t.keepIsValid)||s._setValid(),r.current=e.values,a(e=>({...e}))):s._resetDefaultValues()},[s,e.values]),f.default.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=f.default.useMemo(()=>eJ(n,s),[s,n]),t.current}var tN=e.i(74080);function tS(e,[t,r]){return Math.min(r,Math.max(t,e))}function tC(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function tE(e,t=[]){let r=[],n=()=>{let t=r.map(e=>f.createContext(e));return function(r){let n=r?.[e]||t;return f.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let a=f.createContext(n),s=r.length;r=[...r,n];let i=t=>{let{scope:r,children:n,...i}=t,l=r?.[e]?.[s]||a,o=f.useMemo(()=>i,Object.values(i));return(0,m.jsx)(l.Provider,{value:o,children:n})};return i.displayName=t+"Provider",[i,function(r,i){let l=i?.[e]?.[s]||a,o=f.useContext(l);if(o)return o;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let a=r(e)[`__scope${n}`];return{...t,...a}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}function tR(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function tA(...e){return t=>{let r=!1,n=e.map(e=>{let n=tR(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():tR(e[t],null)}}}}function tT(...e){return f.useCallback(tA(...e),e)}function tO(e){var t;let r,n=(t=e,(r=f.forwardRef((e,t)=>{let{children:r,...n}=e;if(f.isValidElement(r)){var a;let e,s,i=(a=r,(s=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(s=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),l=function(e,t){let r={...t};for(let n in t){let a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{let t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==f.Fragment&&(l.ref=t?tA(t,i):i),f.cloneElement(r,l)}return f.Children.count(r)>1?f.Children.only(null):null})).displayName=`${t}.SlotClone`,r),a=f.forwardRef((e,t)=>{let{children:r,...a}=e,s=f.Children.toArray(r),i=s.find(tF);if(i){let e=i.props.children,r=s.map(t=>t!==i?t:f.Children.count(e)>1?f.Children.only(null):f.isValidElement(e)?e.props.children:null);return(0,m.jsx)(n,{...a,ref:t,children:f.isValidElement(e)?f.cloneElement(e,void 0,r):null})}return(0,m.jsx)(n,{...a,ref:t,children:r})});return a.displayName=`${e}.Slot`,a}"u">typeof window&&window.document&&window.document.createElement;var tM=Symbol("radix.slottable");function tF(e){return f.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===tM}var tP=new WeakMap;function tD(e,t){var r,n;let a,s,i;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let l=(r=e,n=t,a=r.length,(i=(s=tL(n))>=0?s:a+s)<0||i>=a?-1:i);return -1===l?void 0:e[l]}function tL(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#C;constructor(e){super(e),this.#C=[...super.keys()],tP.set(this,!0)}set(e,t){return tP.get(this)&&(this.has(e)?this.#C[this.#C.indexOf(e)]=e:this.#C.push(e)),super.set(e,t),this}insert(e,t,r){let n,a=this.has(t),s=this.#C.length,i=tL(e),l=i>=0?i:s+i,o=l<0||l>=s?-1:l;if(o===this.size||a&&o===this.size-1||-1===o)return this.set(t,r),this;let c=this.size+ +!a;i<0&&l++;let d=[...this.#C],u=!1;for(let e=l;e<c;e++)if(l===e){let s=d[e];d[e]===t&&(s=d[e+1]),a&&this.delete(t),n=this.get(s),this.set(t,r)}else{u||d[e-1]!==t||(u=!0);let r=d[u?e:e-1],a=n;n=this.get(r),this.delete(r),this.set(r,a)}return this}with(t,r,n){let a=new e(this);return a.insert(t,r,n),a}before(e){let t=this.#C.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#C.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#C.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#C.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#C=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#C.splice(this.#C.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=tD(this.#C,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=tD(this.#C,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#C.indexOf(e)}keyAt(e){return tD(this.#C,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],a=0;for(let e of this)Reflect.apply(t,r,[e,a,this])&&n.push(e),a++;return new e(n)}map(t,r){let n=[],a=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,a,this])]),a++;return new e(n)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let r of this)a=0===n&&1===e.length?r:Reflect.apply(t,this,[a,r,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let a=this.at(r);n=r===this.size-1&&1===e.length?a:Reflect.apply(t,this,[n,a,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,a=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(a=r-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}});var t_=f.createContext(void 0),tV=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=tO(`Primitive.${t}`),n=f.forwardRef((e,n)=>{let{asChild:a,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,m.jsx)(a?r:t,{...s,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function tI(e){let t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...e)=>t.current?.(...e),[])}var t$="dismissableLayer.update",tq=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),tU=f.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...o}=e,c=f.useContext(tq),[u,p]=f.useState(null),h=u?.ownerDocument??globalThis?.document,[,x]=f.useState({}),g=tT(t,e=>p(e)),b=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),v=b.indexOf(y),w=u?b.indexOf(u):-1,k=c.layersWithOutsidePointerEventsDisabled.size>0,j=w>=v,z=function(e,t=globalThis?.document){let r=tI(e),n=f.useRef(!1),a=f.useRef(()=>{});return f.useEffect(()=>{let e=e=>{if(e.target&&!n.current){let n=function(){tW("dismissableLayer.pointerDownOutside",r,s,{discrete:!0})},s={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",a.current),a.current=n,t.addEventListener("click",a.current,{once:!0})):n()}else t.removeEventListener("click",a.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",e),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{let t=e.target,r=[...c.branches].some(e=>e.contains(t));j&&!r&&(a?.(e),i?.(e),e.defaultPrevented||l?.())},h),N=function(e,t=globalThis?.document){let r=tI(e),n=f.useRef(!1);return f.useEffect(()=>{let e=e=>{e.target&&!n.current&&tW("dismissableLayer.focusOutside",r,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{let t=e.target;![...c.branches].some(e=>e.contains(t))&&(s?.(e),i?.(e),e.defaultPrevented||l?.())},h);return!function(e,t=globalThis?.document){let r=tI(e);f.useEffect(()=>{let e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{w===c.layers.size-1&&(n?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},h),f.useEffect(()=>{if(u)return r&&(0===c.layersWithOutsidePointerEventsDisabled.size&&(d=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),tB(),()=>{r&&1===c.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=d)}},[u,h,r,c]),f.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),tB())},[u,c]),f.useEffect(()=>{let e=()=>x({});return document.addEventListener(t$,e),()=>document.removeEventListener(t$,e)},[]),(0,m.jsx)(tV.div,{...o,ref:g,style:{pointerEvents:k?j?"auto":"none":void 0,...e.style},onFocusCapture:tC(e.onFocusCapture,N.onFocusCapture),onBlurCapture:tC(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:tC(e.onPointerDownCapture,z.onPointerDownCapture)})});function tB(){let e=new CustomEvent(t$);document.dispatchEvent(e)}function tW(e,t,r,{discrete:n}){let a=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});if(t&&a.addEventListener(e,t,{once:!0}),n)a&&tN.flushSync(()=>a.dispatchEvent(s));else a.dispatchEvent(s)}tU.displayName="DismissableLayer",f.forwardRef((e,t)=>{let r=f.useContext(tq),n=f.useRef(null),a=tT(t,n);return f.useEffect(()=>{let e=n.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),(0,m.jsx)(tV.div,{...e,ref:a})}).displayName="DismissableLayerBranch";var tH=0;function tQ(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var tK="focusScope.autoFocusOnMount",tG="focusScope.autoFocusOnUnmount",tY={bubbles:!1,cancelable:!0},tX=f.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[l,o]=f.useState(null),c=tI(a),d=tI(s),u=f.useRef(null),p=tT(t,e=>o(e)),h=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(n){let e=function(e){if(h.paused||!l)return;let t=e.target;l.contains(t)?u.current=t:t0(u.current,{select:!0})},t=function(e){if(h.paused||!l)return;let t=e.relatedTarget;null!==t&&(l.contains(t)||t0(u.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&t0(l)});return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[n,l,h.paused]),f.useEffect(()=>{if(l){t1.add(h);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(tK,tY);l.addEventListener(tK,c),l.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(t0(n,{select:t}),document.activeElement!==r)return}(tJ(l).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&t0(l))}return()=>{l.removeEventListener(tK,c),setTimeout(()=>{let t=new CustomEvent(tG,tY);l.addEventListener(tG,d),l.dispatchEvent(t),t.defaultPrevented||t0(e??document.body,{select:!0}),l.removeEventListener(tG,d),t1.remove(h)},0)}}},[l,c,d,h]);let x=f.useCallback(e=>{if(!r&&!n||h.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){var s;let t,n=e.currentTarget,[i,l]=[tZ(t=tJ(s=n),s),tZ(t.reverse(),s)];i&&l?e.shiftKey||a!==l?e.shiftKey&&a===i&&(e.preventDefault(),r&&t0(l,{select:!0})):(e.preventDefault(),r&&t0(i,{select:!0})):a===n&&e.preventDefault()}},[r,n,h.paused]);return(0,m.jsx)(tV.div,{tabIndex:-1,...i,ref:p,onKeyDown:x})});function tJ(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function tZ(e,t){for(let r of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function t0(e,{select:t=!1}={}){if(e&&e.focus){var r;let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}tX.displayName="FocusScope";var t1=(n=[],{add(e){let t=n[0];e!==t&&t?.pause(),(n=t2(n,e)).unshift(e)},remove(e){n=t2(n,e),n[0]?.resume()}});function t2(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}var t5=globalThis?.document?f.useLayoutEffect:()=>{},t4=f[" useId ".trim().toString()]||(()=>void 0),t3=0;function t9(e){let[t,r]=f.useState(t4());return t5(()=>{e||r(e=>e??String(t3++))},[e]),e||(t?`radix-${t}`:"")}let t6=["top","right","bottom","left"],t8=Math.min,t7=Math.max,re=Math.round,rt=Math.floor,rr=e=>({x:e,y:e}),rn={left:"right",right:"left",bottom:"top",top:"bottom"};function ra(e,t){return"function"==typeof e?e(t):e}function rs(e){return e.split("-")[0]}function ri(e){return e.split("-")[1]}function rl(e){return"x"===e?"y":"x"}function ro(e){return"y"===e?"height":"width"}function rc(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function rd(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let ru=["left","right"],rm=["right","left"],rf=["top","bottom"],rp=["bottom","top"];function rh(e){let t=rs(e);return rn[t]+e.slice(t.length)}function rx(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function rg(e){let{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function rb(e,t,r){let n,{reference:a,floating:s}=e,i=rc(t),l=rl(rc(t)),o=ro(l),c=rs(t),d="y"===i,u=a.x+a.width/2-s.width/2,m=a.y+a.height/2-s.height/2,f=a[o]/2-s[o]/2;switch(c){case"top":n={x:u,y:a.y-s.height};break;case"bottom":n={x:u,y:a.y+a.height};break;case"right":n={x:a.x+a.width,y:m};break;case"left":n={x:a.x-s.width,y:m};break;default:n={x:a.x,y:a.y}}switch(ri(t)){case"start":n[l]-=f*(r&&d?-1:1);break;case"end":n[l]+=f*(r&&d?-1:1)}return n}async function ry(e,t){var r;void 0===t&&(t={});let{x:n,y:a,platform:s,rects:i,elements:l,strategy:o}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:m=!1,padding:f=0}=ra(t,e),p=rx(f),h=l[m?"floating"===u?"reference":"floating":u],x=rg(await s.getClippingRect({element:null==(r=await (null==s.isElement?void 0:s.isElement(h)))||r?h:h.contextElement||await (null==s.getDocumentElement?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:d,strategy:o})),g="floating"===u?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,b=await (null==s.getOffsetParent?void 0:s.getOffsetParent(l.floating)),y=await (null==s.isElement?void 0:s.isElement(b))&&await (null==s.getScale?void 0:s.getScale(b))||{x:1,y:1},v=rg(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:g,offsetParent:b,strategy:o}):g);return{top:(x.top-v.top+p.top)/y.y,bottom:(v.bottom-x.bottom+p.bottom)/y.y,left:(x.left-v.left+p.left)/y.x,right:(v.right-x.right+p.right)/y.x}}let rv=async(e,t,r)=>{let{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:i}=r,l=i.detectOverflow?i:{...i,detectOverflow:ry},o=await (null==i.isRTL?void 0:i.isRTL(t)),c=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=rb(c,n,o),m=n,f=0,p={};for(let r=0;r<s.length;r++){let h=s[r];if(!h)continue;let{name:x,fn:g}=h,{x:b,y:y,data:v,reset:w}=await g({x:d,y:u,initialPlacement:n,placement:m,strategy:a,middlewareData:p,rects:c,platform:l,elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=y?y:u,p[x]={...p[x],...v},w&&f<50&&(f++,"object"==typeof w&&(w.placement&&(m=w.placement),w.rects&&(c=!0===w.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):w.rects),{x:d,y:u}=rb(c,m,o)),r=-1)}return{x:d,y:u,placement:m,strategy:a,middlewareData:p}};function rw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function rk(e){return t6.some(t=>e[t]>=0)}let rj=new Set(["left","top"]);async function rz(e,t){let{placement:r,platform:n,elements:a}=e,s=await (null==n.isRTL?void 0:n.isRTL(a.floating)),i=rs(r),l=ri(r),o="y"===rc(r),c=rj.has(i)?-1:1,d=s&&o?-1:1,u=ra(t,e),{mainAxis:m,crossAxis:f,alignmentAxis:p}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&"number"==typeof p&&(f="end"===l?-1*p:p),o?{x:f*d,y:m*c}:{x:m*c,y:f*d}}function rN(){return"u">typeof window}function rS(e){return rR(e)?(e.nodeName||"").toLowerCase():"#document"}function rC(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function rE(e){var t;return null==(t=(rR(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function rR(e){return!!rN()&&(e instanceof Node||e instanceof rC(e).Node)}function rA(e){return!!rN()&&(e instanceof Element||e instanceof rC(e).Element)}function rT(e){return!!rN()&&(e instanceof HTMLElement||e instanceof rC(e).HTMLElement)}function rO(e){return!(!rN()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof rC(e).ShadowRoot)}function rM(e){let{overflow:t,overflowX:r,overflowY:n,display:a}=r$(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==a&&"contents"!==a}function rF(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let rP=/transform|translate|scale|rotate|perspective|filter/,rD=/paint|layout|strict|content/,rL=e=>!!e&&"none"!==e;function r_(e){let t=rA(e)?r$(e):e;return rL(t.transform)||rL(t.translate)||rL(t.scale)||rL(t.rotate)||rL(t.perspective)||!rV()&&(rL(t.backdropFilter)||rL(t.filter))||rP.test(t.willChange||"")||rD.test(t.contain||"")}function rV(){return null==t&&(t="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),t}function rI(e){return/^(html|body|#document)$/.test(rS(e))}function r$(e){return rC(e).getComputedStyle(e)}function rq(e){return rA(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rU(e){if("html"===rS(e))return e;let t=e.assignedSlot||e.parentNode||rO(e)&&e.host||rE(e);return rO(t)?t.host:t}function rB(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let a=function e(t){let r=rU(t);return rI(r)?t.ownerDocument?t.ownerDocument.body:t.body:rT(r)&&rM(r)?r:e(r)}(e),s=a===(null==(n=e.ownerDocument)?void 0:n.body),i=rC(a);if(!s)return t.concat(a,rB(a,[],r));{let e=rW(i);return t.concat(i,i.visualViewport||[],rM(a)?a:[],e&&r?rB(e):[])}}function rW(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function rH(e){let t=r$(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,a=rT(e),s=a?e.offsetWidth:r,i=a?e.offsetHeight:n,l=re(r)!==s||re(n)!==i;return l&&(r=s,n=i),{width:r,height:n,$:l}}function rQ(e){return rA(e)?e:e.contextElement}function rK(e){let t=rQ(e);if(!rT(t))return rr(1);let r=t.getBoundingClientRect(),{width:n,height:a,$:s}=rH(t),i=(s?re(r.width):r.width)/n,l=(s?re(r.height):r.height)/a;return i&&Number.isFinite(i)||(i=1),l&&Number.isFinite(l)||(l=1),{x:i,y:l}}let rG=rr(0);function rY(e){let t=rC(e);return rV()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:rG}function rX(e,t,r,n){var a;void 0===t&&(t=!1),void 0===r&&(r=!1);let s=e.getBoundingClientRect(),i=rQ(e),l=rr(1);t&&(n?rA(n)&&(l=rK(n)):l=rK(e));let o=(void 0===(a=r)&&(a=!1),n&&(!a||n===rC(i))&&a)?rY(i):rr(0),c=(s.left+o.x)/l.x,d=(s.top+o.y)/l.y,u=s.width/l.x,m=s.height/l.y;if(i){let e=rC(i),t=n&&rA(n)?rC(n):n,r=e,a=rW(r);for(;a&&n&&t!==r;){let e=rK(a),t=a.getBoundingClientRect(),n=r$(a),s=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,d*=e.y,u*=e.x,m*=e.y,c+=s,d+=i,a=rW(r=rC(a))}}return rg({width:u,height:m,x:c,y:d})}function rJ(e,t){let r=rq(e).scrollLeft;return t?t.left+r:rX(rE(e)).left+r}function rZ(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-rJ(e,r),y:r.top+t.scrollTop}}function r0(e,t,r){var n;let a;if("viewport"===t)a=function(e,t){let r=rC(e),n=rE(e),a=r.visualViewport,s=n.clientWidth,i=n.clientHeight,l=0,o=0;if(a){s=a.width,i=a.height;let e=rV();(!e||e&&"fixed"===t)&&(l=a.offsetLeft,o=a.offsetTop)}let c=rJ(n);if(c<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,i=Math.abs(n.clientWidth-t.clientWidth-a);i<=25&&(s-=i)}else c<=25&&(s+=c);return{width:s,height:i,x:l,y:o}}(e,r);else if("document"===t){let t,r,s,i,l,o,c;n=rE(e),t=rE(n),r=rq(n),s=n.ownerDocument.body,i=t7(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=t7(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),o=-r.scrollLeft+rJ(n),c=-r.scrollTop,"rtl"===r$(s).direction&&(o+=t7(t.clientWidth,s.clientWidth)-i),a={width:i,height:l,x:o,y:c}}else if(rA(t)){let e,n,s,i,l,o;n=(e=rX(t,!0,"fixed"===r)).top+t.clientTop,s=e.left+t.clientLeft,i=rT(t)?rK(t):rr(1),l=t.clientWidth*i.x,o=t.clientHeight*i.y,a={width:l,height:o,x:s*i.x,y:n*i.y}}else{let r=rY(e);a={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return rg(a)}function r1(e){return"static"===r$(e).position}function r2(e,t){if(!rT(e)||"fixed"===r$(e).position)return null;if(t)return t(e);let r=e.offsetParent;return rE(e)===r&&(r=r.ownerDocument.body),r}function r5(e,t){var r;let n=rC(e);if(rF(e))return n;if(!rT(e)){let t=rU(e);for(;t&&!rI(t);){if(rA(t)&&!r1(t))return t;t=rU(t)}return n}let a=r2(e,t);for(;a&&(r=a,/^(table|td|th)$/.test(rS(r)))&&r1(a);)a=r2(a,t);return a&&rI(a)&&r1(a)&&!r_(a)?n:a||function(e){let t=rU(e);for(;rT(t)&&!rI(t);){if(r_(t))return t;if(rF(t))break;t=rU(t)}return null}(e)||n}let r4=async function(e){let t=this.getOffsetParent||r5,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=rT(t),a=rE(t),s="fixed"===r,i=rX(e,!0,s,t),l={scrollLeft:0,scrollTop:0},o=rr(0);if(n||!n&&!s)if(("body"!==rS(t)||rM(a))&&(l=rq(t)),n){let e=rX(t,!0,s,t);o.x=e.x+t.clientLeft,o.y=e.y+t.clientTop}else a&&(o.x=rJ(a));s&&!n&&a&&(o.x=rJ(a));let c=!a||n||s?rr(0):rZ(a,l);return{x:i.left+l.scrollLeft-o.x-c.x,y:i.top+l.scrollTop-o.y-c.y,width:i.width,height:i.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},r3={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e,s="fixed"===a,i=rE(n),l=!!t&&rF(t.floating);if(n===i||l&&s)return r;let o={scrollLeft:0,scrollTop:0},c=rr(1),d=rr(0),u=rT(n);if((u||!u&&!s)&&(("body"!==rS(n)||rM(i))&&(o=rq(n)),u)){let e=rX(n);c=rK(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}let m=!i||u||s?rr(0):rZ(i,o);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-o.scrollLeft*c.x+d.x+m.x,y:r.y*c.y-o.scrollTop*c.y+d.y+m.y}},getDocumentElement:rE,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e,s=[..."clippingAncestors"===r?rF(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=rB(e,[],!1).filter(e=>rA(e)&&"body"!==rS(e)),a=null,s="fixed"===r$(e).position,i=s?rU(e):e;for(;rA(i)&&!rI(i);){let t=r$(i),r=r_(i);r||"fixed"!==t.position||(a=null),(s?r||a:!(!r&&"static"===t.position&&a&&("absolute"===a.position||"fixed"===a.position)||rM(i)&&!r&&function e(t,r){let n=rU(t);return!(n===r||!rA(n)||rI(n))&&("fixed"===r$(n).position||e(n,r))}(e,i)))?a=t:n=n.filter(e=>e!==i),i=rU(i)}return t.set(e,n),n}(t,this._c):[].concat(r),n],i=r0(t,s[0],a),l=i.top,o=i.right,c=i.bottom,d=i.left;for(let e=1;e<s.length;e++){let r=r0(t,s[e],a);l=t7(r.top,l),o=t8(r.right,o),c=t8(r.bottom,c),d=t7(r.left,d)}return{width:o-d,height:c-l,x:d,y:l}},getOffsetParent:r5,getElementRects:r4,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=rH(e);return{width:t,height:r}},getScale:rK,isElement:rA,isRTL:function(e){return"rtl"===r$(e).direction}};function r9(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let r6=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:a,rects:s,platform:i,elements:l,middlewareData:o}=t,{element:c,padding:d=0}=ra(e,t)||{};if(null==c)return{};let u=rx(d),m={x:r,y:n},f=rl(rc(a)),p=ro(f),h=await i.getDimensions(c),x="y"===f,g=x?"clientHeight":"clientWidth",b=s.reference[p]+s.reference[f]-m[f]-s.floating[p],y=m[f]-s.reference[f],v=await (null==i.getOffsetParent?void 0:i.getOffsetParent(c)),w=v?v[g]:0;w&&await (null==i.isElement?void 0:i.isElement(v))||(w=l.floating[g]||s.floating[p]);let k=w/2-h[p]/2-1,j=t8(u[x?"top":"left"],k),z=t8(u[x?"bottom":"right"],k),N=w-h[p]-z,S=w/2-h[p]/2+(b/2-y/2),C=t7(j,t8(S,N)),E=!o.arrow&&null!=ri(a)&&S!==C&&s.reference[p]/2-(S<j?j:z)-h[p]/2<0,R=E?S<j?S-j:S-N:0;return{[f]:m[f]+R,data:{[f]:C,centerOffset:S-C-R,...E&&{alignmentOffset:R}},reset:E}}});var r8="u">typeof document?f.useLayoutEffect:function(){};function r7(e,t){let r,n,a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!r7(e[n],t[n]))return!1;return!0}if((r=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!=n--;){let r=a[n];if(("_owner"!==r||!e.$$typeof)&&!r7(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function ne(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nt(e,t){let r=ne(e);return Math.round(t*r)/r}function nr(e){let t=f.useRef(e);return r8(()=>{t.current=e}),t}var nn=f.forwardRef((e,t)=>{let{children:r,width:n=10,height:a=5,...s}=e;return(0,m.jsx)(tV.svg,{...s,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,m.jsx)("polygon",{points:"0,0 30,0 15,10"})})});nn.displayName="Arrow";var na="Popper",[ns,ni]=tE(na),[nl,no]=ns(na),nc=e=>{let{__scopePopper:t,children:r}=e,[n,a]=f.useState(null);return(0,m.jsx)(nl,{scope:t,anchor:n,onAnchorChange:a,children:r})};nc.displayName=na;var nd="PopperAnchor",nu=f.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...a}=e,s=no(nd,r),i=f.useRef(null),l=tT(t,i),o=f.useRef(null);return f.useEffect(()=>{let e=o.current;o.current=n?.current||i.current,e!==o.current&&s.onAnchorChange(o.current)}),n?null:(0,m.jsx)(tV.div,{...a,ref:l})});nu.displayName=nd;var nm="PopperContent",[nf,np]=ns(nm),nh=f.forwardRef((e,t)=>{var r,n,a,s,i,l,o,c,d,u,p,h,x,g,b,y,v,w,k,j,z;let N,S,C,E,R,A,{__scopePopper:T,side:O="bottom",sideOffset:M=0,align:F="center",alignOffset:P=0,arrowPadding:D=0,avoidCollisions:L=!0,collisionBoundary:_=[],collisionPadding:V=0,sticky:I="partial",hideWhenDetached:$=!1,updatePositionStrategy:q="optimized",onPlaced:U,...B}=e,W=no(nm,T),[H,Q]=f.useState(null),K=tT(t,e=>Q(e)),[G,Y]=f.useState(null),X=function(e){let[t,r]=f.useState(void 0);return t5(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,a;if(!Array.isArray(t)||!t.length)return;let s=t[0];if("borderBoxSize"in s){let e=s.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,a=t.blockSize}else n=e.offsetWidth,a=e.offsetHeight;r({width:n,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}(G),J=X?.width??0,Z=X?.height??0,ee="number"==typeof V?V:{top:0,right:0,bottom:0,left:0,...V},et=Array.isArray(_)?_:[_],er=et.length>0,en={padding:ee,boundary:et.filter(ny),altBoundary:er},{refs:ea,floatingStyles:es,placement:ei,isPositioned:el,middlewareData:eo}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:o,open:c}=e,[d,u]=f.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=f.useState(n);r7(m,n)||p(n);let[h,x]=f.useState(null),[g,b]=f.useState(null),y=f.useCallback(e=>{e!==j.current&&(j.current=e,x(e))},[]),v=f.useCallback(e=>{e!==z.current&&(z.current=e,b(e))},[]),w=s||h,k=i||g,j=f.useRef(null),z=f.useRef(null),N=f.useRef(d),S=null!=o,C=nr(o),E=nr(a),R=nr(c),A=f.useCallback(()=>{var e,n;let a,s,i;if(!j.current||!z.current)return;let l={placement:t,strategy:r,middleware:m};E.current&&(l.platform=E.current),(e=j.current,n=z.current,a=new Map,i={...(s={platform:r3,...l}).platform,_c:a},rv(e,n,{...s,platform:i})).then(e=>{let t={...e,isPositioned:!1!==R.current};T.current&&!r7(N.current,t)&&(N.current=t,tN.flushSync(()=>{u(t)}))})},[m,t,r,E,R]);r8(()=>{!1===c&&N.current.isPositioned&&(N.current.isPositioned=!1,u(e=>({...e,isPositioned:!1})))},[c]);let T=f.useRef(!1);r8(()=>(T.current=!0,()=>{T.current=!1}),[]),r8(()=>{if(w&&(j.current=w),k&&(z.current=k),w&&k){if(C.current)return C.current(w,k,A);A()}},[w,k,A,C,S]);let O=f.useMemo(()=>({reference:j,floating:z,setReference:y,setFloating:v}),[y,v]),M=f.useMemo(()=>({reference:w,floating:k}),[w,k]),F=f.useMemo(()=>{let e={position:r,left:0,top:0};if(!M.floating)return e;let t=nt(M.floating,d.x),n=nt(M.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...ne(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,M.floating,d.x,d.y]);return f.useMemo(()=>({...d,update:A,refs:O,elements:M,floatingStyles:F}),[d,A,O,M,F])}({strategy:"fixed",placement:O+("center"!==F?"-"+F:""),whileElementsMounted:(...e)=>(function(e,t,r,n){let a;void 0===n&&(n={});let{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:o="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,d=rQ(e),u=s||i?[...d?rB(d):[],...t?rB(t):[]]:[];u.forEach(e=>{s&&e.addEventListener("scroll",r,{passive:!0}),i&&e.addEventListener("resize",r)});let m=d&&o?function(e,t){let r,n=null,a=rE(e);function s(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function i(l,o){void 0===l&&(l=!1),void 0===o&&(o=1),s();let c=e.getBoundingClientRect(),{left:d,top:u,width:m,height:f}=c;if(l||t(),!m||!f)return;let p={rootMargin:-rt(u)+"px "+-rt(a.clientWidth-(d+m))+"px "+-rt(a.clientHeight-(u+f))+"px "+-rt(d)+"px",threshold:t7(0,t8(1,o))||1},h=!0;function x(t){let n=t[0].intersectionRatio;if(n!==o){if(!h)return i();n?i(!1,n):r=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==n||r9(c,e.getBoundingClientRect())||i(),h=!1}try{n=new IntersectionObserver(x,{...p,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(x,p)}n.observe(e)}(!0),s}(d,r):null,f=-1,p=null;l&&(p=new ResizeObserver(e=>{let[n]=e;n&&n.target===d&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),r()}),d&&!c&&p.observe(d),t&&p.observe(t));let h=c?rX(e):null;return c&&function t(){let n=rX(e);h&&!r9(h,n)&&r(),h=n,a=requestAnimationFrame(t)}(),r(),()=>{var e;u.forEach(e=>{s&&e.removeEventListener("scroll",r),i&&e.removeEventListener("resize",r)}),null==m||m(),null==(e=p)||e.disconnect(),p=null,c&&cancelAnimationFrame(a)}})(...e,{animationFrame:"always"===q}),elements:{reference:W.anchor},middleware:[{name:(N={name:"offset",options:a=r={mainAxis:M+Z,alignmentAxis:P},async fn(e){var t,r;let{x:n,y:s,placement:i,middlewareData:l}=e,o=await rz(e,a);return i===(null==(t=l.offset)?void 0:t.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:n+o.x,y:s+o.y,data:{...o,placement:i}}}}).name,fn:N.fn,options:[r,n]},L&&{name:(S={name:"shift",options:d=o={mainAxis:!0,crossAxis:!1,limiter:"partial"===I?{fn:(void 0===(l=s)&&(l={}),{options:l,fn(e){let{x:t,y:r,placement:n,rects:a,middlewareData:s}=e,{offset:i=0,mainAxis:o=!0,crossAxis:c=!0}=ra(l,e),d={x:t,y:r},u=rc(n),m=rl(u),f=d[m],p=d[u],h=ra(i,e),x="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(o){let e="y"===m?"height":"width",t=a.reference[m]-a.floating[e]+x.mainAxis,r=a.reference[m]+a.reference[e]-x.mainAxis;f<t?f=t:f>r&&(f=r)}if(c){var g,b;let e="y"===m?"width":"height",t=rj.has(rs(n)),r=a.reference[u]-a.floating[e]+(t&&(null==(g=s.offset)?void 0:g[u])||0)+(t?0:x.crossAxis),i=a.reference[u]+a.reference[e]+(t?0:(null==(b=s.offset)?void 0:b[u])||0)-(t?x.crossAxis:0);p<r?p=r:p>i&&(p=i)}return{[m]:f,[u]:p}}}).fn,options:[s,i]}:void 0,...en},async fn(e){let{x:t,y:r,placement:n,platform:a}=e,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...o}=ra(d,e),c={x:t,y:r},u=await a.detectOverflow(e,o),m=rc(rs(n)),f=rl(m),p=c[f],h=c[m];if(s){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=p+u[e],n=p-u[t];p=t7(r,t8(p,n))}if(i){let e="y"===m?"top":"left",t="y"===m?"bottom":"right",r=h+u[e],n=h-u[t];h=t7(r,t8(h,n))}let x=l.fn({...e,[f]:p,[m]:h});return{...x,data:{x:x.x-t,y:x.y-r,enabled:{[f]:s,[m]:i}}}}}).name,fn:S.fn,options:[o,c]},L&&{name:(C={name:"flip",options:h=u={...en},async fn(e){var t,r,n,a,s,i,l,o;let c,d,u,{placement:m,middlewareData:f,rects:p,initialPlacement:x,platform:g,elements:b}=e,{mainAxis:y=!0,crossAxis:v=!0,fallbackPlacements:w,fallbackStrategy:k="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:z=!0,...N}=ra(h,e);if(null!=(t=f.arrow)&&t.alignmentOffset)return{};let S=rs(m),C=rc(x),E=rs(x)===x,R=await (null==g.isRTL?void 0:g.isRTL(b.floating)),A=w||(E||!z?[rh(x)]:(c=rh(x),[rd(x),c,rd(c)])),T="none"!==j;!w&&T&&A.push(...(d=ri(x),u=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?rm:ru;return t?ru:rm;case"left":case"right":return t?rf:rp;default:return[]}}(rs(x),"start"===j,R),d&&(u=u.map(e=>e+"-"+d),z&&(u=u.concat(u.map(rd)))),u));let O=[x,...A],M=await g.detectOverflow(e,N),F=[],P=(null==(r=f.flip)?void 0:r.overflows)||[];if(y&&F.push(M[S]),v){let e,t,r,n,a=(i=m,l=p,void 0===(o=R)&&(o=!1),e=ri(i),r=ro(t=rl(rc(i))),n="x"===t?e===(o?"end":"start")?"right":"left":"start"===e?"bottom":"top",l.reference[r]>l.floating[r]&&(n=rh(n)),[n,rh(n)]);F.push(M[a[0]],M[a[1]])}if(P=[...P,{placement:m,overflows:F}],!F.every(e=>e<=0)){let e=((null==(n=f.flip)?void 0:n.index)||0)+1,t=O[e];if(t&&("alignment"!==v||C===rc(t)||P.every(e=>rc(e.placement)!==C||e.overflows[0]>0)))return{data:{index:e,overflows:P},reset:{placement:t}};let r=null==(a=P.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!r)switch(k){case"bestFit":{let e=null==(s=P.filter(e=>{if(T){let t=rc(e.placement);return t===C||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:s[0];e&&(r=e);break}case"initialPlacement":r=x}if(m!==r)return{reset:{placement:r}}}return{}}}).name,fn:C.fn,options:[u,p]},{name:(E={name:"size",options:b=x={...en,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:a,height:s}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${r}px`),i.setProperty("--radix-popper-available-height",`${n}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${s}px`)}},async fn(e){var t,r;let n,a,{placement:s,rects:i,platform:l,elements:o}=e,{apply:c=()=>{},...d}=ra(b,e),u=await l.detectOverflow(e,d),m=rs(s),f=ri(s),p="y"===rc(s),{width:h,height:x}=i.floating;"top"===m||"bottom"===m?(n=m,a=f===(await (null==l.isRTL?void 0:l.isRTL(o.floating))?"start":"end")?"left":"right"):(a=m,n="end"===f?"top":"bottom");let g=x-u.top-u.bottom,y=h-u.left-u.right,v=t8(x-u[n],g),w=t8(h-u[a],y),k=!e.middlewareData.shift,j=v,z=w;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(z=y),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(j=g),k&&!f){let e=t7(u.left,0),t=t7(u.right,0),r=t7(u.top,0),n=t7(u.bottom,0);p?z=h-2*(0!==e||0!==t?e+t:t7(u.left,u.right)):j=x-2*(0!==r||0!==n?r+n:t7(u.top,u.bottom))}await c({...e,availableWidth:z,availableHeight:j});let N=await l.getDimensions(o.floating);return h!==N.width||x!==N.height?{reset:{rects:!0}}:{}}}).name,fn:E.fn,options:[x,g]},G&&{name:(R={name:"arrow",options:w=y={element:G,padding:D},fn(e){let{element:t,padding:r}="function"==typeof w?w(e):w;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?r6({element:t.current,padding:r}).fn(e):{}:t?r6({element:t,padding:r}).fn(e):{}}}).name,fn:R.fn,options:[y,v]},nv({arrowWidth:J,arrowHeight:Z}),$&&{name:(A={name:"hide",options:z=k={strategy:"referenceHidden",...en},async fn(e){let{rects:t,platform:r}=e,{strategy:n="referenceHidden",...a}=ra(z,e);switch(n){case"referenceHidden":{let n=rw(await r.detectOverflow(e,{...a,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:n,referenceHidden:rk(n)}}}case"escaped":{let n=rw(await r.detectOverflow(e,{...a,altBoundary:!0}),t.floating);return{data:{escapedOffsets:n,escaped:rk(n)}}}default:return{}}}}).name,fn:A.fn,options:[k,j]}]}),[ec,ed]=nw(ei),eu=tI(U);t5(()=>{el&&eu?.()},[el,eu]);let em=eo.arrow?.x,ef=eo.arrow?.y,ep=eo.arrow?.centerOffset!==0,[eh,ex]=f.useState();return t5(()=>{H&&ex(window.getComputedStyle(H).zIndex)},[H]),(0,m.jsx)("div",{ref:ea.setFloating,"data-radix-popper-content-wrapper":"",style:{...es,transform:el?es.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:eh,"--radix-popper-transform-origin":[eo.transformOrigin?.x,eo.transformOrigin?.y].join(" "),...eo.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,m.jsx)(nf,{scope:T,placedSide:ec,onArrowChange:Y,arrowX:em,arrowY:ef,shouldHideArrow:ep,children:(0,m.jsx)(tV.div,{"data-side":ec,"data-align":ed,...B,ref:K,style:{...B.style,animation:el?void 0:"none"}})})})});nh.displayName=nm;var nx="PopperArrow",ng={top:"bottom",right:"left",bottom:"top",left:"right"},nb=f.forwardRef(function(e,t){let{__scopePopper:r,...n}=e,a=np(nx,r),s=ng[a.placedSide];return(0,m.jsx)("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:(0,m.jsx)(nn,{...n,ref:t,style:{...n.style,display:"block"}})})});function ny(e){return null!==e}nb.displayName=nx;var nv=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:a}=t,s=a.arrow?.centerOffset!==0,i=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[o,c]=nw(r),d={start:"0%",center:"50%",end:"100%"}[c],u=(a.arrow?.x??0)+i/2,m=(a.arrow?.y??0)+l/2,f="",p="";return"bottom"===o?(f=s?d:`${u}px`,p=`${-l}px`):"top"===o?(f=s?d:`${u}px`,p=`${n.floating.height+l}px`):"right"===o?(f=`${-l}px`,p=s?d:`${m}px`):"left"===o&&(f=`${n.floating.width+l}px`,p=s?d:`${m}px`),{data:{x:f,y:p}}}});function nw(e){let[t,r="center"]=e.split("-");return[t,r]}var nk=f.forwardRef((e,t)=>{let{container:r,...n}=e,[a,s]=f.useState(!1);t5(()=>s(!0),[]);let i=r||a&&globalThis?.document?.body;return i?tN.default.createPortal((0,m.jsx)(tV.div,{...n,ref:t}),i):null});nk.displayName="Portal",f[" useEffectEvent ".trim().toString()],f[" useInsertionEffect ".trim().toString()];var nj=f[" useInsertionEffect ".trim().toString()]||t5;function nz({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){let[a,s,i]=function({defaultProp:e,onChange:t}){let[r,n]=f.useState(e),a=f.useRef(r),s=f.useRef(t);return nj(()=>{s.current=t},[t]),f.useEffect(()=>{a.current!==r&&(s.current?.(r),a.current=r)},[r,a]),[r,n,s]}({defaultProp:t,onChange:r}),l=void 0!==e,o=l?e:a;{let t=f.useRef(void 0!==e);f.useEffect(()=>{let e=t.current;if(e!==l){let t=l?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. 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.`)}t.current=l},[l,n])}return[o,f.useCallback(t=>{if(l){let r="function"==typeof t?t(e):t;r!==e&&i.current?.(r)}else s(t)},[l,e,s,i])]}Symbol("RADIX:SYNC_STATE");var nN=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"});f.forwardRef((e,t)=>(0,m.jsx)(tV.span,{...e,ref:t,style:{...nN,...e.style}})).displayName="VisuallyHidden";var nS=new WeakMap,nC=new WeakMap,nE={},nR=0,nA=function(e){return e&&(e.host||nA(e.parentNode))},nT=function(e,t,r,n){var a=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var r=nA(e);return r&&t.contains(r)?r:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});nE[r]||(nE[r]=new WeakMap);var s=nE[r],i=[],l=new Set,o=new Set(a),c=function(e){!e||l.has(e)||(l.add(e),c(e.parentNode))};a.forEach(c);var d=function(e){!e||o.has(e)||Array.prototype.forEach.call(e.children,function(e){if(l.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,o=(nS.get(e)||0)+1,c=(s.get(e)||0)+1;nS.set(e,o),s.set(e,c),i.push(e),1===o&&a&&nC.set(e,!0),1===c&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),l.clear(),nR++,function(){i.forEach(function(e){var t=nS.get(e)-1,a=s.get(e)-1;nS.set(e,t),s.set(e,a),t||(nC.has(e)||e.removeAttribute(n),nC.delete(e)),a||e.removeAttribute(r)}),--nR||(nS=new WeakMap,nS=new WeakMap,nC=new WeakMap,nE={})}},nO=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),nT(n,a,r,"aria-hidden")):function(){return null}},nM=function(){return(nM=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function nF(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)0>t.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}var nP=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),nD="width-before-scroll-bar";function nL(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var n_="u">typeof window?f.useLayoutEffect:f.useEffect,nV=new WeakMap,nI=(void 0===a&&(a={}),(void 0===s&&(s=function(e){return e}),i=[],l=!1,o={read:function(){if(l)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:null},useMedium:function(e){var t=s(e,l);return i.push(t),function(){i=i.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(l=!0;i.length;){var t=i;i=[],t.forEach(e)}i={push:function(t){return e(t)},filter:function(){return i}}},assignMedium:function(e){l=!0;var t=[];if(i.length){var r=i;i=[],r.forEach(e),t=i}var n=function(){var r=t;t=[],r.forEach(e)},a=function(){return Promise.resolve().then(n)};a(),i={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),i}}}}).options=nM({async:!0,ssr:!1},a),o),n$=function(){},nq=f.forwardRef(function(e,t){var r,n,a,s,i=f.useRef(null),l=f.useState({onScrollCapture:n$,onWheelCapture:n$,onTouchMoveCapture:n$}),o=l[0],c=l[1],d=e.forwardProps,u=e.children,m=e.className,p=e.removeScrollBar,h=e.enabled,x=e.shards,g=e.sideCar,b=e.noRelative,y=e.noIsolation,v=e.inert,w=e.allowPinchZoom,k=e.as,j=e.gapMode,z=nF(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=(r=[i,t],n=function(e){return r.forEach(function(t){return nL(t,e)})},(a=(0,f.useState)(function(){return{value:null,callback:n,facade:{get current(){return a.value},set current(value){var e=a.value;e!==value&&(a.value=value,a.callback(value,e))}}}})[0]).callback=n,s=a.facade,n_(function(){var e=nV.get(s);if(e){var t=new Set(e),n=new Set(r),a=s.current;t.forEach(function(e){n.has(e)||nL(e,null)}),n.forEach(function(e){t.has(e)||nL(e,a)})}nV.set(s,r)},[r]),s),S=nM(nM({},z),o);return f.createElement(f.Fragment,null,h&&f.createElement(g,{sideCar:nI,removeScrollBar:p,shards:x,noRelative:b,noIsolation:y,inert:v,setCallbacks:c,allowPinchZoom:!!w,lockRef:i,gapMode:j}),d?f.cloneElement(f.Children.only(u),nM(nM({},S),{ref:N})):f.createElement(void 0===k?"div":k,nM({},S,{className:m,ref:N}),u))});nq.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},nq.classNames={fullWidth:nD,zeroRight:nP};var nU=function(e){var t=e.sideCar,r=nF(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return f.createElement(n,nM({},r))};nU.isSideCarExport=!0;var nB=function(){var e=0,t=null;return{add:function(r){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=u||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var n,a;(n=t).styleSheet?n.styleSheet.cssText=r:n.appendChild(document.createTextNode(r)),a=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(a)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nW=function(){var e=nB();return function(t,r){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},nH=function(){var e=nW();return function(t){return e(t.styles,t.dynamic),null}},nQ={left:0,top:0,right:0,gap:0},nK=function(e){return parseInt(e||"",10)||0},nG=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[nK(r),nK(n),nK(a)]},nY=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return nQ;var t=nG(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},nX=nH(),nJ="data-scroll-locked",nZ=function(e,t,r,n){var a=e.left,s=e.top,i=e.right,l=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(l,"px ").concat(n,";\n }\n body[").concat(nJ,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(s,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(l,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(nP," {\n right: ").concat(l,"px ").concat(n,";\n }\n \n .").concat(nD," {\n margin-right: ").concat(l,"px ").concat(n,";\n }\n \n .").concat(nP," .").concat(nP," {\n right: 0 ").concat(n,";\n }\n \n .").concat(nD," .").concat(nD," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(nJ,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(l,"px;\n }\n")},n0=function(){var e=parseInt(document.body.getAttribute(nJ)||"0",10);return isFinite(e)?e:0},n1=function(){f.useEffect(function(){return document.body.setAttribute(nJ,(n0()+1).toString()),function(){var e=n0()-1;e<=0?document.body.removeAttribute(nJ):document.body.setAttribute(nJ,e.toString())}},[])},n2=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=void 0===n?"margin":n;n1();var s=f.useMemo(function(){return nY(a)},[a]);return f.createElement(nX,{styles:nZ(s,!t,a,r?"":"!important")})},n5=!1;if("u">typeof window)try{var n4=Object.defineProperty({},"passive",{get:function(){return n5=!0,!0}});window.addEventListener("test",n4,n4),window.removeEventListener("test",n4,n4)}catch(e){n5=!1}var n3=!!n5&&{passive:!1},n9=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&(r.overflowY!==r.overflowX||"TEXTAREA"===e.tagName||"visible"!==r[t])},n6=function(e,t){var r=t.ownerDocument,n=t;do{if("u">typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),n8(e,n)){var a=n7(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body)return!1},n8=function(e,t){return"v"===e?n9(t,"overflowY"):n9(t,"overflowX")},n7=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},ae=function(e,t,r,n,a){var s,i=(s=window.getComputedStyle(t).direction,"h"===e&&"rtl"===s?-1:1),l=i*n,o=r.target,c=t.contains(o),d=!1,u=l>0,m=0,f=0;do{if(!o)break;var p=n7(e,o),h=p[0],x=p[1]-p[2]-i*h;(h||x)&&n8(e,o)&&(m+=x,f+=h);var g=o.parentNode;o=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&o!==document.body||c&&(t.contains(o)||t===o))return u&&(a&&1>Math.abs(m)||!a&&l>m)?d=!0:!u&&(a&&1>Math.abs(f)||!a&&-l>f)&&(d=!0),d},at=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ar=function(e){return[e.deltaX,e.deltaY]},an=function(e){return e&&"current"in e?e.current:e},aa=0,as=[];let ai=(c=function(e){var t=f.useRef([]),r=f.useRef([0,0]),n=f.useRef(),a=f.useState(aa++)[0],s=f.useState(nH)[0],i=f.useRef(e);f.useEffect(function(){i.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=(function(e,t,r){if(r||2==arguments.length)for(var n,a=0,s=t.length;a<s;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(an),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=f.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,s=at(e),l=r.current,o="deltaX"in e?e.deltaX:l[0]-s[0],c="deltaY"in e?e.deltaY:l[1]-s[1],d=e.target,u=Math.abs(o)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var m=window.getSelection(),f=m&&m.anchorNode;if(f&&(f===d||f.contains(d)))return!1;var p=n6(u,d);if(!p)return!0;if(p?a=u:(a="v"===u?"h":"v",p=n6(u,d)),!p)return!1;if(!n.current&&"changedTouches"in e&&(o||c)&&(n.current=a),!a)return!0;var h=n.current||a;return ae(h,t,e,"h"===h?o:c,!0)},[]),o=f.useCallback(function(e){if(as.length&&as[as.length-1]===s){var r="deltaY"in e?ar(e):at(e),n=t.current.filter(function(t){var n;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(n=t.delta,n[0]===r[0]&&n[1]===r[1])})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var a=(i.current.shards||[]).map(an).filter(Boolean).filter(function(t){return t.contains(e.target)});(a.length>0?l(e,a[0]):!i.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=f.useCallback(function(e,r,n,a){var s={name:e,delta:r,target:n,should:a,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(n)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),d=f.useCallback(function(e){r.current=at(e),n.current=void 0},[]),u=f.useCallback(function(t){c(t.type,ar(t),t.target,l(t,e.lockRef.current))},[]),m=f.useCallback(function(t){c(t.type,at(t),t.target,l(t,e.lockRef.current))},[]);f.useEffect(function(){return as.push(s),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:m}),document.addEventListener("wheel",o,n3),document.addEventListener("touchmove",o,n3),document.addEventListener("touchstart",d,n3),function(){as=as.filter(function(e){return e!==s}),document.removeEventListener("wheel",o,n3),document.removeEventListener("touchmove",o,n3),document.removeEventListener("touchstart",d,n3)}},[]);var p=e.removeScrollBar,h=e.inert;return f.createElement(f.Fragment,null,h?f.createElement(s,{styles:"\n .block-interactivity-".concat(a," {pointer-events: none;}\n .allow-interactivity-").concat(a," {pointer-events: all;}\n")}):null,p?f.createElement(n2,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},nI.useMedium(c),nU);var al=f.forwardRef(function(e,t){return f.createElement(nq,nM({},e,{ref:t,sideCar:ai}))});al.classNames=nq.classNames;var ao=[" ","Enter","ArrowUp","ArrowDown"],ac=[" ","Enter"],ad="Select",[au,am,af]=function(e){let t=e+"CollectionProvider",[r,n]=tE(t),[a,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=e=>{let{scope:t,children:r}=e,n=f.default.useRef(null),s=f.default.useRef(new Map).current;return(0,m.jsx)(a,{scope:t,itemMap:s,collectionRef:n,children:r})};i.displayName=t;let l=e+"CollectionSlot",o=tO(l),c=f.default.forwardRef((e,t)=>{let{scope:r,children:n}=e,a=tT(t,s(l,r).collectionRef);return(0,m.jsx)(o,{ref:a,children:n})});c.displayName=l;let d=e+"CollectionItemSlot",u="data-radix-collection-item",p=tO(d),h=f.default.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,i=f.default.useRef(null),l=tT(t,i),o=s(d,r);return f.default.useEffect(()=>(o.itemMap.set(i,{ref:i,...a}),()=>void o.itemMap.delete(i))),(0,m.jsx)(p,{...{[u]:""},ref:l,children:n})});return h.displayName=d,[{Provider:i,Slot:c,ItemSlot:h},function(t){let r=s(e+"CollectionConsumer",t);return f.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${u}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},n]}(ad),[ap,ah]=tE(ad,[af,ni]),ax=ni(),[ag,ab]=ap(ad),[ay,av]=ap(ad),aw=e=>{let t,{__scopeSelect:r,children:n,open:a,defaultOpen:s,onOpenChange:i,value:l,defaultValue:o,onValueChange:c,dir:d,name:u,autoComplete:p,disabled:h,required:x,form:g}=e,b=ax(r),[y,v]=f.useState(null),[w,k]=f.useState(null),[j,z]=f.useState(!1),N=(t=f.useContext(t_),d||t||"ltr"),[S,C]=nz({prop:a,defaultProp:s??!1,onChange:i,caller:ad}),[E,R]=nz({prop:l,defaultProp:o,onChange:c,caller:ad}),A=f.useRef(null),T=!y||g||!!y.closest("form"),[O,M]=f.useState(new Set),F=Array.from(O).map(e=>e.props.value).join(";");return(0,m.jsx)(nc,{...b,children:(0,m.jsxs)(ag,{required:x,scope:r,trigger:y,onTriggerChange:v,valueNode:w,onValueNodeChange:k,valueNodeHasChildren:j,onValueNodeHasChildrenChange:z,contentId:t9(),value:E,onValueChange:R,open:S,onOpenChange:C,dir:N,triggerPointerDownPosRef:A,disabled:h,children:[(0,m.jsx)(au.Provider,{scope:r,children:(0,m.jsx)(ay,{scope:e.__scopeSelect,onNativeOptionAdd:f.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:f.useCallback(e=>{M(t=>{let r=new Set(t);return r.delete(e),r})},[]),children:n})}),T?(0,m.jsxs)(a2,{"aria-hidden":!0,required:x,tabIndex:-1,name:u,autoComplete:p,value:E,onChange:e=>R(e.target.value),disabled:h,form:g,children:[void 0===E?(0,m.jsx)("option",{value:""}):null,Array.from(O)]},F):null]})})};aw.displayName=ad;var ak="SelectTrigger",aj=f.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:n=!1,...a}=e,s=ax(r),i=ab(ak,r),l=i.disabled||n,o=tT(t,i.onTriggerChange),c=am(r),d=f.useRef("touch"),[u,p,h]=a4(e=>{let t=c().filter(e=>!e.disabled),r=t.find(e=>e.value===i.value),n=a3(t,e,r);void 0!==n&&i.onValueChange(n.value)}),x=e=>{l||(i.onOpenChange(!0),h()),e&&(i.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,m.jsx)(nu,{asChild:!0,...s,children:(0,m.jsx)(tV.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":a5(i.value)?"":void 0,...a,ref:o,onClick:tC(a.onClick,e=>{e.currentTarget.focus(),"mouse"!==d.current&&x(e)}),onPointerDown:tC(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(x(e),e.preventDefault())}),onKeyDown:tC(a.onKeyDown,e=>{let t=""!==u.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),(!t||" "!==e.key)&&ao.includes(e.key)&&(x(),e.preventDefault())})})})});aj.displayName=ak;var az="SelectValue",aN=f.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:a,children:s,placeholder:i="",...l}=e,o=ab(az,r),{onValueNodeHasChildrenChange:c}=o,d=void 0!==s,u=tT(t,o.onValueNodeChange);return t5(()=>{c(d)},[c,d]),(0,m.jsx)(tV.span,{...l,ref:u,style:{pointerEvents:"none"},children:a5(o.value)?(0,m.jsx)(m.Fragment,{children:i}):s})});aN.displayName=az;var aS=f.forwardRef((e,t)=>{let{__scopeSelect:r,children:n,...a}=e;return(0,m.jsx)(tV.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});aS.displayName="SelectIcon";var aC=e=>(0,m.jsx)(nk,{asChild:!0,...e});aC.displayName="SelectPortal";var aE="SelectContent",aR=f.forwardRef((e,t)=>{let r=ab(aE,e.__scopeSelect),[n,a]=f.useState();return(t5(()=>{a(new DocumentFragment)},[]),r.open)?(0,m.jsx)(aM,{...e,ref:t}):n?tN.createPortal((0,m.jsx)(aA,{scope:e.__scopeSelect,children:(0,m.jsx)(au.Slot,{scope:e.__scopeSelect,children:(0,m.jsx)("div",{children:e.children})})}),n):null});aR.displayName=aE;var[aA,aT]=ap(aE),aO=tO("SelectContent.RemoveScroll"),aM=f.forwardRef((e,t)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:o,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:p,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:b,...y}=e,v=ab(aE,r),[w,k]=f.useState(null),[j,z]=f.useState(null),N=tT(t,e=>k(e)),[S,C]=f.useState(null),[E,R]=f.useState(null),A=am(r),[T,O]=f.useState(!1),M=f.useRef(!1);f.useEffect(()=>{if(w)return nO(w)},[w]),f.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??tQ()),document.body.insertAdjacentElement("beforeend",e[1]??tQ()),tH++,()=>{1===tH&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),tH--}},[]);let F=f.useCallback(e=>{let[t,...r]=A().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(let r of e)if(r===a||(r?.scrollIntoView({block:"nearest"}),r===t&&j&&(j.scrollTop=0),r===n&&j&&(j.scrollTop=j.scrollHeight),r?.focus(),document.activeElement!==a))return},[A,j]),P=f.useCallback(()=>F([S,w]),[F,S,w]);f.useEffect(()=>{T&&P()},[T,P]);let{onOpenChange:D,triggerPointerDownPosRef:L}=v;f.useEffect(()=>{if(w){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(L.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():w.contains(r.target)||D(!1),document.removeEventListener("pointermove",t),L.current=null};return null!==L.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[w,D,L]),f.useEffect(()=>{let e=()=>D(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[D]);let[_,V]=a4(e=>{let t=A().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=a3(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),I=f.useCallback((e,t,r)=>{let n=!M.current&&!r;(void 0!==v.value&&v.value===t||n)&&(C(e),n&&(M.current=!0))},[v.value]),$=f.useCallback(()=>w?.focus(),[w]),q=f.useCallback((e,t,r)=>{let n=!M.current&&!r;(void 0!==v.value&&v.value===t||n)&&R(e)},[v.value]),U="popper"===n?aP:aF,B=U===aP?{side:l,sideOffset:o,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:p,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:b}:{};return(0,m.jsx)(aA,{scope:r,content:w,viewport:j,onViewportChange:z,itemRefCallback:I,selectedItem:S,onItemLeave:$,itemTextRefCallback:q,focusSelectedItem:P,selectedItemText:E,position:n,isPositioned:T,searchRef:_,children:(0,m.jsx)(al,{as:aO,allowPinchZoom:!0,children:(0,m.jsx)(tX,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:tC(a,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,m.jsx)(tU,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,m.jsx)(U,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:e=>e.preventDefault(),...y,...B,onPlaced:()=>O(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:tC(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||V(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>F(t)),e.preventDefault()}})})})})})})});aM.displayName="SelectContentImpl";var aF=f.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:n,...a}=e,s=ab(aE,r),i=aT(aE,r),[l,o]=f.useState(null),[c,d]=f.useState(null),u=tT(t,e=>d(e)),p=am(r),h=f.useRef(!1),x=f.useRef(!0),{viewport:g,selectedItem:b,selectedItemText:y,focusSelectedItem:v}=i,w=f.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&c&&g&&b&&y){let e=s.trigger.getBoundingClientRect(),t=c.getBoundingClientRect(),r=s.valueNode.getBoundingClientRect(),a=y.getBoundingClientRect();if("rtl"!==s.dir){let n=a.left-t.left,s=r.left-n,i=e.left-s,o=e.width+i,c=Math.max(o,t.width),d=tS(s,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=o+"px",l.style.left=d+"px"}else{let n=t.right-a.right,s=window.innerWidth-r.right-n,i=window.innerWidth-e.right-s,o=e.width+i,c=Math.max(o,t.width),d=tS(s,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=o+"px",l.style.right=d+"px"}let i=p(),o=window.innerHeight-20,d=g.scrollHeight,u=window.getComputedStyle(c),m=parseInt(u.borderTopWidth,10),f=parseInt(u.paddingTop,10),x=parseInt(u.borderBottomWidth,10),v=m+f+d+parseInt(u.paddingBottom,10)+x,w=Math.min(5*b.offsetHeight,v),k=window.getComputedStyle(g),j=parseInt(k.paddingTop,10),z=parseInt(k.paddingBottom,10),N=e.top+e.height/2-10,S=b.offsetHeight/2,C=m+f+(b.offsetTop+S);if(C<=N){let e=i.length>0&&b===i[i.length-1].ref.current;l.style.bottom="0px";let t=Math.max(o-N,S+(e?z:0)+(c.clientHeight-g.offsetTop-g.offsetHeight)+x);l.style.height=C+t+"px"}else{let e=i.length>0&&b===i[0].ref.current;l.style.top="0px";let t=Math.max(N,m+g.offsetTop+(e?j:0)+S);l.style.height=t+(v-C)+"px",g.scrollTop=C-N+g.offsetTop}l.style.margin="10px 0",l.style.minHeight=w+"px",l.style.maxHeight=o+"px",n?.(),requestAnimationFrame(()=>h.current=!0)}},[p,s.trigger,s.valueNode,l,c,g,b,y,s.dir,n]);t5(()=>w(),[w]);let[k,j]=f.useState();t5(()=>{c&&j(window.getComputedStyle(c).zIndex)},[c]);let z=f.useCallback(e=>{e&&!0===x.current&&(w(),v?.(),x.current=!1)},[w,v]);return(0,m.jsx)(aD,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:z,children:(0,m.jsx)("div",{ref:o,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:(0,m.jsx)(tV.div,{...a,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});aF.displayName="SelectItemAlignedPosition";var aP=f.forwardRef((e,t)=>{let{__scopeSelect:r,align:n="start",collisionPadding:a=10,...s}=e,i=ax(r);return(0,m.jsx)(nh,{...i,...s,ref:t,align:n,collisionPadding:a,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});aP.displayName="SelectPopperPosition";var[aD,aL]=ap(aE,{}),a_="SelectViewport",aV=f.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:n,...a}=e,s=aT(a_,r),i=aL(a_,r),l=tT(t,s.onViewportChange),o=f.useRef(0);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),(0,m.jsx)(au.Slot,{scope:r,children:(0,m.jsx)(tV.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:tC(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=i;if(n?.current&&r){let e=Math.abs(o.current-t.scrollTop);if(e>0){let n=window.innerHeight-20,a=Math.max(parseFloat(r.style.minHeight),parseFloat(r.style.height));if(a<n){let s=a+e,i=Math.min(n,s),l=s-i;r.style.height=i+"px","0px"===r.style.bottom&&(t.scrollTop=l>0?l:0,r.style.justifyContent="flex-end")}}}o.current=t.scrollTop})})})]})});aV.displayName=a_;var aI="SelectGroup",[a$,aq]=ap(aI);f.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=t9();return(0,m.jsx)(a$,{scope:r,id:a,children:(0,m.jsx)(tV.div,{role:"group","aria-labelledby":a,...n,ref:t})})}).displayName=aI;var aU="SelectLabel";f.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=aq(aU,r);return(0,m.jsx)(tV.div,{id:a.id,...n,ref:t})}).displayName=aU;var aB="SelectItem",[aW,aH]=ap(aB),aQ=f.forwardRef((e,t)=>{let{__scopeSelect:r,value:n,disabled:a=!1,textValue:s,...i}=e,l=ab(aB,r),o=aT(aB,r),c=l.value===n,[d,u]=f.useState(s??""),[p,h]=f.useState(!1),x=tT(t,e=>o.itemRefCallback?.(e,n,a)),g=t9(),b=f.useRef("touch"),y=()=>{a||(l.onValueChange(n),l.onOpenChange(!1))};if(""===n)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,m.jsx)(aW,{scope:r,value:n,disabled:a,textId:g,isSelected:c,onItemTextChange:f.useCallback(e=>{u(t=>t||(e?.textContent??"").trim())},[]),children:(0,m.jsx)(au.ItemSlot,{scope:r,value:n,disabled:a,textValue:d,children:(0,m.jsx)(tV.div,{role:"option","aria-labelledby":g,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:x,onFocus:tC(i.onFocus,()=>h(!0)),onBlur:tC(i.onBlur,()=>h(!1)),onClick:tC(i.onClick,()=>{"mouse"!==b.current&&y()}),onPointerUp:tC(i.onPointerUp,()=>{"mouse"===b.current&&y()}),onPointerDown:tC(i.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:tC(i.onPointerMove,e=>{b.current=e.pointerType,a?o.onItemLeave?.():"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:tC(i.onPointerLeave,e=>{e.currentTarget===document.activeElement&&o.onItemLeave?.()}),onKeyDown:tC(i.onKeyDown,e=>{(o.searchRef?.current===""||" "!==e.key)&&(ac.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});aQ.displayName=aB;var aK="SelectItemText",aG=f.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:a,...s}=e,i=ab(aK,r),l=aT(aK,r),o=aH(aK,r),c=av(aK,r),[d,u]=f.useState(null),p=tT(t,e=>u(e),o.onItemTextChange,e=>l.itemTextRefCallback?.(e,o.value,o.disabled)),h=d?.textContent,x=f.useMemo(()=>(0,m.jsx)("option",{value:o.value,disabled:o.disabled,children:h},o.value),[o.disabled,o.value,h]),{onNativeOptionAdd:g,onNativeOptionRemove:b}=c;return t5(()=>(g(x),()=>b(x)),[g,b,x]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(tV.span,{id:o.textId,...s,ref:p}),o.isSelected&&i.valueNode&&!i.valueNodeHasChildren?tN.createPortal(s.children,i.valueNode):null]})});aG.displayName=aK;var aY="SelectItemIndicator",aX=f.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return aH(aY,r).isSelected?(0,m.jsx)(tV.span,{"aria-hidden":!0,...n,ref:t}):null});aX.displayName=aY;var aJ="SelectScrollUpButton";f.forwardRef((e,t)=>{let r=aT(aJ,e.__scopeSelect),n=aL(aJ,e.__scopeSelect),[a,s]=f.useState(!1),i=tT(t,n.onScrollButtonChange);return t5(()=>{if(r.viewport&&r.isPositioned){let e=function(){s(t.scrollTop>0)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),a?(0,m.jsx)(a0,{...e,ref:i,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=aJ;var aZ="SelectScrollDownButton";f.forwardRef((e,t)=>{let r=aT(aZ,e.__scopeSelect),n=aL(aZ,e.__scopeSelect),[a,s]=f.useState(!1),i=tT(t,n.onScrollButtonChange);return t5(()=>{if(r.viewport&&r.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;s(Math.ceil(t.scrollTop)<e)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),a?(0,m.jsx)(a0,{...e,ref:i,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=aZ;var a0=f.forwardRef((e,t)=>{let{__scopeSelect:r,onAutoScroll:n,...a}=e,s=aT("SelectScrollButton",r),i=f.useRef(null),l=am(r),o=f.useCallback(()=>{null!==i.current&&(window.clearInterval(i.current),i.current=null)},[]);return f.useEffect(()=>()=>o(),[o]),t5(()=>{let e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),(0,m.jsx)(tV.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:tC(a.onPointerDown,()=>{null===i.current&&(i.current=window.setInterval(n,50))}),onPointerMove:tC(a.onPointerMove,()=>{s.onItemLeave?.(),null===i.current&&(i.current=window.setInterval(n,50))}),onPointerLeave:tC(a.onPointerLeave,()=>{o()})})});f.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return(0,m.jsx)(tV.div,{"aria-hidden":!0,...n,ref:t})}).displayName="SelectSeparator";var a1="SelectArrow";f.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=ax(r),s=ab(a1,r),i=aT(a1,r);return s.open&&"popper"===i.position?(0,m.jsx)(nb,{...a,...n,ref:t}):null}).displayName=a1;var a2=f.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{let a,s=f.useRef(null),i=tT(n,s),l=(a=f.useRef({value:t,previous:t}),f.useMemo(()=>(a.current.value!==t&&(a.current.previous=a.current.value,a.current.value=t),a.current.previous),[t]));return f.useEffect(()=>{let e=s.current;if(!e)return;let r=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(l!==t&&r){let n=new Event("change",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[l,t]),(0,m.jsx)(tV.select,{...r,style:{...nN,...r.style},ref:i,defaultValue:t})});function a5(e){return""===e||void 0===e}function a4(e){let t=tI(e),r=f.useRef(""),n=f.useRef(0),a=f.useCallback(e=>{let a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),s=f.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,s]}function a3(e,t,r){var n,a;let s=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=r?e.indexOf(r):-1,l=(n=e,a=Math.max(i,0),n.map((e,t)=>n[(a+t)%n.length]));1===s.length&&(l=l.filter(e=>e!==r));let o=l.find(e=>e.textValue.toLowerCase().startsWith(s.toLowerCase()));return o!==r?o:void 0}a2.displayName="SelectBubbleInput";let a9=ec("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),a6=ec("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),a8=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),a7=[],se=(e,t,r)=>{if(0==e.length-t)return r.classGroupId;let n=e[t],a=r.nextPart.get(n);if(a){let r=se(e,t+1,a);if(r)return r}let s=r.validators;if(null===s)return;let i=0===t?e.join("-"):e.slice(t).join("-"),l=s.length;for(let e=0;e<l;e++){let t=s[e];if(t.validator(i))return t.classGroupId}},st=(e,t)=>{let r=a8();for(let n in e)sr(e[n],r,n,t);return r},sr=(e,t,r,n)=>{let a=e.length;for(let s=0;s<a;s++)sn(e[s],t,r,n)},sn=(e,t,r,n)=>{"string"==typeof e?sa(e,t,r):"function"==typeof e?ss(e,t,r,n):si(e,t,r,n)},sa=(e,t,r)=>{(""===e?t:sl(t,e)).classGroupId=r},ss=(e,t,r,n)=>{so(e)?sr(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:r,validator:e}))},si=(e,t,r,n)=>{let a=Object.entries(e),s=a.length;for(let e=0;e<s;e++){let[s,i]=a[e];sr(i,sl(t,s),r,n)}},sl=(e,t)=>{let r=e,n=t.split("-"),a=n.length;for(let e=0;e<a;e++){let t=n[e],a=r.nextPart.get(t);a||(a=a8(),r.nextPart.set(t,a)),r=a}return r},so=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,sc=[],sd=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),su=/\s+/,sm=e=>{let t;if("string"==typeof e)return e;let r="";for(let n=0;n<e.length;n++)e[n]&&(t=sm(e[n]))&&(r&&(r+=" "),r+=t);return r},sf=[],sp=e=>{let t=t=>t[e]||sf;return t.isThemeGetter=!0,t},sh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,sx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,sg=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,sb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sy=/\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$/,sv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,sw=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sk=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,sj=e=>sg.test(e),sz=e=>!!e&&!Number.isNaN(Number(e)),sN=e=>!!e&&Number.isInteger(Number(e)),sS=e=>e.endsWith("%")&&sz(e.slice(0,-1)),sC=e=>sb.test(e),sE=()=>!0,sR=e=>sy.test(e)&&!sv.test(e),sA=()=>!1,sT=e=>sw.test(e),sO=e=>sk.test(e),sM=e=>!sP(e)&&!sU(e),sF=e=>sX(e,s1,sA),sP=e=>sh.test(e),sD=e=>sX(e,s2,sR),sL=e=>sX(e,s5,sz),s_=e=>sX(e,s3,sE),sV=e=>sX(e,s4,sA),sI=e=>sX(e,sZ,sA),s$=e=>sX(e,s0,sO),sq=e=>sX(e,s9,sT),sU=e=>sx.test(e),sB=e=>sJ(e,s2),sW=e=>sJ(e,s4),sH=e=>sJ(e,sZ),sQ=e=>sJ(e,s1),sK=e=>sJ(e,s0),sG=e=>sJ(e,s9,!0),sY=e=>sJ(e,s3,!0),sX=(e,t,r)=>{let n=sh.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},sJ=(e,t,r=!1)=>{let n=sx.exec(e);return!!n&&(n[1]?t(n[1]):r)},sZ=e=>"position"===e||"percentage"===e,s0=e=>"image"===e||"url"===e,s1=e=>"length"===e||"size"===e||"bg-size"===e,s2=e=>"length"===e,s5=e=>"number"===e,s4=e=>"family-name"===e,s3=e=>"number"===e||"weight"===e,s9=e=>"shadow"===e,s6=((e,...t)=>{let r,n,a,s,i=e=>{let t=n(e);if(t)return t;let s=((e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],l=e.trim().split(su),o="";for(let e=l.length-1;e>=0;e-=1){let t=l[e],{isExternal:c,modifiers:d,hasImportantModifier:u,baseClassName:m,maybePostfixModifierPosition:f}=r(t);if(c){o=t+(o.length>0?" "+o:o);continue}let p=!!f,h=n(p?m.substring(0,f):m);if(!h){if(!p||!(h=n(m))){o=t+(o.length>0?" "+o:o);continue}p=!1}let x=0===d.length?"":1===d.length?d[0]:s(d).join(":"),g=u?x+"!":x,b=g+h;if(i.indexOf(b)>-1)continue;i.push(b);let y=a(h,p);for(let e=0;e<y.length;++e){let t=y[e];i.push(g+t)}o=t+(o.length>0?" "+o:o)}return o})(e,r);return a(e,s),s};return s=l=>{var o;let c;return n=(r={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null),a=(a,s)=>{r[a]=s,++t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}})((o=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:r}=e,n=e=>{let t,r=[],n=0,a=0,s=0,i=e.length;for(let l=0;l<i;l++){let i=e[l];if(0===n&&0===a){if(":"===i){r.push(e.slice(s,l)),s=l+1;continue}if("/"===i){t=l;continue}}"["===i?n++:"]"===i?n--:"("===i?a++:")"===i&&a--}let l=0===r.length?e:e.slice(s),o=l,c=!1;return l.endsWith("!")?(o=l.slice(0,-1),c=!0):l.startsWith("!")&&(o=l.slice(1),c=!0),sd(r,c,o,t&&t>s?t-s:void 0)};if(t){let e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):sd(sc,!1,t,void 0,!0)}if(r){let e=n;n=t=>r({className:t,parseClassName:e})}return n})(o),sortModifiers:(c=new Map,o.orderSensitiveModifiers.forEach((e,t)=>{c.set(e,1e6+t)}),e=>{let t=[],r=[];for(let n=0;n<e.length;n++){let a=e[n],s="["===a[0],i=c.has(a);s||i?(r.length>0&&(r.sort(),t.push(...r),r=[]),t.push(a)):r.push(a)}return r.length>0&&(r.sort(),t.push(...r)),t}),...(e=>{let t=(e=>{let{theme:t,classGroups:r}=e;return st(r,t)})(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var r;let t,n,a;return -1===(r=e).slice(1,-1).indexOf(":")?void 0:(n=(t=r.slice(1,-1)).indexOf(":"),(a=t.slice(0,n))?"arbitrary.."+a:void 0)}let n=e.split("-"),a=+(""===n[0]&&n.length>1);return se(n,a,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=n[e],a=r[e];if(t){if(a){let e=Array(a.length+t.length);for(let t=0;t<a.length;t++)e[t]=a[t];for(let r=0;r<t.length;r++)e[a.length+r]=t[r];return e}return t}return a||a7}return r[e]||a7}}})(o)}).cache.get,a=r.cache.set,s=i,i(l)},(...e)=>s(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=sm(t))&&(a&&(a+=" "),a+=r);return a})(...e))})(()=>{let e=sp("color"),t=sp("font"),r=sp("text"),n=sp("font-weight"),a=sp("tracking"),s=sp("leading"),i=sp("breakpoint"),l=sp("container"),o=sp("spacing"),c=sp("radius"),d=sp("shadow"),u=sp("inset-shadow"),m=sp("text-shadow"),f=sp("drop-shadow"),p=sp("blur"),h=sp("perspective"),x=sp("aspect"),g=sp("ease"),b=sp("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...v(),sU,sP],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],z=()=>[sU,sP,o],N=()=>[sj,"full","auto",...z()],S=()=>[sN,"none","subgrid",sU,sP],C=()=>["auto",{span:["full",sN,sU,sP]},sN,sU,sP],E=()=>[sN,"auto",sU,sP],R=()=>["auto","min","max","fr",sU,sP],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],T=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...z()],M=()=>[sj,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],F=()=>[sj,"screen","full","dvw","lvw","svw","min","max","fit",...z()],P=()=>[sj,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],D=()=>[e,sU,sP],L=()=>[...v(),sH,sI,{position:[sU,sP]}],_=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",sQ,sF,{size:[sU,sP]}],I=()=>[sS,sB,sD],$=()=>["","none","full",c,sU,sP],q=()=>["",sz,sB,sD],U=()=>["solid","dashed","dotted","double"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[sz,sS,sH,sI],H=()=>["","none",p,sU,sP],Q=()=>["none",sz,sU,sP],K=()=>["none",sz,sU,sP],G=()=>[sz,sU,sP],Y=()=>[sj,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[sC],breakpoint:[sC],color:[sE],container:[sC],"drop-shadow":[sC],ease:["in","out","in-out"],font:[sM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[sC],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[sC],shadow:[sC],spacing:["px",sz],text:[sC],"text-shadow":[sC],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",sj,sP,sU,x]}],container:["container"],columns:[{columns:[sz,sP,sU,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:w()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[sN,"auto",sU,sP]}],basis:[{basis:[sj,"full","auto",l,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[sz,sj,"auto","initial","none",sP]}],grow:[{grow:["",sz,sU,sP]}],shrink:[{shrink:["",sz,sU,sP]}],order:[{order:[sN,"first","last","none",sU,sP]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...T(),"normal"]}],"justify-self":[{"justify-self":["auto",...T()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...T(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...T(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...T(),"baseline"]}],"place-self":[{"place-self":["auto",...T()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:M()}],"inline-size":[{inline:["auto",...F()]}],"min-inline-size":[{"min-inline":["auto",...F()]}],"max-inline-size":[{"max-inline":["none",...F()]}],"block-size":[{block:["auto",...P()]}],"min-block-size":[{"min-block":["auto",...P()]}],"max-block-size":[{"max-block":["none",...P()]}],w:[{w:[l,"screen",...M()]}],"min-w":[{"min-w":[l,"screen","none",...M()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...M()]}],h:[{h:["screen","lh",...M()]}],"min-h":[{"min-h":["screen","lh","none",...M()]}],"max-h":[{"max-h":["screen","lh",...M()]}],"font-size":[{text:["base",r,sB,sD]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,sY,s_]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sS,sP]}],"font-family":[{font:[sW,sV,t]}],"font-features":[{"font-features":[sP]}],"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:[a,sU,sP]}],"line-clamp":[{"line-clamp":[sz,"none",sU,sL]}],leading:[{leading:[s,...z()]}],"list-image":[{"list-image":["none",sU,sP]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",sU,sP]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[sz,"from-font","auto",sU,sD]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[sz,"auto",sU,sP]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",sU,sP]}],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",sU,sP]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:_()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},sN,sU,sP],radial:["",sU,sP],conic:[sN,sU,sP]},sK,s$]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:q()}],"border-w-x":[{"border-x":q()}],"border-w-y":[{"border-y":q()}],"border-w-s":[{"border-s":q()}],"border-w-e":[{"border-e":q()}],"border-w-bs":[{"border-bs":q()}],"border-w-be":[{"border-be":q()}],"border-w-t":[{"border-t":q()}],"border-w-r":[{"border-r":q()}],"border-w-b":[{"border-b":q()}],"border-w-l":[{"border-l":q()}],"divide-x":[{"divide-x":q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[sz,sU,sP]}],"outline-w":[{outline:["",sz,sB,sD]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,sG,sq]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",u,sG,sq]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[sz,sD]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":q()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",m,sG,sq]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[sz,sU,sP]}],"mix-blend":[{"mix-blend":[...B(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":B()}],"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":[sz]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[sU,sP]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":v()}],"mask-image-conic-pos":[{"mask-conic":[sz]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:_()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",sU,sP]}],filter:[{filter:["","none",sU,sP]}],blur:[{blur:H()}],brightness:[{brightness:[sz,sU,sP]}],contrast:[{contrast:[sz,sU,sP]}],"drop-shadow":[{"drop-shadow":["","none",f,sG,sq]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",sz,sU,sP]}],"hue-rotate":[{"hue-rotate":[sz,sU,sP]}],invert:[{invert:["",sz,sU,sP]}],saturate:[{saturate:[sz,sU,sP]}],sepia:[{sepia:["",sz,sU,sP]}],"backdrop-filter":[{"backdrop-filter":["","none",sU,sP]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[sz,sU,sP]}],"backdrop-contrast":[{"backdrop-contrast":[sz,sU,sP]}],"backdrop-grayscale":[{"backdrop-grayscale":["",sz,sU,sP]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[sz,sU,sP]}],"backdrop-invert":[{"backdrop-invert":["",sz,sU,sP]}],"backdrop-opacity":[{"backdrop-opacity":[sz,sU,sP]}],"backdrop-saturate":[{"backdrop-saturate":[sz,sU,sP]}],"backdrop-sepia":[{"backdrop-sepia":["",sz,sU,sP]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",sU,sP]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[sz,"initial",sU,sP]}],ease:[{ease:["linear","initial",g,sU,sP]}],delay:[{delay:[sz,sU,sP]}],animate:[{animate:["none",b,sU,sP]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,sU,sP]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:G()}],"skew-x":[{"skew-x":G()}],"skew-y":[{"skew-y":G()}],transform:[{transform:[sU,sP,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Y()}],"translate-x":[{"translate-x":Y()}],"translate-y":[{"translate-y":Y()}],"translate-z":[{"translate-z":Y()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"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",sU,sP]}],"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":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",sU,sP]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[sz,sB,sD,sL]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-bs","border-w-be","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-bs","border-color-be","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-mbs","scroll-mbe","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-pbs","scroll-pbe","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"]}});function s8(...e){return s6(function(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=function e(t){var r,n,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t)){var s=t.length;for(r=0;r<s;r++)t[r]&&(n=e(t[r]))&&(a&&(a+=" "),a+=n)}else for(n in t)t[n]&&(a&&(a+=" "),a+=n);return a}(e))&&(n&&(n+=" "),n+=t);return n}(e))}let s7=f.forwardRef(({className:e,children:t,...r},n)=>(0,m.jsxs)(aj,{ref:n,className:s8("flex h-10 w-full items-center justify-between rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm","ring-offset-white placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50 dark:border-zinc-800 dark:bg-zinc-950 dark:ring-offset-zinc-950","dark:placeholder:text-zinc-400 dark:focus:ring-zinc-300",e),...r,children:[t,(0,m.jsx)(aS,{asChild:!0,children:(0,m.jsx)(a9,{className:"h-4 w-4 opacity-50"})})]}));s7.displayName=aj.displayName;let ie=f.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>(0,m.jsx)(aC,{children:(0,m.jsx)(aR,{ref:a,className:s8("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-zinc-200 bg-white text-zinc-950 shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2","data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:(0,m.jsx)(aV,{className:s8("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));ie.displayName=aR.displayName;let it=f.forwardRef(({className:e,children:t,...r},n)=>(0,m.jsxs)(aQ,{ref:n,className:s8("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","focus:bg-zinc-100 focus:text-zinc-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50","dark:focus:bg-zinc-800 dark:focus:text-zinc-50",e),...r,children:[(0,m.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,m.jsx)(aX,{children:(0,m.jsx)(ez,{className:"h-4 w-4"})})}),(0,m.jsx)(aG,{children:t})]}));function ir(e){if(!e)return{provider:"unknown",model:""};let t=e.indexOf("/");return -1!==t?{provider:e.substring(0,t),model:e.substring(t+1)}:{provider:"unknown",model:e}}function ia({value:e,onValueChange:t,placeholder:r="Select a model...",disabled:n=!1}){let[a,s]=f.useState(""),{data:i,isLoading:l,isError:o,error:c,refetch:d}=A({queryKey:["opencode-models"],queryFn:async()=>{let e=await fetch("/api/opencode-models"),t=await e.json();if(!e.ok||t.error)throw Error(t.error||"Failed to fetch models");return t},retry:!1}),u=f.useMemo(()=>{let t=new Set(i?.models??[]);return e&&!t.has(e)&&t.add(e),Array.from(t).sort()},[i?.models,e]),p=f.useMemo(()=>{if(!a.trim())return u;let e=a.toLowerCase();return u.filter(t=>t.toLowerCase().includes(e))},[u,a]),h=f.useMemo(()=>{let e={};return p.forEach(t=>{let{provider:r}=ir(t);e[r]||(e[r]=[]),e[r].push(t)}),e},[p]),x=Object.keys(h).sort(),g=f.useCallback(e=>{e||s("")},[]),b=e?ir(e):null;return(0,m.jsxs)(aw,{value:e,onValueChange:t,disabled:n||l,onOpenChange:g,children:[(0,m.jsx)(s7,{children:(0,m.jsx)(aN,{placeholder:r,children:b&&(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[(0,m.jsx)("span",{className:"text-xs font-medium text-zinc-500 dark:text-zinc-400",children:b.provider}),(0,m.jsx)("span",{className:"text-zinc-500 dark:text-zinc-400",children:"/"}),(0,m.jsx)("span",{className:"text-zinc-900 dark:text-zinc-100",children:b.model})]})})}),(0,m.jsxs)(ie,{children:[(0,m.jsx)("div",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white px-2 pb-2 pt-1 dark:border-zinc-800 dark:bg-zinc-950",children:(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)(ep,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"}),(0,m.jsx)("input",{type:"text",value:a,onChange:e=>s(e.target.value),placeholder:"Search models...",className:s8("h-9 w-full rounded-md border border-zinc-200 bg-transparent pl-8 pr-3 text-sm","outline-none placeholder:text-zinc-500 focus:border-zinc-400 focus:ring-0","dark:border-zinc-800 dark:placeholder:text-zinc-400"),onKeyDown:e=>e.stopPropagation()})]})}),(0,m.jsx)("div",{className:"max-h-64 overflow-auto",children:l?(0,m.jsx)("div",{className:"px-2 py-4 text-center text-sm text-zinc-500",children:"Loading models..."}):o?(0,m.jsx)("div",{className:"px-4 py-6 text-center",children:(0,m.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,m.jsx)("div",{className:"w-10 h-10 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,m.jsx)(ej,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}),(0,m.jsxs)("div",{className:"space-y-1",children:[(0,m.jsx)("p",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Failed to load models"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 max-w-[200px]",children:c instanceof Error?c.message:"Please check your OpenCode installation"})]}),(0,m.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),d()},className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-zinc-100 text-zinc-700 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-700 transition-colors",children:[(0,m.jsx)(a6,{className:"h-3.5 w-3.5"}),"Retry"]})]})}):0===p.length?(0,m.jsx)("div",{className:"px-2 py-4 text-center text-sm text-zinc-500",children:"No models found"}):x.map(e=>(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold uppercase tracking-wide text-zinc-500 dark:text-zinc-400",children:e}),h[e].map(e=>{let{model:t}=ir(e);return(0,m.jsx)(it,{value:e,children:(0,m.jsx)("span",{className:"flex items-center gap-2",children:(0,m.jsx)("span",{className:"text-zinc-900 dark:text-zinc-100",children:t})})},e)})]},e))})]})]})}function is({categoryName:e,initialConfig:t,onSave:r,onCancel:n}){let[a,s]=f.useState(null),{control:i,handleSubmit:l,watch:o,formState:{isSubmitting:c}}=tz({defaultValues:{model:t?.model||"",variant:t?.variant||"",temperature:t?.temperature??.7,top_p:t?.top_p??1,prompt_append:t?.prompt_append||""}}),{data:d}=A({queryKey:["opencode-models"],queryFn:async()=>{let e=await fetch("/api/opencode-models");if(!e.ok)throw Error("Failed to fetch models");return e.json()}}),u=f.useMemo(()=>new Set(d?.models??[]),[d]),p=o("model"),h=p&&u.size>0&&!u.has(p),x=!p;return f.useEffect(()=>{if(a){let e=setTimeout(()=>s(null),3e3);return()=>clearTimeout(e)}},[a]),(0,m.jsxs)("form",{onSubmit:l(e=>{let t=Math.max(0,Math.min(2,e.temperature)),n=Math.max(0,Math.min(1,e.top_p));r({model:e.model||void 0,variant:e.variant||void 0,temperature:t,top_p:n,prompt_append:e.prompt_append||void 0}),s({type:"success",message:"Configuration saved successfully"})}),className:"space-y-6","aria-label":"Category configuration form",children:[a&&(0,m.jsxs)("div",{role:"alert",className:`flex items-center gap-2 rounded-lg px-4 py-3 text-sm ${"success"===a.type?"bg-emerald-50 text-emerald-800 dark:bg-emerald-900/20 dark:text-emerald-300":"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,children:["success"===a.type?(0,m.jsx)(ez,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,m.jsx)(ej,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,m.jsx)("span",{children:a.message})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"category-name",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Category"}),(0,m.jsx)("input",{id:"category-name",type:"text",value:e,disabled:!0,className:"w-full rounded-lg border border-zinc-200 bg-zinc-100 px-3 py-2 text-sm text-zinc-600 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-400"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"The category identifier for this configuration."})]}),x&&(0,m.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-zinc-200 bg-zinc-50 px-4 py-3 dark:border-zinc-800 dark:bg-zinc-900/20",children:[(0,m.jsx)(ej,{className:"mt-0.5 h-4 w-4 shrink-0 text-zinc-500 dark:text-zinc-400"}),(0,m.jsxs)("p",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:[(0,m.jsx)("span",{className:"font-medium",children:"System default fallback"})," — this category has no specific model assigned. It will fall back to the global default agent model."]})]}),h&&(0,m.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-800 dark:bg-amber-900/20",children:[(0,m.jsx)(eg,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-500 dark:text-amber-400"}),(0,m.jsxs)("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:[(0,m.jsx)("span",{className:"font-medium",children:"Model unavailable"})," — ",(0,m.jsx)("code",{className:"rounded bg-amber-100 px-1 py-0.5 text-xs dark:bg-amber-800",children:p})," is missing from current providers. Please check your provider settings."]})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"model-selector",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Model"}),(0,m.jsx)(e4,{name:"model",control:i,render:({field:e})=>(0,m.jsx)("div",{id:"model-selector",children:(0,m.jsx)(ia,{value:e.value,onValueChange:e.onChange,placeholder:"Select a model..."})})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"The AI model identifier for this category."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"variant-selector",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Variant"}),(0,m.jsx)(e4,{name:"variant",control:i,render:({field:e})=>(0,m.jsxs)("select",{id:"variant-selector",value:e.value,onChange:t=>e.onChange(t.target.value),className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm dark:border-zinc-800 dark:bg-zinc-950",children:[(0,m.jsx)("option",{value:"",children:"Not set"}),(0,m.jsx)("option",{value:"max",children:"max"}),(0,m.jsx)("option",{value:"high",children:"high"}),(0,m.jsx)("option",{value:"medium",children:"medium"}),(0,m.jsx)("option",{value:"low",children:"low"}),(0,m.jsx)("option",{value:"xhigh",children:"xhigh"})]})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Model reasoning variant. Higher values mean more thinking."})]}),(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("label",{htmlFor:"temperature-slider",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Temperature"}),(0,m.jsx)(e4,{name:"temperature",control:i,rules:{min:{value:0,message:"Minimum is 0"},max:{value:2,message:"Maximum is 2"}},render:({field:e})=>(0,m.jsx)("span",{className:"rounded-md bg-zinc-100 px-2 py-0.5 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:e.value.toFixed(1)})})]}),(0,m.jsx)(e4,{name:"temperature",control:i,rules:{min:{value:0,message:"Minimum is 0"},max:{value:2,message:"Maximum is 2"}},render:({field:e,fieldState:t})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("input",{id:"temperature-slider",type:"range",min:0,max:2,step:.1,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)),className:"flex-1 h-2 cursor-pointer appearance-none rounded-lg bg-zinc-200 accent-blue-600 dark:bg-zinc-700","aria-label":"Temperature slider"}),(0,m.jsx)("input",{type:"number",min:0,max:2,step:.1,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)||0),className:"w-16 rounded-lg border border-zinc-200 bg-white px-2 py-1 text-center text-sm dark:border-zinc-800 dark:bg-zinc-950","aria-label":"Temperature value"})]}),t.error&&(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",role:"alert",children:t.error.message})]})}),(0,m.jsxs)("div",{className:"flex justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[(0,m.jsx)("span",{children:"Precise (0)"}),(0,m.jsx)("span",{children:"Balanced (1)"}),(0,m.jsx)("span",{children:"Creative (2)"})]}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Controls randomness: lower values make responses more deterministic."})]}),(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("label",{htmlFor:"top-p-slider",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Top P"}),(0,m.jsx)(e4,{name:"top_p",control:i,rules:{min:{value:0,message:"Minimum is 0"},max:{value:1,message:"Maximum is 1"}},render:({field:e})=>(0,m.jsx)("span",{className:"rounded-md bg-zinc-100 px-2 py-0.5 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:e.value.toFixed(2)})})]}),(0,m.jsx)(e4,{name:"top_p",control:i,rules:{min:{value:0,message:"Minimum is 0"},max:{value:1,message:"Maximum is 1"}},render:({field:e,fieldState:t})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("input",{id:"top-p-slider",type:"range",min:0,max:1,step:.05,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)),className:"flex-1 h-2 cursor-pointer appearance-none rounded-lg bg-zinc-200 accent-blue-600 dark:bg-zinc-700","aria-label":"Top P slider"}),(0,m.jsx)("input",{type:"number",min:0,max:1,step:.05,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)||0),className:"w-16 rounded-lg border border-zinc-200 bg-white px-2 py-1 text-center text-sm dark:border-zinc-800 dark:bg-zinc-950","aria-label":"Top P value"})]}),t.error&&(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",role:"alert",children:t.error.message})]})}),(0,m.jsxs)("div",{className:"flex justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[(0,m.jsx)("span",{children:"Diverse (0)"}),(0,m.jsx)("span",{children:"Default (1)"})]}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Controls nucleus sampling: lower values sample from more likely tokens."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"prompt-append",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Prompt Append"}),(0,m.jsx)(e4,{name:"prompt_append",control:i,render:({field:e})=>(0,m.jsx)("textarea",{id:"prompt-append",value:e.value,onChange:t=>e.onChange(t.target.value),rows:4,className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm resize-none dark:border-zinc-800 dark:bg-zinc-950",placeholder:"Additional system instructions to append..."})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Additional instructions appended to the system prompt."})]}),(0,m.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-2",children:[(0,m.jsx)("button",{type:"button",onClick:n,className:"inline-flex items-center gap-2 rounded-lg border border-zinc-200 bg-white px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800",children:"Cancel"}),(0,m.jsxs)("button",{type:"submit",disabled:c,className:"inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-blue-600 dark:hover:bg-blue-500",children:[c&&(0,m.jsx)(ek,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Save Changes"]})]})]})}function ii({onSaveSuccess:e}){let t=(0,S.useQueryClient)(),[r,n]=f.useState(null),[a,s]=f.useState(void 0),[i,l]=f.useState(null),{data:o,isLoading:c,isError:d,error:u}=A({queryKey:["opencode-config"],queryFn:async()=>{let e=await fetch("/api/opencode-config");if(!e.ok)throw Error("Failed to fetch configuration");return e.json()}});f.useEffect(()=>{if(i){let e=setTimeout(()=>l(null),3e3);return()=>clearTimeout(e)}},[i]);let p=ew({mutationFn:async e=>{let t=await fetch("/api/opencode-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({categories:e})});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to save categories");return t.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["opencode-config"]}),l({type:"success",message:"Categories saved successfully"}),n(null),s(void 0),e?.()},onError:e=>{l({type:"error",message:e.message})}});if(c)return(0,m.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,m.jsx)(ek,{className:"h-6 w-6 animate-spin text-zinc-400"}),(0,m.jsx)("span",{className:"ml-2 text-sm text-zinc-500 dark:text-zinc-400",children:"Loading categories..."})]});if(d)return(0,m.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20",children:(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(ej,{className:"h-5 w-5 text-red-600 dark:text-red-400"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm font-medium text-red-800 dark:text-red-300",children:"Failed to load categories"}),(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:u instanceof Error?u.message:"An unknown error occurred"})]})]})});let h=o?.categories||{};return(0,m.jsxs)("div",{className:"space-y-4",children:[i&&(0,m.jsxs)("div",{role:"alert",className:`flex items-center gap-2 rounded-lg px-4 py-3 text-sm ${"success"===i.type?"bg-emerald-50 text-emerald-800 dark:bg-emerald-900/20 dark:text-emerald-300":"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,children:["success"===i.type?(0,m.jsx)(ez,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,m.jsx)(ej,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,m.jsx)("span",{children:i.message})]}),r?(0,m.jsx)(is,{categoryName:r,initialConfig:a,onSave:e=>{if(!r)return;let t={...o?.categories||{},[r]:e};p.mutate(t)},onCancel:()=>{n(null),s(void 0)}}):(0,m.jsx)(eA,{categories:h,onEdit:(e,t)=>{n(e),s(t)},onDelete:e=>{let{[e]:t,...r}=o?.categories||{};p.mutate(r)}})]})}it.displayName=aQ.displayName;let il=ec("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),io=ec("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);function ic({profiles:e,activeProfileId:t,appliedProfileId:r,onApply:n,onEdit:a,onDelete:s,onCreateNew:i}){let[l,o]=f.useState(""),[c,d]=f.useState(null),u=(e,t)=>{t?d(e):n(e.id)},p=f.useMemo(()=>{if(!l.trim())return e;let t=l.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||(e.description?.toLowerCase()||"").includes(t))},[e,l]),{active:h,builtIn:x,custom:g}=f.useMemo(()=>{let e=[],r=[],n=[];return p.forEach(a=>{a.id===t?e.push(a):a.isBuiltIn?r.push(a):n.push(a)}),{active:e,builtIn:r,custom:n}},[p,t]),b=e.length,y=p.length,v=l.trim().length>0;return(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsxs)("div",{className:"relative flex-1",children:[(0,m.jsx)(ep,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-400"}),(0,m.jsx)("input",{type:"text",placeholder:"Search profiles...",value:l,onChange:e=>o(e.target.value),className:"w-full pl-9 pr-3 py-2 text-sm bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded-lg placeholder:text-zinc-400 focus:outline-none focus:ring-2 focus:ring-teal-500/20 focus:border-teal-500 transition-all duration-200"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-zinc-500 dark:text-zinc-400 tabular-nums",children:[(0,m.jsx)(io,{className:"h-3.5 w-3.5"}),(0,m.jsxs)("span",{children:[v?`${y} of ${b}`:`${b}`," profiles"]})]})]}),0===p.length&&(0,m.jsxs)("div",{className:"text-center py-12 px-4",children:[(0,m.jsx)("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-zinc-100 dark:bg-zinc-800 mb-3",children:(0,m.jsx)(io,{className:"h-5 w-5 text-zinc-400 dark:text-zinc-500"})}),(0,m.jsx)("p",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:v?"No profiles match your search":"No profiles yet"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-1",children:v?"Try a different search term":"Create your first profile to get started"})]}),p.length>0&&(0,m.jsxs)("div",{className:"space-y-4",children:[h.length>0&&(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-semibold bg-teal-100 text-teal-700 dark:bg-teal-900/40 dark:text-teal-300 uppercase tracking-wider",children:[(0,m.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-teal-500 animate-pulse"}),"Active"]}),(0,m.jsx)("span",{className:"text-[10px] text-zinc-400 dark:text-zinc-500 tabular-nums",children:h.length})]}),(0,m.jsx)("div",{className:"space-y-2",children:h.map(e=>(0,m.jsx)(id,{profile:e,isActive:!0,isApplied:e.id===r,onApply:()=>u(e,e.id===r),onEdit:()=>a(e),onDelete:()=>s(e.id)},e.id))})]}),x.length>0&&(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)("span",{className:"text-[10px] font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider",children:"Built-in"}),(0,m.jsx)("span",{className:"text-[10px] text-zinc-400 dark:text-zinc-500 tabular-nums",children:x.length})]}),(0,m.jsx)("div",{className:"space-y-2",children:x.map(e=>(0,m.jsx)(id,{profile:e,isActive:!1,isApplied:e.id===r,onApply:()=>u(e,e.id===r),onEdit:()=>a(e),onDelete:()=>s(e.id)},e.id))})]}),g.length>0&&(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)("span",{className:"text-[10px] font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider",children:"Custom"}),(0,m.jsx)("span",{className:"text-[10px] text-zinc-400 dark:text-zinc-500 tabular-nums",children:g.length})]}),(0,m.jsx)("div",{className:"space-y-2",children:g.map(e=>(0,m.jsx)(id,{profile:e,isActive:!1,isApplied:e.id===r,onApply:()=>u(e,e.id===r),onEdit:()=>a(e),onDelete:()=>s(e.id)},e.id))})]})]}),c&&(0,m.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,m.jsx)("div",{className:"w-full max-w-md mx-4 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-700 shadow-2xl",children:(0,m.jsxs)("div",{className:"p-6",children:[(0,m.jsxs)("div",{className:"flex items-start gap-4",children:[(0,m.jsx)("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center",children:(0,m.jsx)(eg,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"})}),(0,m.jsxs)("div",{className:"flex-1",children:[(0,m.jsx)("h3",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:"Reset Profile Configuration"}),(0,m.jsxs)("p",{className:"mt-2 text-sm text-zinc-600 dark:text-zinc-400",children:["This will reset all agent and category configurations back to the ",(0,m.jsx)("strong",{children:c.name})," profile values. Any changes made after applying this profile will be lost."]})]})]}),(0,m.jsxs)("div",{className:"mt-6 flex items-center justify-end gap-3",children:[(0,m.jsxs)("button",{type:"button",onClick:()=>{d(null)},className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 text-sm font-medium text-zinc-700 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-zinc-700 transition-colors",children:[(0,m.jsx)(ef,{className:"h-4 w-4"}),"Cancel"]}),(0,m.jsxs)("button",{type:"button",onClick:()=>{c&&(n(c.id),d(null))},className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-amber-600 text-sm font-medium text-white hover:bg-amber-700 transition-colors",children:[(0,m.jsx)(ez,{className:"h-4 w-4"}),"Reset to ",c.name]})]})]})})}),(0,m.jsxs)("button",{type:"button",onClick:i,className:"w-full flex items-center justify-center gap-2 py-3 px-4 rounded-lg border border-dashed border-zinc-300 dark:border-zinc-700 text-sm font-medium text-zinc-600 dark:text-zinc-400 hover:border-teal-400 hover:text-teal-600 dark:hover:border-teal-500 dark:hover:text-teal-400 hover:bg-teal-50/50 dark:hover:bg-teal-900/10 transition-all duration-200",children:[(0,m.jsx)(il,{className:"h-4 w-4"}),"Create New Profile"]})]})}function id({profile:e,isActive:t,isApplied:r,onApply:n,onEdit:a,onDelete:s}){return(0,m.jsxs)("div",{className:`
7
+ group relative flex items-center justify-between p-3 rounded-lg border
8
+ transition-all duration-200
9
+ ${t?"bg-teal-50/50 border-teal-200 dark:bg-teal-900/20 dark:border-teal-700/50":"bg-white border-zinc-200 dark:bg-zinc-900 dark:border-zinc-700 hover:border-zinc-300 dark:hover:border-zinc-600"}
10
+ `,children:[(0,m.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,m.jsx)("span",{className:"text-xl",role:"img","aria-label":`${e.name} icon`,children:e.emoji}),(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("h4",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate",children:e.name}),e.isDefault&&(0,m.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",children:"Default"}),e.isBuiltIn&&(0,m.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",children:"Built-in"})]}),e.description&&(0,m.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400 truncate",children:e.description})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1 ml-3",children:[(0,m.jsx)("button",{type:"button",onClick:n,disabled:t&&!r,title:r?"Reset config to this profile":t?"Currently active":"Apply this profile",className:`
11
+ px-2.5 py-1 rounded-md text-xs font-medium
12
+ transition-all duration-200
13
+ ${r?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/40 dark:text-amber-300 dark:hover:bg-amber-900/60":t?"bg-teal-100 text-teal-700 dark:bg-teal-900/40 dark:text-teal-300 cursor-default":"bg-zinc-100 text-zinc-700 hover:bg-teal-100 hover:text-teal-700 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-teal-900/30 dark:hover:text-teal-300"}
14
+ `,children:r?"Reset":t?"Active":"Apply"}),(0,m.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,m.jsx)("button",{type:"button",onClick:a,className:"p-1.5 rounded-md text-zinc-400 hover:text-zinc-700 hover:bg-zinc-100 dark:text-zinc-500 dark:hover:text-zinc-200 dark:hover:bg-zinc-800 transition-colors","aria-label":`Edit ${e.name}`,title:`Edit ${e.name}`,children:(0,m.jsxs)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img",children:[(0,m.jsx)("title",{children:"Edit"}),(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})]})}),!e.isBuiltIn&&!e.isDefault&&(0,m.jsx)("button",{type:"button",onClick:s,className:"p-1.5 rounded-md text-zinc-400 hover:text-red-600 hover:bg-red-50 dark:text-zinc-500 dark:hover:text-red-400 dark:hover:bg-red-900/20 transition-colors","aria-label":`Delete ${e.name}`,title:`Delete ${e.name}`,children:(0,m.jsxs)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img",children:[(0,m.jsx)("title",{children:"Delete"}),(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})]})})]})]})]})}let iu=ec("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),im=ec("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),ip=["⚡","🔥","💎","🚀","🎯","💡","🔧","🎨","📊","🤖","👾","💻","⚙️","🔍","✨","🌟","🎭","🎪","🧩","🎲","📚","🔐","🛠️","⚡️","🌊","🔮","📡","🎸","🏆","🌈"];function ih({profile:e,initialConfig:t,onSave:r,onCancel:n}){let a=!!e,[s,i]=f.useState(null),[l,o]=f.useState(t||{agents:{}}),[c,d]=f.useState(t||{agents:{}});f.useEffect(()=>{t&&(o(t),d(t))},[t]);let[u,p]=f.useState(!1),{control:h,handleSubmit:x,watch:g,formState:{errors:b,isSubmitting:y}}=tz({defaultValues:{id:e?.id||"",name:e?.name||"",emoji:e?.emoji||"⚡",description:e?.description||""}}),v=g("name"),w=g("emoji");f.useEffect(()=>{if(s){let e=setTimeout(()=>i(null),3e3);return()=>clearTimeout(e)}},[s]);let k=async()=>{try{let e=await fetch("/api/opencode-config");if(!e.ok)throw Error("Failed to fetch configuration");let t=await e.json(),r={agents:t.agents||{},categories:t.categories};o(r),i({type:"success",message:"Configuration imported successfully"})}catch{i({type:"error",message:"Failed to import configuration"})}},j=f.useMemo(()=>JSON.stringify(l)!==JSON.stringify(c),[l,c]),z=Object.keys(l.agents||{}).length,N=Object.keys(l.categories||{}).length;return(0,m.jsxs)("form",{onSubmit:x(t=>{let n=new Date().toISOString();r({profile:{id:a?e.id:t.id,name:t.name,emoji:t.emoji,description:t.description||void 0,createdAt:a?e.createdAt:n,updatedAt:n,isDefault:!!a&&e.isDefault,isBuiltIn:!!a&&e.isBuiltIn},config:l}),i({type:"success",message:`Profile ${a?"updated":"created"} successfully`})}),className:"space-y-6","aria-label":"Profile editor form",children:[s&&(0,m.jsxs)("div",{role:"alert",className:`flex items-center gap-2 rounded-lg px-4 py-3 text-sm ${"success"===s.type?"bg-emerald-50 text-emerald-800 dark:bg-emerald-900/20 dark:text-emerald-300":"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,children:["success"===s.type?(0,m.jsx)(ez,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,m.jsx)(ej,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,m.jsx)("span",{children:s.message})]}),!a&&(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsxs)("label",{htmlFor:"profile-id",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:["Profile ID",(0,m.jsx)("span",{className:"ml-1 text-red-500",children:"*"})]}),(0,m.jsx)(e4,{name:"id",control:h,rules:{required:"Profile ID is required",pattern:{value:/^[a-zA-Z0-9_-]+$/,message:"Only alphanumeric characters, hyphens, and underscores allowed"}},render:({field:e})=>(0,m.jsx)("input",{id:"profile-id",type:"text",value:e.value,onChange:t=>e.onChange(t.target.value),placeholder:"e.g., my-custom-profile",className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm dark:border-zinc-800 dark:bg-zinc-950"})}),b.id&&(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",role:"alert",children:b.id.message}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Unique identifier for this profile. Use only letters, numbers, hyphens, and underscores."})]}),a&&(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"profile-id-readonly",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Profile ID"}),(0,m.jsx)("input",{id:"profile-id-readonly",type:"text",value:e.id,disabled:!0,className:"w-full rounded-lg border border-zinc-200 bg-zinc-100 px-3 py-2 text-sm text-zinc-600 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-400"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Profile ID cannot be changed after creation."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsxs)("label",{htmlFor:"profile-name",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:["Name",(0,m.jsx)("span",{className:"ml-1 text-red-500",children:"*"})]}),(0,m.jsx)(e4,{name:"name",control:h,rules:{required:"Name is required",minLength:{value:1,message:"Name cannot be empty"}},render:({field:e})=>(0,m.jsx)("input",{id:"profile-name",type:"text",value:e.value,onChange:t=>e.onChange(t.target.value),placeholder:"e.g., My Custom Profile",className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm dark:border-zinc-800 dark:bg-zinc-950"})}),b.name&&(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",role:"alert",children:b.name.message}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Display name for this profile."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("p",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Emoji Icon"}),(0,m.jsx)(e4,{name:"emoji",control:h,render:({field:e})=>(0,m.jsx)("div",{className:"flex flex-wrap gap-2",children:ip.map(t=>(0,m.jsx)("button",{type:"button",onClick:()=>e.onChange(t),className:`h-10 w-10 rounded-lg text-xl transition-all ${e.value===t?"bg-blue-100 ring-2 ring-blue-500 dark:bg-blue-900/30 dark:ring-blue-400":"bg-zinc-100 hover:bg-zinc-200 dark:bg-zinc-800 dark:hover:bg-zinc-700"}`,"aria-label":`Select ${t} emoji`,"aria-pressed":e.value===t,children:t},t))})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Choose an emoji to represent this profile."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"profile-description",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Description"}),(0,m.jsx)(e4,{name:"description",control:h,render:({field:e})=>(0,m.jsx)("textarea",{id:"profile-description",value:e.value,onChange:t=>e.onChange(t.target.value),rows:3,className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm resize-none dark:border-zinc-800 dark:bg-zinc-950",placeholder:"Optional description of this profile..."})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Optional description to help identify this profile."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("p",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Configuration"}),(0,m.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,m.jsxs)("button",{type:"button",onClick:k,className:"inline-flex items-center gap-2 rounded-lg border border-zinc-200 bg-white px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800",children:[(0,m.jsx)(iu,{className:"h-4 w-4","aria-hidden":"true"}),"Import from Current Config"]}),a&&j&&(0,m.jsxs)("button",{type:"button",onClick:()=>{o(c),i({type:"success",message:"Configuration reset to original values"})},className:"inline-flex items-center gap-2 rounded-lg border border-zinc-200 bg-white px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 hover:text-amber-600 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800 dark:hover:text-amber-400",children:[(0,m.jsx)(im,{className:"h-4 w-4","aria-hidden":"true"}),"Reset to Original"]})]}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Import agent and category configurations from your current settings, or reset to the profile's original values."})]}),(0,m.jsxs)("div",{className:"rounded-lg border border-zinc-200 bg-zinc-50 p-4 dark:border-zinc-700 dark:bg-zinc-900",children:[(0,m.jsx)("h4",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100 mb-2",children:"Profile Preview"}),(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("span",{className:"text-3xl","aria-hidden":"true",children:w||"⚡"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:v||"Untitled Profile"}),(0,m.jsxs)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:[z," agent",1!==z?"s":"",", ",N," categor",1!==N?"ies":"y"," configured"]})]})]})]}),(0,m.jsxs)("div",{className:"rounded-lg border border-zinc-200 dark:border-zinc-700 overflow-hidden",children:[(0,m.jsxs)("button",{type:"button",onClick:()=>p(!u),className:"w-full flex items-center justify-between p-4 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors","aria-expanded":u,children:[(0,m.jsx)("span",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Configuration Details"}),(0,m.jsx)(a9,{className:`h-4 w-4 text-zinc-500 transition-transform duration-200 ${u?"rotate-180":""}`,"aria-hidden":"true"})]}),u&&(0,m.jsxs)("div",{className:"border-t border-zinc-200 dark:border-zinc-700 p-4 space-y-4",children:[(0,m.jsxs)("div",{children:[(0,m.jsxs)("h5",{className:"text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wide mb-2",children:["Agents (",z,")"]}),0===z?(0,m.jsx)("p",{className:"text-sm text-zinc-400 dark:text-zinc-500 italic",children:"No agents configured"}):(0,m.jsx)("ul",{className:"space-y-1.5",children:Object.entries(l.agents||{}).map(([e,t])=>(0,m.jsxs)("li",{className:"text-sm text-zinc-700 dark:text-zinc-300 flex items-center gap-2",children:[(0,m.jsx)("span",{className:"font-medium text-zinc-900 dark:text-zinc-100 min-w-[80px]",children:e}),(0,m.jsx)("span",{className:"text-zinc-400",children:"→"}),(0,m.jsxs)("span",{className:"text-zinc-600 dark:text-zinc-400",children:[t.model,void 0!==t.temperature&&` temp: ${t.temperature}`]})]},e))})]}),(0,m.jsxs)("div",{children:[(0,m.jsxs)("h5",{className:"text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wide mb-2",children:["Categories (",N,")"]}),0===N?(0,m.jsx)("p",{className:"text-sm text-zinc-400 dark:text-zinc-500 italic",children:"No categories configured"}):(0,m.jsx)("ul",{className:"space-y-1.5",children:Object.entries(l.categories||{}).map(([e,t])=>(0,m.jsxs)("li",{className:"text-sm text-zinc-700 dark:text-zinc-300 flex items-center gap-2",children:[(0,m.jsx)("span",{className:"font-medium text-zinc-900 dark:text-zinc-100 min-w-[80px]",children:e}),(0,m.jsx)("span",{className:"text-zinc-400",children:"→"}),(0,m.jsxs)("span",{className:"text-zinc-600 dark:text-zinc-400",children:[t.model,t.variant&&` (${t.variant})`,void 0!==t.temperature&&` temp: ${t.temperature}`]})]},e))})]})]})]}),(0,m.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-2",children:[(0,m.jsx)("button",{type:"button",onClick:n,className:"inline-flex items-center gap-2 rounded-lg border border-zinc-200 bg-white px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800",children:"Cancel"}),(0,m.jsxs)("button",{type:"submit",disabled:y||!v.trim(),className:"inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-blue-600 dark:hover:bg-blue-500",children:[y&&(0,m.jsx)(ek,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),a?"Save Changes":"Create Profile"]})]})]})}function ix({onSaveSuccess:e}){let t=(0,S.useQueryClient)(),[r,n]=f.useState(null),[a,s]=f.useState(void 0),[i,l]=f.useState(!1),[o,c]=f.useState(null),[d,u]=f.useState(null),{data:p,isLoading:h,isError:x,error:g}=A({queryKey:["profiles"],queryFn:async()=>{let e=await fetch("/api/profiles");if(!e.ok)throw Error("Failed to fetch profiles");return e.json()}});f.useEffect(()=>{p?.activeProfileId&&c(p.activeProfileId)},[p?.activeProfileId]),f.useEffect(()=>{if(d){let e=setTimeout(()=>u(null),3e3);return()=>clearTimeout(e)}},[d]);let b=ew({mutationFn:async e=>{let t=await fetch(`/api/profiles/${e}/apply`,{method:"POST"});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to apply profile");return t.json()},onSuccess:(e,r)=>{t.invalidateQueries({queryKey:["profiles"]}),t.invalidateQueries({queryKey:["opencode-config"]}),c(r),u({type:"success",message:"Profile applied successfully"})},onError:e=>{u({type:"error",message:e.message})}}),y=ew({mutationFn:async({profile:e,config:t})=>{let r=await fetch("/api/profiles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:e,config:t})});if(!r.ok)throw Error((await r.json().catch(()=>({}))).error||"Failed to create profile");return r.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),u({type:"success",message:"Profile created successfully"}),l(!1),e?.()},onError:e=>{u({type:"error",message:e.message})}}),v=ew({mutationFn:async({id:e,profile:t,config:r})=>{let n=await fetch(`/api/profiles/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:t,config:r})});if(!n.ok)throw Error((await n.json().catch(()=>({}))).error||"Failed to update profile");return n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),u({type:"success",message:"Profile updated successfully"}),n(null),e?.()},onError:e=>{u({type:"error",message:e.message})}}),w=ew({mutationFn:async e=>{let t=await fetch(`/api/profiles/${e}`,{method:"DELETE"});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to delete profile");return t.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),u({type:"success",message:"Profile deleted successfully"})},onError:e=>{u({type:"error",message:e.message})}}),k=async e=>{n(e),l(!1);try{let t=await fetch(`/api/profiles/${e.id}`);if(t.ok){let e=await t.json();s(e.config)}}catch{s(void 0)}};if(h)return(0,m.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,m.jsx)(ek,{className:"h-6 w-6 animate-spin text-zinc-400"}),(0,m.jsx)("span",{className:"ml-2 text-sm text-zinc-500 dark:text-zinc-400",children:"Loading profiles..."})]});if(x)return(0,m.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20",children:(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(ej,{className:"h-5 w-5 text-red-600 dark:text-red-400"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm font-medium text-red-800 dark:text-red-300",children:"Failed to load profiles"}),(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:g instanceof Error?g.message:"An unknown error occurred"})]})]})});let j=p?.profiles??[],z=p?.activeProfileId??null;return(0,m.jsxs)("div",{className:"space-y-4",children:[d&&(0,m.jsxs)("div",{role:"alert",className:`flex items-center gap-2 rounded-lg px-4 py-3 text-sm ${"success"===d.type?"bg-emerald-50 text-emerald-800 dark:bg-emerald-900/20 dark:text-emerald-300":"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,children:["success"===d.type?(0,m.jsx)(ez,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,m.jsx)(ej,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,m.jsx)("span",{children:d.message})]}),r||i?(0,m.jsx)(ih,{profile:r??void 0,initialConfig:a,onSave:({profile:e,config:t})=>{i?y.mutate({profile:e,config:t}):r&&v.mutate({id:r.id,profile:e,config:t})},onCancel:()=>{n(null),s(void 0),l(!1)}}):(0,m.jsx)(ic,{profiles:j,activeProfileId:z,appliedProfileId:o,onApply:e=>{b.mutate(e)},onEdit:k,onDelete:e=>{w.mutate(e)},onCreateNew:()=>{l(!0),n(null)}})]})}let ig={prometheus:"ultrabrain",hephaestus:"deep",oracle:"ultrabrain",metis:"ultrabrain",momus:"quick",atlas:"unspecified-high",librarian:"writing",explore:"explore",sisyphus:"unspecified-high",default:"unspecified-low"};function ib({agentName:e="default",onSaveSuccess:t}){let r=(0,S.useQueryClient)(),[n,a]=f.useState(null),{data:s,isLoading:i}=A({queryKey:["opencode-config"],queryFn:async()=>{let e=await fetch("/api/opencode-config");if(!e.ok)throw Error("Failed to fetch config");return e.json()}}),{control:l,handleSubmit:o,reset:c,formState:{isSubmitting:d}}=tz({defaultValues:{model:"",temperature:.7,top_p:1,variant:"",prompt_append:""}}),{data:u}=A({queryKey:["opencode-models"],queryFn:async()=>{let e=await fetch("/api/opencode-models");if(!e.ok)throw Error("Failed to fetch models");return e.json()}}),p=f.useMemo(()=>new Set(u?.models??[]),[u]);f.useEffect(()=>{if(s){let t=s.agents?.[e]||{};c({model:t.model||"",temperature:t.temperature??.7,top_p:t.top_p??1,variant:t.variant||"",prompt_append:t.prompt_append||""})}},[s,e,c]),f.useEffect(()=>{if(n){let e=setTimeout(()=>a(null),3e3);return()=>clearTimeout(e)}},[n]);let h=ew({mutationFn:async t=>{let r=await fetch("/api/opencode-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:{[e]:t}})});if(!r.ok)throw Error((await r.json()).error||"Failed to save config");return r.json()},onSuccess:()=>{r.invalidateQueries({queryKey:["opencode-config"]}),a({type:"success",message:"Configuration saved successfully"}),t?.()},onError:e=>{a({type:"error",message:e.message})}}),x=s?.agents?.[e],g=!!x?.model,b=x?.model,y=b&&p.size>0&&!p.has(b),v=!b,w=ig[e]||"unspecified-low",k=s?.categories?.[w]?.model,j=s?.defaultAgent?.model;return i?(0,m.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,m.jsx)(ek,{className:"h-6 w-6 animate-spin text-zinc-400"}),(0,m.jsx)("span",{className:"ml-2 text-sm text-zinc-500",children:"Loading configuration..."})]}):(0,m.jsxs)("form",{onSubmit:o(e=>{h.mutate(e)}),className:"space-y-6","aria-label":"Agent configuration form",children:[g&&(0,m.jsx)("div",{className:"rounded-lg bg-blue-50 border border-blue-200 px-4 py-3 dark:bg-blue-900/20 dark:border-blue-800",children:(0,m.jsxs)("p",{className:"text-sm text-blue-800 dark:text-blue-300",children:[(0,m.jsx)("span",{className:"font-medium",children:"Preset applied:"})," This agent is configured with model ",(0,m.jsx)("span",{className:"font-mono bg-blue-100 dark:bg-blue-800 px-1.5 py-0.5 rounded",children:x.model}),x.variant&&(0,m.jsxs)("span",{children:[" (variant: ",x.variant,")"]})]})}),n&&(0,m.jsxs)("div",{role:"alert",className:`flex items-center gap-2 rounded-lg px-4 py-3 text-sm ${"success"===n.type?"bg-emerald-50 text-emerald-800 dark:bg-emerald-900/20 dark:text-emerald-300":"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,children:["success"===n.type?(0,m.jsx)(ez,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,m.jsx)(ej,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,m.jsx)("span",{children:n.message})]}),v&&(0,m.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-zinc-200 bg-zinc-50 px-4 py-3 dark:border-zinc-800 dark:bg-zinc-900/20",children:[(0,m.jsx)(ej,{className:"mt-0.5 h-4 w-4 shrink-0 text-zinc-500 dark:text-zinc-400"}),(0,m.jsxs)("div",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:[(0,m.jsx)("span",{className:"font-medium",children:"Category fallback"})," — this agent will inherit its model from the ",(0,m.jsx)("code",{className:"rounded bg-zinc-200 px-1 py-0.5 text-xs dark:bg-zinc-800",children:w})," category.",k?(0,m.jsxs)("span",{className:"ml-1",children:["Currently resolving to model ",(0,m.jsx)("code",{className:"rounded bg-blue-100 px-1 py-0.5 text-xs text-blue-800 dark:bg-blue-900/50 dark:text-blue-200",children:k}),"."]}):j?(0,m.jsxs)("span",{className:"ml-1",children:["Falling back to Default Agent resolving to ",(0,m.jsx)("code",{className:"rounded bg-blue-100 px-1 py-0.5 text-xs text-blue-800 dark:bg-blue-900/50 dark:text-blue-200",children:j}),"."]}):(0,m.jsx)("span",{className:"ml-1",children:"Resolving to system default model."}),(0,m.jsx)("p",{className:"mt-1 text-xs text-zinc-500 dark:text-zinc-400",children:"Select a model below only if you want to override it."})]})]}),y&&(0,m.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-800 dark:bg-amber-900/20",children:[(0,m.jsx)(eg,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-500 dark:text-amber-400"}),(0,m.jsxs)("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:[(0,m.jsx)("span",{className:"font-medium",children:"Model unavailable"})," — ",(0,m.jsx)("code",{className:"rounded bg-amber-100 px-1 py-0.5 text-xs dark:bg-amber-800",children:b})," is missing from current providers. Please check your provider settings or select a different model."]})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"model-selector",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Model"}),(0,m.jsx)(e4,{name:"model",control:l,rules:{required:"Please select a model"},render:({field:e,fieldState:t})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{id:"model-selector",children:(0,m.jsx)(ia,{value:e.value,onValueChange:e.onChange,placeholder:"Select a model..."})}),t.error&&(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",role:"alert",children:t.error.message})]})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"The AI model used for this agent."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"variant-selector",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Variant"}),(0,m.jsx)(e4,{name:"variant",control:l,render:({field:e})=>(0,m.jsxs)("select",{id:"variant-selector",value:e.value,onChange:t=>e.onChange(t.target.value),className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm dark:border-zinc-800 dark:bg-zinc-950",children:[(0,m.jsx)("option",{value:"",children:"Not set"}),(0,m.jsx)("option",{value:"max",children:"max"}),(0,m.jsx)("option",{value:"high",children:"high"}),(0,m.jsx)("option",{value:"medium",children:"medium"}),(0,m.jsx)("option",{value:"low",children:"low"}),(0,m.jsx)("option",{value:"xhigh",children:"xhigh"})]})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Model reasoning variant. Higher values mean more thinking."})]}),(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("label",{htmlFor:"temperature-slider",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Temperature"}),(0,m.jsx)(e4,{name:"temperature",control:l,render:({field:e})=>(0,m.jsx)("span",{className:"rounded-md bg-zinc-100 px-2 py-0.5 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:e.value.toFixed(1)})})]}),(0,m.jsx)(e4,{name:"temperature",control:l,render:({field:e})=>(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("input",{id:"temperature-slider",type:"range",min:0,max:2,step:.1,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)),className:"flex-1 h-2 cursor-pointer appearance-none rounded-lg bg-zinc-200 accent-blue-600 dark:bg-zinc-700","aria-label":"Temperature slider"}),(0,m.jsx)("input",{type:"number",min:0,max:2,step:.1,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)||0),className:"w-16 rounded-lg border border-zinc-200 bg-white px-2 py-1 text-center text-sm dark:border-zinc-800 dark:bg-zinc-950","aria-label":"Temperature value"})]})}),(0,m.jsxs)("div",{className:"flex justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[(0,m.jsx)("span",{children:"Precise (0)"}),(0,m.jsx)("span",{children:"Balanced (1)"}),(0,m.jsx)("span",{children:"Creative (2)"})]}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Controls randomness: lower values make responses more deterministic."})]}),(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("label",{htmlFor:"top-p-slider",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Top P"}),(0,m.jsx)(e4,{name:"top_p",control:l,render:({field:e})=>(0,m.jsx)("span",{className:"rounded-md bg-zinc-100 px-2 py-0.5 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:e.value.toFixed(2)})})]}),(0,m.jsx)(e4,{name:"top_p",control:l,render:({field:e})=>(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("input",{id:"top-p-slider",type:"range",min:0,max:1,step:.05,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)),className:"flex-1 h-2 cursor-pointer appearance-none rounded-lg bg-zinc-200 accent-blue-600 dark:bg-zinc-700","aria-label":"Top P slider"}),(0,m.jsx)("input",{type:"number",min:0,max:1,step:.05,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)||0),className:"w-16 rounded-lg border border-zinc-200 bg-white px-2 py-1 text-center text-sm dark:border-zinc-800 dark:bg-zinc-950","aria-label":"Top P value"})]})}),(0,m.jsxs)("div",{className:"flex justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[(0,m.jsx)("span",{children:"Diverse (0)"}),(0,m.jsx)("span",{children:"Default (1)"})]}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Controls nucleus sampling: lower values sample from more likely tokens."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"prompt-append",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Prompt Append"}),(0,m.jsx)(e4,{name:"prompt_append",control:l,render:({field:e})=>(0,m.jsx)("textarea",{id:"prompt-append",value:e.value,onChange:t=>e.onChange(t.target.value),rows:4,className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm resize-none dark:border-zinc-800 dark:bg-zinc-950",placeholder:"Additional system instructions to append..."})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Additional instructions appended to the system prompt."})]}),(0,m.jsx)("div",{className:"flex items-center justify-end gap-3 pt-2",children:(0,m.jsxs)("button",{type:"submit",disabled:d||h.isPending,className:"inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-blue-600 dark:hover:bg-blue-500",children:[(d||h.isPending)&&(0,m.jsx)(ek,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Save Changes"]})})]})}let iy=[{key:"default",name:"Default",description:"Fallback configuration"},{key:"sisyphus",name:"Sisyphus",description:"Task execution agent"},{key:"hephaestus",name:"Hephaestus",description:"Build & automation"},{key:"prometheus",name:"Prometheus",description:"Planning agent"},{key:"oracle",name:"Oracle",description:"Knowledge & research"},{key:"metis",name:"Metis",description:"Strategy & consultation"},{key:"momus",name:"Momus",description:"Review & critique"},{key:"atlas",name:"Atlas",description:"Execution-focused"},{key:"librarian",name:"Librarian",description:"Documentation & exploration"},{key:"explore",name:"Explore",description:"Code navigation"}];function iv({open:e,onClose:t}){let[r,n]=f.useState("agents"),[a,s]=f.useState("default"),[i,l]=f.useState(""),o=f.useRef(null),{data:c}=A({queryKey:["opencode-config"],queryFn:async()=>{let e=await fetch("/api/opencode-config");if(!e.ok)throw Error("Failed to fetch config");return e.json()},enabled:e}),{data:d}=A({queryKey:["opencode-models"],queryFn:async()=>{let e=await fetch("/api/opencode-models");if(!e.ok)throw Error("Failed to fetch models");return e.json()},enabled:e}),u=f.useMemo(()=>new Set(d?.models??[]),[d]),p=f.useCallback(e=>{let t=c?.agents?.[e];return t?.model?u.size>0&&!u.has(t.model)?"invalid":"ok":"unconfigured"},[c,u]),h=f.useMemo(()=>iy.filter(e=>"invalid"===p(e.key)).length,[p]);f.useEffect(()=>{if(!e)return;let r=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t]),f.useEffect(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e]),f.useEffect(()=>{e&&setTimeout(()=>o.current?.focus(),100)},[e]);let x=f.useMemo(()=>{if(!i.trim())return iy;let e=i.toLowerCase();return iy.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e))},[i]),g=iy.find(e=>e.key===a);return e?(0,m.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-white dark:bg-zinc-950",children:[(0,m.jsxs)("header",{className:"flex h-16 items-center justify-between border-b border-zinc-200 px-6 dark:border-zinc-800",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-blue-600 text-white",children:(0,m.jsx)(eu,{className:"h-5 w-5"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h1",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:"Agent Configuration"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Manage AI agent settings and preferences"})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-zinc-100 p-1 dark:bg-zinc-800",children:[(0,m.jsx)("button",{type:"button",onClick:()=>n("agents"),className:`rounded-md px-4 py-1.5 text-sm font-medium transition-colors ${"agents"===r?"bg-blue-600 text-white shadow-sm":"text-zinc-600 hover:bg-zinc-200 dark:text-zinc-400 dark:hover:bg-zinc-700"}`,children:"Agents"}),(0,m.jsx)("button",{type:"button",onClick:()=>n("categories"),className:`rounded-md px-4 py-1.5 text-sm font-medium transition-colors ${"categories"===r?"bg-blue-600 text-white shadow-sm":"text-zinc-600 hover:bg-zinc-200 dark:text-zinc-400 dark:hover:bg-zinc-700"}`,children:"Categories"}),(0,m.jsx)("button",{type:"button",onClick:()=>n("profiles"),className:`rounded-md px-4 py-1.5 text-sm font-medium transition-colors ${"profiles"===r?"bg-blue-600 text-white shadow-sm":"text-zinc-600 hover:bg-zinc-200 dark:text-zinc-400 dark:hover:bg-zinc-700"}`,children:"Profiles"})]}),(0,m.jsx)("button",{type:"button",onClick:t,className:"flex h-9 w-9 items-center justify-center rounded-lg text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-200","aria-label":"Close panel",children:(0,m.jsx)(ef,{className:"h-5 w-5"})})]}),"agents"===r?(0,m.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,m.jsxs)("aside",{className:"flex w-[280px] flex-col border-r border-zinc-200 bg-zinc-50/50 dark:border-zinc-800 dark:bg-zinc-900/20",children:[(0,m.jsx)("div",{className:"border-b border-zinc-200 p-4 dark:border-zinc-800",children:(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)(ep,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"}),(0,m.jsx)("input",{ref:o,type:"text",value:i,onChange:e=>l(e.target.value),placeholder:"Search agents...",className:"h-10 w-full rounded-lg border border-zinc-200 bg-white pl-9 pr-4 text-sm text-zinc-900 placeholder:text-zinc-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100 dark:placeholder:text-zinc-600"})]})}),(0,m.jsxs)("nav",{className:"flex-1 overflow-y-auto p-2",children:[(0,m.jsx)("div",{className:"space-y-1",children:x.map(e=>{let t;return(0,m.jsxs)("button",{type:"button",onClick:()=>s(e.key),className:`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-colors ${a===e.key?"bg-blue-600 text-white":"text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800"}`,children:[(0,m.jsx)("div",{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md ${a===e.key?"bg-white/20":"bg-zinc-200 dark:bg-zinc-800"}`,children:(0,m.jsx)(eh,{className:`h-4 w-4 ${a===e.key?"text-white":"text-zinc-600 dark:text-zinc-400"}`})}),(0,m.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 truncate text-sm font-medium",children:[e.name,"unconfigured"===(t=p(e.key))?(0,m.jsx)("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${a===e.key?"bg-zinc-300":"bg-zinc-400 dark:bg-zinc-500"}`,title:"Inherits category configuration"}):"invalid"===t?(0,m.jsx)("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${a===e.key?"bg-amber-300":"bg-amber-500"}`,title:"Model not available"}):(0,m.jsx)("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${a===e.key?"bg-emerald-300":"bg-emerald-500"}`,title:"Configured"})]}),(0,m.jsx)("div",{className:`truncate text-xs ${a===e.key?"text-blue-100":"text-zinc-500 dark:text-zinc-500"}`,children:e.description})]}),a===e.key&&(0,m.jsx)(ex,{className:"h-4 w-4 shrink-0 text-blue-200"})]},e.key)})}),0===x.length&&(0,m.jsx)("div",{className:"py-8 text-center",children:(0,m.jsx)("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"No agents found"})})]}),(0,m.jsx)("div",{className:"border-t border-zinc-200 p-4 dark:border-zinc-800",children:(0,m.jsxs)("div",{className:"flex items-center justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[(0,m.jsxs)("span",{className:"flex items-center gap-1.5",children:[iy.length," agents",h>0&&(0,m.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",children:[(0,m.jsx)(eg,{className:"h-2.5 w-2.5"}),h," need attention"]})]}),(0,m.jsx)("kbd",{className:"rounded bg-zinc-200 px-1.5 py-0.5 font-mono dark:bg-zinc-800",children:"ESC"})]})})]}),(0,m.jsx)("main",{className:"flex-1 overflow-y-auto bg-white dark:bg-zinc-950",children:(0,m.jsxs)("div",{className:"mx-auto max-w-3xl p-8",children:[(0,m.jsxs)("div",{className:"mb-8 flex items-center gap-4",children:[(0,m.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-blue-500 to-indigo-600 text-white shadow-lg",children:(0,m.jsx)(eh,{className:"h-8 w-8"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h2",{className:"text-2xl font-bold text-zinc-900 dark:text-zinc-100",children:g?.name}),(0,m.jsx)("p",{className:"text-zinc-500 dark:text-zinc-400",children:g?.description})]})]}),(0,m.jsx)(ib,{agentName:a,onSaveSuccess:t})]})})]}):"categories"===r?(0,m.jsx)("main",{className:"flex-1 overflow-y-auto bg-white dark:bg-zinc-950",children:(0,m.jsxs)("div",{className:"mx-auto max-w-4xl p-8",children:[(0,m.jsxs)("div",{className:"mb-8",children:[(0,m.jsx)("h2",{className:"text-2xl font-bold text-zinc-900 dark:text-zinc-100",children:"Categories"}),(0,m.jsx)("p",{className:"text-zinc-500 dark:text-zinc-400",children:"Manage agent categories and their configurations"})]}),(0,m.jsx)(ii,{})]})}):(0,m.jsx)("main",{className:"flex-1 overflow-y-auto bg-white dark:bg-zinc-950",children:(0,m.jsxs)("div",{className:"mx-auto max-w-4xl p-8",children:[(0,m.jsxs)("div",{className:"mb-8",children:[(0,m.jsx)("h2",{className:"text-2xl font-bold text-zinc-900 dark:text-zinc-100",children:"Profiles"}),(0,m.jsx)("p",{className:"text-zinc-500 dark:text-zinc-400",children:"Manage configuration profiles for different agent setups"})]}),(0,m.jsx)(ix,{})]})})]}):null}let iw=[{label:"1d",days:1},{label:"3d",days:3},{label:"7d",days:7},{label:"30d",days:30},{label:"All",days:0}],ik="opencode --port <PORT>";function ij(){let e,t,r,n,a,s,i,l,o,c;e=(0,S.useQueryClient)(),t=(0,f.useRef)(null),r=(0,f.useRef)(0),n=(0,f.useRef)(null),a=(0,f.useRef)(null),s=(0,f.useRef)(!1),i=(0,f.useRef)(!0),l=(0,f.useRef)(null),o=(0,f.useCallback)(()=>{n.current||(n.current=setTimeout(()=>{e.invalidateQueries({queryKey:["sessions"]}),n.current=null},500))},[e]),c=(0,f.useCallback)(t=>{let r="payload"in t?t.payload:t;if(!r?.type)return void o();let n=r.properties?.sessionID;["session.status","session.updated","session.created","session.deleted","question.asked","permission.asked","permission.updated","question.replied","question.rejected","permission.replied","session.archived"].includes(r.type)?e.setQueryData(["sessions"],e=>{if(!e?.sessions)return o(),e;switch(r.type){case"session.updated":case"session.created":{let t=r.properties?.info;if(!t)return o(),e;if(t.parentID){let r=!1,n=e.sessions.map(e=>{let n=e.children?.some(e=>e.id===t.id),a=e.id===t.parentID;if(!n&&!a)return e;r=!0;let s=e.children||[],i=s.find(e=>e.id===t.id),l=ea({...i,...t,realTimeStatus:t.realTimeStatus??i?.realTimeStatus??"busy",waitingForUser:t.waitingForUser??i?.waitingForUser});return i?{...e,children:s.map(e=>e.id===t.id?l:e)}:{...e,children:[...s,l]}});if(!r)return o(),e;return{...e,sessions:n}}let n=e.sessions.find(e=>e.id===t.id);if(!n)return o(),{...e,sessions:[ea(t),...e.sessions]};let a={...t,projectName:n.projectName,branch:n.branch,realTimeStatus:t.realTimeStatus??n.realTimeStatus,waitingForUser:t.waitingForUser??n.waitingForUser,children:n.children};return{...e,sessions:e.sessions.map(e=>e.id===t.id?a:e)}}case"session.deleted":{let t=r.properties?.info,n=t?.id??r.properties?.sessionID;if(!n)return o(),e;return{...e,sessions:e.sessions.filter(e=>e.id!==n)}}default:{if(!n)return o(),e;let t=e=>{switch(r.type){case"session.status":{let t=r.properties?.status?.type;if(!t)return e;let n=e.realTimeStatus,a=!e.parentID;return"retry"!==t||i.current||W("play-alert","Skipped playAlertSound() because muted","playAlertSound() failed",(e,t)=>{let r=e.createOscillator(),n=e.createGain();r.type="triangle",r.frequency.setValueAtTime(880,t),r.frequency.exponentialRampToValueAtTime(698,t+.25),n.gain.setValueAtTime(.3,t),n.gain.exponentialRampToValueAtTime(.001,t+.35),r.connect(n),n.connect(e.destination),r.start(t),r.stop(t+.35);let a=e.createOscillator(),s=e.createGain();a.type="triangle",a.frequency.setValueAtTime(698,t+.2),a.frequency.exponentialRampToValueAtTime(523,t+.45),s.gain.setValueAtTime(.25,t+.2),s.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(s),s.connect(e.destination),a.start(t+.2),a.stop(t+.5)}),"idle"!==t||i.current||e.parentID||"busy"!==n&&"retry"!==n||G(),"idle"===t&&en(e.id,!1),"retry"===t&&en(e.id,!0),"idle"===t&&a&&(e.children?.length||0)>0&&o(),{...e,realTimeStatus:t,waitingForUser:"retry"===t||"idle"!==t&&e.waitingForUser,children:e.children}}case"question.asked":case"permission.asked":return i.current||K(),en(n,!0),{...e,waitingForUser:!0};case"permission.updated":return o(),e;case"question.replied":case"question.rejected":case"permission.replied":return en(n,!1),{...e,waitingForUser:!1};case"session.archived":return{...e,time:{...e.time||{},archived:Date.now()}};default:return e}},a=!1,s=e.sessions.map(e=>e.id===n?(a=!0,t(e)):e.children?.some(e=>e.id===n)?(a=!0,"session.status"===r.type&&r.properties?.status?.type==="idle")?{...e,children:e.children.filter(e=>e.id!==n)}:{...e,children:e.children.map(e=>e.id===n?t(e):e)}:e);if(!a)return o(),e;return{...e,sessions:s}}}}):o()},[e,o]),(0,f.useEffect)(()=>(l.current=setTimeout(()=>{i.current=!1},3e3),()=>{l.current&&clearTimeout(l.current)}),[]),(0,f.useEffect)(()=>{let e=null,n=()=>{t.current&&(clearTimeout(t.current),t.current=null),a.current&&(clearTimeout(a.current),a.current=null),(e=new EventSource("/api/opencode-events")).onopen=()=>{r.current=0,s.current=!1,a.current=setTimeout(()=>{e&&(s.current=!0,e.close(),o(),n())},15e3)},e.onmessage=e=>{try{let t=JSON.parse(e.data);c(t),r.current=0}catch(e){console.error("Failed to parse SSE event:",e)}},e.onerror=()=>{if(e?.close(),a.current&&(clearTimeout(a.current),a.current=null),s.current){s.current=!1;return}r.current<5&&(t.current=setTimeout(()=>{r.current++,n()},1e3*Math.pow(2,r.current)))}};return n(),()=>{e?.close(),t.current&&(clearTimeout(t.current),t.current=null),a.current&&(clearTimeout(a.current),a.current=null)}},[c,o]);let[d,u]=(0,f.useState)(7),[p,h]=(0,f.useState)(()=>H()),[x,g]=(0,f.useState)([]),[b,y]=(0,f.useState)(!1),[v,w]=(0,f.useState)("idle"),[k,j]=(0,f.useState)(!1),z=(0,f.useRef)(null),N=(0,f.useRef)(null),C=(0,f.useMemo)(()=>Array.from(new Set(x.map(e=>e.projectName))),[x]),E=x.length>0,R=1===C.length?`${C[0]} has an OpenCode process without an exposed API port.`:`${C.length} projects have OpenCode processes without exposed API ports.`;(0,f.useEffect)(()=>{let e=()=>{Q(),document.removeEventListener("click",e),document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",e),document.removeEventListener("touchstart",e)};return document.addEventListener("click",e),document.addEventListener("pointerdown",e,{passive:!0}),document.addEventListener("keydown",e),document.addEventListener("touchstart",e,{passive:!0}),()=>{document.removeEventListener("click",e),document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",e),document.removeEventListener("touchstart",e)}},[]),(0,f.useEffect)(()=>{if(!b||!E)return;let e=e=>{let t=e.target,r=N.current,n=z.current;r?.contains(t)||n?.contains(t)||y(!1)},t=e=>{"Escape"===e.key&&(y(!1),z.current?.focus())};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[E,b]);let A=async()=>{try{await navigator.clipboard.writeText(ik),w("copied"),setTimeout(()=>w("idle"),1500)}catch{w("failed"),setTimeout(()=>w("idle"),2e3)}};return(0,m.jsx)("div",{className:"min-h-screen bg-zinc-50 dark:bg-black",children:(0,m.jsxs)("main",{className:"h-screen flex flex-col",children:[(0,m.jsxs)("header",{className:"flex items-center justify-between px-4 py-4 border-b border-gray-200 dark:border-zinc-800",children:[(0,m.jsx)("h1",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:"VibePulse"}),(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("button",{type:"button",onClick:()=>{Q();let e=!p;h(e),window.localStorage.setItem(I,String(e)),e||W("play-toggle-feedback","Skipped playToggleFeedbackSound() because muted","playToggleFeedbackSound() failed",(e,t)=>{let r=e.createOscillator(),n=e.createGain();r.type="sine",r.frequency.setValueAtTime(740,t),r.frequency.exponentialRampToValueAtTime(920,t+.1),n.gain.setValueAtTime(.13,t),n.gain.exponentialRampToValueAtTime(.001,t+.13),r.connect(n),n.connect(e.destination),r.start(t),r.stop(t+.13)})},className:`p-1.5 rounded-lg transition-all duration-150 ${p?"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-zinc-800":"text-blue-500 dark:text-blue-400 hover:text-blue-600 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20"}`,title:p?"Unmute notifications":"Mute notifications",children:p?(0,m.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"}),(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2"})]}):(0,m.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.536 8.464a5 5 0 010 7.072M18.364 5.636a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"})})}),E?(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)("button",{ref:z,type:"button",onClick:()=>y(e=>!e),className:`p-1.5 rounded-lg transition-all duration-150 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-zinc-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 ${b?"bg-gray-100 dark:bg-zinc-800":""}`,"aria-label":"OpenCode process hint details","aria-haspopup":"dialog","aria-expanded":E&&b,"aria-controls":"process-hint-popover",children:(0,m.jsx)(ed,{className:"h-3.5 w-3.5"})}),E&&b?(0,m.jsxs)("div",{id:"process-hint-popover",ref:N,role:"dialog","aria-label":"OpenCode process hints",className:"absolute right-0 top-9 z-30 w-80 rounded-lg border border-blue-200 bg-white p-3 shadow-xl dark:border-blue-900/40 dark:bg-zinc-900",children:[(0,m.jsx)("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-200",children:R}),(0,m.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-blue-800 dark:text-blue-300",children:"Sessions from these instances become visible once OpenCode starts with an exposed API port."}),(0,m.jsx)("div",{className:"mt-2 rounded-md bg-blue-50 px-2 py-1.5 dark:bg-blue-900/20",children:(0,m.jsx)("code",{className:"text-[11px] text-blue-900 dark:text-blue-200",children:ik})}),(0,m.jsxs)("div",{className:"mt-2 flex items-center justify-between gap-2",children:[(0,m.jsx)("span",{className:"text-[10px] text-blue-700 dark:text-blue-300",children:"VibePulse auto-detects active ports."}),(0,m.jsx)("button",{type:"button",onClick:A,className:"rounded-md border border-blue-200 px-2 py-1 text-[10px] font-medium text-blue-800 transition-colors hover:bg-blue-50 dark:border-blue-900/40 dark:text-blue-200 dark:hover:bg-blue-900/30",children:"copied"===v?"Copied":"failed"===v?"Copy Failed":"Copy"})]})]}):null]}):null,(0,m.jsx)("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),(0,m.jsx)("div",{className:"flex items-center gap-1 bg-gray-100 dark:bg-zinc-800 rounded-lg p-0.5",children:iw.map(e=>(0,m.jsx)("button",{type:"button",onClick:()=>u(e.days),className:`px-3 py-1 text-xs font-medium rounded-md transition-all duration-150 ${d===e.days?"bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,children:e.label},e.days))}),(0,m.jsx)(em,{onClick:()=>j(!0)})]})]}),(0,m.jsx)(et,{children:(0,m.jsx)(Z,{filterDays:d,onProcessHintsChange:g})}),(0,m.jsx)(iv,{open:k,onClose:()=>j(!1)})]})})}e.s(["default",()=>ij],52683)}]);