nextclaw 0.18.4 → 0.18.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/app/index.js +87 -372
- package/package.json +10 -10
- package/ui-dist/assets/{api-DnPN4SyA.js → api-C51456xV.js} +1 -1
- package/ui-dist/assets/{app-manager-provider-M7TngYxx.js → app-manager-provider-D_cKqqRG.js} +1 -1
- package/ui-dist/assets/{app-navigation.config-B5YIdRju.js → app-navigation.config-Dve1W20Y.js} +1 -1
- package/ui-dist/assets/{channels-list-page-Cm-Bbu6u.js → channels-list-page-WJ7d4zMI.js} +1 -1
- package/ui-dist/assets/{chat-C0ZNZtS3.js → chat-DCi1-y8U.js} +1 -1
- package/ui-dist/assets/{chat-page-CGHNhXaw.js → chat-page-CHKwiqPY.js} +1 -1
- package/ui-dist/assets/{chunk-JZWAC4HX-BJer-fqD.js → chunk-JZWAC4HX-ptDyT_1C.js} +1 -1
- package/ui-dist/assets/{desktop-update-config-Dfh-3uma.js → desktop-update-config-gnna2NaS.js} +1 -1
- package/ui-dist/assets/{dialog-D-I7ONHQ.js → dialog-BHcaU6NE.js} +1 -1
- package/ui-dist/assets/{dist-DreLBS93.js → dist-DtBFqZ6_.js} +1 -1
- package/ui-dist/assets/{es2015-DMSUl3fm.js → es2015-BlNhrQUG.js} +1 -1
- package/ui-dist/assets/{index-Bc6c1kIx.js → index-CxzW1dQ9.js} +2 -2
- package/ui-dist/assets/marketplace-page-0sEdt5sA.js +1 -0
- package/ui-dist/assets/{marketplace-page-BCrS-jH6.js → marketplace-page-DiqqX25V.js} +1 -1
- package/ui-dist/assets/mcp-marketplace-page-B8vmu9xe.js +1 -0
- package/ui-dist/assets/{mcp-marketplace-page-CjrxT6wI.js → mcp-marketplace-page-C_akqPwv.js} +1 -1
- package/ui-dist/assets/{model-config-D4myteLK.js → model-config-B0L43HTL.js} +1 -1
- package/ui-dist/assets/{notice-card-DX_NEZTQ.js → notice-card-C9PFAR67.js} +1 -1
- package/ui-dist/assets/{popover-Dm_NQ3Cs.js → popover-B8msg2FQ.js} +1 -1
- package/ui-dist/assets/{provider-scoped-model-input-BLHImwI5.js → provider-scoped-model-input-DeAo2Y65.js} +1 -1
- package/ui-dist/assets/{providers-list-DsBFslNi.js → providers-list-5_VShcn7.js} +1 -1
- package/ui-dist/assets/remote-pzp4oLcL.js +1 -0
- package/ui-dist/assets/{runtime-config-page-Bz9r68Rf.js → runtime-config-page-BuWmH7fe.js} +1 -1
- package/ui-dist/assets/{search-config-C-6KpgRQ.js → search-config-DJTm9Fno.js} +1 -1
- package/ui-dist/assets/{secrets-config-MiMElvpm.js → secrets-config-DKFeFii1.js} +1 -1
- package/ui-dist/assets/{select-RgeHgn_-.js → select-DRDejPLk.js} +1 -1
- package/ui-dist/assets/{sessions-config-page-0KNW9QC_.js → sessions-config-page-DZrdd2zT.js} +1 -1
- package/ui-dist/assets/{setting-row-vwm4XKv2.js → setting-row-BcF6eTW0.js} +1 -1
- package/ui-dist/assets/{tag-chip-DGqz3TON.js → tag-chip-CVIqyMv7.js} +1 -1
- package/ui-dist/assets/{theme-provider-CUppbOyN.js → theme-provider-dHqcWU-j.js} +1 -1
- package/ui-dist/assets/{tooltip-DQlSKhZ_.js → tooltip-C6VPreZ7.js} +1 -1
- package/ui-dist/assets/{use-config-CrsavfWZ.js → use-config-DFja1sda.js} +1 -1
- package/ui-dist/assets/{use-confirm-dialog-D1AnLFlc.js → use-confirm-dialog-DvIbSUX3.js} +1 -1
- package/ui-dist/assets/{use-infinite-scroll-loader-DZhv-rmv.js → use-infinite-scroll-loader-D8h0k-iL.js} +1 -1
- package/ui-dist/assets/{use-viewport-layout-CytJAPWM.js → use-viewport-layout-D-pjxsyz.js} +1 -1
- package/ui-dist/index.html +16 -16
- package/ui-dist/assets/marketplace-page-DVrlpB68.js +0 -1
- package/ui-dist/assets/mcp-marketplace-page-pQ_A38fH.js +0 -1
- package/ui-dist/assets/remote-CQQykOYe.js +0 -1
package/ui-dist/assets/{app-manager-provider-M7TngYxx.js → app-manager-provider-D_cKqqRG.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,n as r,p as i}from"./i18n-BnNAQpVM.js";import{At as a,Ct as o,Dt as s,Et as c,It as l,Mt as u,Ot as d,Pt as f,St as p,Tt as m,a as h,bt as g,c as _,d as v,ft as ee,i as y,kt as b,l as x,o as S,s as te,u as ne,wt as C,xt as w}from"./api-DnPN4SyA.js";import{a as T,n as re,o as ie,r as E,t as D}from"./dialog-D-I7ONHQ.js";import{t as O}from"./createLucideIcon-C_GFKVuW.js";import{t as ae}from"./key-round-BQXmPSxD.js";import{t as oe}from"./refresh-ccw-CeG203yU.js";import{t as k}from"./notice-card-DX_NEZTQ.js";import{t as A}from"./status-dot-aQU9Mia4.js";var se=O(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),ce=O(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),j=O(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]);function M(){return l({queryKey:L,queryFn:S,staleTime:5e3,refetchOnWindowFocus:!0})}var N=e(n(),1),P=i();function F(e){let{label:t,muted:n,value:r}=e;return(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,P.jsx)(`span`,{className:`text-gray-500`,children:t}),(0,P.jsx)(`span`,{className:n?`text-right text-gray-500`:`text-right text-gray-900`,children:r==null||r===``?`-`:String(r)})]})}function I(){let e=$(),n=M(),i=n.data,l=W(e=>e.actionLabel),u=(0,N.useMemo)(()=>J(i),[i]),d=!!l,f=i?.runtime?.deviceName?.trim()||i?.settings.deviceName?.trim()||t(`remoteDeviceNameAuto`),h=!!(i?.account.loggedIn&&U(i)),{hero:g,issueHint:_}=u;return(0,N.useEffect)(()=>{e.remoteAccessManager.syncStatus(i)},[e,i]),n.isLoading&&!i?(0,P.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`remoteLoading`)}):(0,P.jsxs)(s,{className:`space-y-6`,children:[(0,P.jsx)(c,{title:t(`remotePageTitle`),description:t(`remotePageDescription`)}),(0,P.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,P.jsxs)(w,{children:[(0,P.jsxs)(C,{className:`space-y-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(m,{children:g.title}),(0,P.jsx)(A,{status:g.badgeStatus,label:g.badgeLabel})]}),(0,P.jsx)(o,{children:g.description})]}),(0,P.jsxs)(p,{className:`space-y-5`,children:[(0,P.jsxs)(k,{tone:`neutral`,children:[(0,P.jsx)(F,{label:t(`remoteSignedInAccount`),value:i?.account.email}),(0,P.jsx)(F,{label:t(`remoteDeviceName`),value:f}),(0,P.jsx)(F,{label:t(`remoteConnectionStatus`),value:g.badgeLabel}),(0,P.jsx)(F,{label:t(`remoteLastConnectedAt`),value:i?.runtime?.lastConnectedAt?r(i.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[u.primaryAction?(0,P.jsxs)(a,{onClick:()=>{if(u.primaryAction?.kind===`reauthorize`){e.remoteAccessManager.reauthorizeRemoteAccess(i);return}if(u.primaryAction?.kind===`repair`){e.remoteAccessManager.repairRemoteAccess(i);return}e.remoteAccessManager.enableRemoteAccess(i)},disabled:d,children:[u.primaryAction.showRefreshIcon?(0,P.jsx)(oe,{className:`mr-2 h-4 w-4`}):null,l||u.primaryAction.label]}):null,(0,P.jsxs)(a,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:d||!h,children:[(0,P.jsx)(j,{className:`mr-2 h-4 w-4`}),t(`remoteOpenDeviceList`)]}),i?.settings.enabled?(0,P.jsx)(a,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(i),disabled:d,children:t(`remoteDisable`)}):null]}),u.shouldShowIssueHint&&_?(0,P.jsx)(k,{tone:`warning`,title:_.title,description:_.body}):null,(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`remoteOpenWebHint`)})]})]}),(0,P.jsxs)(w,{children:[(0,P.jsxs)(C,{children:[(0,P.jsxs)(m,{className:`flex items-center gap-2`,children:[(0,P.jsx)(se,{className:`h-4 w-4 text-primary`}),t(`remoteDeviceSectionTitle`)]}),(0,P.jsx)(o,{children:t(`remoteDeviceSectionDescription`)})]}),(0,P.jsxs)(p,{className:`space-y-5`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsx)(A,{status:i?.account.loggedIn?`ready`:`inactive`,label:i?.account.loggedIn?t(`remoteAccountConnected`):t(`remoteAccountNotConnected`)}),(0,P.jsx)(A,{status:i?.settings.enabled?`active`:`inactive`,label:i?.settings.enabled?t(`remoteEnabled`):t(`remoteStateDisabled`)}),(0,P.jsx)(A,{status:i?.service.running?`active`:`inactive`,label:i?.service.running?t(`remoteServiceRunning`):t(`remoteServiceStopped`)})]}),(0,P.jsxs)(k,{tone:`neutral`,children:[(0,P.jsx)(F,{label:t(`remoteDeviceName`),value:f}),(0,P.jsx)(F,{label:t(`remoteConnectionStatus`),value:g.badgeLabel}),(0,P.jsx)(F,{label:t(`remoteLastConnectedAt`),value:i?.runtime?.lastConnectedAt?r(i.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,P.jsx)(k,{tone:`neutral`,borderStyle:`dashed`,description:i?.account.loggedIn?t(`remoteOpenWebHint`):t(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})]})]})]})}var L=[`remote-status`],R=`https://platform.nextclaw.io`,le=`https://nextclaw-platform-console.pages.dev`,z=async()=>await u.fetchQuery({queryKey:L,queryFn:S,staleTime:5e3}),B=async()=>(await u.invalidateQueries({queryKey:L}),await z()),V=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function H(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return R;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return le}var U=e=>H(e?.account.apiBase)||H(e?.settings.platformApiBase)||H(e?.platformBase)||H(e?.account.platformBase)||void 0,W=g(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),G=class{constructor(){this.accountManager=null,this.bindAccountManager=e=>{this.accountManager=e},this.syncStatus=e=>{if(!e)return;let t=W.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{W.getState().setEnabled(e)},this.setDeviceName=e=>{W.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{W.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{W.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await B(),n=W.getState();if(!t.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`},apiBase:n.platformApiBase});return}await this.applyEnabledState(!0,t)},this.disableRemoteAccess=async e=>{let t=e??await B();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let n=e??await B();if(!n.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`}});return}let r=n.service.running?`restart`:`start`;await this.runManagedAction({actionLabel:t(r===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await y(r);let e=await B();this.hydrateDraftFromStatus(e)},successMessage:t(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await B();await this.accountManager?.startBrowserSignIn({status:t,apiBase:W.getState().platformApiBase,pendingAction:{type:`repair-remote`}})},this.saveAdvancedSettings=async e=>{let n=e??await B(),r=W.getState();await this.runManagedAction({actionLabel:t(`remoteActionSavingAdvanced`),job:async()=>{await v({enabled:r.enabled,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let e=await B();this.hydrateDraftFromStatus(e)},successMessage:n.settings.enabled===r.enabled?t(`remoteSettingsSaved`):t(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:t(`remoteDoctorRunning`),job:async()=>{let e=await h();W.getState().setDoctor(e)},successMessage:t(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,t(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,t(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,t(`remoteActionStopping`))},this.resumePendingActionAfterSignIn=async(e,t)=>{if(e){if(e.type===`enable-remote`){await this.applyEnabledState(!0,t);return}e.type===`repair-remote`&&await this.repairRemoteAccess(t)}},this.applyEnabledState=async(e,n)=>{let r=W.getState();await this.runManagedAction({actionLabel:t(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await v({enabled:e,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let t=await B();this.hydrateDraftFromStatus(t),e?await y(t.service.running?`restart`:`start`):n.service.running&&await y(`restart`);let i=await B();this.hydrateDraftFromStatus(i)},successMessage:t(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await y(e),n=await B();this.hydrateDraftFromStatus(n),f.success(t.message)}})},this.hydrateDraftFromStatus=e=>{W.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{W.getState().beginAction(e.actionLabel);try{await e.job(),e.successMessage&&f.success(e.successMessage)}catch(e){let n=e instanceof Error?e.message:t(`error`);throw f.error(n),e}finally{W.getState().finishAction()}}}},ue=[/invalid or expired token/i,/missing bearer token/i,/token expired/i,/token is invalid/i,/run "nextclaw login"/i,/browser sign-in again/i];function K(e){return e?.runtime?.lastError?.trim()||``}function de(e){let n=t(`remoteStatusIssueDetailGeneric`),r=K(e);return r?`${n} (${r})`:n}function q(e){if(!e?.settings.enabled)return!1;let t=K(e);return ue.some(e=>e.test(t))}function J(e){return q(e)?{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteStateReauthorizationRequired`),title:t(`remoteStatusReauthorizationTitle`),description:t(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:t(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:t(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:t(`statusReady`),title:t(`remoteStatusReadyTitle`),description:t(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:t(`connecting`),title:t(`remoteStatusConnectingTitle`),description:t(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteStateDisconnected`),title:t(`remoteStatusIssueTitle`),description:t(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:de(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteServiceStopped`),title:t(`remoteStatusNeedsServiceTitle`),description:t(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:t(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:t(`statusInactive`),title:t(`remoteStatusNeedsEnable`),description:t(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:t(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:t(`statusSetup`),title:t(`remoteStatusNeedsSignIn`),description:t(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:t(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var Y=g(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,pendingAction:null,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),setPendingAction:t=>e({pendingAction:t}),clearPendingAction:()=>e({pendingAction:null}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));function X({label:e,value:t}){return(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,P.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,P.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function fe(e){let{email:n,username:r,role:i,canSubmitUsername:o,savingUsername:s,usernameDraft:c,onUsernameDraftChange:l,onSubmitUsername:u,onOpenDeviceList:f,onLogout:p}=e;return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(k,{tone:`success`,title:t(`accountPanelSignedInTitle`),description:t(`accountPanelSignedInDescription`)}),(0,P.jsxs)(k,{tone:`neutral`,children:[(0,P.jsx)(X,{label:t(`remoteAccountEmail`),value:n}),(0,P.jsx)(X,{label:t(`remoteAccountUsername`),value:r}),(0,P.jsx)(X,{label:t(`remoteAccountRole`),value:i})]}),r?(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`remoteAccountUsernameLockedHelp`)}):(0,P.jsxs)(k,{tone:`warning`,title:t(`remoteAccountUsernameRequiredTitle`),description:t(`remoteAccountUsernameRequiredDescription`),children:[(0,P.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,P.jsx)(d,{htmlFor:`account-panel-username`,children:t(`remoteAccountUsername`)}),(0,P.jsx)(b,{id:`account-panel-username`,value:c,onChange:e=>l(e.target.value),placeholder:t(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,P.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,P.jsx)(a,{disabled:!o,onClick:()=>void u(),children:t(s?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,P.jsxs)(a,{onClick:()=>void f(),children:[(0,P.jsx)(j,{className:`mr-2 h-4 w-4`}),t(`remoteOpenDeviceList`)]}),(0,P.jsxs)(a,{variant:`outline`,onClick:()=>void p(),children:[(0,P.jsx)(ce,{className:`mr-2 h-4 w-4`}),t(`remoteLogout`)]})]})]})}function pe(e){let{authSessionId:n,authExpiresAt:i,authStatusMessage:o,authVerificationUri:s,onStartBrowserSignIn:c,onResumeBrowserSignIn:l}=e;return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(k,{tone:`neutral`,title:t(`accountPanelSignedOutTitle`),description:t(`accountPanelSignedOutDescription`),children:n?(0,P.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,P.jsx)(X,{label:t(`remoteBrowserAuthSession`),value:n}),(0,P.jsx)(X,{label:t(`remoteBrowserAuthExpiresAt`),value:i?r(i):`-`})]}):null}),o?(0,P.jsx)(`p`,{className:`text-sm text-gray-600`,children:o}):null,(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,P.jsx)(a,{onClick:()=>void c(),children:t(n?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),s?(0,P.jsx)(a,{variant:`outline`,onClick:l,children:t(`remoteBrowserAuthResume`)}):null]})]})}function me(){let e=$(),n=M(),r=Y(e=>e.panelOpen),i=Y(e=>e.authSessionId),a=Y(e=>e.authVerificationUri),o=Y(e=>e.authExpiresAt),s=Y(e=>e.authStatusMessage),c=n.data,[l,u]=(0,N.useState)(``),[d,f]=(0,N.useState)(!1);(0,N.useEffect)(()=>{e.accountManager.syncRemoteStatus(c)},[e,c]);let p=!d&&l.trim().length>0&&!c?.account.username;return(0,P.jsx)(D,{open:r,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,P.jsxs)(re,{className:`max-w-xl`,children:[(0,P.jsxs)(T,{children:[(0,P.jsxs)(ie,{className:`flex items-center gap-2`,children:[(0,P.jsx)(ae,{className:`h-5 w-5 text-primary`}),t(`accountPanelTitle`)]}),(0,P.jsx)(E,{children:t(`accountPanelDescription`)})]}),c?.account.loggedIn?(0,P.jsx)(fe,{email:c.account.email,username:c.account.username,role:c.account.role,canSubmitUsername:p,savingUsername:d,usernameDraft:l,onUsernameDraftChange:u,onSubmitUsername:async()=>{f(!0);try{await e.accountManager.updateUsername(l)}finally{f(!1)}},onOpenDeviceList:()=>e.accountManager.openNextClawWeb(`/account`),onLogout:()=>e.accountManager.logout()}):(0,P.jsx)(pe,{authSessionId:i,authExpiresAt:o,authStatusMessage:s,authVerificationUri:a,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}function he({username:e}){let n=ee(),[r,i]=(0,N.useState)(e??``),[s,c]=(0,N.useState)(``),l=r.trim().length>0&&s.length>0&&!n.isPending;return(0,P.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,P.jsxs)(w,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,P.jsxs)(C,{children:[(0,P.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:t(`authBrand`)}),(0,P.jsx)(m,{className:`text-2xl`,children:t(`authLoginTitle`)}),(0,P.jsx)(o,{children:t(`authLoginDescription`)})]}),(0,P.jsx)(p,{children:(0,P.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),l&&n.mutate({username:r.trim(),password:s})},children:[(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:t(`authUsername`)}),(0,P.jsx)(b,{value:r,onChange:e=>i(e.target.value),placeholder:t(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:t(`authPassword`)}),(0,P.jsx)(b,{type:`password`,value:s,onChange:e=>c(e.target.value),placeholder:t(`authPasswordPlaceholder`)})]}),(0,P.jsx)(a,{type:`submit`,className:`w-full`,disabled:!l,children:n.isPending?t(`authLoggingIn`):t(`authLoginAction`)})]})})]})})}var ge=class{constructor(){this.authPollTimerId=null,this.afterSignedIn=null,this.bindSignedInContinuation=e=>{this.afterSignedIn=e},this.openAccountPanel=()=>{Y.getState().openPanel()},this.closeAccountPanel=()=>{Y.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),Y.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=await z();return t.account.loggedIn?!0:(e?.pendingAction&&Y.getState().setPendingAction(e.pendingAction),this.openAccountPanel(),await this.startBrowserSignIn({apiBase:e?.apiBase,status:t}),!1)},this.startBrowserSignIn=async e=>{try{let n=e?.apiBase,r=e?.pendingAction,i=e?.status??await z();r&&Y.getState().setPendingAction(r);let a=await x({apiBase:V(i,n)});Y.getState().beginBrowserAuth({sessionId:a.sessionId,verificationUri:a.verificationUri,expiresAt:a.expiresAt,intervalMs:a.intervalMs,statusMessage:t(`remoteBrowserAuthWaiting`)}),window.open(a.verificationUri,`_blank`,`noopener,noreferrer`)||Y.getState().setAuthStatusMessage(t(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let n=e instanceof Error?e.message:t(`remoteBrowserAuthStartFailed`);f.error(`${t(`remoteBrowserAuthStartFailed`)}: ${n}`)}},this.resumeBrowserSignIn=()=>{let e=Y.getState().authVerificationUri;e&&window.open(e,`_blank`,`noopener,noreferrer`)},this.logout=async()=>{try{await te(),Y.getState().clearPendingAction(),Y.getState().clearBrowserAuth(),await B(),f.success(t(`remoteLogoutSuccess`))}catch(e){let n=e instanceof Error?e.message:t(`remoteLogoutFailed`);f.error(`${t(`remoteLogoutFailed`)}: ${n}`)}},this.updateUsername=async e=>{try{await ne({username:e.trim()}),await B(),f.success(t(`remoteAccountUsernameSetSuccess`))}catch(e){let n=e instanceof Error?e.message:t(`remoteAccountUsernameSetFailed`);f.error(`${t(`remoteAccountUsernameSetFailed`)}: ${n}`)}},this.openNextClawWeb=async(e=`/`)=>{let n=U(await z());if(!n){f.error(t(`remoteOpenWebUnavailable`));return}let r=new URL(e,`${n.replace(/\/+$/,``)}/`).toString();window.open(r,`_blank`,`noopener,noreferrer`)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=Y.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=Y.getState();if(e.authSessionId)try{let n=await z(),r=await _({sessionId:e.authSessionId,apiBase:V(n)});if(r.status===`pending`){Y.getState().updateBrowserAuth({statusMessage:t(`remoteBrowserAuthWaiting`),intervalMs:r.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(r.status===`expired`){this.clearPollTimer(),Y.getState().clearBrowserAuth(),f.error(r.message||t(`remoteBrowserAuthExpired`));return}Y.getState().setAuthStatusMessage(t(`remoteBrowserAuthCompleted`));let i=await B(),{pendingAction:a}=Y.getState();this.clearPollTimer(),Y.getState().clearBrowserAuth(),f.success(t(`remoteLoginSuccess`)),a&&this.afterSignedIn&&await this.afterSignedIn(a,i),Y.getState().clearPendingAction()}catch(e){this.clearPollTimer(),Y.getState().clearBrowserAuth();let n=e instanceof Error?e.message:t(`remoteBrowserAuthPollFailed`);f.error(`${t(`remoteBrowserAuthPollFailed`)}: ${n}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.getBrowserAuthSummary=()=>{let e=Y.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?r(e.authExpiresAt):`-`}}}},Z=new class{constructor(){this.accountManager=new ge,this.remoteAccessManager=new G}};Z.accountManager.bindSignedInContinuation(Z.remoteAccessManager.resumePendingActionAfterSignIn),Z.remoteAccessManager.bindAccountManager(Z.accountManager);var Q=(0,N.createContext)(null);function _e({children:e}){return(0,P.jsx)(Q.Provider,{value:Z,children:e})}function $(){let e=(0,N.useContext)(Q);if(!e)throw Error(`useAppManager must be used inside AppManagerProvider`);return e}export{J as a,W as c,B as d,V as f,M as h,me as i,L as l,I as m,$ as n,q as o,U as p,he as r,G as s,_e as t,z as u};
|
|
1
|
+
import{_ as e,i as t,m as n,n as r,p as i}from"./i18n-BnNAQpVM.js";import{At as a,Ct as o,Dt as s,Et as c,It as l,Mt as u,Ot as d,Pt as f,St as p,Tt as m,a as h,bt as g,c as _,d as v,ft as ee,i as y,kt as b,l as x,o as S,s as te,u as ne,wt as C,xt as w}from"./api-C51456xV.js";import{a as T,n as re,o as ie,r as E,t as D}from"./dialog-BHcaU6NE.js";import{t as O}from"./createLucideIcon-C_GFKVuW.js";import{t as ae}from"./key-round-BQXmPSxD.js";import{t as oe}from"./refresh-ccw-CeG203yU.js";import{t as k}from"./notice-card-C9PFAR67.js";import{t as A}from"./status-dot-aQU9Mia4.js";var se=O(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),ce=O(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),j=O(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]);function M(){return l({queryKey:L,queryFn:S,staleTime:5e3,refetchOnWindowFocus:!0})}var N=e(n(),1),P=i();function F(e){let{label:t,muted:n,value:r}=e;return(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,P.jsx)(`span`,{className:`text-gray-500`,children:t}),(0,P.jsx)(`span`,{className:n?`text-right text-gray-500`:`text-right text-gray-900`,children:r==null||r===``?`-`:String(r)})]})}function I(){let e=$(),n=M(),i=n.data,l=W(e=>e.actionLabel),u=(0,N.useMemo)(()=>J(i),[i]),d=!!l,f=i?.runtime?.deviceName?.trim()||i?.settings.deviceName?.trim()||t(`remoteDeviceNameAuto`),h=!!(i?.account.loggedIn&&U(i)),{hero:g,issueHint:_}=u;return(0,N.useEffect)(()=>{e.remoteAccessManager.syncStatus(i)},[e,i]),n.isLoading&&!i?(0,P.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`remoteLoading`)}):(0,P.jsxs)(s,{className:`space-y-6`,children:[(0,P.jsx)(c,{title:t(`remotePageTitle`),description:t(`remotePageDescription`)}),(0,P.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,P.jsxs)(w,{children:[(0,P.jsxs)(C,{className:`space-y-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(m,{children:g.title}),(0,P.jsx)(A,{status:g.badgeStatus,label:g.badgeLabel})]}),(0,P.jsx)(o,{children:g.description})]}),(0,P.jsxs)(p,{className:`space-y-5`,children:[(0,P.jsxs)(k,{tone:`neutral`,children:[(0,P.jsx)(F,{label:t(`remoteSignedInAccount`),value:i?.account.email}),(0,P.jsx)(F,{label:t(`remoteDeviceName`),value:f}),(0,P.jsx)(F,{label:t(`remoteConnectionStatus`),value:g.badgeLabel}),(0,P.jsx)(F,{label:t(`remoteLastConnectedAt`),value:i?.runtime?.lastConnectedAt?r(i.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[u.primaryAction?(0,P.jsxs)(a,{onClick:()=>{if(u.primaryAction?.kind===`reauthorize`){e.remoteAccessManager.reauthorizeRemoteAccess(i);return}if(u.primaryAction?.kind===`repair`){e.remoteAccessManager.repairRemoteAccess(i);return}e.remoteAccessManager.enableRemoteAccess(i)},disabled:d,children:[u.primaryAction.showRefreshIcon?(0,P.jsx)(oe,{className:`mr-2 h-4 w-4`}):null,l||u.primaryAction.label]}):null,(0,P.jsxs)(a,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:d||!h,children:[(0,P.jsx)(j,{className:`mr-2 h-4 w-4`}),t(`remoteOpenDeviceList`)]}),i?.settings.enabled?(0,P.jsx)(a,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(i),disabled:d,children:t(`remoteDisable`)}):null]}),u.shouldShowIssueHint&&_?(0,P.jsx)(k,{tone:`warning`,title:_.title,description:_.body}):null,(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`remoteOpenWebHint`)})]})]}),(0,P.jsxs)(w,{children:[(0,P.jsxs)(C,{children:[(0,P.jsxs)(m,{className:`flex items-center gap-2`,children:[(0,P.jsx)(se,{className:`h-4 w-4 text-primary`}),t(`remoteDeviceSectionTitle`)]}),(0,P.jsx)(o,{children:t(`remoteDeviceSectionDescription`)})]}),(0,P.jsxs)(p,{className:`space-y-5`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsx)(A,{status:i?.account.loggedIn?`ready`:`inactive`,label:i?.account.loggedIn?t(`remoteAccountConnected`):t(`remoteAccountNotConnected`)}),(0,P.jsx)(A,{status:i?.settings.enabled?`active`:`inactive`,label:i?.settings.enabled?t(`remoteEnabled`):t(`remoteStateDisabled`)}),(0,P.jsx)(A,{status:i?.service.running?`active`:`inactive`,label:i?.service.running?t(`remoteServiceRunning`):t(`remoteServiceStopped`)})]}),(0,P.jsxs)(k,{tone:`neutral`,children:[(0,P.jsx)(F,{label:t(`remoteDeviceName`),value:f}),(0,P.jsx)(F,{label:t(`remoteConnectionStatus`),value:g.badgeLabel}),(0,P.jsx)(F,{label:t(`remoteLastConnectedAt`),value:i?.runtime?.lastConnectedAt?r(i.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,P.jsx)(k,{tone:`neutral`,borderStyle:`dashed`,description:i?.account.loggedIn?t(`remoteOpenWebHint`):t(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})]})]})]})}var L=[`remote-status`],R=`https://platform.nextclaw.io`,le=`https://nextclaw-platform-console.pages.dev`,z=async()=>await u.fetchQuery({queryKey:L,queryFn:S,staleTime:5e3}),B=async()=>(await u.invalidateQueries({queryKey:L}),await z()),V=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function H(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return R;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return le}var U=e=>H(e?.account.apiBase)||H(e?.settings.platformApiBase)||H(e?.platformBase)||H(e?.account.platformBase)||void 0,W=g(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),G=class{constructor(){this.accountManager=null,this.bindAccountManager=e=>{this.accountManager=e},this.syncStatus=e=>{if(!e)return;let t=W.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{W.getState().setEnabled(e)},this.setDeviceName=e=>{W.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{W.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{W.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await B(),n=W.getState();if(!t.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`},apiBase:n.platformApiBase});return}await this.applyEnabledState(!0,t)},this.disableRemoteAccess=async e=>{let t=e??await B();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let n=e??await B();if(!n.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`}});return}let r=n.service.running?`restart`:`start`;await this.runManagedAction({actionLabel:t(r===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await y(r);let e=await B();this.hydrateDraftFromStatus(e)},successMessage:t(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await B();await this.accountManager?.startBrowserSignIn({status:t,apiBase:W.getState().platformApiBase,pendingAction:{type:`repair-remote`}})},this.saveAdvancedSettings=async e=>{let n=e??await B(),r=W.getState();await this.runManagedAction({actionLabel:t(`remoteActionSavingAdvanced`),job:async()=>{await v({enabled:r.enabled,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let e=await B();this.hydrateDraftFromStatus(e)},successMessage:n.settings.enabled===r.enabled?t(`remoteSettingsSaved`):t(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:t(`remoteDoctorRunning`),job:async()=>{let e=await h();W.getState().setDoctor(e)},successMessage:t(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,t(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,t(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,t(`remoteActionStopping`))},this.resumePendingActionAfterSignIn=async(e,t)=>{if(e){if(e.type===`enable-remote`){await this.applyEnabledState(!0,t);return}e.type===`repair-remote`&&await this.repairRemoteAccess(t)}},this.applyEnabledState=async(e,n)=>{let r=W.getState();await this.runManagedAction({actionLabel:t(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await v({enabled:e,deviceName:r.deviceName.trim(),platformApiBase:r.platformApiBase.trim()});let t=await B();this.hydrateDraftFromStatus(t),e?await y(t.service.running?`restart`:`start`):n.service.running&&await y(`restart`);let i=await B();this.hydrateDraftFromStatus(i)},successMessage:t(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await y(e),n=await B();this.hydrateDraftFromStatus(n),f.success(t.message)}})},this.hydrateDraftFromStatus=e=>{W.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{W.getState().beginAction(e.actionLabel);try{await e.job(),e.successMessage&&f.success(e.successMessage)}catch(e){let n=e instanceof Error?e.message:t(`error`);throw f.error(n),e}finally{W.getState().finishAction()}}}},ue=[/invalid or expired token/i,/missing bearer token/i,/token expired/i,/token is invalid/i,/run "nextclaw login"/i,/browser sign-in again/i];function K(e){return e?.runtime?.lastError?.trim()||``}function de(e){let n=t(`remoteStatusIssueDetailGeneric`),r=K(e);return r?`${n} (${r})`:n}function q(e){if(!e?.settings.enabled)return!1;let t=K(e);return ue.some(e=>e.test(t))}function J(e){return q(e)?{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteStateReauthorizationRequired`),title:t(`remoteStatusReauthorizationTitle`),description:t(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:t(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:t(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:t(`statusReady`),title:t(`remoteStatusReadyTitle`),description:t(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:t(`connecting`),title:t(`remoteStatusConnectingTitle`),description:t(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteStateDisconnected`),title:t(`remoteStatusIssueTitle`),description:t(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:de(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:t(`remoteServiceStopped`),title:t(`remoteStatusNeedsServiceTitle`),description:t(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:t(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:t(`remoteStatusRecoveryTitle`),body:t(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:t(`statusInactive`),title:t(`remoteStatusNeedsEnable`),description:t(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:t(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:t(`statusSetup`),title:t(`remoteStatusNeedsSignIn`),description:t(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:t(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var Y=g(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,pendingAction:null,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),setPendingAction:t=>e({pendingAction:t}),clearPendingAction:()=>e({pendingAction:null}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));function X({label:e,value:t}){return(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,P.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,P.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function fe(e){let{email:n,username:r,role:i,canSubmitUsername:o,savingUsername:s,usernameDraft:c,onUsernameDraftChange:l,onSubmitUsername:u,onOpenDeviceList:f,onLogout:p}=e;return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(k,{tone:`success`,title:t(`accountPanelSignedInTitle`),description:t(`accountPanelSignedInDescription`)}),(0,P.jsxs)(k,{tone:`neutral`,children:[(0,P.jsx)(X,{label:t(`remoteAccountEmail`),value:n}),(0,P.jsx)(X,{label:t(`remoteAccountUsername`),value:r}),(0,P.jsx)(X,{label:t(`remoteAccountRole`),value:i})]}),r?(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`remoteAccountUsernameLockedHelp`)}):(0,P.jsxs)(k,{tone:`warning`,title:t(`remoteAccountUsernameRequiredTitle`),description:t(`remoteAccountUsernameRequiredDescription`),children:[(0,P.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,P.jsx)(d,{htmlFor:`account-panel-username`,children:t(`remoteAccountUsername`)}),(0,P.jsx)(b,{id:`account-panel-username`,value:c,onChange:e=>l(e.target.value),placeholder:t(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,P.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,P.jsx)(a,{disabled:!o,onClick:()=>void u(),children:t(s?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,P.jsxs)(a,{onClick:()=>void f(),children:[(0,P.jsx)(j,{className:`mr-2 h-4 w-4`}),t(`remoteOpenDeviceList`)]}),(0,P.jsxs)(a,{variant:`outline`,onClick:()=>void p(),children:[(0,P.jsx)(ce,{className:`mr-2 h-4 w-4`}),t(`remoteLogout`)]})]})]})}function pe(e){let{authSessionId:n,authExpiresAt:i,authStatusMessage:o,authVerificationUri:s,onStartBrowserSignIn:c,onResumeBrowserSignIn:l}=e;return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(k,{tone:`neutral`,title:t(`accountPanelSignedOutTitle`),description:t(`accountPanelSignedOutDescription`),children:n?(0,P.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,P.jsx)(X,{label:t(`remoteBrowserAuthSession`),value:n}),(0,P.jsx)(X,{label:t(`remoteBrowserAuthExpiresAt`),value:i?r(i):`-`})]}):null}),o?(0,P.jsx)(`p`,{className:`text-sm text-gray-600`,children:o}):null,(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,P.jsx)(a,{onClick:()=>void c(),children:t(n?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),s?(0,P.jsx)(a,{variant:`outline`,onClick:l,children:t(`remoteBrowserAuthResume`)}):null]})]})}function me(){let e=$(),n=M(),r=Y(e=>e.panelOpen),i=Y(e=>e.authSessionId),a=Y(e=>e.authVerificationUri),o=Y(e=>e.authExpiresAt),s=Y(e=>e.authStatusMessage),c=n.data,[l,u]=(0,N.useState)(``),[d,f]=(0,N.useState)(!1);(0,N.useEffect)(()=>{e.accountManager.syncRemoteStatus(c)},[e,c]);let p=!d&&l.trim().length>0&&!c?.account.username;return(0,P.jsx)(D,{open:r,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,P.jsxs)(re,{className:`max-w-xl`,children:[(0,P.jsxs)(T,{children:[(0,P.jsxs)(ie,{className:`flex items-center gap-2`,children:[(0,P.jsx)(ae,{className:`h-5 w-5 text-primary`}),t(`accountPanelTitle`)]}),(0,P.jsx)(E,{children:t(`accountPanelDescription`)})]}),c?.account.loggedIn?(0,P.jsx)(fe,{email:c.account.email,username:c.account.username,role:c.account.role,canSubmitUsername:p,savingUsername:d,usernameDraft:l,onUsernameDraftChange:u,onSubmitUsername:async()=>{f(!0);try{await e.accountManager.updateUsername(l)}finally{f(!1)}},onOpenDeviceList:()=>e.accountManager.openNextClawWeb(`/account`),onLogout:()=>e.accountManager.logout()}):(0,P.jsx)(pe,{authSessionId:i,authExpiresAt:o,authStatusMessage:s,authVerificationUri:a,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}function he({username:e}){let n=ee(),[r,i]=(0,N.useState)(e??``),[s,c]=(0,N.useState)(``),l=r.trim().length>0&&s.length>0&&!n.isPending;return(0,P.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,P.jsxs)(w,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,P.jsxs)(C,{children:[(0,P.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:t(`authBrand`)}),(0,P.jsx)(m,{className:`text-2xl`,children:t(`authLoginTitle`)}),(0,P.jsx)(o,{children:t(`authLoginDescription`)})]}),(0,P.jsx)(p,{children:(0,P.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),l&&n.mutate({username:r.trim(),password:s})},children:[(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:t(`authUsername`)}),(0,P.jsx)(b,{value:r,onChange:e=>i(e.target.value),placeholder:t(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:t(`authPassword`)}),(0,P.jsx)(b,{type:`password`,value:s,onChange:e=>c(e.target.value),placeholder:t(`authPasswordPlaceholder`)})]}),(0,P.jsx)(a,{type:`submit`,className:`w-full`,disabled:!l,children:n.isPending?t(`authLoggingIn`):t(`authLoginAction`)})]})})]})})}var ge=class{constructor(){this.authPollTimerId=null,this.afterSignedIn=null,this.bindSignedInContinuation=e=>{this.afterSignedIn=e},this.openAccountPanel=()=>{Y.getState().openPanel()},this.closeAccountPanel=()=>{Y.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),Y.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=await z();return t.account.loggedIn?!0:(e?.pendingAction&&Y.getState().setPendingAction(e.pendingAction),this.openAccountPanel(),await this.startBrowserSignIn({apiBase:e?.apiBase,status:t}),!1)},this.startBrowserSignIn=async e=>{try{let n=e?.apiBase,r=e?.pendingAction,i=e?.status??await z();r&&Y.getState().setPendingAction(r);let a=await x({apiBase:V(i,n)});Y.getState().beginBrowserAuth({sessionId:a.sessionId,verificationUri:a.verificationUri,expiresAt:a.expiresAt,intervalMs:a.intervalMs,statusMessage:t(`remoteBrowserAuthWaiting`)}),window.open(a.verificationUri,`_blank`,`noopener,noreferrer`)||Y.getState().setAuthStatusMessage(t(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let n=e instanceof Error?e.message:t(`remoteBrowserAuthStartFailed`);f.error(`${t(`remoteBrowserAuthStartFailed`)}: ${n}`)}},this.resumeBrowserSignIn=()=>{let e=Y.getState().authVerificationUri;e&&window.open(e,`_blank`,`noopener,noreferrer`)},this.logout=async()=>{try{await te(),Y.getState().clearPendingAction(),Y.getState().clearBrowserAuth(),await B(),f.success(t(`remoteLogoutSuccess`))}catch(e){let n=e instanceof Error?e.message:t(`remoteLogoutFailed`);f.error(`${t(`remoteLogoutFailed`)}: ${n}`)}},this.updateUsername=async e=>{try{await ne({username:e.trim()}),await B(),f.success(t(`remoteAccountUsernameSetSuccess`))}catch(e){let n=e instanceof Error?e.message:t(`remoteAccountUsernameSetFailed`);f.error(`${t(`remoteAccountUsernameSetFailed`)}: ${n}`)}},this.openNextClawWeb=async(e=`/`)=>{let n=U(await z());if(!n){f.error(t(`remoteOpenWebUnavailable`));return}let r=new URL(e,`${n.replace(/\/+$/,``)}/`).toString();window.open(r,`_blank`,`noopener,noreferrer`)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=Y.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=Y.getState();if(e.authSessionId)try{let n=await z(),r=await _({sessionId:e.authSessionId,apiBase:V(n)});if(r.status===`pending`){Y.getState().updateBrowserAuth({statusMessage:t(`remoteBrowserAuthWaiting`),intervalMs:r.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(r.status===`expired`){this.clearPollTimer(),Y.getState().clearBrowserAuth(),f.error(r.message||t(`remoteBrowserAuthExpired`));return}Y.getState().setAuthStatusMessage(t(`remoteBrowserAuthCompleted`));let i=await B(),{pendingAction:a}=Y.getState();this.clearPollTimer(),Y.getState().clearBrowserAuth(),f.success(t(`remoteLoginSuccess`)),a&&this.afterSignedIn&&await this.afterSignedIn(a,i),Y.getState().clearPendingAction()}catch(e){this.clearPollTimer(),Y.getState().clearBrowserAuth();let n=e instanceof Error?e.message:t(`remoteBrowserAuthPollFailed`);f.error(`${t(`remoteBrowserAuthPollFailed`)}: ${n}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.getBrowserAuthSummary=()=>{let e=Y.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?r(e.authExpiresAt):`-`}}}},Z=new class{constructor(){this.accountManager=new ge,this.remoteAccessManager=new G}};Z.accountManager.bindSignedInContinuation(Z.remoteAccessManager.resumePendingActionAfterSignIn),Z.remoteAccessManager.bindAccountManager(Z.accountManager);var Q=(0,N.createContext)(null);function _e({children:e}){return(0,P.jsx)(Q.Provider,{value:Z,children:e})}function $(){let e=(0,N.useContext)(Q);if(!e)throw Error(`useAppManager must be used inside AppManagerProvider`);return e}export{J as a,W as c,B as d,V as f,M as h,me as i,L as l,I as m,$ as n,q as o,U as p,he as r,G as s,_e as t,z as u};
|
package/ui-dist/assets/{app-navigation.config-B5YIdRju.js → app-navigation.config-Dve1W20Y.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-C_GFKVuW.js";import{_ as t,b as n,f as r,g as i,h as a,v as o,y as s}from"./theme-provider-
|
|
1
|
+
import{t as e}from"./createLucideIcon-C_GFKVuW.js";import{_ as t,b as n,f as r,g as i,h as a,v as o,y as s}from"./theme-provider-dHqcWU-j.js";import{t as c}from"./search-DZSNKEGp.js";import{t as l}from"./key-round-BQXmPSxD.js";import{t as u}from"./message-square-CLVODA23.js";import{t as d}from"./settings-DjvNMJde.js";import{t as f}from"./sparkles-CyDTgTM4.js";var p=e(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),m=e(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),h=e(`Plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),g=e(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),_=e(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]);function v(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function y(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)}function b(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function x(e){return[{target:`/chat`,label:e(`chat`),icon:a},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:o},{target:`/agents`,label:e(`agentsPageTitle`),icon:s},{target:`/settings`,label:e(`settings`),icon:d}]}function S(e){return[{target:`/model`,label:e(`model`),icon:p},{target:`/providers`,label:e(`providers`),icon:f},{target:`/channels`,label:e(`channels`),icon:u},{target:`/search`,label:e(`searchChannels`),icon:c},{target:`/runtime`,label:e(`runtime`),icon:p},{target:`/updates`,label:e(`updates`),icon:t},{target:`/remote`,label:e(`remote`),icon:_},{target:`/security`,label:e(`security`),icon:g},{target:`/sessions`,label:e(`sessions`),icon:m},{target:`/secrets`,label:e(`secrets`),icon:l},{target:`/cron`,label:e(`cron`),icon:n},{target:`/marketplace/plugins`,label:e(`marketplaceFilterPlugins`),icon:h},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:r}]}function C(e){return[{target:`/language`,label:e(`language`),icon:i},...S(e)]}function w(e){let t=e.toLowerCase();return t===`/settings`?!0:C(e=>e).some(e=>v(t,e.target))}function T(e,t){let n=e.toLowerCase(),r=C(t);if(b(n))return{title:t(`chat`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/chat`)return{title:t(`chat`),backTarget:null,backLabel:null};if(n===`/skills`||n.startsWith(`/skills/`))return{title:t(`marketplaceFilterSkills`),backTarget:null,backLabel:null};if(n===`/agents`||n.startsWith(`/agents/`))return{title:t(`agentsPageTitle`),backTarget:null,backLabel:null};if(n===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};for(let e of r)if(v(n,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}export{y as a,b as i,C as n,w as o,S as r,T as s,x as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,h as t,i as n,m as r,n as i,o as a,p as o,u as s}from"./i18n-BnNAQpVM.js";import{At as c,Dt as l,Et as u,Ft as d,It as f,Ot as p,Pt as m,ct as h,kt as g,nt as _,pt as v,tt as y,zt as b}from"./api-DnPN4SyA.js";import{t as x}from"./createLucideIcon-C_GFKVuW.js";import{t as S}from"./search-DZSNKEGp.js";import{t as C}from"./book-open-B4mOKdz8.js";import{O as ee,a as te,i as ne,n as re,r as ie,t as ae}from"./select-RgeHgn_-.js";import{t as w}from"./external-link-DP2IJ7AM.js";import{n as oe,t as T}from"./logos-BcELLmYh.js";import{t as se}from"./hash-CvcvtMBq.js";import{t as ce}from"./key-round-BQXmPSxD.js";import{t as E}from"./loader-circle-C6gg2m2a.js";import{t as le}from"./message-square-CLVODA23.js";import{t as ue}from"./settings-DjvNMJde.js";import{t as de}from"./x-BjMO7v8q.js";import{t as D}from"./status-dot-aQU9Mia4.js";import{t as fe}from"./use-viewport-layout-CytJAPWM.js";import{b as pe,i as O,n as k,r as A,u as me}from"./use-config-CrsavfWZ.js";import{t as j}from"./logo-badge-uB4SwANR.js";import{t as he}from"./tabs-custom-C4P7g4vR.js";import{t as ge}from"./tag-chip-DGqz3TON.js";import{t as M}from"./config-hints-CPNzbMEp.js";import{a as N,c as P,i as _e,n as ve,o as F,r as ye,s as be,t as xe}from"./config-split-page-B3PRA_AV.js";var Se=x(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),Ce=x(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),I=x(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),we=x(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),L=e(r(),1),R=o();function Te({value:e,onChange:t,className:r,placeholder:i=``}){let[a,o]=(0,L.useState)(``),c=n=>{n.key===`Enter`&&a.trim()?(n.preventDefault(),t([...e,a.trim()]),o(``)):n.key===`Backspace`&&!a&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,R.jsxs)(`div`,{className:s(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,r),children:[e.map((e,t)=>(0,R.jsxs)(ge,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,R.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,R.jsx)(de,{className:`h-3 w-3`})})]},t)),(0,R.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:i||n(`enterTag`)})]})}function Ee(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,R.jsx)(ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,R.jsx)(oe,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,R.jsx)(Se,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,R.jsx)(se,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,R.jsx)(we,{className:`h-3.5 w-3.5 text-gray-500`}):(0,R.jsx)(ue,{className:`h-3.5 w-3.5 text-gray-500`})}function De({channelName:e,fields:t,formData:r,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,R.jsx)(R.Fragment,{children:t.map(t=>{let c=M(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,R.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,R.jsxs)(p,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Ee(t.name),l]}),t.type===`boolean`&&(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,R.jsx)(`span`,{className:`text-sm text-gray-500`,children:r[t.name]?n(`enabled`):n(`disabled`)}),(0,R.jsx)(v,{id:t.name,checked:r[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,R.jsx)(g,{id:t.name,type:t.type,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,R.jsx)(g,{id:t.name,type:`password`,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??n(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,R.jsx)(g,{id:t.name,type:`number`,value:r[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,R.jsx)(Te,{value:r[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,R.jsxs)(ae,{value:r[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,R.jsx)(ne,{className:`rounded-xl`,children:(0,R.jsx)(te,{})}),(0,R.jsx)(re,{children:(t.options??[]).map(e=>(0,R.jsx)(ie,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,R.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var Oe=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),z=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),B=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ke=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Ae=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),je=t((e=>{var t=z().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Me=t((e=>{var t=z().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Ne=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),V=t((e=>{var t=B(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Pe=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Fe=t((e=>{var t=Pe();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Ie=t(((e,t)=>{var n=Fe();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),H=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),U=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
1
|
+
import{_ as e,h as t,i as n,m as r,n as i,o as a,p as o,u as s}from"./i18n-BnNAQpVM.js";import{At as c,Dt as l,Et as u,Ft as d,It as f,Ot as p,Pt as m,ct as h,kt as g,nt as _,pt as v,tt as y,zt as b}from"./api-C51456xV.js";import{t as x}from"./createLucideIcon-C_GFKVuW.js";import{t as S}from"./search-DZSNKEGp.js";import{t as C}from"./book-open-B4mOKdz8.js";import{O as ee,a as te,i as ne,n as re,r as ie,t as ae}from"./select-DRDejPLk.js";import{t as w}from"./external-link-DP2IJ7AM.js";import{n as oe,t as T}from"./logos-BcELLmYh.js";import{t as se}from"./hash-CvcvtMBq.js";import{t as ce}from"./key-round-BQXmPSxD.js";import{t as E}from"./loader-circle-C6gg2m2a.js";import{t as le}from"./message-square-CLVODA23.js";import{t as ue}from"./settings-DjvNMJde.js";import{t as de}from"./x-BjMO7v8q.js";import{t as D}from"./status-dot-aQU9Mia4.js";import{t as fe}from"./use-viewport-layout-D-pjxsyz.js";import{b as pe,i as O,n as k,r as A,u as me}from"./use-config-DFja1sda.js";import{t as j}from"./logo-badge-uB4SwANR.js";import{t as he}from"./tabs-custom-C4P7g4vR.js";import{t as ge}from"./tag-chip-CVIqyMv7.js";import{t as M}from"./config-hints-CPNzbMEp.js";import{a as N,c as P,i as _e,n as ve,o as F,r as ye,s as be,t as xe}from"./config-split-page-B3PRA_AV.js";var Se=x(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),Ce=x(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),I=x(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),we=x(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),L=e(r(),1),R=o();function Te({value:e,onChange:t,className:r,placeholder:i=``}){let[a,o]=(0,L.useState)(``),c=n=>{n.key===`Enter`&&a.trim()?(n.preventDefault(),t([...e,a.trim()]),o(``)):n.key===`Backspace`&&!a&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,R.jsxs)(`div`,{className:s(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,r),children:[e.map((e,t)=>(0,R.jsxs)(ge,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,R.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,R.jsx)(de,{className:`h-3 w-3`})})]},t)),(0,R.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:i||n(`enterTag`)})]})}function Ee(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,R.jsx)(ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,R.jsx)(oe,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,R.jsx)(Se,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,R.jsx)(se,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,R.jsx)(we,{className:`h-3.5 w-3.5 text-gray-500`}):(0,R.jsx)(ue,{className:`h-3.5 w-3.5 text-gray-500`})}function De({channelName:e,fields:t,formData:r,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,R.jsx)(R.Fragment,{children:t.map(t=>{let c=M(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,R.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,R.jsxs)(p,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Ee(t.name),l]}),t.type===`boolean`&&(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,R.jsx)(`span`,{className:`text-sm text-gray-500`,children:r[t.name]?n(`enabled`):n(`disabled`)}),(0,R.jsx)(v,{id:t.name,checked:r[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,R.jsx)(g,{id:t.name,type:t.type,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,R.jsx)(g,{id:t.name,type:`password`,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??n(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,R.jsx)(g,{id:t.name,type:`number`,value:r[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,R.jsx)(Te,{value:r[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,R.jsxs)(ae,{value:r[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,R.jsx)(ne,{className:`rounded-xl`,children:(0,R.jsx)(te,{})}),(0,R.jsx)(re,{children:(t.options??[]).map(e=>(0,R.jsx)(ie,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,R.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var Oe=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),z=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),B=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ke=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Ae=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),je=t((e=>{var t=z().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Me=t((e=>{var t=z().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Ne=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),V=t((e=>{var t=B(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Pe=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Fe=t((e=>{var t=Pe();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Ie=t(((e,t)=>{var n=Fe();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),H=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),U=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
2
|
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),W=t((e=>{var t=H(),n=U();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Le=t((e=>{var t=z(),n=V(),r=B(),i=W(),a=H(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Re=t((e=>{var t=z(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),ze=t(((e,t)=>{var n=W();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Be=t(((e,t)=>{var n=W(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Ve=t(((e,t)=>{var n=W();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),He=t(((e,t)=>{var n=W(),r=z();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
3
3
|
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Ue=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),We=t((e=>{var t=W(),n=ze(),r=Be(),i=Ve(),a=He(),o=U(),s=z(),c=Ue();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
4
4
|
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Ge=t((e=>{var t=z(),n=B(),r=ke(),i=Ae(),a=je(),o=Me(),s=Ne(),c=V(),l=Ie(),u=Le(),d=Re(),f=W(),p=We();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,m as s,n as c,p as l,u}from"./i18n-BnNAQpVM.js";import{At as d,Ft as f,Gt as p,H as m,It as h,Mt as g,Ot as _,Pt as v,_t as y,at as b,b as x,bt as S,g as C,h as w,it as T,jt as E,kt as ee,m as te,mt as ne,n as re,ot as ie,p as ae,r as oe,rt as se,st as ce,y as le,yt as ue,zt as de}from"./api-DnPN4SyA.js";import{a as fe,i as pe,n as me,o as he,r as ge,t as _e}from"./dialog-D-I7ONHQ.js";import{t as D}from"./createLucideIcon-C_GFKVuW.js";import{b as ve,c as ye,d as be,f as xe,g as Se,h as Ce,l as we,m as Te,n as Ee,s as De,u as Oe,v as ke,y as Ae}from"./theme-provider-CUppbOyN.js";import{n as je,t as Me}from"./search-DZSNKEGp.js";import{t as Ne}from"./book-open-B4mOKdz8.js";import{D as Pe,O as Fe,_ as Ie,b as Le,c as Re,d as ze,f as Be,g as Ve,h as He,i as Ue,k as We,l as Ge,m as Ke,n as qe,o as Je,p as Ye,r as Xe,s as Ze,t as Qe,u as $e,v as et,y as tt}from"./select-RgeHgn_-.js";import{t as nt}from"./external-link-DP2IJ7AM.js";import{t as rt}from"./folder-BPwc278w.js";import{n as it,t as at}from"./logos-BcELLmYh.js";import{t as ot}from"./loader-circle-C6gg2m2a.js";import{t as st}from"./plus-BptLViq1.js";import{t as ct}from"./refresh-ccw-CeG203yU.js";import{t as lt}from"./settings-DjvNMJde.js";import{t as ut}from"./sparkles-CyDTgTM4.js";import{t as dt}from"./trash-2-C1cdqL6V.js";import{t as ft}from"./x-BjMO7v8q.js";import{i as pt}from"./doc-browser-context-Dib9sS83.js";import{n as mt}from"./doc-browser-CwgI7ipB.js";import{n as ht}from"./use-viewport-layout-CytJAPWM.js";import{m as gt}from"./use-config-CrsavfWZ.js";import{a as _t,c as vt,i as yt,n as bt,o as xt,r as St,s as Ct,t as wt}from"./popover-Dm_NQ3Cs.js";import{t as Tt}from"./logo-badge-uB4SwANR.js";import{a as Et,c as Dt,i as Ot,l as kt,n as At,o as jt,r as Mt,s as Nt,t as Pt}from"./tooltip-DQlSKhZ_.js";import{t as Ft}from"./skeleton-5Mg6vZHN.js";var It=D(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Lt=D(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Rt=D(`Brain`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`,key:`ep3f8r`}],[`path`,{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`,key:`1p4c4q`}],[`path`,{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`,key:`tmeiqw`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M19.938 10.5a4 4 0 0 1 .585.396`,key:`1qfode`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M19.967 17.484A4 4 0 0 1 18 18`,key:`159ez6`}]]),zt=D(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Bt=D(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Vt=D(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ht=D(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Ut=D(`FileArchive`,[[`path`,{d:`M10 12v-1`,key:`v7bkov`}],[`path`,{d:`M10 18v-2`,key:`1cjy8d`}],[`path`,{d:`M10 7V6`,key:`dljcrl`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01`,key:`gkbcor`}],[`circle`,{cx:`10`,cy:`20`,r:`2`,key:`1xzdoj`}]]),Wt=D(`FileAudio2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2`,key:`17k7jt`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`3`,cy:`17`,r:`1`,key:`vo6nti`}],[`path`,{d:`M2 17v-3a4 4 0 0 1 8 0v3`,key:`1ggdre`}],[`circle`,{cx:`9`,cy:`17`,r:`1`,key:`bc1fq4`}]]),Gt=D(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Kt=D(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),qt=D(`FileJson2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),Jt=D(`FileSpreadsheet`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),Yt=D(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Xt=D(`FileVideo2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`rect`,{width:`8`,height:`6`,x:`2`,y:`12`,rx:`1`,key:`1a6c1e`}],[`path`,{d:`m10 15.5 4 2.5v-6l-4 2.5`,key:`t7cp39`}]]),Zt=D(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Qt=D(`FolderGit2`,[[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`path`,{d:`M18 19c-2.8 0-5-2.2-5-5v8`,key:`pkpw2h`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),$t=D(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),en=D(`FolderTree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),tn=D(`FolderUp`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`m9 13 3-3 3 3`,key:`1pxg3c`}]]),nn=D(`FolderX`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),rn=D(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),an=D(`HeartPulse`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}],[`path`,{d:`M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`1uw2ng`}]]),on=D(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),sn=D(`MessageSquareText`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M13 8H7`,key:`14i4kc`}],[`path`,{d:`M17 12H7`,key:`16if0g`}]]),cn=D(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ln=D(`Paperclip`,[[`path`,{d:`m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48`,key:`1u3ebp`}]]),un=D(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),dn=D(`Puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),fn=D(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),pn=D(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),mn=D(`User`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),O=l();function hn({isProjectFirstView:e,onSelectMode:t}){return(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,O.jsx)(`button`,{type:`button`,"aria-pressed":!e,onClick:()=>t(`time-first`),className:u(`transition-colors`,e?`text-gray-400 hover:text-gray-600`:`font-medium text-gray-600`),children:o(`chatSidebarViewTime`)}),(0,O.jsx)(`span`,{className:`text-gray-300`,children:`/`}),(0,O.jsx)(`button`,{type:`button`,"aria-pressed":e,onClick:()=>t(`project-first`),className:u(`transition-colors`,e?`font-medium text-gray-600`:`text-gray-400 hover:text-gray-600`),children:o(`chatSidebarViewProject`)})]})}var gn={wx:`weixin`,lark:`feishu`},_n={heartbeat:{icon:`heartbeat`},cron:{icon:`cron`}},vn={codex:`chatSessionTypeCodex`,claude:`chatSessionTypeClaude`};function yn(e){return e?.trim().toLowerCase()??``}function bn(e){return e.split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function xn(e,t){let n=yn(e);if(!n||n===`native`)return null;let r=t.find(e=>yn(e.value)===n);return r?.label.trim()?r.label.trim():bn(n)}function Sn(e,t){let n=yn(e);return!n||n===`native`?null:t.find(e=>yn(e.value)===n)??null}function Cn(e){let t=yn(e);if(!t)return null;let n=gn[t]??t;return at(n)?n:null}function wn(e,t){let n=Cn(e.channel??``);if(n)return{icon:{kind:`channel-logo`,channel:n},label:null};let r=_n[yn(e.type)];if(r)return{icon:{kind:`symbol`,icon:r.icon},label:null};let i=yn(e.sessionType),a=Sn(i,t);if(a?.icon?.src?.trim())return{icon:{kind:`runtime-image`,src:a.icon.src,alt:a.icon.alt??null,name:a.label},label:null};let s=vn[i];return s?{icon:null,label:o(s)}:{icon:null,label:a?.label?.trim()||xn(e.sessionType,t)}}var Tn=`app://`;function En(e){let t=e.trim().replace(/^\/+/,``);if(!t)return null;let n=t.split(`/`);return n.some(e=>e.trim().length===0||e===`.`||e===`..`)?null:n.join(`/`)}function Dn(e){let t=e.trim();if(!t)return null;if(!t.startsWith(Tn))return t;let n=En(t.slice(6));return n?`/${n}`:null}function On({icon:e,className:t}){if(e.kind===`channel-logo`)return(0,O.jsx)(kn,{channel:e.channel,className:t});if(e.kind===`runtime-image`){let n=Dn(e.src);return(0,O.jsx)(Tt,{name:e.name?.trim()||e.alt?.trim()||`runtime`,src:n??void 0,className:u(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,O.jsx)(Ae,{className:u(`h-3 w-3 text-gray-500`,t)})})}return e.icon===`heartbeat`?(0,O.jsx)(an,{className:u(`h-3.5 w-3.5`,t)}):(0,O.jsx)(ve,{className:u(`h-3.5 w-3.5`,t)})}function kn({channel:e,className:t}){return(0,O.jsx)(Tt,{name:e,src:at(e),className:u(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,O.jsx)(Ae,{className:`h-3 w-3 text-gray-500`})})}function An(e){let{option:t,onSelect:n}=e,r=t.ready===!1?t.reasonMessage?.trim()||o(`statusSetup`):null;return(0,O.jsx)(`button`,{type:`button`,onClick:n,className:`w-full rounded-2xl px-3 py-2.5 text-left transition-colors hover:bg-gray-50`,children:(0,O.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2.5`,children:[t.icon?.src?(0,O.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5`,children:(0,O.jsx)(On,{icon:{kind:`runtime-image`,src:t.icon.src,alt:t.icon.alt??null,name:t.label}})}):null,(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-gray-900`,children:t.label}),(0,O.jsxs)(`span`,{className:u(`inline-flex shrink-0 items-center gap-1.5 text-[11px] font-medium`,t.ready===!1?`text-amber-700`:`text-emerald-600`),children:[(0,O.jsx)(`span`,{className:u(`h-1.5 w-1.5 rounded-full`,t.ready===!1?`bg-amber-500`:`bg-emerald-500`)}),t.ready===!1?o(`statusSetup`):o(`statusReady`)]})]}),r?(0,O.jsx)(`div`,{className:`mt-1 pr-4 text-[11px] leading-4 text-gray-500`,children:r}):null]})]})})})}var k=e(s(),1);function jn(e,t){return t.some(t=>t.value===e)?e:t[0]?.value??e}function Mn(e){let{groups:t,defaultSessionType:n,sessionTypeOptions:r,renderSessionItem:i,onCreateSession:a}=e,[s,c]=(0,k.useState)(null),l=(0,k.useMemo)(()=>jn(n,r),[n,r]),u=r.length>1;return(0,O.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>{let t=`${o(`chatSidebarNewTask`)} · ${e.projectName}`;return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-0.5`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,O.jsx)(`div`,{className:`truncate text-[11px] font-medium uppercase tracking-wider text-gray-500`,title:e.projectRoot,children:e.projectName}),(0,O.jsx)(`span`,{className:`shrink-0 text-[10px] text-gray-400`,children:e.items.length})]}),u?(0,O.jsxs)(wt,{open:s===e.projectRoot,onOpenChange:t=>{c(t?e.projectRoot:null)},children:[(0,O.jsx)(St,{asChild:!0,children:(0,O.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-lg text-gray-400 hover:bg-white hover:text-gray-900`,"aria-label":t,title:t,children:(0,O.jsx)(st,{className:`h-3.5 w-3.5`})})}),(0,O.jsxs)(bt,{align:`end`,className:`w-56 rounded-2xl border border-gray-200/80 bg-white p-1.5 shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:[(0,O.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400`,children:o(`chatSessionTypeLabel`)}),(0,O.jsx)(`div`,{className:`space-y-1`,children:r.map(t=>(0,O.jsx)(An,{option:t,onSelect:()=>{a(t.value,e.projectRoot),c(null)}},`${e.projectRoot}:${t.value}`))})]})]}):(0,O.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-lg text-gray-400 hover:bg-white hover:text-gray-900`,onClick:()=>a(l,e.projectRoot),"aria-label":t,title:t,children:(0,O.jsx)(st,{className:`h-3.5 w-3.5`})})]}),(0,O.jsx)(`div`,{className:`space-y-0.5 pl-2`,children:e.items.map(i)})]},e.projectRoot)})})}var Nn=[[`bg-amber-100`,`text-amber-700`],[`bg-emerald-100`,`text-emerald-700`],[`bg-blue-100`,`text-blue-700`],[`bg-rose-100`,`text-rose-700`],[`bg-cyan-100`,`text-cyan-700`],[`bg-violet-100`,`text-violet-700`]];function Pn(e){let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}function Fn(e){let t=e.trim();return t?t.slice(0,1).toUpperCase():`A`}function In({agentId:e,displayName:t,avatarUrl:n,className:r}){let i=t?.trim()||e,[a,o]=Nn[Pn(e)%Nn.length]??Nn[0];return n?.trim()?(0,O.jsx)(`img`,{src:n,alt:t?.trim()||e,className:u(`rounded-full object-cover`,r)}):(0,O.jsx)(`div`,{className:u(`rounded-full flex items-center justify-center font-semibold`,a,o,r),"aria-label":t?.trim()||e,children:Fn(i)})}function Ln({status:e,className:t}){let n=o(e===`running`?`sessionsRunStatusRunning`:`sessionsRunStatusQueued`);return(0,O.jsxs)(`span`,{className:u(`inline-flex h-3.5 w-3.5 items-center justify-center text-gray-400`,t),title:n,"aria-label":n,children:[(0,O.jsx)(ot,{className:`h-3 w-3 animate-spin`}),(0,O.jsx)(`span`,{className:`sr-only`,children:n})]})}function Rn({session:e,draftLabel:t,isSaving:n,onDraftLabelChange:r,onSave:i,onCancel:a}){return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(ee,{value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),a())},placeholder:o(`sessionsLabelPlaceholder`),className:`h-8 rounded-lg border-gray-300 bg-white text-xs`,autoFocus:!0,disabled:n}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsx)(`div`,{className:`min-w-0 text-[11px] text-gray-400 truncate`,children:e.key}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,O.jsx)(d,{type:`button`,size:`icon`,variant:`ghost`,className:`h-7 w-7 rounded-lg text-gray-500 hover:bg-white hover:text-gray-900`,onClick:()=>void i(),disabled:n,"aria-label":o(`save`),children:(0,O.jsx)(We,{className:`h-3.5 w-3.5`})}),(0,O.jsx)(d,{type:`button`,size:`icon`,variant:`ghost`,className:`h-7 w-7 rounded-lg text-gray-500 hover:bg-white hover:text-gray-900`,onClick:a,disabled:n,"aria-label":o(`cancel`),children:(0,O.jsx)(ft,{className:`h-3.5 w-3.5`})})]})]})]})}function zn({session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:s,agentLabel:l,agentAvatarUrl:d,childSessionCount:f=0,onSelect:p,onOpenChildSessions:m,onStartEditing:h}){let g=t?`text-gray-700`:`text-gray-500`,_=s?.trim()??``;return(0,O.jsxs)(`div`,{className:`group/session relative`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:p,className:`w-full text-left`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-1.5 pr-8`,children:[(0,O.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[_&&_.toLowerCase()!==`main`?(0,O.jsx)(In,{agentId:_,displayName:l,avatarUrl:d,className:`h-5 w-5 shrink-0`}):null,(0,O.jsx)(`span`,{className:`truncate font-medium`,children:a}),i.label?(0,O.jsx)(`span`,{className:u(`shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-semibold leading-none`,t?`border-gray-300 bg-white/80 text-gray-700`:`border-gray-200 bg-gray-100 text-gray-500`),children:i.label}):null,i.icon?(0,O.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] shrink-0 items-center justify-center`,children:(0,O.jsx)(On,{icon:i.icon,className:g})}):null]}),(0,O.jsxs)(`span`,{className:`inline-flex shrink-0 items-center justify-end gap-1.5`,children:[n?(0,O.jsx)(`span`,{"aria-label":o(`chatSessionUnread`),className:`h-2 w-2 rounded-full bg-primary`}):null,(0,O.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 items-center justify-center`,children:r?(0,O.jsx)(Ln,{status:r}):null})]})]}),(0,O.jsx)(`div`,{className:`mt-0.5 text-[11px] text-gray-400 truncate`,children:(0,O.jsxs)(`span`,{children:[l?.trim()?`${l} · `:``,e.messageCount,` · `,c(e.updatedAt)]})})]}),f>0&&m?(0,O.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m()},className:u(`absolute right-7 top-0 inline-flex h-7 items-center gap-1 rounded-lg px-1.5 text-[10px] font-medium text-gray-400 transition-all hover:bg-white hover:text-gray-900`,t?`opacity-100`:`opacity-0 group-hover/session:opacity-100 group-focus-within/session:opacity-100`),"aria-label":o(`chatSessionOpenChildSessions`),title:o(`chatSessionOpenChildSessions`),children:[(0,O.jsx)(rn,{className:`h-3.5 w-3.5`}),(0,O.jsx)(`span`,{children:f})]}):null,(0,O.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h()},className:u(`absolute right-0 top-0 inline-flex h-7 w-7 items-center justify-center rounded-lg text-gray-400 transition-all hover:bg-white hover:text-gray-900`,t?`opacity-100`:`opacity-0 group-hover/session:opacity-100 group-focus-within/session:opacity-100`),"aria-label":o(`edit`),children:(0,O.jsx)(un,{className:`h-3.5 w-3.5`})})]})}function Bn({session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:o,agentLabel:s,agentAvatarUrl:c,childSessionCount:l,isEditing:d,draftLabel:f,isSaving:p,onSelect:m,onOpenChildSessions:h,onStartEditing:g,onDraftLabelChange:_,onSave:v,onCancel:y}){return(0,O.jsx)(`div`,{className:u(`w-full rounded-xl px-3 py-2 text-left transition-all text-[13px]`,t?`bg-gray-200 text-gray-900 font-semibold shadow-sm`:`text-gray-700 hover:bg-gray-200/60 hover:text-gray-900`),children:d?(0,O.jsx)(Rn,{session:e,draftLabel:f,isSaving:p,onDraftLabelChange:_,onSave:v,onCancel:y}):(0,O.jsx)(zn,{session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:o,agentLabel:s,agentAvatarUrl:c,onSelect:m,childSessionCount:l,onOpenChildSessions:h,onStartEditing:g})})}var Vn=[{icon:Ce,titleKey:`chatWelcomeCapability1Title`,descKey:`chatWelcomeCapability1Desc`},{icon:ke,titleKey:`chatWelcomeCapability2Title`,descKey:`chatWelcomeCapability2Desc`},{icon:ve,titleKey:`chatWelcomeCapability3Title`,descKey:`chatWelcomeCapability3Desc`}];function Hn({onCreateSession:e,agents:t,selectedAgentId:n,onSelectAgent:r}){let i=t.find(e=>e.id===n)??null;return(0,O.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,O.jsxs)(`div`,{className:`max-w-lg w-full text-center`,children:[(0,O.jsx)(`div`,{className:`mx-auto mb-6 h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center`,children:(0,O.jsx)(Ae,{className:`h-8 w-8 text-primary`})}),(0,O.jsx)(`h2`,{className:`text-xl font-semibold text-gray-900 mb-2`,children:o(`chatWelcomeTitle`)}),(0,O.jsx)(`p`,{className:`text-sm text-gray-500 mb-8`,children:o(`chatWelcomeSubtitle`)}),(0,O.jsxs)(`div`,{className:`mb-6 flex items-center justify-center gap-2.5`,children:[(0,O.jsx)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:o(`chatDraftAgentTitle`)}),(0,O.jsxs)(Qe,{value:n,onValueChange:r,children:[(0,O.jsxs)(Ue,{"aria-label":o(`chatDraftAgentTitle`),className:`h-auto w-auto gap-1 rounded-full border-0 bg-transparent px-1.5 py-1 text-gray-500 shadow-none hover:bg-white/70 hover:text-gray-800 focus:ring-0`,children:[(0,O.jsx)(`span`,{className:`sr-only`,children:o(`chatDraftAgentTitle`)}),(0,O.jsx)(`div`,{className:`flex items-center gap-1.5`,children:i?(0,O.jsx)(In,{agentId:i.id,displayName:i.displayName,avatarUrl:i.avatarUrl,className:`h-7 w-7 shrink-0`}):null})]}),(0,O.jsx)(qe,{className:`rounded-xl border-gray-200/80 shadow-lg`,children:t.map(e=>(0,O.jsx)(Xe,{value:e.id,className:`rounded-lg pr-10`,children:(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,O.jsx)(In,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,O.jsx)(`span`,{className:`truncate text-sm font-medium text-gray-700`,children:e.displayName?.trim()||e.id})]})},e.id))})]})]}),(0,O.jsx)(`div`,{className:`grid grid-cols-3 gap-3`,children:Vn.map(t=>{let n=t.icon;return(0,O.jsxs)(`button`,{onClick:e,className:`rounded-2xl border border-gray-200 bg-white p-4 text-left shadow-card hover:shadow-card-hover transition-shadow cursor-pointer`,children:[(0,O.jsx)(`div`,{className:`h-9 w-9 rounded-xl bg-primary/8 flex items-center justify-center mb-3`,children:(0,O.jsx)(n,{className:`h-4.5 w-4.5 text-primary`})}),(0,O.jsx)(`div`,{className:`text-sm font-semibold text-gray-900 mb-1`,children:o(t.titleKey)}),(0,O.jsx)(`div`,{className:`text-[11px] text-gray-500 leading-relaxed`,children:o(t.descKey)})]},t.titleKey)})})]})})}var Un=e=>`[data-item-index="${e}"]`;function Wn(e){let{activeIndex:t,containerRef:n,getItemSelector:r,isEnabled:i,itemCount:a}=e,o=r??Un;(0,k.useEffect)(()=>{if(!i||a===0)return;let e=n.current;if(!e)return;let r=e.querySelector(o(t));typeof r?.scrollIntoView==`function`&&r.scrollIntoView({block:`nearest`,inline:`nearest`})},[t,n,o,i,a])}function Gn(){let e=(0,k.useRef)(null),[t,n]=(0,k.useState)(null);return(0,k.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=()=>{n(t.getBoundingClientRect().width)};r();let i=new ResizeObserver(()=>r());return i.observe(t),()=>i.disconnect()},[]),{elementRef:e,width:t}}function A(...e){return n(r(e))}var Kn=k.forwardRef(({className:e,type:t,...n},r)=>(0,O.jsx)(`input`,{type:t,className:A(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));Kn.displayName=`ChatInput`;var qn=Ct,Jn=vt,Yn=yt,Xn=k.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,...r},i)=>(0,O.jsx)(xt,{children:(0,O.jsx)(_t,{ref:i,sideOffset:t,align:n,className:A(`z-[var(--z-popover,50)] w-72 overflow-hidden rounded-2xl border border-gray-200/50 bg-white p-4 shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));Xn.displayName=_t.displayName;var Zn=Ke,Qn=Ze,$n=tt,er=k.forwardRef(({className:e,children:t,...n},r)=>(0,O.jsxs)(et,{ref:r,className:A(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-gray-200/80 bg-white px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,O.jsx)(Re,{asChild:!0,children:(0,O.jsx)(Fe,{className:`h-4 w-4 opacity-50`})})]}));er.displayName=et.displayName;var tr=k.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Ve,{ref:n,className:A(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,O.jsx)(Pe,{className:`h-4 w-4`})}));tr.displayName=Ve.displayName;var nr=k.forwardRef(({className:e,...t},n)=>(0,O.jsx)(He,{ref:n,className:A(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,O.jsx)(Fe,{className:`h-4 w-4`})}));nr.displayName=He.displayName;var rr=k.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,O.jsx)(Ye,{children:(0,O.jsxs)(Je,{ref:i,className:A(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,O.jsx)(tr,{}),(0,O.jsx)(Le,{className:A(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,O.jsx)(nr,{})]})}));rr.displayName=Je.displayName;var ir=k.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Be,{ref:n,className:A(`px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-gray-500`,e),...t}));ir.displayName=Be.displayName;var ar=k.forwardRef(({className:e,children:t,...n},r)=>(0,O.jsxs)(Ge,{ref:r,className:A(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-gray-100`,e),...n,children:[(0,O.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,O.jsx)($e,{children:(0,O.jsx)(We,{className:`h-4 w-4`})})}),(0,O.jsx)(ze,{children:t})]}));ar.displayName=Ge.displayName;var or=k.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Ie,{ref:n,className:A(`-mx-1 my-1 h-px bg-gray-100`,e),...t}));or.displayName=Ie.displayName;var sr=Nt,cr=Dt,lr=kt,ur=k.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,O.jsx)(jt,{children:(0,O.jsx)(Et,{ref:r,sideOffset:t,className:A(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));ur.displayName=Et.displayName;var dr={Popover:qn,PopoverAnchor:Yn,PopoverContent:Xn,PopoverTrigger:Jn,Input:Kn,Select:Zn,SelectContent:rr,SelectGroup:Qn,SelectItem:ar,SelectLabel:ir,SelectSeparator:or,SelectTrigger:er,SelectValue:$n,Tooltip:cr,TooltipContent:ur,TooltipProvider:sr,TooltipTrigger:lr},fr=680,pr=.82,mr=560;function hr(e){let{Popover:t,PopoverAnchor:n,PopoverContent:r}=dr,{elementRef:i,width:a}=Gn(),o=(0,k.useRef)(null),{isOpen:s,isLoading:c,items:l,activeIndex:u,activeItem:d,texts:f,onSelectItem:p,onOpenChange:m,onSetActiveIndex:h}=e,g=(0,k.useMemo)(()=>{if(a)return Math.min(a>mr?a*pr:a,fr)},[a]);return Wn({containerRef:o,activeIndex:u,itemCount:l.length,isEnabled:s&&!c,getItemSelector:e=>`[data-slash-index="${e}"]`}),(0,O.jsxs)(t,{open:s,onOpenChange:m,children:[(0,O.jsx)(n,{asChild:!0,children:(0,O.jsx)(`div`,{ref:i,className:`pointer-events-none absolute bottom-full left-3 right-3 h-0`})}),(0,O.jsx)(r,{side:`top`,align:`start`,sideOffset:10,className:`z-[70] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-2xl border border-gray-200 bg-white/95 p-0 shadow-2xl backdrop-blur-md`,onOpenAutoFocus:e=>e.preventDefault(),style:g?{width:`${g}px`}:void 0,children:(0,O.jsxs)(`div`,{className:`grid min-h-[240px] grid-cols-[minmax(220px,300px)_minmax(0,1fr)]`,children:[(0,O.jsx)(`div`,{ref:o,role:`listbox`,"aria-label":f.slashSectionLabel,className:`custom-scrollbar max-h-[320px] overflow-y-auto border-r border-gray-200 p-2.5`,children:c?(0,O.jsx)(`div`,{className:`p-2 text-xs text-gray-500`,children:f.slashLoadingLabel}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`mb-2 px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:f.slashSectionLabel}),l.length===0?(0,O.jsx)(`div`,{className:`px-2 text-xs text-gray-400`,children:f.slashEmptyLabel}):(0,O.jsx)(`div`,{className:`space-y-1`,children:l.map((e,t)=>{let n=t===u;return(0,O.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,"data-slash-index":t,onMouseEnter:()=>h(t),onClick:()=>p(e),className:`flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition ${n?`bg-gray-100 text-gray-900`:`text-gray-700 hover:bg-gray-50`}`,children:[(0,O.jsx)(`span`,{className:`truncate text-xs font-semibold`,children:e.title}),(0,O.jsx)(`span`,{className:`truncate text-xs text-gray-500`,children:e.subtitle})]},e.key)})})]})}),(0,O.jsx)(`div`,{className:`min-w-0 p-2.5`,children:d?(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary`,children:d.subtitle}),(0,O.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:d.title})]}),(0,O.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:d.description}),(0,O.jsx)(`div`,{className:`space-y-1`,children:d.detailLines.map(e=>(0,O.jsx)(`div`,{className:`min-w-0 break-all rounded-md bg-gray-50 px-2 py-1 text-[11px] leading-5 text-gray-600`,children:e},e))}),(0,O.jsx)(`div`,{className:`pt-1 text-[11px] text-gray-500`,children:f.slashSkillHintLabel})]}):(0,O.jsx)(`div`,{className:`text-xs text-gray-500`,children:f.slashHintLabel})})]})})]})}var gr=E(`inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-gray-200 bg-white hover:bg-gray-50 hover:text-gray-800 text-gray-600`,secondary:`bg-gray-100 text-gray-700 hover:bg-gray-200/80`,ghost:`hover:bg-gray-100/80 hover:text-gray-800`,link:`text-primary underline-offset-4 hover:underline`,primary:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,subtle:`bg-gray-100 text-gray-600 hover:bg-gray-200/80`,"primary-outline":`border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground`},size:{default:`h-9 px-4 py-2`,sm:`h-8 px-3 text-xs`,lg:`h-11 px-5 text-[14px]`,xl:`h-12 px-6 text-[15px]`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),_r=k.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,O.jsx)(`button`,{className:A(gr({variant:t,size:n,className:e})),ref:i,...r}));_r.displayName=`ChatButton`;var vr=120;function yr(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=vr?t:`${t.slice(0,vr-1)}…`}function br(){return(0,O.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`chat-stop-icon`,className:`block h-3 w-3 rounded-[2px] bg-gray-700 shadow-[inset_0_0_0_1px_rgba(17,24,39,0.06)]`})}function xr({sendError:e,sendErrorDetailsLabel:t,isSending:n,canStopGeneration:r,sendDisabled:i,stopDisabled:a,stopHint:o,sendButtonLabel:s,stopButtonLabel:c,onSend:l,onStop:u}){let{Popover:d,PopoverContent:f,PopoverTrigger:p,Tooltip:m,TooltipContent:h,TooltipProvider:g,TooltipTrigger:_}=dr,v=e?.trim()??``,y=v?yr(v):``,b=t?.trim()||`Details`;return(0,O.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[v?(0,O.jsxs)(`div`,{className:`flex max-w-[420px] items-start justify-end gap-2 text-right`,children:[(0,O.jsx)(`div`,{className:`min-w-0 flex-1 text-[11px] text-red-600`,children:(0,O.jsx)(`span`,{className:`block truncate`,title:v,children:y})}),(0,O.jsxs)(d,{children:[(0,O.jsx)(p,{asChild:!0,children:(0,O.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-full border border-red-200/80 bg-red-50 px-2 py-0.5 text-[10px] font-semibold text-red-700 transition-colors hover:bg-red-100`,children:b})}),(0,O.jsxs)(f,{align:`end`,className:`w-[min(32rem,calc(100vw-1.5rem))] border-red-100/80 p-0`,children:[(0,O.jsx)(`div`,{className:`border-b border-red-100 bg-red-50/80 px-4 py-2 text-xs font-semibold text-red-700`,children:b}),(0,O.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words px-4 py-3 text-xs leading-relaxed text-red-700`,children:v})]})]})]}):null,(0,O.jsx)(`div`,{className:`flex items-center gap-2`,children:n?r?(0,O.jsx)(_r,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,onClick:()=>void u(),disabled:a,children:(0,O.jsx)(br,{})}):(0,O.jsx)(g,{children:(0,O.jsxs)(m,{children:[(0,O.jsx)(_,{asChild:!0,children:(0,O.jsx)(`span`,{children:(0,O.jsx)(_r,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,disabled:!0,children:(0,O.jsx)(br,{})})})}),(0,O.jsx)(h,{side:`top`,children:(0,O.jsx)(`p`,{className:`text-xs`,children:o})})]})}):(0,O.jsx)(_r,{size:`icon`,className:`h-8 w-8 rounded-full`,"aria-label":s,onClick:()=>void l(),disabled:i,children:(0,O.jsx)(Lt,{className:`h-5 w-5`})})})]})}function Sr(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.label,e.key,e.description].filter(e=>typeof e==`string`&&e.trim().length>0).join(` `).toLowerCase().includes(n)):e}function Cr(e){let{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:i}=dr,{picker:a}=e,o=(0,k.useRef)(null),s=(0,k.useId)(),[c,l]=(0,k.useState)(``),[u,d]=(0,k.useState)(0),f=(0,k.useMemo)(()=>new Set(a.selectedKeys),[a.selectedKeys]),p=a.selectedKeys.length,m=c.trim().length>0,h=(0,k.useMemo)(()=>{if(m)return null;let e=a.groups?.filter(e=>e.options.length>0)??[];return e.length>0?e:null},[m,a.groups]),g=(0,k.useMemo)(()=>h?h.flatMap(e=>e.options):Sr(a.options,c),[h,a.options,c]);(0,k.useEffect)(()=>{d(0)},[c]),(0,k.useEffect)(()=>{d(e=>g.length===0?0:Math.min(e,g.length-1))},[g.length]),Wn({containerRef:o,activeIndex:u,itemCount:g.length,isEnabled:g.length>0,getItemSelector:e=>`[data-skill-index="${e}"]`});let _=e=>{if(f.has(e)){a.onSelectedKeysChange(a.selectedKeys.filter(t=>t!==e));return}a.onSelectedKeysChange([...a.selectedKeys,e])},v=e=>{if(g.length!==0){if(e.key===`ArrowDown`){e.preventDefault(),d(e=>Math.min(e+1,g.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),d(e=>Math.max(e-1,0));return}if(e.key===`Enter`){e.preventDefault();let t=g[u];t&&_(t.key)}}};return(0,O.jsxs)(n,{children:[(0,O.jsx)(i,{asChild:!0,children:(0,O.jsxs)(`button`,{type:`button`,"aria-haspopup":`listbox`,className:`inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,children:[(0,O.jsx)(ke,{className:`h-4 w-4`}),(0,O.jsx)(`span`,{children:a.title}),p>0?(0,O.jsx)(`span`,{className:`ml-0.5 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary/10 text-[10px] font-semibold text-primary`,children:p}):null]})}),(0,O.jsxs)(r,{side:`top`,align:`start`,className:`w-[360px] p-0`,children:[(0,O.jsxs)(`div`,{className:`space-y-2 border-b border-gray-100 px-4 py-3`,children:[(0,O.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:a.title}),(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsx)(Me,{className:`pointer-events-none absolute left-3 top-2.5 h-3.5 w-3.5 text-gray-400`}),(0,O.jsx)(t,{value:c,onChange:e=>l(e.target.value),onKeyDown:v,placeholder:a.searchPlaceholder,role:`combobox`,"aria-controls":s,"aria-expanded":`true`,"aria-autocomplete":`list`,"aria-activedescendant":g[u]?`${s}-option-${u}`:void 0,className:`h-8 rounded-lg pl-8 text-xs`})]})]}),(0,O.jsx)(`div`,{ref:o,id:s,role:`listbox`,"aria-multiselectable":`true`,className:`custom-scrollbar max-h-[320px] overflow-y-auto`,children:a.isLoading?(0,O.jsx)(`div`,{className:`p-4 text-xs text-gray-500`,children:a.loadingLabel}):g.length===0?(0,O.jsx)(`div`,{className:`p-4 text-center text-xs text-gray-500`,children:a.emptyLabel}):(0,O.jsx)(`div`,{className:`py-1`,children:(()=>{let e=h??[{key:`all-skills`,options:g}],t=0;return e.map(e=>(0,O.jsxs)(`div`,{children:[e.label?(0,O.jsx)(`div`,{className:`px-4 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:e.label}):null,e.options.map(e=>{let n=t;t+=1;let r=f.has(e.key),i=n===u;return(0,O.jsxs)(`button`,{type:`button`,id:`${s}-option-${n}`,role:`option`,"aria-selected":r,"data-skill-index":n,onClick:()=>_(e.key),onMouseEnter:()=>d(n),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors ${i?`bg-gray-50`:`hover:bg-gray-50`}`,children:[(0,O.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500`,children:(0,O.jsx)(dn,{className:`h-4 w-4`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`truncate text-sm text-gray-900`,children:e.label}),e.badgeLabel?(0,O.jsx)(`span`,{className:`shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:e.badgeLabel}):null]}),(0,O.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-gray-500`,children:e.description||e.key})]}),(0,O.jsx)(`div`,{className:`ml-3 shrink-0`,children:(0,O.jsx)(`span`,{className:r?`inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-white`:`inline-flex h-5 w-5 items-center justify-center rounded-full border border-gray-300 bg-white`,children:r?(0,O.jsx)(We,{className:`h-3 w-3`}):null})})]},e.key)})]},e.key))})()})}),a.manageHref&&a.manageLabel?(0,O.jsx)(`div`,{className:`border-t border-gray-100 px-4 py-2.5`,children:(0,O.jsxs)(`a`,{href:a.manageHref,className:`inline-flex items-center gap-1.5 text-xs font-medium text-primary transition-colors hover:text-primary/80`,children:[a.manageLabel,(0,O.jsx)(nt,{className:`h-3 w-3`})]})}):null]})]})}function wr({icon:e}){return e===`sparkles`?(0,O.jsx)(ut,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):e===`brain`?(0,O.jsx)(Rt,{className:`h-3.5 w-3.5 shrink-0 text-gray-500`}):null}function Tr({icon:e}){return e===`paperclip`?(0,O.jsx)(ln,{className:`h-4 w-4`}):(0,O.jsx)(wr,{icon:e})}function Er(e){return e===`model`?`min-w-[220px]`:e===`session-type`?`min-w-[140px]`:e===`thinking`?`min-w-[150px]`:``}function Dr(e){return e===`model`?`w-[320px]`:e===`session-type`?`w-[220px]`:e===`thinking`?`w-[180px]`:``}function Or({item:e}){let{Select:t,SelectContent:n,SelectGroup:r,SelectItem:i,SelectLabel:a,SelectSeparator:o,SelectTrigger:s,SelectValue:c}=dr,l=e.groups?.filter(e=>e.options.length>0)??(e.options.length>0?[{key:`${e.key}-default`,options:e.options}]:[]),u=l.some(e=>e.options.length>0);return(0,O.jsxs)(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[(0,O.jsx)(s,{className:`h-8 w-auto rounded-lg border-0 bg-transparent px-3 text-xs font-medium text-gray-600 shadow-none hover:bg-gray-100 focus:ring-0 ${Er(e.key)}`,children:e.selectedLabel?(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-left`,children:[(0,O.jsx)(wr,{icon:e.icon}),(0,O.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-700`,children:e.selectedLabel})]}):e.loading?(0,O.jsx)(`div`,{className:`h-3 w-24 animate-pulse rounded bg-gray-200`}):(0,O.jsx)(c,{placeholder:e.placeholder})}),(0,O.jsxs)(n,{className:Dr(e.key),children:[u?null:e.loading?(0,O.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,O.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-gray-200`}),(0,O.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-gray-200`}),(0,O.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-gray-200`})]}):e.emptyLabel?(0,O.jsx)(`div`,{className:`px-3 py-2 text-xs text-gray-500`,children:e.emptyLabel}):null,l.map((e,t)=>(0,O.jsxs)(`div`,{children:[t>0?(0,O.jsx)(o,{}):null,(0,O.jsxs)(r,{children:[e.label?(0,O.jsx)(a,{children:e.label}):null,e.options.map(e=>(0,O.jsx)(i,{value:e.value,className:`py-2`,children:e.description?(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,O.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label}),(0,O.jsx)(`span`,{className:`truncate text-[11px] text-gray-500`,children:e.description})]}):(0,O.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label})},e.value))]})]},e.key))]})]})}function kr(e){let{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=dr;return(0,O.jsxs)(`div`,{className:`flex items-center justify-between px-3 pb-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.skillPicker?(0,O.jsx)(Cr,{picker:e.skillPicker}):null,e.selects.map(e=>(0,O.jsx)(Or,{item:e},e.key)),e.accessories?.map(e=>{let a=(0,O.jsxs)(`button`,{type:`button`,className:`inline-flex items-center rounded-lg py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:text-gray-400 ${e.iconOnly?`h-8 w-8 justify-center px-0`:`gap-1.5 px-3`}`,onClick:e.onClick,disabled:e.disabled,"aria-label":e.label,children:[(0,O.jsx)(Tr,{icon:e.icon}),e.iconOnly?null:(0,O.jsx)(`span`,{children:e.label})]});return e.tooltip?(0,O.jsx)(r,{children:(0,O.jsxs)(t,{children:[(0,O.jsx)(i,{asChild:!0,children:e.disabled?(0,O.jsx)(`span`,{className:`inline-flex`,children:a}):a}),(0,O.jsx)(n,{side:`top`,children:(0,O.jsx)(`p`,{className:`text-xs`,children:e.tooltip})})]})},e.key):(0,O.jsx)(`div`,{children:a},e.key)})]}),(0,O.jsx)(xr,{...e.actions})]})}var Ar=(0,k.createContext)(null);function jr(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function Mr(){let e=(0,k.useContext)(Ar);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function j(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Nr(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Pr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Fr=Pr&&`documentMode`in document?document.documentMode:null,Ir=Pr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Lr=Pr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Rr=!(!Pr||!(`InputEvent`in window)||Fr)&&`getTargetRanges`in new window.InputEvent(`input`),zr=Pr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Br=Pr&&/Android/.test(navigator.userAgent),Vr=Pr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Br,Hr=Pr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ur=Pr&&Br&&Hr,Wr=Pr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ir&&!Hr,Gr=0,Kr=1,qr=2,Jr=1,Yr=2,Xr=3,Zr=4,Qr=5,$r=6,ei=Vr||zr||Wr?`\xA0`:``,ti=`
|
|
1
|
+
import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,m as s,n as c,p as l,u}from"./i18n-BnNAQpVM.js";import{At as d,Ft as f,Gt as p,H as m,It as h,Mt as g,Ot as _,Pt as v,_t as y,at as b,b as x,bt as S,g as C,h as w,it as T,jt as E,kt as ee,m as te,mt as ne,n as re,ot as ie,p as ae,r as oe,rt as se,st as ce,y as le,yt as ue,zt as de}from"./api-C51456xV.js";import{a as fe,i as pe,n as me,o as he,r as ge,t as _e}from"./dialog-BHcaU6NE.js";import{t as D}from"./createLucideIcon-C_GFKVuW.js";import{b as ve,c as ye,d as be,f as xe,g as Se,h as Ce,l as we,m as Te,n as Ee,s as De,u as Oe,v as ke,y as Ae}from"./theme-provider-dHqcWU-j.js";import{n as je,t as Me}from"./search-DZSNKEGp.js";import{t as Ne}from"./book-open-B4mOKdz8.js";import{D as Pe,O as Fe,_ as Ie,b as Le,c as Re,d as ze,f as Be,g as Ve,h as He,i as Ue,k as We,l as Ge,m as Ke,n as qe,o as Je,p as Ye,r as Xe,s as Ze,t as Qe,u as $e,v as et,y as tt}from"./select-DRDejPLk.js";import{t as nt}from"./external-link-DP2IJ7AM.js";import{t as rt}from"./folder-BPwc278w.js";import{n as it,t as at}from"./logos-BcELLmYh.js";import{t as ot}from"./loader-circle-C6gg2m2a.js";import{t as st}from"./plus-BptLViq1.js";import{t as ct}from"./refresh-ccw-CeG203yU.js";import{t as lt}from"./settings-DjvNMJde.js";import{t as ut}from"./sparkles-CyDTgTM4.js";import{t as dt}from"./trash-2-C1cdqL6V.js";import{t as ft}from"./x-BjMO7v8q.js";import{i as pt}from"./doc-browser-context-Dib9sS83.js";import{n as mt}from"./doc-browser-CwgI7ipB.js";import{n as ht}from"./use-viewport-layout-D-pjxsyz.js";import{m as gt}from"./use-config-DFja1sda.js";import{a as _t,c as vt,i as yt,n as bt,o as xt,r as St,s as Ct,t as wt}from"./popover-B8msg2FQ.js";import{t as Tt}from"./logo-badge-uB4SwANR.js";import{a as Et,c as Dt,i as Ot,l as kt,n as At,o as jt,r as Mt,s as Nt,t as Pt}from"./tooltip-C6VPreZ7.js";import{t as Ft}from"./skeleton-5Mg6vZHN.js";var It=D(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Lt=D(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Rt=D(`Brain`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`,key:`ep3f8r`}],[`path`,{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`,key:`1p4c4q`}],[`path`,{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`,key:`tmeiqw`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M19.938 10.5a4 4 0 0 1 .585.396`,key:`1qfode`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M19.967 17.484A4 4 0 0 1 18 18`,key:`159ez6`}]]),zt=D(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Bt=D(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Vt=D(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ht=D(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Ut=D(`FileArchive`,[[`path`,{d:`M10 12v-1`,key:`v7bkov`}],[`path`,{d:`M10 18v-2`,key:`1cjy8d`}],[`path`,{d:`M10 7V6`,key:`dljcrl`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01`,key:`gkbcor`}],[`circle`,{cx:`10`,cy:`20`,r:`2`,key:`1xzdoj`}]]),Wt=D(`FileAudio2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2`,key:`17k7jt`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`3`,cy:`17`,r:`1`,key:`vo6nti`}],[`path`,{d:`M2 17v-3a4 4 0 0 1 8 0v3`,key:`1ggdre`}],[`circle`,{cx:`9`,cy:`17`,r:`1`,key:`bc1fq4`}]]),Gt=D(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Kt=D(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),qt=D(`FileJson2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),Jt=D(`FileSpreadsheet`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),Yt=D(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Xt=D(`FileVideo2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`rect`,{width:`8`,height:`6`,x:`2`,y:`12`,rx:`1`,key:`1a6c1e`}],[`path`,{d:`m10 15.5 4 2.5v-6l-4 2.5`,key:`t7cp39`}]]),Zt=D(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Qt=D(`FolderGit2`,[[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`path`,{d:`M18 19c-2.8 0-5-2.2-5-5v8`,key:`pkpw2h`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),$t=D(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),en=D(`FolderTree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),tn=D(`FolderUp`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`m9 13 3-3 3 3`,key:`1pxg3c`}]]),nn=D(`FolderX`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),rn=D(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),an=D(`HeartPulse`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}],[`path`,{d:`M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`1uw2ng`}]]),on=D(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),sn=D(`MessageSquareText`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M13 8H7`,key:`14i4kc`}],[`path`,{d:`M17 12H7`,key:`16if0g`}]]),cn=D(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ln=D(`Paperclip`,[[`path`,{d:`m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48`,key:`1u3ebp`}]]),un=D(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),dn=D(`Puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),fn=D(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),pn=D(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),mn=D(`User`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),O=l();function hn({isProjectFirstView:e,onSelectMode:t}){return(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,O.jsx)(`button`,{type:`button`,"aria-pressed":!e,onClick:()=>t(`time-first`),className:u(`transition-colors`,e?`text-gray-400 hover:text-gray-600`:`font-medium text-gray-600`),children:o(`chatSidebarViewTime`)}),(0,O.jsx)(`span`,{className:`text-gray-300`,children:`/`}),(0,O.jsx)(`button`,{type:`button`,"aria-pressed":e,onClick:()=>t(`project-first`),className:u(`transition-colors`,e?`font-medium text-gray-600`:`text-gray-400 hover:text-gray-600`),children:o(`chatSidebarViewProject`)})]})}var gn={wx:`weixin`,lark:`feishu`},_n={heartbeat:{icon:`heartbeat`},cron:{icon:`cron`}},vn={codex:`chatSessionTypeCodex`,claude:`chatSessionTypeClaude`};function yn(e){return e?.trim().toLowerCase()??``}function bn(e){return e.split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function xn(e,t){let n=yn(e);if(!n||n===`native`)return null;let r=t.find(e=>yn(e.value)===n);return r?.label.trim()?r.label.trim():bn(n)}function Sn(e,t){let n=yn(e);return!n||n===`native`?null:t.find(e=>yn(e.value)===n)??null}function Cn(e){let t=yn(e);if(!t)return null;let n=gn[t]??t;return at(n)?n:null}function wn(e,t){let n=Cn(e.channel??``);if(n)return{icon:{kind:`channel-logo`,channel:n},label:null};let r=_n[yn(e.type)];if(r)return{icon:{kind:`symbol`,icon:r.icon},label:null};let i=yn(e.sessionType),a=Sn(i,t);if(a?.icon?.src?.trim())return{icon:{kind:`runtime-image`,src:a.icon.src,alt:a.icon.alt??null,name:a.label},label:null};let s=vn[i];return s?{icon:null,label:o(s)}:{icon:null,label:a?.label?.trim()||xn(e.sessionType,t)}}var Tn=`app://`;function En(e){let t=e.trim().replace(/^\/+/,``);if(!t)return null;let n=t.split(`/`);return n.some(e=>e.trim().length===0||e===`.`||e===`..`)?null:n.join(`/`)}function Dn(e){let t=e.trim();if(!t)return null;if(!t.startsWith(Tn))return t;let n=En(t.slice(6));return n?`/${n}`:null}function On({icon:e,className:t}){if(e.kind===`channel-logo`)return(0,O.jsx)(kn,{channel:e.channel,className:t});if(e.kind===`runtime-image`){let n=Dn(e.src);return(0,O.jsx)(Tt,{name:e.name?.trim()||e.alt?.trim()||`runtime`,src:n??void 0,className:u(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,O.jsx)(Ae,{className:u(`h-3 w-3 text-gray-500`,t)})})}return e.icon===`heartbeat`?(0,O.jsx)(an,{className:u(`h-3.5 w-3.5`,t)}):(0,O.jsx)(ve,{className:u(`h-3.5 w-3.5`,t)})}function kn({channel:e,className:t}){return(0,O.jsx)(Tt,{name:e,src:at(e),className:u(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,O.jsx)(Ae,{className:`h-3 w-3 text-gray-500`})})}function An(e){let{option:t,onSelect:n}=e,r=t.ready===!1?t.reasonMessage?.trim()||o(`statusSetup`):null;return(0,O.jsx)(`button`,{type:`button`,onClick:n,className:`w-full rounded-2xl px-3 py-2.5 text-left transition-colors hover:bg-gray-50`,children:(0,O.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2.5`,children:[t.icon?.src?(0,O.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5`,children:(0,O.jsx)(On,{icon:{kind:`runtime-image`,src:t.icon.src,alt:t.icon.alt??null,name:t.label}})}):null,(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-gray-900`,children:t.label}),(0,O.jsxs)(`span`,{className:u(`inline-flex shrink-0 items-center gap-1.5 text-[11px] font-medium`,t.ready===!1?`text-amber-700`:`text-emerald-600`),children:[(0,O.jsx)(`span`,{className:u(`h-1.5 w-1.5 rounded-full`,t.ready===!1?`bg-amber-500`:`bg-emerald-500`)}),t.ready===!1?o(`statusSetup`):o(`statusReady`)]})]}),r?(0,O.jsx)(`div`,{className:`mt-1 pr-4 text-[11px] leading-4 text-gray-500`,children:r}):null]})]})})})}var k=e(s(),1);function jn(e,t){return t.some(t=>t.value===e)?e:t[0]?.value??e}function Mn(e){let{groups:t,defaultSessionType:n,sessionTypeOptions:r,renderSessionItem:i,onCreateSession:a}=e,[s,c]=(0,k.useState)(null),l=(0,k.useMemo)(()=>jn(n,r),[n,r]),u=r.length>1;return(0,O.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>{let t=`${o(`chatSidebarNewTask`)} · ${e.projectName}`;return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-0.5`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,O.jsx)(`div`,{className:`truncate text-[11px] font-medium uppercase tracking-wider text-gray-500`,title:e.projectRoot,children:e.projectName}),(0,O.jsx)(`span`,{className:`shrink-0 text-[10px] text-gray-400`,children:e.items.length})]}),u?(0,O.jsxs)(wt,{open:s===e.projectRoot,onOpenChange:t=>{c(t?e.projectRoot:null)},children:[(0,O.jsx)(St,{asChild:!0,children:(0,O.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-lg text-gray-400 hover:bg-white hover:text-gray-900`,"aria-label":t,title:t,children:(0,O.jsx)(st,{className:`h-3.5 w-3.5`})})}),(0,O.jsxs)(bt,{align:`end`,className:`w-56 rounded-2xl border border-gray-200/80 bg-white p-1.5 shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:[(0,O.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400`,children:o(`chatSessionTypeLabel`)}),(0,O.jsx)(`div`,{className:`space-y-1`,children:r.map(t=>(0,O.jsx)(An,{option:t,onSelect:()=>{a(t.value,e.projectRoot),c(null)}},`${e.projectRoot}:${t.value}`))})]})]}):(0,O.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-lg text-gray-400 hover:bg-white hover:text-gray-900`,onClick:()=>a(l,e.projectRoot),"aria-label":t,title:t,children:(0,O.jsx)(st,{className:`h-3.5 w-3.5`})})]}),(0,O.jsx)(`div`,{className:`space-y-0.5 pl-2`,children:e.items.map(i)})]},e.projectRoot)})})}var Nn=[[`bg-amber-100`,`text-amber-700`],[`bg-emerald-100`,`text-emerald-700`],[`bg-blue-100`,`text-blue-700`],[`bg-rose-100`,`text-rose-700`],[`bg-cyan-100`,`text-cyan-700`],[`bg-violet-100`,`text-violet-700`]];function Pn(e){let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}function Fn(e){let t=e.trim();return t?t.slice(0,1).toUpperCase():`A`}function In({agentId:e,displayName:t,avatarUrl:n,className:r}){let i=t?.trim()||e,[a,o]=Nn[Pn(e)%Nn.length]??Nn[0];return n?.trim()?(0,O.jsx)(`img`,{src:n,alt:t?.trim()||e,className:u(`rounded-full object-cover`,r)}):(0,O.jsx)(`div`,{className:u(`rounded-full flex items-center justify-center font-semibold`,a,o,r),"aria-label":t?.trim()||e,children:Fn(i)})}function Ln({status:e,className:t}){let n=o(e===`running`?`sessionsRunStatusRunning`:`sessionsRunStatusQueued`);return(0,O.jsxs)(`span`,{className:u(`inline-flex h-3.5 w-3.5 items-center justify-center text-gray-400`,t),title:n,"aria-label":n,children:[(0,O.jsx)(ot,{className:`h-3 w-3 animate-spin`}),(0,O.jsx)(`span`,{className:`sr-only`,children:n})]})}function Rn({session:e,draftLabel:t,isSaving:n,onDraftLabelChange:r,onSave:i,onCancel:a}){return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(ee,{value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),a())},placeholder:o(`sessionsLabelPlaceholder`),className:`h-8 rounded-lg border-gray-300 bg-white text-xs`,autoFocus:!0,disabled:n}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsx)(`div`,{className:`min-w-0 text-[11px] text-gray-400 truncate`,children:e.key}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,O.jsx)(d,{type:`button`,size:`icon`,variant:`ghost`,className:`h-7 w-7 rounded-lg text-gray-500 hover:bg-white hover:text-gray-900`,onClick:()=>void i(),disabled:n,"aria-label":o(`save`),children:(0,O.jsx)(We,{className:`h-3.5 w-3.5`})}),(0,O.jsx)(d,{type:`button`,size:`icon`,variant:`ghost`,className:`h-7 w-7 rounded-lg text-gray-500 hover:bg-white hover:text-gray-900`,onClick:a,disabled:n,"aria-label":o(`cancel`),children:(0,O.jsx)(ft,{className:`h-3.5 w-3.5`})})]})]})]})}function zn({session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:s,agentLabel:l,agentAvatarUrl:d,childSessionCount:f=0,onSelect:p,onOpenChildSessions:m,onStartEditing:h}){let g=t?`text-gray-700`:`text-gray-500`,_=s?.trim()??``;return(0,O.jsxs)(`div`,{className:`group/session relative`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:p,className:`w-full text-left`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-1.5 pr-8`,children:[(0,O.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[_&&_.toLowerCase()!==`main`?(0,O.jsx)(In,{agentId:_,displayName:l,avatarUrl:d,className:`h-5 w-5 shrink-0`}):null,(0,O.jsx)(`span`,{className:`truncate font-medium`,children:a}),i.label?(0,O.jsx)(`span`,{className:u(`shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-semibold leading-none`,t?`border-gray-300 bg-white/80 text-gray-700`:`border-gray-200 bg-gray-100 text-gray-500`),children:i.label}):null,i.icon?(0,O.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] shrink-0 items-center justify-center`,children:(0,O.jsx)(On,{icon:i.icon,className:g})}):null]}),(0,O.jsxs)(`span`,{className:`inline-flex shrink-0 items-center justify-end gap-1.5`,children:[n?(0,O.jsx)(`span`,{"aria-label":o(`chatSessionUnread`),className:`h-2 w-2 rounded-full bg-primary`}):null,(0,O.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 items-center justify-center`,children:r?(0,O.jsx)(Ln,{status:r}):null})]})]}),(0,O.jsx)(`div`,{className:`mt-0.5 text-[11px] text-gray-400 truncate`,children:(0,O.jsxs)(`span`,{children:[l?.trim()?`${l} · `:``,e.messageCount,` · `,c(e.updatedAt)]})})]}),f>0&&m?(0,O.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m()},className:u(`absolute right-7 top-0 inline-flex h-7 items-center gap-1 rounded-lg px-1.5 text-[10px] font-medium text-gray-400 transition-all hover:bg-white hover:text-gray-900`,t?`opacity-100`:`opacity-0 group-hover/session:opacity-100 group-focus-within/session:opacity-100`),"aria-label":o(`chatSessionOpenChildSessions`),title:o(`chatSessionOpenChildSessions`),children:[(0,O.jsx)(rn,{className:`h-3.5 w-3.5`}),(0,O.jsx)(`span`,{children:f})]}):null,(0,O.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h()},className:u(`absolute right-0 top-0 inline-flex h-7 w-7 items-center justify-center rounded-lg text-gray-400 transition-all hover:bg-white hover:text-gray-900`,t?`opacity-100`:`opacity-0 group-hover/session:opacity-100 group-focus-within/session:opacity-100`),"aria-label":o(`edit`),children:(0,O.jsx)(un,{className:`h-3.5 w-3.5`})})]})}function Bn({session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:o,agentLabel:s,agentAvatarUrl:c,childSessionCount:l,isEditing:d,draftLabel:f,isSaving:p,onSelect:m,onOpenChildSessions:h,onStartEditing:g,onDraftLabelChange:_,onSave:v,onCancel:y}){return(0,O.jsx)(`div`,{className:u(`w-full rounded-xl px-3 py-2 text-left transition-all text-[13px]`,t?`bg-gray-200 text-gray-900 font-semibold shadow-sm`:`text-gray-700 hover:bg-gray-200/60 hover:text-gray-900`),children:d?(0,O.jsx)(Rn,{session:e,draftLabel:f,isSaving:p,onDraftLabelChange:_,onSave:v,onCancel:y}):(0,O.jsx)(zn,{session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:o,agentLabel:s,agentAvatarUrl:c,onSelect:m,childSessionCount:l,onOpenChildSessions:h,onStartEditing:g})})}var Vn=[{icon:Ce,titleKey:`chatWelcomeCapability1Title`,descKey:`chatWelcomeCapability1Desc`},{icon:ke,titleKey:`chatWelcomeCapability2Title`,descKey:`chatWelcomeCapability2Desc`},{icon:ve,titleKey:`chatWelcomeCapability3Title`,descKey:`chatWelcomeCapability3Desc`}];function Hn({onCreateSession:e,agents:t,selectedAgentId:n,onSelectAgent:r}){let i=t.find(e=>e.id===n)??null;return(0,O.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,O.jsxs)(`div`,{className:`max-w-lg w-full text-center`,children:[(0,O.jsx)(`div`,{className:`mx-auto mb-6 h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center`,children:(0,O.jsx)(Ae,{className:`h-8 w-8 text-primary`})}),(0,O.jsx)(`h2`,{className:`text-xl font-semibold text-gray-900 mb-2`,children:o(`chatWelcomeTitle`)}),(0,O.jsx)(`p`,{className:`text-sm text-gray-500 mb-8`,children:o(`chatWelcomeSubtitle`)}),(0,O.jsxs)(`div`,{className:`mb-6 flex items-center justify-center gap-2.5`,children:[(0,O.jsx)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:o(`chatDraftAgentTitle`)}),(0,O.jsxs)(Qe,{value:n,onValueChange:r,children:[(0,O.jsxs)(Ue,{"aria-label":o(`chatDraftAgentTitle`),className:`h-auto w-auto gap-1 rounded-full border-0 bg-transparent px-1.5 py-1 text-gray-500 shadow-none hover:bg-white/70 hover:text-gray-800 focus:ring-0`,children:[(0,O.jsx)(`span`,{className:`sr-only`,children:o(`chatDraftAgentTitle`)}),(0,O.jsx)(`div`,{className:`flex items-center gap-1.5`,children:i?(0,O.jsx)(In,{agentId:i.id,displayName:i.displayName,avatarUrl:i.avatarUrl,className:`h-7 w-7 shrink-0`}):null})]}),(0,O.jsx)(qe,{className:`rounded-xl border-gray-200/80 shadow-lg`,children:t.map(e=>(0,O.jsx)(Xe,{value:e.id,className:`rounded-lg pr-10`,children:(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,O.jsx)(In,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,O.jsx)(`span`,{className:`truncate text-sm font-medium text-gray-700`,children:e.displayName?.trim()||e.id})]})},e.id))})]})]}),(0,O.jsx)(`div`,{className:`grid grid-cols-3 gap-3`,children:Vn.map(t=>{let n=t.icon;return(0,O.jsxs)(`button`,{onClick:e,className:`rounded-2xl border border-gray-200 bg-white p-4 text-left shadow-card hover:shadow-card-hover transition-shadow cursor-pointer`,children:[(0,O.jsx)(`div`,{className:`h-9 w-9 rounded-xl bg-primary/8 flex items-center justify-center mb-3`,children:(0,O.jsx)(n,{className:`h-4.5 w-4.5 text-primary`})}),(0,O.jsx)(`div`,{className:`text-sm font-semibold text-gray-900 mb-1`,children:o(t.titleKey)}),(0,O.jsx)(`div`,{className:`text-[11px] text-gray-500 leading-relaxed`,children:o(t.descKey)})]},t.titleKey)})})]})})}var Un=e=>`[data-item-index="${e}"]`;function Wn(e){let{activeIndex:t,containerRef:n,getItemSelector:r,isEnabled:i,itemCount:a}=e,o=r??Un;(0,k.useEffect)(()=>{if(!i||a===0)return;let e=n.current;if(!e)return;let r=e.querySelector(o(t));typeof r?.scrollIntoView==`function`&&r.scrollIntoView({block:`nearest`,inline:`nearest`})},[t,n,o,i,a])}function Gn(){let e=(0,k.useRef)(null),[t,n]=(0,k.useState)(null);return(0,k.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=()=>{n(t.getBoundingClientRect().width)};r();let i=new ResizeObserver(()=>r());return i.observe(t),()=>i.disconnect()},[]),{elementRef:e,width:t}}function A(...e){return n(r(e))}var Kn=k.forwardRef(({className:e,type:t,...n},r)=>(0,O.jsx)(`input`,{type:t,className:A(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));Kn.displayName=`ChatInput`;var qn=Ct,Jn=vt,Yn=yt,Xn=k.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,...r},i)=>(0,O.jsx)(xt,{children:(0,O.jsx)(_t,{ref:i,sideOffset:t,align:n,className:A(`z-[var(--z-popover,50)] w-72 overflow-hidden rounded-2xl border border-gray-200/50 bg-white p-4 shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));Xn.displayName=_t.displayName;var Zn=Ke,Qn=Ze,$n=tt,er=k.forwardRef(({className:e,children:t,...n},r)=>(0,O.jsxs)(et,{ref:r,className:A(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-gray-200/80 bg-white px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,O.jsx)(Re,{asChild:!0,children:(0,O.jsx)(Fe,{className:`h-4 w-4 opacity-50`})})]}));er.displayName=et.displayName;var tr=k.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Ve,{ref:n,className:A(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,O.jsx)(Pe,{className:`h-4 w-4`})}));tr.displayName=Ve.displayName;var nr=k.forwardRef(({className:e,...t},n)=>(0,O.jsx)(He,{ref:n,className:A(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,O.jsx)(Fe,{className:`h-4 w-4`})}));nr.displayName=He.displayName;var rr=k.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,O.jsx)(Ye,{children:(0,O.jsxs)(Je,{ref:i,className:A(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,O.jsx)(tr,{}),(0,O.jsx)(Le,{className:A(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,O.jsx)(nr,{})]})}));rr.displayName=Je.displayName;var ir=k.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Be,{ref:n,className:A(`px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-gray-500`,e),...t}));ir.displayName=Be.displayName;var ar=k.forwardRef(({className:e,children:t,...n},r)=>(0,O.jsxs)(Ge,{ref:r,className:A(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-gray-100`,e),...n,children:[(0,O.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,O.jsx)($e,{children:(0,O.jsx)(We,{className:`h-4 w-4`})})}),(0,O.jsx)(ze,{children:t})]}));ar.displayName=Ge.displayName;var or=k.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Ie,{ref:n,className:A(`-mx-1 my-1 h-px bg-gray-100`,e),...t}));or.displayName=Ie.displayName;var sr=Nt,cr=Dt,lr=kt,ur=k.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,O.jsx)(jt,{children:(0,O.jsx)(Et,{ref:r,sideOffset:t,className:A(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));ur.displayName=Et.displayName;var dr={Popover:qn,PopoverAnchor:Yn,PopoverContent:Xn,PopoverTrigger:Jn,Input:Kn,Select:Zn,SelectContent:rr,SelectGroup:Qn,SelectItem:ar,SelectLabel:ir,SelectSeparator:or,SelectTrigger:er,SelectValue:$n,Tooltip:cr,TooltipContent:ur,TooltipProvider:sr,TooltipTrigger:lr},fr=680,pr=.82,mr=560;function hr(e){let{Popover:t,PopoverAnchor:n,PopoverContent:r}=dr,{elementRef:i,width:a}=Gn(),o=(0,k.useRef)(null),{isOpen:s,isLoading:c,items:l,activeIndex:u,activeItem:d,texts:f,onSelectItem:p,onOpenChange:m,onSetActiveIndex:h}=e,g=(0,k.useMemo)(()=>{if(a)return Math.min(a>mr?a*pr:a,fr)},[a]);return Wn({containerRef:o,activeIndex:u,itemCount:l.length,isEnabled:s&&!c,getItemSelector:e=>`[data-slash-index="${e}"]`}),(0,O.jsxs)(t,{open:s,onOpenChange:m,children:[(0,O.jsx)(n,{asChild:!0,children:(0,O.jsx)(`div`,{ref:i,className:`pointer-events-none absolute bottom-full left-3 right-3 h-0`})}),(0,O.jsx)(r,{side:`top`,align:`start`,sideOffset:10,className:`z-[70] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-2xl border border-gray-200 bg-white/95 p-0 shadow-2xl backdrop-blur-md`,onOpenAutoFocus:e=>e.preventDefault(),style:g?{width:`${g}px`}:void 0,children:(0,O.jsxs)(`div`,{className:`grid min-h-[240px] grid-cols-[minmax(220px,300px)_minmax(0,1fr)]`,children:[(0,O.jsx)(`div`,{ref:o,role:`listbox`,"aria-label":f.slashSectionLabel,className:`custom-scrollbar max-h-[320px] overflow-y-auto border-r border-gray-200 p-2.5`,children:c?(0,O.jsx)(`div`,{className:`p-2 text-xs text-gray-500`,children:f.slashLoadingLabel}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`mb-2 px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:f.slashSectionLabel}),l.length===0?(0,O.jsx)(`div`,{className:`px-2 text-xs text-gray-400`,children:f.slashEmptyLabel}):(0,O.jsx)(`div`,{className:`space-y-1`,children:l.map((e,t)=>{let n=t===u;return(0,O.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,"data-slash-index":t,onMouseEnter:()=>h(t),onClick:()=>p(e),className:`flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition ${n?`bg-gray-100 text-gray-900`:`text-gray-700 hover:bg-gray-50`}`,children:[(0,O.jsx)(`span`,{className:`truncate text-xs font-semibold`,children:e.title}),(0,O.jsx)(`span`,{className:`truncate text-xs text-gray-500`,children:e.subtitle})]},e.key)})})]})}),(0,O.jsx)(`div`,{className:`min-w-0 p-2.5`,children:d?(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary`,children:d.subtitle}),(0,O.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:d.title})]}),(0,O.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:d.description}),(0,O.jsx)(`div`,{className:`space-y-1`,children:d.detailLines.map(e=>(0,O.jsx)(`div`,{className:`min-w-0 break-all rounded-md bg-gray-50 px-2 py-1 text-[11px] leading-5 text-gray-600`,children:e},e))}),(0,O.jsx)(`div`,{className:`pt-1 text-[11px] text-gray-500`,children:f.slashSkillHintLabel})]}):(0,O.jsx)(`div`,{className:`text-xs text-gray-500`,children:f.slashHintLabel})})]})})]})}var gr=E(`inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-gray-200 bg-white hover:bg-gray-50 hover:text-gray-800 text-gray-600`,secondary:`bg-gray-100 text-gray-700 hover:bg-gray-200/80`,ghost:`hover:bg-gray-100/80 hover:text-gray-800`,link:`text-primary underline-offset-4 hover:underline`,primary:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,subtle:`bg-gray-100 text-gray-600 hover:bg-gray-200/80`,"primary-outline":`border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground`},size:{default:`h-9 px-4 py-2`,sm:`h-8 px-3 text-xs`,lg:`h-11 px-5 text-[14px]`,xl:`h-12 px-6 text-[15px]`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),_r=k.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,O.jsx)(`button`,{className:A(gr({variant:t,size:n,className:e})),ref:i,...r}));_r.displayName=`ChatButton`;var vr=120;function yr(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=vr?t:`${t.slice(0,vr-1)}…`}function br(){return(0,O.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`chat-stop-icon`,className:`block h-3 w-3 rounded-[2px] bg-gray-700 shadow-[inset_0_0_0_1px_rgba(17,24,39,0.06)]`})}function xr({sendError:e,sendErrorDetailsLabel:t,isSending:n,canStopGeneration:r,sendDisabled:i,stopDisabled:a,stopHint:o,sendButtonLabel:s,stopButtonLabel:c,onSend:l,onStop:u}){let{Popover:d,PopoverContent:f,PopoverTrigger:p,Tooltip:m,TooltipContent:h,TooltipProvider:g,TooltipTrigger:_}=dr,v=e?.trim()??``,y=v?yr(v):``,b=t?.trim()||`Details`;return(0,O.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[v?(0,O.jsxs)(`div`,{className:`flex max-w-[420px] items-start justify-end gap-2 text-right`,children:[(0,O.jsx)(`div`,{className:`min-w-0 flex-1 text-[11px] text-red-600`,children:(0,O.jsx)(`span`,{className:`block truncate`,title:v,children:y})}),(0,O.jsxs)(d,{children:[(0,O.jsx)(p,{asChild:!0,children:(0,O.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-full border border-red-200/80 bg-red-50 px-2 py-0.5 text-[10px] font-semibold text-red-700 transition-colors hover:bg-red-100`,children:b})}),(0,O.jsxs)(f,{align:`end`,className:`w-[min(32rem,calc(100vw-1.5rem))] border-red-100/80 p-0`,children:[(0,O.jsx)(`div`,{className:`border-b border-red-100 bg-red-50/80 px-4 py-2 text-xs font-semibold text-red-700`,children:b}),(0,O.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words px-4 py-3 text-xs leading-relaxed text-red-700`,children:v})]})]})]}):null,(0,O.jsx)(`div`,{className:`flex items-center gap-2`,children:n?r?(0,O.jsx)(_r,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,onClick:()=>void u(),disabled:a,children:(0,O.jsx)(br,{})}):(0,O.jsx)(g,{children:(0,O.jsxs)(m,{children:[(0,O.jsx)(_,{asChild:!0,children:(0,O.jsx)(`span`,{children:(0,O.jsx)(_r,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,disabled:!0,children:(0,O.jsx)(br,{})})})}),(0,O.jsx)(h,{side:`top`,children:(0,O.jsx)(`p`,{className:`text-xs`,children:o})})]})}):(0,O.jsx)(_r,{size:`icon`,className:`h-8 w-8 rounded-full`,"aria-label":s,onClick:()=>void l(),disabled:i,children:(0,O.jsx)(Lt,{className:`h-5 w-5`})})})]})}function Sr(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.label,e.key,e.description].filter(e=>typeof e==`string`&&e.trim().length>0).join(` `).toLowerCase().includes(n)):e}function Cr(e){let{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:i}=dr,{picker:a}=e,o=(0,k.useRef)(null),s=(0,k.useId)(),[c,l]=(0,k.useState)(``),[u,d]=(0,k.useState)(0),f=(0,k.useMemo)(()=>new Set(a.selectedKeys),[a.selectedKeys]),p=a.selectedKeys.length,m=c.trim().length>0,h=(0,k.useMemo)(()=>{if(m)return null;let e=a.groups?.filter(e=>e.options.length>0)??[];return e.length>0?e:null},[m,a.groups]),g=(0,k.useMemo)(()=>h?h.flatMap(e=>e.options):Sr(a.options,c),[h,a.options,c]);(0,k.useEffect)(()=>{d(0)},[c]),(0,k.useEffect)(()=>{d(e=>g.length===0?0:Math.min(e,g.length-1))},[g.length]),Wn({containerRef:o,activeIndex:u,itemCount:g.length,isEnabled:g.length>0,getItemSelector:e=>`[data-skill-index="${e}"]`});let _=e=>{if(f.has(e)){a.onSelectedKeysChange(a.selectedKeys.filter(t=>t!==e));return}a.onSelectedKeysChange([...a.selectedKeys,e])},v=e=>{if(g.length!==0){if(e.key===`ArrowDown`){e.preventDefault(),d(e=>Math.min(e+1,g.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),d(e=>Math.max(e-1,0));return}if(e.key===`Enter`){e.preventDefault();let t=g[u];t&&_(t.key)}}};return(0,O.jsxs)(n,{children:[(0,O.jsx)(i,{asChild:!0,children:(0,O.jsxs)(`button`,{type:`button`,"aria-haspopup":`listbox`,className:`inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,children:[(0,O.jsx)(ke,{className:`h-4 w-4`}),(0,O.jsx)(`span`,{children:a.title}),p>0?(0,O.jsx)(`span`,{className:`ml-0.5 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary/10 text-[10px] font-semibold text-primary`,children:p}):null]})}),(0,O.jsxs)(r,{side:`top`,align:`start`,className:`w-[360px] p-0`,children:[(0,O.jsxs)(`div`,{className:`space-y-2 border-b border-gray-100 px-4 py-3`,children:[(0,O.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:a.title}),(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsx)(Me,{className:`pointer-events-none absolute left-3 top-2.5 h-3.5 w-3.5 text-gray-400`}),(0,O.jsx)(t,{value:c,onChange:e=>l(e.target.value),onKeyDown:v,placeholder:a.searchPlaceholder,role:`combobox`,"aria-controls":s,"aria-expanded":`true`,"aria-autocomplete":`list`,"aria-activedescendant":g[u]?`${s}-option-${u}`:void 0,className:`h-8 rounded-lg pl-8 text-xs`})]})]}),(0,O.jsx)(`div`,{ref:o,id:s,role:`listbox`,"aria-multiselectable":`true`,className:`custom-scrollbar max-h-[320px] overflow-y-auto`,children:a.isLoading?(0,O.jsx)(`div`,{className:`p-4 text-xs text-gray-500`,children:a.loadingLabel}):g.length===0?(0,O.jsx)(`div`,{className:`p-4 text-center text-xs text-gray-500`,children:a.emptyLabel}):(0,O.jsx)(`div`,{className:`py-1`,children:(()=>{let e=h??[{key:`all-skills`,options:g}],t=0;return e.map(e=>(0,O.jsxs)(`div`,{children:[e.label?(0,O.jsx)(`div`,{className:`px-4 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:e.label}):null,e.options.map(e=>{let n=t;t+=1;let r=f.has(e.key),i=n===u;return(0,O.jsxs)(`button`,{type:`button`,id:`${s}-option-${n}`,role:`option`,"aria-selected":r,"data-skill-index":n,onClick:()=>_(e.key),onMouseEnter:()=>d(n),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors ${i?`bg-gray-50`:`hover:bg-gray-50`}`,children:[(0,O.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500`,children:(0,O.jsx)(dn,{className:`h-4 w-4`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`truncate text-sm text-gray-900`,children:e.label}),e.badgeLabel?(0,O.jsx)(`span`,{className:`shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:e.badgeLabel}):null]}),(0,O.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-gray-500`,children:e.description||e.key})]}),(0,O.jsx)(`div`,{className:`ml-3 shrink-0`,children:(0,O.jsx)(`span`,{className:r?`inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-white`:`inline-flex h-5 w-5 items-center justify-center rounded-full border border-gray-300 bg-white`,children:r?(0,O.jsx)(We,{className:`h-3 w-3`}):null})})]},e.key)})]},e.key))})()})}),a.manageHref&&a.manageLabel?(0,O.jsx)(`div`,{className:`border-t border-gray-100 px-4 py-2.5`,children:(0,O.jsxs)(`a`,{href:a.manageHref,className:`inline-flex items-center gap-1.5 text-xs font-medium text-primary transition-colors hover:text-primary/80`,children:[a.manageLabel,(0,O.jsx)(nt,{className:`h-3 w-3`})]})}):null]})]})}function wr({icon:e}){return e===`sparkles`?(0,O.jsx)(ut,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):e===`brain`?(0,O.jsx)(Rt,{className:`h-3.5 w-3.5 shrink-0 text-gray-500`}):null}function Tr({icon:e}){return e===`paperclip`?(0,O.jsx)(ln,{className:`h-4 w-4`}):(0,O.jsx)(wr,{icon:e})}function Er(e){return e===`model`?`min-w-[220px]`:e===`session-type`?`min-w-[140px]`:e===`thinking`?`min-w-[150px]`:``}function Dr(e){return e===`model`?`w-[320px]`:e===`session-type`?`w-[220px]`:e===`thinking`?`w-[180px]`:``}function Or({item:e}){let{Select:t,SelectContent:n,SelectGroup:r,SelectItem:i,SelectLabel:a,SelectSeparator:o,SelectTrigger:s,SelectValue:c}=dr,l=e.groups?.filter(e=>e.options.length>0)??(e.options.length>0?[{key:`${e.key}-default`,options:e.options}]:[]),u=l.some(e=>e.options.length>0);return(0,O.jsxs)(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[(0,O.jsx)(s,{className:`h-8 w-auto rounded-lg border-0 bg-transparent px-3 text-xs font-medium text-gray-600 shadow-none hover:bg-gray-100 focus:ring-0 ${Er(e.key)}`,children:e.selectedLabel?(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-left`,children:[(0,O.jsx)(wr,{icon:e.icon}),(0,O.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-700`,children:e.selectedLabel})]}):e.loading?(0,O.jsx)(`div`,{className:`h-3 w-24 animate-pulse rounded bg-gray-200`}):(0,O.jsx)(c,{placeholder:e.placeholder})}),(0,O.jsxs)(n,{className:Dr(e.key),children:[u?null:e.loading?(0,O.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,O.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-gray-200`}),(0,O.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-gray-200`}),(0,O.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-gray-200`})]}):e.emptyLabel?(0,O.jsx)(`div`,{className:`px-3 py-2 text-xs text-gray-500`,children:e.emptyLabel}):null,l.map((e,t)=>(0,O.jsxs)(`div`,{children:[t>0?(0,O.jsx)(o,{}):null,(0,O.jsxs)(r,{children:[e.label?(0,O.jsx)(a,{children:e.label}):null,e.options.map(e=>(0,O.jsx)(i,{value:e.value,className:`py-2`,children:e.description?(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,O.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label}),(0,O.jsx)(`span`,{className:`truncate text-[11px] text-gray-500`,children:e.description})]}):(0,O.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label})},e.value))]})]},e.key))]})]})}function kr(e){let{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=dr;return(0,O.jsxs)(`div`,{className:`flex items-center justify-between px-3 pb-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.skillPicker?(0,O.jsx)(Cr,{picker:e.skillPicker}):null,e.selects.map(e=>(0,O.jsx)(Or,{item:e},e.key)),e.accessories?.map(e=>{let a=(0,O.jsxs)(`button`,{type:`button`,className:`inline-flex items-center rounded-lg py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:text-gray-400 ${e.iconOnly?`h-8 w-8 justify-center px-0`:`gap-1.5 px-3`}`,onClick:e.onClick,disabled:e.disabled,"aria-label":e.label,children:[(0,O.jsx)(Tr,{icon:e.icon}),e.iconOnly?null:(0,O.jsx)(`span`,{children:e.label})]});return e.tooltip?(0,O.jsx)(r,{children:(0,O.jsxs)(t,{children:[(0,O.jsx)(i,{asChild:!0,children:e.disabled?(0,O.jsx)(`span`,{className:`inline-flex`,children:a}):a}),(0,O.jsx)(n,{side:`top`,children:(0,O.jsx)(`p`,{className:`text-xs`,children:e.tooltip})})]})},e.key):(0,O.jsx)(`div`,{children:a},e.key)})]}),(0,O.jsx)(xr,{...e.actions})]})}var Ar=(0,k.createContext)(null);function jr(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function Mr(){let e=(0,k.useContext)(Ar);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function j(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Nr(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Pr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Fr=Pr&&`documentMode`in document?document.documentMode:null,Ir=Pr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Lr=Pr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Rr=!(!Pr||!(`InputEvent`in window)||Fr)&&`getTargetRanges`in new window.InputEvent(`input`),zr=Pr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Br=Pr&&/Android/.test(navigator.userAgent),Vr=Pr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Br,Hr=Pr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ur=Pr&&Br&&Hr,Wr=Pr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ir&&!Hr,Gr=0,Kr=1,qr=2,Jr=1,Yr=2,Xr=3,Zr=4,Qr=5,$r=6,ei=Vr||zr||Wr?`\xA0`:``,ti=`
|
|
2
2
|
|
|
3
3
|
`,ni=Lr?`\xA0`:ei,ri={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},ii={directionless:1,unmergeable:2},ai={center:2,end:6,justify:4,left:1,right:3,start:5},oi={[Yr]:`center`,[$r]:`end`,[Zr]:`justify`,[Jr]:`left`,[Xr]:`right`,[Qr]:`start`},si={normal:0,segmented:2,token:1},ci={[Gr]:`normal`,[qr]:`segmented`,[Kr]:`token`},li=`$config`;function ui(e,t,n,r,i,a){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&(L(o)&&ui(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}var di=!1,fi=0;function pi(e){fi=e.timeStamp}function mi(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&ul(e,n)!==void 0}function hi(e,t,n){let r=Ql(Wl(n)),i=null,a=null;r!==null&&r.anchorNode===e&&(i=r.anchorOffset,a=r.focusOffset);let o=e.nodeValue;o!==null&&Cl(t,o,i,a,!1)}function gi(e,t,n){if(P(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return $c(t)&&n.isAttached()}function _i(e,t,n,r){for(let i=e;i&&!pu(i);i=Rl(i)){let e=ul(i,t);if(e!==void 0){let t=cl(e,n);if(t)return R(t)||!eu(i)?void 0:[i,t]}else if(i===r)return[r,hl(n)]}}function vi(e,t,n){di=!0;let r=performance.now()-fi>100;try{hc(e,()=>{let i=F()||function(e){return e.getEditorState().read(()=>{let e=F();return e===null?null:e.clone()})}(e),a=new Map,o=e.getRootElement(),s=e._editorState,c=e._blockCursorElement,l=!1,u=``;for(let n=0;n<t.length;n++){let d=t[n],f=d.type,p=d.target,m=_i(p,e,s,o);if(!m)continue;let[h,g]=m;if(f===`characterData`)r&&N(g)&&$c(p)&&gi(i,p,g)&&hi(p,g,e);else if(f===`childList`){l=!0;let t=d.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=ll(r),a=r.parentNode;if(a!=null&&r!==c&&i===null&&!mi(r,a,e)){if(Lr){let e=(eu(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}a.removeChild(r)}}let n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(mi(r,p,e)||c===r)&&(p.appendChild(r),t++)}r!==t&&a.set(h,g)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){let n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||mi(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(l&&gl(i),Lr&&Il(e)&&i.insertRawText(u))})}finally{di=!1}}function yi(e){let t=e._observer;t!==null&&vi(e,t.takeRecords(),t)}function bi(e){(function(e){fi===0&&Wl(e).addEventListener(`textInput`,pi,!0)})(e),e._observer=new MutationObserver((t,n)=>{vi(e,t,n)})}var xi=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Oi).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Si(e,t){return new xi(e,t)}function Ci(e){let t=new Map,n=new Set;for(let r=typeof e==`function`?e:e.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){let{ownNodeConfig:e}=hu(r);if(e&&e.stateConfigs)for(let r of e.stateConfigs){let e;`stateConfig`in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}var wi=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState;this.size=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return Di(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=Di(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function Ti(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new wi(t,Ei(t));return t.__state=n,n}function Ei(e){return e.__state?e.__state.sharedNodeState:Hc(ou(),e.getType()).sharedNodeState}function Di(e){if(e)for(let t in e)return e}function Oi(e){return e}function ki(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function Ai(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function ji(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Mi(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&ki(n,e,t)||t&&ki(n,t,e)||e&&Ai(n,e,t)||t&&Ai(n,t,e))}(c,l))}function Ni(e,t){let n=e.mergeWithSibling(t),r=I()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function Pi(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&N(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(Mi(t,r)){r=Ni(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&N(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(Mi(r,n)){r=Ni(r,n);break}break}n.remove()}}else r.remove()}function Fi(e){return Ii(e.anchor),Ii(e.focus),e}function Ii(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),N(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!L(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi=``,Ji=null,Yi=null,Xi=!1,Zi=!1;function Qi(e,t){let n=Ui.get(e);if(t!==null){let n=ga(e);n.parentNode===t&&t.removeChild(n)}if(Wi.has(e)||Ri._keyToDOMMap.delete(e),L(n)){let e=ua(n,Ui);$i(e,0,e.length-1,null)}n!==void 0&&Nl(Ki,zi,Bi,n,`destroyed`)}function $i(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&Qi(t,r)}}function ea(e,t){e.setProperty(`text-align`,t)}var ta=`40px`;function na(e,t){let n=Li.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty(`padding-inline-start`,``);let r=getComputedStyle(Ri._rootElement||e).getPropertyValue(`--lexical-indent-base-value`)||ta;e.style.setProperty(`padding-inline-start`,`calc(${t} * ${r})`)}function ra(e,t){let n=e.style;t===0?ea(n,``):t===1?ea(n,`left`):t===2?ea(n,`center`):t===3?ea(n,`right`):t===4?ea(n,`justify`):t===5?ea(n,`start`):t===6&&ea(n,`end`)}function ia(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(Sc(e))return null;let n=e.getParentOrThrow();return Sc(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function aa(e,t){let n=Wi.get(e);n===void 0&&j(60);let r=n.createDOM(Li,Ri);if(function(e,t,n){let r=n._keyToDOMMap;(function(e,t,n){let r=`__lexicalKey_${t._key}`;e[r]=n})(t,n,e),r.set(e,t)}(e,r,Ri),N(n)?r.setAttribute(`data-lexical-text`,`true`):R(n)&&r.setAttribute(`data-lexical-decorator`,`true`),L(n)){let e=n.__indent,t=n.__size;if(ia(r,n),e!==0&&na(r,e),t!==0){let e=t-1;oa(ua(n,Wi),n,0,e,n.getDOMSlot(r))}let i=n.__format;i!==0&&ra(r,i),n.isInline()||ca(null,n,r)}else{let t=n.getTextContent();if(R(n)){let t=n.decorate(Ri,Li);t!==null&&fa(e,t),r.contentEditable=`false`}qi+=t}return t!==null&&t.insertChild(r),Nl(Ki,zi,Bi,n,`created`),r}function oa(e,t,n,r,i){let a=qi;qi=``;let o=n;for(;o<=r;++o){aa(e[o],i);let t=Wi.get(e[o]);t!==null&&N(t)?Ji===null&&(Ji=t.getFormat(),Yi=t.getStyle()):L(t)&&o<r&&!t.isInline()&&(qi+=ti)}i.element.__lexicalTextContent=qi,qi=a+qi}function sa(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return Jo(e)?`line-break`:R(e)&&e.isInline()?`decorator`:null}return`empty`}return null}function ca(e,t,n){let r=sa(e,Ui),i=sa(t,Wi);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function la(e,t,n){var r;Ji=null,Yi=null,function(e,t,n){let r=qi,i=e.__size,a=t.__size;qi=``;let o=n.element;if(i===1&&a===1){let n=e.__first,r=t.__first;if(n===r)da(n,o);else{let e=ga(n),t=aa(r,null);try{o.replaceChild(t,e)}catch(i){if(typeof i==`object`&&i){let a=`${i.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw Error(a)}throw i}Qi(n,null)}let i=Wi.get(r);N(i)&&Ji===null&&(Ji=i.getFormat(),Yi=i.getStyle())}else{let r=ua(e,Ui),s=ua(t,Wi);if(r.length!==i&&j(227),s.length!==a&&j(228),i===0)a!==0&&oa(s,0,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&n.element.__lexicalLineBreak==null;$i(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else (function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f];if(e===r)u=pa(da(r,a.element)),d++,f++;else{if(l===void 0&&(l=ma(n,f)),c===void 0)c=ma(t,d);else if(!c.has(e)){d++;continue}if(!l.has(e)){u=pa(ga(e)),Qi(e,a.element),d++,c.delete(e);continue}if(c.has(r)){let e=Ll(Ri,r);e!==u&&a.withBefore(u).insertChild(e),u=pa(da(r,a.element)),d++,f++}else aa(r,a.withBefore(u)),f++}let i=Wi.get(r);i!==null&&N(i)?Ji===null&&(Ji=i.getFormat(),Yi=i.getStyle()):L(i)&&f<=s&&!i.isInline()&&(qi+=ti)}let p=d>o,m=f>s;if(p&&!m){let e=n[s+1],t=e===void 0?null:Ri.getElementByKey(e);oa(n,0,f,s,a.withBefore(t))}else m&&!p&&$i(t,d,o,a.element)})(0,r,s,i,a,n)}o.__lexicalTextContent=qi,qi=r+qi}(e,t,t.getDOMSlot(n)),r=t,Ji==null||Ji===r.__textFormat||Zi||r.setTextFormat(Ji),function(e){Yi==null||Yi===e.__textStyle||Zi||e.setTextStyle(Yi)}(t)}function ua(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t.get(r);e===void 0&&j(101),n.push(r),r=e.__next}return n}function da(e,t){let n=Ui.get(e),r=Wi.get(e);n!==void 0&&r!==void 0||j(61);let i=Xi||Hi.has(e)||Vi.has(e),a=Ll(Ri,e);if(n===r&&!i){let e;if(L(n)){let t=a.__lexicalTextContent;typeof t==`string`?e=t:(e=n.getTextContent(),a.__lexicalTextContent=e)}else e=n.getTextContent();return qi+=e,a}if(n!==r&&i&&Nl(Ki,zi,Bi,r,`updated`),r.updateDOM(n,a,Li)){let n=aa(e,null);return t===null&&j(62),t.replaceChild(n,a),Qi(e,null),n}if(L(n)){L(r)||j(334,e);let t=r.__indent;(Xi||t!==n.__indent)&&na(a,t);let o=r.__format;if((Xi||o!==n.__format)&&ra(a,o),i)la(n,r,a),Sc(r)||r.isInline()||ca(n,r,a);else{let e=a.__lexicalTextContent,t;typeof e==`string`?t=e:(t=n.getTextContent(),a.__lexicalTextContent=t),qi+=t}if((Xi||r.__dir!==n.__dir)&&(ia(a,r),Sc(r)&&!Xi))for(let e of r.getChildren())L(e)&&ia(Ll(Ri,e.getKey()),e)}else{let t=r.getTextContent();if(R(r)){let t=r.decorate(Ri,Li);t!==null&&fa(e,t)}qi+=t}if(!Zi&&Sc(r)&&r.__cachedText!==qi){let e=r.getWritable();e.__cachedText=qi,r=e}return a}function fa(e,t){let n=Ri._pendingDecorators,r=Ri._decorators;if(n===null){if(r[e]===t)return;n=fl(Ri)}n[e]=t}function pa(e){let t=e.nextSibling;return t!==null&&t===Ri._blockCursorElement&&(t=t.nextSibling),t}function ma(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function ha(e,t,n,r,i,a){qi=``,Xi=r===2,Ri=n,Li=n._config,zi=n._nodes,Bi=Ri._listeners.mutation,Vi=i,Hi=a,Ui=e._nodeMap,Wi=t._nodeMap,Zi=t._readOnly,Gi=new Map(n._keyToDOMMap);let o=new Map;return Ki=o,da(`root`,null),Ri=void 0,zi=void 0,Vi=void 0,Hi=void 0,Ui=void 0,Wi=void 0,Li=void 0,Gi=void 0,Ki=void 0,o}function ga(e){let t=Gi.get(e);return t===void 0&&j(75,e),t}function M(e){return{type:e}}var _a=M(`SELECTION_CHANGE_COMMAND`),va=M(`CLICK_COMMAND`),ya=M(`BEFORE_INPUT_COMMAND`),ba=M(`INPUT_COMMAND`),xa=M(`COMPOSITION_START_COMMAND`),Sa=M(`COMPOSITION_END_COMMAND`),Ca=M(`DELETE_CHARACTER_COMMAND`),wa=M(`INSERT_LINE_BREAK_COMMAND`),Ta=M(`INSERT_PARAGRAPH_COMMAND`),Ea=M(`CONTROLLED_TEXT_INSERTION_COMMAND`),Da=M(`PASTE_COMMAND`),Oa=M(`REMOVE_TEXT_COMMAND`),ka=M(`DELETE_WORD_COMMAND`),Aa=M(`DELETE_LINE_COMMAND`),ja=M(`FORMAT_TEXT_COMMAND`),Ma=M(`UNDO_COMMAND`),Na=M(`REDO_COMMAND`),Pa=M(`KEYDOWN_COMMAND`),Fa=M(`KEY_ARROW_RIGHT_COMMAND`),Ia=M(`MOVE_TO_END`),La=M(`KEY_ARROW_LEFT_COMMAND`),Ra=M(`MOVE_TO_START`),za=M(`KEY_ARROW_UP_COMMAND`),Ba=M(`KEY_ARROW_DOWN_COMMAND`),Va=M(`KEY_ENTER_COMMAND`),Ha=M(`KEY_SPACE_COMMAND`),Ua=M(`KEY_BACKSPACE_COMMAND`),Wa=M(`KEY_ESCAPE_COMMAND`),Ga=M(`KEY_DELETE_COMMAND`),Ka=M(`KEY_TAB_COMMAND`),qa=M(`DROP_COMMAND`),Ja=M(`DRAGSTART_COMMAND`),Ya=M(`DRAGOVER_COMMAND`),Xa=M(`DRAGEND_COMMAND`),Za=M(`COPY_COMMAND`),Qa=M(`CUT_COMMAND`),$a=M(`SELECT_ALL_COMMAND`),eo=M(`FOCUS_COMMAND`),to=M(`BLUR_COMMAND`),no=M(`KEY_MODIFIER_COMMAND`),ro=Object.freeze({}),io=[[`keydown`,function(e,t){ao=e.timeStamp,oo=e.key,!t.isComposing()&&B(t,Pa,e)}],[`pointerdown`,function(e,t){let n=e.target,r=e.pointerType;tu(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&hc(t,()=>{Gc(n)||(po=!0)})}],[`compositionstart`,function(e,t){B(t,xa,e)}],[`compositionend`,function(e,t){Lr?ho=!0:zr||!Vr&&!Wr?B(t,Sa,e):(go=!0,_o=e.data)}],[`input`,function(e,t){e.stopPropagation(),hc(t,()=>{t.dispatchCommand(ba,e)},{event:e}),co=null}],[`click`,function(e,t){hc(t,()=>{let n=F(),r=Ql(Wl(t)),i=Is();if(r){if(P(n)){let t=n.anchor,a=t.getNode();if(t.type===`element`&&t.offset===0&&n.isCollapsed()&&!Sc(a)&&ml().getChildrenSize()===1&&a.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&a!==n.focus.getNode()){let e=_u(a,e=>L(e)&&!e.isInline());L(e)&&e.select(0)}}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=r.anchorNode;(eu(n)||$c(n))&&gl(Fs(i,r,t,e))}}B(t,va,e)})}],[`cut`,ro],[`copy`,ro],[`dragstart`,ro],[`dragover`,ro],[`dragend`,ro],[`paste`,ro],[`focus`,ro],[`blur`,ro],[`drop`,ro]];Rr&&io.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||Lr&&Il(t)||n!==`insertCompositionText`&&B(t,ya,e)}(e,t)]);var ao=0,oo=null,so=0,co=null,lo=new WeakMap,uo=new WeakMap,fo=!1,po=!1,mo=!1,ho=!1,go=!1,_o=``,vo=null,yo=[0,``,0,`root`,0];function bo(e,t,n,r,i){let a=e.anchor,o=e.focus,s=a.getNode(),c=I(),l=Ql(Wl(c)),u=l===null?null:l.anchorNode,d=a.key,f=c.getElementByKey(d),p=n.length;return d!==o.key||!N(s)||(!i&&(!Rr||so<r+50)||s.isDirty()&&p<2||vl(n))&&a.offset!==o.offset&&!s.isComposing()||Qc(s)||s.isDirty()&&p>1||(i||!Rr)&&f!==null&&!s.isComposing()&&u!==tl(f)||l!==null&&t!==null&&(!t.collapsed||t.startContainer!==l.anchorNode||t.startOffset!==l.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=Zc(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(N(t)||L(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,s)}function xo(e,t){return $c(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function So(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=e;fo&&(fo=!1,xo(r,i)&&xo(a,o)&&!vo)||hc(t,()=>{if(!n)return void gl(null);if(!qc(t,r,a))return;let s=F();if(vo&&P(s)&&s.isCollapsed()){let e=s.anchor,t=vo.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(s=vo.clone(),gl(s))}if(vo=null,P(s)){let n=s.anchor,r=n.getNode();if(s.isCollapsed()){e.type===`Range`&&e.anchorNode===e.focusNode&&(s.dirty=!0);let i=Wl(t).event,a=i?i.timeStamp:performance.now(),[o,c,l,u,d]=yo,f=ml(),p=!1===t.isComposing()&&f.getTextContent()===``;if(a<d+200&&n.offset===l&&n.key===u)Co(s,o,c);else if(n.type===`text`)N(r)||j(141),wo(s,r);else if(n.type===`element`&&!p){L(r)||j(259);let e=n.getNode();e.isEmpty()?function(e,t){Co(e,t.getTextFormat(),t.getTextStyle())}(s,e):Co(s,s.format,``)}}else{let e=n.key,t=s.focus.key,r=s.getNodes(),a=r.length,c=s.isBackward(),l=c?o:i,u=c?i:o,d=c?t:e,f=c?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(N(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}s.format=m?p:0}}B(t,_a,void 0)})}function Co(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function wo(e,t){Co(e,t.getFormat(),t.getStyle())}function To(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function Eo(e){let t=e.inputType,n=To(e),r=I(),i=F();if(t===`deleteContentBackward`){if(i===null){let e=Is();if(!P(e))return!0;gl(e.clone())}if(P(i)){let t=i.anchor.key===i.focus.key;if(a=e.timeStamp,oo===`MediaLast`&&a<ao+30&&r.isComposing()&&t){if(ol(null),ao=0,setTimeout(()=>{hc(r,()=>{ol(null)})},30),P(i)){let e=i.anchor.getNode();e.markDirty(),N(e)||j(142),wo(i,e)}}else{ol(null),e.preventDefault();let n=i.anchor.getNode(),a=n.getTextContent(),o=n.canInsertTextAfter(),s=i.anchor.offset===0&&i.focus.offset===a.length,c=Ur&&t&&!s&&o;if(c&&i.isCollapsed()&&(c=!R(Fl(i.anchor,!0))),!c){B(r,Ca,!0);let e=F();Ur&&P(e)&&e.isCollapsed()&&(vo=e,setTimeout(()=>vo=null))}}return!0}}var a;if(!P(i))return!0;let o=e.data;co!==null&&Sl(!1,r,co),i.dirty&&co===null||!i.isCollapsed()||Sc(i.anchor.getNode())||n===null||i.applyDOMRange(n),co=null;let s=i.anchor,c=i.focus,l=s.getNode(),u=c.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
|
|
4
4
|
`)e.preventDefault(),B(r,wa,!1);else if(o===ti)e.preventDefault(),B(r,Ta,void 0);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),i.insertRawText(t)}else o!=null&&bo(i,n,o,e.timeStamp,!0)?(e.preventDefault(),B(r,Ea,o)):co=o;return so=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:B(r,Ea,e);break;case`insertFromComposition`:ol(null),B(r,Ea,e);break;case`insertLineBreak`:ol(null),B(r,wa,!1);break;case`insertParagraph`:ol(null),mo&&!zr?(mo=!1,B(r,wa,!1)):B(r,Ta,void 0);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:B(r,Da,e);break;case`deleteByComposition`:(function(e,t){return e!==t||L(e)||L(t)||!Zc(e)||!Zc(t)})(l,u)&&B(r,Oa,e);break;case`deleteByDrag`:case`deleteByCut`:B(r,Oa,e);break;case`deleteContent`:B(r,Ca,!1);break;case`deleteWordBackward`:B(r,ka,!0);break;case`deleteWordForward`:B(r,ka,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:B(r,Aa,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:B(r,Aa,!1);break;case`formatStrikeThrough`:B(r,ja,`strikethrough`);break;case`formatBold`:B(r,ja,`bold`);break;case`formatItalic`:B(r,ja,`italic`);break;case`formatUnderline`:B(r,ja,`underline`);break;case`historyUndo`:B(r,Ma,void 0);break;case`historyRedo`:B(r,Na,void 0)}return!0}function Do(e){if(eu(e.target)&&Gc(e.target))return!0;let t=I(),n=F(),r=e.data,i=To(e);if(r!=null&&P(n)&&bo(n,i,r,e.timeStamp,!1)){ho&&=(Ao(t,r),!1);let i=n.anchor.getNode(),a=Ql(Wl(t));if(a===null)return!0;let o=n.isBackward(),s=o?n.anchor.offset:n.focus.offset,c=o?n.focus.offset:n.anchor.offset;Rr&&!n.isCollapsed()&&N(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,s)+r+i.getTextContent().slice(s+c)===xl(a.anchorNode)||B(t,Ea,r);let l=r.length;Lr&&l>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(n.anchor.offset-=l),Ur&&t.isComposing()&&(ao=0,ol(null))}else Sl(!1,t,r===null?void 0:r),ho&&=(Ao(t,r||void 0),!1);return function(){ec(),yi(I())}(),!0}function Oo(e){let t=I(),n=F();if(P(n)&&!t.isComposing()){let r=n.anchor,i=n.anchor.getNode();ol(r.key),Bl(Uo),(e.timeStamp<ao+30||r.type===`element`||!n.isCollapsed()||i.getFormat()!==n.format||N(i)&&i.getStyle()!==n.style)&&B(t,Ea,ni)}return!0}function ko(e){return Ao(I(),e.data),Bl(Wo),!0}function Ao(e,t){let n=e._compositionKey;if(ol(null),n!==null&&t!=null){if(t===``){let t=cl(n),r=tl(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&N(t)){let n=Ql(Wl(e)),i=null,a=null;n!==null&&n.anchorNode===r&&(i=n.anchorOffset,a=n.focusOffset),Cl(t,r.nodeValue,i,a,!0)}return}if(t[t.length-1]===`
|