@onescience/onecode-web 1.14.50-202609071715 → 1.14.50-202609071804

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/assets/{3Dmol-B1rQmimB.js → 3Dmol-tU5bxMp2.js} +1 -1
  2. package/assets/{account-system-Djs3bQsY.js → account-system-agj4pml6.js} +1 -1
  3. package/assets/{alert-04-DQgxnbZj.js → alert-01-CPtMLCYj.js} +1 -1
  4. package/assets/{alert-05-DieKTu9h.js → alert-02-Blic9piO.js} +1 -1
  5. package/assets/{alert-01-BzJJ-zh_.js → alert-04-C-gp_Col.js} +1 -1
  6. package/assets/{alert-02-DuklsSJE.js → alert-05-DJvJoQG9.js} +1 -1
  7. package/assets/alert-06-KRw7fTp3.js +1 -0
  8. package/assets/alert-07-hGcGiD0S.js +1 -0
  9. package/assets/alert-08-tC_6TS6D.js +1 -0
  10. package/assets/alert-10-Dpoh9rqF.js +1 -0
  11. package/assets/{bip-bop-03-8uYDh5fD.js → bip-bop-03-BMGeXTPu.js} +1 -1
  12. package/assets/{bip-bop-04-D7J2V_pQ.js → bip-bop-04-BjsTn08D.js} +1 -1
  13. package/assets/{bip-bop-06-DVe4G3q4.js → bip-bop-06-BpgSjD-H.js} +1 -1
  14. package/assets/{bip-bop-08-BR47Ixqy.js → bip-bop-08-E_8kYpgP.js} +1 -1
  15. package/assets/bip-bop-09-CBn7WZOZ.js +1 -0
  16. package/assets/{center-BHSp0APF.js → center-Bdm7642L.js} +1 -1
  17. package/assets/{dialog-edit-project-Dsv8HvjS.js → dialog-edit-project-DIGBwz0I.js} +1 -1
  18. package/assets/{dialog-fork-CA3inOLr.js → dialog-fork-DkJI84a4.js} +1 -1
  19. package/assets/{dialog-project-upload-Bs1_9kHj.js → dialog-project-upload-psziojzJ.js} +1 -1
  20. package/assets/{dialog-select-file-BrLiSa0e.js → dialog-select-file-8jAfsF2L.js} +1 -1
  21. package/assets/{dialog-select-model-CMF-xmbD.js → dialog-select-model-BRGl8eYL.js} +2 -2
  22. package/assets/{dialog-terminal-unavailable-BOUZ3KsI.js → dialog-terminal-unavailable-CmPSnZv2.js} +1 -1
  23. package/assets/{docs-BzOnK23f.js → docs-CJtqscRw.js} +1 -1
  24. package/assets/{ghostty-web-l4q7-PU1.js → ghostty-web-CLe6azmW.js} +1 -1
  25. package/assets/{home-C3y_A1-6.js → home-DkfYlE_p.js} +1 -1
  26. package/assets/{index-BfLPI17v.js → index-CL0Pu3hA.js} +11 -11
  27. package/assets/{index-BwtL4rk2.css → index-FpOsJHB5.css} +1 -1
  28. package/assets/{intro-BJgVhMkF.js → intro-CnBmc9av.js} +1 -1
  29. package/assets/{nope-02-CruCGsk0.js → nope-02-BFEihmx0.js} +1 -1
  30. package/assets/{nope-05-Dxj-phOs.js → nope-05-bIRVhEuo.js} +1 -1
  31. package/assets/{nope-08-DcEjC0yF.js → nope-08-BNa8k6os.js} +1 -1
  32. package/assets/{nope-11-Dkkp3vCv.js → nope-11-DPrg_zNt.js} +1 -1
  33. package/assets/nope-12-DZ5PbjRd.js +1 -0
  34. package/assets/{onescience-DMXJ1nYb.js → onescience-CgkFGllp.js} +1 -1
  35. package/assets/{resources-BtRvjjW6.js → resources-DCizhkUZ.js} +1 -1
  36. package/assets/{selection-BDKVpung.js → selection-CynHR4Ge.js} +1 -1
  37. package/assets/{shell-M6Hcceef.js → shell-CYsw1ww_.js} +2 -2
  38. package/assets/{skills-Cr1Txx6V.js → skills-7bBjsBjk.js} +1 -1
  39. package/assets/{staplebops-03-C9ZA5vYl.js → staplebops-03-C9N14eC7.js} +1 -1
  40. package/assets/{staplebops-04-C8RBLMc9.js → staplebops-04-D6NyyK-L.js} +1 -1
  41. package/assets/{staplebops-06-hRBlO_Jx.js → staplebops-06-DIW8XyYA.js} +1 -1
  42. package/assets/{staplebops-07-C4Pmn4wy.js → staplebops-07-CvKLtcio.js} +1 -1
  43. package/assets/{status-popover-body-CwhO-ly1.js → status-popover-body-C6YlzCII.js} +2 -2
  44. package/assets/{wizard-DfNLXs5i.js → wizard-52y7g6ST.js} +1 -1
  45. package/assets/{yup-01-CCyquaXC.js → yup-01-BWSdA5jG.js} +1 -1
  46. package/assets/{yup-03-DUKtblGi.js → yup-03-BVuLt3ld.js} +1 -1
  47. package/assets/{yup-04-Djw3oL2g.js → yup-04-D9JsyR5u.js} +1 -1
  48. package/assets/{yup-05-BPnDQKpc.js → yup-05-BdiPGcTI.js} +1 -1
  49. package/index.html +11 -11
  50. package/package.json +2 -2
  51. package/assets/alert-06-CdNX1MFF.js +0 -1
  52. package/assets/alert-07-D8bcb829.js +0 -1
  53. package/assets/alert-08-DwxXD9Jv.js +0 -1
  54. package/assets/alert-10-O1JGraHb.js +0 -1
  55. package/assets/bip-bop-09-Ba1Kwga0.js +0 -1
  56. package/assets/nope-12-DAx93zTR.js +0 -1
