limixbot 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActivityPanel-CagbdBtd.js → ActivityPanel-BG18nJiz.js} +1 -1
- package/dist/assets/{App-DFjF9FvF.js → App-8heymKKb.js} +8 -8
- package/dist/assets/{AppEventEditor-BgX3KO6T.js → AppEventEditor-D5dGKlRO.js} +1 -1
- package/dist/assets/{BotSettingsDialog-ieeszW_3.js → BotSettingsDialog-Ct_Yktk8.js} +1 -1
- package/dist/assets/{BrowserPanel-BB3qz5lN.js → BrowserPanel-Cyws1YTJ.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-CVdcfOF8.js → BrowserProfilesManager-BEUgS3Me.js} +1 -1
- package/dist/assets/{CloudAddDialog-Bl1bRrYD.js → CloudAddDialog-UEPtzvka.js} +1 -1
- package/dist/assets/{ComputerFilesPane-piKNDkt6.js → ComputerFilesPane-BGywdHPB.js} +1 -1
- package/dist/assets/{ComputerPanel-COQweEJR.js → ComputerPanel-DLV2INTM.js} +2 -2
- package/dist/assets/{DataPanel-DdHxcsUa.js → DataPanel-CIvvbY5b.js} +1 -1
- package/dist/assets/{FilesView-Dy1gKmcM.js → FilesView-Cd5kwljm.js} +1 -1
- package/dist/assets/{GrokMoveDialog-CUnJWZi7.js → GrokMoveDialog-B2Vgd-vB.js} +1 -1
- package/dist/assets/{InspectorPanel-CWdxtHne.js → InspectorPanel-Bxm2bVHy.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-6FMUgbpC.js → KeyboardShortcutsModal-Dfcfy-EA.js} +1 -1
- package/dist/assets/{LiveDesktop-CDbI9dPy.js → LiveDesktop-fbnBEFRL.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-CslSGvNI.js → LocalVmWorkspace-CBe48xft.js} +1 -1
- package/dist/assets/{MacLocalControl-CwHtEWES.js → MacLocalControl-CpVqwJts.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-DrdGFCnN.js → MarkdownFilePreview--PNcCEvm.js} +1 -1
- package/dist/assets/{NewBotDialog-V2wMpLPn.js → NewBotDialog-CZbVbamH.js} +1 -1
- package/dist/assets/{PhoneAppDialog-DmBPVDxr.js → PhoneAppDialog-B9oozUp0.js} +1 -1
- package/dist/assets/{PluginsPanel-CMARnTMq.js → PluginsPanel-Bj3Pn0Iw.js} +1 -1
- package/dist/assets/{ProIntroduction--jIMb4bL.js → ProIntroduction-qFeFSzyk.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-Co34aJHb.js → RemoteAgentSettingsPanel-CcbUTgTg.js} +1 -1
- package/dist/assets/{RoomPanel-ClyWQx9x.js → RoomPanel-k0hQwspJ.js} +1 -1
- package/dist/assets/{RoutinesPage-DRwSDyGu.js → RoutinesPage-aANJQ--g.js} +1 -1
- package/dist/assets/{SettingsModal-CHa_Zc-J.js → SettingsModal-t10M3Ahi.js} +1 -1
- package/dist/assets/{ShareTeamDialog-BQ9h2Rd2.js → ShareTeamDialog-DeRaL6zM.js} +1 -1
- package/dist/assets/{SignedInSites-B16Ruhd0.js → SignedInSites-CfhTex9p.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-NwC4Fc9C.js → TeamLibraryPanel-C7LZ7Onp.js} +1 -1
- package/dist/assets/{TeamMapPage-DabJFxkf.js → TeamMapPage-BSvk8tOC.js} +1 -1
- package/dist/assets/{TriggersPage-Cn_f8AcZ.js → TriggersPage-BdePfInC.js} +1 -1
- package/dist/assets/{VisibilitySection-DyGNmx9n.js → VisibilitySection-CCwpvTlJ.js} +1 -1
- package/dist/assets/{WebhookTrigger-C-9-FE3w.js → WebhookTrigger-wqj5vki5.js} +1 -1
- package/dist/assets/{WorksOnGrid-M_5NkZch.js → WorksOnGrid-CenOXsZe.js} +1 -1
- package/dist/assets/{core-BNopzNRl.js → core-C_G-J8y-.js} +1 -1
- package/dist/assets/{import-name-DA_MmEsd.js → import-name-CKE76uoY.js} +1 -1
- package/dist/assets/{index-CwYJ9TX8.js → index-BBsdMDZV.js} +2 -2
- package/dist/assets/{index-D6huutPz.js → index-jlMtdqfJ.js} +1 -1
- package/dist/assets/{mcp-servers-CYvHVOYi.js → mcp-servers-DGQioE-C.js} +1 -1
- package/dist/assets/{new-bot-_oEUbcDw.js → new-bot-7IqfI7S4.js} +1 -1
- package/dist/assets/{org-library-CapoiPaN.js → org-library-BW4CqVd6.js} +1 -1
- package/dist/assets/{package-format-Cn4nABBW.js → package-format-BOH5_nvi.js} +1 -1
- package/dist/assets/{remote-desktop-panel-DbxYe3uv.js → remote-desktop-panel-B9rqQRMc.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/package.json +1 -1
- package/package.json +1 -1
package/dist/assets/{BrowserProfilesManager-CVdcfOF8.js → BrowserProfilesManager-BEUgS3Me.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t,r as y,j as s}from"./styles-BlayaJti.js";import{Z as Y,u as _,bb as ee,D as R,G as se,T as te,n as B,A as z}from"./App-
|
|
1
|
+
import{t,r as y,j as s}from"./styles-BlayaJti.js";import{Z as Y,u as _,bb as ee,D as R,G as se,T as te,n as B,A as z}from"./App-8heymKKb.js";import{r as ne,i as ie}from"./index-BBsdMDZV.js";import{S as q}from"./SignedInSites-CfhTex9p.js";import{P as re}from"./PlacesRail-v1XIqiBG.js";function G(i){return i.map(({id:l,name:x,browser:c})=>({id:l,name:x,...c?{browser:c}:{}}))}function ae(i,l){return{browserProfiles:G(l),expectedBrowserProfiles:G(i)}}function oe(){return`profile-${Y().replaceAll("-","")}`}function J(i,l){const x=i.filter(g=>g.browserProfile===l&&g.busy);if(!x.length)return null;const c=x.map(g=>g.name).join(", ");return x.length===1?t("settings.profiles.busyOne",{names:c}):t("settings.profiles.busyMany",{names:c})}function le(i,l){return i&&l?{threadId:l}:{}}function ue(i,l){const x=new URLSearchParams(l).toString();return x?`${i}${i.includes("?")?"&":"?"}${x}`:i}function pe({bot:i,onProfileChanged:l,disabled:x=!1}){const{state:c,dispatch:g,flushBotPatches:Z}=_(),r=c.config?.browserProfiles??[],v=c.config?.browserEngine?.myChrome===!0,b=c.config?.browserEngine?.myChromeOn,E=c.config?.browserEngine?.myChromeLendable===!0,w=c.bots??[],o=i?w.find(e=>e.id===i.id)??i:void 0,[O,L]=y.useState(null),[S,f]=y.useState(!1),[N,A]=y.useState(""),[h,j]=y.useState(null),[F,u]=y.useState(""),k=y.useId(),a=S||x||O!==!0;y.useEffect(()=>{let e=!0;return ne().then(n=>{e&&L(ie(n))}),()=>{e=!1}},[]);const T=async e=>{if(u(e instanceof Error?e.message:t("settings.profiles.saveError")),e instanceof z&&e.status===409)try{const n=await B("/api/config");g({type:"configStatus",config:n})}catch{u(t("settings.profiles.refreshError"))}e instanceof z&&(e.status===401||e.status===403)&&L(!1)},C=async e=>{try{const n=await B("/api/config",{method:"PATCH",body:JSON.stringify(ae(r,e))});return g({type:"configStatus",config:n}),!0}catch(n){return await T(n),!1}},K=async()=>{if(!(a||!N.trim()||r.length>=20)){f(!0),u("");try{await C([...r,{id:oe(),name:N.trim()}])&&A("")}finally{f(!1)}}},Q=async()=>{if(!(a||!h?.name.trim())){if(!r.some(e=>e.id===h.id)){u(t("settings.profiles.removed"));return}f(!0),u("");try{await C(r.map(e=>e.id===h.id?{...e,name:h.name.trim()}:e))&&j(null)}finally{f(!1)}}},V=async e=>{if(a)return;const n=J(w,e.id);if(n)return u(n);const p=w.filter(m=>m.browserProfile===e.id),$=p.length?` ${t("settings.profiles.deleteUsers",{names:p.map(m=>m.name).join(", ")})}`:"";if(window.confirm(t("settings.profiles.confirm",{name:e.name,bots:$}))){f(!0),u("");try{await C(r.filter(m=>m.id!==e.id))&&(h?.id===e.id&&j(null),o?.browserProfile===e.id&&l?.())}finally{f(!1)}}},W=async(e,n)=>{if(!(a||(e.browser??"")===n)){f(!0),u("");try{await C(r.map(p=>p.id===e.id?{...p,browser:n==="chrome"?"chrome":void 0}:p))}finally{f(!1)}}},X=async e=>{if(!(a||!o||o.busy||e===(o.browserProfile??""))){f(!0),u("");try{await Z(o.id);const n=await B(`/api/bots/${encodeURIComponent(o.id)}`,{method:"PATCH",body:JSON.stringify({browserProfile:e||null})});g({type:"botPatched",bot:n.bot}),l?.()}catch(n){await T(n)}finally{f(!1)}}};if(O===!1)return s.jsx("p",{className:"text-[12px] text-ink-secondary",children:t("settings.profiles.ownerOnly")});const I="min-w-0 flex-1 rounded-md border border-hairline/40 bg-inset px-2.5 py-2 text-[13px] text-ink outline-none focus:border-accent disabled:opacity-50",P="shrink-0 rounded-md bg-control px-2.5 py-2 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",d=o?.browserProfile??"",M=r.find(e=>e.id===d),U=e=>w.filter(n=>n.browserProfile===e).map(n=>n.name),D=e=>e?.browser==="chrome"&&(v||E),H=s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t("settings.profiles.myChromeHint")}),b&&s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t("settings.profiles.myChromeLent",{name:b.name,device:ee(b.device)})}),b?.online===!1&&s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t("settings.profiles.myChromeLentOffline",{name:b.name})})]});return s.jsxs("div",{className:"flex min-w-0 flex-col gap-3","aria-busy":S,children:[o&&s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("label",{htmlFor:`${k}-profile`,className:"text-[12px] font-medium text-ink",children:t("settings.profiles.browserSession")}),s.jsxs(R,{className:"w-full",id:`${k}-profile`,value:d,disabled:a||o.busy,onChange:e=>{X(e.target.value)},children:[s.jsx("option",{value:"",children:t("settings.profiles.own")}),r.map(e=>s.jsx("option",{value:e.id,children:e.name},e.id)),s.jsx("option",{value:"guest",children:t("settings.profiles.temporary")}),d&&d!=="guest"&&!r.some(e=>e.id===d)?s.jsx("option",{value:d,disabled:!0,children:t("settings.profiles.removed")}):null]}),s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:o.busy?t("settings.profiles.stopToSwitch"):d==="guest"?t("settings.profiles.temporaryHint"):t("settings.profiles.sharedHint")}),D(M)?s.jsxs(s.Fragment,{children:[H,!v&&s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t("settings.profiles.myChromeShare")})]}):(d===""||M)&&s.jsx(q,{target:{bot:o.id},scope:le(c.config?.team,i?.threadId),sharedBy:d?U(d):[o.name],disabled:a},`${o.id}:${d}`)]}),s.jsxs("details",{open:!o,className:"min-w-0",children:[s.jsx("summary",{className:"cursor-pointer text-[12px] font-medium text-ink-secondary hover:text-ink",children:t("settings.profiles.manage")}),s.jsxs("div",{className:"mt-3 flex flex-col gap-3",children:[s.jsxs("form",{className:"flex flex-wrap gap-2",onSubmit:e=>{e.preventDefault(),K()},children:[s.jsx("label",{htmlFor:`${k}-new`,className:"sr-only",children:t("settings.profiles.newName")}),s.jsx("input",{id:`${k}-new`,value:N,onChange:e=>A(e.target.value),maxLength:40,required:!0,disabled:a||r.length>=20,placeholder:t("settings.profiles.newName"),className:I}),s.jsxs("button",{type:"submit",disabled:a||!N.trim()||r.length>=20,className:`${P} flex items-center gap-1`,children:[s.jsx(re,{size:13}),t("settings.profiles.create")]})]}),r.length>=20&&s.jsx("p",{className:"text-[11px] text-ink-secondary",children:t("settings.profiles.limit")}),!v&&r.length>0&&s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t(E?"settings.profiles.myChromeShare":"settings.profiles.myChromeUnavailable")}),!r.length&&s.jsx("p",{className:"text-[12px] text-ink-secondary",children:t("settings.profiles.sharedEmpty")}),s.jsx("div",{className:"divide-y divide-hairline/30",children:r.map(e=>{const n=U(e.id),p=J(w,e.id),$=D(e);return s.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(se,{size:14,className:"shrink-0 text-ink-secondary"}),h?.id===e.id?s.jsxs("form",{className:"flex min-w-0 flex-1 flex-wrap gap-2",onSubmit:m=>{m.preventDefault(),Q()},children:[s.jsx("input",{autoFocus:!0,value:h.name,onChange:m=>j({id:e.id,name:m.target.value}),maxLength:40,required:!0,disabled:a,className:I,"aria-label":t("settings.profiles.nameAria")}),s.jsx("button",{type:"submit",disabled:a||!h.name.trim(),className:P,children:t("common.save")}),s.jsx("button",{type:"button",disabled:S,onClick:()=>j(null),className:P,children:t("common.cancel")})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",disabled:a,onClick:()=>{j({id:e.id,name:e.name}),u("")},className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-ink hover:underline disabled:opacity-50",title:t("settings.profiles.rename"),children:e.name}),s.jsxs("button",{type:"button",onClick:()=>{V(e)},disabled:a||!!p,title:p??t("settings.profiles.deleteTitle"),"aria-label":`${t("common.delete")} ${e.name}`,className:"flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-danger disabled:opacity-50",children:[s.jsx(te,{size:13}),t("common.delete")]})]})]}),s.jsx("p",{className:"break-words pl-6 text-[11px] text-ink-secondary",children:n.length?t("settings.profiles.usedBy",{names:n.join(", ")}):t("settings.profiles.notInUse")}),s.jsxs("div",{className:"flex min-w-0 flex-col gap-2 pl-6 pt-1",children:[s.jsxs("label",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[t("settings.profiles.browserLabel"),s.jsxs(R,{size:"sm",value:e.browser??"",disabled:a,onChange:m=>{W(e,m.target.value)},children:[s.jsx("option",{value:"",children:t("settings.profiles.builtIn")}),s.jsx("option",{value:"chrome",disabled:!v,children:t("settings.profiles.myChrome")})]})]}),$?H:s.jsx(q,{target:{profile:e.id},sharedBy:n,disabled:a})]})]},e.id)})})]})]}),F&&s.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:F})]})}export{pe as B,le as b,ue as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,A as z,B as ve,H as U,t as n,D as se,Q,E as X,F as Pe,G as pe,I as Ce,J as Ee,K as fe,M as ze,N as Ae,O as Ue,T as qe,U as Me,V as G,a as ue,W as $e,Y as Ke,r as d,Z as We,$ as Ve,a0 as we,a1 as Ge,X as Je,a2 as Qe,a3 as Xe,a4 as Ye,a5 as Ze,a6 as et,a7 as Le,a8 as tt}from"./styles-BlayaJti.js";import{L as nt,z as st,C as at,y as J,F as lt,G as ot,H as rt,S as dt,I as ct,J as it}from"./PlacesRail-v1XIqiBG.js";import{u as ut}from"./App-DFjF9FvF.js";import"./monitor-DFEzCfQk.js";import"./index-CwYJ9TX8.js";import"./MenuMotion-IQitGKH4.js";function pt({name:t,color:l,busy:o,interest:r,openFailed:s,onInterest:u,onOpen:p}){return e.jsxs("div",{"data-cloud-add":"has-cloud",className:z,children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(ve,{color:l,size:32}),e.jsx(U,{title:n("cloudBuy.one.title"),sub:n("cloudBuy.one.sub",{name:t})})]}),e.jsxs("div",{className:se,children:[r!=="sent"&&e.jsx("button",{type:"button",className:Q,disabled:o,onClick:u,children:n("cloudBuy.one.email")}),e.jsx("button",{type:"button",className:X,disabled:o,onClick:p,children:n("cloudBuy.setup.open",{name:t})})]}),e.jsxs("div",{"aria-live":"polite",className:"text-[13px] leading-[18px] empty:-mt-5",children:[r==="sent"&&e.jsx("p",{className:"text-ink-secondary",children:n("cloudBuy.one.thanks")}),r==="failed"&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.one.failed")}),s&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.openFailed",{name:t})})]})]})}function ie({kind:t,line:l,onRetry:o,onClose:r}){return e.jsxs("div",{"data-cloud-add":t,className:z,children:[e.jsx(U,{title:n("cloudAdd.title")}),l?e.jsx("p",{role:"alert",className:"text-[14px] leading-5 text-ink",children:l}):e.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] leading-[18px] text-ink-secondary",children:[e.jsx(nt,{size:14,className:"animate-spin motion-reduce:animate-none","aria-hidden":"true"}),n("cloudAdd.checking")]}),e.jsxs("div",{className:se,children:[e.jsx("button",{type:"button",className:Q,onClick:r,children:n("cloudAdd.close")}),o&&e.jsx("button",{type:"button",className:X,onClick:o,children:n("cloudAdd.tryAgain")})]})]})}function ft({plan:t,offer:l,browser:o,late:r,link:s,email:u,busy:p,copied:v,failed:N,onReopen:k,onCopy:I,onChangePlan:q}){const y=l?.plans.find(M=>M.tier===t)??null,E=y?Pe(y):pe(t),A=y?.trialDays===1?n("cloudBuy.pay.planTrial.one",{plan:E,due:Ce(0)}):y?.trialDays?n("cloudBuy.pay.planTrial.many",{plan:E,days:y.trialDays,due:Ce(0)}):y?n("cloudBuy.pay.planPaid",{plan:E,price:Ee(y.amount/100)}):E;return e.jsxs("div",{"data-cloud-add":r?"waiting-late":o==="signin"?"waiting-signin":"waiting",className:z,children:[e.jsx(U,{title:r?n("cloudBuy.pay.lateTitle"):n("cloudAdd.browserTitle"),sub:r?n("cloudBuy.pay.lateSub"):n(o==="signin"?"cloudBuy.pay.subSignIn":"cloudBuy.pay.sub")}),e.jsx(fe,{items:[{key:"signed-in",state:"done",title:n("cloudBuy.pay.signedIn"),detail:u},{key:"payment",state:"now",title:n("cloudBuy.pay.waiting"),detail:A},{key:"setup",state:"next",title:n("cloudBuy.pay.setup"),detail:n("cloudBuy.pay.setupHint")}]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("button",{type:"button",className:r?X:Q,disabled:p,onClick:k,children:[e.jsx(st,{size:14,"aria-hidden":"true"}),n("cloudAdd.reopenCheckout")]}),s&&e.jsxs("button",{type:"button",className:Q,disabled:p,onClick:I,children:[e.jsx(at,{size:14,"aria-hidden":"true"}),n("cloudBuy.pay.copy")]}),e.jsx("button",{type:"button",className:`${ze} ms-1 px-1 py-1`,onClick:q,children:n("cloudAdd.changePlan")})]}),e.jsxs("div",{"aria-live":"polite",className:"text-[13px] leading-[18px] empty:-mt-5",children:[v&&e.jsx("p",{className:"text-ink-secondary",children:n("cloudBuy.pay.copied")}),N&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.pay.failed")})]})]})}const R=[["reserving","cloudHome.step.reserving"],["storage","cloudHome.step.storage"],["starting","cloudBuy.step.starting"],["checking","cloudHome.step.checking"]];function mt({tier:t,trial:l,credit:o},r){if(r)return n("cloudAdd.receivedTitle");const s=pe(t??l?.tier??void 0);return l?o?n("cloudBuy.setup.badgeCredit",{plan:s,credit:Ee(o.grantedUsd)}):n("cloudBuy.setup.badgeTrial",{plan:s}):n("cloudBuy.setup.badgePaid",{plan:s})}function xt({started:t,received:l,step:o,slow:r,ready:s,sleeps:u=!1,name:p,typed:v,color:N,counting:k,busy:I,openFailed:q,onName:y,onColor:E,onOpen:A,onNotNow:M}){const _=s?R.length:Math.max(0,R.findIndex(([i])=>i===o)),C=pe(t.tier??t.trial?.tier??void 0);return e.jsxs("div",{"data-cloud-add":s?"ready":l?"received":"starting","data-cloud-setup":s?"ready":o??"reserving",className:z,children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ue,{children:mt(t,l)}),e.jsx(U,{title:s?n("cloudBuy.ready.title",{name:p}):n("cloudBuy.setup.title"),sub:s?n("cloudBuy.ready.sub"):l?n("cloudAccount.purchaseNoteNoDate"):n("cloudBuy.setup.sub")})]}),e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ae,{value:_/R.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:R.map(([i,w],j)=>({key:i,title:n(w,{name:p}),state:j<_?"done":j===_?"now":"next"}))}),r&&!s&&e.jsx("p",{role:"status",className:"px-3 text-[13px] leading-[18px] text-ink-secondary",children:n("cloudHome.slow")})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"cloud-add-name",className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.name")}),e.jsx("input",{id:"cloud-add-name",value:v,maxLength:Me,placeholder:n("cloudSetup.myCloud"),autoComplete:"off",spellCheck:!1,onChange:i=>y(i.target.value),className:qe})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{id:"cloud-add-color",className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.color")}),e.jsx("div",{role:"radiogroup","aria-labelledby":"cloud-add-color",className:"flex flex-wrap gap-2",children:G.map(i=>e.jsx("button",{type:"button",role:"radio","aria-checked":i===N,"aria-label":n(Ke[i]),tabIndex:i===N?0:-1,"data-color":i,onClick:()=>E(i),onKeyDown:w=>{const j=G.indexOf(i),$=w.key==="ArrowRight"||w.key==="ArrowDown"?1:w.key==="ArrowLeft"||w.key==="ArrowUp"?-1:0;if(!$)return;w.preventDefault();const Y=G[(j+$+G.length)%G.length];E(Y),w.currentTarget.parentElement?.querySelector(`[data-color="${Y}"]`)?.focus()},style:{background:$e(i)},className:ue("size-[26px] rounded-lg border-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",i===N?"border-ink shadow-[inset_0_0_0_2px_var(--color-app)]":"border-transparent")},i))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.preview")}),e.jsxs("span",{"data-cloud-preview":!0,className:"inline-flex max-w-full items-center gap-2 self-start rounded-[12px] border-[0.5px] border-ink/10 bg-menu py-1.5 pe-3 ps-1.5",children:[e.jsx(ve,{color:N}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-[13px] font-medium leading-4 text-ink",children:p}),e.jsx("span",{className:"block truncate text-[12px] text-ink-tertiary",children:n(u?"cloudBuy.setup.previewLineSleeps":"cloudBuy.setup.previewLine",{plan:C})})]})]})]})]})]}),s&&k===null&&e.jsx("p",{className:"text-[13px] leading-[18px] text-ink-tertiary",children:n("cloudBuy.ready.hint",{name:p})}),e.jsxs("div",{className:se,children:[k!==null&&e.jsx("span",{role:"status",className:"me-1 text-[13px] text-ink-secondary",children:n("cloudBuy.setup.openingIn",{seconds:k})}),k!==null&&e.jsx("button",{type:"button",className:Q,onClick:M,children:n("notice.notNow")}),e.jsx("button",{type:"button",className:X,disabled:!s||I,onClick:A,children:n("cloudBuy.setup.open",{name:p})})]}),q&&e.jsx("p",{role:"alert",className:"-mt-2 text-end text-[13px] leading-[18px] text-danger",children:n("cloudBuy.openFailed",{name:p})})]})}function yt({team:t,step:l,slow:o}){const r=Math.max(0,R.findIndex(([u])=>u===l)),s=t??n("cloudBuy.team.unnamed");return e.jsxs("div",{"data-cloud-add":"team-starting","data-cloud-setup":l??"reserving",className:z,children:[e.jsx(U,{title:n("cloudBuy.team.setupTitle"),sub:n("cloudBuy.team.setupSub")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ae,{value:r/R.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:R.map(([u,p],v)=>({key:u,title:n(p,{name:s}),state:v<r?"done":v===r?"now":"next"}))}),o&&e.jsx("p",{role:"status",className:"px-3 text-[13px] leading-[18px] text-ink-secondary",children:n("cloudHome.slow")})]})]})}function gt({name:t,busy:l,openFailed:o,onOpen:r}){return e.jsxs("div",{"data-cloud-add":"team-ready",className:z,children:[e.jsx(U,{title:n("cloudBuy.team.readyTitle"),sub:n("cloudBuy.team.readySub",{name:t})}),e.jsx("p",{className:"text-[13px] leading-[18px] text-ink-tertiary",children:n("cloudBuy.ready.hint",{name:t})}),e.jsx("div",{className:se,children:e.jsx("button",{type:"button","data-autofocus":!0,className:X,disabled:l,onClick:r,children:n("cloudBuy.setup.open",{name:t})})}),o&&e.jsx("p",{role:"alert",className:"-mt-2 text-end text-[13px] leading-[18px] text-danger",children:n("cloudBuy.openFailed",{name:t})})]})}function ht({view:t,ui:l,actions:o}){switch(t.kind){case"checking":return e.jsx(ie,{kind:"checking",line:null,onClose:o.close});case"unreachable":return e.jsx(ie,{kind:"unreachable",line:n("cloudAdd.unreachable"),onRetry:o.retry,onClose:o.close});case"error":return e.jsx(ie,{kind:`error-${t.reason}`,line:n(t.reason==="rate-limited"?"cloudAdd.rateLimited":"cloudAdd.failed"),onRetry:o.retry,onClose:o.close});case"offer":return e.jsx(ct,{offer:t.offer,current:l.current,now:l.now,busy:l.busy,signedOut:t.signedOut,notice:t.notice?n(t.notice==="code-expired"?"cloudAdd.codeExpired":t.notice==="signin-ended"?"cloudAdd.signInEnded":t.notice==="terms"?"cloudBuy.termsChanged":"cloudAdd.preparing"):null,onStart:o.start,onSignIn:o.signIn});case"sign-in":return e.jsx(dt,{phase:t.phase,email:l.email,code:l.code,profileEmail:l.profileEmail,busy:l.busy,now:l.now,onBack:o.back,onEmail:o.email,onSend:o.sendCode,onChangeEmail:o.changeEmail,onCode:o.code,onResend:o.resend,onBrowser:o.browser});case"signing-in":return e.jsx(rt,{code:t.code,checkout:t.checkout,busy:l.busy,trial:l.offerShown?!!Le(l.offerShown,l.chosen).trialDays:!1,onReopen:o.reopenBrowser,onCancel:o.cancelSignIn});case"waiting":return e.jsx(ft,{plan:t.plan,offer:l.offerShown,browser:t.browser,late:t.late,link:t.link,email:t.email,busy:l.busy,copied:l.copied,failed:l.payFailed,onReopen:o.reopenCheckout,onCopy:o.copyLink,onChangePlan:o.changePlan});case"starting":case"ready":return e.jsx(xt,{started:t,received:t.kind==="starting"&&t.received,step:t.kind==="starting"?t.step:null,slow:t.kind==="starting"&&t.slow,ready:t.kind==="ready",sleeps:et(t,l.offerShown),name:l.look.name,typed:l.look.typed,color:l.look.color,counting:l.counting,busy:l.busy,openFailed:l.openFailed,onName:o.name,onColor:o.color,onOpen:o.openCloud,onNotNow:o.notNow});case"has-cloud":return e.jsx(pt,{name:l.look.name,color:l.look.color,busy:l.busy,interest:l.interest,openFailed:l.openFailed,onInterest:o.interest,onOpen:o.openCloud});case"team-starting":return e.jsx(yt,{team:t.team,step:t.step,slow:t.slow});case"team-ready":return e.jsx(gt,{name:t.team.name,busy:l.busy,openFailed:l.openFailed,onOpen:()=>o.openTeam(t.team.id)});case"settings":return null}}const bt={offer:"max-w-[920px]",starting:"max-w-[720px]",ready:"max-w-[720px]"},kt=new Set(["sign-in","signing-in","waiting","starting","team-starting"]);function Be({kind:t,staging:l,onClose:o,children:r}){return e.jsx("div",{className:"ui-scrim fixed inset-0 z-[60] flex items-center justify-center p-4 sm:p-6",onMouseDown:s=>s.target===s.currentTarget&&!kt.has(t)&&o(),children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cloud-add-title","data-cloud-add-dialog":!0,tabIndex:-1,className:ue(Ze,"group/sheet animate-pop-in relative max-h-full w-full overflow-y-auto overscroll-contain outline-none",bt[t]??"max-w-[540px]"),children:[e.jsx("button",{type:"button",onClick:o,"aria-label":n("cloudAdd.close"),className:ue(Xe,Qe,"absolute end-4 top-4 z-10"),children:e.jsx(Je,{size:16})}),l&&e.jsx(Ye,{className:"absolute end-14 top-[22px] z-10 group-has-[[data-night-card]]/sheet:bg-app"}),r]})})}const jt=["offer","checking","unreachable","waiting","sign-in","signing-in"],St="button:not([disabled]):not([tabindex='-1']), input:not([disabled]):not([tabindex='-1']), [href], [tabindex='0']",Nt=t=>t.status==="connected"&&t.entitlement?.plan==="free"&&!t.purchase&&!t.machine,Ct=t=>t?.status==="connected"&&t.entitlement?.plan==="pro"&&t.entitlement.status==="active"?t.entitlement.tier??"pro":null;function It({now:t=Date.now}){const{state:l,dispatch:o}=ut(),r=l.cloudAdd,s=window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[u,p]=d.useState(null),[v,N]=d.useState(void 0),[k,I]=d.useState(null),[q,y]=d.useState(null),[E,A]=d.useState(!1),[M,_]=d.useState(!1),[C,i]=d.useState(!1),[w,j]=d.useState(!1),[$,Y]=d.useState(0),[Z,me]=d.useState([]),[b,h]=d.useState(null),[T,O]=d.useState({email:"",code:""}),[B,ee]=d.useState(null),[F,H]=d.useState(null),[P,S]=d.useState(null),[,Ie]=d.useState(0),[xe,ae]=d.useState(!1),[Te,le]=d.useState(!1),[Oe,Fe]=d.useState(!1),L=!!(r&&s),oe=l.config?.profile?.email?.trim()||null,re=ot();d.useEffect(()=>{if(!L||!s)return;let a=!0,c=!1;const g=s.onState(x=>{c=!0,a&&p(x)});return s.state().then(x=>{a&&!c&&p(x)}).catch(()=>{}),()=>{a=!1,g()}},[L,s]);const m=L?We(u,v,{now:t(),error:q,choosing:M,conflict:E,signIn:b,arrived:xe,terms:Te}):null,ye=L&&m&&jt.includes(m.kind)&&u?`${u.status}:${JSON.stringify(u.offer??null)}:${$}`:null;d.useEffect(()=>{if(!ye||!s?.offer)return;let a=!0;return s.offer().then(c=>{a&&N(c)},()=>{a&&N(null)}),()=>{a=!1}},[ye,s]);const de=n("cloudSetup.myCloud"),K={typed:B?.typed??de,color:B?.color??we,name:Ve(B?.typed??de,de)},D=()=>{b&&s?.signInCancel?.().catch(()=>{}),o({type:"closeCloudAdd"}),y(null),A(!1),_(!1),j(!1),me([]),I(null),h(null),O({email:"",code:""}),ee(null),H(null),S(null),ae(!1),le(!1)};d.useEffect(()=>{if(!L)return;const a=document.activeElement,c=a&&a!==document.body&&typeof a.focus=="function"?a:null;r?.signIn&&(h({step:"email",intent:!1,problem:null}),O({email:oe??"",code:""}));const g=x=>{if(x.key==="Escape"){x.preventDefault(),D();return}if(x.key!=="Tab")return;const V=[...document.querySelector("[data-cloud-add-dialog]")?.querySelectorAll(St)??[]];if(!V.length)return;x.preventDefault();const Ne=V.indexOf(document.activeElement);V[Ne===-1?0:(Ne+(x.shiftKey?-1:1)+V.length)%V.length].focus()};return window.addEventListener("keydown",g,!0),(document.querySelector("#cloud-add-title")??document.querySelector("[data-cloud-add-dialog]"))?.focus(),()=>{window.removeEventListener("keydown",g,!0),c?.isConnected&&c.focus()}},[L]),d.useEffect(()=>{if(!(!L||!s?.sheet||re))return s.sheet(!0).catch(()=>{}),()=>{s.sheet?.(!1).catch(()=>{})}},[L,s,re]);const f=m?.kind??null,te=m?.kind==="sign-in"?`sign-in-${m.phase.step}`:f;d.useEffect(()=>{!te||te==="checking"||te==="settings"||document.activeElement?.closest?.("[data-cloud-add-dialog]")||(document.querySelector("[data-cloud-add-dialog] [data-autofocus]")??document.querySelector("#cloud-add-title"))?.focus()},[te]),d.useEffect(()=>{(f==="waiting"||f==="starting"||f==="ready")&&!xe&&ae(!0),(f==="ready"||f==="team-ready")&&s?.readySeen?.().catch(()=>{})},[f]),d.useEffect(()=>{if(!f||!r)return;if(f==="settings"){D(),o({type:"toggleAppSettings",open:!0,section:"cloudAccount"});return}if(f==="checking")return;const a=Z.length===0;a&&J("cloud_dialog_shown",{source:r.source}),["starting","ready"].includes(f)&&Z.includes(f),(a||!Z.includes(f))&&me([...Z,f])},[f]),d.useEffect(()=>{if(!f||!["starting","ready","has-cloud"].includes(f)||B||!s?.look)return;let a=!0;return s.look().then(c=>{a&&ee({typed:c.name,color:Ge(c.color)??we,dirty:f!=="has-cloud"})},()=>{}),()=>{a=!1}},[f]),d.useEffect(()=>{if(!B?.dirty||!s?.setLook)return;const a=setTimeout(()=>{s.setLook?.(K.name,B.color).catch(()=>{})},400);return()=>clearTimeout(a)},[B?.typed,B?.color]),d.useEffect(()=>{f!=="ready"||F!==null||H(!re&&typeof document.hasFocus=="function"&&document.hasFocus()?3:"off")},[f]);const ge=b?.step==="code"?b.resendAt:0;d.useEffect(()=>{if(!ge||ge<=t())return;const a=setTimeout(()=>Ie(t()),1e3);return()=>clearTimeout(a)}),d.useEffect(()=>{if(P!=="copied")return;const a=setTimeout(()=>S(null),2500);return()=>clearTimeout(a)},[P]);const ne=a=>{C||(i(!0),j(!1),a().catch(()=>y("failed")).finally(()=>i(!1)))},he=()=>{C||!s||(i(!0),j(!1),H("done"),(async()=>{B?.dirty&&s.setLook&&await s.setLook(K.name,B.color).catch(()=>{}),await s.connectHome()})().then(()=>D(),()=>j(!0)).finally(()=>i(!1)))},De=a=>{C||!s?.openTeam||(i(!0),j(!1),s.openTeam(a).then(()=>D(),()=>j(!0)).finally(()=>i(!1)))};d.useEffect(()=>{if(typeof F!="number")return;const a=setTimeout(()=>{F>1?H(F-1):he()},1e3);return()=>clearTimeout(a)},[F]);const be=typeof F=="number";if(d.useEffect(()=>{if(!be)return;const a=()=>H("off");return window.addEventListener("blur",a),()=>window.removeEventListener("blur",a)},[be]),!L||!m||!r||!s||m.kind==="settings")return null;if(m.kind==="has-cloud"&&u?.status==="connected"&&u.clouds&&window.ogb?.cloudAdd&&(u.addCloud?.canAdd!==!1||u.adding&&!u.adding.done))return e.jsx(Be,{kind:Oe?"offer":"has-cloud",staging:u.staging===!0,onClose:D,children:e.jsx(lt,{onClose:D,onFirstCloud:()=>{},onWide:Fe,source:r.source})});const W=v??null,ke=()=>m.kind==="waiting"&&!k?m.plan:W?Le(W,k).tier:null,ce=async a=>{if(!a||!s.checkout){y("failed");return}W?.plans.find(x=>x.tier===a)?.trialDays;const c=await s.checkout(a,r.source),g=c.outcome;p(c.state),g==="opened"||g==="signing-in"?(_(!1),y(null),A(!1),S(null),le(!1),J("cloud_checkout_opened",{source:r.source})):g==="rate-limited"?y("rate-limited"):g==="failed"?y("failed"):A(!0)},je=a=>{h({step:"email",intent:a,problem:null}),O({email:T.email||oe||"",code:""})},Se=()=>{if(C||!s.signInStart||!b||b.step==="done")return;const a=b;i(!0),s.signInStart(T.email).then(c=>{c.outcome==="sent"?(h({step:"code",intent:a.intent,email:c.email,resendAt:c.resendAt,problem:null,triesLeft:null,...c.signupOpen===!1?{signupOpen:!1}:{}}),O({email:c.email,code:""}),J("cloud_signin",{source:r.source})):h({...a,problem:c.outcome})},()=>h({...a,problem:"failed"})).finally(()=>i(!1))},_e=a=>{if(!s.signInVerify||b?.step!=="code")return;const c=b,g=c.intent?ke():null;i(!0),(async()=>{try{const x=await s.signInVerify(a);if(x.outcome!=="signed-in"){O({email:T.email,code:""}),h({...c,problem:x.outcome,triesLeft:x.outcome==="wrong-code"?x.triesLeft:null});return}p(x.state),ae(!0),J("cloud_signin",{step:"signed_in",source:r.source}),g&&Nt(x.state)&&(tt(W,x.state.offer,g)?(h({step:"done",intent:!0}),await ce(g)):(le(!0),I(g))),h(null),O({email:T.email,code:""})}catch{h({...c,problem:"failed",triesLeft:null})}finally{i(!1)}})()},Re={start:a=>{if(I(a),A(!1),m.kind==="offer"&&m.signedOut&&s.signInStart){je(!0);return}ne(()=>ce(a))},signIn:()=>je(!1),back:()=>{h(null),s.signInCancel?.().catch(()=>{})},email:a=>O({email:a,code:T.code}),sendCode:Se,changeEmail:()=>{b&&(h({step:"email",intent:b.intent,problem:null}),s.signInCancel?.().catch(()=>{}))},code:a=>{const c=it(a);O({email:T.email,code:c}),c.length===8&&!C&&_e(c)},resend:Se,browser:()=>ne(async()=>{const a=b?.intent?ke():null;h(null),await s.signInCancel?.().catch(()=>{}),J("cloud_signin",{source:r.source}),a?await ce(a):p(await s.begin())}),reopenBrowser:()=>ne(async()=>p(await s.reopen())),cancelSignIn:()=>ne(async()=>p(await s.cancel())),reopenCheckout:()=>{if(m.kind!=="waiting"||C)return;i(!0),S(null),(s.reopenCheckout?s.reopenCheckout(m.plan,r.source):s.checkout(m.plan,r.source)).then(c=>{p(c.state),c.outcome!=="opened"&&S("pay-failed")},()=>S("pay-failed")).finally(()=>i(!1))},copyLink:()=>{s.copyCheckoutLink?.().then(a=>S(a?"copied":"pay-failed"),()=>S("pay-failed"))},changePlan:()=>{I(m.kind==="waiting"?m.plan:k),_(!0),S(null)},retry:()=>{y(null),A(!1),N(void 0),Y($+1)},name:a=>ee({typed:a,color:K.color,dirty:!0}),color:a=>ee({typed:K.typed,color:a,dirty:!0}),openCloud:he,openTeam:De,notNow:()=>H("off"),interest:()=>{C||!s.interest||(i(!0),s.interest().then(()=>S("interest-sent"),()=>S("interest-failed")).finally(()=>i(!1)))},close:D},He={chosen:k,current:Ct(u),offerShown:W,now:t(),busy:C,openFailed:w,email:T.email,code:T.code,profileEmail:oe,look:K,counting:typeof F=="number"?F:null,copied:P==="copied",payFailed:P==="pay-failed",interest:P==="interest-sent"?"sent":P==="interest-failed"?"failed":null};return e.jsx(Be,{kind:m.kind,staging:u?.staging===!0,onClose:D,children:e.jsx(ht,{view:m,ui:He,actions:Re})})}export{It as CloudAddDialog,ht as CloudAddPanel,Be as CloudAddSheet};
|
|
1
|
+
import{j as e,A as z,B as ve,H as U,t as n,D as se,Q,E as X,F as Pe,G as pe,I as Ce,J as Ee,K as fe,M as ze,N as Ae,O as Ue,T as qe,U as Me,V as G,a as ue,W as $e,Y as Ke,r as d,Z as We,$ as Ve,a0 as we,a1 as Ge,X as Je,a2 as Qe,a3 as Xe,a4 as Ye,a5 as Ze,a6 as et,a7 as Le,a8 as tt}from"./styles-BlayaJti.js";import{L as nt,z as st,C as at,y as J,F as lt,G as ot,H as rt,S as dt,I as ct,J as it}from"./PlacesRail-v1XIqiBG.js";import{u as ut}from"./App-8heymKKb.js";import"./monitor-DFEzCfQk.js";import"./index-BBsdMDZV.js";import"./MenuMotion-IQitGKH4.js";function pt({name:t,color:l,busy:o,interest:r,openFailed:s,onInterest:u,onOpen:p}){return e.jsxs("div",{"data-cloud-add":"has-cloud",className:z,children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(ve,{color:l,size:32}),e.jsx(U,{title:n("cloudBuy.one.title"),sub:n("cloudBuy.one.sub",{name:t})})]}),e.jsxs("div",{className:se,children:[r!=="sent"&&e.jsx("button",{type:"button",className:Q,disabled:o,onClick:u,children:n("cloudBuy.one.email")}),e.jsx("button",{type:"button",className:X,disabled:o,onClick:p,children:n("cloudBuy.setup.open",{name:t})})]}),e.jsxs("div",{"aria-live":"polite",className:"text-[13px] leading-[18px] empty:-mt-5",children:[r==="sent"&&e.jsx("p",{className:"text-ink-secondary",children:n("cloudBuy.one.thanks")}),r==="failed"&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.one.failed")}),s&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.openFailed",{name:t})})]})]})}function ie({kind:t,line:l,onRetry:o,onClose:r}){return e.jsxs("div",{"data-cloud-add":t,className:z,children:[e.jsx(U,{title:n("cloudAdd.title")}),l?e.jsx("p",{role:"alert",className:"text-[14px] leading-5 text-ink",children:l}):e.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] leading-[18px] text-ink-secondary",children:[e.jsx(nt,{size:14,className:"animate-spin motion-reduce:animate-none","aria-hidden":"true"}),n("cloudAdd.checking")]}),e.jsxs("div",{className:se,children:[e.jsx("button",{type:"button",className:Q,onClick:r,children:n("cloudAdd.close")}),o&&e.jsx("button",{type:"button",className:X,onClick:o,children:n("cloudAdd.tryAgain")})]})]})}function ft({plan:t,offer:l,browser:o,late:r,link:s,email:u,busy:p,copied:v,failed:N,onReopen:k,onCopy:I,onChangePlan:q}){const y=l?.plans.find(M=>M.tier===t)??null,E=y?Pe(y):pe(t),A=y?.trialDays===1?n("cloudBuy.pay.planTrial.one",{plan:E,due:Ce(0)}):y?.trialDays?n("cloudBuy.pay.planTrial.many",{plan:E,days:y.trialDays,due:Ce(0)}):y?n("cloudBuy.pay.planPaid",{plan:E,price:Ee(y.amount/100)}):E;return e.jsxs("div",{"data-cloud-add":r?"waiting-late":o==="signin"?"waiting-signin":"waiting",className:z,children:[e.jsx(U,{title:r?n("cloudBuy.pay.lateTitle"):n("cloudAdd.browserTitle"),sub:r?n("cloudBuy.pay.lateSub"):n(o==="signin"?"cloudBuy.pay.subSignIn":"cloudBuy.pay.sub")}),e.jsx(fe,{items:[{key:"signed-in",state:"done",title:n("cloudBuy.pay.signedIn"),detail:u},{key:"payment",state:"now",title:n("cloudBuy.pay.waiting"),detail:A},{key:"setup",state:"next",title:n("cloudBuy.pay.setup"),detail:n("cloudBuy.pay.setupHint")}]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("button",{type:"button",className:r?X:Q,disabled:p,onClick:k,children:[e.jsx(st,{size:14,"aria-hidden":"true"}),n("cloudAdd.reopenCheckout")]}),s&&e.jsxs("button",{type:"button",className:Q,disabled:p,onClick:I,children:[e.jsx(at,{size:14,"aria-hidden":"true"}),n("cloudBuy.pay.copy")]}),e.jsx("button",{type:"button",className:`${ze} ms-1 px-1 py-1`,onClick:q,children:n("cloudAdd.changePlan")})]}),e.jsxs("div",{"aria-live":"polite",className:"text-[13px] leading-[18px] empty:-mt-5",children:[v&&e.jsx("p",{className:"text-ink-secondary",children:n("cloudBuy.pay.copied")}),N&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.pay.failed")})]})]})}const R=[["reserving","cloudHome.step.reserving"],["storage","cloudHome.step.storage"],["starting","cloudBuy.step.starting"],["checking","cloudHome.step.checking"]];function mt({tier:t,trial:l,credit:o},r){if(r)return n("cloudAdd.receivedTitle");const s=pe(t??l?.tier??void 0);return l?o?n("cloudBuy.setup.badgeCredit",{plan:s,credit:Ee(o.grantedUsd)}):n("cloudBuy.setup.badgeTrial",{plan:s}):n("cloudBuy.setup.badgePaid",{plan:s})}function xt({started:t,received:l,step:o,slow:r,ready:s,sleeps:u=!1,name:p,typed:v,color:N,counting:k,busy:I,openFailed:q,onName:y,onColor:E,onOpen:A,onNotNow:M}){const _=s?R.length:Math.max(0,R.findIndex(([i])=>i===o)),C=pe(t.tier??t.trial?.tier??void 0);return e.jsxs("div",{"data-cloud-add":s?"ready":l?"received":"starting","data-cloud-setup":s?"ready":o??"reserving",className:z,children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ue,{children:mt(t,l)}),e.jsx(U,{title:s?n("cloudBuy.ready.title",{name:p}):n("cloudBuy.setup.title"),sub:s?n("cloudBuy.ready.sub"):l?n("cloudAccount.purchaseNoteNoDate"):n("cloudBuy.setup.sub")})]}),e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ae,{value:_/R.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:R.map(([i,w],j)=>({key:i,title:n(w,{name:p}),state:j<_?"done":j===_?"now":"next"}))}),r&&!s&&e.jsx("p",{role:"status",className:"px-3 text-[13px] leading-[18px] text-ink-secondary",children:n("cloudHome.slow")})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"cloud-add-name",className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.name")}),e.jsx("input",{id:"cloud-add-name",value:v,maxLength:Me,placeholder:n("cloudSetup.myCloud"),autoComplete:"off",spellCheck:!1,onChange:i=>y(i.target.value),className:qe})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{id:"cloud-add-color",className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.color")}),e.jsx("div",{role:"radiogroup","aria-labelledby":"cloud-add-color",className:"flex flex-wrap gap-2",children:G.map(i=>e.jsx("button",{type:"button",role:"radio","aria-checked":i===N,"aria-label":n(Ke[i]),tabIndex:i===N?0:-1,"data-color":i,onClick:()=>E(i),onKeyDown:w=>{const j=G.indexOf(i),$=w.key==="ArrowRight"||w.key==="ArrowDown"?1:w.key==="ArrowLeft"||w.key==="ArrowUp"?-1:0;if(!$)return;w.preventDefault();const Y=G[(j+$+G.length)%G.length];E(Y),w.currentTarget.parentElement?.querySelector(`[data-color="${Y}"]`)?.focus()},style:{background:$e(i)},className:ue("size-[26px] rounded-lg border-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",i===N?"border-ink shadow-[inset_0_0_0_2px_var(--color-app)]":"border-transparent")},i))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.preview")}),e.jsxs("span",{"data-cloud-preview":!0,className:"inline-flex max-w-full items-center gap-2 self-start rounded-[12px] border-[0.5px] border-ink/10 bg-menu py-1.5 pe-3 ps-1.5",children:[e.jsx(ve,{color:N}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-[13px] font-medium leading-4 text-ink",children:p}),e.jsx("span",{className:"block truncate text-[12px] text-ink-tertiary",children:n(u?"cloudBuy.setup.previewLineSleeps":"cloudBuy.setup.previewLine",{plan:C})})]})]})]})]})]}),s&&k===null&&e.jsx("p",{className:"text-[13px] leading-[18px] text-ink-tertiary",children:n("cloudBuy.ready.hint",{name:p})}),e.jsxs("div",{className:se,children:[k!==null&&e.jsx("span",{role:"status",className:"me-1 text-[13px] text-ink-secondary",children:n("cloudBuy.setup.openingIn",{seconds:k})}),k!==null&&e.jsx("button",{type:"button",className:Q,onClick:M,children:n("notice.notNow")}),e.jsx("button",{type:"button",className:X,disabled:!s||I,onClick:A,children:n("cloudBuy.setup.open",{name:p})})]}),q&&e.jsx("p",{role:"alert",className:"-mt-2 text-end text-[13px] leading-[18px] text-danger",children:n("cloudBuy.openFailed",{name:p})})]})}function yt({team:t,step:l,slow:o}){const r=Math.max(0,R.findIndex(([u])=>u===l)),s=t??n("cloudBuy.team.unnamed");return e.jsxs("div",{"data-cloud-add":"team-starting","data-cloud-setup":l??"reserving",className:z,children:[e.jsx(U,{title:n("cloudBuy.team.setupTitle"),sub:n("cloudBuy.team.setupSub")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ae,{value:r/R.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:R.map(([u,p],v)=>({key:u,title:n(p,{name:s}),state:v<r?"done":v===r?"now":"next"}))}),o&&e.jsx("p",{role:"status",className:"px-3 text-[13px] leading-[18px] text-ink-secondary",children:n("cloudHome.slow")})]})]})}function gt({name:t,busy:l,openFailed:o,onOpen:r}){return e.jsxs("div",{"data-cloud-add":"team-ready",className:z,children:[e.jsx(U,{title:n("cloudBuy.team.readyTitle"),sub:n("cloudBuy.team.readySub",{name:t})}),e.jsx("p",{className:"text-[13px] leading-[18px] text-ink-tertiary",children:n("cloudBuy.ready.hint",{name:t})}),e.jsx("div",{className:se,children:e.jsx("button",{type:"button","data-autofocus":!0,className:X,disabled:l,onClick:r,children:n("cloudBuy.setup.open",{name:t})})}),o&&e.jsx("p",{role:"alert",className:"-mt-2 text-end text-[13px] leading-[18px] text-danger",children:n("cloudBuy.openFailed",{name:t})})]})}function ht({view:t,ui:l,actions:o}){switch(t.kind){case"checking":return e.jsx(ie,{kind:"checking",line:null,onClose:o.close});case"unreachable":return e.jsx(ie,{kind:"unreachable",line:n("cloudAdd.unreachable"),onRetry:o.retry,onClose:o.close});case"error":return e.jsx(ie,{kind:`error-${t.reason}`,line:n(t.reason==="rate-limited"?"cloudAdd.rateLimited":"cloudAdd.failed"),onRetry:o.retry,onClose:o.close});case"offer":return e.jsx(ct,{offer:t.offer,current:l.current,now:l.now,busy:l.busy,signedOut:t.signedOut,notice:t.notice?n(t.notice==="code-expired"?"cloudAdd.codeExpired":t.notice==="signin-ended"?"cloudAdd.signInEnded":t.notice==="terms"?"cloudBuy.termsChanged":"cloudAdd.preparing"):null,onStart:o.start,onSignIn:o.signIn});case"sign-in":return e.jsx(dt,{phase:t.phase,email:l.email,code:l.code,profileEmail:l.profileEmail,busy:l.busy,now:l.now,onBack:o.back,onEmail:o.email,onSend:o.sendCode,onChangeEmail:o.changeEmail,onCode:o.code,onResend:o.resend,onBrowser:o.browser});case"signing-in":return e.jsx(rt,{code:t.code,checkout:t.checkout,busy:l.busy,trial:l.offerShown?!!Le(l.offerShown,l.chosen).trialDays:!1,onReopen:o.reopenBrowser,onCancel:o.cancelSignIn});case"waiting":return e.jsx(ft,{plan:t.plan,offer:l.offerShown,browser:t.browser,late:t.late,link:t.link,email:t.email,busy:l.busy,copied:l.copied,failed:l.payFailed,onReopen:o.reopenCheckout,onCopy:o.copyLink,onChangePlan:o.changePlan});case"starting":case"ready":return e.jsx(xt,{started:t,received:t.kind==="starting"&&t.received,step:t.kind==="starting"?t.step:null,slow:t.kind==="starting"&&t.slow,ready:t.kind==="ready",sleeps:et(t,l.offerShown),name:l.look.name,typed:l.look.typed,color:l.look.color,counting:l.counting,busy:l.busy,openFailed:l.openFailed,onName:o.name,onColor:o.color,onOpen:o.openCloud,onNotNow:o.notNow});case"has-cloud":return e.jsx(pt,{name:l.look.name,color:l.look.color,busy:l.busy,interest:l.interest,openFailed:l.openFailed,onInterest:o.interest,onOpen:o.openCloud});case"team-starting":return e.jsx(yt,{team:t.team,step:t.step,slow:t.slow});case"team-ready":return e.jsx(gt,{name:t.team.name,busy:l.busy,openFailed:l.openFailed,onOpen:()=>o.openTeam(t.team.id)});case"settings":return null}}const bt={offer:"max-w-[920px]",starting:"max-w-[720px]",ready:"max-w-[720px]"},kt=new Set(["sign-in","signing-in","waiting","starting","team-starting"]);function Be({kind:t,staging:l,onClose:o,children:r}){return e.jsx("div",{className:"ui-scrim fixed inset-0 z-[60] flex items-center justify-center p-4 sm:p-6",onMouseDown:s=>s.target===s.currentTarget&&!kt.has(t)&&o(),children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cloud-add-title","data-cloud-add-dialog":!0,tabIndex:-1,className:ue(Ze,"group/sheet animate-pop-in relative max-h-full w-full overflow-y-auto overscroll-contain outline-none",bt[t]??"max-w-[540px]"),children:[e.jsx("button",{type:"button",onClick:o,"aria-label":n("cloudAdd.close"),className:ue(Xe,Qe,"absolute end-4 top-4 z-10"),children:e.jsx(Je,{size:16})}),l&&e.jsx(Ye,{className:"absolute end-14 top-[22px] z-10 group-has-[[data-night-card]]/sheet:bg-app"}),r]})})}const jt=["offer","checking","unreachable","waiting","sign-in","signing-in"],St="button:not([disabled]):not([tabindex='-1']), input:not([disabled]):not([tabindex='-1']), [href], [tabindex='0']",Nt=t=>t.status==="connected"&&t.entitlement?.plan==="free"&&!t.purchase&&!t.machine,Ct=t=>t?.status==="connected"&&t.entitlement?.plan==="pro"&&t.entitlement.status==="active"?t.entitlement.tier??"pro":null;function It({now:t=Date.now}){const{state:l,dispatch:o}=ut(),r=l.cloudAdd,s=window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[u,p]=d.useState(null),[v,N]=d.useState(void 0),[k,I]=d.useState(null),[q,y]=d.useState(null),[E,A]=d.useState(!1),[M,_]=d.useState(!1),[C,i]=d.useState(!1),[w,j]=d.useState(!1),[$,Y]=d.useState(0),[Z,me]=d.useState([]),[b,h]=d.useState(null),[T,O]=d.useState({email:"",code:""}),[B,ee]=d.useState(null),[F,H]=d.useState(null),[P,S]=d.useState(null),[,Ie]=d.useState(0),[xe,ae]=d.useState(!1),[Te,le]=d.useState(!1),[Oe,Fe]=d.useState(!1),L=!!(r&&s),oe=l.config?.profile?.email?.trim()||null,re=ot();d.useEffect(()=>{if(!L||!s)return;let a=!0,c=!1;const g=s.onState(x=>{c=!0,a&&p(x)});return s.state().then(x=>{a&&!c&&p(x)}).catch(()=>{}),()=>{a=!1,g()}},[L,s]);const m=L?We(u,v,{now:t(),error:q,choosing:M,conflict:E,signIn:b,arrived:xe,terms:Te}):null,ye=L&&m&&jt.includes(m.kind)&&u?`${u.status}:${JSON.stringify(u.offer??null)}:${$}`:null;d.useEffect(()=>{if(!ye||!s?.offer)return;let a=!0;return s.offer().then(c=>{a&&N(c)},()=>{a&&N(null)}),()=>{a=!1}},[ye,s]);const de=n("cloudSetup.myCloud"),K={typed:B?.typed??de,color:B?.color??we,name:Ve(B?.typed??de,de)},D=()=>{b&&s?.signInCancel?.().catch(()=>{}),o({type:"closeCloudAdd"}),y(null),A(!1),_(!1),j(!1),me([]),I(null),h(null),O({email:"",code:""}),ee(null),H(null),S(null),ae(!1),le(!1)};d.useEffect(()=>{if(!L)return;const a=document.activeElement,c=a&&a!==document.body&&typeof a.focus=="function"?a:null;r?.signIn&&(h({step:"email",intent:!1,problem:null}),O({email:oe??"",code:""}));const g=x=>{if(x.key==="Escape"){x.preventDefault(),D();return}if(x.key!=="Tab")return;const V=[...document.querySelector("[data-cloud-add-dialog]")?.querySelectorAll(St)??[]];if(!V.length)return;x.preventDefault();const Ne=V.indexOf(document.activeElement);V[Ne===-1?0:(Ne+(x.shiftKey?-1:1)+V.length)%V.length].focus()};return window.addEventListener("keydown",g,!0),(document.querySelector("#cloud-add-title")??document.querySelector("[data-cloud-add-dialog]"))?.focus(),()=>{window.removeEventListener("keydown",g,!0),c?.isConnected&&c.focus()}},[L]),d.useEffect(()=>{if(!(!L||!s?.sheet||re))return s.sheet(!0).catch(()=>{}),()=>{s.sheet?.(!1).catch(()=>{})}},[L,s,re]);const f=m?.kind??null,te=m?.kind==="sign-in"?`sign-in-${m.phase.step}`:f;d.useEffect(()=>{!te||te==="checking"||te==="settings"||document.activeElement?.closest?.("[data-cloud-add-dialog]")||(document.querySelector("[data-cloud-add-dialog] [data-autofocus]")??document.querySelector("#cloud-add-title"))?.focus()},[te]),d.useEffect(()=>{(f==="waiting"||f==="starting"||f==="ready")&&!xe&&ae(!0),(f==="ready"||f==="team-ready")&&s?.readySeen?.().catch(()=>{})},[f]),d.useEffect(()=>{if(!f||!r)return;if(f==="settings"){D(),o({type:"toggleAppSettings",open:!0,section:"cloudAccount"});return}if(f==="checking")return;const a=Z.length===0;a&&J("cloud_dialog_shown",{source:r.source}),["starting","ready"].includes(f)&&Z.includes(f),(a||!Z.includes(f))&&me([...Z,f])},[f]),d.useEffect(()=>{if(!f||!["starting","ready","has-cloud"].includes(f)||B||!s?.look)return;let a=!0;return s.look().then(c=>{a&&ee({typed:c.name,color:Ge(c.color)??we,dirty:f!=="has-cloud"})},()=>{}),()=>{a=!1}},[f]),d.useEffect(()=>{if(!B?.dirty||!s?.setLook)return;const a=setTimeout(()=>{s.setLook?.(K.name,B.color).catch(()=>{})},400);return()=>clearTimeout(a)},[B?.typed,B?.color]),d.useEffect(()=>{f!=="ready"||F!==null||H(!re&&typeof document.hasFocus=="function"&&document.hasFocus()?3:"off")},[f]);const ge=b?.step==="code"?b.resendAt:0;d.useEffect(()=>{if(!ge||ge<=t())return;const a=setTimeout(()=>Ie(t()),1e3);return()=>clearTimeout(a)}),d.useEffect(()=>{if(P!=="copied")return;const a=setTimeout(()=>S(null),2500);return()=>clearTimeout(a)},[P]);const ne=a=>{C||(i(!0),j(!1),a().catch(()=>y("failed")).finally(()=>i(!1)))},he=()=>{C||!s||(i(!0),j(!1),H("done"),(async()=>{B?.dirty&&s.setLook&&await s.setLook(K.name,B.color).catch(()=>{}),await s.connectHome()})().then(()=>D(),()=>j(!0)).finally(()=>i(!1)))},De=a=>{C||!s?.openTeam||(i(!0),j(!1),s.openTeam(a).then(()=>D(),()=>j(!0)).finally(()=>i(!1)))};d.useEffect(()=>{if(typeof F!="number")return;const a=setTimeout(()=>{F>1?H(F-1):he()},1e3);return()=>clearTimeout(a)},[F]);const be=typeof F=="number";if(d.useEffect(()=>{if(!be)return;const a=()=>H("off");return window.addEventListener("blur",a),()=>window.removeEventListener("blur",a)},[be]),!L||!m||!r||!s||m.kind==="settings")return null;if(m.kind==="has-cloud"&&u?.status==="connected"&&u.clouds&&window.ogb?.cloudAdd&&(u.addCloud?.canAdd!==!1||u.adding&&!u.adding.done))return e.jsx(Be,{kind:Oe?"offer":"has-cloud",staging:u.staging===!0,onClose:D,children:e.jsx(lt,{onClose:D,onFirstCloud:()=>{},onWide:Fe,source:r.source})});const W=v??null,ke=()=>m.kind==="waiting"&&!k?m.plan:W?Le(W,k).tier:null,ce=async a=>{if(!a||!s.checkout){y("failed");return}W?.plans.find(x=>x.tier===a)?.trialDays;const c=await s.checkout(a,r.source),g=c.outcome;p(c.state),g==="opened"||g==="signing-in"?(_(!1),y(null),A(!1),S(null),le(!1),J("cloud_checkout_opened",{source:r.source})):g==="rate-limited"?y("rate-limited"):g==="failed"?y("failed"):A(!0)},je=a=>{h({step:"email",intent:a,problem:null}),O({email:T.email||oe||"",code:""})},Se=()=>{if(C||!s.signInStart||!b||b.step==="done")return;const a=b;i(!0),s.signInStart(T.email).then(c=>{c.outcome==="sent"?(h({step:"code",intent:a.intent,email:c.email,resendAt:c.resendAt,problem:null,triesLeft:null,...c.signupOpen===!1?{signupOpen:!1}:{}}),O({email:c.email,code:""}),J("cloud_signin",{source:r.source})):h({...a,problem:c.outcome})},()=>h({...a,problem:"failed"})).finally(()=>i(!1))},_e=a=>{if(!s.signInVerify||b?.step!=="code")return;const c=b,g=c.intent?ke():null;i(!0),(async()=>{try{const x=await s.signInVerify(a);if(x.outcome!=="signed-in"){O({email:T.email,code:""}),h({...c,problem:x.outcome,triesLeft:x.outcome==="wrong-code"?x.triesLeft:null});return}p(x.state),ae(!0),J("cloud_signin",{step:"signed_in",source:r.source}),g&&Nt(x.state)&&(tt(W,x.state.offer,g)?(h({step:"done",intent:!0}),await ce(g)):(le(!0),I(g))),h(null),O({email:T.email,code:""})}catch{h({...c,problem:"failed",triesLeft:null})}finally{i(!1)}})()},Re={start:a=>{if(I(a),A(!1),m.kind==="offer"&&m.signedOut&&s.signInStart){je(!0);return}ne(()=>ce(a))},signIn:()=>je(!1),back:()=>{h(null),s.signInCancel?.().catch(()=>{})},email:a=>O({email:a,code:T.code}),sendCode:Se,changeEmail:()=>{b&&(h({step:"email",intent:b.intent,problem:null}),s.signInCancel?.().catch(()=>{}))},code:a=>{const c=it(a);O({email:T.email,code:c}),c.length===8&&!C&&_e(c)},resend:Se,browser:()=>ne(async()=>{const a=b?.intent?ke():null;h(null),await s.signInCancel?.().catch(()=>{}),J("cloud_signin",{source:r.source}),a?await ce(a):p(await s.begin())}),reopenBrowser:()=>ne(async()=>p(await s.reopen())),cancelSignIn:()=>ne(async()=>p(await s.cancel())),reopenCheckout:()=>{if(m.kind!=="waiting"||C)return;i(!0),S(null),(s.reopenCheckout?s.reopenCheckout(m.plan,r.source):s.checkout(m.plan,r.source)).then(c=>{p(c.state),c.outcome!=="opened"&&S("pay-failed")},()=>S("pay-failed")).finally(()=>i(!1))},copyLink:()=>{s.copyCheckoutLink?.().then(a=>S(a?"copied":"pay-failed"),()=>S("pay-failed"))},changePlan:()=>{I(m.kind==="waiting"?m.plan:k),_(!0),S(null)},retry:()=>{y(null),A(!1),N(void 0),Y($+1)},name:a=>ee({typed:a,color:K.color,dirty:!0}),color:a=>ee({typed:K.typed,color:a,dirty:!0}),openCloud:he,openTeam:De,notNow:()=>H("off"),interest:()=>{C||!s.interest||(i(!0),s.interest().then(()=>S("interest-sent"),()=>S("interest-failed")).finally(()=>i(!1)))},close:D},He={chosen:k,current:Ct(u),offerShown:W,now:t(),busy:C,openFailed:w,email:T.email,code:T.code,profileEmail:oe,look:K,counting:typeof F=="number"?F:null,copied:P==="copied",payFailed:P==="pay-failed",interest:P==="interest-sent"?"sent":P==="interest-failed"?"failed":null};return e.jsx(Be,{kind:m.kind,staging:u?.staging===!0,onClose:D,children:e.jsx(ht,{view:m,ui:He,actions:Re})})}export{It as CloudAddDialog,ht as CloudAddPanel,Be as CloudAddSheet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,t as a,a as N,r as R}from"./styles-BlayaJti.js";import{a5 as F,a6 as S,x as L,S as z,a7 as y,a8 as b,a9 as A,aa as M,ab as w,ac as k,ad as P,ae as E,af as $,u as I,w as B,F as O,ag as v,ah as T,ai as D,aj as C,ak as H,al as W,am as X}from"./App-
|
|
1
|
+
import{j as e,t as a,a as N,r as R}from"./styles-BlayaJti.js";import{a5 as F,a6 as S,x as L,S as z,a7 as y,a8 as b,a9 as A,aa as M,ab as w,ac as k,ad as P,ae as E,af as $,u as I,w as B,F as O,ag as v,ah as T,ai as D,aj as C,ak as H,al as W,am as X}from"./App-8heymKKb.js";import{a as _,R as q}from"./RoutinesPage-aANJQ--g.js";import{L as G,P as J,d as K}from"./PlacesRail-v1XIqiBG.js";import{C as Q}from"./MenuMotion-IQitGKH4.js";function U({routines:t,runs:r,bots:p,pausedBots:c,loading:o,error:d,onOpen:l,onLogs:n,onToggle:x}){const u=[...t].sort((s,i)=>Number(i.enabled)-Number(s.enabled)||(s.nextRunAt??1/0)-(i.nextRunAt??1/0)||s.name.localeCompare(i.name));return e.jsxs("div",{className:"space-y-3","aria-label":a("routines.list"),children:[d&&e.jsx("div",{role:"alert",className:"rounded-lg bg-danger/10 p-3 text-[12px] text-danger",children:a("routines.loadError")}),o&&e.jsxs("p",{role:"status",className:"flex items-center gap-2 p-3 text-[12px] text-ink-secondary",children:[e.jsx(G,{size:14,className:"animate-spin"}),a("routines.loading")]}),!o&&!d&&u.length===0&&e.jsxs("div",{className:"rounded-xl border border-dashed border-hairline/50 p-5 text-center text-[13px] text-ink-secondary",children:[e.jsx(_,{size:20,className:"mx-auto mb-2 opacity-60"}),a("routines.empty")]}),u.map(s=>{const i=F(s.id,r),m=i&&(i.attention?"attention":i.error?"error":i.output?"output":null),h=p?.find(g=>g.id===s.botId),f=x!==void 0&&!S(s);return e.jsxs("article",{className:"rounded-xl border border-hairline/40 bg-card p-3.5","aria-label":s.name,children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>l(s),className:"min-w-0 flex-1 text-left hover:text-accent",children:[e.jsx("span",{className:"block truncate text-[13px] font-semibold text-ink",children:s.name}),e.jsxs("span",{className:"mt-1 block text-[12px] leading-relaxed text-ink-secondary",children:[h&&`${h.name} · `,L(s.schedule)]})]}),f?e.jsx(z,{checked:s.enabled,"aria-label":a("routines.toggle",{name:s.name}),onClick:()=>x(s)}):e.jsx("span",{className:N("shrink-0 rounded-full bg-inset px-2 py-0.5 text-[10px]",s.enabled&&s.nextRunAt!=null?"text-accent":"text-ink-secondary"),children:y(s)})]}),(f||b(s)!==y(s))&&e.jsx("div",{className:"mt-2 text-[12px] text-ink-secondary",children:b(s)}),e.jsxs("div",{className:"mt-1 flex items-start justify-between gap-2",children:[e.jsx("div",{className:"min-w-0 text-[12px]",children:i?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:M(i),children:a("routines.latestRun",{status:A(i)})}),e.jsx("span",{className:"block text-[11px] text-ink-secondary",children:w(i.finishedAt??i.startedAt??i.scheduledFor)})]}):e.jsx("span",{className:"text-ink-secondary",children:a("routines.neverRun")})}),e.jsxs("button",{type:"button",onClick:()=>n(s),"aria-label":a("routines.logsFor",{name:s.name}),className:"flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.jsx(k,{size:12}),a("routines.logs")]})]}),i&&m&&e.jsx("p",{className:N("mt-2 line-clamp-2 whitespace-pre-wrap text-[12px] leading-relaxed",i.error?"text-danger":"text-ink-secondary"),children:P(i,m)}),!!s.failureStreak&&e.jsx("p",{className:"mt-2 text-[12px] text-danger",children:a("routines.failureStreak",{count:s.failureStreak})}),s.weekRuns&&e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:a(s.weekRuns.total===1?"routines.weekRunsOne":"routines.weekRuns",s.weekRuns)}),s.warning&&e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-warning",children:s.warning}),s.enabled&&c?.includes(s.botId)&&e.jsxs("p",{className:"mt-2 text-[12px] leading-relaxed text-warning","data-routine-bot-paused":"",children:[a("routines.botPaused")," ",e.jsx("button",{type:"button",className:"cursor-pointer text-accent hover:underline",onClick:()=>E("paused"),children:a("routines.botPausedSwap")})]}),s.heldFor&&e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary",children:$(s)}),!!s.skippedRuns&&e.jsxs("p",{className:"mt-2 text-[12px] text-ink-secondary",children:[a("routines.skippedRuns",{count:s.skippedRuns}),s.lastSkippedAt!=null&&e.jsxs(e.Fragment,{children:[" · ",a("routines.lastSkipped",{date:w(s.lastSkippedAt)})]})]})]},s.id)})]})}function le({bot:t,routines:r,runs:p,defaultRunOn:c}){const{state:o,dispatch:d}=I(),[l,n]=R.useState(null);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{size:16,className:"text-accent"}),e.jsx("h2",{className:"min-w-0 flex-1 text-[15px] font-medium text-ink",children:a("computer.tab.routines")}),e.jsx("span",{className:"text-[12px] text-ink-secondary",children:r.length})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>n("new"),className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[12px] font-medium text-white hover:brightness-110",children:[e.jsx(J,{size:14}),a("computer.routines.create")]}),e.jsxs("button",{type:"button",onClick:()=>d({type:"showRoutines",section:"logs",botId:t.id}),className:"flex items-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:[e.jsx(k,{size:13}),a("routines.logs")]})]})]}),e.jsx(U,{routines:r,runs:p,pausedBots:o.config?.pausedBots,loading:o.routinesLoadState==="loading"&&r.length===0,error:o.routinesLoadState==="error",onOpen:n,onLogs:x=>d({type:"showRoutines",section:"logs",botId:t.id,routineId:x.id}),onToggle:x=>d({type:"updateRoutine",routineId:x.id,patch:{enabled:!x.enabled}})}),e.jsxs("button",{type:"button",onClick:()=>d({type:"showRoutines",section:"schedule",view:"list",botId:t.id}),className:"self-start text-[12px] text-accent hover:underline",children:[a("computer.routines.openTitle")," ",e.jsx(Q,{size:14,"aria-hidden":"true",className:"inline align-[-2px] rtl:-scale-x-100"})]}),l&&e.jsx(q,{routine:l==="new"?void 0:l,bots:[t],lockedBotId:t.id,defaultRunOn:c,onClose:()=>n(null)},t.id)]})}const V=20;function Y(t,r=V){const p=new Set,c=[],o=C(t);for(let d=o.length-1;d>=0&&c.length<r;d-=1){const l=o[d].digest?.files;if(l){for(const n of l.deleted)p.add(n);for(const n of[...l.added,...l.changed])if(!p.has(n)&&(p.add(n),c.push(n),c.length>=r))break}}return c}function Z(t){const r=new Map,p=t.tasks?.find(n=>n.threadId===t.threadId),c=p?.cwd===void 0?t.cwd:p.cwd,o=c&&(/^[a-z]:[\\/]/i.test(c)||c.startsWith("\\\\")),d=n=>o?n.replace(/\\/g,"/"):n,l=typeof c=="string"?`${d(c).replace(/\/+$/,"")}/`:void 0;for(const n of[...C(t)].reverse()){if(n.role!=="bot"||n.kind!=="text")continue;const x=H(n.attachments),u=[...x.files,...W(n.text??"",[...x.images,...x.files.map(s=>s.path)])];for(const s of u){const i=s.private?s.path:X(s.path),m={file:s,message:{threadId:t.threadId,messageId:n.id}},h=d(i),f=l&&(o?h.slice(0,l.length).toLowerCase()===l.toLowerCase():h.startsWith(l)),g=[i,...f?[h.slice(l.length)]:[]];i.startsWith("./")&&g.push(i.replace(/^(\.\/)+/,""));for(const j of g)r.has(j)||r.set(j,m)}}return r}function ee(t){const r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return r<0?{name:t,folder:""}:{name:t.slice(r+1),folder:t.slice(0,r)}}function re({bot:t}){const{dispatch:r}=I(),{capabilities:p}=K(),c=p.host.homeDir,d=t.tasks?.find(u=>u.threadId===t.threadId)?.cwd,l=d===void 0?t.cwd:d,n=Y(t),x=R.useMemo(()=>Z(t),[t.messages,t.activeLeafId,t.threadId,t.tasks,t.cwd]);return e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-5","data-testid":"computer-files",children:[e.jsxs("div",{className:"mt-2 rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:a("computer.files.folder")}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx(O,{size:15,className:"shrink-0 text-ink-secondary","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink",title:l??void 0,children:l?v(l,c):l===null?a("computer.files.homeFolder"):a("computer.files.privateFolder",{name:t.name})}),e.jsx("button",{type:"button",onClick:()=>{r({type:"toggleComputer",open:!1}),T(r,"access",{page:"folder"})},className:"shrink-0 rounded-lg bg-control px-2.5 py-1 text-[12px] text-ink hover:bg-raised-hover",children:a(d===void 0?"computer.files.changeFolder":"computer.files.changeDefaultFolder")})]}),d!==void 0&&e.jsx("p",{className:"mt-2 text-[12px] leading-5 text-ink-secondary",children:a("computer.files.pinnedFolderHint")})]}),e.jsxs("div",{className:"mt-3 rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:a("computer.files.recent")}),n.length===0?e.jsx("p",{className:"mt-2 text-[12px] leading-5 text-ink-secondary",children:a("computer.files.empty",{name:t.name})}):e.jsx("ul",{className:"mt-2 flex flex-col gap-1",children:n.map(u=>{const{name:s,folder:i}=ee(u),m=x.get(u);return e.jsxs("li",{className:"min-w-0 rounded-lg py-1",title:u,children:[m?e.jsx(D,{file:{...m.file,name:s},message:m.message,linked:m.file.linked,className:"w-full max-w-none"},`${m.message.threadId}:${m.message.messageId}:${m.file.path}`):e.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2.5 py-2",title:a("computer.files.notSharedHint"),children:[e.jsx(k,{size:14,className:"shrink-0 text-ink-secondary","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",children:s}),e.jsx("span",{className:"shrink-0 text-[11px] text-ink-tertiary",children:a("computer.files.notShared")})]}),i&&e.jsx("div",{className:"mt-1 truncate px-2.5 text-[11px] text-ink-tertiary",children:v(i,c)})]},u)})})]})]})}export{re as C,le as R,U as a,Y as r,Z as s};
|