moi-computer 0.13.1-next.0 → 0.13.1-next.2
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/client/api/app-config.ts +12 -2
- package/client/api/http.ts +11 -1
- package/client/app/app-router.tsx +3 -2
- package/client/app/routes/home-route.tsx +1 -1
- package/client/app/routes/workspace-registration.tsx +68 -0
- package/client/app/routes/workspace-route.tsx +37 -13
- package/client/app/shell/sidebar-layout.tsx +10 -5
- package/client/components/shared/workspace-icon.tsx +8 -17
- package/client/features/account/account-test-utils.tsx +18 -4
- package/client/features/account/api.ts +10 -8
- package/client/features/account/profile-actions.ts +5 -7
- package/client/features/app-settings/avatar-upload.tsx +62 -0
- package/client/features/app-settings/profile-settings.tsx +10 -0
- package/client/features/app-settings/settings-page.tsx +2 -1
- package/client/features/applets/api.ts +6 -6
- package/client/features/applets/applet-cache.ts +6 -5
- package/client/features/applets/applet-log.ts +2 -1
- package/client/features/applets/applet-runtime.ts +2 -1
- package/client/features/applets/use-applet.ts +73 -18
- package/client/features/applets/widget-shell.tsx +4 -2
- package/client/features/chat/applet-chat-intents.ts +5 -13
- package/client/features/chat/chat-popup.tsx +8 -4
- package/client/features/chat/chat-send.ts +2 -2
- package/client/features/chat/composer/model-order.ts +4 -4
- package/client/features/chat/composer/model-picker.tsx +12 -10
- package/client/features/chat/composer/use-workspace-composer-state.tsx +1 -1
- package/client/features/chat/sessions/api.ts +11 -28
- package/client/features/chat/sessions/use-selected-session.ts +18 -100
- package/client/features/chat/use-chat.ts +8 -12
- package/client/features/collab/applet-api.ts +1 -1
- package/client/features/collab/components/cursors.tsx +6 -1
- package/client/features/collab/components/presence-avatars.tsx +1 -1
- package/client/features/collab/components/presence-frame.tsx +1 -1
- package/client/features/collab/components/presence-group.tsx +1 -1
- package/client/features/collab/components/presence-helpers.ts +2 -2
- package/client/features/collab/components/user-avatar-group.tsx +1 -1
- package/client/features/collab/components/user-avatar.tsx +1 -1
- package/client/features/collab/components/user.tsx +1 -1
- package/client/features/collab/index.ts +3 -3
- package/client/features/collab/members/api.ts +17 -0
- package/client/features/collab/members/hooks.ts +97 -0
- package/client/features/collab/members/store.ts +148 -0
- package/client/features/{workspace-members → collab/members}/types.ts +7 -5
- package/client/features/collab/{client.ts → presence/client.ts} +4 -5
- package/client/features/collab/{hooks.tsx → presence/hooks.tsx} +1 -1
- package/client/features/collab/{provider.tsx → presence/provider.tsx} +1 -12
- package/client/features/collab/{users.ts → presence/users.ts} +19 -21
- package/client/features/collab/proxy-user.ts +1 -3
- package/client/features/collab/sharing/agent-invite.tsx +30 -0
- package/client/features/collab/sharing/workspace-members.tsx +269 -0
- package/client/features/collab/sharing/workspace-sharing-menu.tsx +179 -0
- package/client/features/collab/testing/component-fixtures.tsx +3 -3
- package/client/features/collab/testing/fake-engine.ts +2 -2
- package/client/features/dev/chat-states-page.tsx +3 -1
- package/client/features/dev/collab/collab-playground.tsx +2 -2
- package/client/features/dev/dev-index-page.tsx +0 -6
- package/client/features/dev/dev-routes.tsx +0 -2
- package/client/features/dev/harness-debug-page.tsx +7 -7
- package/client/features/dev/workspace-setup-mocks.ts +1 -2
- package/client/features/dev/workspace-setup-preview.tsx +6 -4
- package/client/features/harness/api.ts +13 -10
- package/client/features/harness/harness-login-panel.tsx +9 -5
- package/client/features/harness/harness-presentation.ts +4 -4
- package/client/features/harness/harness-selector.tsx +13 -13
- package/client/features/harness/use-harness-login.ts +5 -5
- package/client/features/home/api.ts +38 -2
- package/client/features/home/home-page.tsx +43 -13
- package/client/features/home/shared-workspaces.tsx +70 -0
- package/client/features/home/workspace-invitations.tsx +101 -0
- package/client/features/identity/host-api.ts +5 -4
- package/client/features/identity/store.ts +1 -7
- package/client/features/onboarding/agent-setup-step.tsx +8 -8
- package/client/features/onboarding/onboarding-page.tsx +3 -2
- package/client/features/onboarding/workspace-setup-step.tsx +1 -1
- package/client/features/overview/api.ts +3 -5
- package/client/features/overview/default/registry.tsx +1 -1
- package/client/features/overview/default/views-widget.tsx +2 -2
- package/client/features/overview/hidden-panel.tsx +7 -5
- package/client/features/overview/overview.tsx +18 -16
- package/client/features/overview/workspace-name.tsx +2 -2
- package/client/features/scratchpad/scratchpad.tsx +9 -7
- package/client/features/scratchpad/use-scratchpad-snapshot.tsx +13 -5
- package/client/features/views/api.ts +34 -16
- package/client/features/views/use-view-actions.ts +10 -20
- package/client/features/views/view-manager.tsx +1 -1
- package/client/features/views/view-submission.ts +2 -21
- package/client/features/workspace/add/api.ts +5 -4
- package/client/features/workspace/add/create-workspace-dialog.tsx +12 -9
- package/client/features/workspace/add/import-workspace-dialog.tsx +7 -7
- package/client/features/workspace/add/use-workspace-import.ts +10 -10
- package/client/features/workspace/add/workspace-agent-options.ts +21 -20
- package/client/features/workspace/add/workspace-agent-selector.tsx +11 -11
- package/client/features/workspace/api.ts +60 -13
- package/client/features/workspace/harness-transition.ts +7 -13
- package/client/features/workspace/remote.ts +25 -0
- package/client/features/workspace/settings/api.ts +7 -12
- package/client/features/workspace/settings/connectors-settings.tsx +3 -3
- package/client/features/workspace/settings/general-settings.tsx +8 -8
- package/client/features/workspace/setup/workspace-login-state.tsx +4 -4
- package/client/features/workspace/setup/workspace-recovery-states.tsx +43 -14
- package/client/features/workspace/setup/workspace-setup.tsx +6 -6
- package/client/features/workspace/tab-resolution.ts +2 -2
- package/client/features/workspace/use-workspace-navigation.ts +7 -4
- package/client/features/workspace/workspace-content.tsx +32 -26
- package/client/features/workspace/workspace-frame.tsx +13 -26
- package/client/features/workspace/workspace-layout-context.tsx +45 -12
- package/client/features/workspace/workspace-menu.tsx +2 -2
- package/client/features/workspace/workspace-pane.tsx +22 -0
- package/client/features/workspace/workspace-pending-screen.tsx +1 -1
- package/client/features/workspace/workspace-preferences.ts +34 -0
- package/client/features/workspace/workspace-presentation.tsx +12 -16
- package/client/features/workspace/workspace-screen.tsx +2 -2
- package/client/features/workspace/workspace-state.ts +2 -1
- package/client/features/workspace/workspace-tabs.tsx +1 -1
- package/client/features/workspace/workspace-test-utils.ts +23 -0
- package/client/runtime/use-workspace-events.ts +14 -0
- package/client/runtime/workspace-events.ts +9 -9
- package/client/store/ui.ts +29 -9
- package/dist/chunk-44khk4sp.js +2 -0
- package/dist/chunk-ba6mz56s.js +72 -0
- package/dist/chunk-ec5ennpv.js +1 -0
- package/dist/chunk-ectsnw81.js +2 -0
- package/dist/chunk-en7w5ypg.js +1 -0
- package/dist/chunk-f695wcx5.js +5 -0
- package/dist/chunk-kffcah9w.css +1 -0
- package/dist/{chunk-kdgk4dac.js → chunk-n0fawy9x.js} +1 -1
- package/dist/chunk-pdt9hxfw.js +2 -0
- package/dist/chunk-rmd0ctfx.js +546 -0
- package/dist/chunk-zv22wv0g.js +1 -0
- package/dist/index.html +1 -1
- package/lib/harness-instructions.ts +4 -4
- package/lib/harness-types.ts +13 -0
- package/lib/types.ts +34 -50
- package/lib/workspace-config.ts +48 -0
- package/lib/workspace-layout.ts +2 -4
- package/package.json +4 -2
- package/server/README.md +29 -27
- package/server/api/harnesses.ts +5 -5
- package/server/api/index.ts +170 -68
- package/server/app-config.ts +2 -7
- package/server/applets/declarations.ts +6 -7
- package/server/applets/index.ts +15 -9
- package/server/applets/views.ts +2 -17
- package/server/applets/widgets.ts +3 -2
- package/server/cli/commands/config.ts +8 -20
- package/server/cli/commands/hermes.ts +2 -2
- package/server/cli/commands/init.ts +96 -64
- package/server/cli/commands/openclaw.ts +2 -2
- package/server/cli/commands/refresh.ts +10 -1
- package/server/cli/commands/remote.ts +228 -0
- package/server/cli/commands/skill.ts +4 -4
- package/server/cli/commands/tabs.ts +5 -12
- package/server/cli/control.ts +35 -4
- package/server/cli/index.ts +10 -6
- package/server/cli/remote-command.ts +77 -0
- package/server/cli/remote-control.ts +70 -0
- package/server/cli/remote-operations.ts +244 -0
- package/server/collab/config.ts +4 -8
- package/server/collab/manager.ts +5 -2
- package/server/collab/skill/index.ts +4 -50
- package/server/control.ts +38 -11
- package/server/harness/acp/session.ts +4 -4
- package/server/harness/auth.ts +26 -31
- package/server/harness/claude-code/index.ts +1 -1
- package/server/harness/codex/discovery.ts +1 -1
- package/server/harness/codex/session.ts +1 -1
- package/server/harness/detect.ts +14 -19
- package/server/harness/executable.ts +10 -10
- package/server/harness/hermes/NOTES.md +2 -2
- package/server/harness/hermes/index.ts +1 -1
- package/server/harness/install.ts +11 -11
- package/server/harness/openclaw/index.ts +1 -1
- package/server/harness/registry.ts +7 -6
- package/server/harness/types.ts +4 -4
- package/server/onboarding/jobs.ts +1 -1
- package/server/operations/commands.ts +46 -0
- package/server/operations/files.ts +148 -0
- package/server/operations/server.ts +206 -0
- package/server/remote/agent.ts +103 -0
- package/server/remote/client.ts +665 -0
- package/server/remote/workspace.ts +34 -0
- package/server/scratchpad/document.ts +32 -12
- package/server/scratchpad/executor.ts +16 -7
- package/server/sessions/config.ts +8 -5
- package/server/sessions/pending-views.ts +16 -0
- package/server/sessions/view-sessions.ts +10 -12
- package/server/skills/locations.ts +4 -4
- package/server/skills/template.ts +3 -2
- package/server/skills/update.ts +12 -12
- package/server/skills/version.ts +7 -7
- package/server/skills/workspace.ts +13 -13
- package/server/web.ts +12 -10
- package/server/workspace-state/file.ts +2 -0
- package/server/workspace-state/index.ts +0 -4
- package/server/workspaces/api.ts +28 -0
- package/server/workspaces/change-harness.ts +15 -26
- package/server/workspaces/import.ts +4 -4
- package/server/workspaces/init.ts +15 -13
- package/server/workspaces/layout.ts +60 -66
- package/server/workspaces/registry.ts +43 -18
- package/server/workspaces/scaffold.ts +1 -0
- package/server/workspaces/shared.ts +74 -0
- package/server/workspaces/tabs.ts +6 -12
- package/skill/SKILL.md +24 -4
- package/client/api/app-ui-keys.ts +0 -6
- package/client/features/chat/sessions/browser-tab-state.ts +0 -43
- package/client/features/collab/workspace-users-menu.tsx +0 -190
- package/client/features/dev/cloud-avatar-upload.tsx +0 -58
- package/client/features/dev/cloud-page.tsx +0 -363
- package/client/features/workspace/browser-tab-state.ts +0 -51
- package/client/features/workspace/layout-save.ts +0 -13
- package/client/features/workspace-members/api.ts +0 -20
- package/client/features/workspace-members/hooks.ts +0 -127
- package/client/features/workspace-members/keys.ts +0 -6
- package/client/features/workspace-members/store.ts +0 -123
- package/dist/chunk-00s35r33.js +0 -546
- package/dist/chunk-7rz6g7g7.js +0 -1
- package/dist/chunk-af2jyddf.js +0 -2
- package/dist/chunk-cekekc3f.css +0 -1
- package/dist/chunk-ep5vh16c.js +0 -75
- package/dist/chunk-s5s1vzdw.js +0 -2
- package/dist/chunk-svxhxfeq.js +0 -2
- package/dist/chunk-t0r0bds1.js +0 -1
- package/dist/chunk-vp2qzc0d.js +0 -1
- package/dist/chunk-wz5qv1bn.js +0 -2
- package/lib/workspace-types.ts +0 -13
- package/server/workspace-state/legacy-migration.ts +0 -79
- /package/client/features/collab/{presence-publisher.ts → presence/presence-publisher.ts} +0 -0
- /package/client/features/collab/{presence-target.ts → presence/presence-target.ts} +0 -0
- /package/client/features/collab/{store.ts → presence/store.ts} +0 -0
package/dist/chunk-s5s1vzdw.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var na=Object.create;var{getPrototypeOf:sa,defineProperty:sr,getOwnPropertyNames:ca}=Object;var xr=Object.prototype.hasOwnProperty;function la(r){return this[r]}var da,pa,e=(r,a,t)=>{var o=r!=null&&typeof r==="object";if(o){var i=a?da??=new WeakMap:pa??=new WeakMap,c=i.get(r);if(c)return c}t=r!=null?na(sa(r)):{};let n=a||!r||!r.__esModule||!xr.call(r,"default")?sr(t,"default",{value:r,enumerable:!0}):t;if(r&&typeof r==="object"||typeof r==="function"){for(let s of ca(r))if(!xr.call(n,s))sr(n,s,{get:la.bind(r,s),enumerable:!0})}if(o)i.set(r,n);return n};var x=(r,a)=>()=>(a||r((a={exports:{}}).exports,a),a.exports);var ha=(r)=>r;function ga(r,a){this[r]=ha.bind(null,a)}var be=(r,a)=>{for(var t in a)sr(r,t,{get:a[t],enumerable:!0,configurable:!0,set:ga.bind(a,t)})};var st=((r)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(a,t)=>(typeof require<"u"?require:a)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var yr,cr,L,Y=(r,a)=>{for(var[t,o,i]of yr||[])for(var c=[r],n=globalThis,s=n.document,l,d,h,p,g;d=c.pop();)if(!cr[d]&&(h=o[d])){cr[d]=1;for(p=1;p<h.length;p++)c.push(i[h[p]]);if(!a&&d!==r&&(l=s&&s.head)){if(L===void 0)L=(p=s.querySelector("meta[property=csp-nonce]"))&&(p.nonce||p.getAttribute("nonce"))||"";if(g=s.createElement("link"),g.rel="modulepreload",g.crossOrigin="",L)g.nonce=L;g.href=new n.URL(h[0],t),l.appendChild(g)}}},ua=(r,a,t,o)=>{for(var i={},c=0;c<a.length;c++)i[a[c]]=t[c];(yr||=[]).push([r,i,a]),cr||={},Y(a[o],1)};ua(import.meta.url,["s5s1vzdw","ep5vh16c","vp2qzc0d","7rz6g7g7","nf2wkvf9","00s35r33","af2jyddf","wz5qv1bn","svxhxfeq","t0r0bds1","kdgk4dac"],[["/chunk-s5s1vzdw.js"],["/chunk-ep5vh16c.js",6,0,7,8],["/chunk-vp2qzc0d.js",7],["/chunk-7rz6g7g7.js",0,8],["/chunk-nf2wkvf9.js"],["/chunk-00s35r33.js",10,6,0,7],["/chunk-af2jyddf.js",0,7],["/chunk-wz5qv1bn.js",0,8],["/chunk-svxhxfeq.js"],["/chunk-t0r0bds1.js",10],["/chunk-kdgk4dac.js"]],0);
|
|
2
|
-
if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);var va={setTimeout:(r,a)=>setTimeout(r,a),clearTimeout:(r)=>clearTimeout(r),setInterval:(r,a)=>setInterval(r,a),clearInterval:(r)=>clearInterval(r)},wa=class{#r=va;#a=!1;setTimeoutProvider(r){this.#r=r}setTimeout(r,a){return this.#r.setTimeout(r,a)}clearTimeout(r){this.#r.clearTimeout(r)}setInterval(r,a){return this.#r.setInterval(r,a)}clearInterval(r){this.#r.clearInterval(r)}},Z=new wa;function kr(r){setTimeout(r,0)}var dr=typeof window>"u"||"Deno"in globalThis;function A(){}function Cr(r,a){return typeof r==="function"?r(a):r}function Be(r){return typeof r==="number"&&r>=0&&r!==1/0}function ze(r,a){return Math.max(r+(a||0)-Date.now(),0)}function T(r,a){return typeof r==="function"?r(a):r}function ve(r,a){let{type:t="all",exact:o,fetchStatus:i,predicate:c,queryKey:n,stale:s}=r;if(n){if(o){if(a.queryHash!==D(n,a.options))return!1}else if(!z(a.queryKey,n))return!1}if(t!=="all"){let l=a.isActive();if(t==="active"&&!l)return!1;if(t==="inactive"&&l)return!1}if(typeof s==="boolean"&&a.isStale()!==s)return!1;if(i&&i!==a.state.fetchStatus)return!1;if(c&&!c(a))return!1;return!0}function K(r,a){let{exact:t,status:o,predicate:i,mutationKey:c}=r;if(c){if(!a.options.mutationKey)return!1;if(t){if(J(a.options.mutationKey)!==J(c))return!1}else if(!z(a.options.mutationKey,c))return!1}if(o&&a.state.status!==o)return!1;if(i&&!i(a))return!1;return!0}function D(r,a){return(a?.queryKeyHashFn||J)(r)}function J(r){return JSON.stringify(r,(a,t)=>lr(t)?Object.keys(t).sort().reduce((o,i)=>(o[i]=t[i],o),{}):t)}function z(r,a){if(r===a)return!0;if(typeof r!==typeof a)return!1;if(r&&a&&typeof r==="object"&&typeof a==="object"){if(Array.isArray(r)&&Array.isArray(a)){for(let o=0;o<a.length;o++)if(!z(r[o],a[o]))return!1;return!0}let t=Object.keys(a);for(let o of t)if(!z(r[o],a[o]))return!1;return!0}return!1}var ma=Object.prototype.hasOwnProperty;function Re(r,a,t=0){if(r===a)return r;if(t>500)return a;let o=zr(r)&&zr(a);if(!o&&!(lr(r)&&lr(a)))return a;let i=(o?r:Object.keys(r)).length,c=o?a:Object.keys(a),n=c.length,s=o?Array(n):{},l=0;for(let d=0;d<n;d++){let h=o?d:c[d],p=r[h],g=a[h];if(p===g){if(s[h]=p,o?d<i:ma.call(r,h))l++;continue}if(p===null||g===null||typeof p!=="object"||typeof g!=="object"){s[h]=g;continue}let b=Re(p,g,t+1);if(s[h]=b,b===p)l++}return i===n&&l===i?r:s}function we(r,a){if(!a||Object.keys(r).length!==Object.keys(a).length)return!1;for(let t in r)if(r[t]!==a[t])return!1;return!0}function zr(r){return Array.isArray(r)&&r.length===Object.keys(r).length}function lr(r){if(!_r(r))return!1;let a=r.constructor;if(a===void 0)return!0;let t=a.prototype;if(!_r(t))return!1;if(!t.hasOwnProperty("isPrototypeOf"))return!1;if(Object.getPrototypeOf(r)!==Object.prototype)return!1;return!0}function _r(r){return Object.prototype.toString.call(r)==="[object Object]"}function Er(r){return new Promise((a)=>{Z.setTimeout(a,r)})}function Ae(r,a,t){if(typeof t.structuralSharing==="function")return t.structuralSharing(r,a);else if(t.structuralSharing!==!1)return Re(r,a);return a}function Sr(r,a,t=0){let o=[...r,a];return t&&o.length>t?o.slice(1):o}function Ar(r,a,t=0){let o=[a,...r];return t&&o.length>t?o.slice(0,-1):o}var P=Symbol();function H(r,a){if(!r.queryFn&&a?.initialPromise)return()=>a.initialPromise;if(!r.queryFn||r.queryFn===P)return()=>Promise.reject(Error(`Missing queryFn: '${r.queryHash}'`));return r.queryFn}function Se(r,a){if(typeof r==="function")return r(...a);return!!r}function jr(r,a,t){let o=!1,i;return Object.defineProperty(r,"signal",{enumerable:!0,get:()=>{if(i??=a(),o)return i;if(o=!0,i.aborted)t();else i.addEventListener("abort",t,{once:!0});return i}}),r}var fa=()=>dr,Ie=()=>fa();var G=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(r){return this.listeners.add(r),this.onSubscribe(),()=>{this.listeners.delete(r),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var ba=class extends G{#r;#a;#t;constructor(){super();this.#t=(r)=>{if(typeof window<"u"&&window.addEventListener){let a=()=>r();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}}}onSubscribe(){if(!this.#a)this.setEventListener(this.#t)}onUnsubscribe(){if(!this.hasListeners())this.#a?.(),this.#a=void 0}setEventListener(r){this.#t=r,this.#a?.(),this.#a=r((a)=>{if(typeof a==="boolean")this.setFocused(a);else this.onFocus()})}setFocused(r){if(this.#r!==r)this.#r=r,this.onFocus()}onFocus(){let r=this.isFocused();this.listeners.forEach((a)=>{a(r)})}isFocused(){if(typeof this.#r==="boolean")return this.#r;return globalThis.document?.visibilityState!=="hidden"}},Ce=new ba;var Pr=kr;function xa(){let r=[],a=0,t=(s)=>{s()},o=(s)=>{s()},i=Pr,c=(s)=>{if(a)r.push(s);else i(()=>{t(s)})},n=()=>{let s=r;if(r=[],s.length)i(()=>{o(()=>{s.forEach((l)=>{t(l)})})})};return{batch:(s)=>{let l;a++;try{l=s()}finally{if(a--,!a)n()}return l},batchCalls:(s)=>(...l)=>{c(()=>{s(...l)})},schedule:c,setNotifyFunction:(s)=>{t=s},setBatchNotifyFunction:(s)=>{o=s},setScheduler:(s)=>{i=s}}}var C=xa();var ya=class extends G{#r=!0;#a;#t;constructor(){super();this.#t=(r)=>{if(typeof window<"u"&&window.addEventListener){let a=()=>r(!0),t=()=>r(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",t)}}}}onSubscribe(){if(!this.#a)this.setEventListener(this.#t)}onUnsubscribe(){if(!this.hasListeners())this.#a?.(),this.#a=void 0}setEventListener(r){this.#t=r,this.#a?.(),this.#a=r(this.setOnline.bind(this))}setOnline(r){if(this.#r!==r)this.#r=r,this.listeners.forEach((a)=>{a(r)})}isOnline(){return this.#r}},O=new ya;function ka(r){return Math.min(1000*2**r,30000)}function pr(r){return(r??"online")==="online"?O.isOnline():!0}var V=class extends Error{constructor(r){super("CancelledError");this.revert=r?.revert,this.silent=r?.silent}};function X(r){let a=!1,t=0,o,i="pending",c,n,s=new Promise((u,m)=>{c=u,n=m});s.catch(A);let l=()=>i!=="pending",d=(u)=>{if(!l()){let m=new V(u);w(m),r.onCancel?.(m)}},h=()=>{a=!0},p=()=>{a=!1},g=()=>Ce.isFocused()&&(r.networkMode==="always"||O.isOnline())&&r.canRun(),b=()=>pr(r.networkMode)&&r.canRun(),v=(u)=>{if(!l())o?.(),i="resolved",c(u)},w=(u)=>{if(!l())o?.(),i="rejected",n(u)},y=()=>new Promise((u)=>{o=(m)=>{if(l()||g())u(m)},r.onPause?.()}).then(()=>{if(o=void 0,!l())r.onContinue?.()}),R=()=>{if(l())return;let u,m=t===0?r.initialPromise:void 0;try{u=m??r.fn()}catch(f){u=Promise.reject(f)}Promise.resolve(u).then(v).catch((f)=>{if(l())return;let k=r.retry??(Ie()?0:3),S=r.retryDelay??ka,oa=typeof S==="function"?S(t,f):S,ia=k===!0||typeof k==="number"&&t<k||typeof k==="function"&&k(t,f);if(a||!ia){w(f);return}t++,r.onFail?.(t,f),Er(oa).then(()=>g()?void 0:y()).then(()=>{if(a)w(f);else R()})})};return{promise:s,status:()=>i,cancel:d,continue:()=>(o?.(),s),cancelRetry:h,continueRetry:p,canStart:b,start:()=>{if(b())R();else y().then(R);return s}}}var rr=class{#r;destroy(){this.clearGcTimeout()}scheduleGc(){if(this.clearGcTimeout(),Be(this.gcTime))this.#r=Z.setTimeout(()=>{this.optionalRemove()},this.gcTime)}updateGcTime(r){this.gcTime=Math.max(this.gcTime||0,r??(Ie()?1/0:300000))}clearGcTimeout(){if(this.#r!==void 0)Z.clearTimeout(this.#r),this.#r=void 0}};function Mr(r){return{onFetch:(a,t)=>{let o=a.options,i=a.fetchOptions?.meta?.fetchMore?.direction,c=a.state.data?.pages||[],n=a.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,d=async()=>{let h=!1,p=(v)=>{jr(v,()=>a.signal,()=>h=!0)},g=H(a.options,a.fetchOptions),b=async(v,w,y)=>{if(h)return Promise.reject(a.signal.reason);if(w==null&&v.pages.length)return Promise.resolve(v);let u=(()=>{let S={client:a.client,queryKey:a.queryKey,pageParam:w,direction:y?"backward":"forward",meta:a.options.meta};return p(S),S})(),m=await g(u),{maxPages:f}=a.options,k=y?Ar:Sr;return{pages:k(v.pages,m,f),pageParams:k(v.pageParams,w,f)}};if(i&&c.length){let v=i==="backward",w=v?za:Or,y={pages:c,pageParams:n};s=await b(y,w(o,y),v)}else{let v=r??c.length;do{let w=l===0?n[0]??o.initialPageParam:Or(o,s);if(l>0&&w==null)break;s=await b(s,w),l++}while(l<v)}return s};if(a.options.persister)a.fetchFn=()=>a.options.persister?.(d,{client:a.client,queryKey:a.queryKey,meta:a.options.meta,signal:a.signal},t);else a.fetchFn=d}}}function Or(r,{pages:a,pageParams:t}){let o=a.length-1;return a.length>0?r.getNextPageParam(a[o],a,t[o],t):void 0}function za(r,{pages:a,pageParams:t}){return a.length>0?r.getPreviousPageParam?.(a[0],a,t[0],t):void 0}var Dr=class extends rr{#r;#a;#t;#o;#i;#e;#c;#n;constructor(r){super();this.#n=!1,this.#c=r.defaultOptions,this.setOptions(r.options),this.observers=[],this.#i=r.client,this.#o=this.#i.getQueryCache(),this.queryKey=r.queryKey,this.queryHash=r.queryHash,this.#a=qr(this.options),this.state=r.state??this.#a,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#r}get promise(){return this.#e?.promise}setOptions(r){if(this.options={...this.#c,...r},r?._type)this.#r=r._type;if(this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let a=qr(this.options);if(a.data!==void 0)this.setState(Ir(a.data,a.dataUpdatedAt)),this.#a=a}}optionalRemove(){if(!this.observers.length&&this.state.fetchStatus==="idle")this.#o.remove(this)}setData(r,a){let t=Ae(this.state.data,r,this.options);return this.#s({data:t,type:"success",dataUpdatedAt:a?.updatedAt,manual:a?.manual}),t}setState(r){this.#s({type:"setState",state:r})}cancel(r){let a=this.#e?.promise;return this.#e?.cancel(r),a?a.then(A).catch(A):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#a}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some((r)=>T(r.options.enabled,this)!==!1)}isDisabled(){if(this.getObserversCount()>0)return!this.isActive();return this.options.queryFn===P||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){if(this.getObserversCount()>0)return this.observers.some((r)=>T(r.options.staleTime,this)==="static");return!1}isStale(){if(this.getObserversCount()>0)return this.observers.some((r)=>r.getCurrentResult().isStale);return this.state.data===void 0||this.state.isInvalidated}isStaleByTime(r=0){if(this.state.data===void 0)return!0;if(r==="static")return!1;if(this.state.isInvalidated)return!0;return!ze(this.state.dataUpdatedAt,r)}onFocus(){this.observers.find((r)=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#e?.continue()}onOnline(){this.observers.find((r)=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#e?.continue()}addObserver(r){if(!this.observers.includes(r))this.observers.push(r),this.clearGcTimeout(),this.#o.notify({type:"observerAdded",query:this,observer:r})}removeObserver(r){let a=this.observers.indexOf(r);if(a!==-1){if(this.observers.splice(a,1),!this.observers.length){if(this.#e)if(this.#n||this.state.fetchStatus==="paused"&&this.state.status==="pending")this.#e.cancel({revert:!0});else this.#e.cancelRetry();this.scheduleGc()}this.#o.notify({type:"observerRemoved",query:this,observer:r})}}getObserversCount(){return this.observers.length}invalidate(){if(!this.state.isInvalidated)this.#s({type:"invalidate"})}async fetch(r,a){if(this.state.fetchStatus!=="idle"&&this.#e?.status()!=="rejected"){if(this.state.data!==void 0&&a?.cancelRefetch)this.cancel({silent:!0});else if(this.#e)return this.#e.continueRetry(),this.#e.promise}if(r)this.setOptions(r);if(!this.options.queryFn){let l=this.observers.find((d)=>d.options.queryFn);if(l)this.setOptions(l.options)}let t=new AbortController,o=(l)=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#n=!0,t.signal)})},i=()=>{let l=H(this.options,a),h=(()=>{let p={client:this.#i,queryKey:this.queryKey,meta:this.meta};return o(p),p})();if(this.#n=!1,this.options.persister)return this.options.persister(l,h,this);return l(h)},n=(()=>{let l={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return o(l),l})();if((this.#r==="infinite"?Mr(this.options.pages):this.options.behavior)?.onFetch(n,this),this.#t=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==n.fetchOptions?.meta)this.#s({type:"fetch",meta:n.fetchOptions?.meta});let s=this.#e=X({initialPromise:a?.initialPromise,fn:n.fetchFn,onCancel:(l)=>{if(l instanceof V&&l.revert)this.setState({...this.#t,fetchStatus:"idle"});t.abort()},onFail:(l,d)=>{this.#s({type:"failed",failureCount:l,error:d})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:n.options.retry,retryDelay:n.options.retryDelay,networkMode:n.options.networkMode,canRun:()=>!0});try{let l=await s.start();if(l===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(l),this.#o.config.onSuccess?.(l,this),this.#o.config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof V){if(l.silent)return this.#e.promise;else if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw this.#s({type:"error",error:l}),this.#o.config.onError?.(l,this),this.#o.config.onSettled?.(this.state.data,l,this),l}finally{if(this.#e===s)this.#e=void 0;this.scheduleGc()}}#s(r){let a=(t)=>{switch(r.type){case"failed":return{...t,fetchFailureCount:r.failureCount,fetchFailureReason:r.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...Ze(t.data,this.options),fetchMeta:r.meta??null};case"success":let o={...t,...Ir(r.data,r.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!r.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=r.manual?o:void 0,o;case"error":let i=r.error;return{...t,error:i,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...r.state}}};this.state=a(this.state),C.batch(()=>{this.observers.slice().forEach((t)=>{t.onQueryUpdate()}),this.#o.notify({query:this,type:"updated",action:r})})}};function Ze(r,a){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pr(a.networkMode)?"fetching":"paused",...r===void 0&&{error:null,status:"pending"}}}function Ir(r,a){return{data:r,dataUpdatedAt:a??Date.now(),error:null,isInvalidated:!1,status:"success"}}function qr(r){let a=typeof r.initialData==="function"?r.initialData():r.initialData,t=a!==void 0,o=t?typeof r.initialDataUpdatedAt==="function"?r.initialDataUpdatedAt():r.initialDataUpdatedAt:0;return{data:a,dataUpdateCount:0,dataUpdatedAt:t?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var Ur=class extends rr{#r;#a;#t;#o;constructor(r){super();this.#r=r.client,this.mutationId=r.mutationId,this.#t=r.mutationCache,this.#a=[],this.state=r.state||Je(),this.setOptions(r.options),this.scheduleGc()}setOptions(r){this.options=r,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(r){if(!this.#a.includes(r))this.#a.push(r),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",mutation:this,observer:r})}removeObserver(r){this.#a=this.#a.filter((a)=>a!==r),this.scheduleGc(),this.#t.notify({type:"observerRemoved",mutation:this,observer:r})}optionalRemove(){if(!this.#a.length)if(this.state.status==="pending")this.scheduleGc();else this.#t.remove(this)}continue(){return this.#o?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(r){let a=()=>{this.#i({type:"continue"})},t={client:this.#r,meta:this.options.meta,mutationKey:this.options.mutationKey},o=this.#o=X({fn:()=>{if(!this.options.mutationFn)return Promise.reject(Error("No mutationFn found"));return this.options.mutationFn(r,t)},onFail:(n,s)=>{this.#i({type:"failed",failureCount:n,error:s})},onPause:()=>{this.#i({type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#t.canRun(this)}),i=this.state.status==="pending",c=!o.canStart();try{if(i)a();else{if(this.#i({type:"pending",variables:r,isPaused:c}),this.#t.config.onMutate)await this.#t.config.onMutate(r,this,t);let s=await this.options.onMutate?.(r,t);if(s!==this.state.context)this.#i({type:"pending",context:s,variables:r,isPaused:c})}let n=await o.start();return await this.#t.config.onSuccess?.(n,r,this.state.context,this,t),await this.options.onSuccess?.(n,r,this.state.context,t),await this.#t.config.onSettled?.(n,null,this.state.variables,this.state.context,this,t),await this.options.onSettled?.(n,null,r,this.state.context,t),this.#i({type:"success",data:n}),n}catch(n){try{await this.#t.config.onError?.(n,r,this.state.context,this,t)}catch(s){Promise.reject(s)}try{await this.options.onError?.(n,r,this.state.context,t)}catch(s){Promise.reject(s)}try{await this.#t.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this,t)}catch(s){Promise.reject(s)}try{await this.options.onSettled?.(void 0,n,r,this.state.context,t)}catch(s){Promise.reject(s)}throw this.#i({type:"error",error:n}),n}finally{if(this.#o===o)this.#o=void 0;this.#t.runNext(this)}}#i(r){let a=(t)=>{switch(r.type){case"failed":return{...t,failureCount:r.failureCount,failureReason:r.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:r.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:r.isPaused,status:"pending",variables:r.variables,submittedAt:Date.now()};case"success":return{...t,data:r.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:r.error,failureCount:t.failureCount+1,failureReason:r.error,isPaused:!1,status:"error"}}};this.state=a(this.state),C.batch(()=>{this.#a.forEach((t)=>{t.onMutationUpdate(r)}),this.#t.notify({mutation:this,type:"updated",action:r})})}};function Je(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Fr=class extends G{#r;#a;#t;constructor(r={}){super();this.config=r,this.#r=new Set,this.#a=new Map,this.#t=0}build(r,a,t){let o=new Ur({client:r,mutationCache:this,mutationId:++this.#t,options:r.defaultMutationOptions(a),state:t});return this.add(o),o}add(r){this.#r.add(r);let a=ar(r);if(typeof a==="string"){let t=this.#a.get(a);if(t)t.push(r);else this.#a.set(a,[r])}this.notify({type:"added",mutation:r})}remove(r){if(this.#r.delete(r)){let a=ar(r);if(typeof a==="string"){let t=this.#a.get(a);if(t){if(t.length>1){let o=t.indexOf(r);if(o!==-1)t.splice(o,1)}else if(t[0]===r)this.#a.delete(a)}}}this.notify({type:"removed",mutation:r})}canRun(r){let a=ar(r);if(typeof a==="string"){let t=this.#a.get(a)?.find((o)=>o.state.status==="pending");return!t||t===r}else return!0}runNext(r){let a=ar(r);if(typeof a==="string")return this.#a.get(a)?.find((t)=>t!==r&&t.state.isPaused)?.continue()??Promise.resolve();else return Promise.resolve()}clear(){C.batch(()=>{this.#r.forEach((r)=>{this.notify({type:"removed",mutation:r})}),this.#r.clear(),this.#a.clear()})}getAll(){return Array.from(this.#r)}find(r){let a={exact:!0,...r};return this.getAll().find((t)=>K(a,t))}findAll(r={}){return this.getAll().filter((a)=>K(r,a))}notify(r){C.batch(()=>{this.listeners.forEach((a)=>{a(r)})})}resumePausedMutations(){let r=this.getAll().filter((a)=>a.state.isPaused);return C.batch(()=>Promise.all(r.map((a)=>a.continue().catch(A))))}};function ar(r){return r.options.scope?.id}var Tr=class extends G{#r;constructor(r={}){super();this.config=r,this.#r=new Map}build(r,a,t){let o=a.queryKey,i=a.queryHash??D(o,a),c=this.get(i);if(!c)c=new Dr({client:r,queryKey:o,queryHash:i,options:r.defaultQueryOptions(a),state:t,defaultOptions:r.getQueryDefaults(o)}),this.add(c);return c}add(r){if(!this.#r.has(r.queryHash))this.#r.set(r.queryHash,r),this.notify({type:"added",query:r})}remove(r){let a=this.#r.get(r.queryHash);if(a){if(r.destroy(),a===r)this.#r.delete(r.queryHash);this.notify({type:"removed",query:r})}}clear(){C.batch(()=>{this.getAll().forEach((r)=>{this.remove(r)})})}get(r){return this.#r.get(r)}getAll(){return[...this.#r.values()]}find(r){let a={exact:!0,...r};return this.getAll().find((t)=>ve(a,t))}findAll(r={}){let a=this.getAll();return Object.keys(r).length>0?a.filter((t)=>ve(r,t)):a}notify(r){C.batch(()=>{this.listeners.forEach((a)=>{a(r)})})}onFocus(){C.batch(()=>{this.getAll().forEach((r)=>{r.onFocus()})})}onOnline(){C.batch(()=>{this.getAll().forEach((r)=>{r.onOnline()})})}};var hr=class{#r;#a;#t;#o;#i;#e;#c;#n;constructor(r={}){this.#r=r.queryCache||new Tr,this.#a=r.mutationCache||new Fr,this.#t=r.defaultOptions||{},this.#o=new Map,this.#i=new Map,this.#e=0}mount(){if(this.#e++,this.#e!==1)return;this.#c=Ce.subscribe(async(r)=>{if(r)await this.resumePausedMutations(),this.#r.onFocus()}),this.#n=O.subscribe(async(r)=>{if(r)await this.resumePausedMutations(),this.#r.onOnline()})}unmount(){if(this.#e--,this.#e!==0)return;this.#c?.(),this.#c=void 0,this.#n?.(),this.#n=void 0}isFetching(r){return this.#r.findAll({...r,fetchStatus:"fetching"}).length}isMutating(r){return this.#a.findAll({...r,status:"pending"}).length}getQueryData(r){let a=this.defaultQueryOptions({queryKey:r});return this.#r.get(a.queryHash)?.state.data}ensureQueryData(r){let a=this.defaultQueryOptions(r),t=this.#r.build(this,a),o=t.state.data;if(o===void 0)return this.fetchQuery(r);if(r.revalidateIfStale&&t.isStaleByTime(T(a.staleTime,t)))this.prefetchQuery(a);return Promise.resolve(o)}getQueriesData(r){return this.#r.findAll(r).map(({queryKey:a,state:t})=>[a,t.data])}setQueryData(r,a,t){let o=this.defaultQueryOptions({queryKey:r}),i=this.#r.get(o.queryHash)?.state.data,c=Cr(a,i);if(c===void 0)return;return this.#r.build(this,o).setData(c,{...t,manual:!0})}setQueriesData(r,a,t){return C.batch(()=>this.#r.findAll(r).map(({queryKey:o})=>[o,this.setQueryData(o,a,t)]))}getQueryState(r){let a=this.defaultQueryOptions({queryKey:r});return this.#r.get(a.queryHash)?.state}removeQueries(r){let a=this.#r;C.batch(()=>{a.findAll(r).forEach((t)=>{a.remove(t)})})}resetQueries(r,a){let t=this.#r;return C.batch(()=>{let o=t.findAll(r),i=new Set(o);return o.forEach((c)=>{c.reset()}),this.refetchQueries({type:"active",predicate:(c)=>i.has(c)},a)})}cancelQueries(r,a={}){let t={revert:!0,...a},o=C.batch(()=>this.#r.findAll(r).map((i)=>i.cancel(t)));return Promise.all(o).then(A).catch(A)}invalidateQueries(r,a={}){return C.batch(()=>{if(this.#r.findAll(r).forEach((t)=>{t.invalidate()}),r?.refetchType==="none")return Promise.resolve();return this.refetchQueries({...r,type:r?.refetchType??r?.type??"active"},a)})}refetchQueries(r,a={}){let t={...a,cancelRefetch:a.cancelRefetch??!0},o=C.batch(()=>this.#r.findAll(r).filter((i)=>!i.isDisabled()&&!i.isStatic()).map((i)=>{let c=i.fetch(void 0,t);if(!t.throwOnError)c=c.catch(A);return i.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(o).then(A)}async query(r){let a=this.defaultQueryOptions(r);if(a.retry===void 0)a.retry=!1;let t=this.#r.build(this,a),o=t.isStaleByTime(T(a.staleTime,t))?await t.fetch(a):t.state.data,i=a.select;if(i)return i(o);return o}fetchQuery(r){let a=this.defaultQueryOptions(r);if(a.retry===void 0)a.retry=!1;let t=this.#r.build(this,a);return t.isStaleByTime(T(a.staleTime,t))?t.fetch(a):Promise.resolve(t.state.data)}prefetchQuery(r){return this.fetchQuery(r).then(A).catch(A)}infiniteQuery(r){return r._type="infinite",this.query(r)}fetchInfiniteQuery(r){return r._type="infinite",this.fetchQuery(r)}prefetchInfiniteQuery(r){return this.fetchInfiniteQuery(r).then(A).catch(A)}ensureInfiniteQueryData(r){return r._type="infinite",this.ensureQueryData(r)}resumePausedMutations(){if(O.isOnline())return this.#a.resumePausedMutations();return Promise.resolve()}getQueryCache(){return this.#r}getMutationCache(){return this.#a}getDefaultOptions(){return this.#t}setDefaultOptions(r){this.#t=r}setQueryDefaults(r,a){this.#o.set(J(r),{queryKey:r,defaultOptions:a})}getQueryDefaults(r){let a=[...this.#o.values()],t={};return a.forEach((o)=>{if(z(r,o.queryKey))Object.assign(t,o.defaultOptions)}),t}setMutationDefaults(r,a){this.#i.set(J(r),{mutationKey:r,defaultOptions:a})}getMutationDefaults(r){let a=[...this.#i.values()],t={};return a.forEach((o)=>{if(z(r,o.mutationKey))Object.assign(t,o.defaultOptions)}),t}defaultQueryOptions(r){if(r._defaulted)return r;let a={...this.#t.queries,...this.getQueryDefaults(r.queryKey),...r,_defaulted:!0};if(!a.queryHash)a.queryHash=D(a.queryKey,a);if(a.refetchOnReconnect===void 0)a.refetchOnReconnect=a.networkMode!=="always";if(a.throwOnError===void 0)a.throwOnError=!!a.suspense;if(!a.networkMode&&a.persister)a.networkMode="offlineFirst";if(a.queryFn===P)a.enabled=!1;return a}defaultMutationOptions(r){if(r?._defaulted)return r;return{...this.#t.mutations,...r?.mutationKey&&this.getMutationDefaults(r.mutationKey),...r,_defaulted:!0}}clear(){this.#r.clear(),this.#a.clear()}};var M=new hr;var N={all:["workspace-members"],account:(r)=>[...N.all,r??"unknown"],workspace:(r,a)=>[...N.account(r),a]};var I=["pink","orange","amber","lime","emerald","cyan","blue","violet"];function tr(r){return typeof r==="string"&&I.includes(r)}function Qr(r){let a=2166136261;for(let t=0;t<r.length;t++)a^=r.charCodeAt(t),a=Math.imul(a,16777619);return I[(a>>>0)%I.length]??I[0]}var lt=1;var _a=8192,Ca=320;function ne(r){return typeof r==="object"&&r!==null&&!Array.isArray(r)}function er(r,a=256){return typeof r==="string"&&r.length>0&&!r.includes("\x00")&&new TextEncoder().encode(r).length<=a}function Rr(r){return ne(r)&&er(r.id,240)&&r.id.trim().length>0&&(r.name===void 0||er(r.name)&&r.name.trim().length>0)&&tr(r.color)&&(r.avatar===void 0||er(r.avatar,_a))&&(r.email===void 0||er(r.email,Ca))}function or(r,a){return typeof r==="string"&&r.length<=a&&!r.includes("\x00")}function Ea(r){if(!or(r,2048))return!1;try{return["http:","https:"].includes(new URL(r).protocol)}catch{return!1}}function ie(r){if(!ne(r)||!or(r.id,240)||!r.id.trim()||r.id!==r.id.trim()||!or(r.name,256)||r.avatar!==void 0&&!Ea(r.avatar))throw Error("Invalid identity");let a={id:r.id,name:r.name,...r.avatar!==void 0?{avatar:r.avatar}:{}};if(r.type==="agent")return{...a,type:"agent"};if(r.type==="user"&&or(r.email,320)&&typeof r.isAnonymous==="boolean")return{...a,type:"user",email:r.email,isAnonymous:r.isAnonymous};throw Error("Invalid identity")}var W=(r)=>`${r.type}:${r.id}`,ir=(r)=>r.type==="agent"?`agent:${r.id}`:r.id;var nr,Lr=0,Nr=0,gr=new Set,U=()=>nr,_e=()=>Nr,Q=()=>Lr;function Ue(r){return gr.add(r),()=>{gr.delete(r)}}function ce(r){let a=r===null?null:ie(r);if((nr&&W(nr))!==(a&&W(a)))Lr++,M.cancelQueries({queryKey:N.all}),M.removeQueries({queryKey:N.all});Nr++,nr=a,gr.forEach((o)=>o())}var Sa=["Curious Kiwi","Cheerful Cherry","Sleepy Peach","Excited Banana","Cosmic Mango","Velvet Lemon","Electric Plum","Wandering Pear","Dramatic Papaya","Suspicious Pineapple","Confused Coconut","Sneaky Tangerine","Gentle Fig","Quiet Apricot","Mellow Melon","Dreamy Guava"];function Kr(r,a){let t=r.filter((o)=>o!==a);return t[Math.floor(Math.random()*t.length)]??r[0]}function Aa(r){return{name:Kr(Sa,r?.name),color:Kr(I,r?.color)}}function ja(r,a){let t=a.name.trim();return{id:r,...t?{name:t}:{},color:a.color}}function Br(){return ja(`local-${crypto.randomUUID().slice(0,8)}`,Aa())}var vr="moi:local-profile",_,E,F=new Set;function wr(r,a){return JSON.stringify(r)===JSON.stringify(a)}function q(r){if(!r||typeof r.id!=="string"||!r.id.trim())throw Error("A user profile needs an id.");if(r.name!==void 0&&typeof r.name!=="string")throw Error("A user profile name must be a string when provided.");if(r.color!==void 0&&!tr(r.color))throw Error("A user profile color must be one of the user palette names.");let a=r.id.trim(),t=r.name?.trim(),o={id:a,...t?{name:t}:{},color:r.color??Qr(a),...r.avatar!==void 0?{avatar:r.avatar}:{},...r.email!==void 0?{email:r.email}:{}};if(!Rr(o))throw Error("Invalid user profile.");return Object.freeze(o)}var ur,Hr;function B(){let r=U();if(r===void 0)return _;if(r!==Hr){Hr=r;let a=!r||r.type==="user"&&r.isAnonymous?void 0:q({id:ir(r),name:r.name||void 0,avatar:r.avatar,email:r.type==="user"?r.email||void 0:void 0});if(!wr(ur,a))ur=a}return ur}function ue(r){let a=B(),t=j(),o=()=>{let c=B(),n=j();if(a===c&&t===n)return;a=c,t=n,r()};F.add(o);let i=Ue(o);return()=>{F.delete(o),i()}}function j(){return U()!==void 0?"external":E}function ct({provider:r,profile:a}){if(j()==="external")return;if(r===void 0){if(E===void 0||E==="local")return;E=void 0,_=void 0}else{let t=a===void 0?void 0:q(a);if(E===r&&wr(_,t))return;E=r,_=t}F.forEach((t)=>t())}function Pa(){try{localStorage.setItem(vr,JSON.stringify(_))}catch{}}function He(r){if(j()!==void 0&&j()!=="local")return;let a=q(r);E="local",_=a,Pa(),F.forEach((t)=>t())}function Vr(r,a){if(!r||!a||a.provider!==void 0||j()!==void 0)return;try{let t=localStorage.getItem(vr);if(t){He(JSON.parse(t));return}}catch{}He(Br())}function Wr(r){if(r.key!==vr||!r.newValue||j()!=="local")return;try{let a=q(JSON.parse(r.newValue));if(wr(a,_))return;_=a,F.forEach((t)=>t())}catch{}}function $r(){return window.addEventListener("storage",Wr),()=>window.removeEventListener("storage",Wr)}function Me(r){if(!ne(r)||!Array.isArray(r.members)||!Array.isArray(r.invitations))throw Error("Invalid workspace members");let a=r.members.map((o)=>{let i=ie(o);if(ne(o)&&o.membershipId!==void 0){if(typeof o.membershipId!=="string"||!o.membershipId||o.membershipId.length>240)throw Error("Invalid membership id");return{...i,membershipId:o.membershipId}}return i}),t=r.invitations.map((o)=>{if(!ne(o)||typeof o.id!=="string"||!o.id||typeof o.email!=="string"||!o.email||typeof o.expiresAt!=="string"||!Number.isFinite(Date.parse(o.expiresAt)))throw Error("Invalid invitation");return{id:o.id,email:o.email,expiresAt:o.expiresAt}});if(new Set(a.map(W)).size!==a.length||new Set(t.map((o)=>o.id)).size!==t.length)throw Error("Duplicate workspace member or invitation");return{members:a,invitations:t}}function ke(r){if(!/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(r))throw Error("Invalid workspace id");return r}M.setQueryDefaults(N.all,{gcTime:1/0});var fr=0,Jr,mr=new Set,Yr=new WeakMap;M.getQueryCache().subscribe((r)=>{if(r.query.queryKey[0]!==N.all[0])return;if(r.type==="removed"||r.type==="updated"&&r.action.type==="success")fr++});var Zr=()=>fr,Xr=new WeakMap;function We(){let r=U();if(Jr!==Q()||r?.type!=="user"||r.isAnonymous)return;let a=Yr.get(r);if(!a)a={members:[r],invitations:[]},Yr.set(r,a);return a}function Gr(r,a){let t=U(),o=N.workspace(t?W(t):void 0,r);ke(r);let i=Me(a);M.cancelQueries({queryKey:o,exact:!0}),M.setQueryData(o,i)}function ra(r){if(!Array.isArray(r))throw Error("Invalid workspace members");let a=r.map((n)=>({id:ke(n.id),data:Me(n)})),t=new Set(a.map((n)=>n.id));if(t.size!==a.length)throw Error("Duplicate workspace id");Jr=Q();let o=U(),i=o?W(o):void 0,c=N.account(i);M.cancelQueries({queryKey:c});for(let n of M.getQueryCache().findAll({queryKey:c}))if(!t.has(n.queryKey[2]))br(n.queryKey);for(let n of a)M.setQueryData(N.workspace(i,n.id),n.data);fr++,mr.forEach((n)=>n())}function aa(r){let a=U(),t=N.workspace(a?W(a):void 0,r);ke(r),M.cancelQueries({queryKey:t,exact:!0}),br(t)}function ta(){M.cancelQueries({queryKey:N.all});for(let r of M.getQueryCache().findAll({queryKey:N.all}))br(r.queryKey)}function br(r){M.setQueryData(r,We()??{members:[],invitations:[]})}function ut(r){let a=U(),t=N.workspace(a?W(a):void 0,r),o=M.getQueryData(t)??We();if(!o)return;let i=Xr.get(o);if(!i)i=o.members.map((c)=>q({id:ir(c),name:c.name||void 0,avatar:c.avatar,email:c.type==="user"?c.email||void 0:void 0})),Xr.set(o,i);return i}function Qe(r){mr.add(r);let a=M.getQueryCache().subscribe((t)=>{if(t.query.queryKey[0]===N.all[0])r()});return()=>{mr.delete(r),a()}}function ea(){if(typeof window>"u")return;let r=window;r.moi??={},r.moi.identity={set:ce,getRevision:_e},r.moi.workspaceMembers={set:Gr,setAll:ra,remove:aa,clear:ta,getRevision:Zr}}ea();$r();async function Oa(r){let[{mount:a},t,o]=await Promise.all([(Y("ep5vh16c"),import("/chunk-ep5vh16c.js")),(Y("vp2qzc0d"),import("/chunk-vp2qzc0d.js")).then((i)=>i.loadAppConfig()),(Y("7rz6g7g7"),import("/chunk-7rz6g7g7.js")).then((i)=>i.loadProxyUser())]);Vr(t?.environment==="local"&&!t.demo,o),a(r)}globalThis.__init=Oa;export{e,x,be,st,Y,Z,A,Be,ze,T,ve,J,Re,we,Ae,Se,Ie,G,Ce,C,Ze,Je,M,N,lt,ne,ie,W,U,_e,Q,Ue,ce,B,ue,j,ct,He,Me,ke,We,ut,Qe};
|
package/dist/chunk-svxhxfeq.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
async function s(t,e){let o=await t.text();return Error(o||e)}async function p(t,e,o="Request failed"){let n=await fetch(t,e);if(!n.ok)throw await s(n,o);return n.json()}async function H(t,e,o="Request failed"){let n=await fetch(t,e);if(!n.ok)throw await s(n,o)}function v(t,e){return{method:t,headers:{"Content-Type":"application/json"},body:e===void 0?void 0:JSON.stringify(e)}}
|
|
2
|
-
export{p,H,v};
|
package/dist/chunk-t0r0bds1.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{gt}from"/chunk-kdgk4dac.js";export{gt as sanitizeSvg};
|
package/dist/chunk-vp2qzc0d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{xt,R}from"/chunk-wz5qv1bn.js";export{xt as loadAppConfig,R as useAppConfig};
|
package/dist/chunk-wz5qv1bn.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{e,x}from"/chunk-s5s1vzdw.js";import{p}from"/chunk-svxhxfeq.js";var t=x(function(a,r){r.exports=globalThis.__esm.react});var f=e(t(),1);var l={environment:"local",collab:!1,demo:!1,demoInstallUrl:"https://moi.computer"},o=l,i=new Set;function s(n){return i.add(n),()=>{i.delete(n)}}async function c(){try{o=await p("/api/config");for(let n of i)n();return o}catch{}}async function xt(){return c()}function R(){return f.useSyncExternalStore(s,()=>o)}
|
|
2
|
-
export{t,xt,R};
|
package/lib/workspace-types.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { WorkspaceType } from './types'
|
|
2
|
-
|
|
3
|
-
export const WORKSPACE_TYPE_ORDER = [
|
|
4
|
-
'claude-code',
|
|
5
|
-
'codex',
|
|
6
|
-
'openclaw',
|
|
7
|
-
'hermes'
|
|
8
|
-
] as const satisfies readonly WorkspaceType[]
|
|
9
|
-
|
|
10
|
-
export function orderWorkspaceTypes(types: Iterable<WorkspaceType>): WorkspaceType[] {
|
|
11
|
-
const unique = new Set(types)
|
|
12
|
-
return WORKSPACE_TYPE_ORDER.filter(type => unique.has(type))
|
|
13
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// One-time import of the pre-0.13 global stores into per-workspace state,
|
|
2
|
-
// keyed by workspace path. Imports registered workspaces only, then deletes
|
|
3
|
-
// the old files. Delete this file after v0.14.
|
|
4
|
-
import { rm } from 'node:fs/promises'
|
|
5
|
-
import { join } from 'node:path'
|
|
6
|
-
|
|
7
|
-
import { DATA_DIR } from '../data-dir'
|
|
8
|
-
import { normalizeWorkspaceState } from './file'
|
|
9
|
-
import { hasWorkspaceState, updateWorkspaceState } from './index'
|
|
10
|
-
import type { WorkspaceRef } from './types'
|
|
11
|
-
|
|
12
|
-
type LegacySession = {
|
|
13
|
-
tabId?: string
|
|
14
|
-
config?: unknown
|
|
15
|
-
forkedFromSessionId?: string
|
|
16
|
-
forkedThroughMessageId?: string
|
|
17
|
-
forkedNoticeIds?: string[]
|
|
18
|
-
}
|
|
19
|
-
type LegacySelection = { selected?: unknown; pinned?: unknown }
|
|
20
|
-
type LegacyView = { id: string; executionSessionId?: string }
|
|
21
|
-
|
|
22
|
-
export const LEGACY_FILES = [
|
|
23
|
-
'sessions.json',
|
|
24
|
-
'session-config.json',
|
|
25
|
-
'selected-sessions.json',
|
|
26
|
-
'pending-views.json',
|
|
27
|
-
'view-builders.json'
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
function readLegacy<T>(dataDir: string, name: string): Promise<Record<string, T>> {
|
|
31
|
-
return Bun.file(join(dataDir, name))
|
|
32
|
-
.json()
|
|
33
|
-
.catch(() => ({}))
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export async function migrateLegacyWorkspaceState(
|
|
37
|
-
workspaces: readonly WorkspaceRef[],
|
|
38
|
-
dataDir = DATA_DIR
|
|
39
|
-
): Promise<void> {
|
|
40
|
-
const sessions = await readLegacy<Record<string, LegacySession>>(dataDir, 'sessions.json')
|
|
41
|
-
const selections = await readLegacy<LegacySelection>(dataDir, 'selected-sessions.json')
|
|
42
|
-
const pendingViews = await readLegacy<LegacyView[]>(dataDir, 'pending-views.json')
|
|
43
|
-
|
|
44
|
-
for (const ws of workspaces) {
|
|
45
|
-
if (hasWorkspaceState(ws.id)) continue
|
|
46
|
-
const state = normalizeWorkspaceState(
|
|
47
|
-
{
|
|
48
|
-
pinnedSessionId: selections[ws.path]?.pinned,
|
|
49
|
-
selected: selections[ws.path]?.selected,
|
|
50
|
-
sessions: Object.fromEntries(
|
|
51
|
-
Object.entries(sessions[ws.path] ?? {}).map(([id, session]) => [
|
|
52
|
-
id,
|
|
53
|
-
{
|
|
54
|
-
tabId: session.tabId,
|
|
55
|
-
config: session.config,
|
|
56
|
-
fork: session.forkedFromSessionId && {
|
|
57
|
-
fromSessionId: session.forkedFromSessionId,
|
|
58
|
-
throughMessageId: session.forkedThroughMessageId,
|
|
59
|
-
noticeIds: session.forkedNoticeIds
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
])
|
|
63
|
-
),
|
|
64
|
-
pendingViews: Object.fromEntries(
|
|
65
|
-
(pendingViews[ws.path] ?? []).map(({ id, executionSessionId, ...view }) => [
|
|
66
|
-
id,
|
|
67
|
-
{ ...view, buildSessionId: executionSessionId }
|
|
68
|
-
])
|
|
69
|
-
)
|
|
70
|
-
},
|
|
71
|
-
ws.path
|
|
72
|
-
)
|
|
73
|
-
await updateWorkspaceState(ws, draft => {
|
|
74
|
-
Object.assign(draft, state)
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
for (const name of LEGACY_FILES) await rm(join(dataDir, name), { force: true })
|
|
79
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|