@onescience/onecode-web 1.14.50-202607291013 → 1.14.50-202607291116
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/assets/{account-system-CYzYnnVP.js → account-system-CL0Y8Njf.js} +1 -1
- package/assets/{alert-05-DLvn9IWC.js → alert-01-C7BWF2ld.js} +1 -1
- package/assets/{alert-01-D8cLi591.js → alert-02-BH9Rqah4.js} +1 -1
- package/assets/{alert-02-Cfh5jftu.js → alert-04-DnwxQUC4.js} +1 -1
- package/assets/{alert-04-CcHWEw2y.js → alert-05-BSP1PmTk.js} +1 -1
- package/assets/alert-06-DXFA5snL.js +1 -0
- package/assets/alert-07-C5JYNWZN.js +1 -0
- package/assets/alert-08-C-GIZM-F.js +1 -0
- package/assets/alert-10-uYhQMx8l.js +1 -0
- package/assets/{bip-bop-03-qUOO_s-x.js → bip-bop-03-CqelBRGR.js} +1 -1
- package/assets/{bip-bop-04-CsdaaFll.js → bip-bop-04-Qh2X9_2Z.js} +1 -1
- package/assets/{bip-bop-06-DT4vNpay.js → bip-bop-06-Mw6No9p7.js} +1 -1
- package/assets/{bip-bop-08-nSvctEtr.js → bip-bop-08-CkXPBTUL.js} +1 -1
- package/assets/bip-bop-09-PV1FEtQg.js +1 -0
- package/assets/{dialog-create-project-folder-DWSHfB8_.js → dialog-create-project-folder-C9qJ_6b8.js} +1 -1
- package/assets/{dialog-edit-project-C_5REfOf.js → dialog-edit-project-DBM5NSOn.js} +1 -1
- package/assets/{dialog-fork-CvfHGj6Q.js → dialog-fork-wBuTmbiy.js} +1 -1
- package/assets/{dialog-select-directory-D2g-mtQB.js → dialog-select-directory-CAa8OmrU.js} +1 -1
- package/assets/{dialog-select-file-Cns06Xzs.js → dialog-select-file-DjIAfdqA.js} +1 -1
- package/assets/{dialog-select-mcp-CMWLtM1s.js → dialog-select-mcp-w5DJVd3-.js} +1 -1
- package/assets/{dialog-select-model-lPuIWO7L.js → dialog-select-model-Bc2xcL-K.js} +2 -2
- package/assets/{dialog-select-server-BJhGGMax.js → dialog-select-server-G6eC2478.js} +1 -1
- package/assets/{dialog-terminal-unavailable-DytaDlaU.js → dialog-terminal-unavailable-Cjd_KkeA.js} +1 -1
- package/assets/{ghostty-web-DdhtKZ4B.js → ghostty-web-BEf80DUl.js} +1 -1
- package/assets/{index-BkVCHloq.js → index-CSNkL9jy.js} +148 -148
- package/assets/{index-BQUAxhhq.css → index-DwCMaEur.css} +1 -1
- package/assets/{nope-02-BJKnP-bT.js → nope-02-CIBO4LBX.js} +1 -1
- package/assets/{nope-05-B6XpRuR1.js → nope-05-zYSLarXA.js} +1 -1
- package/assets/{nope-08-CUFQD0r-.js → nope-08-CiLW3ds_.js} +1 -1
- package/assets/{nope-11-J_nwVgQp.js → nope-11-B1xcdAj-.js} +1 -1
- package/assets/nope-12-Kggqt_89.js +1 -0
- package/assets/{server-row-BvHpF32u.js → server-row-C2EK_XQj.js} +1 -1
- package/assets/{staplebops-03-B1v-Kc4l.js → staplebops-03-CRIcUvpv.js} +1 -1
- package/assets/{staplebops-04-D1jacXYZ.js → staplebops-04-BEbodiqf.js} +1 -1
- package/assets/{staplebops-06-CBod2gvV.js → staplebops-06-BYtSYC69.js} +1 -1
- package/assets/{staplebops-07-DyPVKhjl.js → staplebops-07-B2hbiOIn.js} +1 -1
- package/assets/{status-popover-body-DrubIUuE.js → status-popover-body-BrpnzLnz.js} +2 -2
- package/assets/{yup-01-Ck0DFt9M.js → yup-01-C-vjpUdM.js} +1 -1
- package/assets/{yup-03-CYLmMutU.js → yup-03-w9hAO3RE.js} +1 -1
- package/assets/{yup-04-DVMgpblQ.js → yup-04-tY2cmuoC.js} +1 -1
- package/assets/{yup-05-DCnoa77N.js → yup-05-CKkSkosn.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/assets/alert-06-BTiL-vtj.js +0 -1
- package/assets/alert-07-dy_9pMXn.js +0 -1
- package/assets/alert-08-BntiXgM2.js +0 -1
- package/assets/alert-10-PkxqcRxK.js +0 -1
- package/assets/bip-bop-09-BhDGMUpS.js +0 -1
- package/assets/nope-12-CRCPdKhQ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as U,a as J,b as K,c as C,o as ce,i as l,d as _,t as f,e as ue,S as y,m as Q,f as p,s as P,g as de,r as me,D as pe,h as ge,j as V,l as be,p as X,k as fe,n as B,q as he,v as G,w as $e}from"./index-BkVCHloq.js";var M=f("<p class=os-auth-error>"),ve=f('<form class=os-auth-form><label><span>账户 / 邮箱</span><input autocomplete=username placeholder=账户名或注册邮箱></label><label><span>密码</span><input autocomplete=current-password type=password placeholder=输入密码></label><button type=submit class="os-button os-button-primary os-auth-submit">'),we=f("<div class=os-auth-links><span>还没有账号?</span><a>创建账号</a><a>忘记密码?"),_e=f('<form class=os-auth-form><label><span>账户</span><input autocomplete=username placeholder="例如 researcher01"><small class=os-auth-hint>用作登录标识及个人工作区目录名称。长度 3–32 个字符,须以小写字母开头,仅可包含小写字母、数字、点(.)、下划线(_)与连字符(-)。</small></label><label><span>邮箱</span><input autocomplete=email inputmode=email placeholder=name@example.com><small class=os-auth-hint>用于账号找回与系统通知,亦可作为登录凭证。</small></label><label><span>密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"></label><label><span>确认密码</span><input autocomplete=new-password type=password placeholder=再次输入密码></label><button type=submit class="os-button os-button-primary os-auth-submit">'),xe=f("<div class=os-auth-links><span>已有账号?</span><a>去登录"),Se=f('<form class=os-auth-form><p class=os-account-success>密码找回功能完善中,入口已预留。当前暂不可自助重置,请联系管理员或稍后再试。</p><label><span>账号邮箱</span><input autocomplete=email inputmode=email placeholder=name@example.com disabled></label><button disabled type=submit class="os-button os-button-secondary os-auth-submit">获取重置码(暂不可用)'),Pe=f('<form class=os-auth-form><label><span>重置码</span><input autocomplete=one-time-code placeholder=输入一次性重置码 disabled></label><label><span>新密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"disabled></label><label><span>确认新密码</span><input autocomplete=new-password type=password placeholder=再次输入新密码 disabled></label><button disabled type=submit class="os-button os-button-primary os-auth-submit">重置密码(暂不可用)'),ye=f("<div class=os-auth-links><a>返回登录</a><a>创建账号"),Ce=f("<main class=os-account-page>"),ke=f("<section class=os-account-loading><strong>正在加载账号信息</strong><span>请稍候"),Ae=f('<section class=os-account-empty-state><strong></strong><span>登录后可以查看账号资料和开发空间。</span><a href=/login class="os-button os-button-primary">去登录'),De=f('<header class=os-account-header><div class=os-account-identity><div class=os-account-avatar></div><div><span class=os-account-kicker>账号中心</span><h1></h1><p></p></div></div><div class=os-account-actions><span class=os-account-status></span><a href=/code class="os-button os-button-secondary">进入科研开发</a><button type=button class="os-button os-button-danger">退出登录</button><button type=button class="os-button os-button-danger">'),Te=f("<section class=os-account-workspace-hero><div class=os-account-workspace-hero-copy><span class=os-account-kicker>默认项目</span><strong>default</strong><p></p></div><div class=os-account-workspace-hero-meta><code>"),Ee=f("<p class=os-account-success>"),Le=f('<section class=os-account-content-grid><section class=os-account-panel><div class=os-account-panel-head><strong>基本资料</strong><span class=os-account-session-expiry title="这是当前浏览器登录会话的有效期(约 14 天),不是账号本身到期。重新登录即可续期,账号与工作区数据不受影响。">登录会话 <!>失效</span></div><p class=os-account-session-expiry-note>提示:上方倒计时是登录会话有效期,重新登录即可续期;账号与工作区数据不会因此删除。</p><dl class=os-account-field-grid><div><dt>账户</dt><dd></dd></div><div><dt>邮箱</dt><dd></dd></div><div><dt>创建时间</dt><dd></dd></div><div><dt>默认入口</dt><dd>科研开发工作台</dd></div></dl></section><section class=os-account-panel><div class=os-account-panel-head><strong>修改密码</strong><span>本地账号</span></div><form class=os-account-password-form><label><span>当前密码</span><input autocomplete=current-password type=password placeholder=输入当前密码></label><label><span>新密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"></label><label><span>确认新密码</span><input autocomplete=new-password type=password placeholder=再次输入新密码></label><button type=submit class="os-button os-button-danger os-auth-submit">'),Me=f('<div class="flex flex-col gap-4 pl-6 pr-2.5 pb-3"><p class="text-14-regular text-text-strong"></p><div class="flex justify-end gap-2"><button type=button class="os-button os-button-secondary"></button><button type=button class="os-button os-button-danger">'),Fe=f("<main class=os-auth-page><section class=os-auth-shell><section class=os-auth-panel><a class=os-auth-brand href=/><img src=/favicon-v3.svg alt aria-hidden=true>");function Oe(){const r=U(),[e,a]=C({name:"",email:"",password:"",confirmPassword:"",submitting:!1,error:""}),i=()=>typeof e.lockedUntil=="number"&&e.lockedUntil>Date.now(),d=async s=>{if(s.preventDefault(),i()){a("error",`尝试次数过多,请在 ${We(e.lockedUntil-Date.now())} 后重试`);return}if(!e.email.trim()||!e.password){a("error","请输入账户/邮箱和密码");return}a({submitting:!0,error:"",lockedUntil:void 0});try{await V(await be({email:e.email.trim(),password:e.password}),r.storage),location.assign(X(location.search))}catch(n){const g=n instanceof Error&&"retryAfterMs"in n?Number(n.retryAfterMs):void 0;a({error:n instanceof Error?n.message:"登录失败,请稍后重试",submitting:!1,lockedUntil:typeof g=="number"&&g>0?Date.now()+g:void 0})}};return _(j,{mode:"login",get children(){return[(()=>{var s=ve(),n=s.firstChild,g=n.firstChild,h=g.nextSibling,b=n.nextSibling,c=b.firstChild,t=c.nextSibling,u=b.nextSibling;return s.addEventListener("submit",d),h.$$input=o=>a("email",o.currentTarget.value),t.$$input=o=>a("password",o.currentTarget.value),l(s,_(y,{get when(){return e.error},get children(){var o=M();return l(o,()=>e.error),o}}),u),l(u,(()=>{var o=Q(()=>!!e.submitting);return()=>o()?"正在登录...":i()?"已锁定,请稍后重试":"登录"})()),p(o=>{var $=e.submitting,x=e.submitting,w=e.submitting||i();return $!==o.e&&(h.disabled=o.e=$),x!==o.t&&(t.disabled=o.t=x),w!==o.a&&(u.disabled=o.a=w),o},{e:void 0,t:void 0,a:void 0}),p(()=>h.value=e.email),p(()=>t.value=e.password),s})(),(()=>{var s=we(),n=s.firstChild,g=n.nextSibling,h=g.nextSibling;return p(b=>{var c=`/register${location.search}`,t=`/forgot-password${location.search}`;return c!==b.e&&P(g,"href",b.e=c),t!==b.t&&P(h,"href",b.t=t),b},{e:void 0,t:void 0}),s})()]}})}function Be(){const r=U(),[e,a]=C({name:"",email:"",password:"",confirmPassword:"",submitting:!1,error:""}),i=async d=>{if(d.preventDefault(),!e.name.trim()||!e.email.trim()||!e.password){a("error","请输入账户、邮箱和密码");return}const s=Ne(e.name);if(s){a("error",s);return}if(e.password.length<8){a("error","密码至少需要 8 位");return}if(e.password!==e.confirmPassword){a("error","两次输入的密码不一致");return}a({submitting:!0,error:""});try{await V(await fe({name:e.name.trim().toLowerCase(),email:e.email.trim(),password:e.password}),r.storage),location.assign(X(location.search))}catch(n){a("error",n instanceof Error?n.message:"注册失败,请稍后重试"),a("submitting",!1)}};return _(j,{mode:"register",get children(){return[(()=>{var d=_e(),s=d.firstChild,n=s.firstChild,g=n.nextSibling,h=s.nextSibling,b=h.firstChild,c=b.nextSibling,t=h.nextSibling,u=t.firstChild,o=u.nextSibling,$=t.nextSibling,x=$.firstChild,w=x.nextSibling,S=$.nextSibling;return d.addEventListener("submit",i),g.$$input=m=>a("name",m.currentTarget.value),P(g,"spellcheck",!1),c.$$input=m=>a("email",m.currentTarget.value),o.$$input=m=>a("password",m.currentTarget.value),w.$$input=m=>a("confirmPassword",m.currentTarget.value),l(d,_(y,{get when(){return e.error},get children(){var m=M();return l(m,()=>e.error),m}}),S),l(S,()=>e.submitting?"正在创建...":"创建账号"),p(()=>S.disabled=e.submitting),p(()=>g.value=e.name),p(()=>c.value=e.email),p(()=>o.value=e.password),p(()=>w.value=e.confirmPassword),d})(),(()=>{var d=xe(),s=d.firstChild,n=s.nextSibling;return p(()=>P(n,"href",`/login${location.search}`)),d})()]}})}function Ge(){return _(j,{mode:"forgot-password",get children(){return[(()=>{var r=Se();return r.addEventListener("submit",e=>{e.preventDefault()}),r})(),(()=>{var r=Pe();return r.addEventListener("submit",e=>{e.preventDefault()}),r})(),(()=>{var r=ye(),e=r.firstChild,a=e.nextSibling;return p(i=>{var d=`/login${location.search}`,s=`/register${location.search}`;return d!==i.e&&P(e,"href",i.e=d),s!==i.t&&P(a,"href",i.t=s),i},{e:void 0,t:void 0}),r})()]}})}function He(){const r=U(),e=J(),a=K(),[i,d]=C({loading:!0,error:""}),[s,n]=C({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:""});ce(()=>{const c=de();if(!c){d({loading:!1,error:"当前未登录"});return}me(c).then(t=>d({session:t,loading:!1,error:""})).catch(t=>d({loading:!1,error:t instanceof Error?t.message:"会话已失效"}))});const g=()=>{B(r.storage).finally(()=>location.assign("/login"))},h=async()=>{try{await he(),G({variant:"success",icon:"circle-check",title:e.t("account.deleteAccount.toast.success")}),await B(r.storage),location.assign("/login")}catch(c){G({variant:"error",title:e.t("account.deleteAccount.toast.error"),description:c instanceof Error?c.message:"请稍后重试"})}},b=async(c,t)=>{if(c.preventDefault(),!s.currentPassword||!s.newPassword||!s.confirmPassword){n({error:"请输入当前密码和新密码",success:""});return}if(s.newPassword.length<8){n({error:"新密码至少需要 8 位",success:""});return}if(s.currentPassword===s.newPassword){n({error:"新密码不能与当前密码相同",success:""});return}if(s.newPassword!==s.confirmPassword){n({error:"两次输入的新密码不一致",success:""});return}n({submitting:!0,error:"",success:""});try{await $e({accountId:t.account.id,currentPassword:s.currentPassword,newPassword:s.newPassword}),n({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:"密码已更新,下次登录请使用新密码"})}catch(u){n({submitting:!1,error:u instanceof Error?u.message:"修改密码失败,请稍后重试",success:""})}};return(()=>{var c=Ce();return l(c,_(y,{get when(){return!i.loading},get fallback(){return ke()},get children(){return _(y,{get when(){return i.session},get fallback(){return(()=>{var t=Ae(),u=t.firstChild;return l(u,()=>i.error||"当前未登录"),t})()},children:t=>[(()=>{var u=De(),o=u.firstChild,$=o.firstChild,x=$.nextSibling,w=x.firstChild,S=w.nextSibling,m=S.nextSibling,F=o.nextSibling,k=F.firstChild,A=k.nextSibling,D=A.nextSibling,T=D.nextSibling;return l($,()=>je(t().account.name,t().account.email)),l(S,()=>t().account.name),l(m,()=>t().account.email),l(k,()=>ze(t().account.status)),D.$$click=g,T.$$click=()=>a.show(()=>_(Ue,{onConfirm:h})),l(T,()=>e.t("account.deleteAccount.button")),u})(),(()=>{var u=Te(),o=u.firstChild,$=o.firstChild,x=$.nextSibling,w=x.nextSibling,S=o.nextSibling,m=S.firstChild;return l(w,()=>e.t("account.defaultProject.description")),l(m,()=>H(t())||"未分配"),p(()=>P(m,"title",H(t()))),u})(),(()=>{var u=Le(),o=u.firstChild,$=o.firstChild,x=$.firstChild,w=x.nextSibling,S=w.firstChild,m=S.nextSibling;m.nextSibling;var F=$.nextSibling,k=F.nextSibling,A=k.firstChild,D=A.firstChild,T=D.nextSibling,z=A.nextSibling,Z=z.firstChild,ee=Z.nextSibling,te=z.nextSibling,re=te.firstChild,se=re.nextSibling,ne=o.nextSibling,ae=ne.firstChild,E=ae.nextSibling,I=E.firstChild,oe=I.firstChild,R=oe.nextSibling,N=I.nextSibling,le=N.firstChild,W=le.nextSibling,q=N.nextSibling,ie=q.firstChild,O=ie.nextSibling,L=q.nextSibling;return l(w,()=>Re(t().expiresAt),m),l(T,()=>t().account.name),l(ee,()=>t().account.email),l(se,()=>Ie(t().account.timeCreated)),E.addEventListener("submit",v=>b(v,t())),R.$$input=v=>n("currentPassword",v.currentTarget.value),W.$$input=v=>n("newPassword",v.currentTarget.value),O.$$input=v=>n("confirmPassword",v.currentTarget.value),l(E,_(y,{get when(){return s.error},get children(){var v=M();return l(v,()=>s.error),v}}),L),l(E,_(y,{get when(){return s.success},get children(){var v=Ee();return l(v,()=>s.success),v}}),L),l(L,()=>s.submitting?"正在更新...":"更新密码"),p(()=>L.disabled=s.submitting),p(()=>R.value=s.currentPassword),p(()=>W.value=s.newPassword),p(()=>O.value=s.confirmPassword),u})()]})}})),c})()}function Ue(r){const e=J(),a=K(),[i,d]=C({submitting:!1,error:""}),s=async()=>{d({submitting:!0,error:""});try{await r.onConfirm(),a.close()}catch(n){d({submitting:!1,error:n instanceof Error?n.message:e.t("account.deleteAccount.toast.error")})}};return _(pe,{get title(){return e.t("account.deleteAccount.title")},fit:!0,transition:!0,get children(){var n=Me(),g=n.firstChild,h=g.nextSibling,b=h.firstChild,c=b.nextSibling;return l(g,()=>e.t("account.deleteAccount.description")),l(n,_(y,{get when(){return i.error},get children(){var t=M();return l(t,()=>i.error),t}}),h),b.$$click=()=>a.close(),l(b,()=>e.t("common.cancel")),c.$$click=s,l(c,(()=>{var t=Q(()=>!!i.submitting);return()=>t()?"注销中...":e.t("account.deleteAccount.confirm")})()),p(t=>{var u=i.submitting,o=i.submitting;return u!==t.e&&(b.disabled=t.e=u),o!==t.t&&(c.disabled=t.t=o),t},{e:void 0,t:void 0}),n}})}function j(r){return(()=>{var e=Fe(),a=e.firstChild,i=a.firstChild;return i.firstChild,l(i,()=>r.children,null),p(()=>P(a,"data-mode",r.mode)),e})()}function je(r,e){return(r.trim()||e.trim()||"OS").slice(0,2).toUpperCase()}function ze(r){return r==="active"?"正常":r==="disabled"?"已停用":r==="pending"?"待激活":r||"未知"}function H(r){return ge(r)??""}function Ie(r){return r?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(Y(r))):"未记录"}function Re(r){const e=Math.ceil(Math.max(0,Y(r)-Date.now())/36e5);return e<=0?"已":e<24?`${e} 小时后`:`${Math.ceil(e/24)} 天后`}function Ne(r){const e=r.trim().toLowerCase();return e?/^[a-z][a-z0-9._-]{2,31}$/.test(e)?e.includes("..")||e.endsWith(".")||e.startsWith(".")?"账户名不能以点开头/结尾,也不能包含连续的点":"":"账户名须为 3–32 位,以小写字母开头,仅含小写字母、数字、点、下划线或连字符":"请填写账户名"}function We(r){const e=Math.max(1,Math.ceil(r/1e3));if(e<60)return`${e} 秒`;const a=Math.ceil(e/60);return a<60?`${a} 分钟`:"1 小时"}function Y(r){return r<1e10?r*1e3:r}ue(["input","click"]);export{He as AccountCenterPage,Ge as ForgotPasswordPage,Oe as LoginPage,Be as RegisterPage};
|
|
1
|
+
import{u as U,a as J,b as K,c as C,o as ce,i as l,d as _,t as f,e as ue,S as y,m as Q,f as p,s as P,g as de,r as me,D as pe,h as ge,j as V,l as be,p as X,k as fe,n as B,q as he,v as G,w as $e}from"./index-CSNkL9jy.js";var M=f("<p class=os-auth-error>"),ve=f('<form class=os-auth-form><label><span>账户 / 邮箱</span><input autocomplete=username placeholder=账户名或注册邮箱></label><label><span>密码</span><input autocomplete=current-password type=password placeholder=输入密码></label><button type=submit class="os-button os-button-primary os-auth-submit">'),we=f("<div class=os-auth-links><span>还没有账号?</span><a>创建账号</a><a>忘记密码?"),_e=f('<form class=os-auth-form><label><span>账户</span><input autocomplete=username placeholder="例如 researcher01"><small class=os-auth-hint>用作登录标识及个人工作区目录名称。长度 3–32 个字符,须以小写字母开头,仅可包含小写字母、数字、点(.)、下划线(_)与连字符(-)。</small></label><label><span>邮箱</span><input autocomplete=email inputmode=email placeholder=name@example.com><small class=os-auth-hint>用于账号找回与系统通知,亦可作为登录凭证。</small></label><label><span>密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"></label><label><span>确认密码</span><input autocomplete=new-password type=password placeholder=再次输入密码></label><button type=submit class="os-button os-button-primary os-auth-submit">'),xe=f("<div class=os-auth-links><span>已有账号?</span><a>去登录"),Se=f('<form class=os-auth-form><p class=os-account-success>密码找回功能完善中,入口已预留。当前暂不可自助重置,请联系管理员或稍后再试。</p><label><span>账号邮箱</span><input autocomplete=email inputmode=email placeholder=name@example.com disabled></label><button disabled type=submit class="os-button os-button-secondary os-auth-submit">获取重置码(暂不可用)'),Pe=f('<form class=os-auth-form><label><span>重置码</span><input autocomplete=one-time-code placeholder=输入一次性重置码 disabled></label><label><span>新密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"disabled></label><label><span>确认新密码</span><input autocomplete=new-password type=password placeholder=再次输入新密码 disabled></label><button disabled type=submit class="os-button os-button-primary os-auth-submit">重置密码(暂不可用)'),ye=f("<div class=os-auth-links><a>返回登录</a><a>创建账号"),Ce=f("<main class=os-account-page>"),ke=f("<section class=os-account-loading><strong>正在加载账号信息</strong><span>请稍候"),Ae=f('<section class=os-account-empty-state><strong></strong><span>登录后可以查看账号资料和开发空间。</span><a href=/login class="os-button os-button-primary">去登录'),De=f('<header class=os-account-header><div class=os-account-identity><div class=os-account-avatar></div><div><span class=os-account-kicker>账号中心</span><h1></h1><p></p></div></div><div class=os-account-actions><span class=os-account-status></span><a href=/code class="os-button os-button-secondary">进入科研开发</a><button type=button class="os-button os-button-danger">退出登录</button><button type=button class="os-button os-button-danger">'),Te=f("<section class=os-account-workspace-hero><div class=os-account-workspace-hero-copy><span class=os-account-kicker>默认项目</span><strong>default</strong><p></p></div><div class=os-account-workspace-hero-meta><code>"),Ee=f("<p class=os-account-success>"),Le=f('<section class=os-account-content-grid><section class=os-account-panel><div class=os-account-panel-head><strong>基本资料</strong><span class=os-account-session-expiry title="这是当前浏览器登录会话的有效期(约 14 天),不是账号本身到期。重新登录即可续期,账号与工作区数据不受影响。">登录会话 <!>失效</span></div><p class=os-account-session-expiry-note>提示:上方倒计时是登录会话有效期,重新登录即可续期;账号与工作区数据不会因此删除。</p><dl class=os-account-field-grid><div><dt>账户</dt><dd></dd></div><div><dt>邮箱</dt><dd></dd></div><div><dt>创建时间</dt><dd></dd></div><div><dt>默认入口</dt><dd>科研开发工作台</dd></div></dl></section><section class=os-account-panel><div class=os-account-panel-head><strong>修改密码</strong><span>本地账号</span></div><form class=os-account-password-form><label><span>当前密码</span><input autocomplete=current-password type=password placeholder=输入当前密码></label><label><span>新密码</span><input autocomplete=new-password type=password placeholder="至少 8 位"></label><label><span>确认新密码</span><input autocomplete=new-password type=password placeholder=再次输入新密码></label><button type=submit class="os-button os-button-danger os-auth-submit">'),Me=f('<div class="flex flex-col gap-4 pl-6 pr-2.5 pb-3"><p class="text-14-regular text-text-strong"></p><div class="flex justify-end gap-2"><button type=button class="os-button os-button-secondary"></button><button type=button class="os-button os-button-danger">'),Fe=f("<main class=os-auth-page><section class=os-auth-shell><section class=os-auth-panel><a class=os-auth-brand href=/><img src=/favicon-v3.svg alt aria-hidden=true>");function Oe(){const r=U(),[e,a]=C({name:"",email:"",password:"",confirmPassword:"",submitting:!1,error:""}),i=()=>typeof e.lockedUntil=="number"&&e.lockedUntil>Date.now(),d=async s=>{if(s.preventDefault(),i()){a("error",`尝试次数过多,请在 ${We(e.lockedUntil-Date.now())} 后重试`);return}if(!e.email.trim()||!e.password){a("error","请输入账户/邮箱和密码");return}a({submitting:!0,error:"",lockedUntil:void 0});try{await V(await be({email:e.email.trim(),password:e.password}),r.storage),location.assign(X(location.search))}catch(n){const g=n instanceof Error&&"retryAfterMs"in n?Number(n.retryAfterMs):void 0;a({error:n instanceof Error?n.message:"登录失败,请稍后重试",submitting:!1,lockedUntil:typeof g=="number"&&g>0?Date.now()+g:void 0})}};return _(j,{mode:"login",get children(){return[(()=>{var s=ve(),n=s.firstChild,g=n.firstChild,h=g.nextSibling,b=n.nextSibling,c=b.firstChild,t=c.nextSibling,u=b.nextSibling;return s.addEventListener("submit",d),h.$$input=o=>a("email",o.currentTarget.value),t.$$input=o=>a("password",o.currentTarget.value),l(s,_(y,{get when(){return e.error},get children(){var o=M();return l(o,()=>e.error),o}}),u),l(u,(()=>{var o=Q(()=>!!e.submitting);return()=>o()?"正在登录...":i()?"已锁定,请稍后重试":"登录"})()),p(o=>{var $=e.submitting,x=e.submitting,w=e.submitting||i();return $!==o.e&&(h.disabled=o.e=$),x!==o.t&&(t.disabled=o.t=x),w!==o.a&&(u.disabled=o.a=w),o},{e:void 0,t:void 0,a:void 0}),p(()=>h.value=e.email),p(()=>t.value=e.password),s})(),(()=>{var s=we(),n=s.firstChild,g=n.nextSibling,h=g.nextSibling;return p(b=>{var c=`/register${location.search}`,t=`/forgot-password${location.search}`;return c!==b.e&&P(g,"href",b.e=c),t!==b.t&&P(h,"href",b.t=t),b},{e:void 0,t:void 0}),s})()]}})}function Be(){const r=U(),[e,a]=C({name:"",email:"",password:"",confirmPassword:"",submitting:!1,error:""}),i=async d=>{if(d.preventDefault(),!e.name.trim()||!e.email.trim()||!e.password){a("error","请输入账户、邮箱和密码");return}const s=Ne(e.name);if(s){a("error",s);return}if(e.password.length<8){a("error","密码至少需要 8 位");return}if(e.password!==e.confirmPassword){a("error","两次输入的密码不一致");return}a({submitting:!0,error:""});try{await V(await fe({name:e.name.trim().toLowerCase(),email:e.email.trim(),password:e.password}),r.storage),location.assign(X(location.search))}catch(n){a("error",n instanceof Error?n.message:"注册失败,请稍后重试"),a("submitting",!1)}};return _(j,{mode:"register",get children(){return[(()=>{var d=_e(),s=d.firstChild,n=s.firstChild,g=n.nextSibling,h=s.nextSibling,b=h.firstChild,c=b.nextSibling,t=h.nextSibling,u=t.firstChild,o=u.nextSibling,$=t.nextSibling,x=$.firstChild,w=x.nextSibling,S=$.nextSibling;return d.addEventListener("submit",i),g.$$input=m=>a("name",m.currentTarget.value),P(g,"spellcheck",!1),c.$$input=m=>a("email",m.currentTarget.value),o.$$input=m=>a("password",m.currentTarget.value),w.$$input=m=>a("confirmPassword",m.currentTarget.value),l(d,_(y,{get when(){return e.error},get children(){var m=M();return l(m,()=>e.error),m}}),S),l(S,()=>e.submitting?"正在创建...":"创建账号"),p(()=>S.disabled=e.submitting),p(()=>g.value=e.name),p(()=>c.value=e.email),p(()=>o.value=e.password),p(()=>w.value=e.confirmPassword),d})(),(()=>{var d=xe(),s=d.firstChild,n=s.nextSibling;return p(()=>P(n,"href",`/login${location.search}`)),d})()]}})}function Ge(){return _(j,{mode:"forgot-password",get children(){return[(()=>{var r=Se();return r.addEventListener("submit",e=>{e.preventDefault()}),r})(),(()=>{var r=Pe();return r.addEventListener("submit",e=>{e.preventDefault()}),r})(),(()=>{var r=ye(),e=r.firstChild,a=e.nextSibling;return p(i=>{var d=`/login${location.search}`,s=`/register${location.search}`;return d!==i.e&&P(e,"href",i.e=d),s!==i.t&&P(a,"href",i.t=s),i},{e:void 0,t:void 0}),r})()]}})}function He(){const r=U(),e=J(),a=K(),[i,d]=C({loading:!0,error:""}),[s,n]=C({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:""});ce(()=>{const c=de();if(!c){d({loading:!1,error:"当前未登录"});return}me(c).then(t=>d({session:t,loading:!1,error:""})).catch(t=>d({loading:!1,error:t instanceof Error?t.message:"会话已失效"}))});const g=()=>{B(r.storage).finally(()=>location.assign("/login"))},h=async()=>{try{await he(),G({variant:"success",icon:"circle-check",title:e.t("account.deleteAccount.toast.success")}),await B(r.storage),location.assign("/login")}catch(c){G({variant:"error",title:e.t("account.deleteAccount.toast.error"),description:c instanceof Error?c.message:"请稍后重试"})}},b=async(c,t)=>{if(c.preventDefault(),!s.currentPassword||!s.newPassword||!s.confirmPassword){n({error:"请输入当前密码和新密码",success:""});return}if(s.newPassword.length<8){n({error:"新密码至少需要 8 位",success:""});return}if(s.currentPassword===s.newPassword){n({error:"新密码不能与当前密码相同",success:""});return}if(s.newPassword!==s.confirmPassword){n({error:"两次输入的新密码不一致",success:""});return}n({submitting:!0,error:"",success:""});try{await $e({accountId:t.account.id,currentPassword:s.currentPassword,newPassword:s.newPassword}),n({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:"密码已更新,下次登录请使用新密码"})}catch(u){n({submitting:!1,error:u instanceof Error?u.message:"修改密码失败,请稍后重试",success:""})}};return(()=>{var c=Ce();return l(c,_(y,{get when(){return!i.loading},get fallback(){return ke()},get children(){return _(y,{get when(){return i.session},get fallback(){return(()=>{var t=Ae(),u=t.firstChild;return l(u,()=>i.error||"当前未登录"),t})()},children:t=>[(()=>{var u=De(),o=u.firstChild,$=o.firstChild,x=$.nextSibling,w=x.firstChild,S=w.nextSibling,m=S.nextSibling,F=o.nextSibling,k=F.firstChild,A=k.nextSibling,D=A.nextSibling,T=D.nextSibling;return l($,()=>je(t().account.name,t().account.email)),l(S,()=>t().account.name),l(m,()=>t().account.email),l(k,()=>ze(t().account.status)),D.$$click=g,T.$$click=()=>a.show(()=>_(Ue,{onConfirm:h})),l(T,()=>e.t("account.deleteAccount.button")),u})(),(()=>{var u=Te(),o=u.firstChild,$=o.firstChild,x=$.nextSibling,w=x.nextSibling,S=o.nextSibling,m=S.firstChild;return l(w,()=>e.t("account.defaultProject.description")),l(m,()=>H(t())||"未分配"),p(()=>P(m,"title",H(t()))),u})(),(()=>{var u=Le(),o=u.firstChild,$=o.firstChild,x=$.firstChild,w=x.nextSibling,S=w.firstChild,m=S.nextSibling;m.nextSibling;var F=$.nextSibling,k=F.nextSibling,A=k.firstChild,D=A.firstChild,T=D.nextSibling,z=A.nextSibling,Z=z.firstChild,ee=Z.nextSibling,te=z.nextSibling,re=te.firstChild,se=re.nextSibling,ne=o.nextSibling,ae=ne.firstChild,E=ae.nextSibling,I=E.firstChild,oe=I.firstChild,R=oe.nextSibling,N=I.nextSibling,le=N.firstChild,W=le.nextSibling,q=N.nextSibling,ie=q.firstChild,O=ie.nextSibling,L=q.nextSibling;return l(w,()=>Re(t().expiresAt),m),l(T,()=>t().account.name),l(ee,()=>t().account.email),l(se,()=>Ie(t().account.timeCreated)),E.addEventListener("submit",v=>b(v,t())),R.$$input=v=>n("currentPassword",v.currentTarget.value),W.$$input=v=>n("newPassword",v.currentTarget.value),O.$$input=v=>n("confirmPassword",v.currentTarget.value),l(E,_(y,{get when(){return s.error},get children(){var v=M();return l(v,()=>s.error),v}}),L),l(E,_(y,{get when(){return s.success},get children(){var v=Ee();return l(v,()=>s.success),v}}),L),l(L,()=>s.submitting?"正在更新...":"更新密码"),p(()=>L.disabled=s.submitting),p(()=>R.value=s.currentPassword),p(()=>W.value=s.newPassword),p(()=>O.value=s.confirmPassword),u})()]})}})),c})()}function Ue(r){const e=J(),a=K(),[i,d]=C({submitting:!1,error:""}),s=async()=>{d({submitting:!0,error:""});try{await r.onConfirm(),a.close()}catch(n){d({submitting:!1,error:n instanceof Error?n.message:e.t("account.deleteAccount.toast.error")})}};return _(pe,{get title(){return e.t("account.deleteAccount.title")},fit:!0,transition:!0,get children(){var n=Me(),g=n.firstChild,h=g.nextSibling,b=h.firstChild,c=b.nextSibling;return l(g,()=>e.t("account.deleteAccount.description")),l(n,_(y,{get when(){return i.error},get children(){var t=M();return l(t,()=>i.error),t}}),h),b.$$click=()=>a.close(),l(b,()=>e.t("common.cancel")),c.$$click=s,l(c,(()=>{var t=Q(()=>!!i.submitting);return()=>t()?"注销中...":e.t("account.deleteAccount.confirm")})()),p(t=>{var u=i.submitting,o=i.submitting;return u!==t.e&&(b.disabled=t.e=u),o!==t.t&&(c.disabled=t.t=o),t},{e:void 0,t:void 0}),n}})}function j(r){return(()=>{var e=Fe(),a=e.firstChild,i=a.firstChild;return i.firstChild,l(i,()=>r.children,null),p(()=>P(a,"data-mode",r.mode)),e})()}function je(r,e){return(r.trim()||e.trim()||"OS").slice(0,2).toUpperCase()}function ze(r){return r==="active"?"正常":r==="disabled"?"已停用":r==="pending"?"待激活":r||"未知"}function H(r){return ge(r)??""}function Ie(r){return r?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(Y(r))):"未记录"}function Re(r){const e=Math.ceil(Math.max(0,Y(r)-Date.now())/36e5);return e<=0?"已":e<24?`${e} 小时后`:`${Math.ceil(e/24)} 天后`}function Ne(r){const e=r.trim().toLowerCase();return e?/^[a-z][a-z0-9._-]{2,31}$/.test(e)?e.includes("..")||e.endsWith(".")||e.startsWith(".")?"账户名不能以点开头/结尾,也不能包含连续的点":"":"账户名须为 3–32 位,以小写字母开头,仅含小写字母、数字、点、下划线或连字符":"请填写账户名"}function We(r){const e=Math.max(1,Math.ceil(r/1e3));if(e<60)return`${e} 秒`;const a=Math.ceil(e/60);return a<60?`${a} 分钟`:"1 小时"}function Y(r){return r<1e10?r*1e3:r}ue(["input","click"]);export{He as AccountCenterPage,Ge as ForgotPasswordPage,Oe as LoginPage,Be as RegisterPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/alert-01-BuOD_o_q.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/alert-02-CS75AsoP.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/alert-04-CaGsIGFP.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/alert-05-D2gbGoRH.aac";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/alert-06-GK5Tqy6u.aac";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/alert-07-0r0kiLGz.aac";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/alert-08-CZowNquU.aac";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/alert-10-Ck5hR7zH.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/bip-bop-03-DXp7Zb0f.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/bip-bop-04-CfVtpI7z.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/bip-bop-06-BuvNosjK.aac";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/bip-bop-08-DBf7Bwjz.aac";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202607291116/assets/bip-bop-09-CxEgoAHQ.aac";export{e as default};
|
package/assets/{dialog-create-project-folder-DWSHfB8_.js → dialog-create-project-folder-C9qJ_6b8.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as F,Y as P,Z as w,a as y,c as _,E as i,a4 as $,a5 as D,a6 as C,a7 as k,A as E,d as n,i as r,T as z,S as K,K as p,m as M,D as A,t as f}from"./index-
|
|
1
|
+
import{b as F,Y as P,Z as w,a as y,c as _,E as i,a4 as $,a5 as D,a6 as C,a7 as k,A as E,d as n,i as r,T as z,S as K,K as p,m as M,D as A,t as f}from"./index-CSNkL9jy.js";var G=f('<p class="text-12-regular text-text-critical-base">'),L=f('<form class="flex flex-col gap-6 p-6 pt-0"><div class="flex flex-col gap-4"><p class="text-12-regular text-text-weak"></p></div><div class="flex justify-end gap-2">');function B(h){const c=F(),x=P(),b=w(),t=y(),[l,v]=_({name:""}),u=i(()=>$(D())||b.data.path.project_data_root||"/data"),S=i(()=>{const e=C(l.name,u());return e?`${e}/`:`${u()}/`}),d=i(()=>!!k(l.name)),o=E(()=>({mutationFn:async()=>{const a=(await x.client.path.mkdir({name:l.name.trim()})).data?.path;if(!a)throw new Error("missing path");return a},onSuccess:e=>{h.onCreated(e),c.close()}}));function j(e){e.preventDefault(),!(o.isPending||!d())&&o.mutate()}return n(A,{get title(){return t.t("command.project.createFolder")},class:"w-full max-w-[480px] mx-auto",get children(){var e=L(),a=e.firstChild,m=a.firstChild,g=a.nextSibling;return e.addEventListener("submit",j),r(a,n(z,{autofocus:!0,type:"text",get label(){return t.t("dialog.project.createFolder.name")},get placeholder(){return t.t("dialog.project.createFolder.placeholder")},get value(){return l.name},onChange:s=>v("name",s)}),m),r(m,()=>t.t("dialog.project.createFolder.path",{path:S()})),r(a,n(K,{get when(){return o.isError},get children(){var s=G();return r(s,()=>t.t("dialog.project.createFolder.failed")),s}}),null),r(g,n(p,{type:"button",variant:"ghost",size:"large",onClick:()=>c.close(),get children(){return t.t("common.cancel")}}),null),r(g,n(p,{type:"submit",variant:"primary",size:"large",get disabled(){return o.isPending||!d()},get children(){return M(()=>!!o.isPending)()?t.t("common.confirming"):t.t("common.confirm")}}),null),e}})}export{B as DialogCreateProjectFolder};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as te,Y as re,Z as ae,a as ie,E as F,_ as oe,c as ne,A as le,d as c,i,T as P,S as I,f as $,s as j,$ as R,a0 as K,a1 as T,a2 as se,H as M,V as ce,a3 as de,O as G,K as N,m as ue,D as ve,t as p,e as ge}from"./index-
|
|
1
|
+
import{b as te,Y as re,Z as ae,a as ie,E as F,_ as oe,c as ne,A as le,d as c,i,T as P,S as I,f as $,s as j,$ as R,a0 as K,a1 as T,a2 as se,H as M,V as ce,a3 as de,O as G,K as N,m as ue,D as ve,t as p,e as ge}from"./index-CSNkL9jy.js";var fe=p('<div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5">'),me=p('<form class="flex flex-col gap-6 p-6 pt-0"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-3 items-start"><div class=relative><div class="relative size-16 rounded-md transition-colors cursor-pointer"></div><div class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"></div><div class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"></div></div><input id=icon-upload type=file accept=image/* class=hidden><div class="flex flex-col gap-1.5 text-12-regular text-text-weak self-center"><span></span><span></span></div></div></div></div><div class="flex justify-end gap-2">'),pe=p('<div class="size-full flex items-center justify-center">'),be=p('<img class="size-full object-cover">'),xe=p("<button type=button>");const he=["pink","mint","orange","purple","cyan","lime"];function we(o){const w=te(),V=re(),_=ae(),n=ie(),y=F(()=>oe(o.project.worktree)),O=F(()=>o.project.name||y()),[e,d]=ne({name:O(),color:o.project.icon?.color,iconOverride:o.project.icon?.override,startup:o.project.commands?.start??"",dragOver:!1,iconHover:!1});let L;function z(r){if(!r.type.startsWith("image/"))return;const a=new FileReader;a.onload=f=>{d("iconOverride",f.target?.result),d("iconHover",!1)},a.readAsDataURL(r)}function Y(r){r.preventDefault(),d("dragOver",!1);const a=r.dataTransfer?.files[0];a&&z(a)}function B(r){r.preventDefault(),d("dragOver",!0)}function U(){d("dragOver",!1)}function W(r){const f=r.target.files?.[0];f&&z(f)}function Z(){d("iconOverride","")}const b=le(()=>({mutationFn:async()=>{const r=e.name.trim()===y()?"":e.name.trim(),a=e.startup.trim();if(o.project.id&&o.project.id!=="global"){await V.client.project.update({projectID:o.project.id,directory:o.project.worktree,name:r,icon:{color:e.color||"",override:e.iconOverride||""},commands:{start:a}}),_.project.icon(o.project.worktree,e.iconOverride||void 0),w.close();return}_.project.meta(o.project.worktree,{name:r,icon:{color:e.color||void 0,override:e.iconOverride||void 0},commands:{start:a||void 0}}),w.close()}}));function q(r){r.preventDefault(),!b.isPending&&b.mutate()}return c(ve,{get title(){return n.t("dialog.project.edit.title")},class:"w-full max-w-[480px] mx-auto",get children(){var r=me(),a=r.firstChild,f=a.firstChild,C=f.firstChild,J=C.nextSibling,x=J.firstChild,m=x.firstChild,h=m.nextSibling,k=h.nextSibling,S=x.nextSibling,Q=S.nextSibling,D=Q.firstChild,X=D.nextSibling,E=a.nextSibling;return r.addEventListener("submit",q),i(a,c(P,{autofocus:!0,type:"text",get label(){return n.t("dialog.project.edit.name")},get placeholder(){return y()},get value(){return e.name},onChange:t=>d("name",t)}),f),i(C,()=>n.t("dialog.project.edit.icon")),x.addEventListener("mouseleave",()=>d("iconHover",!1)),x.addEventListener("mouseenter",()=>d("iconHover",!0)),m.$$click=()=>{e.iconOverride&&e.iconHover?Z():L?.click()},m.addEventListener("dragleave",U),m.addEventListener("dragover",B),m.addEventListener("drop",Y),i(m,c(I,{get when(){return se(o.project.id,{color:e.color,url:o.project.icon?.url,override:e.iconOverride})},get fallback(){return(()=>{var t=pe();return i(t,c(R,K({get fallback(){return e.name||O()}},()=>T(e.color),{class:"size-full text-[32px]"}))),t})()},children:t=>(()=>{var g=be();return $(u=>{var l=t(),s=n.t("dialog.project.edit.icon.alt");return l!==u.e&&j(g,"src",u.e=l),s!==u.t&&j(g,"alt",u.t=s),u},{e:void 0,t:void 0}),g})()})),i(h,c(M,{name:"cloud-upload",size:"large",class:"text-icon-on-interactive-base drop-shadow-sm"})),i(k,c(M,{name:"trash",size:"large",class:"text-icon-on-interactive-base drop-shadow-sm"})),S.addEventListener("change",W),ce(t=>{L=t},S),i(D,()=>n.t("dialog.project.edit.icon.hint")),i(X,()=>n.t("dialog.project.edit.icon.recommended")),i(a,c(I,{get when(){return!e.iconOverride},get children(){var t=fe(),g=t.firstChild,u=g.nextSibling;return i(g,()=>n.t("dialog.project.edit.color")),i(u,c(de,{each:he,children:l=>(()=>{var s=xe();return s.$$click=()=>{e.color===l&&!o.project.icon?.url||d("color",e.color===l?void 0:l)},i(s,c(R,K({get fallback(){return e.name||O()}},()=>T(l),{class:"size-full rounded"}))),$(v=>{var H=n.t("dialog.project.edit.color.select",{color:l}),A=e.color===l,ee={"flex items-center justify-center size-10 p-0.5 rounded-lg overflow-hidden transition-colors cursor-default":!0,"bg-transparent border-2 border-icon-strong-base hover:bg-surface-base-hover":e.color===l,"bg-transparent border border-transparent hover:bg-surface-base-hover hover:border-border-weak-base":e.color!==l};return H!==v.e&&j(s,"aria-label",v.e=H),A!==v.t&&j(s,"aria-pressed",v.t=A),v.a=G(s,ee,v.a),v},{e:void 0,t:void 0,a:void 0}),s})()})),t}}),null),i(a,c(P,{multiline:!0,get label(){return n.t("dialog.project.edit.worktree.startup")},get description(){return n.t("dialog.project.edit.worktree.startup.description")},get placeholder(){return n.t("dialog.project.edit.worktree.startup.placeholder")},get value(){return e.startup},onChange:t=>d("startup",t),spellcheck:!1,class:"max-h-14 w-full overflow-y-auto font-mono text-xs"}),null),i(E,c(N,{type:"button",variant:"ghost",size:"large",onClick:()=>w.close(),get children(){return n.t("common.cancel")}}),null),i(E,c(N,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return ue(()=>!!b.isPending)()?n.t("common.saving"):n.t("common.save")}}),null),$(t=>{var g={"border-text-interactive-base bg-surface-info-base/20":e.dragOver,"border-border-base hover:border-border-strong":!e.dragOver,"overflow-hidden":!!e.iconOverride},u=!!(e.iconHover&&!e.iconOverride),l=!(e.iconHover&&!e.iconOverride),s=!!(e.iconHover&&e.iconOverride),v=!(e.iconHover&&e.iconOverride);return t.e=G(m,g,t.e),u!==t.t&&h.classList.toggle("opacity-100",t.t=u),l!==t.a&&h.classList.toggle("opacity-0",t.a=l),s!==t.o&&k.classList.toggle("opacity-100",t.o=s),v!==t.i&&k.classList.toggle("opacity-0",t.i=v),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r}})}ge(["click"]);export{we as DialogEditProject};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aH as D,al as S,x as k,aA as P,aB as _,aI as w,b as F,a as L,E as I,d,L as $,i as u,D as b,aJ as E,at as T,v as g,as as q,t as C}from"./index-
|
|
1
|
+
import{aH as D,al as S,x as k,aA as P,aB as _,aI as w,b as F,a as L,E as I,d,L as $,i as u,D as b,aJ as E,at as T,v as g,as as q,t as C}from"./index-CSNkL9jy.js";var H=C('<div class="w-full flex items-center gap-2"><span class="truncate flex-1 min-w-0 text-left font-normal"></span><span class="text-text-weak shrink-0 font-normal">');function K(i){return i.toLocaleTimeString(void 0,{timeStyle:"short"})}const N=()=>{const i=D(),p=S(),f=k(),c=P(),l=_(),h=w(),x=F(),n=L(),y=I(()=>{const t=i.id;if(!t)return[];const a=c.data.message[t]??[],o=[];for(const s of a){if(s.role!=="user")continue;const e=(c.data.part[s.id]??[]).find(r=>r.type==="text"&&!r.synthetic&&!r.ignored);e&&o.push({id:s.id,text:e.text.replace(/\n/g," ").slice(0,200),time:K(new Date(s.time.created))})}return o.reverse()}),v=t=>{if(!t)return;const a=i.id;if(!a)return;const o=c.data.part[t.id]??[],s=E(o,{directory:l.directory,attachmentName:n.t("common.attachment")}),m=T(l.directory);l.client.session.fork({sessionID:a,messageID:t.id}).then(e=>{if(!e.data){g({title:n.t("common.requestFailed")});return}x.close(),h.set(s,void 0,{dir:m,id:e.data.id}),f(q(p.pathname,m,e.data.id))}).catch(e=>{const r=e instanceof Error?e.message:String(e);g({title:n.t("common.requestFailed"),description:r})})};return d(b,{get title(){return n.t("command.session.fork")},get children(){return d($,{class:"flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0",get search(){return{placeholder:n.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return n.t("dialog.fork.empty")},key:t=>t.id,items:y,filterKeys:["text"],onSelect:v,children:t=>(()=>{var a=H(),o=a.firstChild,s=o.nextSibling;return u(o,()=>t.text),u(s,()=>t.time),a})()})}})};export{N as DialogFork};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a8 as Y,Z as N,Y as Q,a9 as U,b as tt,a as et,u as rt,y as nt,P as st,E as P,M as ot,aa as at,a4 as it,a5 as Z,ab as z,_ as M,d as W,S as ct,i as _,K as lt,L as ut,ac as K,ad as ft,D as ht,t as I,ae as dt,af as O,ag as pt,ah as mt}from"./index-
|
|
1
|
+
import{a8 as Y,Z as N,Y as Q,a9 as U,b as tt,a as et,u as rt,y as nt,P as st,E as P,M as ot,aa as at,a4 as it,a5 as Z,ab as z,_ as M,d as W,S as ct,i as _,K as lt,L as ut,ac as K,ad as ft,D as ht,t as I,ae as dt,af as O,ag as pt,ah as mt}from"./index-CSNkL9jy.js";const wt=8;async function J(e,t,o,n){const m=await e(t);return o?Y.go(o,m,{key:"name",limit:n}).map(c=>c.obj.absolute):m.slice(0,n).map(c=>c.absolute)}async function yt(e,t,o,n){const m=n?.limit,c=n?.maxDepth??wt;if(!o)return J(e,t,"",m);const b=[],k=new Set;let f=[t];for(let a=0;a<c&&f.length>0&&b.length<m;a++){const i=[];for(const h of f){const w=await e(h);for(const u of w)if(!k.has(u.absolute)){if(k.add(u.absolute),Y.single(o,u.name)&&(b.push(u.absolute),b.length>=m))return b;i.push(u.absolute)}}f=i}return b}var gt=I('<div class="px-4 pb-3">'),vt=I('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-strong whitespace-nowrap">~</span><span class="text-text-weak whitespace-nowrap">/'),bt=I('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap"></span><span class="text-text-weak whitespace-nowrap">/');function T(e){return((e??"").split(/\r?\n/)[0]??"").replace(/[\u0000-\u001F\u007F]/g,"").trim()}function xt(e){const t=e.replaceAll("\\","/");return t.startsWith("//")&&!t.startsWith("///")?"//"+t.slice(2).replace(/\/+/g,"/"):t.replace(/\/+/g,"/")}function R(e){const t=xt(e);return/^[A-Za-z]:$/.test(t)?t+"/":t}function p(e){const t=R(e);return t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t)?t:t.replace(/\/+$/,"")}function kt(e,t){const o=p(e??""),n=p(t).replace(/^\/+/,"");return o?n?o.endsWith("/")?o+n:o+"/"+n:o:n}function E(e){const t=R(e);return t.startsWith("//")?"//":t.startsWith("/")?"/":/^[A-Za-z]:\//.test(t)?t.slice(0,3):""}function Pt(e){const t=p(e);if(t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t))return t;const o=t.lastIndexOf("/");return o<=0?"/":o===2&&/^[A-Za-z]:/.test(t)?t.slice(0,3):t.slice(0,o)}function Rt(e){const t=R(e.trim());return t?t.startsWith("~")?"tilde":E(t)?"absolute":"relative":"relative"}function V(e,t){const o=p(e);if(!t)return"";const n=p(t),m=o.toLowerCase(),c=n.toLowerCase();return m===c?"~":m.startsWith(c+"/")?"~"+o.slice(n.length):""}function G(e,t,o){const n=p(e);return Rt(t)==="absolute"?n:V(n,o)||n}function H(e,t,o){const n=p(e),m=V(n,t),c=k=>k?k.endsWith("/")?k:k+"/":"",b=Array.from(new Set([n,c(n),m,c(m),M(n)].filter(Boolean))).join(`
|
|
2
2
|
`);return{absolute:n,search:b,group:o}}function Dt(e){const t=new Set;return e.filter(o=>t.has(o.absolute)?!1:(t.add(o.absolute),!0))}function q(e,t){const o=O(t,t),n=O(e,t);return n===o?{directory:o,path:""}:{directory:o,path:n.slice(o.length+1)}}function $t(e){const t=new Map;let o=0;const n=f=>O(f,e.root()),m=f=>{const a=e.start();if(!a)return;const i=e.root(),h=R(f);if(!h)return{directory:n(p(a)),path:""};const w=e.home();if(h==="~")return{directory:n(p(w||a)),path:""};if(h.startsWith("~/")){const y=kt(w||a,h.slice(2));return z(y,i)?q(y,i):{directory:n(p(a)),path:""}}if(E(h)){const y=p(h);return z(y,i)?q(y,i):{directory:n(p(a)),path:""}}return{directory:n(p(a)),path:h}},c=async f=>{const a=n(p(f)),i=t.get(a);if(i)return i;const h=pt(e.apiRoot(),a);if(h===void 0&&p(a).toLowerCase()!==p(e.apiRoot()).toLowerCase())return t.set(a,Promise.resolve([])),[];const w=mt(e.sdk,h??"",{fetch:e.fetch,headers:e.headers?.()}).then(u=>u.filter(y=>!y.name.startsWith(".")).filter(y=>z(y.absolute,e.root())).map(y=>({name:y.name,absolute:p(R(y.absolute))})));return t.set(a,w),w},b=async(f,a,i)=>J(c,n(f),a,i),k=async(f,a,i)=>yt(c,n(f),a,{limit:i});return async f=>{const a=++o,i=()=>a===o,h=T(f),w=m(h);if(!w)return[];const u=R(h),y=u.startsWith("~")||!!E(u)||u.includes("/"),D=R(w.path);if(!y){const s=D?await k(w.directory,D,50):await b(w.directory,"",50);return i()?s.slice(0,50):[]}const $=u.endsWith("/"),S=D.replace(/^\/+/,"").replace(/\/+$/,"").split("/").filter(s=>s&&s!=="."),F=12,L=4,j=async(s,v)=>{let d=v;for(const A of s){if(!i())return[];if(A===".."){d=d.map(B=>n(Pt(B)));continue}const X=(await Promise.all(d.map(B=>b(B,A,L)))).flat();if(!i())return[];if(d=Array.from(new Set(X)).slice(0,F),d.length===0)return[]}return d},C=[w.directory];if($){const s=await j(S,C);if(s.length===0)return[];const v=(await Promise.all(s.map(d=>b(d,"",50)))).flat();return i()?Array.from(new Set(v)).slice(0,50):[]}const r=S.slice(0,-1),l=S[S.length-1]??"",g=await j(r,C);if(g.length===0)return[];const x=(await Promise.all(g.map(s=>b(s,l,50)))).flat();return i()?Array.from(new Set(x)).slice(0,50):[]}}function Wt(e){const t=N(),o=Q(),n=U(),m=tt(),c=et(),b=rt(),k=nt(),[f,a]=st("");let i;const h=P(()=>!(t.data.path.home||t.data.path.directory)),[w]=ot(()=>h()?!0:void 0,async()=>o.client.path.get().then(r=>r.data).catch(()=>{}),{initialValue:void 0}),u=P(()=>t.data.path.home||w()?.home||""),y=P(()=>{const r=t.data.path.project_data_root?t.data.path:w();return at(r)}),D=P(()=>it(Z())),$=P(()=>{const r=D();return r||y()}),S=P(()=>$()),F=$t({sdk:o,home:u,start:S,root:$,apiRoot:$,fetch:b.fetch,headers:()=>{if(Z())return;const r=k.current?.http;if(r?.password)return{Authorization:`Basic ${dt({username:r.username,password:r.password})}`}}}),L=P(()=>{const r=$(),l=D(),g=n.projects.list().filter(s=>z(s.worktree,r)).filter(s=>!l||s.worktree!==l),x=new Map(t.data.project.map(s=>[s.worktree,s]));return g.map((s,v)=>({project:s,at:x.get(s.worktree)?.time?.updated??x.get(s.worktree)?.time?.created??0,index:v})).sort((s,v)=>v.at-s.at||s.index-v.index).slice(0,5).map(({project:s})=>{const v=x.get(s.worktree),d=H(s.worktree,u(),"recent"),A=s.name||v?.name||M(s.worktree);return{...d,search:`${d.search}
|
|
3
3
|
${A}`}})}),j=async r=>{const l=T(r),g=await F(l),x=l.endsWith("/"),s=g.map(v=>{const d=H(v,u(),"folders");return x?{...d,search:`${d.search}
|
|
4
4
|
${l}`}:d});return Dt([...L(),...s])};function C(r){e.onSelect(e.multiple?[r]:r),m.close()}return W(ht,{get title(){return e.title??c.t("command.project.open")},get children(){return[W(ct,{get when(){return e.onCreateFolder},children:r=>(()=>{var l=gt();return _(l,W(lt,{size:"normal",variant:"ghost",icon:"folder-add-left",class:"w-full justify-start",onClick:()=>r()(),get children(){return c.t("command.project.createFolder")}})),l})()}),W(ut,{get search(){return{placeholder:c.t("dialog.directory.search.placeholder"),autofocus:!0}},get emptyMessage(){return c.t("dialog.directory.empty")},get loadingMessage(){return c.t("common.loading")},items:j,key:r=>r.absolute,filterKeys:["search"],groupBy:r=>r.group,sortGroupsBy:(r,l)=>r.category===l.category?0:r.category==="recent"?-1:1,groupHeader:r=>r.category==="recent"?c.t("home.recentProjects"):c.t("command.project.open"),ref:r=>i=r,onFilter:r=>a(T(r)),onKeyEvent:(r,l)=>{if(r.key!=="Tab"||r.shiftKey||!l)return;r.preventDefault(),r.stopPropagation();const g=G(l.absolute,f(),u());i?.setFilter(g.endsWith("/")?g:g+"/")},onSelect:r=>{r&&C(r.absolute)},children:r=>{const l=G(r.absolute,f(),u());return l==="~"?(()=>{var g=vt(),x=g.firstChild,s=x.firstChild;return _(x,W(K,{get node(){return{path:r.absolute,type:"directory"}},class:"shrink-0 size-4"}),s),g})():(()=>{var g=bt(),x=g.firstChild,s=x.firstChild,v=s.firstChild,d=v.nextSibling;return _(x,W(K,{get node(){return{path:r.absolute,type:"directory"}},class:"shrink-0 size-4"}),s),_(v,()=>ft(l)),_(d,()=>M(l)),g})()}})]}})}export{Wt as DialogSelectDirectory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as f,f as T,O as U,t as $,aj as V,a as X,a9 as ee,ak as te,b as ne,al as se,x as ae,Y as re,Z as oe,am as ie,P as ce,E as b,an as le,G as de,d as w,L as ue,ao as fe,ap as P,S as C,aq as ge,H as he,ac as pe,ad as me,_ as K,D as we,ar as ye,as as ve,at as be}from"./index-
|
|
1
|
+
import{i as f,f as T,O as U,t as $,aj as V,a as X,a9 as ee,ak as te,b as ne,al as se,x as ae,Y as re,Z as oe,am as ie,P as ce,E as b,an as le,G as de,d as w,L as ue,ao as fe,ap as P,S as C,aq as ge,H as he,ac as pe,ad as me,_ as K,D as we,ar as ye,as as ve,at as be}from"./index-CSNkL9jy.js";var xe=$("<span data-component=keybind>");function ke(t){return(()=>{var n=xe();return f(n,()=>t.children),T(r=>U(n,{...t.classList,[t.class??""]:!!t.class},r)),n})()}function $e(t,n){const r=Math.floor(Math.max(0,t)/1e3),l=Math.floor(r/60),s=Math.floor(l/60),d=Math.floor(s/24);return r<60?n("common.time.justNow"):l<60?n("common.time.minutesAgo.short",{count:l}):s<24?n("common.time.hoursAgo.short",{count:s}):n("common.time.daysAgo.short",{count:d})}function Se(t,n){return $e(Date.now()-new Date(t).getTime(),n)}var q=$('<span class="text-14-regular text-text-weak truncate">'),_e=$('<div class="w-full flex items-center justify-between gap-4"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong whitespace-nowrap">'),De=$('<span class="text-12-regular text-text-weak whitespace-nowrap ml-2">'),Me=$('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong truncate">'),Ce=$('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap">');const L=5,Fe=["session.new","workspace.new","session.previous","session.next","terminal.toggle","review.toggle"],A=t=>{const n=new Set,r=[];for(const l of t)n.has(l.id)||(n.add(l.id),r.push(l));return r},N=(t,n)=>({id:"command:"+t.id,type:"command",title:t.title,description:t.description,keybind:t.keybind,category:n,option:t}),F=(t,n)=>({id:"file:"+t,type:"file",title:t,category:n,path:t}),Ee=(t,n)=>({id:`session:${t.directory}:${t.id}`,type:"session",title:t.title,description:t.description,category:n,directory:t.directory,sessionID:t.id,archived:t.archived,updated:t.updated});function Te(t){const n=b(()=>t.filesOnly()?[]:t.command.options.filter(s=>!s.disabled&&!s.hidden&&!s.id.startsWith("suggested.")&&s.id!=="file.open")),r=b(()=>{const s=t.language.t("palette.group.commands");return n().map(d=>N(d,s))}),l=b(()=>{const s=n(),d=new Map(Fe.map((o,c)=>[o,c])),y=s.filter(o=>d.has(o.id)),i=y.length?y:s.slice(0,L),h=y.length?[...i].sort((o,c)=>(d.get(o.id)??0)-(d.get(c.id)??0)):i,v=t.language.t("palette.group.commands");return h.map(o=>N(o,v))});return{allowed:n,list:r,picks:l}}function Le(t){const n=ye({tabs:t.tabs,pathFromTab:t.file.pathFromTab,normalizeTab:s=>s.startsWith("file://")?t.file.tab(s):s}),r=b(()=>{const s=n.openedTabs(),d=n.activeFileTab(),y=d?[d,...s.filter(o=>o!==d)]:s,i=new Set,h=t.language.t("palette.group.files"),v=[];for(const o of y){const c=t.file.pathFromTab(o);c&&(i.has(c)||(i.add(c),v.push(F(c,h))))}return v.slice(0,L)}),l=b(()=>{const s=t.language.t("palette.group.files");return t.file.tree.children("").filter(i=>i.type==="file").map(i=>i.path).sort((i,h)=>i.localeCompare(h)).slice(0,L).map(i=>F(i,s))});return{recent:r,root:l}}function Ie(t){const n={token:0,inflight:void 0,cached:void 0};return{sessions:l=>{if(!l.trim())return n.token+=1,n.inflight=void 0,n.cached=void 0,[];if(n.cached)return n.cached;if(n.inflight)return n.inflight;const d=n.token,y=t.workspaces();return y.length===0?[]:(n.inflight=Promise.all(y.map(i=>{const h=t.label(i);return t.globalSDK.client.session.list({directory:i,roots:!0}).then(v=>(v.data??[]).filter(o=>!!o?.id).map(o=>({id:o.id,title:o.title??t.language.t("command.session.new"),description:h,directory:i,archived:o.time?.archived,updated:o.time?.updated}))).catch(()=>[])})).then(i=>{if(n.token!==d)return[];const h=new Set,v=t.language.t("command.category.session"),o=i.flat().filter(c=>{const S=`${c.directory}:${c.id}`;return h.has(S)?!1:(h.add(S),!0)}).map(c=>Ee(c,v));return n.cached=o,o}).catch(()=>[]).finally(()=>{n.inflight=void 0}),n.inflight)}}}function Oe(t){const n=V(),r=X(),l=ee(),s=te(),d=ne(),y=se(),i=ae(),h=re(),v=oe(),{params:o,tabs:c,view:S}=ie(),D=()=>t.mode==="files",k={cleanup:void 0,committed:!1},[G,H]=ce(!1),I=Te({filesOnly:D,command:n,language:r}),_=Le({file:s,tabs:c,language:r}),j=b(()=>le(o.dir)??""),O=b(()=>{const e=j();if(e)return l.projects.list().find(a=>a.worktree===e||a.sandboxes?.includes(e))}),R=b(()=>{const e=j(),a=O();if(!a)return e?[e]:[];const u=[a.worktree,...a.sandboxes??[]];return e&&!u.includes(e)?[...u,e]:u}),z=b(()=>v.data.path.home),W=e=>{const a=O(),u=a&&e===a.worktree?r.t("workspace.type.local"):r.t("workspace.type.sandbox"),[p]=v.child(e,{bootstrap:!1}),g=z(),m=g?e.replace(g,"~"):e,x=p.vcs?.branch??K(e);return`${u} : ${x||m}`},{sessions:Y}=Ie({workspaces:R,label:W,globalSDK:h,language:r}),B=async e=>{const a=e.trim();if(H(a.length>0),!a&&D()){const x=s.tree.state("")?.loaded,E=x?Promise.resolve():s.tree.list(""),M=A([..._.recent(),..._.root()]);return x||M.length>0?M:(await E,A([..._.recent(),..._.root()]))}if(!a)return[...I.picks(),..._.recent()];if(D()){const x=await s.searchFiles(a),E=r.t("palette.group.files");return x.map(M=>F(M,E))}const[u,p]=await Promise.all([s.searchFiles(a),Promise.resolve(Y(a))]),g=r.t("palette.group.files"),m=u.map(x=>F(x,g));return[...I.list(),...p,...m]},Z=e=>{k.cleanup?.(),e&&e.type==="command"&&(k.cleanup=e.option?.onHighlight?.())},J=e=>{const a=s.tab(e);c().open(a),s.load(e),S().reviewPanel.opened()||S().reviewPanel.open(),l.fileTree.setTab("all"),t.onOpenFile?.(e),c().setActive(a)},Q=e=>{if(e){if(k.committed=!0,k.cleanup=void 0,d.close(),e.type==="command"){e.option?.onSelect?.("palette");return}if(e.type==="session"){if(!e.directory||!e.sessionID)return;i(ve(y.pathname,be(e.directory),e.sessionID));return}e.path&&J(e.path)}};return de(()=>{k.committed||k.cleanup?.()}),w(we,{class:"pt-3 pb-0 !max-h-[480px]",transition:!0,get children(){return w(ue,{get search(){return{placeholder:D()?r.t("session.header.searchFiles"):r.t("palette.search.placeholder"),autofocus:!0,hideIcon:!0}},get emptyMessage(){return r.t("palette.empty")},get loadingMessage(){return r.t("common.loading")},items:B,key:e=>e.id,filterKeys:["title","description","category"],get groupBy(){return G()?e=>e.category:()=>""},onMove:Z,onSelect:Q,children:e=>w(fe,{get fallback(){return(()=>{var a=Ce(),u=a.firstChild,p=u.firstChild,g=p.firstChild,m=g.nextSibling;return f(u,w(pe,{get node(){return{path:e.path??"",type:"file"}},class:"shrink-0 size-4"}),p),f(g,()=>me(e.path??"")),f(m,()=>K(e.path??"")),a})()},get children(){return[w(P,{get when(){return e.type==="command"},get children(){var a=_e(),u=a.firstChild,p=u.firstChild;return f(p,()=>e.title),f(u,w(C,{get when(){return e.description},get children(){var g=q();return f(g,()=>e.description),g}}),null),f(a,w(C,{get when(){return e.keybind},get children(){return w(ke,{class:"rounded-[4px]",get children(){return ge(e.keybind??"",r.t)}})}}),null),a}}),w(P,{get when(){return e.type==="session"},get children(){var a=Me(),u=a.firstChild,p=u.firstChild,g=p.firstChild;return f(u,w(he,{name:"bubble-5",size:"small",class:"shrink-0 text-icon-weak"}),p),f(g,()=>e.title),f(p,w(C,{get when(){return e.description},get children(){var m=q();return f(m,()=>e.description),T(()=>m.classList.toggle("opacity-70",!!e.archived)),m}}),null),f(a,w(C,{get when(){return e.updated},get children(){var m=De();return f(m,()=>Se(new Date(e.updated).toISOString(),r.t)),m}}),null),T(()=>g.classList.toggle("opacity-70",!!e.archived)),a}})]}})})}})}export{Oe as DialogSelectFile};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{aA as Y,Z as ee,aB as te,a as re,aC as ne,aD as ae,c as le,E as C,A as z,v as K,i as n,d as c,I as ie,m as F,S as w,L as oe,K as O,aE as Q,T as j,aF as se,D as ce,aG as de,t as v,e as me}from"./index-
|
|
1
|
+
import{aA as Y,Z as ee,aB as te,a as re,aC as ne,aD as ae,c as le,E as C,A as z,v as K,i as n,d as c,I as ie,m as F,S as w,L as oe,K as O,aE as Q,T as j,aF as se,D as ce,aG as de,t as v,e as me}from"./index-CSNkL9jy.js";function E(a){return{name:"",transport:"local",command:"",environment:"",url:"",headers:"",enabled:!0,...a}}function R(a){const r=[],g=/"([^"]*)"|'([^']*)'|(\S+)/g;let d;for(;d=g.exec(a.trim());)r.push(d[1]??d[2]??d[3]??"");return r.filter(t=>t.length>0)}function ue(a){return a.map(r=>/[\s"']/.test(r)?`"${r.replaceAll('"','\\"')}"`:r).join(" ")}function G(a){const r={};for(const g of a.split(/\r?\n/)){const d=g.trim();if(!d||d.startsWith("#"))continue;const t=d.indexOf("=");if(t<=0)continue;const k=d.slice(0,t).trim(),T=d.slice(t+1).trim();k&&(r[k]=T)}return Object.keys(r).length>0?r:void 0}function I(a){return a?Object.entries(a).map(([r,g])=>`${r}=${g}`).join(`
|
|
2
2
|
`):""}function ge(a,r){return r.type==="remote"?E({name:a,transport:"remote",url:r.url??"",headers:I(r.headers),enabled:r.enabled!==!1}):E({name:a,transport:"local",command:ue(r.command??[]),environment:I(r.environment),enabled:r.enabled!==!1})}function pe(a,r,g){const d=a.name.trim();if(!d)return"name";if(d!==g&&r.includes(d))return"duplicate";if(a.transport==="local")return R(a.command).length===0?"command":void 0;if(!a.url.trim())return"url"}function fe(a){const r=a.enabled;return a.transport==="remote"?{type:"remote",url:a.url.trim(),enabled:r,headers:G(a.headers)}:{type:"local",command:R(a.command),enabled:r,environment:G(a.environment)}}var he=v('<div class="flex items-center gap-2 -ml-2"><span>'),ve=v('<div class="flex flex-col gap-3 min-h-0 px-5 pb-5"><div class=shrink-0>'),V=v('<div class="flex flex-col gap-5">'),be=v('<p class="text-12-regular text-text-critical-base">'),xe=v('<div class="flex h-full min-h-0 flex-col px-5 pb-5"><div class="min-h-0 flex-1 overflow-y-auto pr-1"><div class="flex flex-col gap-5 rounded-md bg-surface-base p-5"><div class="flex flex-col gap-2"><span class="text-12-medium text-text-strong"></span></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-3"><div class="flex flex-col gap-1"><span class="text-13-medium text-text-strong"></span><span class="text-12-regular text-text-weak"></span></div></div></div></div><div class="shrink-0 flex justify-end gap-2 pt-4">'),ye=v('<span class="text-11-regular text-text-weaker">'),$e=v('<span class="text-11-regular text-text-weak">'),_e=v('<span class="text-11-regular text-text-weaker truncate">'),Ce=v('<div class="w-full flex items-center justify-between gap-x-3"><div class="flex flex-col gap-0.5 min-w-0"><div class="flex items-center gap-2"><span class=truncate></span></div></div><div class="flex items-center gap-2 shrink-0">');const we={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled"},N={name:"dialog.mcp.error.name",command:"dialog.mcp.error.command",url:"dialog.mcp.error.url",duplicate:"dialog.mcp.error.duplicate"},Se=a=>{const r=Y(),g=ee(),d=te(),t=re(),k=ne(),T=ae(),[s,y]=le({mode:a.initialMode==="add"?"form":"list",editing:void 0,form:E(),error:""}),S=C(()=>g.data.config.mcp??{}),B=C(()=>{const e=new Set([...Object.keys(S()),...Object.keys(r.data.mcp??{})]);return Array.from(e).map(o=>({name:o,status:r.data.mcp?.[o]?.status??(S()[o]?"disabled":void 0)})).sort((o,l)=>o.name.localeCompare(l.name))}),W=C(()=>Object.keys(S())),x=e=>y("form",e),A=()=>k.refetchQueries(T.mcp(de(r.directory))),b=z(()=>({mutationFn:async e=>{r.data.mcp[e]?.status==="connected"?await d.client.mcp.disconnect({name:e}):await d.client.mcp.connect({name:e})},onSuccess:()=>A(),onError:e=>{K({variant:"error",title:t.t("common.requestFailed"),description:e instanceof Error?e.message:String(e)})}})),u=z(()=>({mutationFn:async()=>{const e=pe(s.form,W(),s.editing);if(e)throw y("error",t.t(N[e])),new Error(e);y("error","");const o=s.form.name.trim(),l=fe(s.form),m={...S()};return s.editing&&s.editing!==o&&delete m[s.editing],m[o]=l,await g.updateConfig({mcp:m}),l.enabled!==!1&&await d.client.mcp.add({name:o,config:l}).catch(()=>{}),o},onSuccess:async()=>{K({title:t.t("dialog.mcp.toast.saved")});const e=async()=>{await Promise.all([A(),k.invalidateQueries({queryKey:["config"]})])};await e(),setTimeout(()=>void e(),500),setTimeout(()=>void e(),1500),D()},onError:e=>{e instanceof Error&&e.message in N||K({variant:"error",title:t.t("common.requestFailed"),description:e instanceof Error?e.message:String(e)})}})),Z=C(()=>B().filter(e=>e.status==="connected").length),H=C(()=>B().length);function D(){y({mode:"list",editing:void 0,form:E(),error:""})}function J(){y({mode:"form",editing:void 0,form:E(),error:""})}function U(e){const o=S()[e];if(!o||!("type"in o)){K({variant:"error",title:t.t("dialog.mcp.error.missingConfig")});return}y({mode:"form",editing:e,form:ge(e,o),error:""})}const X=C(()=>s.mode!=="form"?t.t("dialog.mcp.title"):(()=>{var e=he(),o=e.firstChild;return n(e,c(ie,{icon:"arrow-left",variant:"ghost",onClick:D,get"aria-label"(){return t.t("common.goBack")}}),o),n(o,(()=>{var l=F(()=>!!s.editing);return()=>l()?t.t("dialog.mcp.editTitle"):t.t("dialog.mcp.addTitle")})()),e})());return c(ce,{size:"large",get title(){return X()},get description(){return F(()=>s.mode==="list")()?t.t("dialog.mcp.description",{enabled:Z(),total:H()}):t.t("dialog.mcp.form.hint")},class:"overflow-hidden [&_[data-slot=dialog-body]]:h-full [&_[data-slot=dialog-body]]:min-h-0",get children(){return c(w,{get when(){return s.mode==="list"},get fallback(){return(()=>{var e=xe(),o=e.firstChild,l=o.firstChild,m=l.firstChild,P=m.firstChild,$=m.nextSibling,M=$.firstChild,L=M.firstChild,p=L.nextSibling,_=o.nextSibling;return n(l,c(j,{get label(){return t.t("dialog.mcp.form.name")},get placeholder(){return t.t("dialog.mcp.form.namePlaceholder")},get value(){return s.form.name},get disabled(){return u.isPending||!!s.editing},onChange:i=>x({name:i})}),m),n(P,()=>t.t("dialog.mcp.form.transport")),n(m,c(se,{options:["local","remote"],get current(){return s.form.transport},value:i=>i,label:i=>i==="local"?t.t("dialog.mcp.form.transport.local"):t.t("dialog.mcp.form.transport.remote"),onSelect:i=>{!i||u.isPending||x({transport:i})}}),null),n(l,c(w,{get when(){return s.form.transport==="local"},get fallback(){return(()=>{var i=V();return n(i,c(j,{get label(){return t.t("dialog.mcp.form.url")},get placeholder(){return t.t("dialog.mcp.form.urlPlaceholder")},get value(){return s.form.url},get disabled(){return u.isPending},onChange:h=>x({url:h})}),null),n(i,c(j,{multiline:!0,get label(){return t.t("dialog.mcp.form.headers")},get placeholder(){return t.t("dialog.mcp.form.headersPlaceholder")},get value(){return s.form.headers},get disabled(){return u.isPending},onChange:h=>x({headers:h}),class:"min-h-24"}),null),i})()},get children(){var i=V();return n(i,c(j,{get label(){return t.t("dialog.mcp.form.command")},get placeholder(){return t.t("dialog.mcp.form.commandPlaceholder")},get value(){return s.form.command},get disabled(){return u.isPending},onChange:h=>x({command:h})}),null),n(i,c(j,{multiline:!0,get label(){return t.t("dialog.mcp.form.environment")},get placeholder(){return t.t("dialog.mcp.form.environmentPlaceholder")},get value(){return s.form.environment},get disabled(){return u.isPending},onChange:h=>x({environment:h}),class:"min-h-24"}),null),i}}),$),n(L,()=>t.t("dialog.mcp.form.enabled")),n(p,()=>t.t("dialog.mcp.form.enabledDescription")),n($,c(Q,{get checked(){return s.form.enabled},get disabled(){return u.isPending},onChange:i=>x({enabled:i})}),null),n(l,c(w,{get when(){return s.error},get children(){var i=be();return n(i,()=>s.error),i}}),null),n(_,c(O,{variant:"ghost",size:"large",onClick:D,get disabled(){return u.isPending},get children(){return t.t("common.cancel")}}),null),n(_,c(O,{variant:"primary",size:"large",get disabled(){return u.isPending},onClick:()=>{u.isPending||u.mutate()},get children(){return F(()=>!!u.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),e})()},get children(){var e=ve(),o=e.firstChild;return n(e,c(oe,{get search(){return{placeholder:t.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return t.t("dialog.mcp.empty")},key:l=>l?.name??"",items:B,filterKeys:["name","status"],sortBy:(l,m)=>l.name.localeCompare(m.name),onSelect:l=>{!l||b.isPending||b.mutate(l.name)},children:l=>{const m=()=>r.data.mcp[l.name],P=()=>m()?.status??l.status,$=()=>{const p=P()?we[P()]:void 0;if(p)return t.t(p)},M=()=>{const p=m();return p?.status==="failed"?p.error:void 0},L=()=>P()==="connected";return(()=>{var p=Ce(),_=p.firstChild,i=_.firstChild,h=i.firstChild,q=_.nextSibling;return n(h,()=>l.name),n(i,c(w,{get when(){return $()},get children(){var f=ye();return n(f,$),f}}),null),n(i,c(w,{get when(){return F(()=>!!b.isPending)()&&b.variables===l.name},get children(){var f=$e();return n(f,()=>t.t("common.loading.ellipsis")),f}}),null),n(_,c(w,{get when(){return M()},get children(){var f=_e();return n(f,M),f}}),null),q.$$click=f=>f.stopPropagation(),n(q,c(O,{variant:"ghost",class:"h-7 px-2 text-12-regular",onClick:()=>U(l.name),get children(){return t.t("common.edit")}}),null),n(q,c(Q,{get checked(){return L()},get disabled(){return F(()=>!!b.isPending)()&&b.variables===l.name},onChange:()=>{b.isPending||b.mutate(l.name)}}),null),p})()}}),o),n(o,c(O,{variant:"secondary",icon:"plus-small",size:"large",onClick:J,class:"py-1.5 pl-1.5 pr-3",get children(){return t.t("dialog.mcp.addButton")}})),e}})}})};me(["click"]);export{Se as DialogSelectMcp};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{a as x,i as d,d as i,S as h,t as b,b as y,K as P,D as M,c as O,au as v,a0 as k,X as D,I as C,av as z,E,aw as _,ax as p,L as B,ay as L,az as I}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CSNkL9jy.js","assets/index-DwCMaEur.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as x,i as d,d as i,S as h,t as b,b as y,K as P,D as M,c as O,au as v,a0 as k,X as D,I as C,av as z,E,aw as _,ax as p,L as B,ay as L,az as I}from"./index-CSNkL9jy.js";var j=b('<div class="flex flex-col gap-1 py-1"><div class=text-13-medium></div><div class="text-12-regular text-text-invert-base"></div><div class="text-12-regular text-text-invert-base">'),A=b('<div class="text-12-regular text-text-invert-base">');const F=o=>{const n=x(),a=e=>{const l=`${e.id} ${e.name}`.toLowerCase();return/claude|anthropic/.test(l)?n.t("model.provider.anthropic"):/gpt|o[1-4]|codex|openai/.test(l)?n.t("model.provider.openai"):/gemini|palm|bard|google/.test(l)?n.t("model.provider.google"):/grok|xai/.test(l)?n.t("model.provider.xai"):/llama|meta/.test(l)?n.t("model.provider.meta"):e.provider.name},c=e=>e==="text"?n.t("model.input.text"):e==="image"?n.t("model.input.image"):e==="audio"?n.t("model.input.audio"):e==="video"?n.t("model.input.video"):e==="pdf"?n.t("model.input.pdf"):e,t=()=>{const e=[];o.latest&&e.push(n.t("model.tag.latest")),o.free&&e.push(n.t("model.tag.free")),o.limited&&e.push(n.t("model.tag.limited"));const l=e.length?` (${e.join(", ")})`:"";return`${a(o.model)} ${o.model.name}${l}`},r=()=>{if(o.model.capabilities){const g=o.model.capabilities.input,f=["text","image","audio","video","pdf"].filter(m=>g[m]).map(m=>c(m));return f.length?f.join(", "):void 0}const e=o.model.modalities?.input;if(!e)return;const l=e.map(g=>c(g));return l.length?l.join(", "):void 0},u=()=>o.model.capabilities?o.model.capabilities.reasoning?n.t("model.tooltip.reasoning.allowed"):n.t("model.tooltip.reasoning.none"):o.model.reasoning?n.t("model.tooltip.reasoning.allowed"):n.t("model.tooltip.reasoning.none"),s=()=>n.t("model.tooltip.context",{limit:o.model.limit.context.toLocaleString()});return(()=>{var e=j(),l=e.firstChild,g=l.nextSibling,S=g.nextSibling;return d(l,t),d(e,i(h,{get when(){return r()},children:f=>(()=>{var m=A();return d(m,()=>n.t("model.tooltip.allows",{inputs:f()})),m})()}),g),d(g,u),d(S,s),e})()};var K=b('<div class="w-full flex items-center gap-x-2 text-13-regular"><span class=truncate>'),N=b('<div class="flex items-center gap-1">');const $=(o,n)=>o==="opencode"&&(!n||n.input===0),w=o=>o==="onescience",T=o=>{const n=o.model??z().model,a=x(),c=E(()=>n.list().filter(r=>o.provider?r.provider.id===o.provider:!0).filter(r=>n.visible({modelID:r.id,providerID:r.provider.id})).map(r=>({...r,search:[r.provider.name,r.provider.id,r.name,r.id,r.family,$(r.provider.id,r.cost)?"free 免费":"",w(r.provider.id)?"limited 限免":"",r.latest?"latest 最新":""].join(" ")})));return i(B,{get class(){return`flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0 ${o.class??""}`},get search(){return{placeholder:a.t("dialog.model.search.placeholder"),autofocus:!0,action:o.action}},get emptyMessage(){return a.t("dialog.model.empty")},key:t=>`${t.provider.id}:${t.id}`,items:c,get current(){return n.current()},scrollToCurrent:!1,filterKeys:["search"],sortBy:(t,r)=>t.name.localeCompare(r.name),groupBy:t=>t.provider.name,sortGroupsBy:(t,r)=>{const u=t.items[0].provider.id,s=r.items[0].provider.id;return p.includes(u)&&!p.includes(s)?-1:!p.includes(u)&&p.includes(s)?1:p.indexOf(u)-p.indexOf(s)},itemWrapper:(t,r)=>i(D,{class:"w-full",placement:"right-start",gutter:12,get value(){return i(F,{model:t,get latest(){return t.latest},get free(){return $(t.provider.id,t.cost)},get limited(){return w(t.provider.id)}})},children:r}),onSelect:t=>{n.set(t?{modelID:t.id,providerID:t.provider.id}:void 0,{recent:!0}),o.onSelect()},children:t=>(()=>{var r=K(),u=r.firstChild;return d(u,()=>t.name),d(r,i(h,{get when(){return $(t.provider.id,t.cost)},get children(){return i(_,{get children(){return a.t("model.tag.free")}})}}),null),d(r,i(h,{get when(){return w(t.provider.id)},get children(){return i(_,{get children(){return a.t("model.tag.limited")}})}}),null),d(r,i(h,{get when(){return t.latest},get children(){return i(_,{get children(){return a.t("model.tag.latest")}})}}),null),r})()})};function V(o){const[n,a]=O({open:!1,dismiss:null}),c=y(),t=e=>{a("dismiss",e),a("open",!1)},r=()=>{t("manage"),c.show(()=>i(L,{tab:"models"}))},u=()=>{t("provider"),I(()=>import("./index-CSNkL9jy.js").then(e=>e.aN),__vite__mapDeps([0,1])).then(e=>{c.show(()=>i(e.DialogSelectProvider,{}))})},s=x();return i(v,{get open(){return n.open},onOpenChange:e=>{e&&a("dismiss",null),a("open",e)},modal:!1,placement:"top-start",gutter:4,get children(){return[i(v.Trigger,k({get as(){return o.triggerAs??"div"}},()=>o.triggerProps,{get children(){return o.children}})),i(v.Portal,{get children(){return i(v.Content,{class:"w-72 h-80 flex flex-col p-2 rounded-md border border-border-base bg-surface-raised-stronger-non-alpha shadow-md z-50 outline-none overflow-hidden",onEscapeKeyDown:e=>{t("escape"),e.preventDefault(),e.stopPropagation()},onPointerDownOutside:()=>t("outside"),onFocusOutside:()=>t("outside"),onCloseAutoFocus:e=>{const l=n.dismiss;l==="outside"&&e.preventDefault(),(l==="escape"||l==="select")&&(e.preventDefault(),o.onClose?.(l)),a("dismiss",null)},get children(){return[i(v.Title,{class:"sr-only",get children(){return s.t("dialog.model.select.title")}}),i(T,{get provider(){return o.provider},get model(){return o.model},onSelect:()=>t("select"),class:"p-1",get action(){return(()=>{var e=N();return d(e,i(D,{placement:"top",get value(){return s.t("command.provider.connect")},get children(){return i(C,{icon:"plus-small",variant:"ghost",iconSize:"normal",class:"size-6",get"aria-label"(){return s.t("command.provider.connect")},onClick:u})}}),null),d(e,i(D,{placement:"top",get value(){return s.t("settings.models.title")},get children(){return i(C,{icon:"sliders",variant:"ghost",iconSize:"normal",class:"size-6",get"aria-label"(){return s.t("settings.models.title")},onClick:r})}}),null),e})()}})]}})}})]}})}const G=o=>{const n=y(),a=x(),c=()=>{I(()=>import("./index-CSNkL9jy.js").then(r=>r.aN),__vite__mapDeps([0,1])).then(r=>{n.show(()=>i(r.DialogSelectProvider,{}))})},t=()=>{n.show(()=>i(L,{tab:"models"}))};return i(M,{get title(){return a.t("dialog.model.select.title")},get action(){return i(P,{class:"h-7 -my-1 text-14-medium",icon:"plus-small",tabIndex:-1,onClick:c,get children(){return a.t("command.provider.connect")}})},get children(){return[i(T,{get provider(){return o.provider},get model(){return o.model},onSelect:()=>n.close()}),i(P,{variant:"ghost",class:"ml-3 mt-5 mb-6 text-text-base self-start",onClick:t,get children(){return a.t("settings.models.title")}})]}})};export{G as DialogSelectModel,V as ModelSelectorPopover};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as he,b as me,y as fe,u as Y,a as H,z as Z,c as pe,A as V,B as z,C as f,E as k,F as W,G as Se,i as m,d as n,I as O,m as w,S as $,L as we,H as ye,J as S,K as Q,D as xe,M as be,N as ke,t as A,T as N,v as Ce}from"./index-BkVCHloq.js";import{S as _e,a as De}from"./server-row-BvHpF32u.js";var Pe=A('<div class=px-5><div class="bg-surface-base rounded-md p-5 flex flex-col gap-3"><div class="flex-1 min-w-0 [&_[data-slot=input-wrapper]]:relative"></div><p class="text-12-regular text-text-weak leading-snug">'),$e=A('<div class="flex items-center gap-2 -ml-2"><span>'),Ie=A('<p class="px-5 text-13-regular text-text-weak">'),Ee=A('<div class="flex flex-1 min-h-0 flex-col gap-2"><div class="shrink-0 px-5 pb-5">'),Ae=A('<div class="flex items-center gap-3 min-w-0 flex-1 w-full group/item"><div class="flex flex-col h-full items-start w-5"></div><div class="flex items-center justify-center gap-4 pl-4">'),Fe=A('<span class="text-text-base bg-surface-base text-14-regular px-1.5 rounded-xs">');const K="";function X(i,l){Ce({variant:"error",title:i.t("common.requestFailed"),description:l instanceof Error?l.message:String(l)})}function Me(){const i=H(),l=Y(),[c,u]=be(async()=>{try{const h=await l.getDefaultServer?.();return h||null}catch(h){return X(i,h),null}},{initialValue:null}),s=k(()=>!!l.getDefaultServer&&!!l.setDefaultServer);return{defaultKey:c,canDefault:s,setDefault:async h=>{try{await l.setDefaultServer?.(h),u.mutate(h)}catch(C){X(i,C)}}}}function Ne(){const i=Z(),l=u=>{const s=z(u);if(!s)return!1;const v=s.replace(/^https?:\/\//,"").split("/")[0];return v?v.includes("localhost")||v.startsWith("127.0.0.1")?!0:v.includes(".")||v.includes(":"):!1};return{previewStatus:async(u,s,v,h)=>{if(h(void 0),!l(u))return;const C=z(u);if(!C)return;const y={url:C};s&&(y.username=s),v&&(y.password=v);const F=await i(y);h(F.healthy)}}}function ze(i){const l=H(),c=u=>{if(u.stopPropagation(),u.key==="Escape"){u.preventDefault(),i.onBack();return}u.key!=="Enter"||u.isComposing||(u.preventDefault(),i.onSubmit())};return(()=>{var u=Pe(),s=u.firstChild,v=s.firstChild,h=v.nextSibling;return m(v,n(N,{type:"text",get label(){return l.t("dialog.server.add.url")},get placeholder(){return i.placeholder},get value(){return i.value},autofocus:!0,get validationState(){return i.error?"invalid":"valid"},get error(){return i.error},get disabled(){return i.busy},get onChange(){return i.onChange},onKeyDown:c})),m(s,n(N,{type:"text",get label(){return l.t("dialog.server.add.name")},get placeholder(){return l.t("dialog.server.add.namePlaceholder")},get value(){return i.name},get disabled(){return i.busy},get onChange(){return i.onNameChange},onKeyDown:c}),h),m(h,()=>l.t("dialog.server.add.auth.hint")),m(s,n(N,{type:"password",get label(){return l.t("dialog.server.add.password")},get placeholder(){return l.t("dialog.server.add.passwordPlaceholder")},get value(){return i.password},get disabled(){return i.busy},get onChange(){return i.onPasswordChange},onKeyDown:c}),null),m(s,n(N,{type:"text",get label(){return l.t("dialog.server.add.username")},get placeholder(){return l.t("dialog.server.add.usernamePlaceholder")},get value(){return i.username},get disabled(){return i.busy},get onChange(){return i.onUsernameChange},onKeyDown:c}),null),u})()}function Be(){const i=he(),l=me(),c=fe(),u=Y(),s=H(),{defaultKey:v,canDefault:h,setDefault:C}=Me(),{previewStatus:y}=Ne(),F=Z(),[r,d]=pe({status:{},addServer:{url:"",name:"",username:K,password:"",error:"",showForm:!1,status:void 0},editServer:{id:void 0,value:"",name:"",username:"",password:"",error:"",status:void 0}}),M=()=>{d("addServer",{url:"",name:"",username:K,password:"",error:"",showForm:!1,status:void 0})},I=()=>{d("editServer",{id:void 0,value:"",name:"",username:"",password:"",error:"",status:void 0})},_=V(()=>({mutationFn:async e=>{const t=z(e);if(!t){M();return}const a={type:"http",http:{url:t}};if(r.addServer.name.trim()&&(a.displayName=r.addServer.name.trim()),r.addServer.password&&(a.http.password=r.addServer.password),r.addServer.password&&r.addServer.username&&(a.http.username=r.addServer.username),!(await F(a.http)).healthy){d("addServer",{error:s.t("dialog.server.add.error")});return}M(),await q(a,!0)}})),D=V(()=>({mutationFn:async e=>{if(e.original.type!=="http")return;const t=z(e.value);if(!t){I();return}const a=r.editServer.name.trim()||void 0,g=r.editServer.username||void 0,o=r.editServer.password||void 0,x=e.original.displayName;if(t===e.original.http.url&&a===x&&g===e.original.http.username&&o===e.original.http.password){I();return}const b={type:"http",displayName:a,http:{url:t,username:g,password:o}};if(!(await F(b.http)).healthy){d("editServer",{error:s.t("dialog.server.add.error")});return}t===e.original.http.url?c.add(b):ee(e.original,b),I()}})),ee=(e,t)=>{const a=c.key,g=c.add(t);if(!g)return;const o=a===f.key(e)?f.key(g):a;o&&c.setActive(o),c.remove(f.key(e))},E=k(()=>{const e=c.current,t=c.list;return e?t.includes(e)?[e,...t.filter(a=>a!==e)]:[e,...t]:t}),R=k(()=>E().find(e=>f.key(e)===c.key)??E()[0]),re=k(()=>{const e=E().filter(o=>o.type==="http"||o.type==="sidecar");if(!e.length)return e;const t=R(),a=new Map(e.map((o,x)=>[o,x])),g=o=>o?.healthy===!0?0:o?.healthy===!1?2:1;return e.slice().sort((o,x)=>{if(o===t)return-1;if(x===t)return 1;const b=g(r.status[f.key(o)])-g(r.status[f.key(x)]);return b!==0?b:(a.get(o)??0)-(a.get(x)??0)})});async function T(){const e={};await Promise.all(E().map(async t=>{e[f.key(t)]=await F(t.http)})),d("status",ke(e))}W(()=>{E(),T();const e=setInterval(T,1e4);Se(()=>clearInterval(e))});async function q(e,t){if(!(!t&&r.status[f.key(e)]?.healthy===!1)){if(l.close(),t&&e.type==="http"){c.add(e),i("/");return}i("/"),queueMicrotask(()=>c.setActive(f.key(e)))}}const te=e=>{_.isPending||(d("addServer",{url:e,error:""}),y(e,r.addServer.username,r.addServer.password,t=>d("addServer",{status:t})))},ae=e=>{_.isPending||d("addServer",{name:e,error:""})},ne=e=>{_.isPending||(d("addServer",{username:e,error:""}),y(r.addServer.url,e,r.addServer.password,t=>d("addServer",{status:t})))},se=e=>{_.isPending||(d("addServer",{password:e,error:""}),y(r.addServer.url,r.addServer.username,e,t=>d("addServer",{status:t})))},ie=e=>{D.isPending||(d("editServer",{value:e,error:""}),y(e,r.editServer.username,r.editServer.password,t=>d("editServer",{status:t})))},de=e=>{D.isPending||d("editServer",{name:e,error:""})},le=e=>{D.isPending||(d("editServer",{username:e,error:""}),y(r.editServer.value,e,r.editServer.password,t=>d("editServer",{status:t})))},oe=e=>{D.isPending||(d("editServer",{password:e,error:""}),y(r.editServer.value,r.editServer.username,e,t=>d("editServer",{status:t})))},L=k(()=>r.editServer.id?"edit":r.addServer.showForm?"add":"list"),j=k(()=>{if(r.editServer.id)return E().find(e=>e.type==="http"&&e.http.url===r.editServer.id)}),G=()=>{M(),I()},ue=()=>{I(),d("addServer",{showForm:!0,url:"",name:"",username:K,password:"",error:"",status:void 0})},ce=e=>{M(),d("editServer",{id:e.http.url,value:e.http.url,name:e.displayName??"",username:e.http.username??"",password:e.http.password??"",error:"",status:r.status[f.key(e)]?.healthy})},J=()=>{if(L()==="add"){if(_.isPending)return;d("addServer",{error:""}),_.mutate(r.addServer.url);return}const e=j();e&&(D.isPending||(d("editServer",{error:""}),D.mutate({original:e,value:r.editServer.value})))},U=k(()=>L()!=="list"),p=k(()=>L()==="add"),B=k(()=>p()?_.isPending:D.isPending),ge=k(()=>U()?(()=>{var e=$e(),t=e.firstChild;return m(e,n(O,{icon:"arrow-left",variant:"ghost",onClick:G,get"aria-label"(){return s.t("common.goBack")}}),t),m(t,(()=>{var a=w(()=>!!p());return()=>a()?s.t("dialog.server.add.title"):s.t("dialog.server.edit.title")})()),e})():s.t("dialog.server.title"));W(()=>{r.editServer.id&&(j()||I())});async function ve(e){await u.sshDisconnect?.(e),c.remove(e),await u.getDefaultServer?.()===e&&u.setDefaultServer?.(null)}return n(xe,{get title(){return ge()},get children(){var e=Ee(),t=e.firstChild;return m(e,n($,{get when(){return!U()},get fallback(){return n(ze,{get value(){return w(()=>!!p())()?r.addServer.url:r.editServer.value},get name(){return w(()=>!!p())()?r.addServer.name:r.editServer.name},get username(){return w(()=>!!p())()?r.addServer.username:r.editServer.username},get password(){return w(()=>!!p())()?r.addServer.password:r.editServer.password},get placeholder(){return s.t("dialog.server.add.placeholder")},get busy(){return B()},get error(){return w(()=>!!p())()?r.addServer.error:r.editServer.error},get status(){return w(()=>!!p())()?r.addServer.status:r.editServer.status},get onChange(){return p()?te:ie},get onNameChange(){return p()?ae:de},get onUsernameChange(){return p()?ne:le},get onPasswordChange(){return p()?se:oe},onSubmit:J,onBack:G})},get children(){return[(()=>{var a=Ie();return m(a,()=>s.t("dialog.server.description")),a})(),n(we,{get search(){return{placeholder:s.t("dialog.server.search.placeholder"),autofocus:!1}},noInitialSelection:!0,get emptyMessage(){return s.t("dialog.server.empty")},items:re,key:a=>a.http.url,onSelect:a=>{a&&q(a)},divider:!0,class:"flex-1 min-h-0 px-5 [&_[data-slot=list-search-wrapper]]:w-full [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:overflow-y-auto [&_[data-slot=list-items]]:bg-surface-base [&_[data-slot=list-items]]:rounded-md [&_[data-slot=list-item]]:min-h-14 [&_[data-slot=list-item]]:p-3 [&_[data-slot=list-item]]:!bg-transparent",children:a=>{const g=f.key(a);return(()=>{var o=Ae(),x=o.firstChild,b=x.nextSibling;return m(x,n(_e,{get health(){return r.status[g]}})),m(o,n(De,{conn:a,get dimmed(){return r.status[g]?.healthy===!1},get status(){return r.status[g]},class:"flex items-center gap-3 min-w-0 flex-1",get badge(){return n($,{get when(){return v()===f.key(a)},get children(){var P=Fe();return m(P,()=>s.t("dialog.server.status.default")),P}})},showCredentials:!0}),b),m(b,n($,{get when(){return f.key(R())===g},get children(){return n(ye,{name:"check",class:"h-6"})}}),null),m(b,n($,{get when(){return a.type==="http"},get children(){return n(S,{get children(){return[n(S.Trigger,{as:O,icon:"dot-grid",variant:"ghost",class:"shrink-0 size-8 hover:bg-surface-base-hover data-[expanded]:bg-surface-base-active",onClick:P=>P.stopPropagation(),onPointerDown:P=>P.stopPropagation()}),n(S.Portal,{get children(){return n(S.Content,{class:"mt-1",get children(){return[n(S.Item,{onSelect:()=>{a.type==="http"&&ce(a)},get children(){return n(S.ItemLabel,{get children(){return s.t("dialog.server.menu.edit")}})}}),n($,{get when(){return w(()=>!!h())()&&v()!==g},get children(){return n(S.Item,{onSelect:()=>C(g),get children(){return n(S.ItemLabel,{get children(){return s.t("dialog.server.menu.default")}})}})}}),n($,{get when(){return w(()=>!!h())()&&v()===g},get children(){return n(S.Item,{onSelect:()=>C(null),get children(){return n(S.ItemLabel,{get children(){return s.t("dialog.server.menu.defaultRemove")}})}})}}),n(S.Separator,{}),n(S.Item,{onSelect:()=>ve(f.key(a)),class:"text-text-on-critical-base hover:bg-surface-critical-weak",get children(){return n(S.ItemLabel,{get children(){return s.t("dialog.server.menu.delete")}})}})]}})}})]}})}}),null),o})()}})]}}),t),m(t,n($,{get when(){return U()},get fallback(){return n(Q,{variant:"secondary",icon:"plus-small",size:"large",onClick:ue,class:"py-1.5 pl-1.5 pr-3 flex items-center gap-1.5",get children(){return s.t("dialog.server.add.button")}})},get children(){return n(Q,{variant:"primary",size:"large",onClick:J,get disabled(){return B()},class:"px-3 py-1.5",get children(){return w(()=>!!B())()?s.t("dialog.server.add.checking"):w(()=>!!p())()?s.t("dialog.server.add.button"):s.t("common.save")}})}})),e}})}export{Be as DialogSelectServer};
|
|
1
|
+
import{x as he,b as me,y as fe,u as Y,a as H,z as Z,c as pe,A as V,B as z,C as f,E as k,F as W,G as Se,i as m,d as n,I as O,m as w,S as $,L as we,H as ye,J as S,K as Q,D as xe,M as be,N as ke,t as A,T as N,v as Ce}from"./index-CSNkL9jy.js";import{S as _e,a as De}from"./server-row-C2EK_XQj.js";var Pe=A('<div class=px-5><div class="bg-surface-base rounded-md p-5 flex flex-col gap-3"><div class="flex-1 min-w-0 [&_[data-slot=input-wrapper]]:relative"></div><p class="text-12-regular text-text-weak leading-snug">'),$e=A('<div class="flex items-center gap-2 -ml-2"><span>'),Ie=A('<p class="px-5 text-13-regular text-text-weak">'),Ee=A('<div class="flex flex-1 min-h-0 flex-col gap-2"><div class="shrink-0 px-5 pb-5">'),Ae=A('<div class="flex items-center gap-3 min-w-0 flex-1 w-full group/item"><div class="flex flex-col h-full items-start w-5"></div><div class="flex items-center justify-center gap-4 pl-4">'),Fe=A('<span class="text-text-base bg-surface-base text-14-regular px-1.5 rounded-xs">');const K="";function X(i,l){Ce({variant:"error",title:i.t("common.requestFailed"),description:l instanceof Error?l.message:String(l)})}function Me(){const i=H(),l=Y(),[c,u]=be(async()=>{try{const h=await l.getDefaultServer?.();return h||null}catch(h){return X(i,h),null}},{initialValue:null}),s=k(()=>!!l.getDefaultServer&&!!l.setDefaultServer);return{defaultKey:c,canDefault:s,setDefault:async h=>{try{await l.setDefaultServer?.(h),u.mutate(h)}catch(C){X(i,C)}}}}function Ne(){const i=Z(),l=u=>{const s=z(u);if(!s)return!1;const v=s.replace(/^https?:\/\//,"").split("/")[0];return v?v.includes("localhost")||v.startsWith("127.0.0.1")?!0:v.includes(".")||v.includes(":"):!1};return{previewStatus:async(u,s,v,h)=>{if(h(void 0),!l(u))return;const C=z(u);if(!C)return;const y={url:C};s&&(y.username=s),v&&(y.password=v);const F=await i(y);h(F.healthy)}}}function ze(i){const l=H(),c=u=>{if(u.stopPropagation(),u.key==="Escape"){u.preventDefault(),i.onBack();return}u.key!=="Enter"||u.isComposing||(u.preventDefault(),i.onSubmit())};return(()=>{var u=Pe(),s=u.firstChild,v=s.firstChild,h=v.nextSibling;return m(v,n(N,{type:"text",get label(){return l.t("dialog.server.add.url")},get placeholder(){return i.placeholder},get value(){return i.value},autofocus:!0,get validationState(){return i.error?"invalid":"valid"},get error(){return i.error},get disabled(){return i.busy},get onChange(){return i.onChange},onKeyDown:c})),m(s,n(N,{type:"text",get label(){return l.t("dialog.server.add.name")},get placeholder(){return l.t("dialog.server.add.namePlaceholder")},get value(){return i.name},get disabled(){return i.busy},get onChange(){return i.onNameChange},onKeyDown:c}),h),m(h,()=>l.t("dialog.server.add.auth.hint")),m(s,n(N,{type:"password",get label(){return l.t("dialog.server.add.password")},get placeholder(){return l.t("dialog.server.add.passwordPlaceholder")},get value(){return i.password},get disabled(){return i.busy},get onChange(){return i.onPasswordChange},onKeyDown:c}),null),m(s,n(N,{type:"text",get label(){return l.t("dialog.server.add.username")},get placeholder(){return l.t("dialog.server.add.usernamePlaceholder")},get value(){return i.username},get disabled(){return i.busy},get onChange(){return i.onUsernameChange},onKeyDown:c}),null),u})()}function Be(){const i=he(),l=me(),c=fe(),u=Y(),s=H(),{defaultKey:v,canDefault:h,setDefault:C}=Me(),{previewStatus:y}=Ne(),F=Z(),[r,d]=pe({status:{},addServer:{url:"",name:"",username:K,password:"",error:"",showForm:!1,status:void 0},editServer:{id:void 0,value:"",name:"",username:"",password:"",error:"",status:void 0}}),M=()=>{d("addServer",{url:"",name:"",username:K,password:"",error:"",showForm:!1,status:void 0})},I=()=>{d("editServer",{id:void 0,value:"",name:"",username:"",password:"",error:"",status:void 0})},_=V(()=>({mutationFn:async e=>{const t=z(e);if(!t){M();return}const a={type:"http",http:{url:t}};if(r.addServer.name.trim()&&(a.displayName=r.addServer.name.trim()),r.addServer.password&&(a.http.password=r.addServer.password),r.addServer.password&&r.addServer.username&&(a.http.username=r.addServer.username),!(await F(a.http)).healthy){d("addServer",{error:s.t("dialog.server.add.error")});return}M(),await q(a,!0)}})),D=V(()=>({mutationFn:async e=>{if(e.original.type!=="http")return;const t=z(e.value);if(!t){I();return}const a=r.editServer.name.trim()||void 0,g=r.editServer.username||void 0,o=r.editServer.password||void 0,x=e.original.displayName;if(t===e.original.http.url&&a===x&&g===e.original.http.username&&o===e.original.http.password){I();return}const b={type:"http",displayName:a,http:{url:t,username:g,password:o}};if(!(await F(b.http)).healthy){d("editServer",{error:s.t("dialog.server.add.error")});return}t===e.original.http.url?c.add(b):ee(e.original,b),I()}})),ee=(e,t)=>{const a=c.key,g=c.add(t);if(!g)return;const o=a===f.key(e)?f.key(g):a;o&&c.setActive(o),c.remove(f.key(e))},E=k(()=>{const e=c.current,t=c.list;return e?t.includes(e)?[e,...t.filter(a=>a!==e)]:[e,...t]:t}),R=k(()=>E().find(e=>f.key(e)===c.key)??E()[0]),re=k(()=>{const e=E().filter(o=>o.type==="http"||o.type==="sidecar");if(!e.length)return e;const t=R(),a=new Map(e.map((o,x)=>[o,x])),g=o=>o?.healthy===!0?0:o?.healthy===!1?2:1;return e.slice().sort((o,x)=>{if(o===t)return-1;if(x===t)return 1;const b=g(r.status[f.key(o)])-g(r.status[f.key(x)]);return b!==0?b:(a.get(o)??0)-(a.get(x)??0)})});async function T(){const e={};await Promise.all(E().map(async t=>{e[f.key(t)]=await F(t.http)})),d("status",ke(e))}W(()=>{E(),T();const e=setInterval(T,1e4);Se(()=>clearInterval(e))});async function q(e,t){if(!(!t&&r.status[f.key(e)]?.healthy===!1)){if(l.close(),t&&e.type==="http"){c.add(e),i("/");return}i("/"),queueMicrotask(()=>c.setActive(f.key(e)))}}const te=e=>{_.isPending||(d("addServer",{url:e,error:""}),y(e,r.addServer.username,r.addServer.password,t=>d("addServer",{status:t})))},ae=e=>{_.isPending||d("addServer",{name:e,error:""})},ne=e=>{_.isPending||(d("addServer",{username:e,error:""}),y(r.addServer.url,e,r.addServer.password,t=>d("addServer",{status:t})))},se=e=>{_.isPending||(d("addServer",{password:e,error:""}),y(r.addServer.url,r.addServer.username,e,t=>d("addServer",{status:t})))},ie=e=>{D.isPending||(d("editServer",{value:e,error:""}),y(e,r.editServer.username,r.editServer.password,t=>d("editServer",{status:t})))},de=e=>{D.isPending||d("editServer",{name:e,error:""})},le=e=>{D.isPending||(d("editServer",{username:e,error:""}),y(r.editServer.value,e,r.editServer.password,t=>d("editServer",{status:t})))},oe=e=>{D.isPending||(d("editServer",{password:e,error:""}),y(r.editServer.value,r.editServer.username,e,t=>d("editServer",{status:t})))},L=k(()=>r.editServer.id?"edit":r.addServer.showForm?"add":"list"),j=k(()=>{if(r.editServer.id)return E().find(e=>e.type==="http"&&e.http.url===r.editServer.id)}),G=()=>{M(),I()},ue=()=>{I(),d("addServer",{showForm:!0,url:"",name:"",username:K,password:"",error:"",status:void 0})},ce=e=>{M(),d("editServer",{id:e.http.url,value:e.http.url,name:e.displayName??"",username:e.http.username??"",password:e.http.password??"",error:"",status:r.status[f.key(e)]?.healthy})},J=()=>{if(L()==="add"){if(_.isPending)return;d("addServer",{error:""}),_.mutate(r.addServer.url);return}const e=j();e&&(D.isPending||(d("editServer",{error:""}),D.mutate({original:e,value:r.editServer.value})))},U=k(()=>L()!=="list"),p=k(()=>L()==="add"),B=k(()=>p()?_.isPending:D.isPending),ge=k(()=>U()?(()=>{var e=$e(),t=e.firstChild;return m(e,n(O,{icon:"arrow-left",variant:"ghost",onClick:G,get"aria-label"(){return s.t("common.goBack")}}),t),m(t,(()=>{var a=w(()=>!!p());return()=>a()?s.t("dialog.server.add.title"):s.t("dialog.server.edit.title")})()),e})():s.t("dialog.server.title"));W(()=>{r.editServer.id&&(j()||I())});async function ve(e){await u.sshDisconnect?.(e),c.remove(e),await u.getDefaultServer?.()===e&&u.setDefaultServer?.(null)}return n(xe,{get title(){return ge()},get children(){var e=Ee(),t=e.firstChild;return m(e,n($,{get when(){return!U()},get fallback(){return n(ze,{get value(){return w(()=>!!p())()?r.addServer.url:r.editServer.value},get name(){return w(()=>!!p())()?r.addServer.name:r.editServer.name},get username(){return w(()=>!!p())()?r.addServer.username:r.editServer.username},get password(){return w(()=>!!p())()?r.addServer.password:r.editServer.password},get placeholder(){return s.t("dialog.server.add.placeholder")},get busy(){return B()},get error(){return w(()=>!!p())()?r.addServer.error:r.editServer.error},get status(){return w(()=>!!p())()?r.addServer.status:r.editServer.status},get onChange(){return p()?te:ie},get onNameChange(){return p()?ae:de},get onUsernameChange(){return p()?ne:le},get onPasswordChange(){return p()?se:oe},onSubmit:J,onBack:G})},get children(){return[(()=>{var a=Ie();return m(a,()=>s.t("dialog.server.description")),a})(),n(we,{get search(){return{placeholder:s.t("dialog.server.search.placeholder"),autofocus:!1}},noInitialSelection:!0,get emptyMessage(){return s.t("dialog.server.empty")},items:re,key:a=>a.http.url,onSelect:a=>{a&&q(a)},divider:!0,class:"flex-1 min-h-0 px-5 [&_[data-slot=list-search-wrapper]]:w-full [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:overflow-y-auto [&_[data-slot=list-items]]:bg-surface-base [&_[data-slot=list-items]]:rounded-md [&_[data-slot=list-item]]:min-h-14 [&_[data-slot=list-item]]:p-3 [&_[data-slot=list-item]]:!bg-transparent",children:a=>{const g=f.key(a);return(()=>{var o=Ae(),x=o.firstChild,b=x.nextSibling;return m(x,n(_e,{get health(){return r.status[g]}})),m(o,n(De,{conn:a,get dimmed(){return r.status[g]?.healthy===!1},get status(){return r.status[g]},class:"flex items-center gap-3 min-w-0 flex-1",get badge(){return n($,{get when(){return v()===f.key(a)},get children(){var P=Fe();return m(P,()=>s.t("dialog.server.status.default")),P}})},showCredentials:!0}),b),m(b,n($,{get when(){return f.key(R())===g},get children(){return n(ye,{name:"check",class:"h-6"})}}),null),m(b,n($,{get when(){return a.type==="http"},get children(){return n(S,{get children(){return[n(S.Trigger,{as:O,icon:"dot-grid",variant:"ghost",class:"shrink-0 size-8 hover:bg-surface-base-hover data-[expanded]:bg-surface-base-active",onClick:P=>P.stopPropagation(),onPointerDown:P=>P.stopPropagation()}),n(S.Portal,{get children(){return n(S.Content,{class:"mt-1",get children(){return[n(S.Item,{onSelect:()=>{a.type==="http"&&ce(a)},get children(){return n(S.ItemLabel,{get children(){return s.t("dialog.server.menu.edit")}})}}),n($,{get when(){return w(()=>!!h())()&&v()!==g},get children(){return n(S.Item,{onSelect:()=>C(g),get children(){return n(S.ItemLabel,{get children(){return s.t("dialog.server.menu.default")}})}})}}),n($,{get when(){return w(()=>!!h())()&&v()===g},get children(){return n(S.Item,{onSelect:()=>C(null),get children(){return n(S.ItemLabel,{get children(){return s.t("dialog.server.menu.defaultRemove")}})}})}}),n(S.Separator,{}),n(S.Item,{onSelect:()=>ve(f.key(a)),class:"text-text-on-critical-base hover:bg-surface-critical-weak",get children(){return n(S.ItemLabel,{get children(){return s.t("dialog.server.menu.delete")}})}})]}})}})]}})}}),null),o})()}})]}}),t),m(t,n($,{get when(){return U()},get fallback(){return n(Q,{variant:"secondary",icon:"plus-small",size:"large",onClick:ue,class:"py-1.5 pl-1.5 pr-3 flex items-center gap-1.5",get children(){return s.t("dialog.server.add.button")}})},get children(){return n(Q,{variant:"primary",size:"large",onClick:J,get disabled(){return B()},class:"px-3 py-1.5",get children(){return w(()=>!!B())()?s.t("dialog.server.add.checking"):w(()=>!!p())()?s.t("dialog.server.add.button"):s.t("common.save")}})}})),e}})}export{Be as DialogSelectServer};
|
package/assets/{dialog-terminal-unavailable-DytaDlaU.js → dialog-terminal-unavailable-Cjd_KkeA.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as N,E as t,a5 as y,ai as A,d as s,i as a,S as f,K as x,D as L,t as p}from"./index-
|
|
1
|
+
import{b as N,E as t,a5 as y,ai as A,d as s,i as a,S as f,K as x,D as L,t as p}from"./index-CSNkL9jy.js";var S=p('<pre class="m-0 shrink-0 max-h-28 overflow-y-auto rounded-lg border border-border-weak-base bg-background-weak p-3 text-12-regular text-text-strong leading-5 whitespace-pre-wrap break-all">探测详情:'),T=p('<div class="flex flex-col gap-2 min-w-0 min-h-0"><div class="flex items-center justify-between gap-2 shrink-0"><strong class="text-13-medium text-text-strong"></strong></div><pre class="m-0 max-h-[40vh] overflow-y-auto rounded-lg border border-border-weak-base bg-background-weak p-3 text-12-regular text-text-strong leading-5 whitespace-pre-wrap break-all">'),D=p('<div class="flex flex-col gap-4 px-6 pb-6 pt-0 min-h-0"><p class="text-14-regular text-text-weak m-0 leading-6 shrink-0"></p><p class="text-12-regular text-text-weak m-0 shrink-0"></p><div class="flex justify-end shrink-0">');function M(){const h=N(),n=t(()=>y()),r=t(()=>n()?.capabilities.terminalUnavailableReason??""),m=t(()=>n()?.capabilities.terminalUnavailableDetail??""),g=t(()=>n()?.capabilities.terminalInstallFamily??"unknown"),w=t(()=>n()?.capabilities.terminalIsolation??""),i=t(()=>!!n()&&n()?.capabilities.terminal===!0&&!r()),o=t(()=>!r()&&!i()&&w()==="bubblewrap"),c=t(()=>{if(i())return["# 当前账号已允许打开终端(native)。若仍失败,请在浏览器控制台查看 Failed to create terminal / websocket 错误。","# 源码/本机直启:看 onecode 进程日志或数据目录下 log/*.log","# 容器部署示例:","docker logs --tail 80 <onecode-container>"];const e=A(n());return Array.isArray(e)&&e.length>0?e:o()?["# bubblewrap 运行时启动失败(常见于 Docker 内缺少用户命名空间):","docker run --security-opt seccomp=unconfined --cap-add=SYS_ADMIN ...","# 确认宿主机允许非特权 user namespace:","cat /proc/sys/kernel/unprivileged_userns_clone","# 容器部署请改用 native(不做终端隔离):","export ONECODE_TERMINAL_ISOLATION=native"]:[]}),k=t(()=>c().length>0),v=t(()=>i()?"无法打开终端:连接失败":r()==="docker-missing"?"无法打开终端:缺少 Docker":r()==="disabled"?"无法打开终端:服务未启用":r()==="bubblewrap-unusable"?"无法打开终端:bubblewrap 无法隔离":o()?"无法打开终端:隔离环境异常":"无法打开终端:需要安装 bubblewrap"),O=t(()=>i()?`当前会话已启用终端(隔离模式:${w()||"native"}),但创建或连接 PTY 失败。这通常是服务端 shell/工作目录异常,或 WebSocket 被代理拦截,而不是缺少 bubblewrap。请刷新页面重试;若仍失败,查看浏览器控制台与容器日志。`:r()==="docker-missing"?"当前服务将平台账号终端隔离配置为 docker,但未检测到可用的 docker。请安装 Docker 后重启 OneCode,或改为使用 bubblewrap。":r()==="disabled"?"当前服务关闭了登录用户的交互终端。请联系管理员在服务端开启终端隔离后再试。":r()==="bubblewrap-unusable"?"已检测到 bubblewrap,但无法创建用户命名空间。源码/本机直启时多为 Ubuntu 默认限制了 unprivileged user namespaces;请按下方命令检查 sysctl,开启后重启 OneCode 并重新登录。容器部署可设置 ONECODE_TERMINAL_ISOLATION=native。":o()?"终端进程在 bubblewrap 隔离环境中启动失败或秒退。容器场景请设置 ONECODE_TERMINAL_ISOLATION=native 后重启并重新登录。":g()==="debian"?"Linux 网页版默认使用 bubblewrap 隔离不同用户的终端。检测到当前环境缺少 bwrap,请在运行 OneCode 的服务器(或容器)内安装后重新登录;容器部署可改为 ONECODE_TERMINAL_ISOLATION=native。":g()==="rhel"?"Linux 网页版默认使用 bubblewrap 隔离不同用户的终端。当前主机类似 RHEL/CentOS 系列,请按下方命令安装后重新登录;容器部署可改为 ONECODE_TERMINAL_ISOLATION=native。":"Linux 网页版默认使用 bubblewrap(bwrap)隔离终端。请在运行 OneCode 的服务器上安装后重新登录;容器部署请设置 ONECODE_TERMINAL_ISOLATION=native。"),_=async()=>{const e=c().filter(u=>!u.trim().startsWith("#")).join(`
|
|
2
2
|
`);if(e)try{await navigator.clipboard.writeText(e)}catch{}};return s(L,{get title(){return v()},class:"w-full max-w-[560px] mx-auto",size:"large",get children(){var e=D(),u=e.firstChild,b=u.nextSibling,I=b.nextSibling;return a(u,O),a(e,s(f,{get when(){return m()},get children(){var l=S();return l.firstChild,a(l,m,null),l}}),b),a(e,s(f,{get when(){return k()},get children(){var l=T(),d=l.firstChild,C=d.firstChild,E=d.nextSibling;return a(C,()=>i()||r()==="bubblewrap-unusable"||o()?"建议处理命令":"建议安装命令"),a(d,s(x,{type:"button",size:"normal",variant:"ghost",onClick:()=>void _(),children:"复制命令"}),null),a(E,()=>c().join(`
|
|
3
3
|
`)),l}}),b),a(b,()=>i()?"若刷新后仍失败,请把浏览器控制台报错与 docker logs 片段发给管理员。":"处理后请重启 OneCode(或重建容器),并重新登录账号,再打开终端。"),a(I,s(x,{type:"button",variant:"primary",size:"large",onClick:()=>h.close(),children:"知道了"})),e}})}export{M as DialogTerminalUnavailable};
|