@@ -1,4 +1,4 @@
1
- import{eb as getDefaultExportFromCjs}from"./index-BfLPI17v.js";function _mergeNamespaces(K,D){for(var c=0;c<D.length;c++){const y=D[c];if(typeof y!="string"&&!Array.isArray(y)){for(const O in y)if(O!=="default"&&!(O in K)){const w=Object.getOwnPropertyDescriptor(y,O);w&&Object.defineProperty(K,O,w.get?w:{enumerable:!0,get:()=>y[O]})}}}return Object.freeze(Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}))}var _3Dmol$3={exports:{}};/*!
1
+ import{eb as getDefaultExportFromCjs}from"./index-CL0Pu3hA.js";function _mergeNamespaces(K,D){for(var c=0;c<D.length;c++){const y=D[c];if(typeof y!="string"&&!Array.isArray(y)){for(const O in y)if(O!=="default"&&!(O in K)){const w=Object.getOwnPropertyDescriptor(y,O);w&&Object.defineProperty(K,O,w.get?w:{enumerable:!0,get:()=>y[O]})}}}return Object.freeze(Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}))}var _3Dmol$3={exports:{}};/*!
2
2
  * 3dmol v2.5.5
3
3
  * JavaScript/TypeScript molecular visualization library
4
4
  * Author: David Koes and contributors
@@ -1 +1 @@
1
- import{k as ee,f as W,u as de,m as me,bf as N,ag as te,i,c as C,n as V,o as Y,t as v,b as we,S as k,R as z,Q as f,T as E,dv as ve,aB as ge,br as _e,cB as Ce,cC as ye,a5 as xe,M as Se,r as Pe,cD as fe,dw as ke,dx as pe,dy as qe,dz as Ae,dA as Me,dB as Te,dC as De,dD as Ee,cS as oe,dE as Ue,_ as le,dF as Re}from"./index-BfLPI17v.js";var G=v("<p class=os-auth-error>"),He=v('<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">'),Le=v("<div class=os-auth-links><span>还没有账号?</span><a>创建账号</a><a>忘记密码?"),Fe=v("<p>"),Ie=v('<div class=os-auth-email-verify><button type=button class="os-button os-button-secondary os-auth-submit"></button><label><span></span><input autocomplete=one-time-code>'),Ne=v("<label><span>邀请码</span><input autocomplete=one-time-code placeholder=请输入邀请码><small class=os-auth-hint>当前已开启注册审核,需填写有效邀请码才能注册。"),ze=v('<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">'),Be=v("<div class=os-auth-links><span>已有账号?</span><a>去登录"),je=v('<p class=os-auth-hint style="margin:0 0 0.35rem">通过注册邮箱获取验证码后重置密码。若无法收到邮件,请联系管理员。'),Z=v("<p class=os-account-success>"),Oe=v('<form class=os-auth-form><label><span>账号邮箱</span><input autocomplete=email inputmode=email placeholder=name@example.com></label><button type=submit class="os-button os-button-secondary os-auth-submit">'),Ve=v("<label><span>邮件验证码</span><input autocomplete=one-time-code placeholder=输入邮件中的验证码>"),We=v('<form class=os-auth-form><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">'),Ge=v("<div class=os-auth-links><a>返回登录</a><a>创建账号"),Qe=v('<p class=os-auth-hint style="margin:0 0 0.35rem">请设置新密码以完成重置。'),Je=v("<main class=os-account-page><div class=os-account-shell>"),Ke=v("<section class=os-account-loading><strong>正在加载账号信息</strong><span>请稍候"),Xe=v('<section class=os-account-empty-state><strong></strong><span>登录后可以查看账号资料和开发空间。</span><a href="/login?redirect=%2Faccount"class="os-button os-button-primary">去登录'),Ye=v('<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">'),Ze=v("<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>"),et=v('<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">'),tt=v('<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">'),rt=v("<main class=os-auth-page><section class=os-auth-shell><button type=button class=os-auth-dismiss aria-label=关闭并返回浏览><span aria-hidden=true>×</span></button><section class=os-auth-panel><a class=os-auth-brand href=/></a><div class=os-auth-links><button type=button class=os-auth-link-button>暂不登录,继续浏览");function dt(){const l=ee(),u=W(),[d,_]=N({name:"",email:"",password:"",confirmPassword:"",submitting:!1,error:""}),x=()=>typeof d.lockedUntil=="number"&&d.lockedUntil>Date.now(),a=async t=>{if(t.preventDefault(),x()){_("error",`尝试次数过多,请在 ${ct(d.lockedUntil-Date.now())} 后重试`);return}if(!d.email.trim()||!d.password){_("error","请输入账户/邮箱和密码");return}_({submitting:!0,error:"",lockedUntil:void 0});try{await fe(await ke({email:d.email.trim(),password:d.password}),l.storage),u(pe(location.search),{replace:!0});return}catch(m){const w=m instanceof Error&&"retryAfterMs"in m?Number(m.retryAfterMs):void 0;_({error:m instanceof Error?m.message:"登录失败,请稍后重试",submitting:!1,lockedUntil:typeof w=="number"&&w>0?Date.now()+w:void 0})}};return C(re,{mode:"login",get children(){return[(()=>{var t=He(),m=t.firstChild,w=m.firstChild,S=w.nextSibling,r=m.nextSibling,e=r.firstChild,o=e.nextSibling,p=r.nextSibling;return t.addEventListener("submit",a),S.$$input=n=>_("email",n.currentTarget.value),o.$$input=n=>_("password",n.currentTarget.value),i(t,C(k,{get when(){return d.error},get children(){var n=G();return i(n,()=>d.error),n}}),p),i(p,(()=>{var n=z(()=>!!d.submitting);return()=>n()?"正在登录...":x()?"已锁定,请稍后重试":"登录"})()),f(n=>{var h=d.submitting,s=d.submitting,c=d.submitting||x();return h!==n.e&&(S.disabled=n.e=h),s!==n.t&&(o.disabled=n.t=s),c!==n.a&&(p.disabled=n.a=c),n},{e:void 0,t:void 0,a:void 0}),f(()=>S.value=d.email),f(()=>o.value=d.password),t})(),(()=>{var t=Le(),m=t.firstChild,w=m.nextSibling,S=w.nextSibling;return f(r=>{var e=`/register${location.search}`,o=`/forgot-password${location.search}`;return e!==r.e&&E(w,"href",r.e=e),o!==r.t&&E(S,"href",r.t=o),r},{e:void 0,t:void 0}),t})()]}})}function mt(){const l=ee(),u=W(),[d,_]=V(!1),[x,a]=V(!1),[t,m]=V(!1),[w,S]=V(Date.now()),[r,e]=N({name:"",email:"",password:"",confirmPassword:"",inviteCode:"",emailCode:"",submitting:!1,requestingCode:!1,requestHint:"",cooldownUntil:0,error:""});te(()=>{ve().then(c=>{_(!!c.inviteRequired),a(!!c.emailVerificationRequired)}).catch(()=>{_(!1),a(!1)});const s=window.setInterval(()=>S(Date.now()),250);ge(()=>window.clearInterval(s))});const o=Y(()=>Math.max(0,Math.ceil(((r.cooldownUntil??0)-w())/1e3))),p=Y(()=>o()>0),n=async()=>{if(r.requestingCode||r.submitting||p())return;const s=ue(r.email);if(s){e({error:s,requestHint:""});return}e({requestingCode:!0,error:"",requestHint:""});try{const c=await Te({email:r.email.trim()}),b=typeof c.retryAfterMs=="number"&&c.retryAfterMs>0?c.retryAfterMs:6e4;if(c.smtpUnreachable){m(!0),e({requestingCode:!1,requestHint:"无法连接邮件服务器,本次注册无需填写验证码。找回密码仍须邮件验证,收不到验证码请联系管理员。",error:"",cooldownUntil:Date.now()+b});return}m(!1),e({requestingCode:!1,requestHint:"验证码已发送,请查收邮箱后填入下方。",error:"",cooldownUntil:Date.now()+b})}catch(c){const b=c instanceof Error&&"retryAfterMs"in c?Number(c.retryAfterMs):void 0;e({requestingCode:!1,error:c instanceof Error?c.message:"发送验证码失败,请稍后重试",requestHint:"",...typeof b=="number"&&b>0?{cooldownUntil:Date.now()+b}:{}})}},h=async s=>{if(s.preventDefault(),!r.name.trim()||!r.email.trim()||!r.password){e("error","请输入账户、邮箱和密码");return}const c=lt(r.name);if(c){e("error",c);return}const b=ue(r.email);if(b){e("error",b);return}if(d()&&!(r.inviteCode??"").trim()){e("error","请填写邀请码");return}if(x()&&!t()&&!(r.emailCode??"").trim()){e("error","请填写邮箱验证码");return}if(r.password.length<8){e("error","密码至少需要 8 位");return}if(r.password!==r.confirmPassword){e("error","两次输入的密码不一致");return}e({submitting:!0,error:""});try{await fe(await Me({name:r.name.trim().toLowerCase(),email:r.email.trim(),password:r.password,...r.inviteCode?.trim()?{inviteCode:r.inviteCode.trim()}:{},...x()&&r.emailCode?.trim()?{emailCode:r.emailCode.trim()}:{}}),l.storage),u(pe(location.search),{replace:!0})}catch(g){e("error",g instanceof Error?g.message:"注册失败,请稍后重试"),e("submitting",!1)}};return C(re,{mode:"register",get children(){return[(()=>{var s=ze(),c=s.firstChild,b=c.firstChild,g=b.nextSibling,q=c.nextSibling,P=q.firstChild,M=P.nextSibling,U=q.nextSibling,F=U.firstChild,R=F.nextSibling,H=U.nextSibling,Q=H.firstChild,J=Q.nextSibling,B=H.nextSibling;return s.addEventListener("submit",h),g.$$input=$=>e("name",$.currentTarget.value),E(g,"spellcheck",!1),M.$$input=$=>{e("email",$.currentTarget.value),m(!1)},i(s,C(k,{get when(){return x()},get children(){var $=Ie(),T=$.firstChild,D=T.nextSibling,I=D.firstChild,L=I.nextSibling;return T.$$click=()=>void n(),i(T,(()=>{var y=z(()=>!!r.requestingCode);return()=>y()?"正在发送...":z(()=>!!p())()?`重新发送 (${o()}s)`:"发送验证码"})()),i($,C(k,{get when(){return r.requestHint},get children(){var y=Fe();return i(y,()=>r.requestHint),f(()=>_e(y,t()?"os-auth-hint":"os-account-success")),y}}),D),i(I,()=>t()?"邮箱验证码(可不填)":"邮箱验证码"),L.$$input=y=>e("emailCode",y.currentTarget.value),E(L,"spellcheck",!1),f(y=>{var j=r.requestingCode||r.submitting||p()||!r.email.trim(),K=t()?"邮件服务器不可达,可留空":"输入邮件中的验证码",O=r.submitting;return j!==y.e&&(T.disabled=y.e=j),K!==y.t&&E(L,"placeholder",y.t=K),O!==y.a&&(L.disabled=y.a=O),y},{e:void 0,t:void 0,a:void 0}),f(()=>L.value=r.emailCode??""),$}}),U),i(s,C(k,{get when(){return d()},get children(){var $=Ne(),T=$.firstChild,D=T.nextSibling;return D.$$input=I=>e("inviteCode",I.currentTarget.value),E(D,"spellcheck",!1),f(()=>D.value=r.inviteCode??""),$}}),U),R.$$input=$=>e("password",$.currentTarget.value),J.$$input=$=>e("confirmPassword",$.currentTarget.value),i(s,C(k,{get when(){return r.error},get children(){var $=G();return i($,()=>r.error),$}}),B),i(B,()=>r.submitting?"正在创建...":"创建账号"),f($=>{var T=r.submitting||r.requestingCode,D=r.submitting;return T!==$.e&&(M.disabled=$.e=T),D!==$.t&&(B.disabled=$.t=D),$},{e:void 0,t:void 0}),f(()=>g.value=r.name),f(()=>M.value=r.email),f(()=>R.value=r.password),f(()=>J.value=r.confirmPassword),s})(),(()=>{var s=Be(),c=s.firstChild,b=c.nextSibling;return f(()=>E(b,"href",`/login${location.search}`)),s})()]}})}function gt(){const l=W(),u=typeof location<"u"?new URLSearchParams(location.search).get("token")?.trim()??"":"",d=!!u,[_,x]=V(Date.now()),[a,t]=N({email:"",token:u,newPassword:"",confirmPassword:"",requesting:!1,submitting:!1,error:"",success:"",requestHint:"",cooldownUntil:0});te(()=>{const e=window.setInterval(()=>x(Date.now()),250);ge(()=>window.clearInterval(e))});const m=Y(()=>Math.max(0,Math.ceil((a.cooldownUntil-_())/1e3))),w=Y(()=>m()>0),S=async()=>{if(!(a.requesting||a.submitting||w())){if(!a.email.trim()){t({error:"请输入账号邮箱",success:"",requestHint:""});return}t({requesting:!0,error:"",success:"",requestHint:""});try{const e=await De({email:a.email.trim()}),o=typeof e.retryAfterMs=="number"&&e.retryAfterMs>0?e.retryAfterMs:6e4;t({requesting:!1,requestHint:"若该邮箱已注册,验证码将发送至邮箱。请查收后在下方完成重置。",error:"",cooldownUntil:Date.now()+o})}catch(e){const o=e instanceof Error&&"retryAfterMs"in e?Number(e.retryAfterMs):void 0;t({requesting:!1,error:e instanceof Error?e.message:"发送验证码失败,请稍后重试",requestHint:"",...typeof o=="number"&&o>0?{cooldownUntil:Date.now()+o}:{}})}}},r=async e=>{if(e.preventDefault(),!a.token.trim()){t({error:"请输入邮件验证码",success:""});return}if(a.newPassword.length<8){t({error:"新密码至少需要 8 位",success:""});return}if(a.newPassword!==a.confirmPassword){t({error:"两次输入的新密码不一致",success:""});return}t({submitting:!0,error:"",success:""});try{await Ee({token:a.token.trim(),newPassword:a.newPassword}),t({submitting:!1,error:"",success:"密码已重置,请使用新密码登录",newPassword:"",confirmPassword:""});const o=new URLSearchParams(location.search);o.delete("token");const p=o.toString();window.setTimeout(()=>l(`/login${p?`?${p}`:""}`,{replace:!0}),1200)}catch(o){t({submitting:!1,error:o instanceof Error?o.message:"重置密码失败,请稍后重试",success:""})}};return C(re,{mode:"forgot-password",get children(){return[C(k,{when:!d,get fallback(){return Qe()},get children(){return je()}}),C(k,{when:!d,get children(){var e=Oe(),o=e.firstChild,p=o.firstChild,n=p.nextSibling,h=o.nextSibling;return e.addEventListener("submit",s=>{s.preventDefault(),S()}),n.$$input=s=>t("email",s.currentTarget.value),i(h,(()=>{var s=z(()=>!!a.requesting);return()=>s()?"正在发送...":z(()=>!!w())()?`重新发送 (${m()}s)`:"获取验证码"})()),i(e,C(k,{get when(){return a.requestHint},get children(){var s=Z();return i(s,()=>a.requestHint),s}}),null),f(s=>{var c=a.requesting||a.submitting,b=a.requesting||a.submitting||w()||!a.email.trim();return c!==s.e&&(n.disabled=s.e=c),b!==s.t&&(h.disabled=s.t=b),s},{e:void 0,t:void 0}),f(()=>n.value=a.email),e}}),(()=>{var e=We(),o=e.firstChild,p=o.firstChild,n=p.nextSibling,h=o.nextSibling,s=h.firstChild,c=s.nextSibling,b=h.nextSibling;return e.addEventListener("submit",r),i(e,C(k,{when:!d,get children(){var g=Ve(),q=g.firstChild,P=q.nextSibling;return P.$$input=M=>t("token",M.currentTarget.value),f(()=>P.disabled=a.submitting),f(()=>P.value=a.token),g}}),o),n.$$input=g=>t("newPassword",g.currentTarget.value),c.$$input=g=>t("confirmPassword",g.currentTarget.value),i(e,C(k,{get when(){return a.error},get children(){var g=G();return i(g,()=>a.error),g}}),b),i(e,C(k,{get when(){return a.success},get children(){var g=Z();return i(g,()=>a.success),g}}),b),i(b,()=>a.submitting?"正在重置...":"重置密码"),f(g=>{var q=a.submitting,P=a.submitting,M=a.submitting;return q!==g.e&&(n.disabled=g.e=q),P!==g.t&&(c.disabled=g.t=P),M!==g.a&&(b.disabled=g.a=M),g},{e:void 0,t:void 0,a:void 0}),f(()=>n.value=a.newPassword),f(()=>c.value=a.confirmPassword),e})(),(()=>{var e=Ge(),o=e.firstChild,p=o.nextSibling;return f(n=>{var h=`/login${location.search}`,s=`/register${location.search}`;return h!==n.e&&E(o,"href",n.e=h),s!==n.t&&E(p,"href",n.t=s),n},{e:void 0,t:void 0}),e})()]}})}function ft(){const l=ee(),u=W(),d=de(),_=me(),[x,a]=N({loading:!0,error:""}),[t,m]=N({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:""});te(()=>{const o=Ce();if(!o){a({loading:!1,error:"当前未登录"});return}ye(o).then(p=>a({session:p,loading:!1,error:""})).catch(p=>a({loading:!1,error:p instanceof Error?p.message:"会话已失效"}))});const w=()=>{if(l.platform==="desktop"){u("/login",{replace:!0});return}location.assign("/login")},S=()=>{oe(l.storage).finally(()=>w())},r=async()=>{try{await Ue(),le({variant:"success",icon:"circle-check",title:d.t("account.deleteAccount.toast.success")}),await oe(l.storage),w()}catch(o){le({variant:"error",title:d.t("account.deleteAccount.toast.error"),description:o instanceof Error?o.message:"请稍后重试"})}},e=async(o,p)=>{if(o.preventDefault(),!t.currentPassword||!t.newPassword||!t.confirmPassword){m({error:"请输入当前密码和新密码",success:""});return}if(t.newPassword.length<8){m({error:"新密码至少需要 8 位",success:""});return}if(t.currentPassword===t.newPassword){m({error:"新密码不能与当前密码相同",success:""});return}if(t.newPassword!==t.confirmPassword){m({error:"两次输入的新密码不一致",success:""});return}m({submitting:!0,error:"",success:""});try{await Re({accountId:p.account.id,currentPassword:t.currentPassword,newPassword:t.newPassword}),m({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:"密码已更新,下次登录请使用新密码"})}catch(n){m({submitting:!1,error:n instanceof Error?n.message:"修改密码失败,请稍后重试",success:""})}};return(()=>{var o=Je(),p=o.firstChild;return i(p,C(k,{get when(){return!x.loading},get fallback(){return Ke()},get children(){return C(k,{get when(){return x.session},get fallback(){return(()=>{var n=Xe(),h=n.firstChild,s=h.nextSibling;return s.nextSibling,i(h,()=>x.error||"当前未登录"),n})()},children:n=>[(()=>{var h=Ye(),s=h.firstChild,c=s.firstChild,b=c.nextSibling,g=b.firstChild,q=g.nextSibling,P=q.nextSibling,M=s.nextSibling,U=M.firstChild,F=U.nextSibling,R=F.nextSibling,H=R.nextSibling;return i(c,()=>st(n().account.name,n().account.email)),i(q,()=>n().account.name),i(P,()=>n().account.email),i(U,()=>at(n().account.status)),R.$$click=S,H.$$click=()=>_.show(()=>C(nt,{onConfirm:r})),i(H,()=>d.t("account.deleteAccount.button")),h})(),(()=>{var h=Ze(),s=h.firstChild,c=s.firstChild,b=c.nextSibling,g=b.nextSibling,q=s.nextSibling,P=q.firstChild;return i(g,()=>d.t("account.defaultProject.description")),i(P,()=>ce(n())||"未分配"),f(()=>E(P,"title",ce(n()))),h})(),(()=>{var h=et(),s=h.firstChild,c=s.firstChild,b=c.firstChild,g=b.nextSibling,q=g.firstChild,P=q.nextSibling;P.nextSibling;var M=c.nextSibling,U=M.nextSibling,F=U.firstChild,R=F.firstChild,H=R.nextSibling,Q=F.nextSibling,J=Q.firstChild,B=J.nextSibling,$=Q.nextSibling,T=$.firstChild,D=T.nextSibling,I=s.nextSibling,L=I.firstChild,y=L.nextSibling,j=y.firstChild,K=j.firstChild,O=K.nextSibling,ne=j.nextSibling,he=ne.firstChild,se=he.nextSibling,ae=ne.nextSibling,$e=ae.firstChild,ie=$e.nextSibling,X=ae.nextSibling;return i(g,()=>ot(n().expiresAt),P),i(H,()=>n().account.name),i(B,()=>n().account.email),i(D,()=>it(n().account.timeCreated)),y.addEventListener("submit",A=>e(A,n())),O.$$input=A=>m("currentPassword",A.currentTarget.value),se.$$input=A=>m("newPassword",A.currentTarget.value),ie.$$input=A=>m("confirmPassword",A.currentTarget.value),i(y,C(k,{get when(){return t.error},get children(){var A=G();return i(A,()=>t.error),A}}),X),i(y,C(k,{get when(){return t.success},get children(){var A=Z();return i(A,()=>t.success),A}}),X),i(X,()=>t.submitting?"正在更新...":"更新密码"),f(()=>X.disabled=t.submitting),f(()=>O.value=t.currentPassword),f(()=>se.value=t.newPassword),f(()=>ie.value=t.confirmPassword),h})()]})}})),o})()}function nt(l){const u=de(),d=me(),[_,x]=N({submitting:!1,error:""}),a=async()=>{x({submitting:!0,error:""});try{await l.onConfirm(),d.close()}catch(t){x({submitting:!1,error:t instanceof Error?t.message:u.t("account.deleteAccount.toast.error")})}};return C(xe,{get title(){return u.t("account.deleteAccount.title")},fit:!0,transition:!0,get children(){var t=tt(),m=t.firstChild,w=m.nextSibling,S=w.firstChild,r=S.nextSibling;return i(m,()=>u.t("account.deleteAccount.description")),i(t,C(k,{get when(){return _.error},get children(){var e=G();return i(e,()=>_.error),e}}),w),S.$$click=()=>d.close(),i(S,()=>u.t("common.cancel")),r.$$click=a,i(r,(()=>{var e=z(()=>!!_.submitting);return()=>e()?"注销中...":u.t("account.deleteAccount.confirm")})()),f(e=>{var o=_.submitting,p=_.submitting;return o!==e.e&&(S.disabled=e.e=o),p!==e.t&&(r.disabled=e.t=p),e},{e:void 0,t:void 0}),t}})}function re(l){const u=W(),d=()=>{qe(),u(Ae(location.search),{replace:!0})};return(()=>{var _=rt(),x=_.firstChild,a=x.firstChild,t=a.nextSibling,m=t.firstChild,w=m.nextSibling,S=w.firstChild;return a.$$click=d,i(m,C(Se,{})),i(t,()=>l.children,w),S.$$click=d,f(()=>E(x,"data-mode",l.mode)),_})()}function st(l,u){return(l.trim()||u.trim()||"OS").slice(0,2).toUpperCase()}function at(l){return l==="active"?"正常":l==="frozen"?"已冻结":l==="limited"?"已限流":l==="pending"?"待激活":l||"未知"}function ce(l){return Pe(l)??""}function it(l){return l?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(be(l))):"未记录"}function ot(l){const u=Math.ceil(Math.max(0,be(l)-Date.now())/36e5);return u<=0?"已":u<24?`${u} 小时后`:`${Math.ceil(u/24)} 天后`}function lt(l){const u=l.trim().toLowerCase();return u?/^[a-z][a-z0-9._-]{2,31}$/.test(u)?u.includes("..")||u.endsWith(".")||u.startsWith(".")?"账户名不能以点开头/结尾,也不能包含连续的点":"":"账户名须为 3–32 位,以小写字母开头,仅含小写字母、数字、点、下划线或连字符":"请填写账户名"}function ue(l){const u=l.trim().toLowerCase();return!u||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u)||u.length>254?"请填写有效邮箱":""}function ct(l){const u=Math.max(1,Math.ceil(l/1e3));if(u<60)return`${u} 秒`;const d=Math.ceil(u/60);return d<60?`${d} 分钟`:"1 小时"}function be(l){return l<1e10?l*1e3:l}we(["input","click"]);export{ft as AccountCenterPage,gt as ForgotPasswordPage,dt as LoginPage,mt as RegisterPage};
1
+ import{k as ee,f as W,u as de,m as me,bf as N,ag as te,i,c as C,n as V,o as Y,t as v,b as we,S as k,R as z,Q as f,T as E,dv as ve,aB as ge,br as _e,cB as Ce,cC as ye,a5 as xe,M as Se,r as Pe,cD as fe,dw as ke,dx as pe,dy as qe,dz as Ae,dA as Me,dB as Te,dC as De,dD as Ee,cS as oe,dE as Ue,_ as le,dF as Re}from"./index-CL0Pu3hA.js";var G=v("<p class=os-auth-error>"),He=v('<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">'),Le=v("<div class=os-auth-links><span>还没有账号?</span><a>创建账号</a><a>忘记密码?"),Fe=v("<p>"),Ie=v('<div class=os-auth-email-verify><button type=button class="os-button os-button-secondary os-auth-submit"></button><label><span></span><input autocomplete=one-time-code>'),Ne=v("<label><span>邀请码</span><input autocomplete=one-time-code placeholder=请输入邀请码><small class=os-auth-hint>当前已开启注册审核,需填写有效邀请码才能注册。"),ze=v('<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">'),Be=v("<div class=os-auth-links><span>已有账号?</span><a>去登录"),je=v('<p class=os-auth-hint style="margin:0 0 0.35rem">通过注册邮箱获取验证码后重置密码。若无法收到邮件,请联系管理员。'),Z=v("<p class=os-account-success>"),Oe=v('<form class=os-auth-form><label><span>账号邮箱</span><input autocomplete=email inputmode=email placeholder=name@example.com></label><button type=submit class="os-button os-button-secondary os-auth-submit">'),Ve=v("<label><span>邮件验证码</span><input autocomplete=one-time-code placeholder=输入邮件中的验证码>"),We=v('<form class=os-auth-form><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">'),Ge=v("<div class=os-auth-links><a>返回登录</a><a>创建账号"),Qe=v('<p class=os-auth-hint style="margin:0 0 0.35rem">请设置新密码以完成重置。'),Je=v("<main class=os-account-page><div class=os-account-shell>"),Ke=v("<section class=os-account-loading><strong>正在加载账号信息</strong><span>请稍候"),Xe=v('<section class=os-account-empty-state><strong></strong><span>登录后可以查看账号资料和开发空间。</span><a href="/login?redirect=%2Faccount"class="os-button os-button-primary">去登录'),Ye=v('<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">'),Ze=v("<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>"),et=v('<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">'),tt=v('<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">'),rt=v("<main class=os-auth-page><section class=os-auth-shell><button type=button class=os-auth-dismiss aria-label=关闭并返回浏览><span aria-hidden=true>×</span></button><section class=os-auth-panel><a class=os-auth-brand href=/></a><div class=os-auth-links><button type=button class=os-auth-link-button>暂不登录,继续浏览");function dt(){const l=ee(),u=W(),[d,_]=N({name:"",email:"",password:"",confirmPassword:"",submitting:!1,error:""}),x=()=>typeof d.lockedUntil=="number"&&d.lockedUntil>Date.now(),a=async t=>{if(t.preventDefault(),x()){_("error",`尝试次数过多,请在 ${ct(d.lockedUntil-Date.now())} 后重试`);return}if(!d.email.trim()||!d.password){_("error","请输入账户/邮箱和密码");return}_({submitting:!0,error:"",lockedUntil:void 0});try{await fe(await ke({email:d.email.trim(),password:d.password}),l.storage),u(pe(location.search),{replace:!0});return}catch(m){const w=m instanceof Error&&"retryAfterMs"in m?Number(m.retryAfterMs):void 0;_({error:m instanceof Error?m.message:"登录失败,请稍后重试",submitting:!1,lockedUntil:typeof w=="number"&&w>0?Date.now()+w:void 0})}};return C(re,{mode:"login",get children(){return[(()=>{var t=He(),m=t.firstChild,w=m.firstChild,S=w.nextSibling,r=m.nextSibling,e=r.firstChild,o=e.nextSibling,p=r.nextSibling;return t.addEventListener("submit",a),S.$$input=n=>_("email",n.currentTarget.value),o.$$input=n=>_("password",n.currentTarget.value),i(t,C(k,{get when(){return d.error},get children(){var n=G();return i(n,()=>d.error),n}}),p),i(p,(()=>{var n=z(()=>!!d.submitting);return()=>n()?"正在登录...":x()?"已锁定,请稍后重试":"登录"})()),f(n=>{var h=d.submitting,s=d.submitting,c=d.submitting||x();return h!==n.e&&(S.disabled=n.e=h),s!==n.t&&(o.disabled=n.t=s),c!==n.a&&(p.disabled=n.a=c),n},{e:void 0,t:void 0,a:void 0}),f(()=>S.value=d.email),f(()=>o.value=d.password),t})(),(()=>{var t=Le(),m=t.firstChild,w=m.nextSibling,S=w.nextSibling;return f(r=>{var e=`/register${location.search}`,o=`/forgot-password${location.search}`;return e!==r.e&&E(w,"href",r.e=e),o!==r.t&&E(S,"href",r.t=o),r},{e:void 0,t:void 0}),t})()]}})}function mt(){const l=ee(),u=W(),[d,_]=V(!1),[x,a]=V(!1),[t,m]=V(!1),[w,S]=V(Date.now()),[r,e]=N({name:"",email:"",password:"",confirmPassword:"",inviteCode:"",emailCode:"",submitting:!1,requestingCode:!1,requestHint:"",cooldownUntil:0,error:""});te(()=>{ve().then(c=>{_(!!c.inviteRequired),a(!!c.emailVerificationRequired)}).catch(()=>{_(!1),a(!1)});const s=window.setInterval(()=>S(Date.now()),250);ge(()=>window.clearInterval(s))});const o=Y(()=>Math.max(0,Math.ceil(((r.cooldownUntil??0)-w())/1e3))),p=Y(()=>o()>0),n=async()=>{if(r.requestingCode||r.submitting||p())return;const s=ue(r.email);if(s){e({error:s,requestHint:""});return}e({requestingCode:!0,error:"",requestHint:""});try{const c=await Te({email:r.email.trim()}),b=typeof c.retryAfterMs=="number"&&c.retryAfterMs>0?c.retryAfterMs:6e4;if(c.smtpUnreachable){m(!0),e({requestingCode:!1,requestHint:"无法连接邮件服务器,本次注册无需填写验证码。找回密码仍须邮件验证,收不到验证码请联系管理员。",error:"",cooldownUntil:Date.now()+b});return}m(!1),e({requestingCode:!1,requestHint:"验证码已发送,请查收邮箱后填入下方。",error:"",cooldownUntil:Date.now()+b})}catch(c){const b=c instanceof Error&&"retryAfterMs"in c?Number(c.retryAfterMs):void 0;e({requestingCode:!1,error:c instanceof Error?c.message:"发送验证码失败,请稍后重试",requestHint:"",...typeof b=="number"&&b>0?{cooldownUntil:Date.now()+b}:{}})}},h=async s=>{if(s.preventDefault(),!r.name.trim()||!r.email.trim()||!r.password){e("error","请输入账户、邮箱和密码");return}const c=lt(r.name);if(c){e("error",c);return}const b=ue(r.email);if(b){e("error",b);return}if(d()&&!(r.inviteCode??"").trim()){e("error","请填写邀请码");return}if(x()&&!t()&&!(r.emailCode??"").trim()){e("error","请填写邮箱验证码");return}if(r.password.length<8){e("error","密码至少需要 8 位");return}if(r.password!==r.confirmPassword){e("error","两次输入的密码不一致");return}e({submitting:!0,error:""});try{await fe(await Me({name:r.name.trim().toLowerCase(),email:r.email.trim(),password:r.password,...r.inviteCode?.trim()?{inviteCode:r.inviteCode.trim()}:{},...x()&&r.emailCode?.trim()?{emailCode:r.emailCode.trim()}:{}}),l.storage),u(pe(location.search),{replace:!0})}catch(g){e("error",g instanceof Error?g.message:"注册失败,请稍后重试"),e("submitting",!1)}};return C(re,{mode:"register",get children(){return[(()=>{var s=ze(),c=s.firstChild,b=c.firstChild,g=b.nextSibling,q=c.nextSibling,P=q.firstChild,M=P.nextSibling,U=q.nextSibling,F=U.firstChild,R=F.nextSibling,H=U.nextSibling,Q=H.firstChild,J=Q.nextSibling,B=H.nextSibling;return s.addEventListener("submit",h),g.$$input=$=>e("name",$.currentTarget.value),E(g,"spellcheck",!1),M.$$input=$=>{e("email",$.currentTarget.value),m(!1)},i(s,C(k,{get when(){return x()},get children(){var $=Ie(),T=$.firstChild,D=T.nextSibling,I=D.firstChild,L=I.nextSibling;return T.$$click=()=>void n(),i(T,(()=>{var y=z(()=>!!r.requestingCode);return()=>y()?"正在发送...":z(()=>!!p())()?`重新发送 (${o()}s)`:"发送验证码"})()),i($,C(k,{get when(){return r.requestHint},get children(){var y=Fe();return i(y,()=>r.requestHint),f(()=>_e(y,t()?"os-auth-hint":"os-account-success")),y}}),D),i(I,()=>t()?"邮箱验证码(可不填)":"邮箱验证码"),L.$$input=y=>e("emailCode",y.currentTarget.value),E(L,"spellcheck",!1),f(y=>{var j=r.requestingCode||r.submitting||p()||!r.email.trim(),K=t()?"邮件服务器不可达,可留空":"输入邮件中的验证码",O=r.submitting;return j!==y.e&&(T.disabled=y.e=j),K!==y.t&&E(L,"placeholder",y.t=K),O!==y.a&&(L.disabled=y.a=O),y},{e:void 0,t:void 0,a:void 0}),f(()=>L.value=r.emailCode??""),$}}),U),i(s,C(k,{get when(){return d()},get children(){var $=Ne(),T=$.firstChild,D=T.nextSibling;return D.$$input=I=>e("inviteCode",I.currentTarget.value),E(D,"spellcheck",!1),f(()=>D.value=r.inviteCode??""),$}}),U),R.$$input=$=>e("password",$.currentTarget.value),J.$$input=$=>e("confirmPassword",$.currentTarget.value),i(s,C(k,{get when(){return r.error},get children(){var $=G();return i($,()=>r.error),$}}),B),i(B,()=>r.submitting?"正在创建...":"创建账号"),f($=>{var T=r.submitting||r.requestingCode,D=r.submitting;return T!==$.e&&(M.disabled=$.e=T),D!==$.t&&(B.disabled=$.t=D),$},{e:void 0,t:void 0}),f(()=>g.value=r.name),f(()=>M.value=r.email),f(()=>R.value=r.password),f(()=>J.value=r.confirmPassword),s})(),(()=>{var s=Be(),c=s.firstChild,b=c.nextSibling;return f(()=>E(b,"href",`/login${location.search}`)),s})()]}})}function gt(){const l=W(),u=typeof location<"u"?new URLSearchParams(location.search).get("token")?.trim()??"":"",d=!!u,[_,x]=V(Date.now()),[a,t]=N({email:"",token:u,newPassword:"",confirmPassword:"",requesting:!1,submitting:!1,error:"",success:"",requestHint:"",cooldownUntil:0});te(()=>{const e=window.setInterval(()=>x(Date.now()),250);ge(()=>window.clearInterval(e))});const m=Y(()=>Math.max(0,Math.ceil((a.cooldownUntil-_())/1e3))),w=Y(()=>m()>0),S=async()=>{if(!(a.requesting||a.submitting||w())){if(!a.email.trim()){t({error:"请输入账号邮箱",success:"",requestHint:""});return}t({requesting:!0,error:"",success:"",requestHint:""});try{const e=await De({email:a.email.trim()}),o=typeof e.retryAfterMs=="number"&&e.retryAfterMs>0?e.retryAfterMs:6e4;t({requesting:!1,requestHint:"若该邮箱已注册,验证码将发送至邮箱。请查收后在下方完成重置。",error:"",cooldownUntil:Date.now()+o})}catch(e){const o=e instanceof Error&&"retryAfterMs"in e?Number(e.retryAfterMs):void 0;t({requesting:!1,error:e instanceof Error?e.message:"发送验证码失败,请稍后重试",requestHint:"",...typeof o=="number"&&o>0?{cooldownUntil:Date.now()+o}:{}})}}},r=async e=>{if(e.preventDefault(),!a.token.trim()){t({error:"请输入邮件验证码",success:""});return}if(a.newPassword.length<8){t({error:"新密码至少需要 8 位",success:""});return}if(a.newPassword!==a.confirmPassword){t({error:"两次输入的新密码不一致",success:""});return}t({submitting:!0,error:"",success:""});try{await Ee({token:a.token.trim(),newPassword:a.newPassword}),t({submitting:!1,error:"",success:"密码已重置,请使用新密码登录",newPassword:"",confirmPassword:""});const o=new URLSearchParams(location.search);o.delete("token");const p=o.toString();window.setTimeout(()=>l(`/login${p?`?${p}`:""}`,{replace:!0}),1200)}catch(o){t({submitting:!1,error:o instanceof Error?o.message:"重置密码失败,请稍后重试",success:""})}};return C(re,{mode:"forgot-password",get children(){return[C(k,{when:!d,get fallback(){return Qe()},get children(){return je()}}),C(k,{when:!d,get children(){var e=Oe(),o=e.firstChild,p=o.firstChild,n=p.nextSibling,h=o.nextSibling;return e.addEventListener("submit",s=>{s.preventDefault(),S()}),n.$$input=s=>t("email",s.currentTarget.value),i(h,(()=>{var s=z(()=>!!a.requesting);return()=>s()?"正在发送...":z(()=>!!w())()?`重新发送 (${m()}s)`:"获取验证码"})()),i(e,C(k,{get when(){return a.requestHint},get children(){var s=Z();return i(s,()=>a.requestHint),s}}),null),f(s=>{var c=a.requesting||a.submitting,b=a.requesting||a.submitting||w()||!a.email.trim();return c!==s.e&&(n.disabled=s.e=c),b!==s.t&&(h.disabled=s.t=b),s},{e:void 0,t:void 0}),f(()=>n.value=a.email),e}}),(()=>{var e=We(),o=e.firstChild,p=o.firstChild,n=p.nextSibling,h=o.nextSibling,s=h.firstChild,c=s.nextSibling,b=h.nextSibling;return e.addEventListener("submit",r),i(e,C(k,{when:!d,get children(){var g=Ve(),q=g.firstChild,P=q.nextSibling;return P.$$input=M=>t("token",M.currentTarget.value),f(()=>P.disabled=a.submitting),f(()=>P.value=a.token),g}}),o),n.$$input=g=>t("newPassword",g.currentTarget.value),c.$$input=g=>t("confirmPassword",g.currentTarget.value),i(e,C(k,{get when(){return a.error},get children(){var g=G();return i(g,()=>a.error),g}}),b),i(e,C(k,{get when(){return a.success},get children(){var g=Z();return i(g,()=>a.success),g}}),b),i(b,()=>a.submitting?"正在重置...":"重置密码"),f(g=>{var q=a.submitting,P=a.submitting,M=a.submitting;return q!==g.e&&(n.disabled=g.e=q),P!==g.t&&(c.disabled=g.t=P),M!==g.a&&(b.disabled=g.a=M),g},{e:void 0,t:void 0,a:void 0}),f(()=>n.value=a.newPassword),f(()=>c.value=a.confirmPassword),e})(),(()=>{var e=Ge(),o=e.firstChild,p=o.nextSibling;return f(n=>{var h=`/login${location.search}`,s=`/register${location.search}`;return h!==n.e&&E(o,"href",n.e=h),s!==n.t&&E(p,"href",n.t=s),n},{e:void 0,t:void 0}),e})()]}})}function ft(){const l=ee(),u=W(),d=de(),_=me(),[x,a]=N({loading:!0,error:""}),[t,m]=N({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:""});te(()=>{const o=Ce();if(!o){a({loading:!1,error:"当前未登录"});return}ye(o).then(p=>a({session:p,loading:!1,error:""})).catch(p=>a({loading:!1,error:p instanceof Error?p.message:"会话已失效"}))});const w=()=>{if(l.platform==="desktop"){u("/login",{replace:!0});return}location.assign("/login")},S=()=>{oe(l.storage).finally(()=>w())},r=async()=>{try{await Ue(),le({variant:"success",icon:"circle-check",title:d.t("account.deleteAccount.toast.success")}),await oe(l.storage),w()}catch(o){le({variant:"error",title:d.t("account.deleteAccount.toast.error"),description:o instanceof Error?o.message:"请稍后重试"})}},e=async(o,p)=>{if(o.preventDefault(),!t.currentPassword||!t.newPassword||!t.confirmPassword){m({error:"请输入当前密码和新密码",success:""});return}if(t.newPassword.length<8){m({error:"新密码至少需要 8 位",success:""});return}if(t.currentPassword===t.newPassword){m({error:"新密码不能与当前密码相同",success:""});return}if(t.newPassword!==t.confirmPassword){m({error:"两次输入的新密码不一致",success:""});return}m({submitting:!0,error:"",success:""});try{await Re({accountId:p.account.id,currentPassword:t.currentPassword,newPassword:t.newPassword}),m({currentPassword:"",newPassword:"",confirmPassword:"",submitting:!1,error:"",success:"密码已更新,下次登录请使用新密码"})}catch(n){m({submitting:!1,error:n instanceof Error?n.message:"修改密码失败,请稍后重试",success:""})}};return(()=>{var o=Je(),p=o.firstChild;return i(p,C(k,{get when(){return!x.loading},get fallback(){return Ke()},get children(){return C(k,{get when(){return x.session},get fallback(){return(()=>{var n=Xe(),h=n.firstChild,s=h.nextSibling;return s.nextSibling,i(h,()=>x.error||"当前未登录"),n})()},children:n=>[(()=>{var h=Ye(),s=h.firstChild,c=s.firstChild,b=c.nextSibling,g=b.firstChild,q=g.nextSibling,P=q.nextSibling,M=s.nextSibling,U=M.firstChild,F=U.nextSibling,R=F.nextSibling,H=R.nextSibling;return i(c,()=>st(n().account.name,n().account.email)),i(q,()=>n().account.name),i(P,()=>n().account.email),i(U,()=>at(n().account.status)),R.$$click=S,H.$$click=()=>_.show(()=>C(nt,{onConfirm:r})),i(H,()=>d.t("account.deleteAccount.button")),h})(),(()=>{var h=Ze(),s=h.firstChild,c=s.firstChild,b=c.nextSibling,g=b.nextSibling,q=s.nextSibling,P=q.firstChild;return i(g,()=>d.t("account.defaultProject.description")),i(P,()=>ce(n())||"未分配"),f(()=>E(P,"title",ce(n()))),h})(),(()=>{var h=et(),s=h.firstChild,c=s.firstChild,b=c.firstChild,g=b.nextSibling,q=g.firstChild,P=q.nextSibling;P.nextSibling;var M=c.nextSibling,U=M.nextSibling,F=U.firstChild,R=F.firstChild,H=R.nextSibling,Q=F.nextSibling,J=Q.firstChild,B=J.nextSibling,$=Q.nextSibling,T=$.firstChild,D=T.nextSibling,I=s.nextSibling,L=I.firstChild,y=L.nextSibling,j=y.firstChild,K=j.firstChild,O=K.nextSibling,ne=j.nextSibling,he=ne.firstChild,se=he.nextSibling,ae=ne.nextSibling,$e=ae.firstChild,ie=$e.nextSibling,X=ae.nextSibling;return i(g,()=>ot(n().expiresAt),P),i(H,()=>n().account.name),i(B,()=>n().account.email),i(D,()=>it(n().account.timeCreated)),y.addEventListener("submit",A=>e(A,n())),O.$$input=A=>m("currentPassword",A.currentTarget.value),se.$$input=A=>m("newPassword",A.currentTarget.value),ie.$$input=A=>m("confirmPassword",A.currentTarget.value),i(y,C(k,{get when(){return t.error},get children(){var A=G();return i(A,()=>t.error),A}}),X),i(y,C(k,{get when(){return t.success},get children(){var A=Z();return i(A,()=>t.success),A}}),X),i(X,()=>t.submitting?"正在更新...":"更新密码"),f(()=>X.disabled=t.submitting),f(()=>O.value=t.currentPassword),f(()=>se.value=t.newPassword),f(()=>ie.value=t.confirmPassword),h})()]})}})),o})()}function nt(l){const u=de(),d=me(),[_,x]=N({submitting:!1,error:""}),a=async()=>{x({submitting:!0,error:""});try{await l.onConfirm(),d.close()}catch(t){x({submitting:!1,error:t instanceof Error?t.message:u.t("account.deleteAccount.toast.error")})}};return C(xe,{get title(){return u.t("account.deleteAccount.title")},fit:!0,transition:!0,get children(){var t=tt(),m=t.firstChild,w=m.nextSibling,S=w.firstChild,r=S.nextSibling;return i(m,()=>u.t("account.deleteAccount.description")),i(t,C(k,{get when(){return _.error},get children(){var e=G();return i(e,()=>_.error),e}}),w),S.$$click=()=>d.close(),i(S,()=>u.t("common.cancel")),r.$$click=a,i(r,(()=>{var e=z(()=>!!_.submitting);return()=>e()?"注销中...":u.t("account.deleteAccount.confirm")})()),f(e=>{var o=_.submitting,p=_.submitting;return o!==e.e&&(S.disabled=e.e=o),p!==e.t&&(r.disabled=e.t=p),e},{e:void 0,t:void 0}),t}})}function re(l){const u=W(),d=()=>{qe(),u(Ae(location.search),{replace:!0})};return(()=>{var _=rt(),x=_.firstChild,a=x.firstChild,t=a.nextSibling,m=t.firstChild,w=m.nextSibling,S=w.firstChild;return a.$$click=d,i(m,C(Se,{})),i(t,()=>l.children,w),S.$$click=d,f(()=>E(x,"data-mode",l.mode)),_})()}function st(l,u){return(l.trim()||u.trim()||"OS").slice(0,2).toUpperCase()}function at(l){return l==="active"?"正常":l==="frozen"?"已冻结":l==="limited"?"已限流":l==="pending"?"待激活":l||"未知"}function ce(l){return Pe(l)??""}function it(l){return l?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(be(l))):"未记录"}function ot(l){const u=Math.ceil(Math.max(0,be(l)-Date.now())/36e5);return u<=0?"已":u<24?`${u} 小时后`:`${Math.ceil(u/24)} 天后`}function lt(l){const u=l.trim().toLowerCase();return u?/^[a-z][a-z0-9._-]{2,31}$/.test(u)?u.includes("..")||u.endsWith(".")||u.startsWith(".")?"账户名不能以点开头/结尾,也不能包含连续的点":"":"账户名须为 3–32 位,以小写字母开头,仅含小写字母、数字、点、下划线或连字符":"请填写账户名"}function ue(l){const u=l.trim().toLowerCase();return!u||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u)||u.length>254?"请填写有效邮箱":""}function ct(l){const u=Math.max(1,Math.ceil(l/1e3));if(u<60)return`${u} 秒`;const d=Math.ceil(u/60);return d<60?`${d} 分钟`:"1 小时"}function be(l){return l<1e10?l*1e3:l}we(["input","click"]);export{ft as AccountCenterPage,gt as ForgotPasswordPage,dt as LoginPage,mt as RegisterPage};
@@ -1 +1 @@
1
- const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609071715/assets/alert-04-CaGsIGFP.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609071804/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-202609071715/assets/alert-05-D2gbGoRH.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609071804/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-202609071715/assets/alert-01-BuOD_o_q.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609071804/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-202609071715/assets/alert-02-CS75AsoP.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609071804/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-202609071804/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-202609071804/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-202609071804/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-202609071804/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-202609071715/assets/bip-bop-03-DXp7Zb0f.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609071804/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-202609071715/assets/bip-bop-04-CfVtpI7z.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609071804/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-202609071715/assets/bip-bop-06-BuvNosjK.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609071804/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-202609071715/assets/bip-bop-08-DBf7Bwjz.aac";export{e as default};
1
+ const e="https://cdn.jsdelivr.net/npm/@onescience/onecode-web@1.14.50-202609071804/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-202609071804/assets/bip-bop-09-CxEgoAHQ.aac";export{e as default};
@@ -1,4 +1,4 @@
1
- import{b as Ee,n as P,c as l,i as t,S as p,Q as k,a$ as Pt,t as i,b0 as Tt,X as Me,b1 as pt,b2 as Ne,aQ as Be,r as Ve,s as pe,aS as Ge,Z as gt,b3 as bt,Y as ht,_ as we,E as yt,b4 as Et,b5 as vt,b6 as $t,l as Re,h as Oe,e as Je,f as Ue,o as ne,aR as je,b7 as mt,b8 as Rt,x as ft,T as B,F as V,R as ce,g as Ye,ag as Qe,b9 as _t,ba as Ot,bb as Ut,bc as Ke,ak as wt,bd as jt,be as At,bf as qt,bg as Fe,bh as Kt,bi as rt,bj as Wt,bk as lt,aU as Ht,bl as xe,bm as Xe,bn as Mt,L as nt,bo as Qt}from"./index-BfLPI17v.js";import{m as Ft,O as zt,S as Nt,s as Bt}from"./onescience-DMXJ1nYb.js";import{d as Vt,r as Gt,s as it,w as Jt}from"./selection-BDKVpung.js";import{s as Yt,a as st,b as Xt,S as Zt}from"./wizard-DfNLXs5i.js";import"./onescience-docs-CH5KBTI9.js";var ea=i("<p class=os-client-capability-upload-error role=alert>"),ta=i('<div class=os-client-capability-wizard-overlay role=dialog aria-modal=true aria-label=上传私有模型><button type=button class=os-client-capability-wizard-backdrop aria-label=关闭上传></button><form class=os-client-capability-upload-dialog><header class=os-client-capability-upload-head><div class=os-client-capability-upload-head-copy><div class=os-client-capability-upload-eyebrow>私有资产 · 模型</div><h2>上传私有模型</h2><p>填写与模型卡片一致的基础信息。保存后会出现在当前领域的 onemodel 列表,并标注为私有资产。</p></div><button type=button class=os-client-capability-upload-close aria-label=关闭>×</button></header><div class=os-client-capability-upload-notice role=note><strong>后台登记为 AI 原语</strong><p>AI 原语是后台知识资产体系,不对用户单独展示。上传后会自动登记,供 Agent 检索与编排时利用该模型知识。</p></div><div class=os-client-capability-upload-body><label class=os-client-capability-upload-field><span>名称<span class=os-client-capability-upload-required> *</span></span><small>显示在模型卡片标题</small><input maxlength=64 required placeholder="例如:团队内部微调 MACE"></label><label class=os-client-capability-upload-field><span>简介<span class=os-client-capability-upload-required> *</span></span><small>对应卡片正文,建议 1–2 句说明用途与适用场景</small><textarea maxlength=160 required rows=3 placeholder="例如:面向界面体系的内部势函数,可用于弛豫与短时程 MD 冒烟"></textarea></label><div class=os-client-capability-upload-grid data-cols=2><label class=os-client-capability-upload-field><span>标签<span class=os-client-capability-upload-required> *</span></span><small>逗号分隔,将显示为卡片标签;系统会自动加上「私有」</small><input required placeholder="例如:mlff, 界面, 内部模型"></label><label class=os-client-capability-upload-field><span>领域</span><small>跟随当前能力中心领域,卡片会出现在该领域下</small><input class=is-readonly readonly></label></div></div><footer class=os-client-capability-upload-actions><button type=button>取消</button><button type=submit data-primary=true>保存并发布');function aa(e){return e.split(/[,,、]/).map(a=>a.trim()).filter(Boolean)}function ra(e){const[a,n]=P(""),[s,r]=P(""),[c,b]=P(""),[g,C]=P(""),D=()=>{n(""),r(""),b(""),C("")},_=()=>{D(),e.onClose()},f=u=>{u.preventDefault();const d=a().trim(),O=s().trim(),v=aa(c());if(!d||!O||v.length===0){C("请填写名称、简介和至少一个标签,以便生成与现有模型卡片一致的展示信息。");return}const M=Tt({name:d,blurb:O,tags:v,domain:e.domain});e.onSaved({id:M.id,name:M.name}),_()};return l(p,{get when(){return e.open},get children(){var u=ta(),d=u.firstChild,O=d.nextSibling,v=O.firstChild,M=v.firstChild,q=M.nextSibling,X=v.nextSibling,o=X.nextSibling,j=o.firstChild,ie=j.firstChild,Q=ie.nextSibling,G=Q.nextSibling,x=j.nextSibling,K=x.firstChild,F=K.nextSibling,h=F.nextSibling,I=x.nextSibling,w=I.firstChild,W=w.firstChild,Z=W.nextSibling,J=Z.nextSibling,S=w.nextSibling,z=S.firstChild,se=z.nextSibling,ge=se.nextSibling,$e=o.nextSibling,be=$e.firstChild;return d.$$click=_,O.addEventListener("submit",f),q.$$click=_,G.$$input=ae=>n(ae.currentTarget.value),h.$$input=ae=>r(ae.currentTarget.value),J.$$input=ae=>b(ae.currentTarget.value),t(O,l(p,{get when(){return g()},get children(){var ae=ea();return t(ae,g),ae}}),$e),be.$$click=_,k(()=>G.value=a()),k(()=>h.value=s()),k(()=>J.value=c()),k(()=>ge.value=Pt(e.domain)),u}})}Ee(["click","input"]);function la(e,a){return e.includes("modelscope download --model ")?e:`${e}
1
+ import{b as Ee,n as P,c as l,i as t,S as p,Q as k,a$ as Pt,t as i,b0 as Tt,X as Me,b1 as pt,b2 as Ne,aQ as Be,r as Ve,s as pe,aS as Ge,Z as gt,b3 as bt,Y as ht,_ as we,E as yt,b4 as Et,b5 as vt,b6 as $t,l as Re,h as Oe,e as Je,f as Ue,o as ne,aR as je,b7 as mt,b8 as Rt,x as ft,T as B,F as V,R as ce,g as Ye,ag as Qe,b9 as _t,ba as Ot,bb as Ut,bc as Ke,ak as wt,bd as jt,be as At,bf as qt,bg as Fe,bh as Kt,bi as rt,bj as Wt,bk as lt,aU as Ht,bl as xe,bm as Xe,bn as Mt,L as nt,bo as Qt}from"./index-CL0Pu3hA.js";import{m as Ft,O as zt,S as Nt,s as Bt}from"./onescience-CgkFGllp.js";import{d as Vt,r as Gt,s as it,w as Jt}from"./selection-CynHR4Ge.js";import{s as Yt,a as st,b as Xt,S as Zt}from"./wizard-52y7g6ST.js";import"./onescience-docs-CH5KBTI9.js";var ea=i("<p class=os-client-capability-upload-error role=alert>"),ta=i('<div class=os-client-capability-wizard-overlay role=dialog aria-modal=true aria-label=上传私有模型><button type=button class=os-client-capability-wizard-backdrop aria-label=关闭上传></button><form class=os-client-capability-upload-dialog><header class=os-client-capability-upload-head><div class=os-client-capability-upload-head-copy><div class=os-client-capability-upload-eyebrow>私有资产 · 模型</div><h2>上传私有模型</h2><p>填写与模型卡片一致的基础信息。保存后会出现在当前领域的 onemodel 列表,并标注为私有资产。</p></div><button type=button class=os-client-capability-upload-close aria-label=关闭>×</button></header><div class=os-client-capability-upload-notice role=note><strong>后台登记为 AI 原语</strong><p>AI 原语是后台知识资产体系,不对用户单独展示。上传后会自动登记,供 Agent 检索与编排时利用该模型知识。</p></div><div class=os-client-capability-upload-body><label class=os-client-capability-upload-field><span>名称<span class=os-client-capability-upload-required> *</span></span><small>显示在模型卡片标题</small><input maxlength=64 required placeholder="例如:团队内部微调 MACE"></label><label class=os-client-capability-upload-field><span>简介<span class=os-client-capability-upload-required> *</span></span><small>对应卡片正文,建议 1–2 句说明用途与适用场景</small><textarea maxlength=160 required rows=3 placeholder="例如:面向界面体系的内部势函数,可用于弛豫与短时程 MD 冒烟"></textarea></label><div class=os-client-capability-upload-grid data-cols=2><label class=os-client-capability-upload-field><span>标签<span class=os-client-capability-upload-required> *</span></span><small>逗号分隔,将显示为卡片标签;系统会自动加上「私有」</small><input required placeholder="例如:mlff, 界面, 内部模型"></label><label class=os-client-capability-upload-field><span>领域</span><small>跟随当前能力中心领域,卡片会出现在该领域下</small><input class=is-readonly readonly></label></div></div><footer class=os-client-capability-upload-actions><button type=button>取消</button><button type=submit data-primary=true>保存并发布');function aa(e){return e.split(/[,,、]/).map(a=>a.trim()).filter(Boolean)}function ra(e){const[a,n]=P(""),[s,r]=P(""),[c,b]=P(""),[g,C]=P(""),D=()=>{n(""),r(""),b(""),C("")},_=()=>{D(),e.onClose()},f=u=>{u.preventDefault();const d=a().trim(),O=s().trim(),v=aa(c());if(!d||!O||v.length===0){C("请填写名称、简介和至少一个标签,以便生成与现有模型卡片一致的展示信息。");return}const M=Tt({name:d,blurb:O,tags:v,domain:e.domain});e.onSaved({id:M.id,name:M.name}),_()};return l(p,{get when(){return e.open},get children(){var u=ta(),d=u.firstChild,O=d.nextSibling,v=O.firstChild,M=v.firstChild,q=M.nextSibling,X=v.nextSibling,o=X.nextSibling,j=o.firstChild,ie=j.firstChild,Q=ie.nextSibling,G=Q.nextSibling,x=j.nextSibling,K=x.firstChild,F=K.nextSibling,h=F.nextSibling,I=x.nextSibling,w=I.firstChild,W=w.firstChild,Z=W.nextSibling,J=Z.nextSibling,S=w.nextSibling,z=S.firstChild,se=z.nextSibling,ge=se.nextSibling,$e=o.nextSibling,be=$e.firstChild;return d.$$click=_,O.addEventListener("submit",f),q.$$click=_,G.$$input=ae=>n(ae.currentTarget.value),h.$$input=ae=>r(ae.currentTarget.value),J.$$input=ae=>b(ae.currentTarget.value),t(O,l(p,{get when(){return g()},get children(){var ae=ea();return t(ae,g),ae}}),$e),be.$$click=_,k(()=>G.value=a()),k(()=>h.value=s()),k(()=>J.value=c()),k(()=>ge.value=Pt(e.domain)),u}})}Ee(["click","input"]);function la(e,a){return e.includes("modelscope download --model ")?e:`${e}
2
2
 
3
3
  【从魔搭下载模型】
4
4
  ${Ft(a,{kind:"local"})}`}function na(e){const a=pt(e);if(!a)throw new Error(`Unknown capability resource: ${e}`);if(!Ne(a))throw new Error(`Capability resource is not installable: ${e}`);const n=Et(a);return{banner:a.install.banner,prompt:n?la(a.install.prompt,n):a.install.prompt}}function St(e){if(!Me({navigate:e.navigate,action:{type:"install",resourceId:e.resourceId},isLoggedIn:e.isLoggedIn}))return!1;const a=pt(e.resourceId);if(!a||!Ne(a))return!1;const{banner:n,prompt:s}=na(e.resourceId),r=Be({path:e.path,recent:e.recent,lastCodeWorkspace:e.lastCodeWorkspace})||Ve(pe())||Ge(document,e.path);if(!r)return!1;const c=gt(r);return bt(c,s),ht(c),e.openProject?.(r),e.touchCode?.(r),we({variant:"success",title:n}),e.navigate(yt(r)),!0}async function te(e,a,n){const s=await vt(`${$t(e)}${a}`,{...n,headers:{"content-type":"application/json",...n?.headers??{}}});if(!s.ok){const r=await s.text().catch(()=>"");throw new Error(r||`Request failed (${s.status})`)}return await s.json()}function ia(e,a){const n=new URLSearchParams;return a?.domain&&a.domain!=="all"&&n.set("domain",a.domain),te(e,`/experimental/onescience/raw-source?${n}`)}function sa(e,a){const n=new URLSearchParams({scope:a.scope});return a.domain&&a.domain!=="all"&&n.set("domain",a.domain),te(e,`/experimental/onescience/already?${n}`)}function oa(e,a){return te(e,"/experimental/onescience/raw-source",{method:"POST",body:JSON.stringify(a)})}function ca(e,a){return te(e,`/experimental/onescience/raw-source/${encodeURIComponent(a)}/convert`,{method:"POST"})}function da(e,a,n){const s=new URLSearchParams;n&&s.set("viewer_workspace_id",n);const r=s.size?`?${s}`:"";return te(e,`/experimental/onescience/raw-source/${encodeURIComponent(a)}/preview${r}`)}function ua(e,a,n){const s=new URLSearchParams;n&&s.set("viewer_workspace_id",n);const r=s.size?`?${s}`:"";return te(e,`/experimental/onescience/already/${encodeURIComponent(a)}/preview${r}`)}function pa(e,a,n){return te(e,`/experimental/onescience/session/${encodeURIComponent(a)}/chips`,{method:"PUT",body:JSON.stringify({raw_ids:n})})}function ga(e,a){return te(e,`/experimental/onescience/already/${encodeURIComponent(a)}/publish`,{method:"POST"})}function ba(e,a){return te(e,`/experimental/onescience/already/${encodeURIComponent(a)}/unpublish`,{method:"POST"})}function ha(e,a){return te(e,`/experimental/onescience/already/${encodeURIComponent(a)}/reingest`,{method:"POST"})}function ya(e,a,n){return te(e,`/experimental/onescience/already/${encodeURIComponent(a)}/training`,{method:"POST",body:JSON.stringify(n)})}function va(e){return te(e,"/experimental/workspace")}function $a(e){return te(e,"/experimental/onescience/object-store-key")}function ma(e,a){return te(e,"/experimental/onescience/object-store-key",{method:"PUT",body:JSON.stringify(a)})}function fa(e,a){return te(e,`/experimental/onescience/object-store-key/${encodeURIComponent(a)}`,{method:"DELETE"})}const _a={all:"全部",weather:"地球科学",materials:"材料化学",bio:"生命科学",fluid:"流体仿真"};var wa=i('<div class=os-onedata-subtabs role=tablist aria-label="Already 范围"><button type=button>我的</button><button type=button>公共'),Sa=i("<p class=os-client-capability-empty>登录后才能查看和接入登记库。"),ka=i("<p class=os-onedata-error>"),We=i("<ul class=os-onedata-list>"),Ca=i('<form class=os-onedata-register><strong>个人对象存储 Key</strong><select><option value=s3>s3</option><option value=oss>oss</option><option value=cos>cos</option></select><input required placeholder="Access Key ID"><input required type=password placeholder=Secret><input><input placeholder=region(可选)><button type=submit>保存 Key'),Ia=i("<select required><option value>选择远端执行环境"),xa=i('<form class=os-onedata-register><strong>+ 接入原始数据</strong><input placeholder=名称><input required placeholder="本机路径、s3://bucket/key、远端路径或 http(s) 地址"><select><option value=local_fs>本机路径</option><option value=http_dataset>无认证 HTTP</option><option value=object_store>对象存储(平台桶路径或 s3/oss/cos URI)</option><option value=remote_workspace>已连接的远端 wrk_*</option></select><button type=submit>接入'),La=i("<p class=os-client-capability-empty>还没有原始数据。接入本机路径、公开 HTTP,或已连接的远端路径。"),Da=i("<button type=button class=os-onedata-chip-btn>把选中的原始数据挂到当前会话芯片"),ot=i("<pre class=os-onedata-preview>"),Pa=i("<ul>"),Ta=i("<section class=os-onedata-selector aria-label=模型选择数据(只读)><h3>选择数据(只读)</h3><p>训练只接受 ready 的 Already(alr_)。种子 id / raw_ 不能写入 datasetRefs。"),Ea=i("<select><option value>选择作业目标"),Ra=i("<div class=os-onedata-actions><select><option value=local>作业目标:本机</option><option value=workspace>作业目标:远端 wrk_*</option><option value=shared_root>作业目标:平台共享根"),Oa=i("<p class=os-client-capability-empty>"),Ua=i('<section class="os-client-capability-resource-panel os-onedata-catalog"><header class="os-client-capability-page-section-head os-client-capability-page-section-head-active"><p>。先登记为原始数据,转为 Already 后才能给模型用。</p></header><div class=os-onedata-subtabs role=tablist aria-label="OneData 登记库"><button type=button>原始数据</button><button type=button>Already</button></div><section class=os-onedata-platform><header class=os-client-capability-page-section-head><div><strong>平台目录</strong><p>种子与魔搭卡,只读。下载后请回到上方「原始数据」按实际路径接入;不能把种子 id 当成训练数据。'),ja=i("<li><span> · …</span><button type=button>删除"),ct=i("<option>"),Aa=i("<li><label><input type=checkbox><strong></strong><span> · </span><small></small></label><div class=os-onedata-actions><button type=button>预览</button><button type=button>转为 Already"),qa=i("<p class=os-client-capability-empty>还没有 ready 的 Already。"),Ka=i("<li><code></code> "),Wa=i("<button type=button>发布"),Ha=i("<button type=button>取消发布"),Ma=i("<button type=button>作为原始数据接入"),Qa=i("<button type=button>开训"),Fa=i("<li><strong></strong><span></span><small></small><div class=os-onedata-actions><button type=button>预览");function za(e){const a=Re(),n=Oe(),s=Je(),r=Ue(),c=ne(()=>new URLSearchParams(s.search)),b=ne(()=>c().get("onedata")==="already"?"already":"raw"),g=ne(()=>c().get("already")==="public"?"public":"mine"),[C,D]=P([]),[_,f]=P([]),[u,d]=P(""),[O,v]=P(!1),[M,q]=P(""),[X,o]=P(""),[j,ie]=P("local_fs"),[Q,G]=P(""),[x,K]=P([]),[F,h]=P(""),[I,w]=P([]),[W,Z]=P("local"),[J,S]=P([]),[z,se]=P("s3"),[ge,$e]=P(""),[be,ae]=P(""),[Se,Le]=P(""),[he,Ae]=P(""),ee=()=>a.current?.http.url,ke=()=>!!pe(),De=ne(()=>Be({path:n.data.path,recent:je(n.data.project??[]),lastCodeWorkspace:a.projects.lastCode()})||mt(pe(),a.projects.lastCode())||Ve(pe())||Ge(document,n.data.path)),et=ne(()=>{const T=De();if(!T)return;const Y=Rt(T);if(Y)return Y;const[re]=n.child(T,{bootstrap:!1});return(re.session??[]).find(ye=>!ye.parentID&&!ye.time?.archived)?.id}),Ce=T=>{const Y=new URLSearchParams(s.search);for(const[re,ye]of Object.entries(T))Y.set(re,ye);Y.set("category","onedata"),r(`${s.pathname}?${Y}`)},tt=T=>Ce({onedata:T}),de=async()=>{const T=ee();if(!T||!ke()){D([]),f([]);return}d("");try{const Y=e.domain==="all"?void 0:e.domain,[re,ye,Pe,Ie]=await Promise.all([ia(T,{domain:Y}),sa(T,{scope:g(),domain:Y}),va(T).catch(()=>[]),$a(T).catch(()=>({items:[]}))]);D(re.items),f(ye.items),K(Pe.filter(ve=>ve.id.startsWith("wrk_")).map(ve=>({id:ve.id,name:ve.name||ve.id}))),S(Ie.items)}catch(Y){d(Y instanceof Error?Y.message:"无法加载登记库")}};ft(()=>{e.domain,b(),g(),de()});const qe=ne(()=>_().filter(T=>T.status==="ready")),at=(T,Y)=>T.zarr_summary?.arrays?.length?T.zarr_summary.arrays.map(re=>`${re.path||"."} shape=${re.shape.join("×")} dtype=${re.dtype} chunks=${re.chunks.join("×")}`).join(`
@@ -1 +1 @@
1
- import{m as S,j as w,h as D,u as $,o,dG as k,bf as C,dp as _,c,i as l,ds as P,a4 as j,R as F,a5 as G,t as M}from"./index-BfLPI17v.js";var z=M('<form class="os-client-project-create-form flex flex-col gap-5 p-5 pt-4"><div class="flex flex-col gap-3"><p class="os-client-project-create-path text-12-regular text-text-weak"></p></div><div class="flex justify-end gap-2">');function K(e){const i=S(),f=w(),h=D(),a=$(),s=o(()=>k(e.project.worktree)),u=o(()=>e.project.name||s()),x=o(()=>`${e.project.worktree.replace(/\\/g,"/").replace(/\/+$/,"")}/`),[m,b]=C({name:u()}),d=o(()=>{const t=m.name.trim();return t?t!==u():!1}),r=_(()=>({mutationFn:async()=>{const t=m.name.trim(),n=t===s()?"":t;if(e.project.id&&e.project.id!=="global"){await f.client.project.update({projectID:e.project.id,directory:e.project.worktree,name:n,icon:{color:e.project.icon?.color||"",override:e.project.icon?.override||""},commands:{start:e.project.commands?.start??""}}),i.close();return}h.project.meta(e.project.worktree,{name:n,icon:e.project.icon,commands:e.project.commands}),i.close()}}));function v(t){t.preventDefault(),!(r.isPending||!d())&&r.mutate()}return c(G,{get title(){return a.t("dialog.project.rename.title")},class:"os-client-project-create w-full max-w-[480px] mx-auto",get children(){var t=z(),n=t.firstChild,g=n.firstChild,p=n.nextSibling;return t.addEventListener("submit",v),l(n,c(P,{autofocus:!0,type:"text",get label(){return a.t("dialog.project.rename.name")},get placeholder(){return s()},get value(){return m.name},onChange:y=>b("name",y)}),g),l(g,()=>a.t("dialog.project.rename.path",{path:x()})),l(p,c(j,{type:"button",variant:"ghost",size:"large",onClick:()=>i.close(),get children(){return a.t("common.cancel")}}),null),l(p,c(j,{type:"submit",variant:"primary",size:"large",get disabled(){return r.isPending||!d()},get children(){return F(()=>!!r.isPending)()?a.t("common.saving"):a.t("common.confirm")}}),null),t}})}export{K as DialogEditProject};
1
+ import{m as S,j as w,h as D,u as $,o,dG as k,bf as C,dp as _,c,i as l,ds as P,a4 as j,R as F,a5 as G,t as M}from"./index-CL0Pu3hA.js";var z=M('<form class="os-client-project-create-form flex flex-col gap-5 p-5 pt-4"><div class="flex flex-col gap-3"><p class="os-client-project-create-path text-12-regular text-text-weak"></p></div><div class="flex justify-end gap-2">');function K(e){const i=S(),f=w(),h=D(),a=$(),s=o(()=>k(e.project.worktree)),u=o(()=>e.project.name||s()),x=o(()=>`${e.project.worktree.replace(/\\/g,"/").replace(/\/+$/,"")}/`),[m,b]=C({name:u()}),d=o(()=>{const t=m.name.trim();return t?t!==u():!1}),r=_(()=>({mutationFn:async()=>{const t=m.name.trim(),n=t===s()?"":t;if(e.project.id&&e.project.id!=="global"){await f.client.project.update({projectID:e.project.id,directory:e.project.worktree,name:n,icon:{color:e.project.icon?.color||"",override:e.project.icon?.override||""},commands:{start:e.project.commands?.start??""}}),i.close();return}h.project.meta(e.project.worktree,{name:n,icon:e.project.icon,commands:e.project.commands}),i.close()}}));function v(t){t.preventDefault(),!(r.isPending||!d())&&r.mutate()}return c(G,{get title(){return a.t("dialog.project.rename.title")},class:"os-client-project-create w-full max-w-[480px] mx-auto",get children(){var t=z(),n=t.firstChild,g=n.firstChild,p=n.nextSibling;return t.addEventListener("submit",v),l(n,c(P,{autofocus:!0,type:"text",get label(){return a.t("dialog.project.rename.name")},get placeholder(){return s()},get value(){return m.name},onChange:y=>b("name",y)}),g),l(g,()=>a.t("dialog.project.rename.path",{path:x()})),l(p,c(j,{type:"button",variant:"ghost",size:"large",onClick:()=>i.close(),get children(){return a.t("common.cancel")}}),null),l(p,c(j,{type:"submit",variant:"primary",size:"large",get disabled(){return r.isPending||!d()},get children(){return F(()=>!!r.isPending)()?a.t("common.saving"):a.t("common.confirm")}}),null),t}})}export{K as DialogEditProject};
@@ -1 +1 @@
1
- import{e0 as D,e as S,f as _,e1 as k,ae as P,e2 as w,m as F,u as L,o as $,c as d,dq as q,i as u,a5 as I,e3 as T,Z as b,_ as g,dV as C,t as E}from"./index-BfLPI17v.js";var K=E('<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 M(i){return i.toLocaleTimeString(void 0,{timeStyle:"short"})}const H=()=>{const i=D(),p=S(),f=_(),c=k(),l=P(),h=w(),x=F(),n=L(),y=$(()=>{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:M(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=T(o,{directory:l.directory,attachmentName:n.t("common.attachment")}),m=b(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(C(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(I,{get title(){return n.t("command.session.fork")},get children(){return d(q,{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=K(),o=a.firstChild,s=o.nextSibling;return u(o,()=>t.text),u(s,()=>t.time),a})()})}})};export{H as DialogFork};
1
+ import{e0 as D,e as S,f as _,e1 as k,ae as P,e2 as w,m as F,u as L,o as $,c as d,dq as q,i as u,a5 as I,e3 as T,Z as b,_ as g,dV as C,t as E}from"./index-CL0Pu3hA.js";var K=E('<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 M(i){return i.toLocaleTimeString(void 0,{timeStyle:"short"})}const H=()=>{const i=D(),p=S(),f=_(),c=k(),l=P(),h=w(),x=F(),n=L(),y=$(()=>{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:M(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=T(o,{directory:l.directory,attachmentName:n.t("common.attachment")}),m=b(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(C(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(I,{get title(){return n.t("command.session.fork")},get children(){return d(q,{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=K(),o=a.firstChild,s=o.nextSibling;return u(o,()=>t.text),u(s,()=>t.time),a})()})}})};export{H as DialogFork};
@@ -1,2 +1,2 @@
1
- import{m as oe,u as se,l as ce,h as de,n as g,o as x,dI as ue,dJ as ge,dK as pe,x as fe,dL as he,c as n,i as t,a4 as k,av as J,S as p,R as K,dM as L,dN as V,F as xe,ay as me,a5 as ve,t as f,dO as we,dP as be,_ as ye}from"./index-BfLPI17v.js";var _e=f('<p class="text-12-regular text-icon-warning-base">'),U=f('<p class="text-12-regular text-text-weak">'),$e=f('<ul class="max-h-36 overflow-auto text-12-regular text-text-weak font-mono">'),Se=f('<div class="flex flex-col gap-2 rounded-md border border-border-weak-base bg-background-weak px-3 py-3"><p class="text-13-medium text-text-strong">'),ke=f("<p class=text-text-critical-base>"),je=f('<p class="text-12-regular text-text-critical-base whitespace-pre-wrap">'),Ee=f('<div class="flex flex-col gap-5 p-6 pt-0"><div class="flex flex-col gap-2"><p class="text-12-regular text-text-weak"></p><p class="text-13-medium text-text-strong break-all font-mono">/</p><p class="text-12-regular text-text-weak"></p></div><div class="flex flex-wrap gap-2"><input type=file class=hidden multiple><input type=file class=hidden multiple></div><div class="flex flex-col gap-1 text-12-regular text-text-weak"><p></p></div><div class="flex justify-end gap-2">'),Ce=f("<li class=truncate>");function Ue(b){const F=oe(),l=se(),T=ce(),X=de(),[s,q]=g([]),[Q,Y]=g(!1),[D,Z]=g(!1),[I,P]=g(),[ee,j]=g(!0),[h,B]=g(!1),[z,R]=g({done:0,total:0,written:0,skipped:0,failed:0}),[A,$]=g("");let M,O;const te=x(()=>{const r=X.data.path.home,a=b.directory;return r&&a.startsWith(r)?`~${a.slice(r.length)}`:a}),E=x(()=>ue(s())),S=x(()=>ge(s())),H=x(()=>{const r=I();return r===void 0||r<=0?!1:E()>r}),N=x(()=>s().length>0&&!h()&&!H()),C=x(()=>s().slice(0,pe)),re=x(()=>s().length>0&&!S());fe(()=>{const r=b.directory,a=T.current?.http;if(!r||!a){j(!1);return}let i=!1;return j(!0),he(a.url,r).then(c=>{i||P(c.availableBytes)}).catch(()=>{i||P(void 0)}).finally(()=>{i||j(!1)}),()=>{i=!0}});const W=r=>{if(!r?.length)return;$("");const a=we(r);q(a.entries),Y(a.truncated),a.truncated&&$(l.t("dialog.project.upload.tooManyFiles",{max:String(V),selected:String(a.totalSelected)}))},le=async()=>{const r=T.current?.http;if(!r||!N())return;const a=s();B(!0),$(""),R({done:0,total:a.length,written:0,skipped:0,failed:0});let i=0,c=0,m=0;const y=[];for(let d=0;d<a.length;d+=1){const u=a[d];try{(await be(r.url,b.directory,{path:u.path,file:u.file,overwrite:D()})).status==="written"?i+=1:c+=1}catch(v){m+=1;const w=v instanceof Error?v.message:l.t("dialog.project.upload.failed");y.length<3&&y.push(`${u.path}: ${w}`)}R({done:d+1,total:a.length,written:i,skipped:c,failed:m})}if(B(!1),m===0){ye({title:l.t("toast.project.upload.success",{written:String(i),skipped:String(c)})}),b.onUploaded?.(),F.close();return}$([l.t("dialog.project.upload.partialFailed",{written:String(i),skipped:String(c),failed:String(m)}),...y].join(`
1
+ import{m as oe,u as se,l as ce,h as de,n as g,o as x,dI as ue,dJ as ge,dK as pe,x as fe,dL as he,c as n,i as t,a4 as k,av as J,S as p,R as K,dM as L,dN as V,F as xe,ay as me,a5 as ve,t as f,dO as we,dP as be,_ as ye}from"./index-CL0Pu3hA.js";var _e=f('<p class="text-12-regular text-icon-warning-base">'),U=f('<p class="text-12-regular text-text-weak">'),$e=f('<ul class="max-h-36 overflow-auto text-12-regular text-text-weak font-mono">'),Se=f('<div class="flex flex-col gap-2 rounded-md border border-border-weak-base bg-background-weak px-3 py-3"><p class="text-13-medium text-text-strong">'),ke=f("<p class=text-text-critical-base>"),je=f('<p class="text-12-regular text-text-critical-base whitespace-pre-wrap">'),Ee=f('<div class="flex flex-col gap-5 p-6 pt-0"><div class="flex flex-col gap-2"><p class="text-12-regular text-text-weak"></p><p class="text-13-medium text-text-strong break-all font-mono">/</p><p class="text-12-regular text-text-weak"></p></div><div class="flex flex-wrap gap-2"><input type=file class=hidden multiple><input type=file class=hidden multiple></div><div class="flex flex-col gap-1 text-12-regular text-text-weak"><p></p></div><div class="flex justify-end gap-2">'),Ce=f("<li class=truncate>");function Ue(b){const F=oe(),l=se(),T=ce(),X=de(),[s,q]=g([]),[Q,Y]=g(!1),[D,Z]=g(!1),[I,P]=g(),[ee,j]=g(!0),[h,B]=g(!1),[z,R]=g({done:0,total:0,written:0,skipped:0,failed:0}),[A,$]=g("");let M,O;const te=x(()=>{const r=X.data.path.home,a=b.directory;return r&&a.startsWith(r)?`~${a.slice(r.length)}`:a}),E=x(()=>ue(s())),S=x(()=>ge(s())),H=x(()=>{const r=I();return r===void 0||r<=0?!1:E()>r}),N=x(()=>s().length>0&&!h()&&!H()),C=x(()=>s().slice(0,pe)),re=x(()=>s().length>0&&!S());fe(()=>{const r=b.directory,a=T.current?.http;if(!r||!a){j(!1);return}let i=!1;return j(!0),he(a.url,r).then(c=>{i||P(c.availableBytes)}).catch(()=>{i||P(void 0)}).finally(()=>{i||j(!1)}),()=>{i=!0}});const W=r=>{if(!r?.length)return;$("");const a=we(r);q(a.entries),Y(a.truncated),a.truncated&&$(l.t("dialog.project.upload.tooManyFiles",{max:String(V),selected:String(a.totalSelected)}))},le=async()=>{const r=T.current?.http;if(!r||!N())return;const a=s();B(!0),$(""),R({done:0,total:a.length,written:0,skipped:0,failed:0});let i=0,c=0,m=0;const y=[];for(let d=0;d<a.length;d+=1){const u=a[d];try{(await be(r.url,b.directory,{path:u.path,file:u.file,overwrite:D()})).status==="written"?i+=1:c+=1}catch(v){m+=1;const w=v instanceof Error?v.message:l.t("dialog.project.upload.failed");y.length<3&&y.push(`${u.path}: ${w}`)}R({done:d+1,total:a.length,written:i,skipped:c,failed:m})}if(B(!1),m===0){ye({title:l.t("toast.project.upload.success",{written:String(i),skipped:String(c)})}),b.onUploaded?.(),F.close();return}$([l.t("dialog.project.upload.partialFailed",{written:String(i),skipped:String(c),failed:String(m)}),...y].join(`
2
2
  `)),(i>0||c>0)&&b.onUploaded?.()};return n(ve,{get title(){return l.t("command.project.upload")},class:"w-full max-w-[520px] mx-auto",get children(){var r=Ee(),a=r.firstChild,i=a.firstChild,c=i.nextSibling,m=c.firstChild,y=c.nextSibling,d=a.nextSibling,u=d.firstChild,v=u.nextSibling,w=d.nextSibling,ae=w.firstChild,_=w.nextSibling;return t(i,()=>l.t("dialog.project.upload.destinationLabel")),t(c,te,m),t(y,()=>l.t("dialog.project.upload.destinationHint")),t(d,n(k,{type:"button",variant:"secondary",size:"large",get disabled(){return h()},onClick:()=>M?.click(),get children(){return l.t("dialog.project.upload.pickFiles")}}),u),t(d,n(k,{type:"button",variant:"secondary",size:"large",get disabled(){return h()},onClick:()=>O?.click(),get children(){return l.t("dialog.project.upload.pickFolder")}}),u),u.addEventListener("change",e=>{W(e.currentTarget.files),e.currentTarget.value=""}),J(e=>{M=e},u),v.addEventListener("change",e=>{W(e.currentTarget.files),e.currentTarget.value=""}),J(e=>{O=e,e&&e.setAttribute("webkitdirectory","")},v),t(r,n(p,{get when(){return s().length>0},get children(){var e=Se(),ne=e.firstChild;return t(ne,(()=>{var o=K(()=>!!S());return()=>o()?l.t("dialog.project.upload.folderSummary",{folder:S(),count:String(s().length),size:L(E())}):l.t("dialog.project.upload.summary",{count:String(s().length),size:L(E())})})()),t(e,n(p,{get when(){return Q()},get children(){var o=_e();return t(o,()=>l.t("dialog.project.upload.truncatedHint",{max:String(V)})),o}}),null),t(e,n(p,{get when(){return S()},get children(){var o=U();return t(o,()=>l.t("dialog.project.upload.folderHint")),o}}),null),t(e,n(p,{get when(){return re()},get children(){return[(()=>{var o=$e();return t(o,n(xe,{get each(){return C()},children:ie=>(()=>{var G=Ce();return t(G,()=>ie.path),G})()})),o})(),n(p,{get when(){return s().length>C().length},get children(){var o=U();return t(o,()=>l.t("dialog.project.upload.moreFiles",{count:String(s().length-C().length)})),o}})]}}),null),e}}),w),t(ae,()=>l.t("dialog.project.upload.diskSpace",{space:ee()?l.t("common.loading"):L(I())})),t(w,n(p,{get when(){return H()},get children(){var e=ke();return t(e,()=>l.t("dialog.project.upload.diskInsufficient")),e}}),null),t(r,n(me,{get checked(){return D()},onChange:Z,get disabled(){return h()},get children(){return l.t("dialog.project.upload.overwrite")}}),_),t(r,n(p,{get when(){return h()},get children(){var e=U();return t(e,()=>l.t("dialog.project.upload.progress",{done:String(z().done),total:String(z().total)})),e}}),_),t(r,n(p,{get when(){return A()},get children(){var e=je();return t(e,A),e}}),_),t(_,n(k,{type:"button",variant:"ghost",size:"large",get disabled(){return h()},onClick:()=>F.close(),get children(){return l.t("common.cancel")}}),null),t(_,n(k,{type:"button",variant:"primary",size:"large",get disabled(){return!N()},onClick:()=>void le(),get children(){return K(()=>!!h())()?l.t("dialog.project.upload.uploading"):l.t("dialog.project.upload.confirm")}}),null),r}})}export{Ue as DialogProjectUpload};
@@ -1 +1 @@
1
- import{i as f,Q as E,bJ as Y,t as $,aI as Z,u as X,g as ee,ad as te,m as ne,e as se,f as re,j as ae,h as oe,dQ as ie,n as ce,o as b,w as le,aB as de,c as w,dq as ue,am as fe,an as P,S as C,dR as ge,I as he,dS as pe,dT as me,dG as K,a5 as we,dU as ye,dV as ve,Z as be}from"./index-BfLPI17v.js";var xe=$("<span data-component=keybind>");function ke(t){return(()=>{var n=xe();return f(n,()=>t.children),E(a=>Y(n,{...t.classList,[t.class??""]:!!t.class},a)),n})()}function $e(t,n){const a=Math.floor(Math.max(0,t)/1e3),l=Math.floor(a/60),s=Math.floor(l/60),d=Math.floor(s/24);return a<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 I=5,Fe=["session.new","workspace.new","session.previous","session.next","terminal.toggle","review.toggle"],A=t=>{const n=new Set,a=[];for(const l of t)n.has(l.id)||(n.add(l.id),a.push(l));return a},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}),Te=(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 Ee(t){const n=b(()=>t.filesOnly()?[]:t.command.options.filter(s=>!s.disabled&&!s.hidden&&!s.id.startsWith("suggested.")&&s.id!=="file.open")),a=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,I),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:a,picks:l}}function Ie(t){const n=ye({tabs:t.tabs,pathFromTab:t.file.pathFromTab,normalizeTab:s=>s.startsWith("file://")?t.file.tab(s):s}),a=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,I)}),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,I).map(i=>F(i,s))});return{recent:a,root:l}}function Le(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=>Te(c,v));return n.cached=o,o}).catch(()=>[]).finally(()=>{n.inflight=void 0}),n.inflight)}}}function Oe(t){const n=Z(),a=X(),l=ee(),s=te(),d=ne(),y=se(),i=re(),h=ae(),v=oe(),{params:o,tabs:c,view:S}=ie(),D=()=>t.mode==="files",k={cleanup:void 0,committed:!1},[R,G]=ce(!1),L=Ee({filesOnly:D,command:n,language:a}),_=Ie({file:s,tabs:c,language:a}),j=b(()=>le(o.dir)??""),O=b(()=>{const e=j();if(e)return l.projects.list().find(r=>r.worktree===e||r.sandboxes?.includes(e))}),z=b(()=>{const e=j(),r=O();if(!r)return e?[e]:[];const u=[r.worktree,...r.sandboxes??[]];return e&&!u.includes(e)?[...u,e]:u}),H=b(()=>v.data.path.home),B=e=>{const r=O(),u=r&&e===r.worktree?a.t("workspace.type.local"):a.t("workspace.type.sandbox"),[p]=v.child(e,{bootstrap:!1}),g=H(),m=g?e.replace(g,"~"):e,x=p.vcs?.branch??K(e);return`${u} : ${x||m}`},{sessions:Q}=Le({workspaces:z,label:B,globalSDK:h,language:a}),W=async e=>{const r=e.trim();if(G(r.length>0),!r&&D()){const x=s.tree.state("")?.loaded,T=x?Promise.resolve():s.tree.list(""),M=A([..._.recent(),..._.root()]);return x||M.length>0?M:(await T,A([..._.recent(),..._.root()]))}if(!r)return[...L.picks(),..._.recent()];if(D()){const x=await s.searchFiles(r),T=a.t("palette.group.files");return x.map(M=>F(M,T))}const[u,p]=await Promise.all([s.searchFiles(r),Promise.resolve(Q(r))]),g=a.t("palette.group.files"),m=u.map(x=>F(x,g));return[...L.list(),...p,...m]},J=e=>{k.cleanup?.(),e&&e.type==="command"&&(k.cleanup=e.option?.onHighlight?.())},U=e=>{const r=s.tab(e);c().open(r),s.load(e),S().reviewPanel.opened()||S().reviewPanel.open(),l.fileTree.setTab("all"),t.onOpenFile?.(e),c().setActive(r)},V=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&&U(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()?a.t("session.header.searchFiles"):a.t("palette.search.placeholder"),autofocus:!0,hideIcon:!0}},get emptyMessage(){return a.t("palette.empty")},get loadingMessage(){return a.t("common.loading")},items:W,key:e=>e.id,filterKeys:["title","description","category"],get groupBy(){return R()?e=>e.category:()=>""},onMove:J,onSelect:V,children:e=>w(fe,{get fallback(){return(()=>{var r=Ce(),u=r.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??"")),r})()},get children(){return[w(P,{get when(){return e.type==="command"},get children(){var r=_e(),u=r.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(r,w(C,{get when(){return e.keybind},get children(){return w(ke,{class:"rounded-[4px]",get children(){return ge(e.keybind??"",a.t)}})}}),null),r}}),w(P,{get when(){return e.type==="session"},get children(){var r=Me(),u=r.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),E(()=>m.classList.toggle("opacity-70",!!e.archived)),m}}),null),f(r,w(C,{get when(){return e.updated},get children(){var m=De();return f(m,()=>Se(new Date(e.updated).toISOString(),a.t)),m}}),null),E(()=>g.classList.toggle("opacity-70",!!e.archived)),r}})]}})})}})}export{Oe as DialogSelectFile};
1
+ import{i as f,Q as E,bJ as Y,t as $,aI as Z,u as X,g as ee,ad as te,m as ne,e as se,f as re,j as ae,h as oe,dQ as ie,n as ce,o as b,w as le,aB as de,c as w,dq as ue,am as fe,an as P,S as C,dR as ge,I as he,dS as pe,dT as me,dG as K,a5 as we,dU as ye,dV as ve,Z as be}from"./index-CL0Pu3hA.js";var xe=$("<span data-component=keybind>");function ke(t){return(()=>{var n=xe();return f(n,()=>t.children),E(a=>Y(n,{...t.classList,[t.class??""]:!!t.class},a)),n})()}function $e(t,n){const a=Math.floor(Math.max(0,t)/1e3),l=Math.floor(a/60),s=Math.floor(l/60),d=Math.floor(s/24);return a<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 I=5,Fe=["session.new","workspace.new","session.previous","session.next","terminal.toggle","review.toggle"],A=t=>{const n=new Set,a=[];for(const l of t)n.has(l.id)||(n.add(l.id),a.push(l));return a},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}),Te=(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 Ee(t){const n=b(()=>t.filesOnly()?[]:t.command.options.filter(s=>!s.disabled&&!s.hidden&&!s.id.startsWith("suggested.")&&s.id!=="file.open")),a=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,I),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:a,picks:l}}function Ie(t){const n=ye({tabs:t.tabs,pathFromTab:t.file.pathFromTab,normalizeTab:s=>s.startsWith("file://")?t.file.tab(s):s}),a=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,I)}),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,I).map(i=>F(i,s))});return{recent:a,root:l}}function Le(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=>Te(c,v));return n.cached=o,o}).catch(()=>[]).finally(()=>{n.inflight=void 0}),n.inflight)}}}function Oe(t){const n=Z(),a=X(),l=ee(),s=te(),d=ne(),y=se(),i=re(),h=ae(),v=oe(),{params:o,tabs:c,view:S}=ie(),D=()=>t.mode==="files",k={cleanup:void 0,committed:!1},[R,G]=ce(!1),L=Ee({filesOnly:D,command:n,language:a}),_=Ie({file:s,tabs:c,language:a}),j=b(()=>le(o.dir)??""),O=b(()=>{const e=j();if(e)return l.projects.list().find(r=>r.worktree===e||r.sandboxes?.includes(e))}),z=b(()=>{const e=j(),r=O();if(!r)return e?[e]:[];const u=[r.worktree,...r.sandboxes??[]];return e&&!u.includes(e)?[...u,e]:u}),H=b(()=>v.data.path.home),B=e=>{const r=O(),u=r&&e===r.worktree?a.t("workspace.type.local"):a.t("workspace.type.sandbox"),[p]=v.child(e,{bootstrap:!1}),g=H(),m=g?e.replace(g,"~"):e,x=p.vcs?.branch??K(e);return`${u} : ${x||m}`},{sessions:Q}=Le({workspaces:z,label:B,globalSDK:h,language:a}),W=async e=>{const r=e.trim();if(G(r.length>0),!r&&D()){const x=s.tree.state("")?.loaded,T=x?Promise.resolve():s.tree.list(""),M=A([..._.recent(),..._.root()]);return x||M.length>0?M:(await T,A([..._.recent(),..._.root()]))}if(!r)return[...L.picks(),..._.recent()];if(D()){const x=await s.searchFiles(r),T=a.t("palette.group.files");return x.map(M=>F(M,T))}const[u,p]=await Promise.all([s.searchFiles(r),Promise.resolve(Q(r))]),g=a.t("palette.group.files"),m=u.map(x=>F(x,g));return[...L.list(),...p,...m]},J=e=>{k.cleanup?.(),e&&e.type==="command"&&(k.cleanup=e.option?.onHighlight?.())},U=e=>{const r=s.tab(e);c().open(r),s.load(e),S().reviewPanel.opened()||S().reviewPanel.open(),l.fileTree.setTab("all"),t.onOpenFile?.(e),c().setActive(r)},V=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&&U(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()?a.t("session.header.searchFiles"):a.t("palette.search.placeholder"),autofocus:!0,hideIcon:!0}},get emptyMessage(){return a.t("palette.empty")},get loadingMessage(){return a.t("common.loading")},items:W,key:e=>e.id,filterKeys:["title","description","category"],get groupBy(){return R()?e=>e.category:()=>""},onMove:J,onSelect:V,children:e=>w(fe,{get fallback(){return(()=>{var r=Ce(),u=r.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??"")),r})()},get children(){return[w(P,{get when(){return e.type==="command"},get children(){var r=_e(),u=r.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(r,w(C,{get when(){return e.keybind},get children(){return w(ke,{class:"rounded-[4px]",get children(){return ge(e.keybind??"",a.t)}})}}),null),r}}),w(P,{get when(){return e.type==="session"},get children(){var r=Me(),u=r.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),E(()=>m.classList.toggle("opacity-70",!!e.archived)),m}}),null),f(r,w(C,{get when(){return e.updated},get children(){var m=De();return f(m,()=>Se(new Date(e.updated).toISOString(),a.t)),m}}),null),E(()=>g.classList.toggle("opacity-70",!!e.archived)),r}})]}})})}})}export{Oe as DialogSelectFile};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BfLPI17v.js","assets/index-BwtL4rk2.css"])))=>i.map(i=>d[i]);
2
- import{u as x,i as d,c as i,S as h,t as b,m as y,a4 as P,a5 as M,bf as O,dW as v,H as k,dX as S,dY as C,dZ as z,o as B,d_ as _,d$ as p,dq as E,a7 as L,$ as I}from"./index-BfLPI17v.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,D=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(D,s),e})()};var K=b('<div class="w-full flex items-center gap-x-2 text-13-regular"><span class=truncate>'),R=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=B(()=>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(E,{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(S,{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 W(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-BfLPI17v.js").then(e=>e.ed),__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=R();return d(e,i(S,{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(S,{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 q=o=>{const n=y(),a=x(),c=()=>{I(()=>import("./index-BfLPI17v.js").then(r=>r.ed),__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{q as DialogSelectModel,W as ModelSelectorPopover};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CL0Pu3hA.js","assets/index-FpOsJHB5.css"])))=>i.map(i=>d[i]);
2
+ import{u as x,i as d,c as i,S as h,t as b,m as y,a4 as P,a5 as M,bf as O,dW as v,H as k,dX as S,dY as C,dZ as z,o as B,d_ as _,d$ as p,dq as E,a7 as L,$ as I}from"./index-CL0Pu3hA.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,D=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(D,s),e})()};var K=b('<div class="w-full flex items-center gap-x-2 text-13-regular"><span class=truncate>'),R=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=B(()=>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(E,{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(S,{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 W(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-CL0Pu3hA.js").then(e=>e.ed),__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=R();return d(e,i(S,{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(S,{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 q=o=>{const n=y(),a=x(),c=()=>{I(()=>import("./index-CL0Pu3hA.js").then(r=>r.ed),__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{q as DialogSelectModel,W as ModelSelectorPopover};
@@ -1,3 +1,3 @@
1
- import{m as $,o as r,s as I,dH as A,c as s,i as a,S as m,a4 as x,a5 as N,t as b}from"./index-BfLPI17v.js";var T=b('<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">服务端返回:'),S=b('<pre class="m-0 shrink-0 max-h-24 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=b('<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-[36vh] 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">'),L=b('<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">修改环境变量后需重启 OneCode,并在浏览器中重新登录后再打开终端。</p><div class="flex justify-end shrink-0">');function M(f={}){const k=$(),l=r(()=>I()),n=r(()=>l()?.capabilities.terminalUnavailableReason??""),w=r(()=>l()?.capabilities.terminalUnavailableDetail??""),i=r(()=>l()?.capabilities.terminalIsolation??""),h=r(()=>(f.failure??"").trim()),u=r(()=>!!l()&&l()?.capabilities.terminal===!0&&!n()),d=r(()=>!n()&&!u()&&i()==="bubblewrap"),p=r(()=>{if(u())return i()==="docker"?["# 1) 无 GPU:改用 bubblewrap 后重启 OneCode,并重新登录","export ONECODE_TERMINAL_ISOLATION=bubblewrap","# 2) 有 GPU 且必须用 docker:给运行账号加组后重新登录系统再启 OneCode",'sudo usermod -aG docker "$USER"',"docker info"]:i()==="bubblewrap"?["# A. 临时绕过隔离(先验证终端能否打开)","export ONECODE_TERMINAL_ISOLATION=native","# 然后重启 onecode,浏览器重新登录后再开终端","","# B. 继续用 bubblewrap 时,在运行 OneCode 的机器上检查:","which bwrap; bwrap --version","bwrap --unshare-all --die-with-parent --new-session --proc /proc --dev /dev --ro-bind-try /usr /usr --ro-bind-try /bin /bin --tmpfs /tmp -- /usr/bin/true; echo exit:$?","cat /proc/sys/kernel/unprivileged_userns_clone","cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null || true","","# C. 若 exit 非 0,可临时放开(需管理员;重启后可能失效)","sudo sysctl -w kernel.unprivileged_userns_clone=1","sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0","","# D. 服务端日志(搜 creating session / exited)",'ls ~/.local/share/opencode/log/ 2>/dev/null || ls "$HOME"/.local/share/opencode/log/']:["# 查看服务端日志(搜 creating session / exited)",'ls ~/.local/share/opencode/log/ 2>/dev/null || ls "$HOME"/.local/share/opencode/log/',"# 临时可改:export ONECODE_TERMINAL_ISOLATION=native 后重启并重新登录"];const e=A(l());return Array.isArray(e)&&e.length>0?e:d()?["export ONECODE_TERMINAL_ISOLATION=native","cat /proc/sys/kernel/unprivileged_userns_clone"]:[]}),v=r(()=>p().length>0),_=r(()=>u()?"无法打开终端":n()==="docker-missing"?"无法打开终端:Docker 不可用":n()==="disabled"?"无法打开终端:服务未启用":n()==="bubblewrap-unusable"?"无法打开终端:bubblewrap 异常":d()?"无法打开终端:隔离环境异常":"无法打开终端:需要 bubblewrap"),O=r(()=>u()?i()==="docker"?"隔离模式为 docker,创建终端失败。常见原因是当前用户无权访问 docker.sock。无 GPU 请改用 bubblewrap;有 GPU 请把运行账号加入 docker 组。":i()==="bubblewrap"?"隔离模式为 bubblewrap,创建终端失败(服务端 POST /pty 返回错误)。可先按下方 A 改用 native 验证;若需继续隔离,再按 B/C 检查 bubblewrap 与内核命名空间。":`隔离模式为 ${i()||"native"},创建终端失败。请按下方命令查看日志或临时调整隔离模式后重试。`:n()==="docker-missing"?"已配置 docker 隔离,但当前用户无法使用 Docker。无 GPU 请改用 bubblewrap;有 GPU 请将运行账号加入 docker 组。":n()==="disabled"?"服务端未启用平台账号终端。":n()==="bubblewrap-unusable"?"已安装 bubblewrap,但无法创建用户命名空间。请按下方命令检查后重启 OneCode 并重新登录。":d()?"bubblewrap 终端启动失败。可临时改用 native,或检查 user namespace 相关 sysctl。":"需要安装 bubblewrap 后重启 OneCode 并重新登录。容器部署可使用 ONECODE_TERMINAL_ISOLATION=native。"),C=async()=>{const e=p().filter(o=>o.trim().length>0&&!o.trim().startsWith("#")).join(`
1
+ import{m as $,o as r,s as I,dH as A,c as s,i as a,S as m,a4 as x,a5 as N,t as b}from"./index-CL0Pu3hA.js";var T=b('<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">服务端返回:'),S=b('<pre class="m-0 shrink-0 max-h-24 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=b('<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-[36vh] 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">'),L=b('<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">修改环境变量后需重启 OneCode,并在浏览器中重新登录后再打开终端。</p><div class="flex justify-end shrink-0">');function M(f={}){const k=$(),l=r(()=>I()),n=r(()=>l()?.capabilities.terminalUnavailableReason??""),w=r(()=>l()?.capabilities.terminalUnavailableDetail??""),i=r(()=>l()?.capabilities.terminalIsolation??""),h=r(()=>(f.failure??"").trim()),u=r(()=>!!l()&&l()?.capabilities.terminal===!0&&!n()),d=r(()=>!n()&&!u()&&i()==="bubblewrap"),p=r(()=>{if(u())return i()==="docker"?["# 1) 无 GPU:改用 bubblewrap 后重启 OneCode,并重新登录","export ONECODE_TERMINAL_ISOLATION=bubblewrap","# 2) 有 GPU 且必须用 docker:给运行账号加组后重新登录系统再启 OneCode",'sudo usermod -aG docker "$USER"',"docker info"]:i()==="bubblewrap"?["# A. 临时绕过隔离(先验证终端能否打开)","export ONECODE_TERMINAL_ISOLATION=native","# 然后重启 onecode,浏览器重新登录后再开终端","","# B. 继续用 bubblewrap 时,在运行 OneCode 的机器上检查:","which bwrap; bwrap --version","bwrap --unshare-all --die-with-parent --new-session --proc /proc --dev /dev --ro-bind-try /usr /usr --ro-bind-try /bin /bin --tmpfs /tmp -- /usr/bin/true; echo exit:$?","cat /proc/sys/kernel/unprivileged_userns_clone","cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null || true","","# C. 若 exit 非 0,可临时放开(需管理员;重启后可能失效)","sudo sysctl -w kernel.unprivileged_userns_clone=1","sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0","","# D. 服务端日志(搜 creating session / exited)",'ls ~/.local/share/opencode/log/ 2>/dev/null || ls "$HOME"/.local/share/opencode/log/']:["# 查看服务端日志(搜 creating session / exited)",'ls ~/.local/share/opencode/log/ 2>/dev/null || ls "$HOME"/.local/share/opencode/log/',"# 临时可改:export ONECODE_TERMINAL_ISOLATION=native 后重启并重新登录"];const e=A(l());return Array.isArray(e)&&e.length>0?e:d()?["export ONECODE_TERMINAL_ISOLATION=native","cat /proc/sys/kernel/unprivileged_userns_clone"]:[]}),v=r(()=>p().length>0),_=r(()=>u()?"无法打开终端":n()==="docker-missing"?"无法打开终端:Docker 不可用":n()==="disabled"?"无法打开终端:服务未启用":n()==="bubblewrap-unusable"?"无法打开终端:bubblewrap 异常":d()?"无法打开终端:隔离环境异常":"无法打开终端:需要 bubblewrap"),O=r(()=>u()?i()==="docker"?"隔离模式为 docker,创建终端失败。常见原因是当前用户无权访问 docker.sock。无 GPU 请改用 bubblewrap;有 GPU 请把运行账号加入 docker 组。":i()==="bubblewrap"?"隔离模式为 bubblewrap,创建终端失败(服务端 POST /pty 返回错误)。可先按下方 A 改用 native 验证;若需继续隔离,再按 B/C 检查 bubblewrap 与内核命名空间。":`隔离模式为 ${i()||"native"},创建终端失败。请按下方命令查看日志或临时调整隔离模式后重试。`:n()==="docker-missing"?"已配置 docker 隔离,但当前用户无法使用 Docker。无 GPU 请改用 bubblewrap;有 GPU 请将运行账号加入 docker 组。":n()==="disabled"?"服务端未启用平台账号终端。":n()==="bubblewrap-unusable"?"已安装 bubblewrap,但无法创建用户命名空间。请按下方命令检查后重启 OneCode 并重新登录。":d()?"bubblewrap 终端启动失败。可临时改用 native,或检查 user namespace 相关 sysctl。":"需要安装 bubblewrap 后重启 OneCode 并重新登录。容器部署可使用 ONECODE_TERMINAL_ISOLATION=native。"),C=async()=>{const e=p().filter(o=>o.trim().length>0&&!o.trim().startsWith("#")).join(`
2
2
  `);if(e)try{await navigator.clipboard.writeText(e)}catch{}};return s(N,{get title(){return _()},class:"w-full max-w-[560px] mx-auto",size:"large",get children(){var e=L(),o=e.firstChild,c=o.nextSibling,y=c.nextSibling;return a(o,O),a(e,s(m,{get when(){return h()},get children(){var t=T();return t.firstChild,a(t,h,null),t}}),c),a(e,s(m,{get when(){return w()},get children(){var t=S();return t.firstChild,a(t,w,null),t}}),c),a(e,s(m,{get when(){return v()},get children(){var t=D(),g=t.firstChild;g.firstChild;var E=g.nextSibling;return a(g,s(x,{type:"button",size:"normal",variant:"ghost",onClick:()=>void C(),children:"复制命令"}),null),a(E,()=>p().join(`
3
3
  `)),t}}),c),a(y,s(x,{type:"button",variant:"primary",size:"large",onClick:()=>k.close(),children:"知道了"})),e}})}export{M as DialogTerminalUnavailable};
@@ -1 +1 @@
1
- import{e as M,f as O,n as P,x as Q,o as R,i as t,c as d,t as n,b as T,N as V,L as W,Q as x,T as k,F as g,S as j,V as q}from"./index-BfLPI17v.js";import{d as z}from"./onescience-docs-CH5KBTI9.js";var B=n("<div class=os-client-capability-page-grid>"),G=n('<div class="os-client-capability-page os-client-docs-page"><header class=os-client-docs-head><div class=os-client-docs-head-copy><h2>帮助</h2><p>平台使用说明、插件镜像与版本记录</p></div></header><section class=os-client-capability-selector aria-label=帮助与文档><div class=os-client-capability-current-domain><span>文档分类:</span><strong></strong><small>点击条目在新窗口打开原文</small></div><div class="os-client-capability-tabs os-client-docs-tabs"role=tablist aria-label=文档分类></div></section><div class=os-client-capability-page-body><section class=os-client-capability-resource-panel>'),J=n("<button type=button><strong></strong><small>"),K=n("<p class=os-client-capability-empty>该分类下暂无文档。"),U=n("<article class=os-client-capability-card><div><h4></h4><p></p></div><div class=os-client-capability-meta></div><div class=os-client-capability-actions><a target=_blank rel=noreferrer data-primary=true>"),X=n("<span>");const v=[{id:"manual",label:"用户手册",hint:"平台与 OneSkills 使用说明",match:e=>e.includes("用户手册")},{id:"plugins",label:"插件与镜像",hint:"插件协议与运行镜像",match:e=>e.includes("插件")||e.includes("镜像")},{id:"release",label:"发版记录",hint:"版本变化与重要调整",match:e=>e.includes("发版记录")||e.includes("版本记录")}];function w(e){const c=e.replace(/^#/,"").trim().toLowerCase();return c==="manual"||c==="plugins"||c==="release"?c:"manual"}function ee(){const e=M(),c=O(),[b,f]=P(w(e.hash));Q(()=>f(w(e.hash)));const H=a=>{f(a),c(q(a),{replace:!0})},$=()=>v.find(a=>a.id===b())??v[0],_=R(()=>z.filter(a=>$().match(a.tags)));return(()=>{var a=G(),u=a.firstChild;u.firstChild;var m=u.nextSibling,y=m.firstChild,L=y.firstChild,E=L.nextSibling,F=y.nextSibling,A=m.nextSibling,D=A.firstChild;return t(u,d(W,{get href(){return V()},class:"os-client-docs-close","aria-label":"关闭帮助",children:"×"}),null),t(E,()=>$().label),t(F,d(g,{each:v,children:i=>(()=>{var l=J(),r=l.firstChild,h=r.nextSibling;return l.$$click=()=>H(i.id),t(r,()=>i.label),t(h,()=>i.hint),x(s=>{var p=b()===i.id,o=b()===i.id;return p!==s.e&&l.classList.toggle("is-active",s.e=p),o!==s.t&&k(l,"aria-pressed",s.t=o),s},{e:void 0,t:void 0}),l})()})),t(D,d(j,{get when(){return _().length>0},get fallback(){return K()},get children(){var i=B();return t(i,d(g,{get each(){return _()},children:l=>(()=>{var r=U(),h=r.firstChild,s=h.firstChild,p=s.nextSibling,o=h.nextSibling,N=o.nextSibling,S=N.firstChild;return t(s,()=>l.title),t(p,()=>l.copy),t(o,d(g,{get each(){return l.tags},children:I=>(()=>{var C=X();return t(C,I),C})()})),t(S,()=>l.action),x(()=>k(S,"href",l.href)),r})()})),i}})),a})()}T(["click"]);export{ee as WorkbenchDocsPage};
1
+ import{e as M,f as O,n as P,x as Q,o as R,i as t,c as d,t as n,b as T,N as V,L as W,Q as x,T as k,F as g,S as j,V as q}from"./index-CL0Pu3hA.js";import{d as z}from"./onescience-docs-CH5KBTI9.js";var B=n("<div class=os-client-capability-page-grid>"),G=n('<div class="os-client-capability-page os-client-docs-page"><header class=os-client-docs-head><div class=os-client-docs-head-copy><h2>帮助</h2><p>平台使用说明、插件镜像与版本记录</p></div></header><section class=os-client-capability-selector aria-label=帮助与文档><div class=os-client-capability-current-domain><span>文档分类:</span><strong></strong><small>点击条目在新窗口打开原文</small></div><div class="os-client-capability-tabs os-client-docs-tabs"role=tablist aria-label=文档分类></div></section><div class=os-client-capability-page-body><section class=os-client-capability-resource-panel>'),J=n("<button type=button><strong></strong><small>"),K=n("<p class=os-client-capability-empty>该分类下暂无文档。"),U=n("<article class=os-client-capability-card><div><h4></h4><p></p></div><div class=os-client-capability-meta></div><div class=os-client-capability-actions><a target=_blank rel=noreferrer data-primary=true>"),X=n("<span>");const v=[{id:"manual",label:"用户手册",hint:"平台与 OneSkills 使用说明",match:e=>e.includes("用户手册")},{id:"plugins",label:"插件与镜像",hint:"插件协议与运行镜像",match:e=>e.includes("插件")||e.includes("镜像")},{id:"release",label:"发版记录",hint:"版本变化与重要调整",match:e=>e.includes("发版记录")||e.includes("版本记录")}];function w(e){const c=e.replace(/^#/,"").trim().toLowerCase();return c==="manual"||c==="plugins"||c==="release"?c:"manual"}function ee(){const e=M(),c=O(),[b,f]=P(w(e.hash));Q(()=>f(w(e.hash)));const H=a=>{f(a),c(q(a),{replace:!0})},$=()=>v.find(a=>a.id===b())??v[0],_=R(()=>z.filter(a=>$().match(a.tags)));return(()=>{var a=G(),u=a.firstChild;u.firstChild;var m=u.nextSibling,y=m.firstChild,L=y.firstChild,E=L.nextSibling,F=y.nextSibling,A=m.nextSibling,D=A.firstChild;return t(u,d(W,{get href(){return V()},class:"os-client-docs-close","aria-label":"关闭帮助",children:"×"}),null),t(E,()=>$().label),t(F,d(g,{each:v,children:i=>(()=>{var l=J(),r=l.firstChild,h=r.nextSibling;return l.$$click=()=>H(i.id),t(r,()=>i.label),t(h,()=>i.hint),x(s=>{var p=b()===i.id,o=b()===i.id;return p!==s.e&&l.classList.toggle("is-active",s.e=p),o!==s.t&&k(l,"aria-pressed",s.t=o),s},{e:void 0,t:void 0}),l})()})),t(D,d(j,{get when(){return _().length>0},get fallback(){return K()},get children(){var i=B();return t(i,d(g,{get each(){return _()},children:l=>(()=>{var r=U(),h=r.firstChild,s=h.firstChild,p=s.nextSibling,o=h.nextSibling,N=o.nextSibling,S=N.firstChild;return t(s,()=>l.title),t(p,()=>l.copy),t(o,d(g,{get each(){return l.tags},children:I=>(()=>{var C=X();return t(C,I),C})()})),t(S,()=>l.action),x(()=>k(S,"href",l.href)),r})()})),i}})),a})()}T(["click"]);export{ee as WorkbenchDocsPage};