@openchambery/web 1.19.17-beta.3 → 1.19.17

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 (41) hide show
  1. package/dist/assets/{AssistantView-CDXE0eTS.js → AssistantView-Zq6tBjih.js} +3 -3
  2. package/dist/assets/{DiagramView-BrRV4o5T.js → DiagramView-BVkfNci5.js} +1 -1
  3. package/dist/assets/MarkdownRenderer-DSqWFDq7.js +2 -0
  4. package/dist/assets/{MarkdownRendererImpl-D2dIlX0h.js → MarkdownRendererImpl-BlRCMmq2.js} +1 -1
  5. package/dist/assets/{MarkstreamRendererImpl-Drb2Tpv-.js → MarkstreamRendererImpl-IxPVvQrK.js} +1 -1
  6. package/dist/assets/{MobileDetailNavigation-BgCoDqtp.js → MobileDetailNavigation-B2fTY2nU.js} +1 -1
  7. package/dist/assets/{MobileShareBridge-ZlVURYWR.js → MobileShareBridge-CQBddgDr.js} +1 -1
  8. package/dist/assets/MobileSurface-DrUFT40n.js +2 -0
  9. package/dist/assets/{MultiRunWindow-BCvcwItK.js → MultiRunWindow-B8Cc2NUx.js} +1 -1
  10. package/dist/assets/{SettingsView-D57amZJb.js → SettingsView-DxMrhPpR.js} +3 -3
  11. package/dist/assets/{SettingsWindow-B5DqLCkD.js → SettingsWindow-Cb8yglVO.js} +1 -1
  12. package/dist/assets/{TerminalView-2_RFPaVs.js → TerminalView-BZ_OWmUl.js} +1 -1
  13. package/dist/assets/{ToolOutputDialog-CQs_7KYT.js → ToolOutputDialog-nhZwyPOH.js} +1 -1
  14. package/dist/assets/{appThemeRegistry-DpLe_jnW.js → appThemeRegistry-nmKlvHum.js} +1 -1
  15. package/dist/assets/{fileMentionTouchSelection-CmQthb6Q.js → fileMentionTouchSelection-DipHuaLB.js} +1 -1
  16. package/dist/assets/{gitApi-8HxdR1zx.js → gitApi-CbhPyoLY.js} +1 -1
  17. package/dist/assets/{insertionBoundaries-Cdv9-1Bg.js → insertionBoundaries-DcjuOya1.js} +1 -1
  18. package/dist/assets/{main-Cfru2-qr.js → main-BoTARB6C.js} +2 -2
  19. package/dist/assets/{main-CQY7JUX4.js → main-Cua6NA9P.js} +4 -4
  20. package/dist/assets/{miniChat-BphFgAb_.js → miniChat-alS-GQJT.js} +2 -2
  21. package/dist/assets/{mobile-BVRPTuLT.js → mobile-B2jIuTOm.js} +2 -2
  22. package/dist/assets/{multirun-CYdieVzW.js → multirun-DKDs3BMk.js} +1 -1
  23. package/dist/assets/{projectMeta-D8hiy3Dk.js → projectMeta-D2rOiejm.js} +1 -1
  24. package/dist/assets/{renderElectronMiniChatApp-CVqd3Nmc.js → renderElectronMiniChatApp-CaQsjZiI.js} +2 -2
  25. package/dist/assets/{renderMobileApp-DgtCGRKP.js → renderMobileApp-BFbbXCSX.js} +4 -4
  26. package/dist/assets/{runtimeConfig-DXXOBrK_.js → runtimeConfig-DFO2rEBa.js} +1 -1
  27. package/dist/assets/{runtimeEndpointReset-bSVOt7pi.js → runtimeEndpointReset-Dl97vnoo.js} +1 -1
  28. package/dist/assets/{sessionLookup-BZuujM6l.js → sessionLookup-CZwBZILA.js} +1 -1
  29. package/dist/assets/{src-C_Yn9Ylz.css → src-DZ60kHBP.css} +1 -1
  30. package/dist/assets/{useAppFontEffects-DhEfjuPp.js → useAppFontEffects-CCaWyCj1.js} +6 -6
  31. package/dist/assets/{useDesktopWindowControlsLayout-BhNFU2Wd.js → useDesktopWindowControlsLayout-CLapWnnJ.js} +1 -1
  32. package/dist/assets/{useEffectiveDirectory-BhhzFJgX.js → useEffectiveDirectory-Cz772BtQ.js} +1 -1
  33. package/dist/assets/{useMobileNavigationStore-1jdHeA49.js → useMobileNavigationStore-C4HhoiC4.js} +8 -8
  34. package/dist/assets/{useSessionAutoCleanup-C8u2-jrO.js → useSessionAutoCleanup-0sFR1yLV.js} +1 -1
  35. package/dist/assets/{useWorkerHighlightedLines-DFXK66lA.js → useWorkerHighlightedLines-tFoFZt9Z.js} +1 -1
  36. package/dist/index.html +3 -3
  37. package/dist/mini-chat.html +3 -3
  38. package/dist/mobile.html +3 -3
  39. package/package.json +1 -1
  40. package/dist/assets/MarkdownRenderer-CAdfUgV1.js +0 -2
  41. package/dist/assets/MobileSurface-DhLOTW0-.js +0 -2
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/assistant-attachment-cache-C0aRnFkj.js","assets/rolldown-runtime-C0FnF6B9.js","assets/runtime-auth-D66yq6ie.js","assets/runtime-switch-LvWDU-SL.js","assets/runtime-fetch-zIalUnbb.js","assets/relay-image-stream-DM7atqJs.js","assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js","assets/dualLimitLru-D8Sphgua.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{i as t,l as n}from"./runtime-switch-LvWDU-SL.js";import{n as r}from"./runtime-fetch-zIalUnbb.js";import{Cn as i,Jt as a,Qt as o,Yt as s,d as c,tt as l,u}from"./persistence-DwRBC4zl.js";import{h as d}from"./desktopHosts-B052a4UK.js";import{i as f,n as p,r as m}from"./desktopRelayRestore-OjKNXr10.js";import{A as h,D as g,E as _,F as v,I as y,M as b,N as x,P as S,j as C,k as w,nt as T,rt as E,tt as D}from"./vendor-base-ui-CnHfUmDN.js";import{Nt as O}from"./platform-DQ5_LNKO.js";import{t as k}from"./useUIStore-CxOoCv7B.js";import{o as A}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as j}from"./vendor-react-DLPElpoQ.js";import{n as M}from"./vendor-tanstack-query-core-BWz0ose6.js";import{i as ee,r as te,s as N}from"./vendor-tanstack-react-query-D7pys_c9.js";import{P as ne,V as P,a as re,f as F,l as ie}from"./vendor-codemirror-autocomplete-DHomsvW7.js";import{c as I,o as L,r as R}from"./vendor-codemirror-lang-angular-DShkBD6m.js";import{n as ae,r as z}from"./vendor-codemirror-lang-json-CYJRHck9.js";import{n as oe}from"./vendor-codemirror-lang-markdown-WORgx6ZD.js";import{n as B}from"./vendor-codemirror-lang-python-Du6XQ8Zw.js";import{O as se}from"./vendor-codemirror-legacy-modes-DuRAjNvB.js";import{n as ce}from"./vendor-reactuses-core-BnW6GxJt.js";import{d as le,f as ue,l as de,p as V,r as H,t as fe}from"./button-bhVnVYB_.js";import{i as pe,t as me}from"./store-BoixGrYS.js";import{Ja as he,Xa as ge,aa as _e,c as ve,fr as ye,ho as be,hr as xe,or as Se,ra as U,ta as Ce,to as we,yr as Te}from"./useMobileNavigationStore-1jdHeA49.js";import{t as W}from"./AgentAvatar-CUDJ3_nZ.js";import{n as G}from"./Icon-C9ZHbwqp.js";import{i as Ee,n as De,r as Oe,t as ke}from"./vendor-simplewebauthn-browser-Dwhcdg_5.js";import{B as Ae,C as je,D as Me,H as Ne,O as Pe,S as Fe,T as Ie,U as Le,V as Re,k as ze,w as Be}from"./projectMeta-D8hiy3Dk.js";import{t as Ve}from"./input-8Te_vPwB.js";import{t as He}from"./useThemeSystem-DMzWVJaW.js";import{i as Ue}from"./OverlayScrollbar-C7fAOAKT.js";import{n as We,r as Ge,t as Ke}from"./dropdown-menu.styles-Bzo6L3FH.js";import{n as qe}from"./textarea-DRL916s6.js";import{t as Je}from"./vendor-codemirror-language-data-BfYFhIH1.js";var K=j(),Ye=[`desktopHostSwitch`],Xe=class extends Error{result;host;constructor(e,t){super(e.reason),this.name=`DesktopHostSwitchError`,this.result=e,this.host=t}},Ze=(e,t)=>me(pe.getState().dictionary,e,t),Qe=async e=>{let{host:t}=e;if(t.id===`local`){let r=(e.localApiOrigin||``).trim();if(!r)throw new Xe({ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`},t);return n({apiBaseUrl:r,clientToken:e.localClientToken||null,runtimeKey:m(t)}),{ok:!0,via:`direct`,status:{status:`ok`,latencyMs:0}}}let r=await f(t,{cachedProbe:e.cachedProbe});if(!r.ok)throw new Xe(r,t);return r},$e=null,et=()=>$e||($e=new M(u,{mutationKey:Ye,mutationFn:Qe,onError:(e,t)=>{if(e instanceof Xe&&e.result.reason!==`unsupported`){if(e.result.status.status===`auth`){Te.error(Ze(`desktopHostSwitcher.status.authRequired`));return}Te.error(Ze(`desktopHostSwitcher.toast.instanceUnreachable`,{host:d(t.host.label)}))}}}),$e.subscribe(()=>void 0),$e),tt=async e=>{if(p(e.host))return{ok:!0,via:`direct`,status:e.cachedProbe?.status===`ok`?e.cachedProbe:{status:`ok`,latencyMs:0}};if(u.isMutating({mutationKey:Ye})>0)return{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unsupported`};try{return await et().mutate(e)}catch(e){if(e instanceof Xe)return e.result;throw e}},nt=()=>{let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={mutationKey:Ye},e[0]=t):t=e[0],te(t)>0},rt=()=>{let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={filters:{mutationKey:Ye,status:`pending`},select:it},e[0]=t):t=e[0],ee(t)[0]?.host.id??null};function it(e){return e.state.variables}var q=e=>typeof e==`object`&&!!e,J=(e,t)=>{let n=e[t];return typeof n==`string`?n:null},Y=(e,t)=>{let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:null},X=(e,t)=>{let n=e[t];return typeof n==`boolean`?n:null},at=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],ot=()=>a()?(e,t)=>s(e,t):null,st=e=>{if(!q(e))return;let t=X(e,`enabled`)??!1,n=J(e,`store`)?.toLowerCase()===`settings`?`settings`:`never`,r=J(e,`value`);return{enabled:t,store:n,...r?{value:r}:{}}},ct=e=>e===`remote`||e===`dynamic`?e:`local`,lt=e=>{if(!q(e))return null;let t=J(e,`id`);if(!t)return null;let n=X(e,`enabled`)??!0,r=ct(J(e,`type`)),i=J(e,`localHost`)||J(e,`local_host`)||void 0,a=Y(e,`localPort`)??Y(e,`local_port`)??void 0,o=J(e,`remoteHost`)||J(e,`remote_host`)||void 0,s=Y(e,`remotePort`)??Y(e,`remote_port`)??void 0;return{id:t,enabled:n,type:r,...i?{localHost:i}:{},...typeof a==`number`?{localPort:a}:{},...o?{remoteHost:o}:{},...typeof s==`number`?{remotePort:s}:{}}},ut=e=>{if(!q(e))return null;let t=J(e,`id`),n=J(e,`sshCommand`)||J(e,`ssh_command`);if(!t||!n)return null;let r=J(e,`nickname`),i=e.sshParsed,a=q(i)?{destination:J(i,`destination`)||``,args:at(i.args)}:void 0,o=q(e.remoteOpenchamber)?e.remoteOpenchamber:q(e.remote_openchamber)?e.remote_openchamber:{},s=q(e.localForward)?e.localForward:q(e.local_forward)?e.local_forward:{},c=q(e.auth)?e.auth:{},l=J(o,`mode`)?.toLowerCase()===`external`?`external`:`managed`,u=J(o,`installMethod`)||J(o,`install_method`),d=u===`npm`||u===`download_release`||u===`upload_bundle`?u:`bun`,f=J(s,`bindHost`)||J(s,`bind_host`)||`127.0.0.1`,p=f===`localhost`||f===`0.0.0.0`?f:`127.0.0.1`,m=(Array.isArray(e.portForwards)?e.portForwards:Array.isArray(e.port_forwards)?e.port_forwards:[]).map(e=>lt(e)).filter(e=>!!e),h=Y(o,`preferredPort`)??Y(o,`preferred_port`),g=Y(s,`preferredLocalPort`)??Y(s,`preferred_local_port`),_=st(c.sshPassword||c.ssh_password),v=st(c.openchamberPassword||c.openchamber_password);return{id:t,...r?{nickname:r}:{},sshCommand:n,...a&&a.destination?{sshParsed:a}:{},connectionTimeoutSec:Y(e,`connectionTimeoutSec`)??Y(e,`connection_timeout_sec`)??60,remoteOpenchamber:{mode:l,keepRunning:X(o,`keepRunning`)??X(o,`keep_running`)??!0,relayHost:X(o,`relayHost`)??X(o,`relay_host`)??!0,...h?{preferredPort:h}:{},installMethod:d,uploadBundleOverSsh:X(o,`uploadBundleOverSsh`)??X(o,`upload_bundle_over_ssh`)??!1},localForward:{...g?{preferredLocalPort:g}:{},bindHost:p},auth:{..._?{sshPassword:_}:{},...v?{openchamberPassword:v}:{}},portForwards:m}},dt=e=>{switch(e){case`config_resolved`:case`auth_check`:case`master_connecting`:case`remote_probe`:case`installing`:case`updating`:case`server_detecting`:case`server_starting`:case`forwarding`:case`ready`:case`degraded`:case`error`:return e;default:return`idle`}},ft=e=>{if(!q(e))return null;let t=J(e,`id`);return t?{id:t,phase:dt(J(e,`phase`)),...J(e,`detail`)?{detail:J(e,`detail`)||void 0}:{},...J(e,`localUrl`)||J(e,`local_url`)?{localUrl:J(e,`localUrl`)||J(e,`local_url`)||void 0}:{},...typeof(Y(e,`localPort`)??Y(e,`local_port`))==`number`?{localPort:Y(e,`localPort`)??Y(e,`local_port`)??void 0}:{},...typeof(Y(e,`remotePort`)??Y(e,`remote_port`))==`number`?{remotePort:Y(e,`remotePort`)??Y(e,`remote_port`)??void 0}:{},startedByUs:X(e,`startedByUs`)??X(e,`started_by_us`)??!1,retryAttempt:Y(e,`retryAttempt`)??Y(e,`retry_attempt`)??0,requiresUserAction:X(e,`requiresUserAction`)??X(e,`requires_user_action`)??!1,...J(e,`errorCode`)||J(e,`error_code`)?{errorCode:J(e,`errorCode`)||J(e,`error_code`)||void 0}:{},updatedAtMs:Y(e,`updatedAtMs`)??Y(e,`updated_at_ms`)??Date.now()}:null},pt=e=>{if(!q(e))return null;let t=J(e,`host`),n=J(e,`source`),r=J(e,`sshCommand`)||J(e,`ssh_command`);return!t||!n||!r?null:{host:t,source:n,sshCommand:r,pattern:X(e,`pattern`)??!1}},mt=(e,t)=>({id:e,sshCommand:t,connectionTimeoutSec:60,remoteOpenchamber:{mode:`managed`,keepRunning:!0,relayHost:!0,installMethod:`bun`,uploadBundleOverSsh:!1},localForward:{bindHost:`127.0.0.1`},auth:{},portForwards:[]}),ht=async()=>{let e=ot();if(!e)return{instances:[]};let t=await e(`desktop_ssh_instances_get`);return q(t)?{instances:(Array.isArray(t.instances)?t.instances:Array.isArray(t.desktopSshInstances)?t.desktopSshInstances:[]).map(e=>ut(e)).filter(e=>!!e)}:{instances:[]}},gt=async e=>{let t=ot();t&&await t(`desktop_ssh_instances_set`,{config:{instances:e.instances}})},_t=async()=>{let e=ot();if(!e)return[];let t=await e(`desktop_ssh_import_hosts`);return Array.isArray(t)?t.map(e=>pt(e)).filter(e=>!!e):[]},vt=async e=>{let t=ot();t&&await t(`desktop_ssh_connect`,{id:e})},yt=async e=>{let t=ot();t&&await t(`desktop_ssh_disconnect`,{id:e})},bt=async e=>{let t=ot();if(!t)return[];let n=await t(`desktop_ssh_status`,{...e?{id:e}:{}});return Array.isArray(n)?n.map(e=>ft(e)).filter(e=>!!e):[]},xt=async(e,t)=>{let n=ot();if(!n)return[];let r=await n(`desktop_ssh_logs`,{id:e,...typeof t==`number`?{limit:t}:{}});return Array.isArray(r)?r.filter(e=>typeof e==`string`):[]},St=async e=>{let t=ot();t&&await t(`desktop_ssh_logs_clear`,{id:e})},Ct=(e,t)=>{let n=Math.max(0,Math.trunc(Number(e.fileGroups)||0)),r=Math.max(0,Math.trunc(Number(e.singleFiles)||0)),i=Math.max(0,Math.trunc(Number(e.directories)||0));return{fileGroups:Array.from({length:n},()=>!0),singleFiles:Array.from({length:r},()=>!0),directories:Array.from({length:i},()=>!0),agentsRoot:!0,authFile:t?.includeAuthFile===!0}},wt=e=>{if(!q(e))return null;let t=J(e,`path`),n=Y(e,`bytes`);return!t||n===null?null:{path:t,bytes:n}},Tt=e=>{if(!q(e))return null;let t=J(e,`path`),n=Y(e,`fileCount`)??Y(e,`file_count`),r=Y(e,`bytes`);return!t||n===null||r===null?null:{path:t,fileCount:n,bytes:r}},Et=e=>{if(e==null||!q(e))return null;let t=Y(e,`fileCount`)??Y(e,`file_count`),n=Y(e,`bytes`);return t===null||n===null?null:{fileCount:t,bytes:n}},Dt=e=>{if(e==null||!q(e))return null;let t=Y(e,`bytes`);return t===null?null:{bytes:t}},Ot=e=>{if(!q(e))return null;let t=Array.isArray(e.files)?e.files:null,n=Array.isArray(e.directories)?e.directories:null,r=at(e.deletes),i=Y(e,`totalBytes`)??Y(e,`total_bytes`);if(!t||!n||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=t.map(e=>wt(e)).filter(e=>!!e),o=n.map(e=>Tt(e)).filter(e=>!!e);if(a.length!==t.length||o.length!==n.length)return null;let s=e.agentsRoot??e.agents_root,c=s==null?null:Et(s);if(s!=null&&c===null)return null;let l=e.authFile??e.auth_file,u=l==null?null:Dt(l),d=e.direction===`pull`||e.direction===`push`?e.direction:void 0,f=e.selections,p=q(f)?{fileGroups:Array.isArray(f.fileGroups)?f.fileGroups.map(e=>e!==!1):[],singleFiles:Array.isArray(f.singleFiles)?f.singleFiles.map(e=>e!==!1):[],directories:Array.isArray(f.directories)?f.directories.map(e=>e!==!1):[],agentsRoot:f.agentsRoot!==!1,authFile:f.authFile===!0}:void 0,m=kt(e.selectionShape??e.selection_shape);return{files:a,directories:o,agentsRoot:c,authFile:u,deletes:r,totalBytes:i,...d?{direction:d}:{},...p?{selections:p}:{},...m?{selectionShape:m}:{}}},kt=e=>{if(!q(e))return null;let t=Y(e,`fileGroups`)??Y(e,`file_groups`),n=Y(e,`singleFiles`)??Y(e,`single_files`),r=Y(e,`directories`);return t===null||n===null||r===null||t<0||n<0||r<0?null:{fileGroups:t,singleFiles:n,directories:r}},At=e=>{if(!q(e))return null;let t=Ot(e.plan);if(!t)return null;let n=kt(e.selectionShape??e.selection_shape)??t.selectionShape??null;return{plan:t,remoteExisting:at(e.remoteExisting??e.remote_existing),remoteAgentsRootExists:X(e,`remoteAgentsRootExists`)??X(e,`remote_agents_root_exists`)??!1,remoteAuthFileExists:X(e,`remoteAuthFileExists`)??X(e,`remote_auth_file_exists`)??!1,...n?{selectionShape:n}:{}}},jt=e=>{if(!q(e)||X(e,`ok`)!==!0)return null;let t=Y(e,`files`),n=Y(e,`directories`),r=Y(e,`deletes`),i=Y(e,`totalBytes`)??Y(e,`total_bytes`);if(t===null||n===null||r===null||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=e.agentsRoot??e.agents_root,o=null;if(a!=null){if(!q(a))return null;let e=Y(a,`fileCount`)??Y(a,`file_count`);if(e===null)return null;o={fileCount:e}}let s=e.authFile??e.auth_file,c=s==null?null:Dt(s);return{ok:!0,files:t,directories:n,deletes:r,totalBytes:i,agentsRoot:o,authFile:c}},Mt=async(e={})=>{let t=ot();if(!t)return console.error(`[desktopSsh] config sync local scan skipped: desktop IPC bridge is unavailable in this window`),null;let n=await t(`desktop_ssh_sync_opencode_config`,{stage:`local`,...e.direction?{direction:e.direction}:{},...e.selections?{selections:e.selections}:{}});if(!q(n))return console.error(`[desktopSsh] config sync local scan returned a non-object payload`,n),null;let r=Ot(n.plan);if(!r)return console.error(`[desktopSsh] config sync local scan plan payload was not recognized`,n),null;let i=kt(n.selectionShape??n.selection_shape)??r.selectionShape??null;return i?{...r,selectionShape:i}:r},Nt=async(e,t={})=>{let n=ot();if(!n)return console.error(`[desktopSsh] config sync preview skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=At(r);return i||console.error(`[desktopSsh] config sync preview payload was not recognized`,r),i},Pt=async(e,t={})=>{let n=ot();if(!n)return console.error(`[desktopSsh] config sync apply skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,apply:!0,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=jt(r);return i||console.error(`[desktopSsh] config sync apply payload was not recognized`,r),i},Ft=async(e,t={})=>{let n=ot();if(!n)return[];let r=await n(`desktop_ssh_sync_runs_list`,{id:e,...t.targetKind?{targetKind:t.targetKind}:{}});return Array.isArray(r)?r.filter(e=>q(e)&&typeof e.syncRunId==`string`&&typeof e.targetId==`string`):[]},It=async e=>{if(!a())return async()=>{};let t=window.__OPENCHAMBER_DESKTOP__?.listen;if(typeof t!=`function`)return async()=>{};let n=await t(`openchamber:ssh-instance-status`,t=>{let n=ft(t?.payload);n&&e(n)});return async()=>{await n()}},Lt=new Set([`nodeRuntimeMissing`,`packageManagerMissing`,`nativeBinding`,`openchamberCliMissing`,`openchamberRegistry`,`openchamberInstall`,`openchamberCliIncompatible`,`opencodeInstall`,`serverStart`,`sshAuth`,`sshUnreachable`,`timeout`,`unknown`]),Rt=e=>typeof e==`string`&&Lt.has(e),zt=e=>{let t=String(e||``);return/requires Node\.js \d+|no supported Node runtime/i.test(t)?`nodeRuntimeMissing`:/neither bun nor npm/i.test(t)?`packageManagerMissing`:/better-sqlite3|node_gyp_bins|gyp ERR|failed to prepare better-sqlite3/i.test(t)?`nativeBinding`:/OpenChamber installation completed but the executable is unavailable/i.test(t)?`openchamberCliMissing`:/could not reach the npm registry|ENOTFOUND|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|CERT_HAS_EXPIRED|UNABLE_TO_GET_ISSUER_CERT|self-signed certificate|registry\.npmjs|npm error code E404|npm ERR! code E404|getaddrinfo/i.test(t)?`openchamberRegistry`:/Failed to install OpenChamber/i.test(t)?`openchamberInstall`:/Unknown option:\s*--relay-host|does not advertise --relay-host|does not support --relay-host/i.test(t)||/Unknown option:/i.test(t)?`openchamberCliIncompatible`:/Failed to install OpenCode|OpenCode CLI/i.test(t)?`opencodeInstall`:/failed to become reachable|Managed OpenChamber server failed/i.test(t)?`serverStart`:/Permission denied|Authentication failed|publickey|keyboard-interactive/i.test(t)?`sshAuth`:/Could not resolve hostname|Connection refused|Connection timed out|ControlMaster connection timed out|SSH master process exited|Network is unreachable/i.test(t)?`sshUnreachable`:/Timed out waiting for SSH|Timed out waiting for forwarded/i.test(t)?`timeout`:`unknown`},Bt=(e,t)=>Rt(e)?e:zt(t),Vt=e=>{switch(e){case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.title`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.title`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.title`;case`openchamberCliMissing`:return`desktopHostSwitcher.sshError.openchamberCliMissing.title`;case`openchamberRegistry`:return`desktopHostSwitcher.sshError.openchamberRegistry.title`;case`openchamberInstall`:return`desktopHostSwitcher.sshError.openchamberInstall.title`;case`openchamberCliIncompatible`:return`desktopHostSwitcher.sshError.openchamberCliIncompatible.title`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.title`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.title`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.title`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.title`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.title`;default:return`desktopHostSwitcher.sshError.unknown.title`}},Ht=e=>{switch(e){case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.guidance`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.guidance`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.guidance`;case`openchamberCliMissing`:return`desktopHostSwitcher.sshError.openchamberCliMissing.guidance`;case`openchamberRegistry`:return`desktopHostSwitcher.sshError.openchamberRegistry.guidance`;case`openchamberInstall`:return`desktopHostSwitcher.sshError.openchamberInstall.guidance`;case`openchamberCliIncompatible`:return`desktopHostSwitcher.sshError.openchamberCliIncompatible.guidance`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.guidance`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.guidance`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.guidance`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.guidance`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.guidance`;default:return`desktopHostSwitcher.sshError.unknown.guidance`}},Ut=e=>e===`unknown`||e===`openchamberCliIncompatible`,Wt=(e,t,n)=>{let r=typeof n==`string`?n.trim():``;return!Ut(t)||!r||r===e?e:`${e}\n${r}`},Z=T();function Gt(e){let t=(0,K.c)(27),{errorCode:n,detail:r,className:i}=e,{t:a}=ue(),o,s,c,l,u,d;if(t[0]!==i||t[1]!==r||t[2]!==n||t[3]!==a){let e=Bt(n,r);o=a(Ht(e));let f;t[10]===r?f=t[11]:(f=typeof r==`string`?r.trim():``,t[10]=r,t[11]=f),s=f,c=Ut(e)&&!!s&&s!==o,t[12]===i?d=t[13]:(d=H(`space-y-1`,i),t[12]=i,t[13]=d),l=`typography-ui-label text-[var(--status-error)]`,u=a(Vt(e)),t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9];let f;t[14]!==l||t[15]!==u?(f=(0,Z.jsx)(`p`,{className:l,children:u}),t[14]=l,t[15]=u,t[16]=f):f=t[16];let p;t[17]===o?p=t[18]:(p=(0,Z.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:o}),t[17]=o,t[18]=p);let m;t[19]!==s||t[20]!==c?(m=c?(0,Z.jsx)(`p`,{className:`typography-meta break-words text-muted-foreground`,children:s}):null,t[19]=s,t[20]=c,t[21]=m):m=t[21];let h;return t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,Z.jsxs)(`div`,{className:d,children:[f,p,m]}),t[22]=d,t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}var Q=e(E(),1),Kt=[.2,.45,.15,.55,.35,.1,.5,.25,.4,.3,.45,.15,.55,.2,.35,.1],qt=[.3,.15,.45,.25,.5,.35,.1,.4,.2,.55,.3,.15,.45,.25,.4,.2],Jt=(e,t,n,r,i=4)=>{let a=[];for(let o=0;o<i;o++)for(let s=0;s<i;s++){let c=s/i,l=(s+1)/i,u=o/i,d=(o+1)/i,f=(e,t,n)=>e+(t-e)*n,p=(e,t,n,r,i,a)=>{let o=f(e,t,i),s=f(r,n,i);return f(o,s,a)},m={x:p(e.x,t.x,n.x,r.x,c,u),y:p(e.y,t.y,n.y,r.y,c,u)},h={x:p(e.x,t.x,n.x,r.x,l,u),y:p(e.y,t.y,n.y,r.y,l,u)},g={x:p(e.x,t.x,n.x,r.x,l,d),y:p(e.y,t.y,n.y,r.y,l,d)},_={x:p(e.x,t.x,n.x,r.x,c,d),y:p(e.y,t.y,n.y,r.y,c,d)};a.push({path:`M${m.x} ${m.y} L${h.x} ${h.y} L${g.x} ${g.y} L${_.x} ${_.y} Z`,row:o,col:s})}return a},Yt=({className:e=``,width:t=70,height:n=70,isAnimated:r=!1})=>{let{t:i}=ue(),a=He(),o=!0;a?o=a.currentTheme.metadata.variant!==`light`:typeof window<`u`&&(o=window.matchMedia(`(prefers-color-scheme: dark)`).matches);let s=(0,Q.useMemo)(()=>{if(a)return a.currentTheme.colors.surface.foreground;if(typeof window<`u`){let e=getComputedStyle(document.documentElement).getPropertyValue(`--splash-stroke`).trim();if(e)return e}return o?`white`:`black`},[a,o]),c=(0,Q.useMemo)(()=>typeof window>`u`||typeof CSS>`u`||typeof CSS.supports!=`function`?!1:CSS.supports(`color`,`color-mix(in srgb, white 50%, transparent)`),[]),l=(0,Q.useMemo)(()=>{if(a)return c?`color-mix(in srgb, ${s} 15%, transparent)`:o?`rgba(255,255,255,0.15)`:`rgba(0,0,0,0.15)`;if(typeof window<`u`){let e=getComputedStyle(document.documentElement).getPropertyValue(`--splash-face-fill`).trim();if(e)return e}return o?`rgba(255,255,255,0.15)`:`rgba(0,0,0,0.15)`},[a,c,s,o]),u=(0,Q.useMemo)(()=>{if(a)return c?`color-mix(in srgb, ${s} 35%, transparent)`:o?`rgba(255,255,255,0.35)`:`rgba(0,0,0,0.4)`;if(typeof window<`u`){let e=getComputedStyle(document.documentElement).getPropertyValue(`--splash-cell-fill`).trim();if(e)return e}return o?`rgba(255,255,255,0.35)`:`rgba(0,0,0,0.4)`},[a,c,s,o]),d=s,f=.866,p=.5,m={x:50,y:2},h={x:50-48*f,y:50-48*p},g={x:91.568,y:50-48*p},_={x:50,y:50},v={x:50-48*f,y:74},y={x:91.568,y:74},b={x:50,y:98},x=`matrix(0.866, 0.5, -0.866, 0.5, 50, ${(m.y+h.y+_.y+g.y)/4})`,S=Jt(h,_,b,v),C=Jt(_,g,y,b);return(0,Z.jsxs)(`svg`,{width:t,height:n,viewBox:`0 0 100 100`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:e,role:`img`,"aria-label":i(`openChamberLogo.aria.logo`),children:[r?(0,Z.jsx)(`style`,{children:`@keyframes oc-logo-glow{0%,100%{filter:drop-shadow(0 0 0 transparent)}50%{filter:drop-shadow(0 0 4px var(--oc-glow-color))}}.oc-logo-glow{animation:oc-logo-glow 1.8s ease-in-out infinite}@media (prefers-reduced-motion:reduce){.oc-logo-glow{animation:none}}`}):null,(0,Z.jsx)(`path`,{d:`M${_.x} ${_.y} L${h.x} ${h.y} L${v.x} ${v.y} L${b.x} ${b.y} Z`,fill:l,stroke:s,strokeWidth:`2`,strokeLinejoin:`round`}),S.map((e,t)=>(0,Z.jsx)(`path`,{d:e.path,fill:u,opacity:Kt[e.row*4+(3-e.col)]??.35},`left-${t}`)),(0,Z.jsx)(`path`,{d:`M${_.x} ${_.y} L${g.x} ${g.y} L${y.x} ${y.y} L${b.x} ${b.y} Z`,fill:l,stroke:s,strokeWidth:`2`,strokeLinejoin:`round`}),C.map((e,t)=>(0,Z.jsx)(`path`,{d:e.path,fill:u,opacity:qt[e.row*4+e.col]??.35},`right-${t}`)),(0,Z.jsx)(`path`,{d:`M${m.x} ${m.y} L${h.x} ${h.y} L${_.x} ${_.y} L${g.x} ${g.y} Z`,fill:`none`,stroke:s,strokeWidth:`2`,strokeLinejoin:`round`}),(0,Z.jsx)(`g`,{opacity:1,className:r?`oc-logo-glow`:void 0,style:r?{"--oc-glow-color":s}:void 0,children:(0,Z.jsxs)(`g`,{transform:`${x} scale(0.75)`,children:[(0,Z.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M-16 -20 L16 -20 L16 20 L-16 20 Z M-8 -12 L-8 12 L8 12 L8 -12 Z`,fill:d}),(0,Z.jsx)(`path`,{d:`M-8 -4 L8 -4 L8 12 L-8 12 Z`,fill:d,fillOpacity:`0.4`})]})})]})},Xt=`/auth/passkey/authenticate/options`,Zt=`/auth/passkey/authenticate/verify`,Qt=`/auth/passkey/register/options`,$t=`/auth/passkey/register/verify`,en=`/api/passkeys`,tn=`/auth/passkey/status`,nn=`/api/auth/reset`,rn={enabled:!1,hasPasskeys:!1,passkeyCount:0,rpID:null},an=async(e,t)=>r(e,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),on=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim())return t.error}catch{}return t},sn=e=>e instanceof Ee&&e.code===`ERROR_CEREMONY_ABORTED`,cn=()=>{Oe.cancelCeremony()},ln=()=>typeof window>`u`?{supported:!1,reason:`Passkeys are unavailable outside the browser.`}:window.isSecureContext?{supported:!0,reason:``}:{supported:!1,reason:`Passkeys require HTTPS or localhost.`},un=async()=>{let e=ln();if(!e.supported)throw Error(e.reason);let t=await an(Qt,{label:typeof navigator.userAgent==`string`&&navigator.userAgent.trim()?navigator.userAgent:`This device`});if(!t.ok)throw Error(await on(t,`Could not start passkey setup.`));let{requestId:n,optionsJSON:r}=await t.json(),i=await an($t,{requestId:n,response:await De({optionsJSON:r})});if(!i.ok)throw Error(await on(i,`Could not finish passkey setup.`));return i.json().catch(()=>null)},dn=async(e,t={})=>{let n=ln();if(!n.supported)throw Error(n.reason);let r=await an(Xt);if(!r.ok)throw Error(await on(r,`Passkey sign-in is not available right now.`));let{requestId:i,optionsJSON:a}=await r.json(),o=await an(Zt,{requestId:i,response:await ke({optionsJSON:a}),trustDevice:e,issueClientToken:t.issueClientToken===!0,clientLabel:t.clientLabel,clientKind:t.clientKind,dedupeKey:t.dedupeKey});if(!o.ok)throw Error(await on(o,`Passkey sign-in failed.`));return o.json().catch(()=>null)},fn=async()=>{let e=await r(tn,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return rn;let t=await e.json().catch(()=>null);return{enabled:t?.enabled===!0,hasPasskeys:t?.hasPasskeys===!0,passkeyCount:typeof t?.passkeyCount==`number`?t.passkeyCount:0,rpID:typeof t?.rpID==`string`&&t.rpID?t.rpID:null}},pn=async()=>{let e=await r(en,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)throw Error(await on(e,`Could not load passkeys.`));let t=await e.json().catch(()=>null);return Array.isArray(t?.passkeys)?t.passkeys:[]},mn=async e=>{let t=await r(`${en}/${encodeURIComponent(e)}`,{method:`DELETE`,credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok)throw Error(await on(t,`Could not remove passkey.`));return t.json().catch(()=>null)},hn=async()=>{let e=await an(nn);if(!e.ok)throw Error(await on(e,`Could not clear saved authentication.`));try{let{clearAssistantAttachmentCacheAll:e}=await A(async()=>{let{clearAssistantAttachmentCacheAll:e}=await import(`./assistant-attachment-cache-C0aRnFkj.js`).then(e=>e.t);return{clearAssistantAttachmentCacheAll:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])),{invalidateRuntimeAuthSession:t}=await A(async()=>{let{invalidateRuntimeAuthSession:e}=await import(`./runtime-auth-D66yq6ie.js`).then(e=>e.m);return{invalidateRuntimeAuthSession:e}},__vite__mapDeps([2,1]));await e(`auth-reset`),t()}catch{}return e.json().catch(()=>null)};function gn(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _n(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vn(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`leading-none font-semibold`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yn(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`px-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var bn=class extends Q.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t,copied:!1}),console.error(`Error caught by boundary:`,e,t)}handleReset=()=>{this.setState({hasError:!1,error:void 0,errorInfo:void 0})};handleCopy=async()=>{let{strings:e}=this.props,t=`${this.state.error?String(this.state.error):e.unknownError}${this.state.error?.stack?`\n\nStack:\n${this.state.error.stack}`:``}${this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``}`;(await le(t)).ok&&(this.setState({copied:!0}),window.setTimeout(()=>{this.setState(e=>e.copied?{copied:!1}:null)},1500))};render(){let{strings:e}=this.props;return this.state.hasError?this.props.fallback?this.props.fallback:(0,Z.jsx)(`div`,{className:`p-4 flex items-center justify-center min-h-screen`,children:(0,Z.jsxs)(gn,{className:`w-full max-w-md`,children:[(0,Z.jsx)(_n,{className:`text-center`,children:(0,Z.jsxs)(vn,{className:`flex items-center justify-center gap-2 text-destructive`,children:[(0,Z.jsx)(G,{name:`error-warning`,className:`h-5 w-5`}),e.title]})}),(0,Z.jsxs)(yn,{className:`space-y-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground text-center`,children:e.description}),this.state.error&&(0,Z.jsxs)(`details`,{className:`text-xs font-mono bg-muted p-3 rounded`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer hover:bg-interactive-hover/80`,children:e.detailsSummary}),(0,Z.jsxs)(`pre`,{className:`mt-2 max-h-48 overflow-auto`,children:[this.state.error.toString(),this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``]})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(fe,{onClick:this.handleReset,variant:`outline`,className:`flex-1`,children:[(0,Z.jsx)(G,{name:`restart`,className:`h-4 w-4 mr-2`}),e.tryAgain]}),(0,Z.jsx)(fe,{onClick:this.handleCopy,variant:`outline`,className:`flex-1`,children:this.state.copied?e.copied:e.copy})]})]})]})}):this.props.children}},xn=e=>{let t=(0,K.c)(29),{children:n,fallback:r}=e,{t:i}=ue(),a;t[0]===i?a=t[1]:(a=i(`errorBoundary.state.unknownError`),t[0]=i,t[1]=a);let o;t[2]===i?o=t[3]:(o=i(`errorBoundary.title`),t[2]=i,t[3]=o);let s;t[4]===i?s=t[5]:(s=i(`errorBoundary.description`),t[4]=i,t[5]=s);let c;t[6]===i?c=t[7]:(c=i(`errorBoundary.actions.errorDetails`),t[6]=i,t[7]=c);let l;t[8]===i?l=t[9]:(l=i(`errorBoundary.state.componentStackLabel`),t[8]=i,t[9]=l);let u;t[10]===i?u=t[11]:(u=i(`errorBoundary.actions.tryAgain`),t[10]=i,t[11]=u);let d;t[12]===i?d=t[13]:(d=i(`errorBoundary.actions.copied`),t[12]=i,t[13]=d);let f;t[14]===i?f=t[15]:(f=i(`errorBoundary.actions.copy`),t[14]=i,t[15]=f);let p;t[16]!==a||t[17]!==o||t[18]!==s||t[19]!==c||t[20]!==l||t[21]!==u||t[22]!==d||t[23]!==f?(p={unknownError:a,title:o,description:s,detailsSummary:c,componentStackLabel:l,tryAgain:u,copied:d,copy:f},t[16]=a,t[17]=o,t[18]=s,t[19]=c,t[20]=l,t[21]=u,t[22]=d,t[23]=f,t[24]=p):p=t[24];let m=p,h;return t[25]!==n||t[26]!==r||t[27]!==m?(h=(0,Z.jsx)(bn,{fallback:r,strings:m,children:n}),t[25]=n,t[26]=r,t[27]=m,t[28]=h):h=t[28],h},Sn=`__unassigned__`,Cn={mod:`mod`,shift:`shift`,alt:`alt`,option:`alt`,ctrl:`ctrl`,meta:`mod`,cmd:`mod`,command:`mod`},wn={mod:de()&&o()?`⌘`:`Ctrl`,shift:`⇧`,alt:`⌥`,option:`⌥`,ctrl:`⌃`},Tn={comma:`,`,period:`.`,enter:`Enter`,escape:`Esc`,tab:`Tab`,space:`Space`,backspace:`⌫`,delete:`⌦`,arrowup:`↑`,arrowdown:`↓`,arrowleft:`←`,arrowright:`→`,home:`Home`,end:`End`,pageup:`Page Up`,pagedown:`Page Down`,backtick:"`",grave:"`","=":`=`,equal:`=`,plus:`+`,minus:`-`,"-":`-`},En=[`mod`,`ctrl`,`shift`,`alt`],Dn={"{":`[`,"}":`]`,":":`;`,'"':`'`,"<":`,`,">":`.`,"?":`/`,"|":`\\`,"~":"`","!":`1`,"@":`2`,"#":`3`,$:`4`,"%":`5`,"^":`6`,"&":`7`,"*":`8`,"(":`9`,")":`0`};function On(e){return e.trim().toLowerCase()===Sn}function kn(e){let t=e.toLowerCase();return t===`,`?`comma`:t===`.`?`period`:t===` `?`space`:t===`esc`?`escape`:t===`+`?`plus`:t===`-`||t===`_`?`minus`:t===`arrowup`?`arrowup`:t===`arrowdown`?`arrowdown`:t===`arrowleft`?`arrowleft`:t===`arrowright`?`arrowright`:t==="`"?`backtick`:Dn[t]??t}var An=[{id:`open_go_to_line`,defaultCombo:`alt+g`,label:`Go to line (files editor)`,description:`Open go to line in the files editor`,customizable:!0},{id:`open_command_palette`,defaultCombo:`mod+p`,label:`Open command palette`,description:`Open the command palette`,customizable:!0},{id:`focus_input`,defaultCombo:`mod+i`,label:`Focus input`,description:`Focus the chat input field`,customizable:!0},{id:`open_status`,defaultCombo:`mod+shift+o`,label:`Open OpenCode status`,description:`Open the OpenCode status dialog`},{id:`open_settings`,defaultCombo:`mod+comma`,label:`Open settings`,description:`Open the settings panel`,customizable:!0},{id:`toggle_terminal`,defaultCombo:`ctrl+backtick`,label:`Toggle terminal`,description:`Toggle the integrated terminal`,customizable:!0},{id:`toggle_bottom_panel`,defaultCombo:`mod+j`,label:`Toggle bottom panel`,description:`Toggle the bottom panel dock`,customizable:!0},{id:`toggle_terminal_expanded`,defaultCombo:`mod+shift+j`,label:`Toggle terminal expanded`,description:`Toggle terminal expanded or collapsed`,customizable:!0},{id:`new_terminal_tab`,defaultCombo:`mod+t`,label:`New terminal tab`,description:`Create a new terminal tab when the terminal is focused`,customizable:!0},{id:`open_new_terminal`,defaultCombo:`mod+shift+backtick`,label:`Open new terminal`,description:`Open the terminal panel and create a new terminal tab`,customizable:!0},{id:`previous_terminal_tab`,defaultCombo:`mod+shift+[`,label:`Previous terminal tab`,description:`Switch to the previous terminal tab when the terminal is focused`,customizable:!0},{id:`next_terminal_tab`,defaultCombo:`mod+shift+]`,label:`Next terminal tab`,description:`Switch to the next terminal tab when the terminal is focused`,customizable:!0},{id:`toggle_files`,defaultCombo:`mod+shift+f`,label:`Toggle files`,description:`Toggle the files panel`},{id:`toggle_sidebar`,defaultCombo:`mod+b`,label:`Toggle sidebar`,description:`Toggle the session sidebar`,customizable:!0},{id:`open_timeline_dialog`,defaultCombo:`mod+t`,label:`Open conversation timeline`,description:`Search and navigate within current conversation`,customizable:!0},{id:`toggle_prompt_navigator`,defaultCombo:`mod+alt+p`,label:`Toggle prompt navigator`,description:`Show or hide the prompt navigator panel in chat`,customizable:!0},{id:`toggle_right_sidebar`,defaultCombo:`mod+alt+b`,defaultAliases:[`mod+\\`],label:`Toggle review panel`,description:`Toggle the review panel (right sidebar)`,customizable:!0},{id:`open_right_sidebar_git`,defaultCombo:`mod+shift+g`,label:`Open right sidebar Git tab`,description:`Open right sidebar and select Git`,customizable:!0},{id:`open_right_sidebar_files`,defaultCombo:`mod+shift+f`,label:`Open right sidebar Files tab`,description:`Open right sidebar and select Files`,customizable:!0},{id:`cycle_right_sidebar_tab`,defaultCombo:`mod+alt+shift+r`,label:`Cycle right sidebar tab`,description:`Cycle through right sidebar tabs`,customizable:!0},{id:`close_context_panel_tab`,defaultCombo:`mod+w`,label:`Close context panel tab`,description:`Close the active context panel tab (closes the panel when empty)`,customizable:!0},{id:`previous_session`,defaultCombo:`mod+shift+[`,defaultAliases:[`mod+arrowup`],label:`Previous session`,description:`Switch to the previous session`,customizable:!0},{id:`next_session`,defaultCombo:`mod+shift+]`,defaultAliases:[`mod+arrowdown`],label:`Next session`,description:`Switch to the next session`,customizable:!0},{id:`new_chat`,defaultCombo:`mod+n`,label:`New session`,description:`Start a new session`,customizable:!0},{id:`new_chat_worktree`,defaultCombo:`mod+shift+alt+n`,label:`New worktree draft`,description:`Create a new worktree and open a draft in it`,customizable:!0},{id:`new_mini_chat`,defaultCombo:`mod+alt+n`,label:`New Mini Chat window`,description:`Open a new Mini Chat draft window`,customizable:!0},{id:`submit_message`,defaultCombo:`mod+enter`,label:`Submit message`,description:`Submit the current message`},{id:`clear_input`,defaultCombo:`escape`,label:`Clear input`,description:`Clear the input field`},{id:`clear_all_messages`,defaultCombo:`ctrl+c`,label:`Clear all messages`,description:`Clear the composer input and queued messages`,customizable:!0},{id:`open_diff_panel`,defaultCombo:`mod+2`,label:`Open diff panel`,description:`Switch to the diff panel`},{id:`open_terminal_panel`,defaultCombo:`mod+3`,label:`Open terminal panel`,description:`Switch to the terminal panel`},{id:`open_git_panel`,defaultCombo:`mod+4`,label:`Open git panel`,description:`Switch to the git panel`},{id:`open_help`,defaultCombo:`mod+.`,label:`Open keyboard shortcuts`,description:`Show the keyboard shortcuts help`,customizable:!0},{id:`toggle_services_menu`,defaultCombo:`mod+shift+s`,label:`Toggle services menu`,description:`Open or close the services menu`,customizable:!0},{id:`open_usage`,defaultCombo:`mod+shift+c`,label:`Open usage`,description:`Open the usage panel`,customizable:!0},{id:`cycle_services_tab`,defaultCombo:`mod+alt+shift+s`,label:`Cycle services tab`,description:`Cycle through tabs in the services menu`,customizable:!0},{id:`cycle_theme`,defaultCombo:`mod+/`,label:`Cycle theme`,description:`Cycle between light, dark, and system theme`,customizable:!0},{id:`zoom_in`,defaultCombo:`mod+=`,label:`Zoom in`,description:`Increase the webview zoom level`,customizable:!0},{id:`zoom_out`,defaultCombo:`mod+-`,label:`Zoom out`,description:`Decrease the webview zoom level`,customizable:!0},{id:`zoom_reset`,defaultCombo:`mod+0`,label:`Reset zoom`,description:`Reset the webview zoom level to 100%`,customizable:!0},{id:`leader_key`,defaultCombo:`ctrl+x`,label:`Leader key`,description:`Start an OpenCode-style chord, then press M / A / N / C`,customizable:!0},{id:`open_model_selector`,defaultCombo:`mod+shift+m`,label:`Open model selector`,description:`Open model selector while in chat`,customizable:!0},{id:`cycle_thinking_variant`,defaultCombo:`mod+shift+t`,label:`Cycle thinking variant`,description:`Cycle thinking variant while in chat`},{id:`cycle_agent`,defaultCombo:`tab`,label:`Cycle agent`,description:`Cycle agent while the model selector is open`,customizable:!0},{id:`cycle_favorite_model_forward`,defaultCombo:`ctrl+]`,label:`Cycle favorite model forward`,description:`Cycle forward through starred models without opening the picker`,customizable:!0},{id:`cycle_favorite_model_backward`,defaultCombo:`ctrl+[`,label:`Cycle favorite model backward`,description:`Cycle backward through starred models without opening the picker`,customizable:!0},{id:`expand_input`,defaultCombo:`mod+shift+e`,label:`Expand input`,description:`Toggle focus mode for the chat input`,customizable:!0},{id:`toggle_dictation`,defaultCombo:`mod+alt+v`,label:`Voice input`,description:`Start dictation; press again to confirm and insert the transcript`,customizable:!0},{id:`abort_run`,defaultCombo:`escape`,label:`Abort active run`,description:`Abort the currently running task (double press)`},{id:`switch_tab_1`,defaultCombo:`mod+1`,label:`Switch to visible session 1`,description:`Switch to the first visible sidebar session`},{id:`switch_tab_2`,defaultCombo:`mod+2`,label:`Switch to visible session 2`,description:`Switch to the second visible sidebar session`},{id:`switch_tab_3`,defaultCombo:`mod+3`,label:`Switch to visible session 3`,description:`Switch to the third visible sidebar session`},{id:`switch_tab_4`,defaultCombo:`mod+4`,label:`Switch to visible session 4`,description:`Switch to the fourth visible sidebar session`},{id:`switch_tab_5`,defaultCombo:`mod+5`,label:`Switch to visible session 5`,description:`Switch to the fifth visible sidebar session`},{id:`switch_tab_6`,defaultCombo:`mod+6`,label:`Switch to visible session 6`,description:`Switch to the sixth visible sidebar session`},{id:`switch_tab_7`,defaultCombo:`mod+7`,label:`Switch to visible session 7`,description:`Switch to the seventh visible sidebar session`},{id:`switch_tab_8`,defaultCombo:`mod+8`,label:`Switch to visible session 8`,description:`Switch to the eighth visible sidebar session`},{id:`switch_tab_9`,defaultCombo:`mod+9`,label:`Switch to visible session 9`,description:`Switch to the ninth visible sidebar session`}];function jn(e){if(On(e))return Sn;let t=e.toLowerCase().trim().split(`+`).map(e=>e.trim()).filter(Boolean),n=new Set,r=``;for(let e of t){let t=e===`,`?`comma`:e===`.`?`period`:e,i=Cn[t];if(i){n.add(i);continue}r=t}return[...En.filter(e=>n.has(e)),r].filter(Boolean).join(`+`)}function Mn(e){return On(e)?!0:Nn(e).key.trim().length>0}function Nn(e){if(On(e))return{modifiers:new Set,key:Sn};let t=jn(e).split(`+`),n=new Set,r=``;for(let e of t){let t=Cn[e];t?n.add(t):r=e}return{modifiers:n,key:r}}function Pn(e){if(On(e))return`Unassigned`;let t=Nn(e);if(!t.key&&t.modifiers.size===0)return`Unassigned`;let n=[];for(let e of En)t.modifiers.has(e)&&n.push(wn[e]);if(t.key){let e=Tn[t.key.toLowerCase()]||t.key.toUpperCase();n.push(e)}return n.join(` + `)}function Fn(e){return An.find(t=>t.id===e)}function In(){return An.filter(e=>e.customizable===!0)}function Ln(e,t){let n=Fn(e);if(!n)return``;let r=t?.[e];if(typeof r==`string`){if(r.trim().toLowerCase()===`__unassigned__`)return``;let e=jn(r);if(e===`__unassigned__`)return Sn;if(Mn(e))return e}return n.defaultCombo}function Rn(e,t){let n=Fn(e);if(!n)return[];let r=Ln(e,t);return r===n.defaultCombo?[n.defaultCombo,...n.defaultAliases??[]]:r?[r]:[]}function zn(e){if(On(e))return!1;let t=Nn(e);if(!t.modifiers.has(`mod`))return!1;let n=t.key.toLowerCase();return new Set([`w`,`t`,`r`,`p`,`s`,`f`,`l`,`n`]).has(n)&&!t.modifiers.has(`shift`)&&!t.modifiers.has(`alt`)}function Bn(e,t){let n=typeof t==`string`?t:t.defaultCombo;if(On(n))return!1;let r=Nn(n),i=r.modifiers.has(`mod`),a=r.modifiers.has(`shift`),s=r.modifiers.has(`alt`),c=r.modifiers.has(`ctrl`),l=de()&&o(),u=de(),d=l?e.metaKey:u&&e.metaKey||e.ctrlKey;if(i&&!d||!i&&e.metaKey||a!==e.shiftKey||s!==e.altKey)return!1;if(c){if(!e.ctrlKey)return!1}else{let t=i&&!l&&e.ctrlKey;if(e.ctrlKey&&!t)return!1}let f=e.key;return(!f||f===`Dead`)&&e.code===`Backquote`&&(f="`"),e.altKey&&(e.code.startsWith(`Key`)&&e.code.length===4?f=e.code.slice(3).toLowerCase():e.code.startsWith(`Digit`)&&e.code.length===6&&(f=e.code.slice(5))),kn(f)===kn(r.key)}function Vn(){return de()&&o()?`⌘`:`Ctrl`}function Hn(e,t,n){if(Bn(e,n))return!0;let r=jn(n),i=de()&&o(),a=de();return!(i?e.metaKey:a&&e.metaKey||e.ctrlKey)||e.altKey||i&&e.ctrlKey&&!e.metaKey?!1:t===`in`&&r===`mod+=`?e.key===`+`||e.code===`NumpadAdd`:t===`out`&&(r===`mod+-`||r===`mod+minus`)?e.key===`_`||e.code===`NumpadSubtract`:!1}var Un=Q.createContext(null),Wn=e=>e?e.closest(`[data-slot="dialog-content"], [role="dialog"]`):null;function Gn(e,t){return e&&Q.isValidElement(t)?{render:t}:{children:t}}function Kn(e){let t=(0,K.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let[r,i]=Q.useState(null),a;t[2]===r?a=t[3]:(a={portalContainer:r,setPortalContainer:i},t[2]=r,t[3]=a);let o=a,s;t[4]===n?s=t[5]:(s=(0,Z.jsx)(w,{...n}),t[4]=n,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsx)(Un.Provider,{value:o,children:s}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function qn(e){let t=(0,K.c)(22),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:n,children:r,onPointerDownCapture:a,onFocusCapture:i,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=Q.useContext(Un),c;t[6]===s?c=t[7]:(c=e=>{if(!s)return;let t=e instanceof HTMLElement?e:null;s.setPortalContainer(Wn(t))},t[6]=s,t[7]=c);let l=c,u;t[8]!==n||t[9]!==r?(u=Gn(n,r),t[8]=n,t[9]=r,t[10]=u):u=t[10];let d=u,f;t[11]!==a||t[12]!==l?(f=e=>{l(e.currentTarget),a?.(e)},t[11]=a,t[12]=l,t[13]=f):f=t[13];let p;t[14]!==i||t[15]!==l?(p=e=>{l(e.currentTarget),i?.(e)},t[14]=i,t[15]=l,t[16]=p):p=t[16];let m;return t[17]!==o||t[18]!==d||t[19]!==f||t[20]!==p?(m=(0,Z.jsx)(g,{"data-slot":`dropdown-menu-trigger`,onPointerDownCapture:f,onFocusCapture:p,...o,...d}),t[17]=o,t[18]=d,t[19]=f,t[20]=p,t[21]=m):m=t[21],m}function Jn(e){let t=(0,K.c)(40),n,r,i,a,o,s,c,l,u,d,f,p,m;if(t[0]!==e){let{className:h,sideOffset:g,align:_,side:v,alignOffset:y,anchor:b,portalToBody:x,positionerClassName:S,style:C,children:w,onCloseAutoFocus:T,collisionPadding:E,collisionAvoidance:D,...O}=e;o=h,d=g,n=_,l=v,r=y,i=b,f=x,s=S,u=C,a=w,p=E,m=D,c=O,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13];let h=d===void 0?4:d,g=f!==void 0&&f,_=p===void 0?8:p,y;t[14]===m?y=t[15]:(y=m===void 0?{side:`shift`,align:`shift`}:m,t[14]=m,t[15]=y);let b=y,C=Q.useContext(Un),w=g?void 0:C?.portalContainer||void 0,T;t[16]===s?T=t[17]:(T=H(`app-region-no-drag z-50`,s),t[16]=s,t[17]=T);let E;t[18]===u?E=t[19]:(E={backgroundColor:`var(--surface-elevated)`,color:`var(--surface-elevated-foreground)`,...u},t[18]=u,t[19]=E);let D;t[20]===o?D=t[21]:(D=H(We,o),t[20]=o,t[21]=D);let O;t[22]!==a||t[23]!==c||t[24]!==E||t[25]!==D?(O=(0,Z.jsx)(v,{"data-slot":`dropdown-menu-content`,style:E,className:D,...c,children:a}),t[22]=a,t[23]=c,t[24]=E,t[25]=D,t[26]=O):O=t[26];let k;t[27]!==n||t[28]!==r||t[29]!==i||t[30]!==b||t[31]!==_||t[32]!==l||t[33]!==h||t[34]!==O||t[35]!==T?(k=(0,Z.jsx)(x,{anchor:i,sideOffset:h,align:n,side:l,alignOffset:r,collisionPadding:_,collisionAvoidance:b,className:T,children:O}),t[27]=n,t[28]=r,t[29]=i,t[30]=b,t[31]=_,t[32]=l,t[33]=h,t[34]=O,t[35]=T,t[36]=k):k=t[36];let A;return t[37]!==k||t[38]!==w?(A=(0,Z.jsx)(S,{container:w,children:k}),t[37]=k,t[38]=w,t[39]=A):A=t[39],A}function Yn(e){let t=(0,K.c)(24),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:i,inset:a,variant:l,asChild:n,children:r,onSelect:s,onClick:o,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=l===void 0?`default`:l,d;t[9]!==n||t[10]!==r?(d=Gn(n,r),t[9]=n,t[10]=r,t[11]=d):d=t[11];let f=d,p;t[12]!==o||t[13]!==s?(p=e=>{o?.(e),e.defaultPrevented||s?.(e)},t[12]=o,t[13]=s,t[14]=p):p=t[14];let m=p,h;t[15]===i?h=t[16]:(h=H(Ke,i),t[15]=i,t[16]=h);let g;return t[17]!==m||t[18]!==a||t[19]!==c||t[20]!==f||t[21]!==h||t[22]!==u?(g=(0,Z.jsx)(y,{"data-slot":`dropdown-menu-item`,"data-inset":a,"data-variant":u,className:h,...c,onClick:m,...f}),t[17]=m,t[18]=a,t[19]=c,t[20]=f,t[21]=h,t[22]=u,t[23]=g):g=t[23],g}function Xn(e){let t=(0,K.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(b,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function Zn(e){let t=(0,K.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=H(`data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover data-[checked]:bg-interactive-selection data-[checked]:text-interactive-selection-foreground relative flex cursor-pointer items-start gap-2 rounded-lg py-1 pl-2 pr-8 typography-ui-label outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-3.5 items-center justify-center text-primary`,children:(0,Z.jsx)(h,{children:(0,Z.jsx)(G,{name:`check`,className:`size-3`})})}),t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==i||t[9]!==a?(s=(0,Z.jsxs)(C,{"data-slot":`dropdown-menu-radio-item`,className:a,...i,children:[o,n]}),t[7]=n,t[8]=i,t[9]=a,t[10]=s):s=t[10],s}function Qn(e){let t=(0,K.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=H(`px-2 py-1 typography-ui-label font-medium data-[inset]:pl-8`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(`div`,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function $n(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(Ge,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function er(){let e=(0,K.c)(5),t=U(ir),n=U(rr),r=U(nr),i=U(tr),a=t||i,o=!a&&r===`init_error`,s=!a&&!o,c;return e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==s?(c={isReady:a,isLoading:s,isUnavailable:o,connectionPhase:n},e[0]=n,e[1]=a,e[2]=o,e[3]=s,e[4]=c):c=e[4],c}function tr(e){return e.providers.length>0}function nr(e){return e.lastDisconnectReason}function rr(e){return e.connectionPhase}function ir(e){return e.isInitialized}var ar=e=>{let t=(0,K.c)(41),{agentName:n,onChange:r,className:i,filter:a,dropdownPortalToBody:o,showIcon:s,agents:c}=e,l=o!==void 0&&o,u=s===void 0||s,{t:d}=ue(),{isReady:f,isUnavailable:p}=er(),m=U(or),h=we(sr),g=U(cr),{data:_}=be(),v;t[0]===_?v=t[1]:(v=_===void 0?[]:_,t[0]=_,t[1]=v);let y=v,b;bb0:{if(c){b=c;break bb0}if(Array.isArray(m)&&m.length>0){b=m;break bb0}b=y}let x=b,S;if(t[2]!==a||t[3]!==x){let e=ge(x);S=a?e.filter(a):e,t[2]=a,t[3]=x,t[4]=S}else S=t[4];let C=S,w=k(lr),{isMobile:T}=Ue(),E=w||T,[D,O]=Q.useState(!1),A;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{O(!0),U.getState().refreshCatalogsOnPickerOpen({source:`agentSelector:mobilePanel`})},t[5]=A):A=t[5];let j=ce(A),M=ce(ur),ee=Q.useId(),te,N;t[6]!==c||t[7]!==h||t[8]!==g||t[9]!==x.length?(te=()=>{c||x.length>0||(g(),h())},N=[c,x.length,g,h],t[6]=c,t[7]=h,t[8]=g,t[9]=x.length,t[10]=te,t[11]=N):(te=t[10],N=t[11]),Q.useEffect(te,N);let ne;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(ne=()=>O(!1),t[12]=ne):ne=t[12];let P=ne,re;t[13]===r?re=t[14]:(re=e=>{r(e)},t[13]=r,t[14]=re);let F=re,ie;t[15]!==n||t[16]!==C||t[17]!==F||t[18]!==E||t[19]!==D||t[20]!==ee||t[21]!==d?(ie=()=>E?(0,Z.jsx)(ze,{id:`mobile-agent-selector-sheet-${ee}`,open:D,onOpenChange:e=>{e||P()},ariaLabel:d(`settings.commands.agentSelector.title`),closeAriaLabel:d(`mobile.surface.closeAria`),resizeAriaLabel:d(`mobile.sessions.sheet.resizeAria`),bodyClassName:`px-2`,children:(0,Z.jsxs)(qe,{useScrollShadow:!0,disableHorizontal:!0,preventOverscroll:!0,outerClassName:`min-h-0 flex-1`,className:`flex flex-col gap-1 overscroll-contain`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:H(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-x-2 rounded-lg border border-border/40 bg-background/95 px-2 py-1.5 text-left`,n?`text-foreground`:`bg-primary/10 text-primary`),onClick:()=>{F(``),P()},children:[(0,Z.jsx)(W,{name:`default`,size:16}),(0,Z.jsx)(`span`,{className:H(`min-w-0 typography-meta`,n?`text-muted-foreground`:`font-medium`),children:d(`settings.commands.agentSelector.notSelected`)}),!n&&(0,Z.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-primary`})]}),C.map(e=>{let t=e.name===n;return(0,Z.jsxs)(`button`,{type:`button`,className:H(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-start gap-x-2 rounded-lg border border-border/40 bg-background/95 px-2 py-1.5 text-left`,t?`bg-primary/10 text-primary`:`text-foreground`),onClick:()=>{F(e.name),P()},children:[(0,Z.jsx)(W,{name:e.name,size:16,className:`mt-1.5`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`typography-meta font-medium`,children:e.name}),e.description&&(0,Z.jsx)(`span`,{className:`mt-0.5 block whitespace-normal break-words typography-micro text-muted-foreground`,children:e.description})]}),t&&(0,Z.jsx)(`div`,{className:`mt-2 h-2 w-2 rounded-full bg-primary`})]},e.name)})]})}):null,t[15]=n,t[16]=C,t[17]=F,t[18]=E,t[19]=D,t[20]=ee,t[21]=d,t[22]=ie):ie=t[22];let I=ie,L;t[23]!==n||t[24]!==C||t[25]!==i||t[26]!==l||t[27]!==F||t[28]!==M||t[29]!==E||t[30]!==f||t[31]!==p||t[32]!==j||t[33]!==u||t[34]!==d?(L=E?(0,Z.jsxs)(`button`,{type:`button`,onClick:f?j:void 0,disabled:!f,className:H(`flex w-full items-center justify-between gap-2 rounded-lg border border-border/40 bg-background/95 px-2 py-1.5 text-left`,!f&&`opacity-60 cursor-not-allowed`,i),children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:f?(0,Z.jsxs)(Z.Fragment,{children:[u?(0,Z.jsx)(W,{name:n||`default`,size:14}):null,(0,Z.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:n||d(`settings.commands.agentSelector.selectAgentPlaceholder`)})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{name:`loader-4`,className:`h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:d(p?`common.unavailable`:`common.loading`)})]})}),(0,Z.jsx)(G,{name:`arrow-down-s`,className:`h-3 w-3 text-muted-foreground`})]}):f?(0,Z.jsxs)(Kn,{onOpenChange:M,children:[(0,Z.jsx)(qn,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:H(`flex items-center gap-2 px-2 rounded-lg bg-interactive-selection/20 border border-border/20 cursor-pointer hover:bg-interactive-hover/30 h-6 w-fit`,i),children:[u?(0,Z.jsx)(W,{name:n||`default`,size:14}):null,(0,Z.jsx)(`span`,{className:`typography-micro font-medium whitespace-nowrap`,children:n||d(`settings.commands.agentSelector.notSelected`)}),(0,Z.jsx)(G,{name:`arrow-down-s`,className:`h-3 w-3 flex-shrink-0 text-muted-foreground`})]})}),(0,Z.jsxs)(Jn,{className:`max-w-[300px]`,portalToBody:l,children:[(0,Z.jsxs)(Yn,{className:`typography-meta`,onSelect:()=>F(``),children:[(0,Z.jsx)(W,{name:`default`,size:14}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:d(`settings.commands.agentSelector.notSelected`)})]}),C.map(e=>(0,Z.jsxs)(Yn,{className:`typography-meta`,onSelect:()=>F(e.name),children:[(0,Z.jsx)(W,{name:e.name,size:14}),(0,Z.jsx)(`span`,{className:`font-medium`,children:e.name})]},e.name))]})]}):(0,Z.jsxs)(`div`,{className:H(`flex items-center gap-2 px-2 rounded-lg bg-interactive-selection/20 border border-border/20 h-6 w-fit opacity-60`,i),children:[(0,Z.jsx)(G,{name:`loader-4`,className:`h-3 w-3 animate-spin text-muted-foreground flex-shrink-0`}),(0,Z.jsx)(`span`,{className:`typography-micro font-medium whitespace-nowrap text-muted-foreground`,children:d(p?`common.unavailable`:`common.loading`)})]}),t[23]=n,t[24]=C,t[25]=i,t[26]=l,t[27]=F,t[28]=M,t[29]=E,t[30]=f,t[31]=p,t[32]=j,t[33]=u,t[34]=d,t[35]=L):L=t[35];let R;t[36]===I?R=t[37]:(R=I(),t[36]=I,t[37]=R);let ae;return t[38]!==L||t[39]!==R?(ae=(0,Z.jsxs)(Z.Fragment,{children:[L,R]}),t[38]=L,t[39]=R,t[40]=ae):ae=t[40],ae};function or(e){return e.agents}function sr(e){return e.loadAgents}function cr(e){return e.loadAgents}function lr(e){return e.isMobile}function ur(e){e&&U.getState().refreshCatalogsOnPickerOpen({source:`agentSelector:desktopMenu`})}var dr={compact:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1,minimumFractionDigits:0},compactTokensShort:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1},usd:{style:`currency`,currency:`USD`,maximumFractionDigits:4,minimumFractionDigits:2}},fr=null,pr={},mr=(e,t)=>{fr!==t&&(fr=t,pr.compact=void 0,pr.compactTokensShort=void 0,pr.usd=void 0);let n=pr[e];if(n)return n;let r=new Intl.NumberFormat(t,dr[e]);return pr[e]=r,r},hr=(e,t=V())=>mr(`compact`,t).format(e),gr=(e,t=V())=>mr(`compactTokensShort`,t).format(e),_r=(e,t=V())=>mr(`usd`,t).format(e),vr=(e,t=V())=>e.toLocaleDateString(t,{month:`short`,day:`numeric`,year:`numeric`}),yr=(e,t=V())=>new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`}),br=(e,t=V())=>new Date(e).toLocaleTimeString(t,{hour:`numeric`,minute:`2-digit`}),xr=8,Sr=e=>typeof e!=`number`||Number.isNaN(e)?``:gr(e),Cr=(e,t,n)=>{let r=e.find(e=>e.id===t)?.models?.find(e=>e.id===n);return r?.variants?Object.keys(r.variants):[]},wr=e=>{let t=(0,K.c)(54),{open:n,onClose:r,selectedProviderID:i,selectedModelID:a,resolveSelectedVariant:o,onSelect:s,providers:c,favoriteModels:l,recentModels:u,hiddenModels:d,allowedProviderIds:f,allowedModelIdsByProvider:p,providerOrder:m,variantSelectionEnabled:h,isFavorite:g,onToggleFavorite:_,getMetadata:v,view:y,onViewChange:b}=e,x;t[0]===d?x=t[1]:(x=d===void 0?[]:d,t[0]=d,t[1]=x);let S=x,C=h===void 0||h,{t:w}=ue(),T=Q.useId(),[E,D]=Q.useState(``),O;t[2]===i?O=t[3]:(O=()=>new Set(i?[i]:[]),t[2]=i,t[3]=O);let[k,A]=Q.useState(O),[j,M]=Q.useState(null),[ee,te]=Q.useState(`model`),[N,ne]=Q.useState(null),P=Q.useRef(!1),re=y??ee,F,ie;t[4]!==n||t[5]!==i?(F=()=>{n&&!P.current&&A(new Set(i?[i]:[])),n||(D(``),M(null),te(`model`),ne(null)),P.current=n},ie=[n,i],t[4]=n,t[5]=i,t[6]=F,t[7]=ie):(F=t[6],ie=t[7]),Q.useEffect(F,ie);let I;t[8]===b?I=t[9]:(I=e=>{te(e),b?.(e)},t[8]=b,t[9]=I);let L=I,R=re===`variant`&&!!(N??(i&&a)),ae=`mobile-model-picker-sheet-${T}`,z;t[10]===r?z=t[11]:(z=e=>{e||r()},t[10]=r,t[11]=z);let oe;t[12]!==R||t[13]!==L||t[14]!==w?(oe=R?(0,Z.jsx)(fe,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>L(`model`),"aria-label":w(`onboarding.common.actions.back`),children:(0,Z.jsx)(G,{name:`arrow-left`,className:`size-5`})}):void 0,t[12]=R,t[13]=L,t[14]=w,t[15]=oe):oe=t[15];let B;t[16]!==R||t[17]!==w?(B=w(R?`chat.modelControls.thinking`:`chat.modelControls.selectModel`),t[16]=R,t[17]=w,t[18]=B):B=t[18];let se;t[19]===w?se=t[20]:(se=w(`mobile.surface.closeAria`),t[19]=w,t[20]=se);let ce;t[21]===w?ce=t[22]:(ce=w(`mobile.sessions.sheet.resizeAria`),t[21]=w,t[22]=ce);let le;t[23]!==re||t[24]!==p||t[25]!==f||t[26]!==j||t[27]!==k||t[28]!==l||t[29]!==v||t[30]!==S||t[31]!==g||t[32]!==s||t[33]!==_||t[34]!==m||t[35]!==c||t[36]!==E||t[37]!==u||t[38]!==o||t[39]!==a||t[40]!==i||t[41]!==L||t[42]!==C||t[43]!==N?(le=(0,Z.jsx)(Tr,{query:E,onQueryChange:D,expandedProviders:k,onExpandedProvidersChange:A,expandedModelKey:j,onExpandedModelKeyChange:M,activeView:re,setView:L,variantTarget:N,onVariantTargetChange:ne,selectedProviderID:i,selectedModelID:a,resolveSelectedVariant:o,onSelect:s,providers:c,favoriteModels:l,recentModels:u,hiddenModels:S,allowedProviderIds:f,allowedModelIdsByProvider:p,providerOrder:m,variantSelectionEnabled:C,isFavorite:g,onToggleFavorite:_,getMetadata:v}),t[23]=re,t[24]=p,t[25]=f,t[26]=j,t[27]=k,t[28]=l,t[29]=v,t[30]=S,t[31]=g,t[32]=s,t[33]=_,t[34]=m,t[35]=c,t[36]=E,t[37]=u,t[38]=o,t[39]=a,t[40]=i,t[41]=L,t[42]=C,t[43]=N,t[44]=le):le=t[44];let de;return t[45]!==n||t[46]!==oe||t[47]!==B||t[48]!==se||t[49]!==ce||t[50]!==le||t[51]!==ae||t[52]!==z?(de=(0,Z.jsx)(ze,{id:ae,open:n,onOpenChange:z,leading:oe,ariaLabel:B,closeAriaLabel:se,resizeAriaLabel:ce,bodyClassName:`px-2`,children:le}),t[45]=n,t[46]=oe,t[47]=B,t[48]=se,t[49]=ce,t[50]=le,t[51]=ae,t[52]=z,t[53]=de):de=t[53],de},Tr=e=>{let t=(0,K.c)(117),{query:n,onQueryChange:r,expandedProviders:i,onExpandedProvidersChange:a,expandedModelKey:o,onExpandedModelKeyChange:s,activeView:c,setView:l,variantTarget:u,onVariantTargetChange:d,selectedProviderID:f,selectedModelID:p,resolveSelectedVariant:m,onSelect:h,providers:g,favoriteModels:_,recentModels:v,hiddenModels:y,allowedProviderIds:b,allowedModelIdsByProvider:x,providerOrder:S,variantSelectionEnabled:C,isFavorite:w,onToggleFavorite:T,getMetadata:E}=e,{t:D}=ue(),O;t[0]===b?O=t[1]:(O=b&&b.length>0?new Set(b):null,t[0]=b,t[1]=O);let k=O,A;t[2]===x?A=t[3]:(A=x?new Map(Object.entries(x).map(Er)):null,t[2]=x,t[3]=A);let j=A,M;t[4]===y?M=t[5]:(M=new Set(y.map(Dr)),t[4]=y,t[5]=M);let ee=M,te;t[6]===g?te=t[7]:(te=new Map(g.map(Or)),t[6]=g,t[7]=te);let N=te,ne;bb0:{if(!S?.length){ne=g;break bb0}let e;t[8]===S?e=t[9]:(e=new Map(S.map(kr)),t[8]=S,t[9]=e);let n=e,r;if(t[10]!==g||t[11]!==n){let e;t[13]===n?e=t[14]:(e=(e,t)=>{let r=n.get(e.id),i=n.get(t.id);return r===void 0&&i===void 0?0:r===void 0?1:i===void 0?-1:r-i},t[13]=n,t[14]=e),r=[...g].sort(e),t[10]=g,t[11]=n,t[12]=r}else r=t[12];ne=r}let P=ne,re;t[15]!==j||t[16]!==k||t[17]!==ee?(re=(e,t)=>k&&!k.has(e)||j&&j.get(e)?.has(t)!==!0?!1:!ee.has(`${e}:${t}`),t[15]=j,t[16]=k,t[17]=ee,t[18]=re):re=t[18];let F=re,ie;t[19]!==N||t[20]!==n?(ie=e=>{let t=n.trim();if(!t)return!0;let r=N.get(e.providerID)?.name||e.providerID,i=he(e.model,e.modelID,{maxLength:40});return je(i,t)||je(e.modelID,t)||je(r,t)},t[19]=N,t[20]=n,t[21]=ie):ie=t[21];let I=ie,L;if(t[22]!==_||t[23]!==F||t[24]!==I){let e;t[26]!==F||t[27]!==I?(e=e=>F(e.providerID,e.modelID)&&I(e),t[26]=F,t[27]=I,t[28]=e):e=t[28],L=_.filter(e),t[22]=_,t[23]=F,t[24]=I,t[25]=L}else L=t[25];let R=L,ae;if(t[29]!==F||t[30]!==I||t[31]!==v){let e;t[33]!==F||t[34]!==I?(e=e=>F(e.providerID,e.modelID)&&I(e),t[33]=F,t[34]=I,t[35]=e):e=t[35],ae=v.filter(e),t[29]=F,t[30]=I,t[31]=v,t[32]=ae}else ae=t[32];let z=ae,oe;if(t[36]!==k||t[37]!==F||t[38]!==P||t[39]!==n){let e=n.trim(),r;t[41]===k?r=t[42]:(r=e=>!k||k.has(e.id),t[41]=k,t[42]=r),oe=P.filter(r).map(t=>{let n=e.length>0&&(je(t.name||t.id,e)||je(t.id,e));return{provider:t,models:(t.models??[]).filter(r=>{let i=typeof r.id==`string`?r.id:``;return!i||!F(t.id,i)?!1:n||!e?!0:je(he(r,i,{maxLength:40}),e)||je(i,e)})}}).filter(Ar),t[36]=k,t[37]=F,t[38]=P,t[39]=n,t[40]=oe}else oe=t[40];let B=oe,se;t[43]===D?se=t[44]:(se=e=>{if(!e?.trim())return D(`chat.modelControls.default`);let t=e.trim();return/^\d+(\.\d+)?$/.test(t)?t:t.charAt(0).toUpperCase()+t.slice(1)},t[43]=D,t[44]=se);let ce=se,le;t[45]===D?le=t[46]:(le=e=>{let t=[];e?.tool_call&&t.push({key:`tool_call`,icon:`tools`,label:D(`chat.modelControls.capability.toolCalling`)}),e?.reasoning&&t.push({key:`reasoning`,icon:`brain-ai-3`,label:D(`chat.modelControls.capability.reasoning`)});let n={text:{icon:`text`,label:D(`chat.modelControls.modality.text`)},image:{icon:`file-image`,label:D(`chat.modelControls.modality.image`)},video:{icon:`file-video`,label:D(`chat.modelControls.modality.video`)},audio:{icon:`file-music`,label:D(`chat.modelControls.modality.audio`)},pdf:{icon:`file-pdf`,label:D(`chat.modelControls.modality.pdf`)}};for(let r of[...e?.modalities?.input??[],...e?.modalities?.output??[]]){let e=r.trim().toLowerCase(),i=n[e];i&&!t.some(t=>t.key===e)&&t.push({key:e,...i})}return t},t[45]=D,t[46]=le);let de=le,V;t[47]!==d||t[48]!==l?(V=(e,t,n)=>{d(n===void 0?{providerID:e,modelID:t}:{providerID:e,modelID:t,variant:n}),l(`variant`)},t[47]=d,t[48]=l,t[49]=V):V=t[49];let fe=V,pe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(pe={onPointerDown:Re,onClickCapture:jr},t[50]=pe):pe=t[50];let me=pe,ge;t[51]!==o||t[52]!==ce||t[53]!==E||t[54]!==de||t[55]!==w||t[56]!==s||t[57]!==h||t[58]!==T||t[59]!==fe||t[60]!==N||t[61]!==g||t[62]!==m||t[63]!==p||t[64]!==f||t[65]!==D||t[66]!==C?(ge=(e,t)=>{let n=t===void 0?{}:t,{model:r,providerID:i,modelID:a}=e,c=`${i}:${a}`,l=i===f&&a===p,u=Be(i,r,E?.(i,a)),d=C?Cr(g,i,a):[],_=m(i,a),v=n.preferRememberedVariant&&e.variant!==void 0&&d.includes(e.variant)?e.variant:void 0,y=v===void 0?_:v,b=l||v===void 0?_:v,x=[void 0,...d].slice(0,xr),S=o===c,O=de(u),k=u?.limit?.context?`${Sr(u.limit.context)} ctx`:null;return(0,Z.jsxs)(`div`,{className:H(`border-b border-border/30 last:border-b-0`,l&&`bg-interactive-selection/15 text-interactive-selection-foreground`),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,Z.jsx)(`button`,{type:`button`,...me,onClick:()=>h(i,a,y),className:`flex min-w-0 flex-1 items-start gap-2 rounded-lg text-left focus:outline-none focus-visible:ring-1 focus-visible:ring-primary`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[n.showProvider?(0,Z.jsx)(`span`,{className:`truncate text-[10px] leading-none text-muted-foreground/60`,children:N.get(i)?.name||i}):null,(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(Pe,{modelId:a,providerId:i,className:`size-3.5 flex-shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate typography-meta font-medium text-foreground`,children:he(r,a,{maxLength:40})}),l?(0,Z.jsx)(G,{name:`check`,className:`size-4 flex-shrink-0 text-primary`}):null]}),k||O.length>0?(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden typography-micro text-muted-foreground`,children:[k?(0,Z.jsx)(`span`,{className:`flex-shrink-0 whitespace-nowrap`,children:k}):null,k&&O.length>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px flex-shrink-0 bg-border/50`}):null,(0,Z.jsx)(`div`,{className:`flex min-w-0 items-center gap-1 overflow-hidden whitespace-nowrap pl-0.5`,children:O.map(e=>{let{key:t,icon:n,label:r}=e;return(0,Z.jsx)(`span`,{className:`flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,title:r,"aria-label":r,children:(0,Z.jsx)(G,{name:n,className:`size-3`})},`${c}-${t}`)})})]}):null]})}),d.length>0?(0,Z.jsxs)(`button`,{type:`button`,...me,onClick:()=>s(e=>e===c?null:c),className:`flex flex-shrink-0 items-center gap-0.5 typography-micro font-medium text-muted-foreground hover:text-foreground`,"aria-expanded":S,"aria-label":D(S?`chat.modelControls.hideThinkingModes`:`chat.modelControls.showThinkingModes`),children:[(0,Z.jsx)(`span`,{className:`whitespace-nowrap`,children:ce(b)}),(0,Z.jsx)(G,{name:S?`arrow-down-s`:`arrow-right-s`,className:`size-3.5`})]}):null,(0,Z.jsx)(`button`,{type:`button`,...me,onClick:e=>{e.preventDefault(),e.stopPropagation(),T(i,a)},className:H(`model-favorite-button flex size-5 flex-shrink-0 items-center justify-center hover:text-primary/80`,w(i,a)?`text-primary`:`text-muted-foreground`),"aria-label":w(i,a)?D(`chat.modelControls.unfavoriteAria`):D(`chat.modelControls.favoriteAria`),title:w(i,a)?D(`chat.modelControls.removeFromFavorites`):D(`chat.modelControls.addToFavorites`),children:(0,Z.jsx)(G,{name:w(i,a)?`star-fill`:`star`,className:`size-4`})})]}),S&&d.length>0?(0,Z.jsx)(`div`,{className:`border-t border-border/30 p-2`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[x.map(e=>{let t=e===b||!e&&!b;return(0,Z.jsx)(`button`,{type:`button`,...me,onClick:()=>h(i,a,e),className:H(`inline-flex items-center rounded-full border px-2.5 py-1 typography-meta font-medium`,t?`border-primary/30 bg-primary/10 text-foreground`:`border-border/40 text-muted-foreground hover:bg-interactive-hover/50`),"aria-pressed":t,children:ce(e)},`${c}-${e??`default`}`)}),x.length<d.length+1?(0,Z.jsx)(`button`,{type:`button`,...me,onClick:()=>fe(i,a,b),className:`inline-flex items-center rounded-full border border-border/40 px-2.5 py-1 typography-meta font-medium text-muted-foreground hover:bg-interactive-hover/50`,"aria-label":D(`chat.modelControls.moreThinkingModes`),children:D(`inlineComment.actions.showMore`)}):null]})}):null]},`mobile-model-${c}`)},t[51]=o,t[52]=ce,t[53]=E,t[54]=de,t[55]=w,t[56]=s,t[57]=h,t[58]=T,t[59]=fe,t[60]=N,t[61]=g,t[62]=m,t[63]=p,t[64]=f,t[65]=D,t[66]=C,t[67]=ge):ge=t[67];let _e=ge,ve,ye,be,xe,Se,U,Ce,we,Te,W;if(t[68]!==c||t[69]!==i||t[70]!==R||t[71]!==B||t[72]!==z||t[73]!==ce||t[74]!==s||t[75]!==a||t[76]!==r||t[77]!==h||t[78]!==g||t[79]!==n||t[80]!==_e||t[81]!==m||t[82]!==p||t[83]!==f||t[84]!==D||t[85]!==u){let e=u??(c===`variant`&&f&&p?{providerID:f,modelID:p}:null),o=e?Cr(g,e.providerID,e.modelID):[],l;bb1:{if(!e){l=void 0;break bb1}if(e.providerID===f&&e.modelID===p){l=m(e.providerID,e.modelID);break bb1}l=(e.variant!==void 0&&o.includes(e.variant)?e.variant:void 0)??m(e.providerID,e.modelID)}let d=l,_=R.length>0||z.length>0||B.length>0,v=c===`variant`&&!!e;Te=`flex min-h-0 flex-1 flex-col gap-2`,t[96]!==v||t[97]!==s||t[98]!==r||t[99]!==n||t[100]!==D?(W=v?null:(0,Z.jsxs)(`div`,{className:`relative z-10 shrink-0`,"data-mobile-sheet-no-dismiss":``,"data-mobile-sheet-search":``,children:[(0,Z.jsx)(G,{name:`search`,className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(Ve,{type:`text`,value:n,onChange:e=>{r(e.target.value),s(null)},onPointerUp:Mr,placeholder:D(`chat.modelControls.searchProvidersOrModels`),className:`h-9 rounded-xl border-border/40 bg-[var(--surface-elevated)] pl-7 typography-meta`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`search`,inputMode:`search`}),n?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{r(``),s(null)},className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":D(`chat.modelControls.clearSearch`),children:(0,Z.jsx)(G,{name:`close-circle`,className:`size-4`})}):null]}),t[96]=v,t[97]=s,t[98]=r,t[99]=n,t[100]=D,t[101]=W):W=t[101],ve=qe,xe=!0,Se=!0,U=!0,Ce=`min-h-0 flex-1`,we=`overscroll-contain`,ye=`flex flex-col gap-2`,be=v&&e?(0,Z.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[void 0,...o].map(t=>{let n=t===d||!t&&!d;return(0,Z.jsxs)(`button`,{type:`button`,className:H(`flex w-full items-center justify-between gap-2 rounded-xl border px-2 py-1.5 text-left focus:outline-none focus-visible:ring-1 focus-visible:ring-primary`,n?`border-primary/30 bg-primary/10`:`border-border/40`),...me,onClick:()=>h(e.providerID,e.modelID,t),children:[(0,Z.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:ce(t)}),n?(0,Z.jsx)(G,{name:`check`,className:`size-4 flex-shrink-0 text-primary`}):null]},t??`default`)})}):(0,Z.jsxs)(Z.Fragment,{children:[_?null:(0,Z.jsx)(`div`,{className:`px-3 py-8 text-center typography-meta text-muted-foreground`,children:D(`chat.modelControls.noProvidersOrModelsFound`)}),R.length>0?(0,Z.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,Z.jsx)(G,{name:`star-fill`,className:`mr-1.5 inline-block size-3 text-primary`}),D(`chat.modelControls.favorites`)]}),(0,Z.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:R.map(e=>_e(e,{showProvider:!0,preferRememberedVariant:!0}))})]}):null,z.length>0?(0,Z.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,Z.jsx)(G,{name:`time`,className:`mr-1.5 inline-block size-3`}),D(`chat.modelControls.recent`)]}),(0,Z.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:z.map(e=>_e(e,{showProvider:!0,preferRememberedVariant:!0}))})]}):null,B.map(e=>{let{provider:t,models:r}=e,o=i.has(t.id)||n.trim().length>0;return(0,Z.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,Z.jsxs)(`button`,{type:`button`,...me,onClick:()=>{n.trim()||a(e=>{let n=new Set(e);return n.has(t.id)?n.delete(t.id):n.add(t.id),n})},className:`flex w-full items-center justify-between gap-1.5 px-2 py-1.5 text-left`,"aria-expanded":o,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ie,{providerId:t.id,className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:t.name||t.id}),t.id===f?(0,Z.jsx)(`span`,{className:`typography-micro text-primary/80`,children:D(`chat.modelControls.current`)}):null]}),(0,Z.jsx)(G,{name:o?`arrow-down-s`:`arrow-right-s`,className:`size-3 text-muted-foreground`})]}),o?(0,Z.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:r.map(e=>_e({model:e,providerID:t.id,modelID:e.id}))}):null]},t.id)})]}),t[68]=c,t[69]=i,t[70]=R,t[71]=B,t[72]=z,t[73]=ce,t[74]=s,t[75]=a,t[76]=r,t[77]=h,t[78]=g,t[79]=n,t[80]=_e,t[81]=m,t[82]=p,t[83]=f,t[84]=D,t[85]=u,t[86]=ve,t[87]=ye,t[88]=be,t[89]=xe,t[90]=Se,t[91]=U,t[92]=Ce,t[93]=we,t[94]=Te,t[95]=W}else ve=t[86],ye=t[87],be=t[88],xe=t[89],Se=t[90],U=t[91],Ce=t[92],we=t[93],Te=t[94],W=t[95];let Ee;t[102]!==ye||t[103]!==be?(Ee=(0,Z.jsx)(`div`,{className:ye,children:be}),t[102]=ye,t[103]=be,t[104]=Ee):Ee=t[104];let De;t[105]!==ve||t[106]!==xe||t[107]!==Se||t[108]!==U||t[109]!==Ce||t[110]!==we||t[111]!==Ee?(De=(0,Z.jsx)(ve,{useScrollShadow:xe,disableHorizontal:Se,preventOverscroll:U,outerClassName:Ce,className:we,children:Ee}),t[105]=ve,t[106]=xe,t[107]=Se,t[108]=U,t[109]=Ce,t[110]=we,t[111]=Ee,t[112]=De):De=t[112];let Oe;return t[113]!==Te||t[114]!==W||t[115]!==De?(Oe=(0,Z.jsxs)(`div`,{className:Te,children:[W,De]}),t[113]=Te,t[114]=W,t[115]=De,t[116]=Oe):Oe=t[116],Oe};function Er(e){let[t,n]=e;return[t,new Set(n)]}function Dr(e){return`${e.providerID}:${e.modelID}`}function Or(e){return[e.id,e]}function kr(e,t){return[e,t]}function Ar(e){return e.models.length>0}function jr(e){Ae(e)||(e.preventDefault(),e.stopPropagation())}function Mr(e){document.activeElement!==e.currentTarget&&e.currentTarget.focus({preventScroll:!0})}var Nr=e=>{let t=(0,K.c)(217),{providerId:n,modelId:r,variant:i,onChange:a,className:o,allowedProviderIds:s,allowedModelIdsByProvider:c,placeholder:l,tooltipsEnabled:u,dropdownPortalToBody:d,showIcon:f,providers:p}=e,m=u===void 0||u,h=d!==void 0&&d,g=f===void 0||f,{t:_}=ue(),{isReady:v,isUnavailable:y}=er(),b=U(Pr),x=p??b,S=U(Fr),C=k(Ir),w=k(Lr),T=k(Rr),E=k(zr),D=k(Br),O=k(Vr),A;t[0]!==r||t[1]!==n?(A={currentProviderID:n,currentModelID:r},t[0]=r,t[1]=n,t[2]=A):A=t[2];let{favoriteModelsList:j,recentModelsList:M}=Me(A),{isMobile:ee}=Ue(),te=C||ee,[N,ne]=Q.useState(!1),[P,re]=Q.useState(!1),F;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{ne(!0),U.getState().refreshCatalogsOnPickerOpen({source:`modelSelector:mobilePanel`})},t[3]=F):F=t[3];let ie=ce(F),I;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>{re(e),e&&U.getState().refreshCatalogsOnPickerOpen({source:`modelSelector:desktopMenu`})},t[4]=I):I=t[4];let L=ce(I),[R,ae]=Q.useState(``),[z,oe]=Q.useState(null),B=i!==void 0,se;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{ne(!1),re(!1),ae(``),oe(null)},t[5]=se):se=t[5];let le=se,de;t[6]===x?de=t[7]:(de=e=>{let t=x.find(t=>t.id===e.providerID)?.models?.find(t=>t.id===e.modelID);return t?.variants?Object.keys(t.variants):[]},t[6]=x,t[7]=de);let V=de,fe;t[8]!==D||t[9]!==V||t[10]!==r||t[11]!==a||t[12]!==n||t[13]!==i||t[14]!==B?(fe=e=>{let t=V(e),o=e.providerID===n&&e.modelID===r,s=e.variant!==void 0&&t.includes(e.variant)?e.variant:void 0,c=o&&i&&t.includes(i)?i:s??``;a(e.providerID,e.modelID,B?c:void 0),D(e.providerID,e.modelID,B&&c||void 0),le()},t[8]=D,t[9]=V,t[10]=r,t[11]=a,t[12]=n,t[13]=i,t[14]=B,t[15]=fe):fe=t[15];let pe=fe,me;t[16]!==a||t[17]!==B?(me=()=>{a(``,``,B?``:void 0),le()},t[16]=a,t[17]=B,t[18]=me):me=t[18];let he=me,ge;t[19]!==D||t[20]!==a||t[21]!==z?(ge=e=>{z&&(a(z.providerID,z.modelID,e),D(z.providerID,z.modelID,e||void 0),le())},t[19]=D,t[20]=a,t[21]=z,t[22]=ge):ge=t[22];let _e=ge,ve;t[23]===_?ve=t[24]:(ve=_(`settings.agents.modelSelector.searchPlaceholder`),t[23]=_,t[24]=ve);let ye;t[25]===_?ye=t[26]:(ye=_(`settings.agents.modelSelector.state.noModelsFound`),t[25]=_,t[26]=ye);let be;t[27]===_?be=t[28]:(be=_(`settings.agents.modelSelector.section.favorites`),t[27]=_,t[28]=be);let xe;t[29]===_?xe=t[30]:(xe=_(`settings.agents.modelSelector.section.recent`),t[29]=_,t[30]=xe);let Se;t[31]===_?Se=t[32]:(Se=_(`settings.agents.modelSelector.keyboardHints`),t[31]=_,t[32]=Se);let Ce;t[33]!==l||t[34]!==_?(Ce=l||_(`settings.agents.modelSelector.notSelected`),t[33]=l,t[34]=_,t[35]=Ce):Ce=t[35];let we;t[36]===_?we=t[37]:(we=_(`settings.agents.modelSelector.actions.favorite`),t[36]=_,t[37]=we);let Te;t[38]===_?Te=t[39]:(Te=_(`settings.agents.modelSelector.actions.unfavorite`),t[38]=_,t[39]=Te);let W;t[40]===_?W=t[41]:(W=_(`chat.modelControls.provider`),t[40]=_,t[41]=W);let Ee;t[42]===_?Ee=t[43]:(Ee=_(`chat.modelControls.capabilities`),t[42]=_,t[43]=Ee);let De;t[44]===_?De=t[45]:(De=_(`chat.modelControls.capability.toolCalling`),t[44]=_,t[45]=De);let Oe;t[46]===_?Oe=t[47]:(Oe=_(`chat.modelControls.capability.reasoning`),t[46]=_,t[47]=Oe);let ke;t[48]===_?ke=t[49]:(ke=_(`chat.modelControls.modality.image`),t[48]=_,t[49]=ke);let Ae;t[50]===_?Ae=t[51]:(Ae=_(`chat.modelControls.modality.video`),t[50]=_,t[51]=Ae);let je;t[52]===_?je=t[53]:(je=_(`chat.modelControls.modality.audio`),t[52]=_,t[53]=je);let Ne;t[54]===_?Ne=t[55]:(Ne=_(`chat.modelControls.costPerMillion`),t[54]=_,t[55]=Ne);let Ie;t[56]===_?Ie=t[57]:(Ie=_(`chat.modelControls.costInput`),t[56]=_,t[57]=Ie);let Le;t[58]===_?Le=t[59]:(Le=_(`chat.modelControls.costOutput`),t[58]=_,t[59]=Le);let Re;t[60]!==ve||t[61]!==ye||t[62]!==be||t[63]!==xe||t[64]!==Se||t[65]!==Ce||t[66]!==we||t[67]!==Te||t[68]!==W||t[69]!==Ee||t[70]!==De||t[71]!==Oe||t[72]!==ke||t[73]!==Ae||t[74]!==je||t[75]!==Ne||t[76]!==Ie||t[77]!==Le?(Re={searchPlaceholder:ve,noResults:ye,favorites:be,recent:xe,keyboardHint:Se,notSelected:Ce,favorite:we,unfavorite:Te,provider:W,capabilities:Ee,capabilityToolCalling:De,capabilityReasoning:Oe,modalityImage:ke,modalityVideo:Ae,modalityAudio:je,costPerMillion:Ne,costInput:Ie,costOutput:Le},t[60]=ve,t[61]=ye,t[62]=be,t[63]=xe,t[64]=Se,t[65]=Ce,t[66]=we,t[67]=Te,t[68]=W,t[69]=Ee,t[70]=De,t[71]=Oe,t[72]=ke,t[73]=Ae,t[74]=je,t[75]=Ne,t[76]=Ie,t[77]=Le,t[78]=Re):Re=t[78];let ze=Re,Be;t[79]!==r||t[80]!==n?(Be=n&&r?{providerID:n,modelID:r}:null,t[79]=r,t[80]=n,t[81]=Be):Be=t[81];let Ve=Be,He;t[82]!==r||t[83]!==l||t[84]!==n||t[85]!==_?(He=n&&r?`${n}/${r}`:l||_(`settings.agents.modelSelector.notSelected`),t[82]=r,t[83]=l,t[84]=n,t[85]=_,t[86]=He):He=t[86];let We=He,Ge;t[87]!==_||t[88]!==i||t[89]!==B?(Ge=B?i||_(`chat.modelControls.default`):null,t[87]=_,t[88]=i,t[89]=B,t[90]=Ge):Ge=t[90];let Ke=Ge,qe;t[91]!==r||t[92]!==n||t[93]!==i||t[94]!==B?(qe=(e,t)=>{if(!(!B||e!==n||t!==r))return i||void 0},t[91]=r,t[92]=n,t[93]=i,t[94]=B,t[95]=qe):qe=t[95];let Je=qe,Ye;t[96]!==D||t[97]!==a||t[98]!==B?(Ye=(e,t,n)=>{a(e,t,B?n??``:void 0),D(e,t,B&&n||void 0),le()},t[96]=D,t[97]=a,t[98]=B,t[99]=Ye):Ye=t[99];let Xe=Ye,Ze;t[100]!==V||t[101]!==_||t[102]!==i||t[103]!==B?(Ze=(e,t)=>{let n=V(e);if(!B||n.length===0)return null;let r=e.variant!==void 0&&n.includes(e.variant)?e.variant:void 0,a=t.isSelected?i:r??``;return(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-9 shrink-0 items-center gap-0.5 rounded-md px-1.5 typography-micro font-medium text-muted-foreground hover:bg-interactive-hover hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e)},"aria-label":_(`chat.modelControls.showThinkingModes`),children:[(0,Z.jsx)(`span`,{className:`max-w-24 truncate`,children:a||_(`chat.modelControls.default`)}),(0,Z.jsx)(G,{name:`arrow-right-s`,className:`size-3.5`})]})},t[100]=V,t[101]=_,t[102]=i,t[103]=B,t[104]=Ze):Ze=t[104];let Qe=Ze,$e=te?`max-h-none flex-1`:void 0,et=m&&(te?N:P),tt;t[105]===E?tt=t[106]:(tt=e=>E(e.providerID,e.modelID),t[105]=E,t[106]=tt);let nt;t[107]!==r||t[108]!==n||t[109]!==T||t[110]!==i?(nt=e=>T(e.providerID,e.modelID,e.providerID===n&&e.modelID===r?i||void 0:e.variant),t[107]=r,t[108]=n,t[109]=T,t[110]=i,t[111]=nt):nt=t[111];let rt;t[112]!==c||t[113]!==s||t[114]!==j||t[115]!==S||t[116]!==pe||t[117]!==he||t[118]!==w||t[119]!==ze||t[120]!==O||t[121]!==x||t[122]!==M||t[123]!==Qe||t[124]!==R||t[125]!==Ve||t[126]!==$e||t[127]!==et||t[128]!==tt||t[129]!==nt?(rt=(0,Z.jsx)(Fe,{providers:x,providerOrder:O,favoriteModels:j,recentModels:M,getMetadata:S,searchQuery:R,onSearchQueryChange:ae,onSelect:pe,labels:ze,selectedModel:Ve,hiddenModels:w,allowedProviderIds:s,allowedModelIdsByProvider:c,includeNotSelected:!0,onSelectNone:he,onEscape:le,maxHeightClassName:$e,tooltipsEnabled:et,isFavorite:tt,onToggleFavorite:nt,renderRowEnd:Qe}),t[112]=c,t[113]=s,t[114]=j,t[115]=S,t[116]=pe,t[117]=he,t[118]=w,t[119]=ze,t[120]=O,t[121]=x,t[122]=M,t[123]=Qe,t[124]=R,t[125]=Ve,t[126]=$e,t[127]=et,t[128]=tt,t[129]=nt,t[130]=rt):rt=t[130];let it=rt,q;t[131]!==V||t[132]!==z?(q=z?V(z):[],t[131]=V,t[132]=z,t[133]=q):q=t[133];let J=q,Y;bb0:{if(!z){Y=``;break bb0}if(z.providerID===n&&z.modelID===r){Y=i||``;break bb0}Y=z.variant!==void 0&&J.includes(z.variant)?z.variant:``}let X=Y,at;t[134]!==_e||t[135]!==_||t[136]!==z||t[137]!==X||t[138]!==J?(at=z?(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 items-center gap-2 border-b border-border/40 px-3 text-left typography-ui-label font-medium text-foreground hover:bg-interactive-hover`,onClick:()=>oe(null),"aria-label":_(`header.actions.backAria`),children:[(0,Z.jsx)(G,{name:`arrow-left`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:z.modelID})]}),(0,Z.jsx)(`div`,{className:`space-y-1 p-2`,role:`listbox`,"aria-label":_(`chat.modelControls.thinking`),children:[``,...J].map(e=>{let t=X===e;return(0,Z.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,className:H(`flex min-h-11 w-full items-center justify-between rounded-lg px-3 text-left typography-ui-label transition-colors`,t?`bg-interactive-selection text-interactive-selection-foreground`:`hover:bg-interactive-hover`),onClick:()=>_e(e),children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e||_(`chat.modelControls.default`)}),t?(0,Z.jsx)(G,{name:`check`,className:`size-4 shrink-0`}):null]},e||`__default`)})})]}):null,t[134]=_e,t[135]=_,t[136]=z,t[137]=X,t[138]=J,t[139]=at):at=t[139];let ot=at||it;if(te){let e=v?ie:void 0,a=!v,l=!v&&`opacity-60 cursor-not-allowed`,u;t[140]!==o||t[141]!==l?(u=H(`flex w-full items-center justify-between gap-2 rounded-lg border border-border/40 bg-[var(--surface-elevated)] px-2 py-1.5 text-left`,l,o),t[140]=o,t[141]=l,t[142]=u):u=t[142];let d;t[143]!==v||t[144]!==y||t[145]!==r||t[146]!==n||t[147]!==g||t[148]!==_?(d=v?g&&(n||r)?(0,Z.jsx)(Pe,{modelId:r,providerId:n,className:`h-3.5 w-3.5 flex-shrink-0`}):g?(0,Z.jsx)(G,{name:`pencil-ai`,className:`h-3 w-3 text-muted-foreground`}):null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{name:`loader-4`,className:`h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:_(y?`common.unavailable`:`common.loading`)})]}),t[143]=v,t[144]=y,t[145]=r,t[146]=n,t[147]=g,t[148]=_,t[149]=d):d=t[149];let f;t[150]!==v||t[151]!==We?(f=v?(0,Z.jsx)(`span`,{className:`typography-meta font-medium text-foreground truncate`,children:We}):null,t[150]=v,t[151]=We,t[152]=f):f=t[152];let p;t[153]!==v||t[154]!==Ke?(p=v&&Ke?(0,Z.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground`,children:Ke}):null,t[153]=v,t[154]=Ke,t[155]=p):p=t[155];let m;t[156]!==d||t[157]!==f||t[158]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[d,f,p]}),t[156]=d,t[157]=f,t[158]=p,t[159]=m):m=t[159];let h;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(G,{name:`arrow-down-s`,className:`h-3 w-3 flex-shrink-0 text-muted-foreground`}),t[160]=h):h=t[160];let b;t[161]!==e||t[162]!==a||t[163]!==u||t[164]!==m?(b=(0,Z.jsxs)(`button`,{type:`button`,onClick:e,disabled:a,className:u,children:[m,h]}),t[161]=e,t[162]=a,t[163]=u,t[164]=m,t[165]=b):b=t[165];let C;t[166]!==j||t[167]!==r||t[168]!==n||t[169]!==M||t[170]!==T||t[171]!==i?(C=(e,t)=>T(e,t,e===n&&t===r?i||void 0:j.find(n=>n.providerID===e&&n.modelID===t)?.variant??M.find(n=>n.providerID===e&&n.modelID===t)?.variant),t[166]=j,t[167]=r,t[168]=n,t[169]=M,t[170]=T,t[171]=i,t[172]=C):C=t[172];let D;t[173]!==c||t[174]!==s||t[175]!==j||t[176]!==S||t[177]!==Xe||t[178]!==w||t[179]!==E||t[180]!==N||t[181]!==r||t[182]!==n||t[183]!==O||t[184]!==x||t[185]!==M||t[186]!==Je||t[187]!==C||t[188]!==B?(D=(0,Z.jsx)(wr,{open:N,onClose:le,selectedProviderID:n,selectedModelID:r,resolveSelectedVariant:Je,onSelect:Xe,providers:x,favoriteModels:j,recentModels:M,getMetadata:S,hiddenModels:w,allowedProviderIds:s,allowedModelIdsByProvider:c,providerOrder:O,variantSelectionEnabled:B,isFavorite:E,onToggleFavorite:C}),t[173]=c,t[174]=s,t[175]=j,t[176]=S,t[177]=Xe,t[178]=w,t[179]=E,t[180]=N,t[181]=r,t[182]=n,t[183]=O,t[184]=x,t[185]=M,t[186]=Je,t[187]=C,t[188]=B,t[189]=D):D=t[189];let k;return t[190]!==b||t[191]!==D?(k=(0,Z.jsxs)(Z.Fragment,{children:[b,D]}),t[190]=b,t[191]=D,t[192]=k):k=t[192],k}let st=v&&P,ct=v?L:void 0,lt=!v&&`opacity-60 cursor-not-allowed`,ut;t[193]!==o||t[194]!==lt?(ut=H(`border-input data-[placeholder]:text-muted-foreground flex min-w-0 items-center justify-between gap-2 rounded-lg border bg-transparent px-2 py-2 typography-ui-label whitespace-nowrap shadow-none outline-none hover:bg-interactive-hover data-[popup-open]:bg-interactive-active h-6 w-fit`,lt,o),t[193]=o,t[194]=lt,t[195]=ut):ut=t[195];let dt;t[196]!==v||t[197]!==y||t[198]!==r||t[199]!==n||t[200]!==g||t[201]!==_||t[202]!==We||t[203]!==Ke?(dt=v?(0,Z.jsxs)(Z.Fragment,{children:[g?n||r?(0,Z.jsx)(Pe,{modelId:r,providerId:n,className:`h-3.5 w-3.5 flex-shrink-0`}):(0,Z.jsx)(G,{name:`pencil-ai`,className:`h-3.5 w-3.5 flex-shrink-0 text-muted-foreground`}):null,(0,Z.jsx)(`span`,{className:`typography-ui-label min-w-0 flex-1 truncate text-left font-normal text-foreground`,children:We}),Ke?(0,Z.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground`,children:Ke}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{name:`loader-4`,className:`h-3.5 w-3.5 animate-spin text-muted-foreground flex-shrink-0`}),(0,Z.jsx)(`span`,{className:`typography-ui-label font-normal whitespace-nowrap text-muted-foreground`,children:_(y?`common.unavailable`:`common.loading`)})]}),t[196]=v,t[197]=y,t[198]=r,t[199]=n,t[200]=g,t[201]=_,t[202]=We,t[203]=Ke,t[204]=dt):dt=t[204];let ft;t[205]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,Z.jsx)(G,{name:`arrow-down-s`,className:`h-4 w-4 flex-shrink-0 text-muted-foreground/50`}),t[205]=ft):ft=t[205];let pt;t[206]!==ut||t[207]!==dt?(pt=(0,Z.jsx)(qn,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:ut,children:[dt,ft]})}),t[206]=ut,t[207]=dt,t[208]=pt):pt=t[208];let mt;t[209]!==h||t[210]!==ot?(mt=(0,Z.jsx)(Jn,{className:`w-[min(380px,calc(100vw-2rem))] p-0 flex flex-col`,align:`start`,portalToBody:h,children:ot}),t[209]=h,t[210]=ot,t[211]=mt):mt=t[211];let ht;return t[212]!==st||t[213]!==ct||t[214]!==pt||t[215]!==mt?(ht=(0,Z.jsxs)(Kn,{open:st,onOpenChange:ct,children:[pt,mt]}),t[212]=st,t[213]=ct,t[214]=pt,t[215]=mt,t[216]=ht):ht=t[216],ht};function Pr(e){return e.providers}function Fr(e){return e.getModelMetadata}function Ir(e){return e.isMobile}function Lr(e){return e.hiddenModels}function Rr(e){return e.toggleFavoriteModel}function zr(e){return e.isFavoriteModel}function Br(e){return e.addRecentModel}function Vr(e){return e.providerOrder}var Hr=e(D(),1),Ur=`mobile-overlay-root`,Wr=16,Gr=200,Kr=[],qr=0,Jr=``,Yr=0,Xr=()=>{if(typeof document>`u`)return null;let e=document.getElementById(Ur);return e||(e=document.createElement(`div`),e.id=Ur,document.body.appendChild(e)),e},Zr=({open:e,title:t,onClose:n,children:r,footer:i,className:a,contentMaxHeightClassName:o,renderHeader:s,containedBody:c=!1,closeAriaLabel:l})=>{let u=Q.useRef(null),d=Q.useRef(Symbol(`mobile-overlay`)),f=Q.useRef(n);f.current=n;let[p,m]=Q.useState(!1),[h,g]=Q.useState(!1);if(typeof document<`u`&&!u.current&&(u.current=Xr()),Q.useEffect(()=>{if(!e){m(!1),g(!1);return}let t=window.setTimeout(()=>m(!0),Wr),n=window.setTimeout(()=>g(!0),266);return()=>{window.clearTimeout(t),window.clearTimeout(n)}},[e]),Q.useLayoutEffect(()=>{if(e)return Yr===0&&window.dispatchEvent(new Event(`oc:mobile-overlay-opened`)),Yr+=1,()=>{Yr=Math.max(0,Yr-1),Yr===0&&window.dispatchEvent(new Event(`oc:mobile-overlay-closed`))}},[e]),Q.useEffect(()=>{if(!e)return;let t=d.current;Kr.push(t),qr===0&&(Jr=document.body.style.overflow),qr+=1,document.body.style.overflow=`hidden`;let n=e=>{e.key===`Escape`&&Kr[Kr.length-1]===t&&f.current()};return document.addEventListener(`keydown`,n),()=>{let e=Kr.lastIndexOf(t);e>=0&&Kr.splice(e,1),qr=Math.max(0,qr-1),qr===0&&(document.body.style.overflow=Jr),document.removeEventListener(`keydown`,n)}},[e]),!e||!u.current)return null;let _=o??`max-h-[min(70vh,520px)]`,v=(0,Z.jsx)(`div`,{className:H(`oc-keyboard-inset-surface fixed inset-0 z-[60] flex flex-col bg-[rgb(0_0_0_/_0.45)] transition-opacity duration-200 ease-out`,!h&&`oc-keyboard-inset-snap`,p?`opacity-100`:`opacity-0`),role:`dialog`,"aria-modal":`true`,"aria-label":t,onPointerDown:Ne,onClick:e=>{Le(e)&&n()},children:(0,Z.jsxs)(`div`,{className:H(`mt-auto flex max-h-[calc(100dvh-0.75rem)] min-h-0 w-full flex-col rounded-t-xl border-x border-t border-border/50 bg-background pb-[max(0.5rem,var(--oc-app-bottom-safe,0px),var(--oc-safe-area-bottom,env(safe-area-inset-bottom,0px)))] shadow-none pwa-overlay-panel`,`mx-auto max-w-lg`,a),style:{transform:p?`none`:`translateY(100%)`,transition:`transform ${Gr}ms cubic-bezier(0.32, 0.72, 0, 1)`},onClick:e=>e.stopPropagation(),children:[(()=>{let e=(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:H(`flex items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover`,c?`size-11`:`h-8 w-8`),"aria-label":l??t,children:(0,Z.jsx)(G,{name:`close`,className:`h-4 w-4`})});return s?s(e):(0,Z.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border/40`,children:[(0,Z.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:t}),e]})})(),c?(0,Z.jsx)(`div`,{className:H(`flex min-h-0 flex-1 flex-col overflow-hidden`,_),children:r}):(0,Z.jsx)(qe,{useScrollShadow:!0,disableHorizontal:!0,preventOverscroll:!0,outerClassName:H(`min-h-0 flex-1`,_),className:`px-2 py-2 pwa-overlay-scroll`,children:r}),i?(0,Z.jsx)(`div`,{className:`shrink-0 border-t border-border/40 px-3 py-2`,children:i}):null]})});return(0,Hr.createPortal)(v,u.current)},Qr=e=>e??i()?.github,$r=(e=t())=>c.github.auth(e),ei=async(e,t)=>{if(e)return e.authStatus();let n=await r(`/api/github/auth/status`,{method:`GET`,headers:{Accept:`application/json`},signal:t}),i=await n.json().catch(()=>null);if(!n.ok||!i)throw Error(i?.error||n.statusText||`Failed to load GitHub status`);return i},ti=(e,n=t())=>{let r=Qr(e);return{queryKey:$r(n),queryFn:async({signal:e})=>ei(r,e),retry:2}},ni=e=>!!e&&typeof e==`object`&&`authStatus`in e,ri=e=>{let t=(0,K.c)(5),n=ni(e)?e:void 0,r=ni(e)?void 0:e?.enabled,i;t[0]===n?i=t[1]:(i=ti(n),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a={...i,enabled:r},t[2]=r,t[3]=i,t[4]=a):a=t[4],N(a)},ii=(e=u,n=t())=>e.getQueryData($r(n))??null,ai=async(e,n,r)=>t()===r?e.fetchQuery({...ti(n,r),staleTime:0}):e.getQueryData($r(r))??null,oi=(e=u,n,r=t())=>{e.setQueryData($r(r),n)},si=F.define(se),ci=z.data.of({commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}}});function li(e){let t=e.trim().toLowerCase();switch(t){case`bash`:case`sh`:case`zsh`:case`shell`:case`shellsession`:case`console`:return si;case`json`:case`jsonc`:case`json5`:return ae().language;case`js`:case`javascript`:return L().language;case`jsx`:return L({jsx:!0}).language;case`ts`:case`typescript`:return L({typescript:!0}).language;case`tsx`:return L({typescript:!0,jsx:!0}).language;case`html`:return R().language;case`css`:return I().language;case`py`:case`python`:return B().language;case`md`:case`markdown`:case`mdown`:case`mkd`:return oe().language;case`heex`:case`eex`:case`leex`:return R().language;default:return ie.matchLanguageName(Je,t,!0)}}var ui=e=>e.split(`/`).pop()?.toLowerCase()??``,di=e=>{let t=ui(e);return t?ie.matchFilename(Je,t):null},fi=()=>ne(re.define([{tag:[P.heading1,P.heading2,P.heading3,P.heading4,P.heading5,P.heading6],fontWeight:`600`},{tag:P.strong,fontWeight:`600`},{tag:P.emphasis,fontStyle:`italic`},{tag:P.strikethrough,textDecoration:`line-through`},{tag:[P.link,P.url],color:`var(--markdown-link, currentColor)`,textDecoration:`underline`},{tag:P.monospace,color:`var(--markdown-inline-code, currentColor)`,backgroundColor:`var(--markdown-inline-code-bg, transparent)`},{tag:P.quote,color:`var(--markdown-blockquote, currentColor)`,fontStyle:`italic`},{tag:P.list,color:`color-mix(in srgb, var(--muted-foreground) 40%, var(--foreground) 60%)`},{tag:P.heading,color:`var(--markdown-heading1, currentColor)`}]));function pi(e){let t=e.toLowerCase();switch(ui(t)){case`makefile`:case`gnumakefile`:return si}let n=t.lastIndexOf(`.`),r=n>=0?t.slice(n+1):``;switch(r){case`ts`:case`tsx`:case`mts`:case`cts`:return L({typescript:!0,jsx:r===`tsx`});case`js`:case`jsx`:case`mjs`:case`cjs`:return L({typescript:!1,jsx:r===`jsx`});case`jsonc`:case`json5`:return[ae(),ci];case`json`:case`jsonl`:case`ndjson`:case`geojson`:return ae();case`css`:case`scss`:case`sass`:case`less`:return I();case`html`:case`htm`:case`xml`:case`drawio`:case`dio`:return R();case`md`:case`mdx`:case`markdown`:case`mdown`:case`mkd`:return[oe({codeLanguages:li}),fi()];case`sh`:case`bash`:case`zsh`:case`fish`:case`env`:return si;case`py`:case`pyw`:case`pyi`:return B();default:return null}}async function mi(e){let t=di(e);if(!t)return null;if(t.support)return t.support;try{return await t.load()}catch{return null}}var hi=60,gi=400;function _i(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return[];let n=t.match(/[^.!?…]+[.!?…]+["')\]]*\s*|[^.!?…]+$/g)??[t],r=[],i=``;for(let e of n)for(let t=0;t<e.length;t+=gi){let n=e.slice(t,t+gi);i&&i.length+n.length>gi&&(r.push(i.trim()),i=``),i+=n,i.length>=hi&&/[.!?…]["')\]]*\s*$/.test(i)&&(r.push(i.trim()),i=``)}if(i.trim()&&r.push(i.trim()),r.length>0&&r[0].length>120){let e=r[0],t=/[,;:]\s/g,n=-1,i;for(;(i=t.exec(e))!==null;){let e=i.index+1;if(!(e<40)){if(e>160)break;n=e;break}}if(n>0){let t=e.slice(0,n).trim(),i=e.slice(n).trim();r.splice(0,1,t,i)}}return r}var vi=null;function yi(){return vi||=new(window.AudioContext||window.webkitAudioContext),vi}function bi(){let[e,t]=(0,Q.useState)(!1),[n,i]=(0,Q.useState)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=(0,Q.useCallback)(async()=>{try{let e=yi();e.state===`suspended`&&await e.resume();let t=e.createBuffer(1,1,22050),n=e.createBufferSource();n.buffer=t,n.connect(e.destination),n.start(0)}catch{}},[]),c=(0,Q.useCallback)(()=>{let e=o.current;if(e&&(e.cancelled=!0,e.abort.abort(),o.current=null),a.current){try{a.current.onended=null,a.current.stop()}catch{}a.current=null}t(!1)},[]),l=(0,Q.useCallback)(async(e,n)=>{c();let s=_i(e);if(s.length===0){i(`No text to speak`),n?.onError?.(`No text to speak`);return}i(null);let l={cancelled:!1,abort:new AbortController};o.current=l;let u=async e=>{let t=await r(`/api/dictation/tts/speak`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e,...typeof n?.speakerId==`number`?{speakerId:n.speakerId}:{},...typeof n?.speed==`number`?{speed:n.speed}:{}}),signal:l.abort.signal});if(!t.ok){let e=await t.json().catch(()=>({error:`Unknown error`}));throw Error(e.error||`HTTP ${t.status}`)}return(await t.blob()).arrayBuffer()},d=async e=>{let t=yi();t.state===`suspended`&&await t.resume();let n=await t.decodeAudioData(e);l.cancelled||await new Promise(e=>{let r=t.createBufferSource();r.buffer=n,r.connect(t.destination),a.current=r,r.onended=()=>{a.current===r&&(a.current=null),e()},r.start(0)})};try{t(!0),n?.onStart?.();let e=u(s[0]);for(let t=0;t<s.length;t+=1){let n=await e;if(l.cancelled||(t+1<s.length&&(e=u(s[t+1])),await d(n),l.cancelled))return}t(!1),n?.onEnd?.()}catch(e){if(e.name===`AbortError`||l.cancelled)return;let r=e instanceof Error?e.message:`Failed to speak`;i(r),n?.onError?.(r),t(!1)}finally{o.current===l&&(o.current=null)}},[c]);return(0,Q.useEffect)(()=>()=>{c()},[c]),{isPlaying:e,error:n,speak:l,stop:c,unlockAudio:s}}var xi=new class{recognition=null;isListening=!1;currentLang=`en-US`;onResultCallback=null;onErrorCallback=null;restartOnEnd=!1;conversationMode=!1;isSpeaking=!1;audioContext=null;audioUnlockRequired=!1;isSupported(){let e=`SpeechRecognition`in window||`webkitSpeechRecognition`in window,t=`speechSynthesis`in window;return e&&t}getSupportDetails(){return{recognition:`SpeechRecognition`in window||`webkitSpeechRecognition`in window,synthesis:`speechSynthesis`in window,prefixed:!(`SpeechRecognition`in window)&&`webkitSpeechRecognition`in window,secureContext:window.isSecureContext}}setConversationMode(e){this.conversationMode=e,e||(this.restartOnEnd=!1)}isConversationMode(){return this.conversationMode}pauseListening(){if(this.restartOnEnd=!1,this.recognition)try{this.recognition.stop()}catch{}this.isListening=!1}resumeListening(){if(this.conversationMode,this.onResultCallback,this.isSpeaking,this.currentLang,this.conversationMode&&this.onResultCallback&&!this.isSpeaking)try{this.startListeningSync(this.currentLang,this.onResultCallback,this.onErrorCallback||void 0)}catch(e){console.error(`[BrowserVoiceService] Failed to resume listening:`,e)}}async checkMicrophonePermission(){try{return`permissions`in navigator&&(await navigator.permissions.query({name:`microphone`})).state===`granted`}catch{return!1}}async prepareListening(){if(!this.isSupported())throw Error(`Web Speech API not supported in this browser`);if(typeof navigator>`u`||typeof navigator.mediaDevices?.getUserMedia!=`function`)return!0;try{return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop()),!0}catch(e){let t=typeof e==`object`&&e&&`name`in e?String(e.name):``;if(t===`NotAllowedError`)throw Error(`Microphone permission denied`);if(t===`NotFoundError`)throw Error(`No microphone found`);let n=e instanceof Error?e.message:`Unable to access microphone`;throw Error(n)}}startListeningSync(e,t,n){if(!this.isSupported()){let e=`Web Speech API not supported in this browser`;throw n?.(e),Error(e)}this.stopListening();let r=window.SpeechRecognition||window.webkitSpeechRecognition;if(!r){let e=`Web Speech API not supported in this browser`;throw n?.(e),Error(e)}let i=new r;this.recognition=i,this.currentLang=e,this.onResultCallback=t,this.onErrorCallback=n||null,i.continuous=!0,i.interimResults=!0,i.lang=e,i.onstart=()=>{this.isListening=!0,this.restartOnEnd=!0},i.onaudiostart=()=>{},i.onsoundstart=()=>{},i.onresult=e=>{e.results.length;let t=``,n=``;for(let r=e.resultIndex;r<e.results.length;r++){let i=e.results[r];i.isFinal?t+=i[0].transcript:n+=i[0].transcript}n&&this.onResultCallback?.(n,!1),t&&this.onResultCallback?.(t,!0)},i.onerror=e=>{if(e.error===`aborted`)return;let t=this.getErrorMessage(e.error);this.onErrorCallback?.(t),(e.error===`not-allowed`||e.error===`service-not-allowed`||e.error===`network`)&&(this.restartOnEnd=!1,this.isListening=!1)},i.onend=()=>{if(this.isListening=!1,this.restartOnEnd&&this.recognition&&!this.isSpeaking)try{this.recognition.start()}catch{}};try{i.start()}catch(e){let t=e instanceof Error?e.message:`Failed to start speech recognition`;throw n?.(t),Error(t)}}async startListening(e,t,n){this.startListeningSync(e,t,n)}stopListening(){if(this.restartOnEnd=!1,this.recognition){try{this.recognition.stop()}catch{}this.recognition=null}this.isListening=!1}getIsListening(){return this.isListening}getCurrentLang(){return this.currentLang}async resumeAudioContext(){this.audioContext||=new(window.AudioContext||window.webkitAudioContext),this.audioContext.state===`suspended`&&await this.audioContext.resume()}isAudioUnlockRequired(){return this.audioUnlockRequired}async unlockAudio(){try{let e=new Audio;if(e.src=`data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA`,e.volume=.01,await e.play(),await this.resumeAudioContext(),this.isMobileDevice()&&`speechSynthesis`in window){let e=new SpeechSynthesisUtterance(``);e.volume=0,window.speechSynthesis.speak(e),window.speechSynthesis.cancel()}return this.audioUnlockRequired=!1,!0}catch(e){return console.error(`[BrowserVoiceService] Failed to unlock audio:`,e),!1}}async speakText(e,t,n,r){if(!(`speechSynthesis`in window))throw Error(`Speech synthesis not supported`);await this.resumeAudioContext();let i=await this.waitForVoices();await new Promise(e=>setTimeout(e,50)),this.isSpeaking=!0,this.pauseListening(),window.speechSynthesis.cancel();let a=new SpeechSynthesisUtterance(e);a.lang=t,a.rate=r?.rate??1,a.pitch=r?.pitch??1,a.volume=r?.volume??1;let o=null;return r?.voiceName&&(o=i.find(e=>e.name===r.voiceName)||null,o?`${o.name}${o.lang}`:console.warn(`[BrowserVoiceService] Selected voice "${r.voiceName}" not found, falling back to language match`)),o||(o=this.findBestVoice(i,t),o?`${o.name}${o.lang}`:console.warn(`[BrowserVoiceService] No voice found for language: ${t}, using default`)),o&&(a.voice=o),`${e.length}${t}`,new Promise((e,t)=>{let r=!1;a.onstart=()=>{r=!0,e()},a.onend=()=>{this.isSpeaking=!1,n?.()},a.onerror=e=>{this.isSpeaking=!1,console.error(`[BrowserVoiceService] Speech synthesis error:`,e.error),(e.error===`not-allowed`||e.error===`interrupted`)&&(this.audioUnlockRequired=!0);let n=`Speech synthesis error: ${e.error||`unknown`}`;e.error===`not-allowed`?n=`Audio blocked by browser autoplay policy. Please interact with the page first.`:e.error===`interrupted`&&(n=`Speech was interrupted. Please try again.`),t(Error(n))},setTimeout(()=>{r||(console.warn(`[BrowserVoiceService] Speech start timeout - audio may be blocked`),this.audioUnlockRequired=!0)},2e3),window.speechSynthesis.speak(a)})}cancelSpeech(){`speechSynthesis`in window&&window.speechSynthesis.cancel()}getVoices(){return`speechSynthesis`in window?window.speechSynthesis.getVoices():[]}async waitForVoices(){if(!(`speechSynthesis`in window))return[];let e=window.speechSynthesis.getVoices();return e.length>0?e:new Promise(e=>{let t=()=>{e(window.speechSynthesis.getVoices()),window.speechSynthesis.onvoiceschanged=null};window.speechSynthesis.onvoiceschanged=t,setTimeout(()=>{e(window.speechSynthesis.getVoices()),window.speechSynthesis.onvoiceschanged=null},1e3)})}findBestVoice(e,t){let n=e.find(e=>e.lang===t);if(!n){let r=t.split(`-`)[0];n=e.find(e=>e.lang.startsWith(r))}return n||=e.find(e=>e.lang.startsWith(t.split(`-`)[0])&&e.localService),n||null}isMobileDevice(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return/iphone|ipad|ipod|android|mobile|webos|blackberry|iemobile|opera mini/i.test(e)}isIOSSafari(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase(),t=/iphone|ipad|ipod/i.test(e),n=/safari/i.test(e)&&!/chrome|crios|crmo/i.test(e);return t&&n}getErrorMessage(e){let t=this.isMobileDevice(),n=this.isIOSSafari();return{"no-speech":`No speech detected`,aborted:`Speech recognition aborted`,"audio-capture":`No microphone found`,network:`Network error - check connection`,"not-allowed":t?`Microphone permission denied. Check Settings > Safari > Microphone`:`Microphone permission denied`,"service-not-allowed":n?`Speech recognition requires a user gesture. Please tap the microphone button again.`:`Speech recognition service not allowed`,"bad-grammar":`Grammar error`,"language-not-supported":`Language not supported`}[e]||`Speech recognition error: ${e}`}},Si=e=>{if(e===`12h`)return!0;if(e===`24h`)return!1},Ci=(e,t,n={})=>{let r=e instanceof Date?e:new Date(e);return Number.isFinite(r.getTime())?r.toLocaleTimeString(V(),{hour:n.hour??`numeric`,minute:`2-digit`,second:n.precision===`second`?`2-digit`:void 0,hour12:Si(t)}):n.fallback??``},wi=(e,t,n)=>{let r=e instanceof Date?e:new Date(e);return Number.isFinite(r.getTime())?r.toLocaleString(V(),{...n,hour12:n.hour?Si(t):n.hour12}):``},Ti=Q.memo(function(e){let t=(0,K.c)(24),{checked:n,onChange:r,disabled:i,ariaLabel:a,className:o,iconClassName:s}=e,c=i!==void 0&&i,l;t[0]!==n||t[1]!==c||t[2]!==r?(l=e=>{e.preventDefault(),e.stopPropagation(),!c&&!n&&r()},t[0]=n,t[1]=c,t[2]=r,t[3]=l):l=t[3];let u=l,d;t[4]!==n||t[5]!==c||t[6]!==r?(d=e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),!c&&!n&&r())},t[4]=n,t[5]=c,t[6]=r,t[7]=d):d=t[7];let f=d,p=n?`bg-[color-mix(in_srgb,var(--primary-base)_80%,transparent)] shadow-none hover:bg-[var(--primary-base)]`:`bg-[var(--surface-muted)] shadow-[inset_0_0_0_1px_var(--interactive-border)] hover:bg-[var(--interactive-hover)]`,m;t[8]!==o||t[9]!==p?(m=H(`group/radio relative flex h-[14px] w-[14px] min-h-[14px] min-w-[14px] shrink-0 self-center items-center justify-center rounded-full outline-none`,`transition-[background-color,box-shadow] duration-200 ease-out`,p,`focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] focus-visible:ring-offset-1 focus-visible:ring-offset-background`,`disabled:cursor-not-allowed disabled:opacity-50`,o),t[8]=o,t[9]=p,t[10]=m):m=t[10];let h=!n&&`opacity-0`,g;t[11]!==s||t[12]!==h?(g=H(`block h-[5px] w-[5px] rounded-full bg-white`,h,s),t[11]=s,t[12]=h,t[13]=g):g=t[13];let _;t[14]===g?_=t[15]:(_=(0,Z.jsx)(`span`,{"aria-hidden":!0,className:g}),t[14]=g,t[15]=_);let v;return t[16]!==a||t[17]!==n||t[18]!==c||t[19]!==u||t[20]!==f||t[21]!==m||t[22]!==_?(v=(0,Z.jsx)(`button`,{type:`button`,role:`radio`,onClick:u,onKeyDown:f,disabled:c,"aria-checked":n,"aria-label":a,className:m,children:_}),t[16]=a,t[17]=n,t[18]=c,t[19]=u,t[20]=f,t[21]=m,t[22]=_,t[23]=v):v=t[23],v}),$=e=>me(pe.getState().dictionary,e),Ei=e=>typeof e!=`number`||!Number.isFinite(e)?null:Math.max(0,Math.min(100,Math.round(e))),Di=e=>typeof e!=`number`||!Number.isFinite(e)?`-`:`${Math.round(e)}%`,Oi=(e,t)=>e??Di(t),ki=(e,t,n=`auto`)=>{if(!e)return t??``;try{let r=new Date(e);if(!Number.isFinite(r.getTime()))return t??``;let i=new Date;return r.toDateString()===i.toDateString()?Ci(r,n,{fallback:t??``}):wi(r,n,{month:`short`,day:`numeric`,weekday:`short`,hour:`numeric`,minute:`2-digit`})}catch{return t??``}},Ai=e=>e===null?`safe`:e>=80?`critical`:e>=50?`warn`:`safe`,ji=e=>e===`5h`?$(`quota.window.5h`):e===`7d`?$(`quota.window.7d`):e===`7d-sonnet`?$(`quota.window.7dSonnet`):e===`7d-opus`?$(`quota.window.7dOpus`):e===`weekly`?$(`quota.window.weekly`):e===`daily`?$(`quota.window.daily`):e===`monthly`?$(`quota.window.monthly`):e===`credits`?$(`quota.window.credits`):e===`credits_balance`?$(`quota.window.creditsBalance`):e===`billing_cycle`?$(`quota.window.billingCycle`):e===`auto`?$(`quota.window.auto`):e===`api`?$(`quota.window.api`):e===`plan_limit`?$(`quota.window.planLimit`):e===`on_demand`?$(`quota.window.onDemand`):e===`session`?$(`quota.window.session`):e===`premium`?$(`quota.window.premium`):e===`chat`?$(`quota.window.chat`):e===`completions`?$(`quota.window.completions`):e===`premium_interactions`?$(`quota.window.premiumInteractions`):e,Mi=e=>{let t=e.toLowerCase().trim();if(t===`5h`)return 18e3;if(t===`7d`||t===`weekly`||t===`7d-sonnet`||t===`7d-opus`)return 604800;if(t===`monthly`)return 2592e3;if(t===`24h`||t===`daily`)return 86400;if(t===`1h`)return 3600;let n=t.match(/^(\d+)h$/);if(n)return parseInt(n[1],10)*3600;let r=t.match(/^(\d+)d$/);return r?parseInt(r[1],10)*86400:null},Ni=(e,t,n,r)=>{let i=n;if(i===null&&r&&(i=Mi(r)),e===null||t===null||i===null||i<=0)return null;let a=Math.max(0,(t-Date.now())/1e3),o=Math.max(0,Math.min(i,i-a)),s=Math.max(0,Math.min(1,o/i)),c=e/100,l=e>=100&&a>0,u;u=s>.01?Math.min(999,c/s*100):e;let d;d=l?`exhausted`:c<=s?`on-track`:u<=130?`slightly-fast`:`too-fast`;let f=i>=432e3,p=f?86400:3600,m=f?`d`:`h`,h=i/p,g=e/Math.max(o/p,h*.01),_=Number.isFinite(g)?`${Math.min(999.9,Math.max(0,g)).toFixed(1)}%/${m}`:`-`,v=u>100?`+${Math.round(u)}%`:`${Math.round(u)}%`,y=null,b=i/86400;return b>=7&&(y=100/b),{elapsedRatio:s,usageRatio:c,predictedFinalPercent:u,remainingSeconds:a,isExhausted:l,elapsedSeconds:o,totalSeconds:i,status:d,paceRateText:_,predictText:v,dailyAllocationPercent:y}},Pi=e=>{switch(e){case`exhausted`:case`too-fast`:return`var(--status-error)`;case`slightly-fast`:return`var(--status-warning)`;case`on-track`:return`var(--status-success)`}},Fi=e=>{let t=Math.floor(Math.max(0,Math.floor(e))/60),n=Math.floor(t/60),r=Math.floor(n/24),i=n%24,a=t%60;return r>0?`${r}d ${i}h`:n>0?`${n}h`:t===0?`<1m`:`${a}m`},Ii=e=>Math.min(100,Math.max(0,e*100)),Li=(e,t)=>me(pe.getState().dictionary,e,t),Ri=e=>{let t=new Date(e),n=new Date,r=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),i=new Date(n);return i.setDate(n.getDate()-1),r(t,n)?Li(`common.date.today`):r(t,i)?Li(`common.date.yesterday`):t.toLocaleDateString(V(),{month:`short`,day:`numeric`,year:`numeric`}).replace(`,`,``)},zi=e=>{let t=new Date;if(((e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate())(new Date(e),t)){let t=Date.now()-e;return t<6e4?Li(`common.relative.justNow`):t<36e5?Li(`common.relative.minutesAgoShort`,{count:Math.floor(t/6e4)}):Li(`common.relative.hoursAgoShort`,{count:Math.floor(t/36e5)})}return Ri(e)},Bi=e=>{let t=Math.max(0,Date.now()-e),n=6e4,r=60*n,i=24*r,a=7*i,o=365*i;return t<r?Li(`common.relative.minutesAgoCompact`,{count:Math.max(1,Math.floor(t/n))}):t<i?Li(`common.relative.hoursAgoCompact`,{count:Math.floor(t/r)}):t<a?Li(`common.relative.daysAgoCompact`,{count:Math.floor(t/i)}):t<5*a?Li(`common.relative.weeksAgoCompact`,{count:Math.floor(t/a)}):t<o?Li(`common.relative.monthsAgoCompact`,{count:Math.floor(t/2592e6)}):Li(`common.relative.yearsAgoCompact`,{count:Math.floor(t/o)})},Vi=(e,t)=>Hi(l(e),l(t)),Hi=(e,t)=>!e||!t?!1:e===t?!0:t===`/`?e.startsWith(`/`):e.startsWith(`${t}/`),Ui=e=>e.toLowerCase().replace(/^opencode[/-]?/i,``).replace(/[-_]/g,``).trim(),Wi=(e,t)=>e?Ui(e)!==Ui(t):!1,Gi=e=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim().length>0){let t=Number(e);if(Number.isFinite(t))return t}},Ki=e=>Gi(e.time?.created)??0,qi=(e,t,n)=>{let r=n.has(e.id),i=n.has(t.id);return r===i?r&&i?Ki(t)-Ki(e):Ce(t)-Ce(e):r?-1:1},Ji=e=>{let t=new Map;return e.forEach(e=>{t.set(e.id,e)}),Array.from(t.values())},Yi=e=>`__archived__:${e}`,Xi=(e,t)=>{let n=l(e.directory??null),r=l(e.project?.worktree??null),i=n??r;if(!i)return`unassigned`;if(t&&i===t)return`project root`;let a=(t&&i.startsWith(`${t}/`)?i.slice(t.length+1):i).split(`/`).filter(Boolean);return a[a.length-1]??`unassigned`},Zi=`box-border w-full px-2 py-1.5 text-left typography-micro text-muted-foreground/70 select-none`,Qi=`bg-[color-mix(in_srgb,var(--surface-foreground)_6%,transparent)] dark:bg-[color-mix(in_srgb,var(--surface-foreground)_11%,transparent)]`,$i=`hover:bg-[color-mix(in_srgb,var(--surface-foreground)_3.5%,transparent)] dark:hover:bg-[color-mix(in_srgb,var(--surface-foreground)_8%,transparent)]`,ea=e=>{let t=Math.max(0,e);return t===0?8:30+(t-1)*14},ta=(e,t)=>{if(!t)return e;let n=e.toLowerCase(),r=t.toLowerCase(),i=r.length;if(i===0)return e;let a=[],o=0,s=n.indexOf(r,o);for(;s!==-1;){s>o&&a.push(e.slice(o,s));let t=e.slice(s,s+i);a.push((0,Z.jsx)(`mark`,{className:`bg-primary text-primary-foreground ring-1 ring-primary/90`,children:t},`${s}-${t}`)),o=s+i,s=n.indexOf(r,o)}return o<e.length&&a.push(e.slice(o)),a.length>0?a:e},na=[`standalone`,`minimal-ui`,`fullscreen`,`window-controls-overlay`],ra=`openchamber.pwaRecentSessions`,ia=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(display-mode: ${e})`).matches,aa=()=>typeof window>`u`?`browser`:typeof document<`u`&&document.referrer.startsWith(`android-app://`)?`twa`:window.navigator.standalone?`standalone`:na.find(e=>ia(e))??`browser`,oa=864e5,sa=5,ca=864e5,la=e=>e.time?.updated??e.time?.created??0,ua=({sessions:e,currentSessionId:t,cutoffDays:n,keepRecent:r=sa,now:i=Date.now()})=>{if(!Array.isArray(e)||n<=0)return[];let a=i-n*oa,o=[...e].sort((e,t)=>la(t)-la(e)),s=new Set(o.slice(0,r).map(e=>e.id));return o.filter(e=>{if(!e?.id||s.has(e.id)||e.id===t||e.share)return!1;let n=la(e);return n?n<a:!1}).map(e=>e.id)},da=e=>{let t=typeof e==`object`?e:void 0,n=t?.autoRun!==!1,r=typeof e==`boolean`?e:t?.enabled??!0,i=ve(e=>e.currentSessionId),a=ve(e=>e.isLoading),o=xe(e=>e.activeSessions),s=xe(e=>e.hasLoadedFullCatalog),c=k(e=>e.autoDeleteEnabled),l=k(e=>e.autoDeleteAfterDays),u=k(e=>e.sessionRetentionAction),d=k(e=>e.autoDeleteLastRunAt),f=k(e=>e.setAutoDeleteLastRunAt),[p,m]=Q.useState(!1),h=Q.useRef(!1);Q.useEffect(()=>{if(!r||!n||!c||l<=0)return;let e=window.setTimeout(()=>{Se(_e())},8e3);return()=>window.clearTimeout(e)},[l,c,n,r]);let g=Q.useMemo(()=>l<=0?[]:ua({sessions:o,currentSessionId:i,cutoffDays:l}),[l,i,o]),_=Q.useCallback(async({force:e=!1}={})=>{if(h.current)return{completedIds:[],failedIds:[],action:u,skippedReason:`running`};if((!c||l<=0)&&!e)return{completedIds:[],failedIds:[],action:u,skippedReason:`disabled`};if(a)return{completedIds:[],failedIds:[],action:u,skippedReason:`loading`};let t=Date.now();if(!e&&d&&t-d<ca)return{completedIds:[],failedIds:[],action:u,skippedReason:`cooldown`};let{activeSessions:n}=await Se(_e());if(n.length===0)return{completedIds:[],failedIds:[],action:u,skippedReason:`no-candidates`};let r=ua({sessions:n,currentSessionId:i,cutoffDays:l,now:t});if(r.length===0)return f(t),{completedIds:[],failedIds:[],action:u,skippedReason:`no-candidates`};h.current=!0,m(!0);try{let e=new Map(n.map(e=>[e.id,e])),t=[],i=[];for(let n of r){let r=e.get(n),a=r?ye(r):null;if(!a){i.push(n);continue}try{u===`archive`?await O.updateSession(n,{time:{archived:Date.now()}},a):await O.deleteSession(n,a),t.push(n)}catch{i.push(n)}}return u===`archive`?xe.getState().archiveSessions(t):xe.getState().removeSessions(t),{completedIds:t,failedIds:i,action:u}}finally{h.current=!1,m(!1),f(Date.now())}},[l,c,d,i,a,u,f]);return Q.useEffect(()=>{r&&n&&(!c||l<=0||a||!s||o.length===0||d&&Date.now()-d<ca||_())},[l,c,d,n,r,s,o.length,a,_]),{candidates:g,isRunning:p,runCleanup:_,keepRecentCount:sa,action:u}};export{Xn as $,rt as $t,xi as A,Yt as At,Nr as B,_t as Bt,Fi as C,fn as Ct,Ti as D,un as Dt,Ai as E,sn as Et,ii as F,Vt as Ft,br as G,bt as Gt,hr as H,gt as Ht,ai as I,Ct as It,er as J,Nt as Jt,_r as K,Pt as Kt,oi as L,mt as Lt,li as M,Wt as Mt,pi as N,Bt as Nt,wi as O,hn as Ot,mi as P,Ht as Pt,Qn as Q,nt as Qt,ri as R,vt as Rt,Oi as S,rn as St,Pi as T,ln as Tt,vr as U,xt as Ut,wr as V,ht as Vt,yr as W,St as Wt,Jn as X,It as Xt,Kn as Y,Ft as Yt,Yn as Z,tt as Zt,Xi as _,yn as _t,Qi as a,Hn as at,Ei as b,dn as bt,Ji as c,Ln as ct,Yi as d,Fn as dt,Zn as et,ea as f,zn as ft,ta as g,gn as gt,Ui as h,xn as ht,Zi as i,Bn as it,bi as j,Gt as jt,Ci as k,mn as kt,Bi as l,Rn as lt,Vi as m,jn as mt,ra as n,qn as nt,$i as o,Pn as ot,Wi as p,kn as pt,ar as q,Mt as qt,aa as r,Sn as rt,qi as s,In as st,da as t,$n as tt,zi as u,Vn as ut,Ii as v,_n as vt,ji as w,pn as wt,ki as x,cn as xt,Ni as y,vn as yt,Zr as z,yt as zt};
2
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{i as t,l as n}from"./runtime-switch-LvWDU-SL.js";import{n as r}from"./runtime-fetch-zIalUnbb.js";import{Cn as i,Jt as a,Qt as o,Yt as s,d as c,tt as l,u}from"./persistence-DwRBC4zl.js";import{h as d}from"./desktopHosts-B052a4UK.js";import{i as f,n as p,r as m}from"./desktopRelayRestore-OjKNXr10.js";import{A as h,D as g,E as _,F as v,I as y,M as b,N as x,P as S,j as C,k as w,nt as T,rt as E,tt as D}from"./vendor-base-ui-CnHfUmDN.js";import{Nt as O}from"./platform-DQ5_LNKO.js";import{t as k}from"./useUIStore-CxOoCv7B.js";import{o as A}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as j}from"./vendor-react-DLPElpoQ.js";import{n as M}from"./vendor-tanstack-query-core-BWz0ose6.js";import{i as ee,r as te,s as N}from"./vendor-tanstack-react-query-D7pys_c9.js";import{P as ne,V as P,a as re,f as F,l as ie}from"./vendor-codemirror-autocomplete-DHomsvW7.js";import{c as I,o as L,r as R}from"./vendor-codemirror-lang-angular-DShkBD6m.js";import{n as ae,r as z}from"./vendor-codemirror-lang-json-CYJRHck9.js";import{n as oe}from"./vendor-codemirror-lang-markdown-WORgx6ZD.js";import{n as B}from"./vendor-codemirror-lang-python-Du6XQ8Zw.js";import{O as se}from"./vendor-codemirror-legacy-modes-DuRAjNvB.js";import{n as ce}from"./vendor-reactuses-core-BnW6GxJt.js";import{d as le,f as ue,l as de,p as V,r as H,t as fe}from"./button-bhVnVYB_.js";import{i as pe,t as me}from"./store-BoixGrYS.js";import{Ja as he,Xa as ge,aa as _e,c as ve,fr as ye,ho as be,hr as xe,or as Se,ra as U,ta as Ce,to as we,yr as Te}from"./useMobileNavigationStore-C4HhoiC4.js";import{t as W}from"./AgentAvatar-CUDJ3_nZ.js";import{n as G}from"./Icon-C9ZHbwqp.js";import{i as Ee,n as De,r as Oe,t as ke}from"./vendor-simplewebauthn-browser-Dwhcdg_5.js";import{B as Ae,C as je,D as Me,H as Ne,O as Pe,S as Fe,T as Ie,U as Le,V as Re,k as ze,w as Be}from"./projectMeta-D2rOiejm.js";import{t as Ve}from"./input-8Te_vPwB.js";import{t as He}from"./useThemeSystem-DMzWVJaW.js";import{i as Ue}from"./OverlayScrollbar-C7fAOAKT.js";import{n as We,r as Ge,t as Ke}from"./dropdown-menu.styles-Bzo6L3FH.js";import{n as qe}from"./textarea-DRL916s6.js";import{t as Je}from"./vendor-codemirror-language-data-BfYFhIH1.js";var K=j(),Ye=[`desktopHostSwitch`],Xe=class extends Error{result;host;constructor(e,t){super(e.reason),this.name=`DesktopHostSwitchError`,this.result=e,this.host=t}},Ze=(e,t)=>me(pe.getState().dictionary,e,t),Qe=async e=>{let{host:t}=e;if(t.id===`local`){let r=(e.localApiOrigin||``).trim();if(!r)throw new Xe({ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`},t);return n({apiBaseUrl:r,clientToken:e.localClientToken||null,runtimeKey:m(t)}),{ok:!0,via:`direct`,status:{status:`ok`,latencyMs:0}}}let r=await f(t,{cachedProbe:e.cachedProbe});if(!r.ok)throw new Xe(r,t);return r},$e=null,et=()=>$e||($e=new M(u,{mutationKey:Ye,mutationFn:Qe,onError:(e,t)=>{if(e instanceof Xe&&e.result.reason!==`unsupported`){if(e.result.status.status===`auth`){Te.error(Ze(`desktopHostSwitcher.status.authRequired`));return}Te.error(Ze(`desktopHostSwitcher.toast.instanceUnreachable`,{host:d(t.host.label)}))}}}),$e.subscribe(()=>void 0),$e),tt=async e=>{if(p(e.host))return{ok:!0,via:`direct`,status:e.cachedProbe?.status===`ok`?e.cachedProbe:{status:`ok`,latencyMs:0}};if(u.isMutating({mutationKey:Ye})>0)return{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unsupported`};try{return await et().mutate(e)}catch(e){if(e instanceof Xe)return e.result;throw e}},nt=()=>{let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={mutationKey:Ye},e[0]=t):t=e[0],te(t)>0},rt=()=>{let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={filters:{mutationKey:Ye,status:`pending`},select:it},e[0]=t):t=e[0],ee(t)[0]?.host.id??null};function it(e){return e.state.variables}var q=e=>typeof e==`object`&&!!e,J=(e,t)=>{let n=e[t];return typeof n==`string`?n:null},Y=(e,t)=>{let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:null},X=(e,t)=>{let n=e[t];return typeof n==`boolean`?n:null},at=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],ot=()=>a()?(e,t)=>s(e,t):null,st=e=>{if(!q(e))return;let t=X(e,`enabled`)??!1,n=J(e,`store`)?.toLowerCase()===`settings`?`settings`:`never`,r=J(e,`value`);return{enabled:t,store:n,...r?{value:r}:{}}},ct=e=>e===`remote`||e===`dynamic`?e:`local`,lt=e=>{if(!q(e))return null;let t=J(e,`id`);if(!t)return null;let n=X(e,`enabled`)??!0,r=ct(J(e,`type`)),i=J(e,`localHost`)||J(e,`local_host`)||void 0,a=Y(e,`localPort`)??Y(e,`local_port`)??void 0,o=J(e,`remoteHost`)||J(e,`remote_host`)||void 0,s=Y(e,`remotePort`)??Y(e,`remote_port`)??void 0;return{id:t,enabled:n,type:r,...i?{localHost:i}:{},...typeof a==`number`?{localPort:a}:{},...o?{remoteHost:o}:{},...typeof s==`number`?{remotePort:s}:{}}},ut=e=>{if(!q(e))return null;let t=J(e,`id`),n=J(e,`sshCommand`)||J(e,`ssh_command`);if(!t||!n)return null;let r=J(e,`nickname`),i=e.sshParsed,a=q(i)?{destination:J(i,`destination`)||``,args:at(i.args)}:void 0,o=q(e.remoteOpenchamber)?e.remoteOpenchamber:q(e.remote_openchamber)?e.remote_openchamber:{},s=q(e.localForward)?e.localForward:q(e.local_forward)?e.local_forward:{},c=q(e.auth)?e.auth:{},l=J(o,`mode`)?.toLowerCase()===`external`?`external`:`managed`,u=J(o,`installMethod`)||J(o,`install_method`),d=u===`npm`||u===`download_release`||u===`upload_bundle`?u:`bun`,f=J(s,`bindHost`)||J(s,`bind_host`)||`127.0.0.1`,p=f===`localhost`||f===`0.0.0.0`?f:`127.0.0.1`,m=(Array.isArray(e.portForwards)?e.portForwards:Array.isArray(e.port_forwards)?e.port_forwards:[]).map(e=>lt(e)).filter(e=>!!e),h=Y(o,`preferredPort`)??Y(o,`preferred_port`),g=Y(s,`preferredLocalPort`)??Y(s,`preferred_local_port`),_=st(c.sshPassword||c.ssh_password),v=st(c.openchamberPassword||c.openchamber_password);return{id:t,...r?{nickname:r}:{},sshCommand:n,...a&&a.destination?{sshParsed:a}:{},connectionTimeoutSec:Y(e,`connectionTimeoutSec`)??Y(e,`connection_timeout_sec`)??60,remoteOpenchamber:{mode:l,keepRunning:X(o,`keepRunning`)??X(o,`keep_running`)??!0,relayHost:X(o,`relayHost`)??X(o,`relay_host`)??!0,...h?{preferredPort:h}:{},installMethod:d,uploadBundleOverSsh:X(o,`uploadBundleOverSsh`)??X(o,`upload_bundle_over_ssh`)??!1},localForward:{...g?{preferredLocalPort:g}:{},bindHost:p},auth:{..._?{sshPassword:_}:{},...v?{openchamberPassword:v}:{}},portForwards:m}},dt=e=>{switch(e){case`config_resolved`:case`auth_check`:case`master_connecting`:case`remote_probe`:case`installing`:case`updating`:case`server_detecting`:case`server_starting`:case`forwarding`:case`ready`:case`degraded`:case`error`:return e;default:return`idle`}},ft=e=>{if(!q(e))return null;let t=J(e,`id`);return t?{id:t,phase:dt(J(e,`phase`)),...J(e,`detail`)?{detail:J(e,`detail`)||void 0}:{},...J(e,`localUrl`)||J(e,`local_url`)?{localUrl:J(e,`localUrl`)||J(e,`local_url`)||void 0}:{},...typeof(Y(e,`localPort`)??Y(e,`local_port`))==`number`?{localPort:Y(e,`localPort`)??Y(e,`local_port`)??void 0}:{},...typeof(Y(e,`remotePort`)??Y(e,`remote_port`))==`number`?{remotePort:Y(e,`remotePort`)??Y(e,`remote_port`)??void 0}:{},startedByUs:X(e,`startedByUs`)??X(e,`started_by_us`)??!1,retryAttempt:Y(e,`retryAttempt`)??Y(e,`retry_attempt`)??0,requiresUserAction:X(e,`requiresUserAction`)??X(e,`requires_user_action`)??!1,...J(e,`errorCode`)||J(e,`error_code`)?{errorCode:J(e,`errorCode`)||J(e,`error_code`)||void 0}:{},updatedAtMs:Y(e,`updatedAtMs`)??Y(e,`updated_at_ms`)??Date.now()}:null},pt=e=>{if(!q(e))return null;let t=J(e,`host`),n=J(e,`source`),r=J(e,`sshCommand`)||J(e,`ssh_command`);return!t||!n||!r?null:{host:t,source:n,sshCommand:r,pattern:X(e,`pattern`)??!1}},mt=(e,t)=>({id:e,sshCommand:t,connectionTimeoutSec:60,remoteOpenchamber:{mode:`managed`,keepRunning:!0,relayHost:!0,installMethod:`bun`,uploadBundleOverSsh:!1},localForward:{bindHost:`127.0.0.1`},auth:{},portForwards:[]}),ht=async()=>{let e=ot();if(!e)return{instances:[]};let t=await e(`desktop_ssh_instances_get`);return q(t)?{instances:(Array.isArray(t.instances)?t.instances:Array.isArray(t.desktopSshInstances)?t.desktopSshInstances:[]).map(e=>ut(e)).filter(e=>!!e)}:{instances:[]}},gt=async e=>{let t=ot();t&&await t(`desktop_ssh_instances_set`,{config:{instances:e.instances}})},_t=async()=>{let e=ot();if(!e)return[];let t=await e(`desktop_ssh_import_hosts`);return Array.isArray(t)?t.map(e=>pt(e)).filter(e=>!!e):[]},vt=async e=>{let t=ot();t&&await t(`desktop_ssh_connect`,{id:e})},yt=async e=>{let t=ot();t&&await t(`desktop_ssh_disconnect`,{id:e})},bt=async e=>{let t=ot();if(!t)return[];let n=await t(`desktop_ssh_status`,{...e?{id:e}:{}});return Array.isArray(n)?n.map(e=>ft(e)).filter(e=>!!e):[]},xt=async(e,t)=>{let n=ot();if(!n)return[];let r=await n(`desktop_ssh_logs`,{id:e,...typeof t==`number`?{limit:t}:{}});return Array.isArray(r)?r.filter(e=>typeof e==`string`):[]},St=async e=>{let t=ot();t&&await t(`desktop_ssh_logs_clear`,{id:e})},Ct=(e,t)=>{let n=Math.max(0,Math.trunc(Number(e.fileGroups)||0)),r=Math.max(0,Math.trunc(Number(e.singleFiles)||0)),i=Math.max(0,Math.trunc(Number(e.directories)||0));return{fileGroups:Array.from({length:n},()=>!0),singleFiles:Array.from({length:r},()=>!0),directories:Array.from({length:i},()=>!0),agentsRoot:!0,authFile:t?.includeAuthFile===!0}},wt=e=>{if(!q(e))return null;let t=J(e,`path`),n=Y(e,`bytes`);return!t||n===null?null:{path:t,bytes:n}},Tt=e=>{if(!q(e))return null;let t=J(e,`path`),n=Y(e,`fileCount`)??Y(e,`file_count`),r=Y(e,`bytes`);return!t||n===null||r===null?null:{path:t,fileCount:n,bytes:r}},Et=e=>{if(e==null||!q(e))return null;let t=Y(e,`fileCount`)??Y(e,`file_count`),n=Y(e,`bytes`);return t===null||n===null?null:{fileCount:t,bytes:n}},Dt=e=>{if(e==null||!q(e))return null;let t=Y(e,`bytes`);return t===null?null:{bytes:t}},Ot=e=>{if(!q(e))return null;let t=Array.isArray(e.files)?e.files:null,n=Array.isArray(e.directories)?e.directories:null,r=at(e.deletes),i=Y(e,`totalBytes`)??Y(e,`total_bytes`);if(!t||!n||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=t.map(e=>wt(e)).filter(e=>!!e),o=n.map(e=>Tt(e)).filter(e=>!!e);if(a.length!==t.length||o.length!==n.length)return null;let s=e.agentsRoot??e.agents_root,c=s==null?null:Et(s);if(s!=null&&c===null)return null;let l=e.authFile??e.auth_file,u=l==null?null:Dt(l),d=e.direction===`pull`||e.direction===`push`?e.direction:void 0,f=e.selections,p=q(f)?{fileGroups:Array.isArray(f.fileGroups)?f.fileGroups.map(e=>e!==!1):[],singleFiles:Array.isArray(f.singleFiles)?f.singleFiles.map(e=>e!==!1):[],directories:Array.isArray(f.directories)?f.directories.map(e=>e!==!1):[],agentsRoot:f.agentsRoot!==!1,authFile:f.authFile===!0}:void 0,m=kt(e.selectionShape??e.selection_shape);return{files:a,directories:o,agentsRoot:c,authFile:u,deletes:r,totalBytes:i,...d?{direction:d}:{},...p?{selections:p}:{},...m?{selectionShape:m}:{}}},kt=e=>{if(!q(e))return null;let t=Y(e,`fileGroups`)??Y(e,`file_groups`),n=Y(e,`singleFiles`)??Y(e,`single_files`),r=Y(e,`directories`);return t===null||n===null||r===null||t<0||n<0||r<0?null:{fileGroups:t,singleFiles:n,directories:r}},At=e=>{if(!q(e))return null;let t=Ot(e.plan);if(!t)return null;let n=kt(e.selectionShape??e.selection_shape)??t.selectionShape??null;return{plan:t,remoteExisting:at(e.remoteExisting??e.remote_existing),remoteAgentsRootExists:X(e,`remoteAgentsRootExists`)??X(e,`remote_agents_root_exists`)??!1,remoteAuthFileExists:X(e,`remoteAuthFileExists`)??X(e,`remote_auth_file_exists`)??!1,...n?{selectionShape:n}:{}}},jt=e=>{if(!q(e)||X(e,`ok`)!==!0)return null;let t=Y(e,`files`),n=Y(e,`directories`),r=Y(e,`deletes`),i=Y(e,`totalBytes`)??Y(e,`total_bytes`);if(t===null||n===null||r===null||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=e.agentsRoot??e.agents_root,o=null;if(a!=null){if(!q(a))return null;let e=Y(a,`fileCount`)??Y(a,`file_count`);if(e===null)return null;o={fileCount:e}}let s=e.authFile??e.auth_file,c=s==null?null:Dt(s);return{ok:!0,files:t,directories:n,deletes:r,totalBytes:i,agentsRoot:o,authFile:c}},Mt=async(e={})=>{let t=ot();if(!t)return console.error(`[desktopSsh] config sync local scan skipped: desktop IPC bridge is unavailable in this window`),null;let n=await t(`desktop_ssh_sync_opencode_config`,{stage:`local`,...e.direction?{direction:e.direction}:{},...e.selections?{selections:e.selections}:{}});if(!q(n))return console.error(`[desktopSsh] config sync local scan returned a non-object payload`,n),null;let r=Ot(n.plan);if(!r)return console.error(`[desktopSsh] config sync local scan plan payload was not recognized`,n),null;let i=kt(n.selectionShape??n.selection_shape)??r.selectionShape??null;return i?{...r,selectionShape:i}:r},Nt=async(e,t={})=>{let n=ot();if(!n)return console.error(`[desktopSsh] config sync preview skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=At(r);return i||console.error(`[desktopSsh] config sync preview payload was not recognized`,r),i},Pt=async(e,t={})=>{let n=ot();if(!n)return console.error(`[desktopSsh] config sync apply skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,apply:!0,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=jt(r);return i||console.error(`[desktopSsh] config sync apply payload was not recognized`,r),i},Ft=async(e,t={})=>{let n=ot();if(!n)return[];let r=await n(`desktop_ssh_sync_runs_list`,{id:e,...t.targetKind?{targetKind:t.targetKind}:{}});return Array.isArray(r)?r.filter(e=>q(e)&&typeof e.syncRunId==`string`&&typeof e.targetId==`string`):[]},It=async e=>{if(!a())return async()=>{};let t=window.__OPENCHAMBER_DESKTOP__?.listen;if(typeof t!=`function`)return async()=>{};let n=await t(`openchamber:ssh-instance-status`,t=>{let n=ft(t?.payload);n&&e(n)});return async()=>{await n()}},Lt=new Set([`nodeRuntimeMissing`,`packageManagerMissing`,`nativeBinding`,`openchamberCliMissing`,`openchamberRegistry`,`openchamberInstall`,`openchamberCliIncompatible`,`opencodeInstall`,`serverStart`,`sshAuth`,`sshUnreachable`,`timeout`,`unknown`]),Rt=e=>typeof e==`string`&&Lt.has(e),zt=e=>{let t=String(e||``);return/requires Node\.js \d+|no supported Node runtime/i.test(t)?`nodeRuntimeMissing`:/neither bun nor npm/i.test(t)?`packageManagerMissing`:/better-sqlite3|node_gyp_bins|gyp ERR|failed to prepare better-sqlite3/i.test(t)?`nativeBinding`:/OpenChamber installation completed but the executable is unavailable/i.test(t)?`openchamberCliMissing`:/could not reach the npm registry|ENOTFOUND|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|CERT_HAS_EXPIRED|UNABLE_TO_GET_ISSUER_CERT|self-signed certificate|registry\.npmjs|npm error code E404|npm ERR! code E404|getaddrinfo/i.test(t)?`openchamberRegistry`:/Failed to install OpenChamber/i.test(t)?`openchamberInstall`:/Unknown option:\s*--relay-host|does not advertise --relay-host|does not support --relay-host/i.test(t)||/Unknown option:/i.test(t)?`openchamberCliIncompatible`:/Failed to install OpenCode|OpenCode CLI/i.test(t)?`opencodeInstall`:/failed to become reachable|Managed OpenChamber server failed/i.test(t)?`serverStart`:/Permission denied|Authentication failed|publickey|keyboard-interactive/i.test(t)?`sshAuth`:/Could not resolve hostname|Connection refused|Connection timed out|ControlMaster connection timed out|SSH master process exited|Network is unreachable/i.test(t)?`sshUnreachable`:/Timed out waiting for SSH|Timed out waiting for forwarded/i.test(t)?`timeout`:`unknown`},Bt=(e,t)=>Rt(e)?e:zt(t),Vt=e=>{switch(e){case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.title`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.title`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.title`;case`openchamberCliMissing`:return`desktopHostSwitcher.sshError.openchamberCliMissing.title`;case`openchamberRegistry`:return`desktopHostSwitcher.sshError.openchamberRegistry.title`;case`openchamberInstall`:return`desktopHostSwitcher.sshError.openchamberInstall.title`;case`openchamberCliIncompatible`:return`desktopHostSwitcher.sshError.openchamberCliIncompatible.title`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.title`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.title`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.title`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.title`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.title`;default:return`desktopHostSwitcher.sshError.unknown.title`}},Ht=e=>{switch(e){case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.guidance`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.guidance`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.guidance`;case`openchamberCliMissing`:return`desktopHostSwitcher.sshError.openchamberCliMissing.guidance`;case`openchamberRegistry`:return`desktopHostSwitcher.sshError.openchamberRegistry.guidance`;case`openchamberInstall`:return`desktopHostSwitcher.sshError.openchamberInstall.guidance`;case`openchamberCliIncompatible`:return`desktopHostSwitcher.sshError.openchamberCliIncompatible.guidance`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.guidance`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.guidance`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.guidance`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.guidance`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.guidance`;default:return`desktopHostSwitcher.sshError.unknown.guidance`}},Ut=e=>e===`unknown`||e===`openchamberCliIncompatible`,Wt=(e,t,n)=>{let r=typeof n==`string`?n.trim():``;return!Ut(t)||!r||r===e?e:`${e}\n${r}`},Z=T();function Gt(e){let t=(0,K.c)(27),{errorCode:n,detail:r,className:i}=e,{t:a}=ue(),o,s,c,l,u,d;if(t[0]!==i||t[1]!==r||t[2]!==n||t[3]!==a){let e=Bt(n,r);o=a(Ht(e));let f;t[10]===r?f=t[11]:(f=typeof r==`string`?r.trim():``,t[10]=r,t[11]=f),s=f,c=Ut(e)&&!!s&&s!==o,t[12]===i?d=t[13]:(d=H(`space-y-1`,i),t[12]=i,t[13]=d),l=`typography-ui-label text-[var(--status-error)]`,u=a(Vt(e)),t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9];let f;t[14]!==l||t[15]!==u?(f=(0,Z.jsx)(`p`,{className:l,children:u}),t[14]=l,t[15]=u,t[16]=f):f=t[16];let p;t[17]===o?p=t[18]:(p=(0,Z.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:o}),t[17]=o,t[18]=p);let m;t[19]!==s||t[20]!==c?(m=c?(0,Z.jsx)(`p`,{className:`typography-meta break-words text-muted-foreground`,children:s}):null,t[19]=s,t[20]=c,t[21]=m):m=t[21];let h;return t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,Z.jsxs)(`div`,{className:d,children:[f,p,m]}),t[22]=d,t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}var Q=e(E(),1),Kt=[.2,.45,.15,.55,.35,.1,.5,.25,.4,.3,.45,.15,.55,.2,.35,.1],qt=[.3,.15,.45,.25,.5,.35,.1,.4,.2,.55,.3,.15,.45,.25,.4,.2],Jt=(e,t,n,r,i=4)=>{let a=[];for(let o=0;o<i;o++)for(let s=0;s<i;s++){let c=s/i,l=(s+1)/i,u=o/i,d=(o+1)/i,f=(e,t,n)=>e+(t-e)*n,p=(e,t,n,r,i,a)=>{let o=f(e,t,i),s=f(r,n,i);return f(o,s,a)},m={x:p(e.x,t.x,n.x,r.x,c,u),y:p(e.y,t.y,n.y,r.y,c,u)},h={x:p(e.x,t.x,n.x,r.x,l,u),y:p(e.y,t.y,n.y,r.y,l,u)},g={x:p(e.x,t.x,n.x,r.x,l,d),y:p(e.y,t.y,n.y,r.y,l,d)},_={x:p(e.x,t.x,n.x,r.x,c,d),y:p(e.y,t.y,n.y,r.y,c,d)};a.push({path:`M${m.x} ${m.y} L${h.x} ${h.y} L${g.x} ${g.y} L${_.x} ${_.y} Z`,row:o,col:s})}return a},Yt=({className:e=``,width:t=70,height:n=70,isAnimated:r=!1})=>{let{t:i}=ue(),a=He(),o=!0;a?o=a.currentTheme.metadata.variant!==`light`:typeof window<`u`&&(o=window.matchMedia(`(prefers-color-scheme: dark)`).matches);let s=(0,Q.useMemo)(()=>{if(a)return a.currentTheme.colors.surface.foreground;if(typeof window<`u`){let e=getComputedStyle(document.documentElement).getPropertyValue(`--splash-stroke`).trim();if(e)return e}return o?`white`:`black`},[a,o]),c=(0,Q.useMemo)(()=>typeof window>`u`||typeof CSS>`u`||typeof CSS.supports!=`function`?!1:CSS.supports(`color`,`color-mix(in srgb, white 50%, transparent)`),[]),l=(0,Q.useMemo)(()=>{if(a)return c?`color-mix(in srgb, ${s} 15%, transparent)`:o?`rgba(255,255,255,0.15)`:`rgba(0,0,0,0.15)`;if(typeof window<`u`){let e=getComputedStyle(document.documentElement).getPropertyValue(`--splash-face-fill`).trim();if(e)return e}return o?`rgba(255,255,255,0.15)`:`rgba(0,0,0,0.15)`},[a,c,s,o]),u=(0,Q.useMemo)(()=>{if(a)return c?`color-mix(in srgb, ${s} 35%, transparent)`:o?`rgba(255,255,255,0.35)`:`rgba(0,0,0,0.4)`;if(typeof window<`u`){let e=getComputedStyle(document.documentElement).getPropertyValue(`--splash-cell-fill`).trim();if(e)return e}return o?`rgba(255,255,255,0.35)`:`rgba(0,0,0,0.4)`},[a,c,s,o]),d=s,f=.866,p=.5,m={x:50,y:2},h={x:50-48*f,y:50-48*p},g={x:91.568,y:50-48*p},_={x:50,y:50},v={x:50-48*f,y:74},y={x:91.568,y:74},b={x:50,y:98},x=`matrix(0.866, 0.5, -0.866, 0.5, 50, ${(m.y+h.y+_.y+g.y)/4})`,S=Jt(h,_,b,v),C=Jt(_,g,y,b);return(0,Z.jsxs)(`svg`,{width:t,height:n,viewBox:`0 0 100 100`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:e,role:`img`,"aria-label":i(`openChamberLogo.aria.logo`),children:[r?(0,Z.jsx)(`style`,{children:`@keyframes oc-logo-glow{0%,100%{filter:drop-shadow(0 0 0 transparent)}50%{filter:drop-shadow(0 0 4px var(--oc-glow-color))}}.oc-logo-glow{animation:oc-logo-glow 1.8s ease-in-out infinite}@media (prefers-reduced-motion:reduce){.oc-logo-glow{animation:none}}`}):null,(0,Z.jsx)(`path`,{d:`M${_.x} ${_.y} L${h.x} ${h.y} L${v.x} ${v.y} L${b.x} ${b.y} Z`,fill:l,stroke:s,strokeWidth:`2`,strokeLinejoin:`round`}),S.map((e,t)=>(0,Z.jsx)(`path`,{d:e.path,fill:u,opacity:Kt[e.row*4+(3-e.col)]??.35},`left-${t}`)),(0,Z.jsx)(`path`,{d:`M${_.x} ${_.y} L${g.x} ${g.y} L${y.x} ${y.y} L${b.x} ${b.y} Z`,fill:l,stroke:s,strokeWidth:`2`,strokeLinejoin:`round`}),C.map((e,t)=>(0,Z.jsx)(`path`,{d:e.path,fill:u,opacity:qt[e.row*4+e.col]??.35},`right-${t}`)),(0,Z.jsx)(`path`,{d:`M${m.x} ${m.y} L${h.x} ${h.y} L${_.x} ${_.y} L${g.x} ${g.y} Z`,fill:`none`,stroke:s,strokeWidth:`2`,strokeLinejoin:`round`}),(0,Z.jsx)(`g`,{opacity:1,className:r?`oc-logo-glow`:void 0,style:r?{"--oc-glow-color":s}:void 0,children:(0,Z.jsxs)(`g`,{transform:`${x} scale(0.75)`,children:[(0,Z.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M-16 -20 L16 -20 L16 20 L-16 20 Z M-8 -12 L-8 12 L8 12 L8 -12 Z`,fill:d}),(0,Z.jsx)(`path`,{d:`M-8 -4 L8 -4 L8 12 L-8 12 Z`,fill:d,fillOpacity:`0.4`})]})})]})},Xt=`/auth/passkey/authenticate/options`,Zt=`/auth/passkey/authenticate/verify`,Qt=`/auth/passkey/register/options`,$t=`/auth/passkey/register/verify`,en=`/api/passkeys`,tn=`/auth/passkey/status`,nn=`/api/auth/reset`,rn={enabled:!1,hasPasskeys:!1,passkeyCount:0,rpID:null},an=async(e,t)=>r(e,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),on=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim())return t.error}catch{}return t},sn=e=>e instanceof Ee&&e.code===`ERROR_CEREMONY_ABORTED`,cn=()=>{Oe.cancelCeremony()},ln=()=>typeof window>`u`?{supported:!1,reason:`Passkeys are unavailable outside the browser.`}:window.isSecureContext?{supported:!0,reason:``}:{supported:!1,reason:`Passkeys require HTTPS or localhost.`},un=async()=>{let e=ln();if(!e.supported)throw Error(e.reason);let t=await an(Qt,{label:typeof navigator.userAgent==`string`&&navigator.userAgent.trim()?navigator.userAgent:`This device`});if(!t.ok)throw Error(await on(t,`Could not start passkey setup.`));let{requestId:n,optionsJSON:r}=await t.json(),i=await an($t,{requestId:n,response:await De({optionsJSON:r})});if(!i.ok)throw Error(await on(i,`Could not finish passkey setup.`));return i.json().catch(()=>null)},dn=async(e,t={})=>{let n=ln();if(!n.supported)throw Error(n.reason);let r=await an(Xt);if(!r.ok)throw Error(await on(r,`Passkey sign-in is not available right now.`));let{requestId:i,optionsJSON:a}=await r.json(),o=await an(Zt,{requestId:i,response:await ke({optionsJSON:a}),trustDevice:e,issueClientToken:t.issueClientToken===!0,clientLabel:t.clientLabel,clientKind:t.clientKind,dedupeKey:t.dedupeKey});if(!o.ok)throw Error(await on(o,`Passkey sign-in failed.`));return o.json().catch(()=>null)},fn=async()=>{let e=await r(tn,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return rn;let t=await e.json().catch(()=>null);return{enabled:t?.enabled===!0,hasPasskeys:t?.hasPasskeys===!0,passkeyCount:typeof t?.passkeyCount==`number`?t.passkeyCount:0,rpID:typeof t?.rpID==`string`&&t.rpID?t.rpID:null}},pn=async()=>{let e=await r(en,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)throw Error(await on(e,`Could not load passkeys.`));let t=await e.json().catch(()=>null);return Array.isArray(t?.passkeys)?t.passkeys:[]},mn=async e=>{let t=await r(`${en}/${encodeURIComponent(e)}`,{method:`DELETE`,credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok)throw Error(await on(t,`Could not remove passkey.`));return t.json().catch(()=>null)},hn=async()=>{let e=await an(nn);if(!e.ok)throw Error(await on(e,`Could not clear saved authentication.`));try{let{clearAssistantAttachmentCacheAll:e}=await A(async()=>{let{clearAssistantAttachmentCacheAll:e}=await import(`./assistant-attachment-cache-C0aRnFkj.js`).then(e=>e.t);return{clearAssistantAttachmentCacheAll:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])),{invalidateRuntimeAuthSession:t}=await A(async()=>{let{invalidateRuntimeAuthSession:e}=await import(`./runtime-auth-D66yq6ie.js`).then(e=>e.m);return{invalidateRuntimeAuthSession:e}},__vite__mapDeps([2,1]));await e(`auth-reset`),t()}catch{}return e.json().catch(()=>null)};function gn(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _n(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vn(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`leading-none font-semibold`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yn(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(`px-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var bn=class extends Q.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t,copied:!1}),console.error(`Error caught by boundary:`,e,t)}handleReset=()=>{this.setState({hasError:!1,error:void 0,errorInfo:void 0})};handleCopy=async()=>{let{strings:e}=this.props,t=`${this.state.error?String(this.state.error):e.unknownError}${this.state.error?.stack?`\n\nStack:\n${this.state.error.stack}`:``}${this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``}`;(await le(t)).ok&&(this.setState({copied:!0}),window.setTimeout(()=>{this.setState(e=>e.copied?{copied:!1}:null)},1500))};render(){let{strings:e}=this.props;return this.state.hasError?this.props.fallback?this.props.fallback:(0,Z.jsx)(`div`,{className:`p-4 flex items-center justify-center min-h-screen`,children:(0,Z.jsxs)(gn,{className:`w-full max-w-md`,children:[(0,Z.jsx)(_n,{className:`text-center`,children:(0,Z.jsxs)(vn,{className:`flex items-center justify-center gap-2 text-destructive`,children:[(0,Z.jsx)(G,{name:`error-warning`,className:`h-5 w-5`}),e.title]})}),(0,Z.jsxs)(yn,{className:`space-y-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground text-center`,children:e.description}),this.state.error&&(0,Z.jsxs)(`details`,{className:`text-xs font-mono bg-muted p-3 rounded`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer hover:bg-interactive-hover/80`,children:e.detailsSummary}),(0,Z.jsxs)(`pre`,{className:`mt-2 max-h-48 overflow-auto`,children:[this.state.error.toString(),this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``]})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(fe,{onClick:this.handleReset,variant:`outline`,className:`flex-1`,children:[(0,Z.jsx)(G,{name:`restart`,className:`h-4 w-4 mr-2`}),e.tryAgain]}),(0,Z.jsx)(fe,{onClick:this.handleCopy,variant:`outline`,className:`flex-1`,children:this.state.copied?e.copied:e.copy})]})]})]})}):this.props.children}},xn=e=>{let t=(0,K.c)(29),{children:n,fallback:r}=e,{t:i}=ue(),a;t[0]===i?a=t[1]:(a=i(`errorBoundary.state.unknownError`),t[0]=i,t[1]=a);let o;t[2]===i?o=t[3]:(o=i(`errorBoundary.title`),t[2]=i,t[3]=o);let s;t[4]===i?s=t[5]:(s=i(`errorBoundary.description`),t[4]=i,t[5]=s);let c;t[6]===i?c=t[7]:(c=i(`errorBoundary.actions.errorDetails`),t[6]=i,t[7]=c);let l;t[8]===i?l=t[9]:(l=i(`errorBoundary.state.componentStackLabel`),t[8]=i,t[9]=l);let u;t[10]===i?u=t[11]:(u=i(`errorBoundary.actions.tryAgain`),t[10]=i,t[11]=u);let d;t[12]===i?d=t[13]:(d=i(`errorBoundary.actions.copied`),t[12]=i,t[13]=d);let f;t[14]===i?f=t[15]:(f=i(`errorBoundary.actions.copy`),t[14]=i,t[15]=f);let p;t[16]!==a||t[17]!==o||t[18]!==s||t[19]!==c||t[20]!==l||t[21]!==u||t[22]!==d||t[23]!==f?(p={unknownError:a,title:o,description:s,detailsSummary:c,componentStackLabel:l,tryAgain:u,copied:d,copy:f},t[16]=a,t[17]=o,t[18]=s,t[19]=c,t[20]=l,t[21]=u,t[22]=d,t[23]=f,t[24]=p):p=t[24];let m=p,h;return t[25]!==n||t[26]!==r||t[27]!==m?(h=(0,Z.jsx)(bn,{fallback:r,strings:m,children:n}),t[25]=n,t[26]=r,t[27]=m,t[28]=h):h=t[28],h},Sn=`__unassigned__`,Cn={mod:`mod`,shift:`shift`,alt:`alt`,option:`alt`,ctrl:`ctrl`,meta:`mod`,cmd:`mod`,command:`mod`},wn={mod:de()&&o()?`⌘`:`Ctrl`,shift:`⇧`,alt:`⌥`,option:`⌥`,ctrl:`⌃`},Tn={comma:`,`,period:`.`,enter:`Enter`,escape:`Esc`,tab:`Tab`,space:`Space`,backspace:`⌫`,delete:`⌦`,arrowup:`↑`,arrowdown:`↓`,arrowleft:`←`,arrowright:`→`,home:`Home`,end:`End`,pageup:`Page Up`,pagedown:`Page Down`,backtick:"`",grave:"`","=":`=`,equal:`=`,plus:`+`,minus:`-`,"-":`-`},En=[`mod`,`ctrl`,`shift`,`alt`],Dn={"{":`[`,"}":`]`,":":`;`,'"':`'`,"<":`,`,">":`.`,"?":`/`,"|":`\\`,"~":"`","!":`1`,"@":`2`,"#":`3`,$:`4`,"%":`5`,"^":`6`,"&":`7`,"*":`8`,"(":`9`,")":`0`};function On(e){return e.trim().toLowerCase()===Sn}function kn(e){let t=e.toLowerCase();return t===`,`?`comma`:t===`.`?`period`:t===` `?`space`:t===`esc`?`escape`:t===`+`?`plus`:t===`-`||t===`_`?`minus`:t===`arrowup`?`arrowup`:t===`arrowdown`?`arrowdown`:t===`arrowleft`?`arrowleft`:t===`arrowright`?`arrowright`:t==="`"?`backtick`:Dn[t]??t}var An=[{id:`open_go_to_line`,defaultCombo:`alt+g`,label:`Go to line (files editor)`,description:`Open go to line in the files editor`,customizable:!0},{id:`open_command_palette`,defaultCombo:`mod+p`,label:`Open command palette`,description:`Open the command palette`,customizable:!0},{id:`focus_input`,defaultCombo:`mod+i`,label:`Focus input`,description:`Focus the chat input field`,customizable:!0},{id:`open_status`,defaultCombo:`mod+shift+o`,label:`Open OpenCode status`,description:`Open the OpenCode status dialog`},{id:`open_settings`,defaultCombo:`mod+comma`,label:`Open settings`,description:`Open the settings panel`,customizable:!0},{id:`toggle_terminal`,defaultCombo:`ctrl+backtick`,label:`Toggle terminal`,description:`Toggle the integrated terminal`,customizable:!0},{id:`toggle_bottom_panel`,defaultCombo:`mod+j`,label:`Toggle bottom panel`,description:`Toggle the bottom panel dock`,customizable:!0},{id:`toggle_terminal_expanded`,defaultCombo:`mod+shift+j`,label:`Toggle terminal expanded`,description:`Toggle terminal expanded or collapsed`,customizable:!0},{id:`new_terminal_tab`,defaultCombo:`mod+t`,label:`New terminal tab`,description:`Create a new terminal tab when the terminal is focused`,customizable:!0},{id:`open_new_terminal`,defaultCombo:`mod+shift+backtick`,label:`Open new terminal`,description:`Open the terminal panel and create a new terminal tab`,customizable:!0},{id:`previous_terminal_tab`,defaultCombo:`mod+shift+[`,label:`Previous terminal tab`,description:`Switch to the previous terminal tab when the terminal is focused`,customizable:!0},{id:`next_terminal_tab`,defaultCombo:`mod+shift+]`,label:`Next terminal tab`,description:`Switch to the next terminal tab when the terminal is focused`,customizable:!0},{id:`toggle_files`,defaultCombo:`mod+shift+f`,label:`Toggle files`,description:`Toggle the files panel`},{id:`toggle_sidebar`,defaultCombo:`mod+b`,label:`Toggle sidebar`,description:`Toggle the session sidebar`,customizable:!0},{id:`open_timeline_dialog`,defaultCombo:`mod+t`,label:`Open conversation timeline`,description:`Search and navigate within current conversation`,customizable:!0},{id:`toggle_prompt_navigator`,defaultCombo:`mod+alt+p`,label:`Toggle prompt navigator`,description:`Show or hide the prompt navigator panel in chat`,customizable:!0},{id:`toggle_right_sidebar`,defaultCombo:`mod+alt+b`,defaultAliases:[`mod+\\`],label:`Toggle review panel`,description:`Toggle the review panel (right sidebar)`,customizable:!0},{id:`open_right_sidebar_git`,defaultCombo:`mod+shift+g`,label:`Open right sidebar Git tab`,description:`Open right sidebar and select Git`,customizable:!0},{id:`open_right_sidebar_files`,defaultCombo:`mod+shift+f`,label:`Open right sidebar Files tab`,description:`Open right sidebar and select Files`,customizable:!0},{id:`cycle_right_sidebar_tab`,defaultCombo:`mod+alt+shift+r`,label:`Cycle right sidebar tab`,description:`Cycle through right sidebar tabs`,customizable:!0},{id:`close_context_panel_tab`,defaultCombo:`mod+w`,label:`Close context panel tab`,description:`Close the active context panel tab (closes the panel when empty)`,customizable:!0},{id:`previous_session`,defaultCombo:`mod+shift+[`,defaultAliases:[`mod+arrowup`],label:`Previous session`,description:`Switch to the previous session`,customizable:!0},{id:`next_session`,defaultCombo:`mod+shift+]`,defaultAliases:[`mod+arrowdown`],label:`Next session`,description:`Switch to the next session`,customizable:!0},{id:`new_chat`,defaultCombo:`mod+n`,label:`New session`,description:`Start a new session`,customizable:!0},{id:`new_chat_worktree`,defaultCombo:`mod+shift+alt+n`,label:`New worktree draft`,description:`Create a new worktree and open a draft in it`,customizable:!0},{id:`new_mini_chat`,defaultCombo:`mod+alt+n`,label:`New Mini Chat window`,description:`Open a new Mini Chat draft window`,customizable:!0},{id:`submit_message`,defaultCombo:`mod+enter`,label:`Submit message`,description:`Submit the current message`},{id:`clear_input`,defaultCombo:`escape`,label:`Clear input`,description:`Clear the input field`},{id:`clear_all_messages`,defaultCombo:`ctrl+c`,label:`Clear all messages`,description:`Clear the composer input and queued messages`,customizable:!0},{id:`open_diff_panel`,defaultCombo:`mod+2`,label:`Open diff panel`,description:`Switch to the diff panel`},{id:`open_terminal_panel`,defaultCombo:`mod+3`,label:`Open terminal panel`,description:`Switch to the terminal panel`},{id:`open_git_panel`,defaultCombo:`mod+4`,label:`Open git panel`,description:`Switch to the git panel`},{id:`open_help`,defaultCombo:`mod+.`,label:`Open keyboard shortcuts`,description:`Show the keyboard shortcuts help`,customizable:!0},{id:`toggle_services_menu`,defaultCombo:`mod+shift+s`,label:`Toggle services menu`,description:`Open or close the services menu`,customizable:!0},{id:`open_usage`,defaultCombo:`mod+shift+c`,label:`Open usage`,description:`Open the usage panel`,customizable:!0},{id:`cycle_services_tab`,defaultCombo:`mod+alt+shift+s`,label:`Cycle services tab`,description:`Cycle through tabs in the services menu`,customizable:!0},{id:`cycle_theme`,defaultCombo:`mod+/`,label:`Cycle theme`,description:`Cycle between light, dark, and system theme`,customizable:!0},{id:`zoom_in`,defaultCombo:`mod+=`,label:`Zoom in`,description:`Increase the webview zoom level`,customizable:!0},{id:`zoom_out`,defaultCombo:`mod+-`,label:`Zoom out`,description:`Decrease the webview zoom level`,customizable:!0},{id:`zoom_reset`,defaultCombo:`mod+0`,label:`Reset zoom`,description:`Reset the webview zoom level to 100%`,customizable:!0},{id:`leader_key`,defaultCombo:`ctrl+x`,label:`Leader key`,description:`Start an OpenCode-style chord, then press M / A / N / C`,customizable:!0},{id:`open_model_selector`,defaultCombo:`mod+shift+m`,label:`Open model selector`,description:`Open model selector while in chat`,customizable:!0},{id:`cycle_thinking_variant`,defaultCombo:`mod+shift+t`,label:`Cycle thinking variant`,description:`Cycle thinking variant while in chat`},{id:`cycle_agent`,defaultCombo:`tab`,label:`Cycle agent`,description:`Cycle agent while the model selector is open`,customizable:!0},{id:`cycle_favorite_model_forward`,defaultCombo:`ctrl+]`,label:`Cycle favorite model forward`,description:`Cycle forward through starred models without opening the picker`,customizable:!0},{id:`cycle_favorite_model_backward`,defaultCombo:`ctrl+[`,label:`Cycle favorite model backward`,description:`Cycle backward through starred models without opening the picker`,customizable:!0},{id:`expand_input`,defaultCombo:`mod+shift+e`,label:`Expand input`,description:`Toggle focus mode for the chat input`,customizable:!0},{id:`toggle_dictation`,defaultCombo:`mod+alt+v`,label:`Voice input`,description:`Start dictation; press again to confirm and insert the transcript`,customizable:!0},{id:`abort_run`,defaultCombo:`escape`,label:`Abort active run`,description:`Abort the currently running task (double press)`},{id:`switch_tab_1`,defaultCombo:`mod+1`,label:`Switch to visible session 1`,description:`Switch to the first visible sidebar session`},{id:`switch_tab_2`,defaultCombo:`mod+2`,label:`Switch to visible session 2`,description:`Switch to the second visible sidebar session`},{id:`switch_tab_3`,defaultCombo:`mod+3`,label:`Switch to visible session 3`,description:`Switch to the third visible sidebar session`},{id:`switch_tab_4`,defaultCombo:`mod+4`,label:`Switch to visible session 4`,description:`Switch to the fourth visible sidebar session`},{id:`switch_tab_5`,defaultCombo:`mod+5`,label:`Switch to visible session 5`,description:`Switch to the fifth visible sidebar session`},{id:`switch_tab_6`,defaultCombo:`mod+6`,label:`Switch to visible session 6`,description:`Switch to the sixth visible sidebar session`},{id:`switch_tab_7`,defaultCombo:`mod+7`,label:`Switch to visible session 7`,description:`Switch to the seventh visible sidebar session`},{id:`switch_tab_8`,defaultCombo:`mod+8`,label:`Switch to visible session 8`,description:`Switch to the eighth visible sidebar session`},{id:`switch_tab_9`,defaultCombo:`mod+9`,label:`Switch to visible session 9`,description:`Switch to the ninth visible sidebar session`}];function jn(e){if(On(e))return Sn;let t=e.toLowerCase().trim().split(`+`).map(e=>e.trim()).filter(Boolean),n=new Set,r=``;for(let e of t){let t=e===`,`?`comma`:e===`.`?`period`:e,i=Cn[t];if(i){n.add(i);continue}r=t}return[...En.filter(e=>n.has(e)),r].filter(Boolean).join(`+`)}function Mn(e){return On(e)?!0:Nn(e).key.trim().length>0}function Nn(e){if(On(e))return{modifiers:new Set,key:Sn};let t=jn(e).split(`+`),n=new Set,r=``;for(let e of t){let t=Cn[e];t?n.add(t):r=e}return{modifiers:n,key:r}}function Pn(e){if(On(e))return`Unassigned`;let t=Nn(e);if(!t.key&&t.modifiers.size===0)return`Unassigned`;let n=[];for(let e of En)t.modifiers.has(e)&&n.push(wn[e]);if(t.key){let e=Tn[t.key.toLowerCase()]||t.key.toUpperCase();n.push(e)}return n.join(` + `)}function Fn(e){return An.find(t=>t.id===e)}function In(){return An.filter(e=>e.customizable===!0)}function Ln(e,t){let n=Fn(e);if(!n)return``;let r=t?.[e];if(typeof r==`string`){if(r.trim().toLowerCase()===`__unassigned__`)return``;let e=jn(r);if(e===`__unassigned__`)return Sn;if(Mn(e))return e}return n.defaultCombo}function Rn(e,t){let n=Fn(e);if(!n)return[];let r=Ln(e,t);return r===n.defaultCombo?[n.defaultCombo,...n.defaultAliases??[]]:r?[r]:[]}function zn(e){if(On(e))return!1;let t=Nn(e);if(!t.modifiers.has(`mod`))return!1;let n=t.key.toLowerCase();return new Set([`w`,`t`,`r`,`p`,`s`,`f`,`l`,`n`]).has(n)&&!t.modifiers.has(`shift`)&&!t.modifiers.has(`alt`)}function Bn(e,t){let n=typeof t==`string`?t:t.defaultCombo;if(On(n))return!1;let r=Nn(n),i=r.modifiers.has(`mod`),a=r.modifiers.has(`shift`),s=r.modifiers.has(`alt`),c=r.modifiers.has(`ctrl`),l=de()&&o(),u=de(),d=l?e.metaKey:u&&e.metaKey||e.ctrlKey;if(i&&!d||!i&&e.metaKey||a!==e.shiftKey||s!==e.altKey)return!1;if(c){if(!e.ctrlKey)return!1}else{let t=i&&!l&&e.ctrlKey;if(e.ctrlKey&&!t)return!1}let f=e.key;return(!f||f===`Dead`)&&e.code===`Backquote`&&(f="`"),e.altKey&&(e.code.startsWith(`Key`)&&e.code.length===4?f=e.code.slice(3).toLowerCase():e.code.startsWith(`Digit`)&&e.code.length===6&&(f=e.code.slice(5))),kn(f)===kn(r.key)}function Vn(){return de()&&o()?`⌘`:`Ctrl`}function Hn(e,t,n){if(Bn(e,n))return!0;let r=jn(n),i=de()&&o(),a=de();return!(i?e.metaKey:a&&e.metaKey||e.ctrlKey)||e.altKey||i&&e.ctrlKey&&!e.metaKey?!1:t===`in`&&r===`mod+=`?e.key===`+`||e.code===`NumpadAdd`:t===`out`&&(r===`mod+-`||r===`mod+minus`)?e.key===`_`||e.code===`NumpadSubtract`:!1}var Un=Q.createContext(null),Wn=e=>e?e.closest(`[data-slot="dialog-content"], [role="dialog"]`):null;function Gn(e,t){return e&&Q.isValidElement(t)?{render:t}:{children:t}}function Kn(e){let t=(0,K.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let[r,i]=Q.useState(null),a;t[2]===r?a=t[3]:(a={portalContainer:r,setPortalContainer:i},t[2]=r,t[3]=a);let o=a,s;t[4]===n?s=t[5]:(s=(0,Z.jsx)(w,{...n}),t[4]=n,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsx)(Un.Provider,{value:o,children:s}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function qn(e){let t=(0,K.c)(22),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:n,children:r,onPointerDownCapture:a,onFocusCapture:i,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=Q.useContext(Un),c;t[6]===s?c=t[7]:(c=e=>{if(!s)return;let t=e instanceof HTMLElement?e:null;s.setPortalContainer(Wn(t))},t[6]=s,t[7]=c);let l=c,u;t[8]!==n||t[9]!==r?(u=Gn(n,r),t[8]=n,t[9]=r,t[10]=u):u=t[10];let d=u,f;t[11]!==a||t[12]!==l?(f=e=>{l(e.currentTarget),a?.(e)},t[11]=a,t[12]=l,t[13]=f):f=t[13];let p;t[14]!==i||t[15]!==l?(p=e=>{l(e.currentTarget),i?.(e)},t[14]=i,t[15]=l,t[16]=p):p=t[16];let m;return t[17]!==o||t[18]!==d||t[19]!==f||t[20]!==p?(m=(0,Z.jsx)(g,{"data-slot":`dropdown-menu-trigger`,onPointerDownCapture:f,onFocusCapture:p,...o,...d}),t[17]=o,t[18]=d,t[19]=f,t[20]=p,t[21]=m):m=t[21],m}function Jn(e){let t=(0,K.c)(40),n,r,i,a,o,s,c,l,u,d,f,p,m;if(t[0]!==e){let{className:h,sideOffset:g,align:_,side:v,alignOffset:y,anchor:b,portalToBody:x,positionerClassName:S,style:C,children:w,onCloseAutoFocus:T,collisionPadding:E,collisionAvoidance:D,...O}=e;o=h,d=g,n=_,l=v,r=y,i=b,f=x,s=S,u=C,a=w,p=E,m=D,c=O,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13];let h=d===void 0?4:d,g=f!==void 0&&f,_=p===void 0?8:p,y;t[14]===m?y=t[15]:(y=m===void 0?{side:`shift`,align:`shift`}:m,t[14]=m,t[15]=y);let b=y,C=Q.useContext(Un),w=g?void 0:C?.portalContainer||void 0,T;t[16]===s?T=t[17]:(T=H(`app-region-no-drag z-50`,s),t[16]=s,t[17]=T);let E;t[18]===u?E=t[19]:(E={backgroundColor:`var(--surface-elevated)`,color:`var(--surface-elevated-foreground)`,...u},t[18]=u,t[19]=E);let D;t[20]===o?D=t[21]:(D=H(We,o),t[20]=o,t[21]=D);let O;t[22]!==a||t[23]!==c||t[24]!==E||t[25]!==D?(O=(0,Z.jsx)(v,{"data-slot":`dropdown-menu-content`,style:E,className:D,...c,children:a}),t[22]=a,t[23]=c,t[24]=E,t[25]=D,t[26]=O):O=t[26];let k;t[27]!==n||t[28]!==r||t[29]!==i||t[30]!==b||t[31]!==_||t[32]!==l||t[33]!==h||t[34]!==O||t[35]!==T?(k=(0,Z.jsx)(x,{anchor:i,sideOffset:h,align:n,side:l,alignOffset:r,collisionPadding:_,collisionAvoidance:b,className:T,children:O}),t[27]=n,t[28]=r,t[29]=i,t[30]=b,t[31]=_,t[32]=l,t[33]=h,t[34]=O,t[35]=T,t[36]=k):k=t[36];let A;return t[37]!==k||t[38]!==w?(A=(0,Z.jsx)(S,{container:w,children:k}),t[37]=k,t[38]=w,t[39]=A):A=t[39],A}function Yn(e){let t=(0,K.c)(24),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:i,inset:a,variant:l,asChild:n,children:r,onSelect:s,onClick:o,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=l===void 0?`default`:l,d;t[9]!==n||t[10]!==r?(d=Gn(n,r),t[9]=n,t[10]=r,t[11]=d):d=t[11];let f=d,p;t[12]!==o||t[13]!==s?(p=e=>{o?.(e),e.defaultPrevented||s?.(e)},t[12]=o,t[13]=s,t[14]=p):p=t[14];let m=p,h;t[15]===i?h=t[16]:(h=H(Ke,i),t[15]=i,t[16]=h);let g;return t[17]!==m||t[18]!==a||t[19]!==c||t[20]!==f||t[21]!==h||t[22]!==u?(g=(0,Z.jsx)(y,{"data-slot":`dropdown-menu-item`,"data-inset":a,"data-variant":u,className:h,...c,onClick:m,...f}),t[17]=m,t[18]=a,t[19]=c,t[20]=f,t[21]=h,t[22]=u,t[23]=g):g=t[23],g}function Xn(e){let t=(0,K.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(b,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function Zn(e){let t=(0,K.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=H(`data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover data-[checked]:bg-interactive-selection data-[checked]:text-interactive-selection-foreground relative flex cursor-pointer items-start gap-2 rounded-lg py-1 pl-2 pr-8 typography-ui-label outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-3.5 items-center justify-center text-primary`,children:(0,Z.jsx)(h,{children:(0,Z.jsx)(G,{name:`check`,className:`size-3`})})}),t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==i||t[9]!==a?(s=(0,Z.jsxs)(C,{"data-slot":`dropdown-menu-radio-item`,className:a,...i,children:[o,n]}),t[7]=n,t[8]=i,t[9]=a,t[10]=s):s=t[10],s}function Qn(e){let t=(0,K.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=H(`px-2 py-1 typography-ui-label font-medium data-[inset]:pl-8`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(`div`,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function $n(e){let t=(0,K.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=H(Ge,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function er(){let e=(0,K.c)(5),t=U(ir),n=U(rr),r=U(nr),i=U(tr),a=t||i,o=!a&&r===`init_error`,s=!a&&!o,c;return e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==s?(c={isReady:a,isLoading:s,isUnavailable:o,connectionPhase:n},e[0]=n,e[1]=a,e[2]=o,e[3]=s,e[4]=c):c=e[4],c}function tr(e){return e.providers.length>0}function nr(e){return e.lastDisconnectReason}function rr(e){return e.connectionPhase}function ir(e){return e.isInitialized}var ar=e=>{let t=(0,K.c)(41),{agentName:n,onChange:r,className:i,filter:a,dropdownPortalToBody:o,showIcon:s,agents:c}=e,l=o!==void 0&&o,u=s===void 0||s,{t:d}=ue(),{isReady:f,isUnavailable:p}=er(),m=U(or),h=we(sr),g=U(cr),{data:_}=be(),v;t[0]===_?v=t[1]:(v=_===void 0?[]:_,t[0]=_,t[1]=v);let y=v,b;bb0:{if(c){b=c;break bb0}if(Array.isArray(m)&&m.length>0){b=m;break bb0}b=y}let x=b,S;if(t[2]!==a||t[3]!==x){let e=ge(x);S=a?e.filter(a):e,t[2]=a,t[3]=x,t[4]=S}else S=t[4];let C=S,w=k(lr),{isMobile:T}=Ue(),E=w||T,[D,O]=Q.useState(!1),A;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{O(!0),U.getState().refreshCatalogsOnPickerOpen({source:`agentSelector:mobilePanel`})},t[5]=A):A=t[5];let j=ce(A),M=ce(ur),ee=Q.useId(),te,N;t[6]!==c||t[7]!==h||t[8]!==g||t[9]!==x.length?(te=()=>{c||x.length>0||(g(),h())},N=[c,x.length,g,h],t[6]=c,t[7]=h,t[8]=g,t[9]=x.length,t[10]=te,t[11]=N):(te=t[10],N=t[11]),Q.useEffect(te,N);let ne;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(ne=()=>O(!1),t[12]=ne):ne=t[12];let P=ne,re;t[13]===r?re=t[14]:(re=e=>{r(e)},t[13]=r,t[14]=re);let F=re,ie;t[15]!==n||t[16]!==C||t[17]!==F||t[18]!==E||t[19]!==D||t[20]!==ee||t[21]!==d?(ie=()=>E?(0,Z.jsx)(ze,{id:`mobile-agent-selector-sheet-${ee}`,open:D,onOpenChange:e=>{e||P()},ariaLabel:d(`settings.commands.agentSelector.title`),closeAriaLabel:d(`mobile.surface.closeAria`),resizeAriaLabel:d(`mobile.sessions.sheet.resizeAria`),bodyClassName:`px-2`,children:(0,Z.jsxs)(qe,{useScrollShadow:!0,disableHorizontal:!0,preventOverscroll:!0,outerClassName:`min-h-0 flex-1`,className:`flex flex-col gap-1 overscroll-contain`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:H(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-x-2 rounded-lg border border-border/40 bg-background/95 px-2 py-1.5 text-left`,n?`text-foreground`:`bg-primary/10 text-primary`),onClick:()=>{F(``),P()},children:[(0,Z.jsx)(W,{name:`default`,size:16}),(0,Z.jsx)(`span`,{className:H(`min-w-0 typography-meta`,n?`text-muted-foreground`:`font-medium`),children:d(`settings.commands.agentSelector.notSelected`)}),!n&&(0,Z.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-primary`})]}),C.map(e=>{let t=e.name===n;return(0,Z.jsxs)(`button`,{type:`button`,className:H(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-start gap-x-2 rounded-lg border border-border/40 bg-background/95 px-2 py-1.5 text-left`,t?`bg-primary/10 text-primary`:`text-foreground`),onClick:()=>{F(e.name),P()},children:[(0,Z.jsx)(W,{name:e.name,size:16,className:`mt-1.5`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`typography-meta font-medium`,children:e.name}),e.description&&(0,Z.jsx)(`span`,{className:`mt-0.5 block whitespace-normal break-words typography-micro text-muted-foreground`,children:e.description})]}),t&&(0,Z.jsx)(`div`,{className:`mt-2 h-2 w-2 rounded-full bg-primary`})]},e.name)})]})}):null,t[15]=n,t[16]=C,t[17]=F,t[18]=E,t[19]=D,t[20]=ee,t[21]=d,t[22]=ie):ie=t[22];let I=ie,L;t[23]!==n||t[24]!==C||t[25]!==i||t[26]!==l||t[27]!==F||t[28]!==M||t[29]!==E||t[30]!==f||t[31]!==p||t[32]!==j||t[33]!==u||t[34]!==d?(L=E?(0,Z.jsxs)(`button`,{type:`button`,onClick:f?j:void 0,disabled:!f,className:H(`flex w-full items-center justify-between gap-2 rounded-lg border border-border/40 bg-background/95 px-2 py-1.5 text-left`,!f&&`opacity-60 cursor-not-allowed`,i),children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:f?(0,Z.jsxs)(Z.Fragment,{children:[u?(0,Z.jsx)(W,{name:n||`default`,size:14}):null,(0,Z.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:n||d(`settings.commands.agentSelector.selectAgentPlaceholder`)})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{name:`loader-4`,className:`h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:d(p?`common.unavailable`:`common.loading`)})]})}),(0,Z.jsx)(G,{name:`arrow-down-s`,className:`h-3 w-3 text-muted-foreground`})]}):f?(0,Z.jsxs)(Kn,{onOpenChange:M,children:[(0,Z.jsx)(qn,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:H(`flex items-center gap-2 px-2 rounded-lg bg-interactive-selection/20 border border-border/20 cursor-pointer hover:bg-interactive-hover/30 h-6 w-fit`,i),children:[u?(0,Z.jsx)(W,{name:n||`default`,size:14}):null,(0,Z.jsx)(`span`,{className:`typography-micro font-medium whitespace-nowrap`,children:n||d(`settings.commands.agentSelector.notSelected`)}),(0,Z.jsx)(G,{name:`arrow-down-s`,className:`h-3 w-3 flex-shrink-0 text-muted-foreground`})]})}),(0,Z.jsxs)(Jn,{className:`max-w-[300px]`,portalToBody:l,children:[(0,Z.jsxs)(Yn,{className:`typography-meta`,onSelect:()=>F(``),children:[(0,Z.jsx)(W,{name:`default`,size:14}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:d(`settings.commands.agentSelector.notSelected`)})]}),C.map(e=>(0,Z.jsxs)(Yn,{className:`typography-meta`,onSelect:()=>F(e.name),children:[(0,Z.jsx)(W,{name:e.name,size:14}),(0,Z.jsx)(`span`,{className:`font-medium`,children:e.name})]},e.name))]})]}):(0,Z.jsxs)(`div`,{className:H(`flex items-center gap-2 px-2 rounded-lg bg-interactive-selection/20 border border-border/20 h-6 w-fit opacity-60`,i),children:[(0,Z.jsx)(G,{name:`loader-4`,className:`h-3 w-3 animate-spin text-muted-foreground flex-shrink-0`}),(0,Z.jsx)(`span`,{className:`typography-micro font-medium whitespace-nowrap text-muted-foreground`,children:d(p?`common.unavailable`:`common.loading`)})]}),t[23]=n,t[24]=C,t[25]=i,t[26]=l,t[27]=F,t[28]=M,t[29]=E,t[30]=f,t[31]=p,t[32]=j,t[33]=u,t[34]=d,t[35]=L):L=t[35];let R;t[36]===I?R=t[37]:(R=I(),t[36]=I,t[37]=R);let ae;return t[38]!==L||t[39]!==R?(ae=(0,Z.jsxs)(Z.Fragment,{children:[L,R]}),t[38]=L,t[39]=R,t[40]=ae):ae=t[40],ae};function or(e){return e.agents}function sr(e){return e.loadAgents}function cr(e){return e.loadAgents}function lr(e){return e.isMobile}function ur(e){e&&U.getState().refreshCatalogsOnPickerOpen({source:`agentSelector:desktopMenu`})}var dr={compact:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1,minimumFractionDigits:0},compactTokensShort:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1},usd:{style:`currency`,currency:`USD`,maximumFractionDigits:4,minimumFractionDigits:2}},fr=null,pr={},mr=(e,t)=>{fr!==t&&(fr=t,pr.compact=void 0,pr.compactTokensShort=void 0,pr.usd=void 0);let n=pr[e];if(n)return n;let r=new Intl.NumberFormat(t,dr[e]);return pr[e]=r,r},hr=(e,t=V())=>mr(`compact`,t).format(e),gr=(e,t=V())=>mr(`compactTokensShort`,t).format(e),_r=(e,t=V())=>mr(`usd`,t).format(e),vr=(e,t=V())=>e.toLocaleDateString(t,{month:`short`,day:`numeric`,year:`numeric`}),yr=(e,t=V())=>new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`}),br=(e,t=V())=>new Date(e).toLocaleTimeString(t,{hour:`numeric`,minute:`2-digit`}),xr=8,Sr=e=>typeof e!=`number`||Number.isNaN(e)?``:gr(e),Cr=(e,t,n)=>{let r=e.find(e=>e.id===t)?.models?.find(e=>e.id===n);return r?.variants?Object.keys(r.variants):[]},wr=e=>{let t=(0,K.c)(54),{open:n,onClose:r,selectedProviderID:i,selectedModelID:a,resolveSelectedVariant:o,onSelect:s,providers:c,favoriteModels:l,recentModels:u,hiddenModels:d,allowedProviderIds:f,allowedModelIdsByProvider:p,providerOrder:m,variantSelectionEnabled:h,isFavorite:g,onToggleFavorite:_,getMetadata:v,view:y,onViewChange:b}=e,x;t[0]===d?x=t[1]:(x=d===void 0?[]:d,t[0]=d,t[1]=x);let S=x,C=h===void 0||h,{t:w}=ue(),T=Q.useId(),[E,D]=Q.useState(``),O;t[2]===i?O=t[3]:(O=()=>new Set(i?[i]:[]),t[2]=i,t[3]=O);let[k,A]=Q.useState(O),[j,M]=Q.useState(null),[ee,te]=Q.useState(`model`),[N,ne]=Q.useState(null),P=Q.useRef(!1),re=y??ee,F,ie;t[4]!==n||t[5]!==i?(F=()=>{n&&!P.current&&A(new Set(i?[i]:[])),n||(D(``),M(null),te(`model`),ne(null)),P.current=n},ie=[n,i],t[4]=n,t[5]=i,t[6]=F,t[7]=ie):(F=t[6],ie=t[7]),Q.useEffect(F,ie);let I;t[8]===b?I=t[9]:(I=e=>{te(e),b?.(e)},t[8]=b,t[9]=I);let L=I,R=re===`variant`&&!!(N??(i&&a)),ae=`mobile-model-picker-sheet-${T}`,z;t[10]===r?z=t[11]:(z=e=>{e||r()},t[10]=r,t[11]=z);let oe;t[12]!==R||t[13]!==L||t[14]!==w?(oe=R?(0,Z.jsx)(fe,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>L(`model`),"aria-label":w(`onboarding.common.actions.back`),children:(0,Z.jsx)(G,{name:`arrow-left`,className:`size-5`})}):void 0,t[12]=R,t[13]=L,t[14]=w,t[15]=oe):oe=t[15];let B;t[16]!==R||t[17]!==w?(B=w(R?`chat.modelControls.thinking`:`chat.modelControls.selectModel`),t[16]=R,t[17]=w,t[18]=B):B=t[18];let se;t[19]===w?se=t[20]:(se=w(`mobile.surface.closeAria`),t[19]=w,t[20]=se);let ce;t[21]===w?ce=t[22]:(ce=w(`mobile.sessions.sheet.resizeAria`),t[21]=w,t[22]=ce);let le;t[23]!==re||t[24]!==p||t[25]!==f||t[26]!==j||t[27]!==k||t[28]!==l||t[29]!==v||t[30]!==S||t[31]!==g||t[32]!==s||t[33]!==_||t[34]!==m||t[35]!==c||t[36]!==E||t[37]!==u||t[38]!==o||t[39]!==a||t[40]!==i||t[41]!==L||t[42]!==C||t[43]!==N?(le=(0,Z.jsx)(Tr,{query:E,onQueryChange:D,expandedProviders:k,onExpandedProvidersChange:A,expandedModelKey:j,onExpandedModelKeyChange:M,activeView:re,setView:L,variantTarget:N,onVariantTargetChange:ne,selectedProviderID:i,selectedModelID:a,resolveSelectedVariant:o,onSelect:s,providers:c,favoriteModels:l,recentModels:u,hiddenModels:S,allowedProviderIds:f,allowedModelIdsByProvider:p,providerOrder:m,variantSelectionEnabled:C,isFavorite:g,onToggleFavorite:_,getMetadata:v}),t[23]=re,t[24]=p,t[25]=f,t[26]=j,t[27]=k,t[28]=l,t[29]=v,t[30]=S,t[31]=g,t[32]=s,t[33]=_,t[34]=m,t[35]=c,t[36]=E,t[37]=u,t[38]=o,t[39]=a,t[40]=i,t[41]=L,t[42]=C,t[43]=N,t[44]=le):le=t[44];let de;return t[45]!==n||t[46]!==oe||t[47]!==B||t[48]!==se||t[49]!==ce||t[50]!==le||t[51]!==ae||t[52]!==z?(de=(0,Z.jsx)(ze,{id:ae,open:n,onOpenChange:z,leading:oe,ariaLabel:B,closeAriaLabel:se,resizeAriaLabel:ce,bodyClassName:`px-2`,children:le}),t[45]=n,t[46]=oe,t[47]=B,t[48]=se,t[49]=ce,t[50]=le,t[51]=ae,t[52]=z,t[53]=de):de=t[53],de},Tr=e=>{let t=(0,K.c)(117),{query:n,onQueryChange:r,expandedProviders:i,onExpandedProvidersChange:a,expandedModelKey:o,onExpandedModelKeyChange:s,activeView:c,setView:l,variantTarget:u,onVariantTargetChange:d,selectedProviderID:f,selectedModelID:p,resolveSelectedVariant:m,onSelect:h,providers:g,favoriteModels:_,recentModels:v,hiddenModels:y,allowedProviderIds:b,allowedModelIdsByProvider:x,providerOrder:S,variantSelectionEnabled:C,isFavorite:w,onToggleFavorite:T,getMetadata:E}=e,{t:D}=ue(),O;t[0]===b?O=t[1]:(O=b&&b.length>0?new Set(b):null,t[0]=b,t[1]=O);let k=O,A;t[2]===x?A=t[3]:(A=x?new Map(Object.entries(x).map(Er)):null,t[2]=x,t[3]=A);let j=A,M;t[4]===y?M=t[5]:(M=new Set(y.map(Dr)),t[4]=y,t[5]=M);let ee=M,te;t[6]===g?te=t[7]:(te=new Map(g.map(Or)),t[6]=g,t[7]=te);let N=te,ne;bb0:{if(!S?.length){ne=g;break bb0}let e;t[8]===S?e=t[9]:(e=new Map(S.map(kr)),t[8]=S,t[9]=e);let n=e,r;if(t[10]!==g||t[11]!==n){let e;t[13]===n?e=t[14]:(e=(e,t)=>{let r=n.get(e.id),i=n.get(t.id);return r===void 0&&i===void 0?0:r===void 0?1:i===void 0?-1:r-i},t[13]=n,t[14]=e),r=[...g].sort(e),t[10]=g,t[11]=n,t[12]=r}else r=t[12];ne=r}let P=ne,re;t[15]!==j||t[16]!==k||t[17]!==ee?(re=(e,t)=>k&&!k.has(e)||j&&j.get(e)?.has(t)!==!0?!1:!ee.has(`${e}:${t}`),t[15]=j,t[16]=k,t[17]=ee,t[18]=re):re=t[18];let F=re,ie;t[19]!==N||t[20]!==n?(ie=e=>{let t=n.trim();if(!t)return!0;let r=N.get(e.providerID)?.name||e.providerID,i=he(e.model,e.modelID,{maxLength:40});return je(i,t)||je(e.modelID,t)||je(r,t)},t[19]=N,t[20]=n,t[21]=ie):ie=t[21];let I=ie,L;if(t[22]!==_||t[23]!==F||t[24]!==I){let e;t[26]!==F||t[27]!==I?(e=e=>F(e.providerID,e.modelID)&&I(e),t[26]=F,t[27]=I,t[28]=e):e=t[28],L=_.filter(e),t[22]=_,t[23]=F,t[24]=I,t[25]=L}else L=t[25];let R=L,ae;if(t[29]!==F||t[30]!==I||t[31]!==v){let e;t[33]!==F||t[34]!==I?(e=e=>F(e.providerID,e.modelID)&&I(e),t[33]=F,t[34]=I,t[35]=e):e=t[35],ae=v.filter(e),t[29]=F,t[30]=I,t[31]=v,t[32]=ae}else ae=t[32];let z=ae,oe;if(t[36]!==k||t[37]!==F||t[38]!==P||t[39]!==n){let e=n.trim(),r;t[41]===k?r=t[42]:(r=e=>!k||k.has(e.id),t[41]=k,t[42]=r),oe=P.filter(r).map(t=>{let n=e.length>0&&(je(t.name||t.id,e)||je(t.id,e));return{provider:t,models:(t.models??[]).filter(r=>{let i=typeof r.id==`string`?r.id:``;return!i||!F(t.id,i)?!1:n||!e?!0:je(he(r,i,{maxLength:40}),e)||je(i,e)})}}).filter(Ar),t[36]=k,t[37]=F,t[38]=P,t[39]=n,t[40]=oe}else oe=t[40];let B=oe,se;t[43]===D?se=t[44]:(se=e=>{if(!e?.trim())return D(`chat.modelControls.default`);let t=e.trim();return/^\d+(\.\d+)?$/.test(t)?t:t.charAt(0).toUpperCase()+t.slice(1)},t[43]=D,t[44]=se);let ce=se,le;t[45]===D?le=t[46]:(le=e=>{let t=[];e?.tool_call&&t.push({key:`tool_call`,icon:`tools`,label:D(`chat.modelControls.capability.toolCalling`)}),e?.reasoning&&t.push({key:`reasoning`,icon:`brain-ai-3`,label:D(`chat.modelControls.capability.reasoning`)});let n={text:{icon:`text`,label:D(`chat.modelControls.modality.text`)},image:{icon:`file-image`,label:D(`chat.modelControls.modality.image`)},video:{icon:`file-video`,label:D(`chat.modelControls.modality.video`)},audio:{icon:`file-music`,label:D(`chat.modelControls.modality.audio`)},pdf:{icon:`file-pdf`,label:D(`chat.modelControls.modality.pdf`)}};for(let r of[...e?.modalities?.input??[],...e?.modalities?.output??[]]){let e=r.trim().toLowerCase(),i=n[e];i&&!t.some(t=>t.key===e)&&t.push({key:e,...i})}return t},t[45]=D,t[46]=le);let de=le,V;t[47]!==d||t[48]!==l?(V=(e,t,n)=>{d(n===void 0?{providerID:e,modelID:t}:{providerID:e,modelID:t,variant:n}),l(`variant`)},t[47]=d,t[48]=l,t[49]=V):V=t[49];let fe=V,pe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(pe={onPointerDown:Re,onClickCapture:jr},t[50]=pe):pe=t[50];let me=pe,ge;t[51]!==o||t[52]!==ce||t[53]!==E||t[54]!==de||t[55]!==w||t[56]!==s||t[57]!==h||t[58]!==T||t[59]!==fe||t[60]!==N||t[61]!==g||t[62]!==m||t[63]!==p||t[64]!==f||t[65]!==D||t[66]!==C?(ge=(e,t)=>{let n=t===void 0?{}:t,{model:r,providerID:i,modelID:a}=e,c=`${i}:${a}`,l=i===f&&a===p,u=Be(i,r,E?.(i,a)),d=C?Cr(g,i,a):[],_=m(i,a),v=n.preferRememberedVariant&&e.variant!==void 0&&d.includes(e.variant)?e.variant:void 0,y=v===void 0?_:v,b=l||v===void 0?_:v,x=[void 0,...d].slice(0,xr),S=o===c,O=de(u),k=u?.limit?.context?`${Sr(u.limit.context)} ctx`:null;return(0,Z.jsxs)(`div`,{className:H(`border-b border-border/30 last:border-b-0`,l&&`bg-interactive-selection/15 text-interactive-selection-foreground`),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,Z.jsx)(`button`,{type:`button`,...me,onClick:()=>h(i,a,y),className:`flex min-w-0 flex-1 items-start gap-2 rounded-lg text-left focus:outline-none focus-visible:ring-1 focus-visible:ring-primary`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[n.showProvider?(0,Z.jsx)(`span`,{className:`truncate text-[10px] leading-none text-muted-foreground/60`,children:N.get(i)?.name||i}):null,(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(Pe,{modelId:a,providerId:i,className:`size-3.5 flex-shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate typography-meta font-medium text-foreground`,children:he(r,a,{maxLength:40})}),l?(0,Z.jsx)(G,{name:`check`,className:`size-4 flex-shrink-0 text-primary`}):null]}),k||O.length>0?(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden typography-micro text-muted-foreground`,children:[k?(0,Z.jsx)(`span`,{className:`flex-shrink-0 whitespace-nowrap`,children:k}):null,k&&O.length>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px flex-shrink-0 bg-border/50`}):null,(0,Z.jsx)(`div`,{className:`flex min-w-0 items-center gap-1 overflow-hidden whitespace-nowrap pl-0.5`,children:O.map(e=>{let{key:t,icon:n,label:r}=e;return(0,Z.jsx)(`span`,{className:`flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,title:r,"aria-label":r,children:(0,Z.jsx)(G,{name:n,className:`size-3`})},`${c}-${t}`)})})]}):null]})}),d.length>0?(0,Z.jsxs)(`button`,{type:`button`,...me,onClick:()=>s(e=>e===c?null:c),className:`flex flex-shrink-0 items-center gap-0.5 typography-micro font-medium text-muted-foreground hover:text-foreground`,"aria-expanded":S,"aria-label":D(S?`chat.modelControls.hideThinkingModes`:`chat.modelControls.showThinkingModes`),children:[(0,Z.jsx)(`span`,{className:`whitespace-nowrap`,children:ce(b)}),(0,Z.jsx)(G,{name:S?`arrow-down-s`:`arrow-right-s`,className:`size-3.5`})]}):null,(0,Z.jsx)(`button`,{type:`button`,...me,onClick:e=>{e.preventDefault(),e.stopPropagation(),T(i,a)},className:H(`model-favorite-button flex size-5 flex-shrink-0 items-center justify-center hover:text-primary/80`,w(i,a)?`text-primary`:`text-muted-foreground`),"aria-label":w(i,a)?D(`chat.modelControls.unfavoriteAria`):D(`chat.modelControls.favoriteAria`),title:w(i,a)?D(`chat.modelControls.removeFromFavorites`):D(`chat.modelControls.addToFavorites`),children:(0,Z.jsx)(G,{name:w(i,a)?`star-fill`:`star`,className:`size-4`})})]}),S&&d.length>0?(0,Z.jsx)(`div`,{className:`border-t border-border/30 p-2`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[x.map(e=>{let t=e===b||!e&&!b;return(0,Z.jsx)(`button`,{type:`button`,...me,onClick:()=>h(i,a,e),className:H(`inline-flex items-center rounded-full border px-2.5 py-1 typography-meta font-medium`,t?`border-primary/30 bg-primary/10 text-foreground`:`border-border/40 text-muted-foreground hover:bg-interactive-hover/50`),"aria-pressed":t,children:ce(e)},`${c}-${e??`default`}`)}),x.length<d.length+1?(0,Z.jsx)(`button`,{type:`button`,...me,onClick:()=>fe(i,a,b),className:`inline-flex items-center rounded-full border border-border/40 px-2.5 py-1 typography-meta font-medium text-muted-foreground hover:bg-interactive-hover/50`,"aria-label":D(`chat.modelControls.moreThinkingModes`),children:D(`inlineComment.actions.showMore`)}):null]})}):null]},`mobile-model-${c}`)},t[51]=o,t[52]=ce,t[53]=E,t[54]=de,t[55]=w,t[56]=s,t[57]=h,t[58]=T,t[59]=fe,t[60]=N,t[61]=g,t[62]=m,t[63]=p,t[64]=f,t[65]=D,t[66]=C,t[67]=ge):ge=t[67];let _e=ge,ve,ye,be,xe,Se,U,Ce,we,Te,W;if(t[68]!==c||t[69]!==i||t[70]!==R||t[71]!==B||t[72]!==z||t[73]!==ce||t[74]!==s||t[75]!==a||t[76]!==r||t[77]!==h||t[78]!==g||t[79]!==n||t[80]!==_e||t[81]!==m||t[82]!==p||t[83]!==f||t[84]!==D||t[85]!==u){let e=u??(c===`variant`&&f&&p?{providerID:f,modelID:p}:null),o=e?Cr(g,e.providerID,e.modelID):[],l;bb1:{if(!e){l=void 0;break bb1}if(e.providerID===f&&e.modelID===p){l=m(e.providerID,e.modelID);break bb1}l=(e.variant!==void 0&&o.includes(e.variant)?e.variant:void 0)??m(e.providerID,e.modelID)}let d=l,_=R.length>0||z.length>0||B.length>0,v=c===`variant`&&!!e;Te=`flex min-h-0 flex-1 flex-col gap-2`,t[96]!==v||t[97]!==s||t[98]!==r||t[99]!==n||t[100]!==D?(W=v?null:(0,Z.jsxs)(`div`,{className:`relative z-10 shrink-0`,"data-mobile-sheet-no-dismiss":``,"data-mobile-sheet-search":``,children:[(0,Z.jsx)(G,{name:`search`,className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(Ve,{type:`text`,value:n,onChange:e=>{r(e.target.value),s(null)},onPointerUp:Mr,placeholder:D(`chat.modelControls.searchProvidersOrModels`),className:`h-9 rounded-xl border-border/40 bg-[var(--surface-elevated)] pl-7 typography-meta`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`search`,inputMode:`search`}),n?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{r(``),s(null)},className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":D(`chat.modelControls.clearSearch`),children:(0,Z.jsx)(G,{name:`close-circle`,className:`size-4`})}):null]}),t[96]=v,t[97]=s,t[98]=r,t[99]=n,t[100]=D,t[101]=W):W=t[101],ve=qe,xe=!0,Se=!0,U=!0,Ce=`min-h-0 flex-1`,we=`overscroll-contain`,ye=`flex flex-col gap-2`,be=v&&e?(0,Z.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[void 0,...o].map(t=>{let n=t===d||!t&&!d;return(0,Z.jsxs)(`button`,{type:`button`,className:H(`flex w-full items-center justify-between gap-2 rounded-xl border px-2 py-1.5 text-left focus:outline-none focus-visible:ring-1 focus-visible:ring-primary`,n?`border-primary/30 bg-primary/10`:`border-border/40`),...me,onClick:()=>h(e.providerID,e.modelID,t),children:[(0,Z.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:ce(t)}),n?(0,Z.jsx)(G,{name:`check`,className:`size-4 flex-shrink-0 text-primary`}):null]},t??`default`)})}):(0,Z.jsxs)(Z.Fragment,{children:[_?null:(0,Z.jsx)(`div`,{className:`px-3 py-8 text-center typography-meta text-muted-foreground`,children:D(`chat.modelControls.noProvidersOrModelsFound`)}),R.length>0?(0,Z.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,Z.jsx)(G,{name:`star-fill`,className:`mr-1.5 inline-block size-3 text-primary`}),D(`chat.modelControls.favorites`)]}),(0,Z.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:R.map(e=>_e(e,{showProvider:!0,preferRememberedVariant:!0}))})]}):null,z.length>0?(0,Z.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,Z.jsx)(G,{name:`time`,className:`mr-1.5 inline-block size-3`}),D(`chat.modelControls.recent`)]}),(0,Z.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:z.map(e=>_e(e,{showProvider:!0,preferRememberedVariant:!0}))})]}):null,B.map(e=>{let{provider:t,models:r}=e,o=i.has(t.id)||n.trim().length>0;return(0,Z.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,Z.jsxs)(`button`,{type:`button`,...me,onClick:()=>{n.trim()||a(e=>{let n=new Set(e);return n.has(t.id)?n.delete(t.id):n.add(t.id),n})},className:`flex w-full items-center justify-between gap-1.5 px-2 py-1.5 text-left`,"aria-expanded":o,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ie,{providerId:t.id,className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:t.name||t.id}),t.id===f?(0,Z.jsx)(`span`,{className:`typography-micro text-primary/80`,children:D(`chat.modelControls.current`)}):null]}),(0,Z.jsx)(G,{name:o?`arrow-down-s`:`arrow-right-s`,className:`size-3 text-muted-foreground`})]}),o?(0,Z.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:r.map(e=>_e({model:e,providerID:t.id,modelID:e.id}))}):null]},t.id)})]}),t[68]=c,t[69]=i,t[70]=R,t[71]=B,t[72]=z,t[73]=ce,t[74]=s,t[75]=a,t[76]=r,t[77]=h,t[78]=g,t[79]=n,t[80]=_e,t[81]=m,t[82]=p,t[83]=f,t[84]=D,t[85]=u,t[86]=ve,t[87]=ye,t[88]=be,t[89]=xe,t[90]=Se,t[91]=U,t[92]=Ce,t[93]=we,t[94]=Te,t[95]=W}else ve=t[86],ye=t[87],be=t[88],xe=t[89],Se=t[90],U=t[91],Ce=t[92],we=t[93],Te=t[94],W=t[95];let Ee;t[102]!==ye||t[103]!==be?(Ee=(0,Z.jsx)(`div`,{className:ye,children:be}),t[102]=ye,t[103]=be,t[104]=Ee):Ee=t[104];let De;t[105]!==ve||t[106]!==xe||t[107]!==Se||t[108]!==U||t[109]!==Ce||t[110]!==we||t[111]!==Ee?(De=(0,Z.jsx)(ve,{useScrollShadow:xe,disableHorizontal:Se,preventOverscroll:U,outerClassName:Ce,className:we,children:Ee}),t[105]=ve,t[106]=xe,t[107]=Se,t[108]=U,t[109]=Ce,t[110]=we,t[111]=Ee,t[112]=De):De=t[112];let Oe;return t[113]!==Te||t[114]!==W||t[115]!==De?(Oe=(0,Z.jsxs)(`div`,{className:Te,children:[W,De]}),t[113]=Te,t[114]=W,t[115]=De,t[116]=Oe):Oe=t[116],Oe};function Er(e){let[t,n]=e;return[t,new Set(n)]}function Dr(e){return`${e.providerID}:${e.modelID}`}function Or(e){return[e.id,e]}function kr(e,t){return[e,t]}function Ar(e){return e.models.length>0}function jr(e){Ae(e)||(e.preventDefault(),e.stopPropagation())}function Mr(e){document.activeElement!==e.currentTarget&&e.currentTarget.focus({preventScroll:!0})}var Nr=e=>{let t=(0,K.c)(217),{providerId:n,modelId:r,variant:i,onChange:a,className:o,allowedProviderIds:s,allowedModelIdsByProvider:c,placeholder:l,tooltipsEnabled:u,dropdownPortalToBody:d,showIcon:f,providers:p}=e,m=u===void 0||u,h=d!==void 0&&d,g=f===void 0||f,{t:_}=ue(),{isReady:v,isUnavailable:y}=er(),b=U(Pr),x=p??b,S=U(Fr),C=k(Ir),w=k(Lr),T=k(Rr),E=k(zr),D=k(Br),O=k(Vr),A;t[0]!==r||t[1]!==n?(A={currentProviderID:n,currentModelID:r},t[0]=r,t[1]=n,t[2]=A):A=t[2];let{favoriteModelsList:j,recentModelsList:M}=Me(A),{isMobile:ee}=Ue(),te=C||ee,[N,ne]=Q.useState(!1),[P,re]=Q.useState(!1),F;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{ne(!0),U.getState().refreshCatalogsOnPickerOpen({source:`modelSelector:mobilePanel`})},t[3]=F):F=t[3];let ie=ce(F),I;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>{re(e),e&&U.getState().refreshCatalogsOnPickerOpen({source:`modelSelector:desktopMenu`})},t[4]=I):I=t[4];let L=ce(I),[R,ae]=Q.useState(``),[z,oe]=Q.useState(null),B=i!==void 0,se;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{ne(!1),re(!1),ae(``),oe(null)},t[5]=se):se=t[5];let le=se,de;t[6]===x?de=t[7]:(de=e=>{let t=x.find(t=>t.id===e.providerID)?.models?.find(t=>t.id===e.modelID);return t?.variants?Object.keys(t.variants):[]},t[6]=x,t[7]=de);let V=de,fe;t[8]!==D||t[9]!==V||t[10]!==r||t[11]!==a||t[12]!==n||t[13]!==i||t[14]!==B?(fe=e=>{let t=V(e),o=e.providerID===n&&e.modelID===r,s=e.variant!==void 0&&t.includes(e.variant)?e.variant:void 0,c=o&&i&&t.includes(i)?i:s??``;a(e.providerID,e.modelID,B?c:void 0),D(e.providerID,e.modelID,B&&c||void 0),le()},t[8]=D,t[9]=V,t[10]=r,t[11]=a,t[12]=n,t[13]=i,t[14]=B,t[15]=fe):fe=t[15];let pe=fe,me;t[16]!==a||t[17]!==B?(me=()=>{a(``,``,B?``:void 0),le()},t[16]=a,t[17]=B,t[18]=me):me=t[18];let he=me,ge;t[19]!==D||t[20]!==a||t[21]!==z?(ge=e=>{z&&(a(z.providerID,z.modelID,e),D(z.providerID,z.modelID,e||void 0),le())},t[19]=D,t[20]=a,t[21]=z,t[22]=ge):ge=t[22];let _e=ge,ve;t[23]===_?ve=t[24]:(ve=_(`settings.agents.modelSelector.searchPlaceholder`),t[23]=_,t[24]=ve);let ye;t[25]===_?ye=t[26]:(ye=_(`settings.agents.modelSelector.state.noModelsFound`),t[25]=_,t[26]=ye);let be;t[27]===_?be=t[28]:(be=_(`settings.agents.modelSelector.section.favorites`),t[27]=_,t[28]=be);let xe;t[29]===_?xe=t[30]:(xe=_(`settings.agents.modelSelector.section.recent`),t[29]=_,t[30]=xe);let Se;t[31]===_?Se=t[32]:(Se=_(`settings.agents.modelSelector.keyboardHints`),t[31]=_,t[32]=Se);let Ce;t[33]!==l||t[34]!==_?(Ce=l||_(`settings.agents.modelSelector.notSelected`),t[33]=l,t[34]=_,t[35]=Ce):Ce=t[35];let we;t[36]===_?we=t[37]:(we=_(`settings.agents.modelSelector.actions.favorite`),t[36]=_,t[37]=we);let Te;t[38]===_?Te=t[39]:(Te=_(`settings.agents.modelSelector.actions.unfavorite`),t[38]=_,t[39]=Te);let W;t[40]===_?W=t[41]:(W=_(`chat.modelControls.provider`),t[40]=_,t[41]=W);let Ee;t[42]===_?Ee=t[43]:(Ee=_(`chat.modelControls.capabilities`),t[42]=_,t[43]=Ee);let De;t[44]===_?De=t[45]:(De=_(`chat.modelControls.capability.toolCalling`),t[44]=_,t[45]=De);let Oe;t[46]===_?Oe=t[47]:(Oe=_(`chat.modelControls.capability.reasoning`),t[46]=_,t[47]=Oe);let ke;t[48]===_?ke=t[49]:(ke=_(`chat.modelControls.modality.image`),t[48]=_,t[49]=ke);let Ae;t[50]===_?Ae=t[51]:(Ae=_(`chat.modelControls.modality.video`),t[50]=_,t[51]=Ae);let je;t[52]===_?je=t[53]:(je=_(`chat.modelControls.modality.audio`),t[52]=_,t[53]=je);let Ne;t[54]===_?Ne=t[55]:(Ne=_(`chat.modelControls.costPerMillion`),t[54]=_,t[55]=Ne);let Ie;t[56]===_?Ie=t[57]:(Ie=_(`chat.modelControls.costInput`),t[56]=_,t[57]=Ie);let Le;t[58]===_?Le=t[59]:(Le=_(`chat.modelControls.costOutput`),t[58]=_,t[59]=Le);let Re;t[60]!==ve||t[61]!==ye||t[62]!==be||t[63]!==xe||t[64]!==Se||t[65]!==Ce||t[66]!==we||t[67]!==Te||t[68]!==W||t[69]!==Ee||t[70]!==De||t[71]!==Oe||t[72]!==ke||t[73]!==Ae||t[74]!==je||t[75]!==Ne||t[76]!==Ie||t[77]!==Le?(Re={searchPlaceholder:ve,noResults:ye,favorites:be,recent:xe,keyboardHint:Se,notSelected:Ce,favorite:we,unfavorite:Te,provider:W,capabilities:Ee,capabilityToolCalling:De,capabilityReasoning:Oe,modalityImage:ke,modalityVideo:Ae,modalityAudio:je,costPerMillion:Ne,costInput:Ie,costOutput:Le},t[60]=ve,t[61]=ye,t[62]=be,t[63]=xe,t[64]=Se,t[65]=Ce,t[66]=we,t[67]=Te,t[68]=W,t[69]=Ee,t[70]=De,t[71]=Oe,t[72]=ke,t[73]=Ae,t[74]=je,t[75]=Ne,t[76]=Ie,t[77]=Le,t[78]=Re):Re=t[78];let ze=Re,Be;t[79]!==r||t[80]!==n?(Be=n&&r?{providerID:n,modelID:r}:null,t[79]=r,t[80]=n,t[81]=Be):Be=t[81];let Ve=Be,He;t[82]!==r||t[83]!==l||t[84]!==n||t[85]!==_?(He=n&&r?`${n}/${r}`:l||_(`settings.agents.modelSelector.notSelected`),t[82]=r,t[83]=l,t[84]=n,t[85]=_,t[86]=He):He=t[86];let We=He,Ge;t[87]!==_||t[88]!==i||t[89]!==B?(Ge=B?i||_(`chat.modelControls.default`):null,t[87]=_,t[88]=i,t[89]=B,t[90]=Ge):Ge=t[90];let Ke=Ge,qe;t[91]!==r||t[92]!==n||t[93]!==i||t[94]!==B?(qe=(e,t)=>{if(!(!B||e!==n||t!==r))return i||void 0},t[91]=r,t[92]=n,t[93]=i,t[94]=B,t[95]=qe):qe=t[95];let Je=qe,Ye;t[96]!==D||t[97]!==a||t[98]!==B?(Ye=(e,t,n)=>{a(e,t,B?n??``:void 0),D(e,t,B&&n||void 0),le()},t[96]=D,t[97]=a,t[98]=B,t[99]=Ye):Ye=t[99];let Xe=Ye,Ze;t[100]!==V||t[101]!==_||t[102]!==i||t[103]!==B?(Ze=(e,t)=>{let n=V(e);if(!B||n.length===0)return null;let r=e.variant!==void 0&&n.includes(e.variant)?e.variant:void 0,a=t.isSelected?i:r??``;return(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-9 shrink-0 items-center gap-0.5 rounded-md px-1.5 typography-micro font-medium text-muted-foreground hover:bg-interactive-hover hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e)},"aria-label":_(`chat.modelControls.showThinkingModes`),children:[(0,Z.jsx)(`span`,{className:`max-w-24 truncate`,children:a||_(`chat.modelControls.default`)}),(0,Z.jsx)(G,{name:`arrow-right-s`,className:`size-3.5`})]})},t[100]=V,t[101]=_,t[102]=i,t[103]=B,t[104]=Ze):Ze=t[104];let Qe=Ze,$e=te?`max-h-none flex-1`:void 0,et=m&&(te?N:P),tt;t[105]===E?tt=t[106]:(tt=e=>E(e.providerID,e.modelID),t[105]=E,t[106]=tt);let nt;t[107]!==r||t[108]!==n||t[109]!==T||t[110]!==i?(nt=e=>T(e.providerID,e.modelID,e.providerID===n&&e.modelID===r?i||void 0:e.variant),t[107]=r,t[108]=n,t[109]=T,t[110]=i,t[111]=nt):nt=t[111];let rt;t[112]!==c||t[113]!==s||t[114]!==j||t[115]!==S||t[116]!==pe||t[117]!==he||t[118]!==w||t[119]!==ze||t[120]!==O||t[121]!==x||t[122]!==M||t[123]!==Qe||t[124]!==R||t[125]!==Ve||t[126]!==$e||t[127]!==et||t[128]!==tt||t[129]!==nt?(rt=(0,Z.jsx)(Fe,{providers:x,providerOrder:O,favoriteModels:j,recentModels:M,getMetadata:S,searchQuery:R,onSearchQueryChange:ae,onSelect:pe,labels:ze,selectedModel:Ve,hiddenModels:w,allowedProviderIds:s,allowedModelIdsByProvider:c,includeNotSelected:!0,onSelectNone:he,onEscape:le,maxHeightClassName:$e,tooltipsEnabled:et,isFavorite:tt,onToggleFavorite:nt,renderRowEnd:Qe}),t[112]=c,t[113]=s,t[114]=j,t[115]=S,t[116]=pe,t[117]=he,t[118]=w,t[119]=ze,t[120]=O,t[121]=x,t[122]=M,t[123]=Qe,t[124]=R,t[125]=Ve,t[126]=$e,t[127]=et,t[128]=tt,t[129]=nt,t[130]=rt):rt=t[130];let it=rt,q;t[131]!==V||t[132]!==z?(q=z?V(z):[],t[131]=V,t[132]=z,t[133]=q):q=t[133];let J=q,Y;bb0:{if(!z){Y=``;break bb0}if(z.providerID===n&&z.modelID===r){Y=i||``;break bb0}Y=z.variant!==void 0&&J.includes(z.variant)?z.variant:``}let X=Y,at;t[134]!==_e||t[135]!==_||t[136]!==z||t[137]!==X||t[138]!==J?(at=z?(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 items-center gap-2 border-b border-border/40 px-3 text-left typography-ui-label font-medium text-foreground hover:bg-interactive-hover`,onClick:()=>oe(null),"aria-label":_(`header.actions.backAria`),children:[(0,Z.jsx)(G,{name:`arrow-left`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:z.modelID})]}),(0,Z.jsx)(`div`,{className:`space-y-1 p-2`,role:`listbox`,"aria-label":_(`chat.modelControls.thinking`),children:[``,...J].map(e=>{let t=X===e;return(0,Z.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,className:H(`flex min-h-11 w-full items-center justify-between rounded-lg px-3 text-left typography-ui-label transition-colors`,t?`bg-interactive-selection text-interactive-selection-foreground`:`hover:bg-interactive-hover`),onClick:()=>_e(e),children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e||_(`chat.modelControls.default`)}),t?(0,Z.jsx)(G,{name:`check`,className:`size-4 shrink-0`}):null]},e||`__default`)})})]}):null,t[134]=_e,t[135]=_,t[136]=z,t[137]=X,t[138]=J,t[139]=at):at=t[139];let ot=at||it;if(te){let e=v?ie:void 0,a=!v,l=!v&&`opacity-60 cursor-not-allowed`,u;t[140]!==o||t[141]!==l?(u=H(`flex w-full items-center justify-between gap-2 rounded-lg border border-border/40 bg-[var(--surface-elevated)] px-2 py-1.5 text-left`,l,o),t[140]=o,t[141]=l,t[142]=u):u=t[142];let d;t[143]!==v||t[144]!==y||t[145]!==r||t[146]!==n||t[147]!==g||t[148]!==_?(d=v?g&&(n||r)?(0,Z.jsx)(Pe,{modelId:r,providerId:n,className:`h-3.5 w-3.5 flex-shrink-0`}):g?(0,Z.jsx)(G,{name:`pencil-ai`,className:`h-3 w-3 text-muted-foreground`}):null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{name:`loader-4`,className:`h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:_(y?`common.unavailable`:`common.loading`)})]}),t[143]=v,t[144]=y,t[145]=r,t[146]=n,t[147]=g,t[148]=_,t[149]=d):d=t[149];let f;t[150]!==v||t[151]!==We?(f=v?(0,Z.jsx)(`span`,{className:`typography-meta font-medium text-foreground truncate`,children:We}):null,t[150]=v,t[151]=We,t[152]=f):f=t[152];let p;t[153]!==v||t[154]!==Ke?(p=v&&Ke?(0,Z.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground`,children:Ke}):null,t[153]=v,t[154]=Ke,t[155]=p):p=t[155];let m;t[156]!==d||t[157]!==f||t[158]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[d,f,p]}),t[156]=d,t[157]=f,t[158]=p,t[159]=m):m=t[159];let h;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(G,{name:`arrow-down-s`,className:`h-3 w-3 flex-shrink-0 text-muted-foreground`}),t[160]=h):h=t[160];let b;t[161]!==e||t[162]!==a||t[163]!==u||t[164]!==m?(b=(0,Z.jsxs)(`button`,{type:`button`,onClick:e,disabled:a,className:u,children:[m,h]}),t[161]=e,t[162]=a,t[163]=u,t[164]=m,t[165]=b):b=t[165];let C;t[166]!==j||t[167]!==r||t[168]!==n||t[169]!==M||t[170]!==T||t[171]!==i?(C=(e,t)=>T(e,t,e===n&&t===r?i||void 0:j.find(n=>n.providerID===e&&n.modelID===t)?.variant??M.find(n=>n.providerID===e&&n.modelID===t)?.variant),t[166]=j,t[167]=r,t[168]=n,t[169]=M,t[170]=T,t[171]=i,t[172]=C):C=t[172];let D;t[173]!==c||t[174]!==s||t[175]!==j||t[176]!==S||t[177]!==Xe||t[178]!==w||t[179]!==E||t[180]!==N||t[181]!==r||t[182]!==n||t[183]!==O||t[184]!==x||t[185]!==M||t[186]!==Je||t[187]!==C||t[188]!==B?(D=(0,Z.jsx)(wr,{open:N,onClose:le,selectedProviderID:n,selectedModelID:r,resolveSelectedVariant:Je,onSelect:Xe,providers:x,favoriteModels:j,recentModels:M,getMetadata:S,hiddenModels:w,allowedProviderIds:s,allowedModelIdsByProvider:c,providerOrder:O,variantSelectionEnabled:B,isFavorite:E,onToggleFavorite:C}),t[173]=c,t[174]=s,t[175]=j,t[176]=S,t[177]=Xe,t[178]=w,t[179]=E,t[180]=N,t[181]=r,t[182]=n,t[183]=O,t[184]=x,t[185]=M,t[186]=Je,t[187]=C,t[188]=B,t[189]=D):D=t[189];let k;return t[190]!==b||t[191]!==D?(k=(0,Z.jsxs)(Z.Fragment,{children:[b,D]}),t[190]=b,t[191]=D,t[192]=k):k=t[192],k}let st=v&&P,ct=v?L:void 0,lt=!v&&`opacity-60 cursor-not-allowed`,ut;t[193]!==o||t[194]!==lt?(ut=H(`border-input data-[placeholder]:text-muted-foreground flex min-w-0 items-center justify-between gap-2 rounded-lg border bg-transparent px-2 py-2 typography-ui-label whitespace-nowrap shadow-none outline-none hover:bg-interactive-hover data-[popup-open]:bg-interactive-active h-6 w-fit`,lt,o),t[193]=o,t[194]=lt,t[195]=ut):ut=t[195];let dt;t[196]!==v||t[197]!==y||t[198]!==r||t[199]!==n||t[200]!==g||t[201]!==_||t[202]!==We||t[203]!==Ke?(dt=v?(0,Z.jsxs)(Z.Fragment,{children:[g?n||r?(0,Z.jsx)(Pe,{modelId:r,providerId:n,className:`h-3.5 w-3.5 flex-shrink-0`}):(0,Z.jsx)(G,{name:`pencil-ai`,className:`h-3.5 w-3.5 flex-shrink-0 text-muted-foreground`}):null,(0,Z.jsx)(`span`,{className:`typography-ui-label min-w-0 flex-1 truncate text-left font-normal text-foreground`,children:We}),Ke?(0,Z.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground`,children:Ke}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{name:`loader-4`,className:`h-3.5 w-3.5 animate-spin text-muted-foreground flex-shrink-0`}),(0,Z.jsx)(`span`,{className:`typography-ui-label font-normal whitespace-nowrap text-muted-foreground`,children:_(y?`common.unavailable`:`common.loading`)})]}),t[196]=v,t[197]=y,t[198]=r,t[199]=n,t[200]=g,t[201]=_,t[202]=We,t[203]=Ke,t[204]=dt):dt=t[204];let ft;t[205]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,Z.jsx)(G,{name:`arrow-down-s`,className:`h-4 w-4 flex-shrink-0 text-muted-foreground/50`}),t[205]=ft):ft=t[205];let pt;t[206]!==ut||t[207]!==dt?(pt=(0,Z.jsx)(qn,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:ut,children:[dt,ft]})}),t[206]=ut,t[207]=dt,t[208]=pt):pt=t[208];let mt;t[209]!==h||t[210]!==ot?(mt=(0,Z.jsx)(Jn,{className:`w-[min(380px,calc(100vw-2rem))] p-0 flex flex-col`,align:`start`,portalToBody:h,children:ot}),t[209]=h,t[210]=ot,t[211]=mt):mt=t[211];let ht;return t[212]!==st||t[213]!==ct||t[214]!==pt||t[215]!==mt?(ht=(0,Z.jsxs)(Kn,{open:st,onOpenChange:ct,children:[pt,mt]}),t[212]=st,t[213]=ct,t[214]=pt,t[215]=mt,t[216]=ht):ht=t[216],ht};function Pr(e){return e.providers}function Fr(e){return e.getModelMetadata}function Ir(e){return e.isMobile}function Lr(e){return e.hiddenModels}function Rr(e){return e.toggleFavoriteModel}function zr(e){return e.isFavoriteModel}function Br(e){return e.addRecentModel}function Vr(e){return e.providerOrder}var Hr=e(D(),1),Ur=`mobile-overlay-root`,Wr=16,Gr=200,Kr=[],qr=0,Jr=``,Yr=0,Xr=()=>{if(typeof document>`u`)return null;let e=document.getElementById(Ur);return e||(e=document.createElement(`div`),e.id=Ur,document.body.appendChild(e)),e},Zr=({open:e,title:t,onClose:n,children:r,footer:i,className:a,contentMaxHeightClassName:o,renderHeader:s,containedBody:c=!1,closeAriaLabel:l})=>{let u=Q.useRef(null),d=Q.useRef(Symbol(`mobile-overlay`)),f=Q.useRef(n);f.current=n;let[p,m]=Q.useState(!1),[h,g]=Q.useState(!1);if(typeof document<`u`&&!u.current&&(u.current=Xr()),Q.useEffect(()=>{if(!e){m(!1),g(!1);return}let t=window.setTimeout(()=>m(!0),Wr),n=window.setTimeout(()=>g(!0),266);return()=>{window.clearTimeout(t),window.clearTimeout(n)}},[e]),Q.useLayoutEffect(()=>{if(e)return Yr===0&&window.dispatchEvent(new Event(`oc:mobile-overlay-opened`)),Yr+=1,()=>{Yr=Math.max(0,Yr-1),Yr===0&&window.dispatchEvent(new Event(`oc:mobile-overlay-closed`))}},[e]),Q.useEffect(()=>{if(!e)return;let t=d.current;Kr.push(t),qr===0&&(Jr=document.body.style.overflow),qr+=1,document.body.style.overflow=`hidden`;let n=e=>{e.key===`Escape`&&Kr[Kr.length-1]===t&&f.current()};return document.addEventListener(`keydown`,n),()=>{let e=Kr.lastIndexOf(t);e>=0&&Kr.splice(e,1),qr=Math.max(0,qr-1),qr===0&&(document.body.style.overflow=Jr),document.removeEventListener(`keydown`,n)}},[e]),!e||!u.current)return null;let _=o??`max-h-[min(70vh,520px)]`,v=(0,Z.jsx)(`div`,{className:H(`oc-keyboard-inset-surface fixed inset-0 z-[60] flex flex-col bg-[rgb(0_0_0_/_0.45)] transition-opacity duration-200 ease-out`,!h&&`oc-keyboard-inset-snap`,p?`opacity-100`:`opacity-0`),role:`dialog`,"aria-modal":`true`,"aria-label":t,onPointerDown:Ne,onClick:e=>{Le(e)&&n()},children:(0,Z.jsxs)(`div`,{className:H(`mt-auto flex max-h-[calc(100dvh-0.75rem)] min-h-0 w-full flex-col rounded-t-xl border-x border-t border-border/50 bg-background pb-[max(0.5rem,var(--oc-app-bottom-safe,0px),var(--oc-safe-area-bottom,env(safe-area-inset-bottom,0px)))] shadow-none pwa-overlay-panel`,`mx-auto max-w-lg`,a),style:{transform:p?`none`:`translateY(100%)`,transition:`transform ${Gr}ms cubic-bezier(0.32, 0.72, 0, 1)`},onClick:e=>e.stopPropagation(),children:[(()=>{let e=(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:H(`flex items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover`,c?`size-11`:`h-8 w-8`),"aria-label":l??t,children:(0,Z.jsx)(G,{name:`close`,className:`h-4 w-4`})});return s?s(e):(0,Z.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border/40`,children:[(0,Z.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:t}),e]})})(),c?(0,Z.jsx)(`div`,{className:H(`flex min-h-0 flex-1 flex-col overflow-hidden`,_),children:r}):(0,Z.jsx)(qe,{useScrollShadow:!0,disableHorizontal:!0,preventOverscroll:!0,outerClassName:H(`min-h-0 flex-1`,_),className:`px-2 py-2 pwa-overlay-scroll`,children:r}),i?(0,Z.jsx)(`div`,{className:`shrink-0 border-t border-border/40 px-3 py-2`,children:i}):null]})});return(0,Hr.createPortal)(v,u.current)},Qr=e=>e??i()?.github,$r=(e=t())=>c.github.auth(e),ei=async(e,t)=>{if(e)return e.authStatus();let n=await r(`/api/github/auth/status`,{method:`GET`,headers:{Accept:`application/json`},signal:t}),i=await n.json().catch(()=>null);if(!n.ok||!i)throw Error(i?.error||n.statusText||`Failed to load GitHub status`);return i},ti=(e,n=t())=>{let r=Qr(e);return{queryKey:$r(n),queryFn:async({signal:e})=>ei(r,e),retry:2}},ni=e=>!!e&&typeof e==`object`&&`authStatus`in e,ri=e=>{let t=(0,K.c)(5),n=ni(e)?e:void 0,r=ni(e)?void 0:e?.enabled,i;t[0]===n?i=t[1]:(i=ti(n),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a={...i,enabled:r},t[2]=r,t[3]=i,t[4]=a):a=t[4],N(a)},ii=(e=u,n=t())=>e.getQueryData($r(n))??null,ai=async(e,n,r)=>t()===r?e.fetchQuery({...ti(n,r),staleTime:0}):e.getQueryData($r(r))??null,oi=(e=u,n,r=t())=>{e.setQueryData($r(r),n)},si=F.define(se),ci=z.data.of({commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}}});function li(e){let t=e.trim().toLowerCase();switch(t){case`bash`:case`sh`:case`zsh`:case`shell`:case`shellsession`:case`console`:return si;case`json`:case`jsonc`:case`json5`:return ae().language;case`js`:case`javascript`:return L().language;case`jsx`:return L({jsx:!0}).language;case`ts`:case`typescript`:return L({typescript:!0}).language;case`tsx`:return L({typescript:!0,jsx:!0}).language;case`html`:return R().language;case`css`:return I().language;case`py`:case`python`:return B().language;case`md`:case`markdown`:case`mdown`:case`mkd`:return oe().language;case`heex`:case`eex`:case`leex`:return R().language;default:return ie.matchLanguageName(Je,t,!0)}}var ui=e=>e.split(`/`).pop()?.toLowerCase()??``,di=e=>{let t=ui(e);return t?ie.matchFilename(Je,t):null},fi=()=>ne(re.define([{tag:[P.heading1,P.heading2,P.heading3,P.heading4,P.heading5,P.heading6],fontWeight:`600`},{tag:P.strong,fontWeight:`600`},{tag:P.emphasis,fontStyle:`italic`},{tag:P.strikethrough,textDecoration:`line-through`},{tag:[P.link,P.url],color:`var(--markdown-link, currentColor)`,textDecoration:`underline`},{tag:P.monospace,color:`var(--markdown-inline-code, currentColor)`,backgroundColor:`var(--markdown-inline-code-bg, transparent)`},{tag:P.quote,color:`var(--markdown-blockquote, currentColor)`,fontStyle:`italic`},{tag:P.list,color:`color-mix(in srgb, var(--muted-foreground) 40%, var(--foreground) 60%)`},{tag:P.heading,color:`var(--markdown-heading1, currentColor)`}]));function pi(e){let t=e.toLowerCase();switch(ui(t)){case`makefile`:case`gnumakefile`:return si}let n=t.lastIndexOf(`.`),r=n>=0?t.slice(n+1):``;switch(r){case`ts`:case`tsx`:case`mts`:case`cts`:return L({typescript:!0,jsx:r===`tsx`});case`js`:case`jsx`:case`mjs`:case`cjs`:return L({typescript:!1,jsx:r===`jsx`});case`jsonc`:case`json5`:return[ae(),ci];case`json`:case`jsonl`:case`ndjson`:case`geojson`:return ae();case`css`:case`scss`:case`sass`:case`less`:return I();case`html`:case`htm`:case`xml`:case`drawio`:case`dio`:return R();case`md`:case`mdx`:case`markdown`:case`mdown`:case`mkd`:return[oe({codeLanguages:li}),fi()];case`sh`:case`bash`:case`zsh`:case`fish`:case`env`:return si;case`py`:case`pyw`:case`pyi`:return B();default:return null}}async function mi(e){let t=di(e);if(!t)return null;if(t.support)return t.support;try{return await t.load()}catch{return null}}var hi=60,gi=400;function _i(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return[];let n=t.match(/[^.!?…]+[.!?…]+["')\]]*\s*|[^.!?…]+$/g)??[t],r=[],i=``;for(let e of n)for(let t=0;t<e.length;t+=gi){let n=e.slice(t,t+gi);i&&i.length+n.length>gi&&(r.push(i.trim()),i=``),i+=n,i.length>=hi&&/[.!?…]["')\]]*\s*$/.test(i)&&(r.push(i.trim()),i=``)}if(i.trim()&&r.push(i.trim()),r.length>0&&r[0].length>120){let e=r[0],t=/[,;:]\s/g,n=-1,i;for(;(i=t.exec(e))!==null;){let e=i.index+1;if(!(e<40)){if(e>160)break;n=e;break}}if(n>0){let t=e.slice(0,n).trim(),i=e.slice(n).trim();r.splice(0,1,t,i)}}return r}var vi=null;function yi(){return vi||=new(window.AudioContext||window.webkitAudioContext),vi}function bi(){let[e,t]=(0,Q.useState)(!1),[n,i]=(0,Q.useState)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=(0,Q.useCallback)(async()=>{try{let e=yi();e.state===`suspended`&&await e.resume();let t=e.createBuffer(1,1,22050),n=e.createBufferSource();n.buffer=t,n.connect(e.destination),n.start(0)}catch{}},[]),c=(0,Q.useCallback)(()=>{let e=o.current;if(e&&(e.cancelled=!0,e.abort.abort(),o.current=null),a.current){try{a.current.onended=null,a.current.stop()}catch{}a.current=null}t(!1)},[]),l=(0,Q.useCallback)(async(e,n)=>{c();let s=_i(e);if(s.length===0){i(`No text to speak`),n?.onError?.(`No text to speak`);return}i(null);let l={cancelled:!1,abort:new AbortController};o.current=l;let u=async e=>{let t=await r(`/api/dictation/tts/speak`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e,...typeof n?.speakerId==`number`?{speakerId:n.speakerId}:{},...typeof n?.speed==`number`?{speed:n.speed}:{}}),signal:l.abort.signal});if(!t.ok){let e=await t.json().catch(()=>({error:`Unknown error`}));throw Error(e.error||`HTTP ${t.status}`)}return(await t.blob()).arrayBuffer()},d=async e=>{let t=yi();t.state===`suspended`&&await t.resume();let n=await t.decodeAudioData(e);l.cancelled||await new Promise(e=>{let r=t.createBufferSource();r.buffer=n,r.connect(t.destination),a.current=r,r.onended=()=>{a.current===r&&(a.current=null),e()},r.start(0)})};try{t(!0),n?.onStart?.();let e=u(s[0]);for(let t=0;t<s.length;t+=1){let n=await e;if(l.cancelled||(t+1<s.length&&(e=u(s[t+1])),await d(n),l.cancelled))return}t(!1),n?.onEnd?.()}catch(e){if(e.name===`AbortError`||l.cancelled)return;let r=e instanceof Error?e.message:`Failed to speak`;i(r),n?.onError?.(r),t(!1)}finally{o.current===l&&(o.current=null)}},[c]);return(0,Q.useEffect)(()=>()=>{c()},[c]),{isPlaying:e,error:n,speak:l,stop:c,unlockAudio:s}}var xi=new class{recognition=null;isListening=!1;currentLang=`en-US`;onResultCallback=null;onErrorCallback=null;restartOnEnd=!1;conversationMode=!1;isSpeaking=!1;audioContext=null;audioUnlockRequired=!1;isSupported(){let e=`SpeechRecognition`in window||`webkitSpeechRecognition`in window,t=`speechSynthesis`in window;return e&&t}getSupportDetails(){return{recognition:`SpeechRecognition`in window||`webkitSpeechRecognition`in window,synthesis:`speechSynthesis`in window,prefixed:!(`SpeechRecognition`in window)&&`webkitSpeechRecognition`in window,secureContext:window.isSecureContext}}setConversationMode(e){this.conversationMode=e,e||(this.restartOnEnd=!1)}isConversationMode(){return this.conversationMode}pauseListening(){if(this.restartOnEnd=!1,this.recognition)try{this.recognition.stop()}catch{}this.isListening=!1}resumeListening(){if(this.conversationMode,this.onResultCallback,this.isSpeaking,this.currentLang,this.conversationMode&&this.onResultCallback&&!this.isSpeaking)try{this.startListeningSync(this.currentLang,this.onResultCallback,this.onErrorCallback||void 0)}catch(e){console.error(`[BrowserVoiceService] Failed to resume listening:`,e)}}async checkMicrophonePermission(){try{return`permissions`in navigator&&(await navigator.permissions.query({name:`microphone`})).state===`granted`}catch{return!1}}async prepareListening(){if(!this.isSupported())throw Error(`Web Speech API not supported in this browser`);if(typeof navigator>`u`||typeof navigator.mediaDevices?.getUserMedia!=`function`)return!0;try{return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop()),!0}catch(e){let t=typeof e==`object`&&e&&`name`in e?String(e.name):``;if(t===`NotAllowedError`)throw Error(`Microphone permission denied`);if(t===`NotFoundError`)throw Error(`No microphone found`);let n=e instanceof Error?e.message:`Unable to access microphone`;throw Error(n)}}startListeningSync(e,t,n){if(!this.isSupported()){let e=`Web Speech API not supported in this browser`;throw n?.(e),Error(e)}this.stopListening();let r=window.SpeechRecognition||window.webkitSpeechRecognition;if(!r){let e=`Web Speech API not supported in this browser`;throw n?.(e),Error(e)}let i=new r;this.recognition=i,this.currentLang=e,this.onResultCallback=t,this.onErrorCallback=n||null,i.continuous=!0,i.interimResults=!0,i.lang=e,i.onstart=()=>{this.isListening=!0,this.restartOnEnd=!0},i.onaudiostart=()=>{},i.onsoundstart=()=>{},i.onresult=e=>{e.results.length;let t=``,n=``;for(let r=e.resultIndex;r<e.results.length;r++){let i=e.results[r];i.isFinal?t+=i[0].transcript:n+=i[0].transcript}n&&this.onResultCallback?.(n,!1),t&&this.onResultCallback?.(t,!0)},i.onerror=e=>{if(e.error===`aborted`)return;let t=this.getErrorMessage(e.error);this.onErrorCallback?.(t),(e.error===`not-allowed`||e.error===`service-not-allowed`||e.error===`network`)&&(this.restartOnEnd=!1,this.isListening=!1)},i.onend=()=>{if(this.isListening=!1,this.restartOnEnd&&this.recognition&&!this.isSpeaking)try{this.recognition.start()}catch{}};try{i.start()}catch(e){let t=e instanceof Error?e.message:`Failed to start speech recognition`;throw n?.(t),Error(t)}}async startListening(e,t,n){this.startListeningSync(e,t,n)}stopListening(){if(this.restartOnEnd=!1,this.recognition){try{this.recognition.stop()}catch{}this.recognition=null}this.isListening=!1}getIsListening(){return this.isListening}getCurrentLang(){return this.currentLang}async resumeAudioContext(){this.audioContext||=new(window.AudioContext||window.webkitAudioContext),this.audioContext.state===`suspended`&&await this.audioContext.resume()}isAudioUnlockRequired(){return this.audioUnlockRequired}async unlockAudio(){try{let e=new Audio;if(e.src=`data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA`,e.volume=.01,await e.play(),await this.resumeAudioContext(),this.isMobileDevice()&&`speechSynthesis`in window){let e=new SpeechSynthesisUtterance(``);e.volume=0,window.speechSynthesis.speak(e),window.speechSynthesis.cancel()}return this.audioUnlockRequired=!1,!0}catch(e){return console.error(`[BrowserVoiceService] Failed to unlock audio:`,e),!1}}async speakText(e,t,n,r){if(!(`speechSynthesis`in window))throw Error(`Speech synthesis not supported`);await this.resumeAudioContext();let i=await this.waitForVoices();await new Promise(e=>setTimeout(e,50)),this.isSpeaking=!0,this.pauseListening(),window.speechSynthesis.cancel();let a=new SpeechSynthesisUtterance(e);a.lang=t,a.rate=r?.rate??1,a.pitch=r?.pitch??1,a.volume=r?.volume??1;let o=null;return r?.voiceName&&(o=i.find(e=>e.name===r.voiceName)||null,o?`${o.name}${o.lang}`:console.warn(`[BrowserVoiceService] Selected voice "${r.voiceName}" not found, falling back to language match`)),o||(o=this.findBestVoice(i,t),o?`${o.name}${o.lang}`:console.warn(`[BrowserVoiceService] No voice found for language: ${t}, using default`)),o&&(a.voice=o),`${e.length}${t}`,new Promise((e,t)=>{let r=!1;a.onstart=()=>{r=!0,e()},a.onend=()=>{this.isSpeaking=!1,n?.()},a.onerror=e=>{this.isSpeaking=!1,console.error(`[BrowserVoiceService] Speech synthesis error:`,e.error),(e.error===`not-allowed`||e.error===`interrupted`)&&(this.audioUnlockRequired=!0);let n=`Speech synthesis error: ${e.error||`unknown`}`;e.error===`not-allowed`?n=`Audio blocked by browser autoplay policy. Please interact with the page first.`:e.error===`interrupted`&&(n=`Speech was interrupted. Please try again.`),t(Error(n))},setTimeout(()=>{r||(console.warn(`[BrowserVoiceService] Speech start timeout - audio may be blocked`),this.audioUnlockRequired=!0)},2e3),window.speechSynthesis.speak(a)})}cancelSpeech(){`speechSynthesis`in window&&window.speechSynthesis.cancel()}getVoices(){return`speechSynthesis`in window?window.speechSynthesis.getVoices():[]}async waitForVoices(){if(!(`speechSynthesis`in window))return[];let e=window.speechSynthesis.getVoices();return e.length>0?e:new Promise(e=>{let t=()=>{e(window.speechSynthesis.getVoices()),window.speechSynthesis.onvoiceschanged=null};window.speechSynthesis.onvoiceschanged=t,setTimeout(()=>{e(window.speechSynthesis.getVoices()),window.speechSynthesis.onvoiceschanged=null},1e3)})}findBestVoice(e,t){let n=e.find(e=>e.lang===t);if(!n){let r=t.split(`-`)[0];n=e.find(e=>e.lang.startsWith(r))}return n||=e.find(e=>e.lang.startsWith(t.split(`-`)[0])&&e.localService),n||null}isMobileDevice(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return/iphone|ipad|ipod|android|mobile|webos|blackberry|iemobile|opera mini/i.test(e)}isIOSSafari(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase(),t=/iphone|ipad|ipod/i.test(e),n=/safari/i.test(e)&&!/chrome|crios|crmo/i.test(e);return t&&n}getErrorMessage(e){let t=this.isMobileDevice(),n=this.isIOSSafari();return{"no-speech":`No speech detected`,aborted:`Speech recognition aborted`,"audio-capture":`No microphone found`,network:`Network error - check connection`,"not-allowed":t?`Microphone permission denied. Check Settings > Safari > Microphone`:`Microphone permission denied`,"service-not-allowed":n?`Speech recognition requires a user gesture. Please tap the microphone button again.`:`Speech recognition service not allowed`,"bad-grammar":`Grammar error`,"language-not-supported":`Language not supported`}[e]||`Speech recognition error: ${e}`}},Si=e=>{if(e===`12h`)return!0;if(e===`24h`)return!1},Ci=(e,t,n={})=>{let r=e instanceof Date?e:new Date(e);return Number.isFinite(r.getTime())?r.toLocaleTimeString(V(),{hour:n.hour??`numeric`,minute:`2-digit`,second:n.precision===`second`?`2-digit`:void 0,hour12:Si(t)}):n.fallback??``},wi=(e,t,n)=>{let r=e instanceof Date?e:new Date(e);return Number.isFinite(r.getTime())?r.toLocaleString(V(),{...n,hour12:n.hour?Si(t):n.hour12}):``},Ti=Q.memo(function(e){let t=(0,K.c)(24),{checked:n,onChange:r,disabled:i,ariaLabel:a,className:o,iconClassName:s}=e,c=i!==void 0&&i,l;t[0]!==n||t[1]!==c||t[2]!==r?(l=e=>{e.preventDefault(),e.stopPropagation(),!c&&!n&&r()},t[0]=n,t[1]=c,t[2]=r,t[3]=l):l=t[3];let u=l,d;t[4]!==n||t[5]!==c||t[6]!==r?(d=e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),!c&&!n&&r())},t[4]=n,t[5]=c,t[6]=r,t[7]=d):d=t[7];let f=d,p=n?`bg-[color-mix(in_srgb,var(--primary-base)_80%,transparent)] shadow-none hover:bg-[var(--primary-base)]`:`bg-[var(--surface-muted)] shadow-[inset_0_0_0_1px_var(--interactive-border)] hover:bg-[var(--interactive-hover)]`,m;t[8]!==o||t[9]!==p?(m=H(`group/radio relative flex h-[14px] w-[14px] min-h-[14px] min-w-[14px] shrink-0 self-center items-center justify-center rounded-full outline-none`,`transition-[background-color,box-shadow] duration-200 ease-out`,p,`focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] focus-visible:ring-offset-1 focus-visible:ring-offset-background`,`disabled:cursor-not-allowed disabled:opacity-50`,o),t[8]=o,t[9]=p,t[10]=m):m=t[10];let h=!n&&`opacity-0`,g;t[11]!==s||t[12]!==h?(g=H(`block h-[5px] w-[5px] rounded-full bg-white`,h,s),t[11]=s,t[12]=h,t[13]=g):g=t[13];let _;t[14]===g?_=t[15]:(_=(0,Z.jsx)(`span`,{"aria-hidden":!0,className:g}),t[14]=g,t[15]=_);let v;return t[16]!==a||t[17]!==n||t[18]!==c||t[19]!==u||t[20]!==f||t[21]!==m||t[22]!==_?(v=(0,Z.jsx)(`button`,{type:`button`,role:`radio`,onClick:u,onKeyDown:f,disabled:c,"aria-checked":n,"aria-label":a,className:m,children:_}),t[16]=a,t[17]=n,t[18]=c,t[19]=u,t[20]=f,t[21]=m,t[22]=_,t[23]=v):v=t[23],v}),$=e=>me(pe.getState().dictionary,e),Ei=e=>typeof e!=`number`||!Number.isFinite(e)?null:Math.max(0,Math.min(100,Math.round(e))),Di=e=>typeof e!=`number`||!Number.isFinite(e)?`-`:`${Math.round(e)}%`,Oi=(e,t)=>e??Di(t),ki=(e,t,n=`auto`)=>{if(!e)return t??``;try{let r=new Date(e);if(!Number.isFinite(r.getTime()))return t??``;let i=new Date;return r.toDateString()===i.toDateString()?Ci(r,n,{fallback:t??``}):wi(r,n,{month:`short`,day:`numeric`,weekday:`short`,hour:`numeric`,minute:`2-digit`})}catch{return t??``}},Ai=e=>e===null?`safe`:e>=80?`critical`:e>=50?`warn`:`safe`,ji=e=>e===`5h`?$(`quota.window.5h`):e===`7d`?$(`quota.window.7d`):e===`7d-sonnet`?$(`quota.window.7dSonnet`):e===`7d-opus`?$(`quota.window.7dOpus`):e===`weekly`?$(`quota.window.weekly`):e===`daily`?$(`quota.window.daily`):e===`monthly`?$(`quota.window.monthly`):e===`credits`?$(`quota.window.credits`):e===`credits_balance`?$(`quota.window.creditsBalance`):e===`billing_cycle`?$(`quota.window.billingCycle`):e===`auto`?$(`quota.window.auto`):e===`api`?$(`quota.window.api`):e===`plan_limit`?$(`quota.window.planLimit`):e===`on_demand`?$(`quota.window.onDemand`):e===`session`?$(`quota.window.session`):e===`premium`?$(`quota.window.premium`):e===`chat`?$(`quota.window.chat`):e===`completions`?$(`quota.window.completions`):e===`premium_interactions`?$(`quota.window.premiumInteractions`):e,Mi=e=>{let t=e.toLowerCase().trim();if(t===`5h`)return 18e3;if(t===`7d`||t===`weekly`||t===`7d-sonnet`||t===`7d-opus`)return 604800;if(t===`monthly`)return 2592e3;if(t===`24h`||t===`daily`)return 86400;if(t===`1h`)return 3600;let n=t.match(/^(\d+)h$/);if(n)return parseInt(n[1],10)*3600;let r=t.match(/^(\d+)d$/);return r?parseInt(r[1],10)*86400:null},Ni=(e,t,n,r)=>{let i=n;if(i===null&&r&&(i=Mi(r)),e===null||t===null||i===null||i<=0)return null;let a=Math.max(0,(t-Date.now())/1e3),o=Math.max(0,Math.min(i,i-a)),s=Math.max(0,Math.min(1,o/i)),c=e/100,l=e>=100&&a>0,u;u=s>.01?Math.min(999,c/s*100):e;let d;d=l?`exhausted`:c<=s?`on-track`:u<=130?`slightly-fast`:`too-fast`;let f=i>=432e3,p=f?86400:3600,m=f?`d`:`h`,h=i/p,g=e/Math.max(o/p,h*.01),_=Number.isFinite(g)?`${Math.min(999.9,Math.max(0,g)).toFixed(1)}%/${m}`:`-`,v=u>100?`+${Math.round(u)}%`:`${Math.round(u)}%`,y=null,b=i/86400;return b>=7&&(y=100/b),{elapsedRatio:s,usageRatio:c,predictedFinalPercent:u,remainingSeconds:a,isExhausted:l,elapsedSeconds:o,totalSeconds:i,status:d,paceRateText:_,predictText:v,dailyAllocationPercent:y}},Pi=e=>{switch(e){case`exhausted`:case`too-fast`:return`var(--status-error)`;case`slightly-fast`:return`var(--status-warning)`;case`on-track`:return`var(--status-success)`}},Fi=e=>{let t=Math.floor(Math.max(0,Math.floor(e))/60),n=Math.floor(t/60),r=Math.floor(n/24),i=n%24,a=t%60;return r>0?`${r}d ${i}h`:n>0?`${n}h`:t===0?`<1m`:`${a}m`},Ii=e=>Math.min(100,Math.max(0,e*100)),Li=(e,t)=>me(pe.getState().dictionary,e,t),Ri=e=>{let t=new Date(e),n=new Date,r=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),i=new Date(n);return i.setDate(n.getDate()-1),r(t,n)?Li(`common.date.today`):r(t,i)?Li(`common.date.yesterday`):t.toLocaleDateString(V(),{month:`short`,day:`numeric`,year:`numeric`}).replace(`,`,``)},zi=e=>{let t=new Date;if(((e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate())(new Date(e),t)){let t=Date.now()-e;return t<6e4?Li(`common.relative.justNow`):t<36e5?Li(`common.relative.minutesAgoShort`,{count:Math.floor(t/6e4)}):Li(`common.relative.hoursAgoShort`,{count:Math.floor(t/36e5)})}return Ri(e)},Bi=e=>{let t=Math.max(0,Date.now()-e),n=6e4,r=60*n,i=24*r,a=7*i,o=365*i;return t<r?Li(`common.relative.minutesAgoCompact`,{count:Math.max(1,Math.floor(t/n))}):t<i?Li(`common.relative.hoursAgoCompact`,{count:Math.floor(t/r)}):t<a?Li(`common.relative.daysAgoCompact`,{count:Math.floor(t/i)}):t<5*a?Li(`common.relative.weeksAgoCompact`,{count:Math.floor(t/a)}):t<o?Li(`common.relative.monthsAgoCompact`,{count:Math.floor(t/2592e6)}):Li(`common.relative.yearsAgoCompact`,{count:Math.floor(t/o)})},Vi=(e,t)=>Hi(l(e),l(t)),Hi=(e,t)=>!e||!t?!1:e===t?!0:t===`/`?e.startsWith(`/`):e.startsWith(`${t}/`),Ui=e=>e.toLowerCase().replace(/^opencode[/-]?/i,``).replace(/[-_]/g,``).trim(),Wi=(e,t)=>e?Ui(e)!==Ui(t):!1,Gi=e=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim().length>0){let t=Number(e);if(Number.isFinite(t))return t}},Ki=e=>Gi(e.time?.created)??0,qi=(e,t,n)=>{let r=n.has(e.id),i=n.has(t.id);return r===i?r&&i?Ki(t)-Ki(e):Ce(t)-Ce(e):r?-1:1},Ji=e=>{let t=new Map;return e.forEach(e=>{t.set(e.id,e)}),Array.from(t.values())},Yi=e=>`__archived__:${e}`,Xi=(e,t)=>{let n=l(e.directory??null),r=l(e.project?.worktree??null),i=n??r;if(!i)return`unassigned`;if(t&&i===t)return`project root`;let a=(t&&i.startsWith(`${t}/`)?i.slice(t.length+1):i).split(`/`).filter(Boolean);return a[a.length-1]??`unassigned`},Zi=`box-border w-full px-2 py-1.5 text-left typography-micro text-muted-foreground/70 select-none`,Qi=`bg-[color-mix(in_srgb,var(--surface-foreground)_6%,transparent)] dark:bg-[color-mix(in_srgb,var(--surface-foreground)_11%,transparent)]`,$i=`hover:bg-[color-mix(in_srgb,var(--surface-foreground)_3.5%,transparent)] dark:hover:bg-[color-mix(in_srgb,var(--surface-foreground)_8%,transparent)]`,ea=e=>{let t=Math.max(0,e);return t===0?8:30+(t-1)*14},ta=(e,t)=>{if(!t)return e;let n=e.toLowerCase(),r=t.toLowerCase(),i=r.length;if(i===0)return e;let a=[],o=0,s=n.indexOf(r,o);for(;s!==-1;){s>o&&a.push(e.slice(o,s));let t=e.slice(s,s+i);a.push((0,Z.jsx)(`mark`,{className:`bg-primary text-primary-foreground ring-1 ring-primary/90`,children:t},`${s}-${t}`)),o=s+i,s=n.indexOf(r,o)}return o<e.length&&a.push(e.slice(o)),a.length>0?a:e},na=[`standalone`,`minimal-ui`,`fullscreen`,`window-controls-overlay`],ra=`openchamber.pwaRecentSessions`,ia=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(display-mode: ${e})`).matches,aa=()=>typeof window>`u`?`browser`:typeof document<`u`&&document.referrer.startsWith(`android-app://`)?`twa`:window.navigator.standalone?`standalone`:na.find(e=>ia(e))??`browser`,oa=864e5,sa=5,ca=864e5,la=e=>e.time?.updated??e.time?.created??0,ua=({sessions:e,currentSessionId:t,cutoffDays:n,keepRecent:r=sa,now:i=Date.now()})=>{if(!Array.isArray(e)||n<=0)return[];let a=i-n*oa,o=[...e].sort((e,t)=>la(t)-la(e)),s=new Set(o.slice(0,r).map(e=>e.id));return o.filter(e=>{if(!e?.id||s.has(e.id)||e.id===t||e.share)return!1;let n=la(e);return n?n<a:!1}).map(e=>e.id)},da=e=>{let t=typeof e==`object`?e:void 0,n=t?.autoRun!==!1,r=typeof e==`boolean`?e:t?.enabled??!0,i=ve(e=>e.currentSessionId),a=ve(e=>e.isLoading),o=xe(e=>e.activeSessions),s=xe(e=>e.hasLoadedFullCatalog),c=k(e=>e.autoDeleteEnabled),l=k(e=>e.autoDeleteAfterDays),u=k(e=>e.sessionRetentionAction),d=k(e=>e.autoDeleteLastRunAt),f=k(e=>e.setAutoDeleteLastRunAt),[p,m]=Q.useState(!1),h=Q.useRef(!1);Q.useEffect(()=>{if(!r||!n||!c||l<=0)return;let e=window.setTimeout(()=>{Se(_e())},8e3);return()=>window.clearTimeout(e)},[l,c,n,r]);let g=Q.useMemo(()=>l<=0?[]:ua({sessions:o,currentSessionId:i,cutoffDays:l}),[l,i,o]),_=Q.useCallback(async({force:e=!1}={})=>{if(h.current)return{completedIds:[],failedIds:[],action:u,skippedReason:`running`};if((!c||l<=0)&&!e)return{completedIds:[],failedIds:[],action:u,skippedReason:`disabled`};if(a)return{completedIds:[],failedIds:[],action:u,skippedReason:`loading`};let t=Date.now();if(!e&&d&&t-d<ca)return{completedIds:[],failedIds:[],action:u,skippedReason:`cooldown`};let{activeSessions:n}=await Se(_e());if(n.length===0)return{completedIds:[],failedIds:[],action:u,skippedReason:`no-candidates`};let r=ua({sessions:n,currentSessionId:i,cutoffDays:l,now:t});if(r.length===0)return f(t),{completedIds:[],failedIds:[],action:u,skippedReason:`no-candidates`};h.current=!0,m(!0);try{let e=new Map(n.map(e=>[e.id,e])),t=[],i=[];for(let n of r){let r=e.get(n),a=r?ye(r):null;if(!a){i.push(n);continue}try{u===`archive`?await O.updateSession(n,{time:{archived:Date.now()}},a):await O.deleteSession(n,a),t.push(n)}catch{i.push(n)}}return u===`archive`?xe.getState().archiveSessions(t):xe.getState().removeSessions(t),{completedIds:t,failedIds:i,action:u}}finally{h.current=!1,m(!1),f(Date.now())}},[l,c,d,i,a,u,f]);return Q.useEffect(()=>{r&&n&&(!c||l<=0||a||!s||o.length===0||d&&Date.now()-d<ca||_())},[l,c,d,n,r,s,o.length,a,_]),{candidates:g,isRunning:p,runCleanup:_,keepRecentCount:sa,action:u}};export{Xn as $,rt as $t,xi as A,Yt as At,Nr as B,_t as Bt,Fi as C,fn as Ct,Ti as D,un as Dt,Ai as E,sn as Et,ii as F,Vt as Ft,br as G,bt as Gt,hr as H,gt as Ht,ai as I,Ct as It,er as J,Nt as Jt,_r as K,Pt as Kt,oi as L,mt as Lt,li as M,Wt as Mt,pi as N,Bt as Nt,wi as O,hn as Ot,mi as P,Ht as Pt,Qn as Q,nt as Qt,ri as R,vt as Rt,Oi as S,rn as St,Pi as T,ln as Tt,vr as U,xt as Ut,wr as V,ht as Vt,yr as W,St as Wt,Jn as X,It as Xt,Kn as Y,Ft as Yt,Yn as Z,tt as Zt,Xi as _,yn as _t,Qi as a,Hn as at,Ei as b,dn as bt,Ji as c,Ln as ct,Yi as d,Fn as dt,Zn as et,ea as f,zn as ft,ta as g,gn as gt,Ui as h,xn as ht,Zi as i,Bn as it,bi as j,Gt as jt,Ci as k,mn as kt,Bi as l,Rn as lt,Vi as m,jn as mt,ra as n,qn as nt,$i as o,Pn as ot,Wi as p,kn as pt,ar as q,Mt as qt,aa as r,Sn as rt,qi as s,In as st,da as t,$n as tt,zi as u,Vn as ut,Ii as v,_n as vt,ji as w,pn as wt,ki as x,cn as xt,Ni as y,vn as yt,Zr as z,yt as zt};