@rizom/brain 0.2.0-alpha.762 → 0.2.0-alpha.763
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/brain.js +133 -133
- package/dist/chunks/app-sm2em526.js +5 -0
- package/dist/chunks/{index-5gwnbhh0.js → index-2eznbxjq.js} +2 -2
- package/dist/chunks/{index-9vwdkez5.js → index-66z3zrmq.js} +3 -3
- package/dist/chunks/{index-9vwdkez5.js.map → index-66z3zrmq.js.map} +1 -1
- package/dist/chunks/{index-7yry6pk2.js → index-8pxh95mr.js} +2 -2
- package/dist/chunks/{index-fzb4mr0f.js → index-91xp5wy6.js} +21 -21
- package/dist/chunks/{index-fzb4mr0f.js.map → index-91xp5wy6.js.map} +4 -4
- package/dist/chunks/{index-y849n0xb.js → index-g9h8t0x7.js} +2 -2
- package/dist/chunks/{index-eedmt1sv.js → index-j13gczzx.js} +2 -2
- package/dist/chunks/{package-pewz17e7.js → package-n2ztkfa2.js} +3 -3
- package/dist/chunks/{package-pewz17e7.js.map → package-n2ztkfa2.js.map} +1 -1
- package/dist/entities.js +1 -1
- package/dist/git-broker.js +10 -10
- package/dist/index.js +1 -1
- package/dist/interfaces.js +1 -1
- package/dist/model.js +4 -4
- package/dist/model.js.map +1 -1
- package/dist/services.js +1 -1
- package/dist/testing.js +1 -1
- package/dist/ui/{studio-app-qd0hk5dv.js → studio-app-hcg2rfyy.js} +2 -2
- package/dist/ui/studio-asset-manifest.json +13 -13
- package/dist/ui/studio-chunks/{account-view-pgy2e6j6.js → account-view-jwgh7b9e.js} +1 -1
- package/dist/ui/studio-chunks/{main-k6jsh4n9.js → main-e4qk2bwv.js} +12 -12
- package/dist/ui/studio-chunks/{main-k6jsh4n9.js.map → main-e4qk2bwv.js.map} +2 -2
- package/dist/ui/studio-chunks/{main-fxrm4ssk.js → main-k6q9va58.js} +1 -1
- package/dist/ui/studio-chunks/{main-6a06q2ax.js → main-rhzszne9.js} +1 -1
- package/dist/ui/studio-chunks/{studio-chat-workspace-x5rxvgae.js → studio-chat-workspace-m8qqpajr.js} +1 -1
- package/package.json +1 -1
- package/dist/chunks/app-95na3rzh.js +0 -5
- /package/dist/chunks/{app-95na3rzh.js.map → app-sm2em526.js.map} +0 -0
- /package/dist/chunks/{index-5gwnbhh0.js.map → index-2eznbxjq.js.map} +0 -0
- /package/dist/chunks/{index-7yry6pk2.js.map → index-8pxh95mr.js.map} +0 -0
- /package/dist/chunks/{index-y849n0xb.js.map → index-g9h8t0x7.js.map} +0 -0
- /package/dist/chunks/{index-eedmt1sv.js.map → index-j13gczzx.js.map} +0 -0
- /package/dist/ui/{studio-app-qd0hk5dv.js.map → studio-app-hcg2rfyy.js.map} +0 -0
- /package/dist/ui/studio-chunks/{account-view-pgy2e6j6.js.map → account-view-jwgh7b9e.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-fxrm4ssk.js.map → main-k6q9va58.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-6a06q2ax.js.map → main-rhzszne9.js.map} +0 -0
- /package/dist/ui/studio-chunks/{studio-chat-workspace-x5rxvgae.js.map → studio-chat-workspace-m8qqpajr.js.map} +0 -0
package/dist/services.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunks/index-z0k97qgd.js";import{Eh as g,Gh as h,Hh as i,Ih as j,Jh as k,Me as a,Th as l,Wi as n,Xi as q,sh as b,th as c,uh as d}from"./chunks/index-
|
|
2
|
+
import"./chunks/index-z0k97qgd.js";import{Eh as g,Gh as h,Hh as i,Ih as j,Jh as k,Me as a,Th as l,Wi as n,Xi as q,sh as b,th as c,uh as d}from"./chunks/index-91xp5wy6.js";import{Am as p,Om as t,Xm as x,xm as f,zm as m}from"./chunks/index-rp80h99d.js";import"./chunks/index-tmmhpkks.js";import"./chunks/index-w3fkvmpp.js";import{cy as e}from"./chunks/index-p7r4yhgz.js";import"./chunks/index-ncwvncs8.js";import"./chunks/index-k148qr6g.js";export{p as SdkError,a as contentGenerationResultSchema,g as defineAccountSettings,i as defineBusContract,t as defineChannel,b as defineDashboardWidget,d as defineEntityCatalog,j as defineJob,q as defineRoute,l as defineServicePlugin,x as defineSharedState,c as defineStudioWorkspace,k as defineTool,h as defineWorkspaceAction,n as protocol,f as sdkErrorCodeSchema,m as sdkErrorSchema,e as z};
|
|
3
3
|
|
|
4
4
|
//# debugId=E0F29C89480A83EE64756E2164756E21
|
|
5
5
|
//# sourceMappingURL=services.js.map
|
package/dist/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{M as k,N as V,O as U}from"./chunks/index-
|
|
2
|
+
import{M as k,N as V,O as U}from"./chunks/index-66z3zrmq.js";import{Ga as N,Ha as O,Ia as z,Ja as M,Ka as q,La as J,Ma as L,Oa as _,P as E,Pa as j,S as I,ea as A,fa as x}from"./chunks/index-2eznbxjq.js";import"./chunks/index-bttj9f2n.js";import{Ta as D}from"./chunks/index-8pxh95mr.js";import{Pe as C,Wb as h,Zg as P,_g as w,lk as B}from"./chunks/index-91xp5wy6.js";import{zl as p}from"./chunks/index-rp80h99d.js";import{Jo as S,Lo as v}from"./chunks/index-tmmhpkks.js";import"./chunks/index-w3fkvmpp.js";import"./chunks/index-p7r4yhgz.js";import"./chunks/index-ncwvncs8.js";import"./chunks/index-k148qr6g.js";import{mkdtemp as K,rm as b}from"fs/promises";import{tmpdir as X}from"os";import{join as m}from"path";var y="none";function s(){return Promise.reject(Error("A test brain has no AI provider"))}function W(e){return{specificationVersion:"v3",provider:"test-brain",modelId:e,supportedUrls:{},doGenerate:s,doStream:s}}function T(e){let r={...e};return{generateText:s,generateObject:s,judge:s,generateImage:s,getModel:()=>W(r.model??"none"),canGenerateImages:()=>!1,getConfig:()=>({...r}),updateConfig:(o)=>{r={...r,...o}}}}function R(){return{identity:{model:"test:none",dimensions:1536,promptRevision:0},embedQuery:s,embedDocuments:s}}var Y="shell",ee=20;function te(e){if("needsConfirmation"in e)return{needsConfirmation:!0,summary:e.summary};if(!e.success)return{success:!1,error:e.error,...p({code:e.code})};return{success:!0,...p({data:e.data,message:e.message})}}function re(e,r){if(e.status==="completed"||e.status==="failed")return!0;return e.status==="pending"&&e.lastError!==null&&e.scheduledFor>r}function ne(e,r){return e.flatMap((o)=>{if(!D(o))throw Error("A test brain runs packages configured with use(), as defineBrain does");return P(o.definition,o.config,r)})}async function F(e,r){let o=k(r.directory);V(o,r.brainVersion);let f=ne(e.plugins,{name:o.name,version:o.version}),a=await K(m(r.temporaryRoot??X(),"rizom-test-brain-")),g={...E({dataDir:a,cacheDir:m(a,"cache"),distDir:m(a,"dist")}),embedding:{enabled:!1}},i;try{await new J(v.createFresh({level:S.WARN,context:"test-brain"}),{getStandardConfigWithDirectories:async()=>g,migrateEntities:O,migrateJobQueue:z,migrateConversations:M,migrateRuntimeState:q}).runAllMigrations();let t=_({name:o.name,version:o.version,logLevel:"warn",plugins:f,shellConfig:{...g,dataDir:m(a,"brain-data"),ai:{model:y}}}),n=I(j(t));i=N.createFresh(n,{aiService:T(A(n)),embeddingService:R()}),await i.initialize()}catch(t){throw await b(a,{recursive:!0,force:!0}),t}let Z=f.map((t)=>t.id),H,Q=async()=>{try{await i.shutdown()}finally{await b(a,{recursive:!0,force:!0})}};return Object.freeze({async tool(t,n){let l=i.getMCPService().listTools(),d=l.find(({tool:u})=>u.name===t);if(!d)throw Error(`No tool "${t}"; this brain has ${l.map(({tool:u})=>u.name).join(", ")}`);return te(await d.tool.handler(n,L()))},request:(t,n)=>h(i.getMessageBus(),t,n,Y),async fetch(t){let n=x(B(i),t.method.toUpperCase(),new URL(t.url).pathname);if(!n)return new Response("Not Found",{status:404});if(n.sharedHostAdmission==="deny")return new Response("Unauthorized",{status:401});return n.handler(t)},entities:C(i.getEntityService(),"restricted"),jobs:Object.freeze({async wait(t,n){let l=i.getJobQueueService(),d=async()=>{let c=await l.getStatus(n);if(!c||!Z.some((G)=>c.type===`${G}:${t.name}`))return null;if(re(c,Date.now()))return c;return await Bun.sleep(ee),d()},u=await d();return u?w(t,u):null}}),stop:()=>H??=Q()})}function Ee(e){return F(e,{brainVersion:U.version,directory:process.cwd()})}export{Ee as startTestBrain};
|
|
3
3
|
|
|
4
4
|
//# debugId=19343464DCA1B8FC64756E2164756E21
|
|
5
5
|
//# sourceMappingURL=testing.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as dL,b as hL,e as uL,f as cL}from"./studio-chunks/main-fxrm4ssk.js";import{$ as sB,A as tL,Aa as pL,B as Vi,Ba as ei,C as $i,Ca as us,D as LE,Da as ig,E as xm,Ea as Ca,F as nL,Fa as Zn,G as cn,Ga as hg,H as kL,Ha as zd,I as CL,Ia as og,J as AL,Ja as WR,K as U1,Ka as XR,L as TL,La as Nd,M as EL,Ma as vR,N as _g,Na as SR,O as Ig,Oa as K,P as xc,Pa as FO,Q as I1,Qa as m1,R as jg,Ra as LO,S as qg,Sa as _O,T as H1,Ta as yg,U as FL,V as KL,W as DL,X as M1,Y as JL,Z as PL,_ as jL,aa as Da,ba as Zd,ca as L1,da as zg,ea as _n,fa as LM,g as eB,ga as lt,h as km,ha as Tg,i as nB,ia as RL,j as Ag,ja as OL,k as qi,ka as ML,l as Ug,la as iL,m as WL,ma as Jd,n as iB,na as Vg,o as XL,oa as qM,p as Gg,pa as Eg,q as Xt,qa as wc,r as ke,ra as si,s as Sm,sa as $o,t as wr,ta as oL,u as OE,ua as Lg,v as ot,va as lL,w as lo,wa as KM,x as $g,xa as JM,y as Gu,ya as Bg,z as eL,za as GL}from"./studio-chunks/main-6a06q2ax.js";import"./studio-chunks/main-a53sa3y9.js";import{$a as q,Ab as Og,Bb as Mg,Gb as C1,Ib as Mv,Jb as ni,Kb as Un,Mb as cd,Nb as Pg,Qb as ud,Rb as bg,Sb as Rv,Tb as HM,ab as An,bb as fe,bc as Ii,cb as Be,fb as XM,fc as Bo,gb as Se,gc as oB,hb as Ta,hc as lB,ib as es,ic as gi,jb as Cm,jc as rr,kc as Dn,lb as GM,lc as ME,mc as ar,pb as QM,pc as li,qb as YM,qc as Qu,rb as fn,rc as Ma,sb as rL,sc as NL,tb as yM,tc as oi,ub as bM,uc as wm,vb as vM,vc as Si,xb as aL,yb as Dg,zb as Rg}from"./studio-chunks/main-k6jsh4n9.js";import{Bc as YL,Cc as Wt,Ec as PN,wc as re,yc as Ev}from"./studio-chunks/main-hft323ae.js";var vE=Ev(function(VN){(function(){function t(){if(I=!1,le){var Q=VN.unstable_now();de=Q;var se=!0;try{e:{N=!1,P&&(P=!1,F(Ee),Ee=-1),M=!0;var te=R;try{t:{u(Q);for(C=l(S);C!==null&&!(C.expirationTime>Q&&h());){var J=C.callback;if(typeof J==="function"){C.callback=null,R=C.priorityLevel;var ge=J(C.expirationTime<=Q);if(Q=VN.unstable_now(),typeof ge==="function"){C.callback=ge,u(Q),se=!0;break t}C===l(S)&&s(S),u(Q)}else s(S);C=l(S)}if(C!==null)se=!0;else{var Ke=l(k);Ke!==null&&p(f,Ke.startTime-Q),se=!1}}break e}finally{C=null,R=te,M=!1}se=void 0}}finally{se?W():le=!1}}}function i(Q,se){var te=Q.length;Q.push(se);e:for(;0<te;){var J=te-1>>>1,ge=Q[J];if(0<a(ge,se))Q[J]=se,Q[te]=ge,te=J;else break e}}function l(Q){return Q.length===0?null:Q[0]}function s(Q){if(Q.length===0)return null;var se=Q[0],te=Q.pop();if(te!==se){Q[0]=te;e:for(var J=0,ge=Q.length,Ke=ge>>>1;J<Ke;){var Ie=2*(J+1)-1,gt=Q[Ie],et=Ie+1,Ne=Q[et];if(0>a(gt,te))et<ge&&0>a(Ne,gt)?(Q[J]=Ne,Q[et]=te,J=et):(Q[J]=gt,Q[Ie]=te,J=Ie);else if(et<ge&&0>a(Ne,te))Q[J]=Ne,Q[et]=te,J=et;else break e}}return se}function a(Q,se){var te=Q.sortIndex-se.sortIndex;return te!==0?te:Q.id-se.id}function u(Q){for(var se=l(k);se!==null;){if(se.callback===null)s(k);else if(se.startTime<=Q)s(k),se.sortIndex=se.expirationTime,i(S,se);else break;se=l(k)}}function f(Q){if(P=!1,u(Q),!N)if(l(S)!==null)N=!0,le||(le=!0,W());else{var se=l(k);se!==null&&p(f,se.startTime-Q)}}function h(){return I?!0:VN.unstable_now()-de<_?!1:!0}function p(Q,se){Ee=j(function(){Q(VN.unstable_now())},se)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),VN.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var g=performance;VN.unstable_now=function(){return g.now()}}else{var y=Date,v=y.now();VN.unstable_now=function(){return y.now()-v}}var S=[],k=[],A=1,C=null,R=3,M=!1,N=!1,P=!1,I=!1,j=typeof setTimeout==="function"?setTimeout:null,F=typeof clearTimeout==="function"?clearTimeout:null,ye=typeof setImmediate<"u"?setImmediate:null,le=!1,Ee=-1,_=5,de=-1;if(typeof ye==="function")var W=function(){ye(t)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,st=be.port2;be.port1.onmessage=t,W=function(){st.postMessage(null)}}else W=function(){j(t,0)};VN.unstable_IdlePriority=5,VN.unstable_ImmediatePriority=1,VN.unstable_LowPriority=4,VN.unstable_NormalPriority=3,VN.unstable_Profiling=null,VN.unstable_UserBlockingPriority=2,VN.unstable_cancelCallback=function(Q){Q.callback=null},VN.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<Q?Math.floor(1000/Q):5},VN.unstable_getCurrentPriorityLevel=function(){return R},VN.unstable_next=function(Q){switch(R){case 1:case 2:case 3:var se=3;break;default:se=R}var te=R;R=se;try{return Q()}finally{R=te}},VN.unstable_requestPaint=function(){I=!0},VN.unstable_runWithPriority=function(Q,se){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var te=R;R=Q;try{return se()}finally{R=te}},VN.unstable_scheduleCallback=function(Q,se,te){var J=VN.unstable_now();switch(typeof te==="object"&&te!==null?(te=te.delay,te=typeof te==="number"&&0<te?J+te:J):te=J,Q){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5000}return ge=te+ge,Q={id:A++,callback:se,priorityLevel:Q,startTime:te,expirationTime:ge,sortIndex:-1},te>J?(Q.sortIndex=te,i(k,Q),l(S)===null&&Q===l(k)&&(P?(F(Ee),Ee=-1):P=!0,p(f,te-J))):(Q.sortIndex=ge,i(S,Q),N||M||(N=!0,le||(le=!0,W()))),Q},VN.unstable_shouldYield=h,VN.unstable_wrapCallback=function(Q){var se=R;return function(){var te=R;R=se;try{return Q.apply(this,arguments)}finally{R=te}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var SE=Ev(function(jN){var We=re(vE()),Pu=re(Wt()),Dv=re(PN());(function(){function t(e,n){for(e=e.memoizedState;e!==null&&0<n;)e=e.next,n--;return e}function i(e,n,o,r){if(o>=n.length)return r;var c=n[o],d=rn(e)?e.slice():Ue({},e);return d[c]=i(e[c],n,o+1,r),d}function l(e,n,o){if(n.length!==o.length)console.warn("copyWithRename() expects paths of the same length");else{for(var r=0;r<o.length-1;r++)if(n[r]!==o[r]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return s(e,n,o,0)}}function s(e,n,o,r){var c=n[r],d=rn(e)?e.slice():Ue({},e);return r+1===n.length?(d[o[r]]=d[c],rn(d)?d.splice(c,1):delete d[c]):d[c]=s(e[c],n,o,r+1),d}function a(e,n,o){var r=n[o],c=rn(e)?e.slice():Ue({},e);if(o+1===n.length)return rn(c)?c.splice(r,1):delete c[r],c;return c[r]=a(e[r],n,o+1),c}function u(){return!1}function f(){return null}function h(){console.error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks")}function p(){console.error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")}function g(){}function y(){}function v(e){var n=[];return e.forEach(function(o){n.push(o)}),n.sort().join(", ")}function S(e,n,o,r){return new OB(e,n,o,r)}function k(e,n){e.context===Is&&(Y0(e.current,2,n,e,null,null),Za())}function A(e,n){if(Xi!==null){var o=n.staleFamilies;n=n.updatedFamilies,of(),Aw(e.current,n,o),Za()}}function C(e){Xi=e}function R(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function M(e){var n=e,o=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(o=n.return),e=n.return;while(e)}return n.tag===3?o:null}function N(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function P(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function I(e){if(M(e)!==e)throw Error("Unable to find node on an unmounted component.")}function j(e){var n=e.alternate;if(!n){if(n=M(e),n===null)throw Error("Unable to find node on an unmounted component.");return n!==e?null:e}for(var o=e,r=n;;){var c=o.return;if(c===null)break;var d=c.alternate;if(d===null){if(r=c.return,r!==null){o=r;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===o)return I(c),e;if(d===r)return I(c),n;d=d.sibling}throw Error("Unable to find node on an unmounted component.")}if(o.return!==r.return)o=c,r=d;else{for(var m=!1,b=c.child;b;){if(b===o){m=!0,o=c,r=d;break}if(b===r){m=!0,r=c,o=d;break}b=b.sibling}if(!m){for(b=d.child;b;){if(b===o){m=!0,o=d,r=c;break}if(b===r){m=!0,r=d,o=c;break}b=b.sibling}if(!m)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(o.alternate!==r)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(o.tag!==3)throw Error("Unable to find node on an unmounted component.");return o.stateNode.current===o?e:n}function F(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=F(e),n!==null)return n;e=e.sibling}return null}function ye(e){if(e===null||typeof e!=="object")return null;return e=LC&&e[LC]||e["@@iterator"],typeof e==="function"?e:null}function le(e){if(e==null)return null;if(typeof e==="function")return e.$$typeof===Kz?null:e.displayName||e.name||null;if(typeof e==="string")return e;switch(e){case su:return"Fragment";case Z0:return"Profiler";case dp:return"StrictMode";case tb:return"Suspense";case nb:return"SuspenseList";case ib:return"Activity"}if(typeof e==="object")switch(typeof e.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case lu:return"Portal";case fl:return e.displayName||"Context";case eb:return(e._context.displayName||"Context")+".Consumer";case pf:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case hp:return n=e.displayName||null,n!==null?n:le(e.type)||"Memo";case Mi:n=e._payload,e=e._init;try{return le(e(n))}catch(o){}}return null}function Ee(e){return typeof e.tag==="number"?_(e):typeof e.name==="string"?e.name:null}function _(e){var n=e.type;switch(e.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(n._context.displayName||"Context")+".Consumer";case 10:return n.displayName||"Context";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return le(n);case 8:return n===dp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 14:case 15:if(typeof n==="function")return n.displayName||n.name||null;if(typeof n==="string")return n;break;case 29:if(n=e._debugInfo,n!=null){for(var o=n.length-1;0<=o;o--)if(typeof n[o].name==="string")return n[o].name}if(e.return!==null)return _(e.return)}return null}function de(e){return{current:e}}function W(e,n){0>Ul?console.error("Unexpected pop."):(n!==lb[Ul]&&console.error("Unexpected Fiber popped."),e.current=ob[Ul],ob[Ul]=null,lb[Ul]=null,Ul--)}function be(e,n,o){Ul++,ob[Ul]=e.current,lb[Ul]=o,e.current=n}function st(e){return e===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),e}function Q(e,n){be(Bs,n,e),be(mf,e,e),be(Ls,null,e);var o=n.nodeType;switch(o){case 9:case 11:o=o===9?"#document":"#fragment",n=(n=n.documentElement)?(n=n.namespaceURI)?nC(n):Kl:Kl;break;default:if(o=n.tagName,n=n.namespaceURI)n=nC(n),n=iC(n,o);else switch(o){case"svg":n=qu;break;case"math":n=fm;break;default:n=Kl}}o=o.toLowerCase(),o=F1(null,o),o={context:n,ancestorInfo:o},W(Ls,e),be(Ls,o,e)}function se(e){W(Ls,e),W(mf,e),W(Bs,e)}function te(){return st(Ls.current)}function J(e){e.memoizedState!==null&&be(pp,e,e);var n=st(Ls.current),o=e.type,r=iC(n.context,o);o=F1(n.ancestorInfo,o),r={context:r,ancestorInfo:o},n!==r&&(be(mf,e,e),be(Ls,r,e))}function ge(e){mf.current===e&&(W(Ls,e),W(mf,e)),pp.current===e&&(W(pp,e),sd._currentValue=pa)}function Ke(){}function Ie(){if(gf===0){BC=console.log,zC=console.info,NC=console.warn,HC=console.error,UC=console.group,_C=console.groupCollapsed,IC=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ke,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}gf++}function gt(){if(gf--,gf===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Ue({},e,{value:BC}),info:Ue({},e,{value:zC}),warn:Ue({},e,{value:NC}),error:Ue({},e,{value:HC}),group:Ue({},e,{value:UC}),groupCollapsed:Ue({},e,{value:_C}),groupEnd:Ue({},e,{value:IC})})}0>gf&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function et(e){var n=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,e=e.stack,Error.prepareStackTrace=n,e.startsWith(`Error: react-stack-top-frame
|
|
1
|
+
import{a as dL,b as hL,e as uL,f as cL}from"./studio-chunks/main-k6q9va58.js";import{$ as sB,A as tL,Aa as pL,B as Vi,Ba as ei,C as $i,Ca as us,D as LE,Da as ig,E as xm,Ea as Ca,F as nL,Fa as Zn,G as cn,Ga as hg,H as kL,Ha as zd,I as CL,Ia as og,J as AL,Ja as WR,K as U1,Ka as XR,L as TL,La as Nd,M as EL,Ma as vR,N as _g,Na as SR,O as Ig,Oa as K,P as xc,Pa as FO,Q as I1,Qa as m1,R as jg,Ra as LO,S as qg,Sa as _O,T as H1,Ta as yg,U as FL,V as KL,W as DL,X as M1,Y as JL,Z as PL,_ as jL,aa as Da,ba as Zd,ca as L1,da as zg,ea as _n,fa as LM,g as eB,ga as lt,h as km,ha as Tg,i as nB,ia as RL,j as Ag,ja as OL,k as qi,ka as ML,l as Ug,la as iL,m as WL,ma as Jd,n as iB,na as Vg,o as XL,oa as qM,p as Gg,pa as Eg,q as Xt,qa as wc,r as ke,ra as si,s as Sm,sa as $o,t as wr,ta as oL,u as OE,ua as Lg,v as ot,va as lL,w as lo,wa as KM,x as $g,xa as JM,y as Gu,ya as Bg,z as eL,za as GL}from"./studio-chunks/main-rhzszne9.js";import"./studio-chunks/main-a53sa3y9.js";import{$a as q,Ab as Og,Bb as Mg,Gb as C1,Ib as Mv,Jb as ni,Kb as Un,Mb as cd,Nb as Pg,Qb as ud,Rb as bg,Sb as Rv,Tb as HM,ab as An,bb as fe,bc as Ii,cb as Be,fb as XM,fc as Bo,gb as Se,gc as oB,hb as Ta,hc as lB,ib as es,ic as gi,jb as Cm,jc as rr,kc as Dn,lb as GM,lc as ME,mc as ar,pb as QM,pc as li,qb as YM,qc as Qu,rb as fn,rc as Ma,sb as rL,sc as NL,tb as yM,tc as oi,ub as bM,uc as wm,vb as vM,vc as Si,xb as aL,yb as Dg,zb as Rg}from"./studio-chunks/main-e4qk2bwv.js";import{Bc as YL,Cc as Wt,Ec as PN,wc as re,yc as Ev}from"./studio-chunks/main-hft323ae.js";var vE=Ev(function(VN){(function(){function t(){if(I=!1,le){var Q=VN.unstable_now();de=Q;var se=!0;try{e:{N=!1,P&&(P=!1,F(Ee),Ee=-1),M=!0;var te=R;try{t:{u(Q);for(C=l(S);C!==null&&!(C.expirationTime>Q&&h());){var J=C.callback;if(typeof J==="function"){C.callback=null,R=C.priorityLevel;var ge=J(C.expirationTime<=Q);if(Q=VN.unstable_now(),typeof ge==="function"){C.callback=ge,u(Q),se=!0;break t}C===l(S)&&s(S),u(Q)}else s(S);C=l(S)}if(C!==null)se=!0;else{var Ke=l(k);Ke!==null&&p(f,Ke.startTime-Q),se=!1}}break e}finally{C=null,R=te,M=!1}se=void 0}}finally{se?W():le=!1}}}function i(Q,se){var te=Q.length;Q.push(se);e:for(;0<te;){var J=te-1>>>1,ge=Q[J];if(0<a(ge,se))Q[J]=se,Q[te]=ge,te=J;else break e}}function l(Q){return Q.length===0?null:Q[0]}function s(Q){if(Q.length===0)return null;var se=Q[0],te=Q.pop();if(te!==se){Q[0]=te;e:for(var J=0,ge=Q.length,Ke=ge>>>1;J<Ke;){var Ie=2*(J+1)-1,gt=Q[Ie],et=Ie+1,Ne=Q[et];if(0>a(gt,te))et<ge&&0>a(Ne,gt)?(Q[J]=Ne,Q[et]=te,J=et):(Q[J]=gt,Q[Ie]=te,J=Ie);else if(et<ge&&0>a(Ne,te))Q[J]=Ne,Q[et]=te,J=et;else break e}}return se}function a(Q,se){var te=Q.sortIndex-se.sortIndex;return te!==0?te:Q.id-se.id}function u(Q){for(var se=l(k);se!==null;){if(se.callback===null)s(k);else if(se.startTime<=Q)s(k),se.sortIndex=se.expirationTime,i(S,se);else break;se=l(k)}}function f(Q){if(P=!1,u(Q),!N)if(l(S)!==null)N=!0,le||(le=!0,W());else{var se=l(k);se!==null&&p(f,se.startTime-Q)}}function h(){return I?!0:VN.unstable_now()-de<_?!1:!0}function p(Q,se){Ee=j(function(){Q(VN.unstable_now())},se)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),VN.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var g=performance;VN.unstable_now=function(){return g.now()}}else{var y=Date,v=y.now();VN.unstable_now=function(){return y.now()-v}}var S=[],k=[],A=1,C=null,R=3,M=!1,N=!1,P=!1,I=!1,j=typeof setTimeout==="function"?setTimeout:null,F=typeof clearTimeout==="function"?clearTimeout:null,ye=typeof setImmediate<"u"?setImmediate:null,le=!1,Ee=-1,_=5,de=-1;if(typeof ye==="function")var W=function(){ye(t)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,st=be.port2;be.port1.onmessage=t,W=function(){st.postMessage(null)}}else W=function(){j(t,0)};VN.unstable_IdlePriority=5,VN.unstable_ImmediatePriority=1,VN.unstable_LowPriority=4,VN.unstable_NormalPriority=3,VN.unstable_Profiling=null,VN.unstable_UserBlockingPriority=2,VN.unstable_cancelCallback=function(Q){Q.callback=null},VN.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<Q?Math.floor(1000/Q):5},VN.unstable_getCurrentPriorityLevel=function(){return R},VN.unstable_next=function(Q){switch(R){case 1:case 2:case 3:var se=3;break;default:se=R}var te=R;R=se;try{return Q()}finally{R=te}},VN.unstable_requestPaint=function(){I=!0},VN.unstable_runWithPriority=function(Q,se){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var te=R;R=Q;try{return se()}finally{R=te}},VN.unstable_scheduleCallback=function(Q,se,te){var J=VN.unstable_now();switch(typeof te==="object"&&te!==null?(te=te.delay,te=typeof te==="number"&&0<te?J+te:J):te=J,Q){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5000}return ge=te+ge,Q={id:A++,callback:se,priorityLevel:Q,startTime:te,expirationTime:ge,sortIndex:-1},te>J?(Q.sortIndex=te,i(k,Q),l(S)===null&&Q===l(k)&&(P?(F(Ee),Ee=-1):P=!0,p(f,te-J))):(Q.sortIndex=ge,i(S,Q),N||M||(N=!0,le||(le=!0,W()))),Q},VN.unstable_shouldYield=h,VN.unstable_wrapCallback=function(Q){var se=R;return function(){var te=R;R=se;try{return Q.apply(this,arguments)}finally{R=te}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var SE=Ev(function(jN){var We=re(vE()),Pu=re(Wt()),Dv=re(PN());(function(){function t(e,n){for(e=e.memoizedState;e!==null&&0<n;)e=e.next,n--;return e}function i(e,n,o,r){if(o>=n.length)return r;var c=n[o],d=rn(e)?e.slice():Ue({},e);return d[c]=i(e[c],n,o+1,r),d}function l(e,n,o){if(n.length!==o.length)console.warn("copyWithRename() expects paths of the same length");else{for(var r=0;r<o.length-1;r++)if(n[r]!==o[r]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return s(e,n,o,0)}}function s(e,n,o,r){var c=n[r],d=rn(e)?e.slice():Ue({},e);return r+1===n.length?(d[o[r]]=d[c],rn(d)?d.splice(c,1):delete d[c]):d[c]=s(e[c],n,o,r+1),d}function a(e,n,o){var r=n[o],c=rn(e)?e.slice():Ue({},e);if(o+1===n.length)return rn(c)?c.splice(r,1):delete c[r],c;return c[r]=a(e[r],n,o+1),c}function u(){return!1}function f(){return null}function h(){console.error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks")}function p(){console.error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")}function g(){}function y(){}function v(e){var n=[];return e.forEach(function(o){n.push(o)}),n.sort().join(", ")}function S(e,n,o,r){return new OB(e,n,o,r)}function k(e,n){e.context===Is&&(Y0(e.current,2,n,e,null,null),Za())}function A(e,n){if(Xi!==null){var o=n.staleFamilies;n=n.updatedFamilies,of(),Aw(e.current,n,o),Za()}}function C(e){Xi=e}function R(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function M(e){var n=e,o=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(o=n.return),e=n.return;while(e)}return n.tag===3?o:null}function N(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function P(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function I(e){if(M(e)!==e)throw Error("Unable to find node on an unmounted component.")}function j(e){var n=e.alternate;if(!n){if(n=M(e),n===null)throw Error("Unable to find node on an unmounted component.");return n!==e?null:e}for(var o=e,r=n;;){var c=o.return;if(c===null)break;var d=c.alternate;if(d===null){if(r=c.return,r!==null){o=r;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===o)return I(c),e;if(d===r)return I(c),n;d=d.sibling}throw Error("Unable to find node on an unmounted component.")}if(o.return!==r.return)o=c,r=d;else{for(var m=!1,b=c.child;b;){if(b===o){m=!0,o=c,r=d;break}if(b===r){m=!0,r=c,o=d;break}b=b.sibling}if(!m){for(b=d.child;b;){if(b===o){m=!0,o=d,r=c;break}if(b===r){m=!0,r=d,o=c;break}b=b.sibling}if(!m)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(o.alternate!==r)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(o.tag!==3)throw Error("Unable to find node on an unmounted component.");return o.stateNode.current===o?e:n}function F(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=F(e),n!==null)return n;e=e.sibling}return null}function ye(e){if(e===null||typeof e!=="object")return null;return e=LC&&e[LC]||e["@@iterator"],typeof e==="function"?e:null}function le(e){if(e==null)return null;if(typeof e==="function")return e.$$typeof===Kz?null:e.displayName||e.name||null;if(typeof e==="string")return e;switch(e){case su:return"Fragment";case Z0:return"Profiler";case dp:return"StrictMode";case tb:return"Suspense";case nb:return"SuspenseList";case ib:return"Activity"}if(typeof e==="object")switch(typeof e.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case lu:return"Portal";case fl:return e.displayName||"Context";case eb:return(e._context.displayName||"Context")+".Consumer";case pf:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case hp:return n=e.displayName||null,n!==null?n:le(e.type)||"Memo";case Mi:n=e._payload,e=e._init;try{return le(e(n))}catch(o){}}return null}function Ee(e){return typeof e.tag==="number"?_(e):typeof e.name==="string"?e.name:null}function _(e){var n=e.type;switch(e.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(n._context.displayName||"Context")+".Consumer";case 10:return n.displayName||"Context";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return le(n);case 8:return n===dp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 14:case 15:if(typeof n==="function")return n.displayName||n.name||null;if(typeof n==="string")return n;break;case 29:if(n=e._debugInfo,n!=null){for(var o=n.length-1;0<=o;o--)if(typeof n[o].name==="string")return n[o].name}if(e.return!==null)return _(e.return)}return null}function de(e){return{current:e}}function W(e,n){0>Ul?console.error("Unexpected pop."):(n!==lb[Ul]&&console.error("Unexpected Fiber popped."),e.current=ob[Ul],ob[Ul]=null,lb[Ul]=null,Ul--)}function be(e,n,o){Ul++,ob[Ul]=e.current,lb[Ul]=o,e.current=n}function st(e){return e===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),e}function Q(e,n){be(Bs,n,e),be(mf,e,e),be(Ls,null,e);var o=n.nodeType;switch(o){case 9:case 11:o=o===9?"#document":"#fragment",n=(n=n.documentElement)?(n=n.namespaceURI)?nC(n):Kl:Kl;break;default:if(o=n.tagName,n=n.namespaceURI)n=nC(n),n=iC(n,o);else switch(o){case"svg":n=qu;break;case"math":n=fm;break;default:n=Kl}}o=o.toLowerCase(),o=F1(null,o),o={context:n,ancestorInfo:o},W(Ls,e),be(Ls,o,e)}function se(e){W(Ls,e),W(mf,e),W(Bs,e)}function te(){return st(Ls.current)}function J(e){e.memoizedState!==null&&be(pp,e,e);var n=st(Ls.current),o=e.type,r=iC(n.context,o);o=F1(n.ancestorInfo,o),r={context:r,ancestorInfo:o},n!==r&&(be(mf,e,e),be(Ls,r,e))}function ge(e){mf.current===e&&(W(Ls,e),W(mf,e)),pp.current===e&&(W(pp,e),sd._currentValue=pa)}function Ke(){}function Ie(){if(gf===0){BC=console.log,zC=console.info,NC=console.warn,HC=console.error,UC=console.group,_C=console.groupCollapsed,IC=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ke,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}gf++}function gt(){if(gf--,gf===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Ue({},e,{value:BC}),info:Ue({},e,{value:zC}),warn:Ue({},e,{value:NC}),error:Ue({},e,{value:HC}),group:Ue({},e,{value:UC}),groupCollapsed:Ue({},e,{value:_C}),groupEnd:Ue({},e,{value:IC})})}0>gf&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function et(e){var n=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,e=e.stack,Error.prepareStackTrace=n,e.startsWith(`Error: react-stack-top-frame
|
|
2
2
|
`)&&(e=e.slice(29)),n=e.indexOf(`
|
|
3
3
|
`),n!==-1&&(e=e.slice(n+1)),n=e.indexOf("react_stack_bottom_frame"),n!==-1&&(n=e.lastIndexOf(`
|
|
4
4
|
`,n)),n!==-1)e=e.slice(0,n);else return"";return e}function Ne(e){if(sb===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);sb=n&&n[1]||"",qC=-1<o.stack.indexOf(`
|
|
@@ -242,6 +242,6 @@ You might need to use a local HTTP server (instead of file://): https://react.de
|
|
|
242
242
|
|
|
243
243
|
[Open the Inbox item](${i.backlink})`;return{draft:l,body:i.body?`${i.body}
|
|
244
244
|
|
|
245
|
-
${s}`:s}}function z8(){let t=window.history.state;return ud(t)?t:{}}function qL(t){let{api:i,queryClient:l,history:s,studioBasePath:a,routeTarget:u,routePathname:f,routeSearch:h,currentStudioPathname:p,createMode:g,entityType:y,collectionType:v,activeType:S,entityCollectionQuery:k,preferredMobilePane:A,dispatchEditor:C,setMobilePane:R,setBodyMode:M,setFieldAssistState:N}=t,P=S?.capabilities.canCreate===!0,I=S?.hierarchy.nested!==!1,[j,F]=wi.useState(null),[ye,le]=wi.useState(0),Ee=wi.useRef(null),_=wi.useRef(0),de=wi.useRef(y);de.current=y,wi.useEffect(()=>{if(u.kind==="grouping"){C({type:"collectionChanged"});return}if(!y||u.kind==="workspace"||u.kind==="not-found")return;let se=u.kind==="entity"&&u.entityType===y?u.id:null,te=++_.current;C({type:"collectionChanged"}),R("details"),N({kind:"idle"});let J=!0,ge=()=>J&&te===_.current;return l.fetchQuery({..._g(i,y),staleTime:0}).then(async(Ke)=>{if(!J||te!==_.current)return;let Ie=mL(Ke,A.current);if(R(Ie),window.matchMedia("(max-width: 640px)").matches&&Ie!=="details")M(Ie==="write"?"source":"preview");if(g&&se===null){if(!P){F(`Creating ${y} is not allowed.`);return}let gt=_L(window.history.state,y,()=>window.history.replaceState(UL(z8()),"",window.location.href)),et=IL(Ke.fields,gt);C({type:"creationStarted",draft:et.draft,body:et.body,...Ke.isSingleton&&{singleton:!0},...gt&&{prefilled:!0},...!gt&&!Ke.isSingleton&&{prefix:I?wc(h).prefix:null}});return}if(se!==null)return l.fetchQuery({...xc(i,y,se),staleTime:0}).then((gt)=>{if(!J||te!==_.current)return;let et=vc(gt),Ne=Ee.current,pn=Ma(a,y,se),ri=Ne?.pathname===pn?Ne.save:{kind:"idle"};if(Ne?.pathname===pn)Ee.current=null;C({type:"documentOpened",document:et,save:ri})});if(Ke.isSingleton){let gt=await l.ensureQueryData(Ig(i,y,wc("?scope=collection")));if(!ge())return;let et=gt.entities[0];if(et)return l.fetchQuery({...xc(i,y,et.id),staleTime:0}).then((Ne)=>{if(!J||te!==_.current)return;let pn=vc(Ne);C({type:"documentOpened",document:pn})});C({type:"creationStarted",singleton:!0,draft:$g(Ke.fields)})}return}).catch((Ke)=>{if(J&&te===_.current)F(kr(Ke))}),()=>{J=!1}},[g,p,y,ye,l,f,h,u,P,I]);let W=wi.useCallback((se,te={kind:"idle"},J=y)=>{if(!J||!y)return;let ge=Ma(a,J,se);if(!(J===y&&u.kind==="entity"&&u.entityType===y&&u.id===se)){Ee.current={pathname:ge,save:te};let et=`${li(a,v??y)}${si(k)}`,Ne=g&&te.kind==="saved",pn=s.location.state,ri=!Ne||ud(pn)&&pn.studioCollectionPath===et;s[Ne?"replace":"push"](`${ge}${si(k)}`,ri?{studioCollectionPath:et}:void 0,te.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let Ie=++_.current,gt=y;l.fetchQuery({...xc(i,y,se),staleTime:0}).then((et)=>{if(Ie!==_.current||de.current!==gt)return;let Ne=vc(et);C({type:"documentOpened",document:Ne,save:te}),N({kind:"idle"})}).catch((et)=>{if(Ie===_.current)F(kr(et))})},[a,p,u,g,y,v,k,l,s]),be=wi.useCallback(()=>{le((se)=>se+1)},[]),st=wi.useCallback(()=>{_.current+=1},[]),Q=wi.useCallback(()=>_.current,[]);return{openEntity:W,loadError:j,setLoadError:F,retryOpen:be,supersedeOpen:st,currentOpenRequest:Q,pendingOpenState:Ee}}var Go=re(Wt(),1);function VL(t){let{api:i,queryClient:l,history:s,studioBasePath:a,entityType:u,collectionType:f,entityCollectionQuery:h,groupReturnPath:p,activeCapabilities:g,schema:y,editor:v,dispatchEditor:S,createPath:k,syncStatus:A,deleting:C,saveEntityMutation:R,deleteEntityMutation:M,openEntity:N,currentOpenRequest:P,setMobilePane:I,setFieldAssistState:j}=t,{mode:F,draft:ye,body:le,save:Ee}=v,[_,de]=Go.useState(null),W=Go.useRef(0);Go.useEffect(()=>{if(Ee.kind!=="saved"||!A?.git)return;if(Tm({save:Ee,git:A.git,baselineCommit:_}).committed==="done")return;if(Date.now()-W.current>20000)return;let J=window.setTimeout(()=>{l.invalidateQueries({queryKey:cn.syncStatus()})},900);return()=>window.clearTimeout(J)},[Ee,A,_,l]);let be=Go.useCallback((te,J)=>{if(!u||F.kind!=="edit"||g?.canUpdate!==!0||g.canAssist!==!0||le.trim().length===0)return;j({kind:"loading",field:J,variant:te}),i.requestFieldAssist({variant:te,entityType:u,id:F.entity.id,targetField:J}).then((ge)=>{let Ke=ge.variant==="summarize"?ge.suggestion:ge.suggestions;j({kind:"suggested",field:ge.targetField,variant:ge.variant,suggestion:Ke})}).catch((ge)=>{j({kind:"error",field:J,message:$i(ge)})})},[g,le,u,F]),st=Go.useCallback((te,J)=>{S({type:"fieldAssistApplied",field:te,suggestion:J}),j({kind:"idle"})},[]),Q=Go.useCallback(()=>{if(!u||F.kind==="browse"||!y||u===ds&&!y.groupingDefinitions||Xd(v)||(F.kind==="create"&&y.isSingleton||u===ds)&&!Sg(v))return;if(F.kind==="create"?g?.canCreate!==!0:g?.canUpdate!==!0)return;W.current=Date.now(),de(A?.git?.lastCommit??null),S({type:"saveStarted"});let te=y.hasBody?{body:le}:{},J=Vg(y.fields,ye),ge=F.kind==="create"?{kind:"create",entityType:u,...k&&{idPath:k},frontmatter:J,...te}:{kind:"update",entityType:u,id:F.entity.id,frontmatter:J,baseContentHash:F.entity.contentHash,...te},Ke=P();R.mutate(ge,{onSuccess:async(Ie)=>{if(await Promise.all([l.invalidateQueries({queryKey:["studio","groupings"]}),l.invalidateQueries({queryKey:cn.entities(u)}),...f&&f!==u?[l.invalidateQueries({queryKey:cn.entities(f)})]:[],l.invalidateQueries({queryKey:cn.syncStatus()}),...u===ds?[l.invalidateQueries({queryKey:["studio","schema"]})]:[],...F.kind==="create"||u===ds?[l.invalidateQueries({queryKey:cn.navigation()})]:[]]),Ke!==P())return;let gt="skipped"in Ie&&Ie.skipped===!0;N(Ie.entityId,{kind:"saved",noop:gt})},onError:(Ie)=>{if(Ke!==P())return;if(Ie instanceof Bo&&(Ie.status===400||Ie.status===409))Promise.all([l.invalidateQueries({queryKey:cn.navigation()}),l.invalidateQueries({queryKey:["studio","schema"]}),l.invalidateQueries({queryKey:["studio","groupings"]})]);if(Ie instanceof Bo&&Ie.issues.length>0)I("details");S({type:"saveFailed",save:Ie instanceof Bo&&Ie.status===409&&F.kind==="edit"?{kind:"conflict",message:$i(Ie),...Ie.conflictId!==void 0&&{conflictId:Ie.conflictId}}:{kind:"error",message:Ie instanceof Bo&&Ie.issues.length>0?Ie.message||"Validation failed":$i(Ie),...Ie instanceof Bo?{issues:Ie.issues}:{}}})}})},[g,u,f,F,k,v,ye,le,y,N,A,l,R]),se=Go.useCallback(()=>{if(!u||F.kind!=="edit"||C||g?.canDelete!==!0)return;let{id:te}=F.entity;M.mutate({entityType:u,id:te},{onSuccess:async()=>{S({type:"deleteSucceeded"}),l.removeQueries({queryKey:cn.entity(u,te)}),await Promise.all([l.invalidateQueries({queryKey:["studio","groupings"]}),l.invalidateQueries({queryKey:cn.entityLists()}),l.invalidateQueries({queryKey:cn.syncStatus()}),l.invalidateQueries({queryKey:cn.navigation()})]),s.replace(p??`${li(a,f??u)}${si(h)}`,void 0,{ignoreBlocker:!0})},onError:(J)=>{S({type:"deleteFailed",message:$i(J)})}})},[g,a,u,f,F,C,l,M,s,p,h]);return{runFieldAssist:be,applyFieldAssist:st,save:Q,remove:se,baselineCommit:_}}var eh=re(Wt(),1);function $L(t){let{history:i,queryClient:l,studioBasePath:s,routeTarget:a,routePathname:u,routeSearch:f,entityType:h,activeWorkspaceId:p,types:g,groupings:y,workspaces:v,activeType:S,activeWorkspace:k,entityCollectionQuery:A,entityListOffset:C,entityListTotal:R,declarativeWorkspaceData:M,initialUrlWorkspaceQuery:N,setActiveWorkspaceId:P,setEntityType:I,setLoadError:j,supersedeOpen:F}=t;eh.useEffect(()=>{if(!h||!S||p||a.kind!=="collection"&&a.kind!=="entity"||a.entityType!==h)return;if(R===void 0)return;let ye=Math.floor(Math.max(0,R-1)/A.limit)*A.limit;if(C>ye)i.replace(`${u}${si({...A,offset:ye})}`,i.location.state)},[S,p,C,R,A,h,u,a,i]),eh.useEffect(()=>{if(!p||!M?.refreshAfterMs)return;let ye=window.setTimeout(()=>{l.invalidateQueries({queryKey:cn.workspace(p)})},M.refreshAfterMs);return()=>window.clearTimeout(ye)},[p,M,l]),eh.useEffect(()=>{if(k?.urlQuery!==!0||a.kind!=="workspace"||a.workspaceId!==k.id)return;let ye=oi(s,k.id);if(Oa(ye,N)!==`${ye}${f}`)Hg(i,ye,N,window.location.pathname)},[k,s,N,f,a,i]),eh.useEffect(()=>{if(!g)return;if(j(null),a.kind==="not-found"){F(),j(`Studio route not found: ${a.pathname}`);return}if(a.kind==="grouping"){if(F(),P(null),I(null),!y.some((_)=>_.key===a.grouping))j("Collection unavailable for this account.");return}if(a.kind==="workspace"){let _=v.find((de)=>de.id===a.workspaceId);if(!_){let de=PL(s,a.workspaceId,f,v);if(de){i.replace(de);return}F(),j(`Workspace unavailable for this account: ${a.workspaceId}`);return}P(_.id),I(null);return}let ye=a.kind==="collection"||a.kind==="entity"?a.entityType:void 0,le=g.find((_)=>!_.isSingleton)??g[0];if(a.kind==="home"){let _=jL(s,g,v);if(_!==s){i.replace(_);return}}let Ee=ye??le?.entityType??null;if(ye!==void 0&&!g.some((_)=>_.entityType===ye)){F(),j(`Collection unavailable for this account: ${ye}`);return}P(null),I(Ee)},[f,a,i,s,g,y,v])}var _1=re(Wt(),1);function QL(t){let{queryClient:i,workspaces:l,activeWorkspaceId:s,entityType:a,mode:u,declarativeWorkspaceActionMutation:f,openEntity:h}=t,p=_1.useCallback(async(y)=>{let v=GL(l,y.entityType);if(!v)throw Error("Publishing is unavailable");let S={entityType:y.entityType,entityId:y.entityId,...y.type==="reorder"?{position:y.position}:{}};if(y.type==="publish"&&!y.confirmation){let C=await f.mutateAsync({workspaceId:v.id,action:{actionId:"publish",label:"Publish now",input:S,invocation:{mode:"prepare"}}});if(typeof C!=="object"||C===null||!("kind"in C)||C.kind!=="prepared-confirmation"||!("token"in C)||typeof C.token!=="string"||!("summary"in C)||typeof C.summary!=="string"||!("expiresAt"in C)||typeof C.expiresAt!=="string")throw Error("Publishing confirmation is unavailable");return{needsConfirmation:!0,summary:C.summary,args:{confirmed:!0,confirmationToken:C.token,contentHash:C.token,expiresAt:C.expiresAt}}}let k=await f.mutateAsync({workspaceId:v.id,action:{actionId:y.type,label:y.type,input:S,...y.type==="publish"&&y.confirmation?{invocation:{mode:"execute",token:y.confirmation.confirmationToken}}:{}}});if(typeof k!=="object"||k===null)throw Error("Publishing returned an invalid result");let A="success"in k&&k.success===!1?{success:!1,error:"error"in k&&typeof k.error==="string"?k.error:"Publishing failed",..."code"in k&&typeof k.code==="string"?{code:k.code}:{}}:{success:!0};if(!A1(A)&&!T1(A)){if(await U1(i,v.id),u.kind==="edit"&&a===y.entityType&&u.entity.id===y.entityId)h(y.entityId)}return A},[a,u,h,i,f,l]),g=_1.useCallback(async(y)=>{if(!s)throw Error("Declarative workspace is unavailable");try{let v=await f.mutateAsync({workspaceId:s,action:y});return await U1(i,s),v}finally{f.reset()}},[s,f,i]);return{performPublishingAction:p,performDeclarativeAction:g}}var Jt=re(Be(),1),N8=ct.lazy(()=>zv(async()=>({default:(await import("./studio-chunks/account-view-pgy2e6j6.js")).AccountApp}))),H8=ct.lazy(()=>zv(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-x5rxvgae.js")).StudioChatWorkspace}),()=>Jt.jsxDEV(Ra,{message:"Chat could not open.",children:Jt.jsxDEV(Bv,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)));function U8(t){let i=new URLSearchParams(t).get("session")?.trim();return i&&i.length<=256?i:null}var _8=["public","trusted","admin"];function I8(t,i,l){let s=document.querySelector("[data-studio-root]"),a=s?.getAttribute("data-studio-principal-name")??"Your account",u=s?.getAttribute("data-studio-principal-role"),f=_8.find((y)=>y===u)??"public",h=s?.getAttribute("data-studio-mcp-url")??void 0,p=s?.getAttribute("data-studio-dav-url")??void 0,g=new URLSearchParams(l).get("section")??void 0;return{displayName:a,role:f,routePath:t,studioPath:i,...h?{mcpUrl:h}:{},...p?{davUrl:p}:{},...g?{initialSection:g}:{}}}function ZL(){let t=WL(),i=Gg({select:(Je)=>Je.location.pathname}),l=Gg({select:(Je)=>Je.location.searchStr}),s=Gg({select:(Je)=>Je.location.state}),a=JL(),u=ct.useMemo(()=>i===I1?{kind:"workspace",workspaceId:jg}:wm(i,a),[i,a]),f=ct.useMemo(()=>u.kind==="collection"&&new URLSearchParams(l).get("mode")==="create",[l,u]),h=i,[p,g]=ct.useState(null),[y,v]=ct.useState(null),[S,k]=ct.useState({}),[A,C]=ct.useReducer(CM,Wd),{mode:R}=A,M=Sg(A),[N]=ct.useState(()=>new KL),P=ct.useSyncExternalStore(N.subscribe,N.hasDrafts,N.hasDrafts),[I,j]=ct.useState({hasDraft:!1,busy:!1}),F=XL({shouldBlockFn:({next:Je})=>M||i===I1&&FL({...I,hasDraft:P},Je.pathname),enableBeforeUnload:M||P||I.busy,withResolver:!0}),[ye,le]=ct.useState({kind:"idle"}),[Ee,_]=ct.useState("preview"),de=A.mode.kind==="create";ct.useEffect(()=>{if(de)_("source")},[de]);let[W,be]=ct.useState("details"),st=ct.useRef(null),Q=ct.useCallback((Je)=>{st.current=Je,be(Je)},[]),se=km(),te=gi(),{navigationQuery:J,types:ge,groupings:Ke,activeType:Ie,collectionType:gt,activeCapabilities:et,entityCollectionQuery:Ne,entityListOffset:pn,workspaces:ri,activeWorkspace:Qo,activeAccount:Cr,activeChat:ps,initialUrlWorkspaceQuery:kc,workspaceRequestQuery:ie,workspaceQuery:On,workspaceData:La,workspaceError:Ar,agentTargets:Tr,syncStatus:ft,entityListQuery:yo,entities:Ba,entityListTotal:th,schema:rt,createPath:Wg,destinationQuery:bo,saveEntityMutation:za,deleteEntityMutation:Er,declarativeWorkspaceActionMutation:Xg,deleting:Na,declarativeWorkspaceData:Ha}=LL({api:te,entityType:y,activeWorkspaceId:p,routeSearch:l,workspaceQueries:S,editor:A}),ms=VE({entityType:y,entities:Ba}),gs=u.kind==="grouping"?Ke.find((Je)=>Je.key===u.grouping):void 0,Dr=ct.useMemo(()=>Ov(l),[l]),Ua=u.kind==="entity"?DE(s,a,Ke):null,Cc=Ua?.path,Ac=ct.useMemo(()=>y?Ke.filter((Je)=>Je.types.includes(y)):[],[Ke,y]),nh=SL(Ac),{openEntity:_a,loadError:Tc,setLoadError:Ec,retryOpen:ih,supersedeOpen:Dc,currentOpenRequest:ys,pendingOpenState:vo}=qL({api:te,queryClient:se,history:t.history,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:l,currentStudioPathname:h,createMode:f,entityType:y,collectionType:gt,activeType:Ie,entityCollectionQuery:Ne,preferredMobilePane:st,dispatchEditor:C,setMobilePane:be,setBodyMode:_,setFieldAssistState:le});$L({history:t.history,queryClient:se,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:l,entityType:y,activeWorkspaceId:p,types:ge,groupings:Ke,workspaces:ri,activeType:Ie,activeWorkspace:Qo,entityCollectionQuery:Ne,entityListOffset:pn,entityListTotal:th,declarativeWorkspaceData:Ha,initialUrlWorkspaceQuery:kc,setActiveWorkspaceId:g,setEntityType:v,setLoadError:Ec,supersedeOpen:Dc});let{openWorkspaceEntity:Rr,openWorkspaceLaunch:bs,selectEntityType:Vt,changeEntityPage:Dl,selectWorkspace:Yo,selectFolder:vs,startCreate:Rc,backToList:oh,changeWorkspaceQuery:Ia}=HL({history:t.history,studioBasePath:a,routeSearch:l,entityType:y,collectionType:gt,entityCollectionQuery:Ne,groupReturnPath:Cc,workspaces:ri,schema:rt,activeCapabilities:et,pendingOpenState:vo,setFieldAssistState:le,setWorkspaceQueries:k}),{runFieldAssist:qa,applyFieldAssist:So,save:ai,remove:lh,baselineCommit:Fg}=VL({api:te,queryClient:se,history:t.history,studioBasePath:a,entityType:y,collectionType:gt,entityCollectionQuery:Ne,groupReturnPath:Cc,activeCapabilities:et,schema:rt,editor:A,dispatchEditor:C,createPath:Wg,syncStatus:ft,deleting:Na,saveEntityMutation:za,deleteEntityMutation:Er,openEntity:_a,currentOpenRequest:ys,setMobilePane:be,setFieldAssistState:le}),{performPublishingAction:Oc,performDeclarativeAction:sh}=QL({queryClient:se,workspaces:ri,activeWorkspaceId:p,entityType:y,mode:R,declarativeWorkspaceActionMutation:Xg,openEntity:_a}),xi=Tc??(J.error?kr(J.error):yo.error?kr(yo.error):null),In=()=>{if(Ec(null),J.error)J.refetch();if(yo.error)yo.refetch();if(On.error)On.refetch();if(R.kind==="browse")ih()};if(xi&&!ge)return Jt.jsxDEV(Ra,{message:xi,error:!0,onRetry:In},void 0,!1,void 0,this);if(!ge)return Jt.jsxDEV(Ra,{message:"Loading…"},void 0,!1,void 0,this);if(Cr&&Qo){let Je=oi(a,Pg);return Jt.jsxDEV(gL,{types:ge,workspaces:ri,workspaceId:Qo.id,selectEntityType:Vt,selectWorkspace:Yo,children:Jt.jsxDEV(ct.Suspense,{fallback:Jt.jsxDEV(ke,{children:"Opening Account…"},void 0,!1,void 0,this),children:Jt.jsxDEV(N8,{bootstrap:I8(Je,a,l)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}if(ps&&Qo)return Jt.jsxDEV(Jt.Fragment,{children:[Jt.jsxDEV(ct.Suspense,{fallback:Jt.jsxDEV(Ra,{message:"Opening Chat…"},void 0,!1,void 0,this),children:Jt.jsxDEV(H8,{apiPath:Qo.chatApiPath,draftStore:N,onNavigationStateChange:j,studioBasePath:a,sessionId:U8(l),types:ge,workspaces:ri,handoff:vL(s),navigate:(Je,wo)=>{t.history.push(Je,void 0,{ignoreBlocker:wo?.preserveWork===!0})},selectEntityType:Vt,selectWorkspace:Yo},void 0,!1,void 0,this)},void 0,!1,void 0,this),F.status==="blocked"&&Jt.jsxDEV(fn,{mark:"↩",title:"Leave this conversation?",titleId:"chat-navigation-title",cancelLabel:"Stay",confirmLabel:"Leave",onCancel:()=>F.reset(),onConfirm:()=>F.proceed(),children:Jt.jsxDEV("p",{children:"Your draft stays in this tab. Leaving stops receiving the response, but does not undo completed actions or background jobs."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(p?!La&&!Ar:y&&!rt&&!xi)return Jt.jsxDEV(Ra,{message:"Loading…"},void 0,!1,void 0,this);if(!gs&&!p&&(!y||!rt&&!xi))return Jt.jsxDEV(Ra,{message:xi??"No readable collections are available for this account.",error:Boolean(xi),...xi?{onHome:()=>t.history.push(a)}:{}},void 0,!1,void 0,this);return Jt.jsxDEV(yL,{groupings:{items:Ke,active:gs?.key??Ua?.grouping??null,onSelect:(Je)=>t.history.push(Qu(a,Je))},groupReturnLabel:Ua?.label,groupingSuggestions:nh,groupingView:gs?Jt.jsxDEV(BE,{basePath:a,grouping:gs,types:ge,query:Dr,onChange:(Je,wo)=>{let Or=`${Qu(a,gs.key)}${$u(Je)}`,Mc=Je.value!==Dr.value||Je.offset!==Dr.offset;t.history[Mc&&wo?.replace!==!0?"push":"replace"](Or)},onOpen:(Je,wo)=>{let Or=Ma(a,Je,wo);vo.current={pathname:Or,save:{kind:"idle"}},t.history.push(Or,{studioGroupingPath:`${Qu(a,gs.key)}${$u(Dr)}`})}},void 0,!1,void 0,this):null,activeWorkspaceId:p,types:ge,workspaces:ri,workspaceError:Ar,readError:xi,onRetryRead:In,declarativeWorkspaceData:Ha,workspaceQuery:ie,entityType:y,entities:Ba,refineNotice:ms.notice,onRefineConfirmed:ms.confirmed,folders:yo.data?.folders??[],collectionTrail:yo.data?.trail,collectionPath:gt?li(a,gt):a,selectFolder:vs,creationDestination:{data:bo.data??null,pending:bo.isPending,error:bo.error},entityOffset:pn,entityLimit:Ne.limit,entityTotal:th??0,collectionQuery:Ne,onCollectionQueryChange:(Je)=>{if(!gt)return;t.history.push(`${li(a,gt)}${si({...Je,offset:0})}`),window.scrollTo({top:0,left:0})},entityListLoading:yo.isPending,schema:rt,editor:A,fieldAssistState:ye,bodyMode:Ee,mobilePane:W,syncStatus:ft,baselineCommit:Fg,agentTargets:Tr,deleting:Na,hasUnsavedChanges:M,navigationBlocked:F.status==="blocked",dispatchEditor:C,setFieldAssistState:le,setBodyMode:_,setMobilePane:Q,backToList:oh,selectEntityType:Vt,selectWorkspace:Yo,changeEntityPage:Dl,openWorkspaceEntity:Rr,openWorkspaceLaunch:bs,performPublishingAction:Oc,performDeclarativeAction:sh,onWorkspaceQueryChange:Ia,startCreate:Rc,openEntity:(Je,wo)=>_a(Je,void 0,wo),runFieldAssist:qa,applyFieldAssist:So,save:ai,remove:lh,onNavigationReset:()=>F.reset?.(),onNavigationProceed:()=>F.proceed?.()},void 0,!1,void 0,this)}function tB(){return new eB({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var Yg=re(Be(),1),Qg=document.querySelector("[data-studio-root]");if(Qg){let t=Qg.getAttribute("data-studio-base-path")??"/studio",i=new oB({basePath:t});Qg.textContent="";let l=tB(),s=sB(t,ZL);rB.createRoot(Qg).render(Yg.jsxDEV(nB,{client:l,children:Yg.jsxDEV(lB,{api:i,children:Yg.jsxDEV(iB,{router:s},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}
|
|
245
|
+
${s}`:s}}function z8(){let t=window.history.state;return ud(t)?t:{}}function qL(t){let{api:i,queryClient:l,history:s,studioBasePath:a,routeTarget:u,routePathname:f,routeSearch:h,currentStudioPathname:p,createMode:g,entityType:y,collectionType:v,activeType:S,entityCollectionQuery:k,preferredMobilePane:A,dispatchEditor:C,setMobilePane:R,setBodyMode:M,setFieldAssistState:N}=t,P=S?.capabilities.canCreate===!0,I=S?.hierarchy.nested!==!1,[j,F]=wi.useState(null),[ye,le]=wi.useState(0),Ee=wi.useRef(null),_=wi.useRef(0),de=wi.useRef(y);de.current=y,wi.useEffect(()=>{if(u.kind==="grouping"){C({type:"collectionChanged"});return}if(!y||u.kind==="workspace"||u.kind==="not-found")return;let se=u.kind==="entity"&&u.entityType===y?u.id:null,te=++_.current;C({type:"collectionChanged"}),R("details"),N({kind:"idle"});let J=!0,ge=()=>J&&te===_.current;return l.fetchQuery({..._g(i,y),staleTime:0}).then(async(Ke)=>{if(!J||te!==_.current)return;let Ie=mL(Ke,A.current);if(R(Ie),window.matchMedia("(max-width: 640px)").matches&&Ie!=="details")M(Ie==="write"?"source":"preview");if(g&&se===null){if(!P){F(`Creating ${y} is not allowed.`);return}let gt=_L(window.history.state,y,()=>window.history.replaceState(UL(z8()),"",window.location.href)),et=IL(Ke.fields,gt);C({type:"creationStarted",draft:et.draft,body:et.body,...Ke.isSingleton&&{singleton:!0},...gt&&{prefilled:!0},...!gt&&!Ke.isSingleton&&{prefix:I?wc(h).prefix:null}});return}if(se!==null)return l.fetchQuery({...xc(i,y,se),staleTime:0}).then((gt)=>{if(!J||te!==_.current)return;let et=vc(gt),Ne=Ee.current,pn=Ma(a,y,se),ri=Ne?.pathname===pn?Ne.save:{kind:"idle"};if(Ne?.pathname===pn)Ee.current=null;C({type:"documentOpened",document:et,save:ri})});if(Ke.isSingleton){let gt=await l.ensureQueryData(Ig(i,y,wc("?scope=collection")));if(!ge())return;let et=gt.entities[0];if(et)return l.fetchQuery({...xc(i,y,et.id),staleTime:0}).then((Ne)=>{if(!J||te!==_.current)return;let pn=vc(Ne);C({type:"documentOpened",document:pn})});C({type:"creationStarted",singleton:!0,draft:$g(Ke.fields)})}return}).catch((Ke)=>{if(J&&te===_.current)F(kr(Ke))}),()=>{J=!1}},[g,p,y,ye,l,f,h,u,P,I]);let W=wi.useCallback((se,te={kind:"idle"},J=y)=>{if(!J||!y)return;let ge=Ma(a,J,se);if(!(J===y&&u.kind==="entity"&&u.entityType===y&&u.id===se)){Ee.current={pathname:ge,save:te};let et=`${li(a,v??y)}${si(k)}`,Ne=g&&te.kind==="saved",pn=s.location.state,ri=!Ne||ud(pn)&&pn.studioCollectionPath===et;s[Ne?"replace":"push"](`${ge}${si(k)}`,ri?{studioCollectionPath:et}:void 0,te.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let Ie=++_.current,gt=y;l.fetchQuery({...xc(i,y,se),staleTime:0}).then((et)=>{if(Ie!==_.current||de.current!==gt)return;let Ne=vc(et);C({type:"documentOpened",document:Ne,save:te}),N({kind:"idle"})}).catch((et)=>{if(Ie===_.current)F(kr(et))})},[a,p,u,g,y,v,k,l,s]),be=wi.useCallback(()=>{le((se)=>se+1)},[]),st=wi.useCallback(()=>{_.current+=1},[]),Q=wi.useCallback(()=>_.current,[]);return{openEntity:W,loadError:j,setLoadError:F,retryOpen:be,supersedeOpen:st,currentOpenRequest:Q,pendingOpenState:Ee}}var Go=re(Wt(),1);function VL(t){let{api:i,queryClient:l,history:s,studioBasePath:a,entityType:u,collectionType:f,entityCollectionQuery:h,groupReturnPath:p,activeCapabilities:g,schema:y,editor:v,dispatchEditor:S,createPath:k,syncStatus:A,deleting:C,saveEntityMutation:R,deleteEntityMutation:M,openEntity:N,currentOpenRequest:P,setMobilePane:I,setFieldAssistState:j}=t,{mode:F,draft:ye,body:le,save:Ee}=v,[_,de]=Go.useState(null),W=Go.useRef(0);Go.useEffect(()=>{if(Ee.kind!=="saved"||!A?.git)return;if(Tm({save:Ee,git:A.git,baselineCommit:_}).committed==="done")return;if(Date.now()-W.current>20000)return;let J=window.setTimeout(()=>{l.invalidateQueries({queryKey:cn.syncStatus()})},900);return()=>window.clearTimeout(J)},[Ee,A,_,l]);let be=Go.useCallback((te,J)=>{if(!u||F.kind!=="edit"||g?.canUpdate!==!0||g.canAssist!==!0||le.trim().length===0)return;j({kind:"loading",field:J,variant:te}),i.requestFieldAssist({variant:te,entityType:u,id:F.entity.id,targetField:J}).then((ge)=>{let Ke=ge.variant==="summarize"?ge.suggestion:ge.suggestions;j({kind:"suggested",field:ge.targetField,variant:ge.variant,suggestion:Ke})}).catch((ge)=>{j({kind:"error",field:J,message:$i(ge)})})},[g,le,u,F]),st=Go.useCallback((te,J)=>{S({type:"fieldAssistApplied",field:te,suggestion:J}),j({kind:"idle"})},[]),Q=Go.useCallback(()=>{if(!u||F.kind==="browse"||!y||u===ds&&!y.groupingDefinitions||Xd(v)||(F.kind==="create"&&y.isSingleton||u===ds)&&!Sg(v))return;if(F.kind==="create"?g?.canCreate!==!0:g?.canUpdate!==!0)return;W.current=Date.now(),de(A?.git?.lastCommit??null),S({type:"saveStarted"});let te=y.hasBody?{body:le}:{},J=Vg(y.fields,ye),ge=F.kind==="create"?{kind:"create",entityType:u,...k&&{idPath:k},frontmatter:J,...te}:{kind:"update",entityType:u,id:F.entity.id,frontmatter:J,baseContentHash:F.entity.contentHash,...te},Ke=P();R.mutate(ge,{onSuccess:async(Ie)=>{if(await Promise.all([l.invalidateQueries({queryKey:["studio","groupings"]}),l.invalidateQueries({queryKey:cn.entities(u)}),...f&&f!==u?[l.invalidateQueries({queryKey:cn.entities(f)})]:[],l.invalidateQueries({queryKey:cn.syncStatus()}),...u===ds?[l.invalidateQueries({queryKey:["studio","schema"]})]:[],...F.kind==="create"||u===ds?[l.invalidateQueries({queryKey:cn.navigation()})]:[]]),Ke!==P())return;let gt="skipped"in Ie&&Ie.skipped===!0;N(Ie.entityId,{kind:"saved",noop:gt})},onError:(Ie)=>{if(Ke!==P())return;if(Ie instanceof Bo&&(Ie.status===400||Ie.status===409))Promise.all([l.invalidateQueries({queryKey:cn.navigation()}),l.invalidateQueries({queryKey:["studio","schema"]}),l.invalidateQueries({queryKey:["studio","groupings"]})]);if(Ie instanceof Bo&&Ie.issues.length>0)I("details");S({type:"saveFailed",save:Ie instanceof Bo&&Ie.status===409&&F.kind==="edit"?{kind:"conflict",message:$i(Ie),...Ie.conflictId!==void 0&&{conflictId:Ie.conflictId}}:{kind:"error",message:Ie instanceof Bo&&Ie.issues.length>0?Ie.message||"Validation failed":$i(Ie),...Ie instanceof Bo?{issues:Ie.issues}:{}}})}})},[g,u,f,F,k,v,ye,le,y,N,A,l,R]),se=Go.useCallback(()=>{if(!u||F.kind!=="edit"||C||g?.canDelete!==!0)return;let{id:te}=F.entity;M.mutate({entityType:u,id:te},{onSuccess:async()=>{S({type:"deleteSucceeded"}),l.removeQueries({queryKey:cn.entity(u,te)}),await Promise.all([l.invalidateQueries({queryKey:["studio","groupings"]}),l.invalidateQueries({queryKey:cn.entityLists()}),l.invalidateQueries({queryKey:cn.syncStatus()}),l.invalidateQueries({queryKey:cn.navigation()})]),s.replace(p??`${li(a,f??u)}${si(h)}`,void 0,{ignoreBlocker:!0})},onError:(J)=>{S({type:"deleteFailed",message:$i(J)})}})},[g,a,u,f,F,C,l,M,s,p,h]);return{runFieldAssist:be,applyFieldAssist:st,save:Q,remove:se,baselineCommit:_}}var eh=re(Wt(),1);function $L(t){let{history:i,queryClient:l,studioBasePath:s,routeTarget:a,routePathname:u,routeSearch:f,entityType:h,activeWorkspaceId:p,types:g,groupings:y,workspaces:v,activeType:S,activeWorkspace:k,entityCollectionQuery:A,entityListOffset:C,entityListTotal:R,declarativeWorkspaceData:M,initialUrlWorkspaceQuery:N,setActiveWorkspaceId:P,setEntityType:I,setLoadError:j,supersedeOpen:F}=t;eh.useEffect(()=>{if(!h||!S||p||a.kind!=="collection"&&a.kind!=="entity"||a.entityType!==h)return;if(R===void 0)return;let ye=Math.floor(Math.max(0,R-1)/A.limit)*A.limit;if(C>ye)i.replace(`${u}${si({...A,offset:ye})}`,i.location.state)},[S,p,C,R,A,h,u,a,i]),eh.useEffect(()=>{if(!p||!M?.refreshAfterMs)return;let ye=window.setTimeout(()=>{l.invalidateQueries({queryKey:cn.workspace(p)})},M.refreshAfterMs);return()=>window.clearTimeout(ye)},[p,M,l]),eh.useEffect(()=>{if(k?.urlQuery!==!0||a.kind!=="workspace"||a.workspaceId!==k.id)return;let ye=oi(s,k.id);if(Oa(ye,N)!==`${ye}${f}`)Hg(i,ye,N,window.location.pathname)},[k,s,N,f,a,i]),eh.useEffect(()=>{if(!g)return;if(j(null),a.kind==="not-found"){F(),j(`Studio route not found: ${a.pathname}`);return}if(a.kind==="grouping"){if(F(),P(null),I(null),!y.some((_)=>_.key===a.grouping))j("Collection unavailable for this account.");return}if(a.kind==="workspace"){let _=v.find((de)=>de.id===a.workspaceId);if(!_){let de=PL(s,a.workspaceId,f,v);if(de){i.replace(de);return}F(),j(`Workspace unavailable for this account: ${a.workspaceId}`);return}P(_.id),I(null);return}let ye=a.kind==="collection"||a.kind==="entity"?a.entityType:void 0,le=g.find((_)=>!_.isSingleton)??g[0];if(a.kind==="home"){let _=jL(s,g,v);if(_!==s){i.replace(_);return}}let Ee=ye??le?.entityType??null;if(ye!==void 0&&!g.some((_)=>_.entityType===ye)){F(),j(`Collection unavailable for this account: ${ye}`);return}P(null),I(Ee)},[f,a,i,s,g,y,v])}var _1=re(Wt(),1);function QL(t){let{queryClient:i,workspaces:l,activeWorkspaceId:s,entityType:a,mode:u,declarativeWorkspaceActionMutation:f,openEntity:h}=t,p=_1.useCallback(async(y)=>{let v=GL(l,y.entityType);if(!v)throw Error("Publishing is unavailable");let S={entityType:y.entityType,entityId:y.entityId,...y.type==="reorder"?{position:y.position}:{}};if(y.type==="publish"&&!y.confirmation){let C=await f.mutateAsync({workspaceId:v.id,action:{actionId:"publish",label:"Publish now",input:S,invocation:{mode:"prepare"}}});if(typeof C!=="object"||C===null||!("kind"in C)||C.kind!=="prepared-confirmation"||!("token"in C)||typeof C.token!=="string"||!("summary"in C)||typeof C.summary!=="string"||!("expiresAt"in C)||typeof C.expiresAt!=="string")throw Error("Publishing confirmation is unavailable");return{needsConfirmation:!0,summary:C.summary,args:{confirmed:!0,confirmationToken:C.token,contentHash:C.token,expiresAt:C.expiresAt}}}let k=await f.mutateAsync({workspaceId:v.id,action:{actionId:y.type,label:y.type,input:S,...y.type==="publish"&&y.confirmation?{invocation:{mode:"execute",token:y.confirmation.confirmationToken}}:{}}});if(typeof k!=="object"||k===null)throw Error("Publishing returned an invalid result");let A="success"in k&&k.success===!1?{success:!1,error:"error"in k&&typeof k.error==="string"?k.error:"Publishing failed",..."code"in k&&typeof k.code==="string"?{code:k.code}:{}}:{success:!0};if(!A1(A)&&!T1(A)){if(await U1(i,v.id),u.kind==="edit"&&a===y.entityType&&u.entity.id===y.entityId)h(y.entityId)}return A},[a,u,h,i,f,l]),g=_1.useCallback(async(y)=>{if(!s)throw Error("Declarative workspace is unavailable");try{let v=await f.mutateAsync({workspaceId:s,action:y});return await U1(i,s),v}finally{f.reset()}},[s,f,i]);return{performPublishingAction:p,performDeclarativeAction:g}}var Jt=re(Be(),1),N8=ct.lazy(()=>zv(async()=>({default:(await import("./studio-chunks/account-view-jwgh7b9e.js")).AccountApp}))),H8=ct.lazy(()=>zv(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-m8qqpajr.js")).StudioChatWorkspace}),()=>Jt.jsxDEV(Ra,{message:"Chat could not open.",children:Jt.jsxDEV(Bv,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)));function U8(t){let i=new URLSearchParams(t).get("session")?.trim();return i&&i.length<=256?i:null}var _8=["public","trusted","admin"];function I8(t,i,l){let s=document.querySelector("[data-studio-root]"),a=s?.getAttribute("data-studio-principal-name")??"Your account",u=s?.getAttribute("data-studio-principal-role"),f=_8.find((y)=>y===u)??"public",h=s?.getAttribute("data-studio-mcp-url")??void 0,p=s?.getAttribute("data-studio-dav-url")??void 0,g=new URLSearchParams(l).get("section")??void 0;return{displayName:a,role:f,routePath:t,studioPath:i,...h?{mcpUrl:h}:{},...p?{davUrl:p}:{},...g?{initialSection:g}:{}}}function ZL(){let t=WL(),i=Gg({select:(Je)=>Je.location.pathname}),l=Gg({select:(Je)=>Je.location.searchStr}),s=Gg({select:(Je)=>Je.location.state}),a=JL(),u=ct.useMemo(()=>i===I1?{kind:"workspace",workspaceId:jg}:wm(i,a),[i,a]),f=ct.useMemo(()=>u.kind==="collection"&&new URLSearchParams(l).get("mode")==="create",[l,u]),h=i,[p,g]=ct.useState(null),[y,v]=ct.useState(null),[S,k]=ct.useState({}),[A,C]=ct.useReducer(CM,Wd),{mode:R}=A,M=Sg(A),[N]=ct.useState(()=>new KL),P=ct.useSyncExternalStore(N.subscribe,N.hasDrafts,N.hasDrafts),[I,j]=ct.useState({hasDraft:!1,busy:!1}),F=XL({shouldBlockFn:({next:Je})=>M||i===I1&&FL({...I,hasDraft:P},Je.pathname),enableBeforeUnload:M||P||I.busy,withResolver:!0}),[ye,le]=ct.useState({kind:"idle"}),[Ee,_]=ct.useState("preview"),de=A.mode.kind==="create";ct.useEffect(()=>{if(de)_("source")},[de]);let[W,be]=ct.useState("details"),st=ct.useRef(null),Q=ct.useCallback((Je)=>{st.current=Je,be(Je)},[]),se=km(),te=gi(),{navigationQuery:J,types:ge,groupings:Ke,activeType:Ie,collectionType:gt,activeCapabilities:et,entityCollectionQuery:Ne,entityListOffset:pn,workspaces:ri,activeWorkspace:Qo,activeAccount:Cr,activeChat:ps,initialUrlWorkspaceQuery:kc,workspaceRequestQuery:ie,workspaceQuery:On,workspaceData:La,workspaceError:Ar,agentTargets:Tr,syncStatus:ft,entityListQuery:yo,entities:Ba,entityListTotal:th,schema:rt,createPath:Wg,destinationQuery:bo,saveEntityMutation:za,deleteEntityMutation:Er,declarativeWorkspaceActionMutation:Xg,deleting:Na,declarativeWorkspaceData:Ha}=LL({api:te,entityType:y,activeWorkspaceId:p,routeSearch:l,workspaceQueries:S,editor:A}),ms=VE({entityType:y,entities:Ba}),gs=u.kind==="grouping"?Ke.find((Je)=>Je.key===u.grouping):void 0,Dr=ct.useMemo(()=>Ov(l),[l]),Ua=u.kind==="entity"?DE(s,a,Ke):null,Cc=Ua?.path,Ac=ct.useMemo(()=>y?Ke.filter((Je)=>Je.types.includes(y)):[],[Ke,y]),nh=SL(Ac),{openEntity:_a,loadError:Tc,setLoadError:Ec,retryOpen:ih,supersedeOpen:Dc,currentOpenRequest:ys,pendingOpenState:vo}=qL({api:te,queryClient:se,history:t.history,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:l,currentStudioPathname:h,createMode:f,entityType:y,collectionType:gt,activeType:Ie,entityCollectionQuery:Ne,preferredMobilePane:st,dispatchEditor:C,setMobilePane:be,setBodyMode:_,setFieldAssistState:le});$L({history:t.history,queryClient:se,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:l,entityType:y,activeWorkspaceId:p,types:ge,groupings:Ke,workspaces:ri,activeType:Ie,activeWorkspace:Qo,entityCollectionQuery:Ne,entityListOffset:pn,entityListTotal:th,declarativeWorkspaceData:Ha,initialUrlWorkspaceQuery:kc,setActiveWorkspaceId:g,setEntityType:v,setLoadError:Ec,supersedeOpen:Dc});let{openWorkspaceEntity:Rr,openWorkspaceLaunch:bs,selectEntityType:Vt,changeEntityPage:Dl,selectWorkspace:Yo,selectFolder:vs,startCreate:Rc,backToList:oh,changeWorkspaceQuery:Ia}=HL({history:t.history,studioBasePath:a,routeSearch:l,entityType:y,collectionType:gt,entityCollectionQuery:Ne,groupReturnPath:Cc,workspaces:ri,schema:rt,activeCapabilities:et,pendingOpenState:vo,setFieldAssistState:le,setWorkspaceQueries:k}),{runFieldAssist:qa,applyFieldAssist:So,save:ai,remove:lh,baselineCommit:Fg}=VL({api:te,queryClient:se,history:t.history,studioBasePath:a,entityType:y,collectionType:gt,entityCollectionQuery:Ne,groupReturnPath:Cc,activeCapabilities:et,schema:rt,editor:A,dispatchEditor:C,createPath:Wg,syncStatus:ft,deleting:Na,saveEntityMutation:za,deleteEntityMutation:Er,openEntity:_a,currentOpenRequest:ys,setMobilePane:be,setFieldAssistState:le}),{performPublishingAction:Oc,performDeclarativeAction:sh}=QL({queryClient:se,workspaces:ri,activeWorkspaceId:p,entityType:y,mode:R,declarativeWorkspaceActionMutation:Xg,openEntity:_a}),xi=Tc??(J.error?kr(J.error):yo.error?kr(yo.error):null),In=()=>{if(Ec(null),J.error)J.refetch();if(yo.error)yo.refetch();if(On.error)On.refetch();if(R.kind==="browse")ih()};if(xi&&!ge)return Jt.jsxDEV(Ra,{message:xi,error:!0,onRetry:In},void 0,!1,void 0,this);if(!ge)return Jt.jsxDEV(Ra,{message:"Loading…"},void 0,!1,void 0,this);if(Cr&&Qo){let Je=oi(a,Pg);return Jt.jsxDEV(gL,{types:ge,workspaces:ri,workspaceId:Qo.id,selectEntityType:Vt,selectWorkspace:Yo,children:Jt.jsxDEV(ct.Suspense,{fallback:Jt.jsxDEV(ke,{children:"Opening Account…"},void 0,!1,void 0,this),children:Jt.jsxDEV(N8,{bootstrap:I8(Je,a,l)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}if(ps&&Qo)return Jt.jsxDEV(Jt.Fragment,{children:[Jt.jsxDEV(ct.Suspense,{fallback:Jt.jsxDEV(Ra,{message:"Opening Chat…"},void 0,!1,void 0,this),children:Jt.jsxDEV(H8,{apiPath:Qo.chatApiPath,draftStore:N,onNavigationStateChange:j,studioBasePath:a,sessionId:U8(l),types:ge,workspaces:ri,handoff:vL(s),navigate:(Je,wo)=>{t.history.push(Je,void 0,{ignoreBlocker:wo?.preserveWork===!0})},selectEntityType:Vt,selectWorkspace:Yo},void 0,!1,void 0,this)},void 0,!1,void 0,this),F.status==="blocked"&&Jt.jsxDEV(fn,{mark:"↩",title:"Leave this conversation?",titleId:"chat-navigation-title",cancelLabel:"Stay",confirmLabel:"Leave",onCancel:()=>F.reset(),onConfirm:()=>F.proceed(),children:Jt.jsxDEV("p",{children:"Your draft stays in this tab. Leaving stops receiving the response, but does not undo completed actions or background jobs."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(p?!La&&!Ar:y&&!rt&&!xi)return Jt.jsxDEV(Ra,{message:"Loading…"},void 0,!1,void 0,this);if(!gs&&!p&&(!y||!rt&&!xi))return Jt.jsxDEV(Ra,{message:xi??"No readable collections are available for this account.",error:Boolean(xi),...xi?{onHome:()=>t.history.push(a)}:{}},void 0,!1,void 0,this);return Jt.jsxDEV(yL,{groupings:{items:Ke,active:gs?.key??Ua?.grouping??null,onSelect:(Je)=>t.history.push(Qu(a,Je))},groupReturnLabel:Ua?.label,groupingSuggestions:nh,groupingView:gs?Jt.jsxDEV(BE,{basePath:a,grouping:gs,types:ge,query:Dr,onChange:(Je,wo)=>{let Or=`${Qu(a,gs.key)}${$u(Je)}`,Mc=Je.value!==Dr.value||Je.offset!==Dr.offset;t.history[Mc&&wo?.replace!==!0?"push":"replace"](Or)},onOpen:(Je,wo)=>{let Or=Ma(a,Je,wo);vo.current={pathname:Or,save:{kind:"idle"}},t.history.push(Or,{studioGroupingPath:`${Qu(a,gs.key)}${$u(Dr)}`})}},void 0,!1,void 0,this):null,activeWorkspaceId:p,types:ge,workspaces:ri,workspaceError:Ar,readError:xi,onRetryRead:In,declarativeWorkspaceData:Ha,workspaceQuery:ie,entityType:y,entities:Ba,refineNotice:ms.notice,onRefineConfirmed:ms.confirmed,folders:yo.data?.folders??[],collectionTrail:yo.data?.trail,collectionPath:gt?li(a,gt):a,selectFolder:vs,creationDestination:{data:bo.data??null,pending:bo.isPending,error:bo.error},entityOffset:pn,entityLimit:Ne.limit,entityTotal:th??0,collectionQuery:Ne,onCollectionQueryChange:(Je)=>{if(!gt)return;t.history.push(`${li(a,gt)}${si({...Je,offset:0})}`),window.scrollTo({top:0,left:0})},entityListLoading:yo.isPending,schema:rt,editor:A,fieldAssistState:ye,bodyMode:Ee,mobilePane:W,syncStatus:ft,baselineCommit:Fg,agentTargets:Tr,deleting:Na,hasUnsavedChanges:M,navigationBlocked:F.status==="blocked",dispatchEditor:C,setFieldAssistState:le,setBodyMode:_,setMobilePane:Q,backToList:oh,selectEntityType:Vt,selectWorkspace:Yo,changeEntityPage:Dl,openWorkspaceEntity:Rr,openWorkspaceLaunch:bs,performPublishingAction:Oc,performDeclarativeAction:sh,onWorkspaceQueryChange:Ia,startCreate:Rc,openEntity:(Je,wo)=>_a(Je,void 0,wo),runFieldAssist:qa,applyFieldAssist:So,save:ai,remove:lh,onNavigationReset:()=>F.reset?.(),onNavigationProceed:()=>F.proceed?.()},void 0,!1,void 0,this)}function tB(){return new eB({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var Yg=re(Be(),1),Qg=document.querySelector("[data-studio-root]");if(Qg){let t=Qg.getAttribute("data-studio-base-path")??"/studio",i=new oB({basePath:t});Qg.textContent="";let l=tB(),s=sB(t,ZL);rB.createRoot(Qg).render(Yg.jsxDEV(nB,{client:l,children:Yg.jsxDEV(lB,{api:i,children:Yg.jsxDEV(iB,{router:s},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}
|
|
246
246
|
|
|
247
247
|
//# debugId=22C9204113F5915E64756E2164756E21
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 2,
|
|
3
3
|
"entrypoints": {
|
|
4
|
-
"script": "studio-app-
|
|
4
|
+
"script": "studio-app-hcg2rfyy.js",
|
|
5
5
|
"stylesheet": "studio-app-a81a9326f0bd8bda4cbc7fae33dd907af35bbf9d6b77571a6998cbceb1ec1507.css"
|
|
6
6
|
},
|
|
7
7
|
"assets": {
|
|
8
8
|
"studio-app-a81a9326f0bd8bda4cbc7fae33dd907af35bbf9d6b77571a6998cbceb1ec1507.css": "studio-app-a81a9326f0bd8bda4cbc7fae33dd907af35bbf9d6b77571a6998cbceb1ec1507.css",
|
|
9
|
-
"studio-app-
|
|
10
|
-
"studio-app-
|
|
11
|
-
"studio-chunks/account-view-
|
|
12
|
-
"studio-chunks/account-view-
|
|
9
|
+
"studio-app-hcg2rfyy.js": "studio-app-hcg2rfyy.js",
|
|
10
|
+
"studio-app-hcg2rfyy.js.map": "studio-app-hcg2rfyy.js.map",
|
|
11
|
+
"studio-chunks/account-view-jwgh7b9e.js": "studio-chunks/account-view-jwgh7b9e.js",
|
|
12
|
+
"studio-chunks/account-view-jwgh7b9e.js.map": "studio-chunks/account-view-jwgh7b9e.js.map",
|
|
13
13
|
"studio-chunks/highlighted-body-OFNGDK62-pzxh6en9.js": "studio-chunks/highlighted-body-OFNGDK62-pzxh6en9.js",
|
|
14
14
|
"studio-chunks/highlighted-body-OFNGDK62-pzxh6en9.js.map": "studio-chunks/highlighted-body-OFNGDK62-pzxh6en9.js.map",
|
|
15
|
-
"studio-chunks/main-6a06q2ax.js": "studio-chunks/main-6a06q2ax.js",
|
|
16
|
-
"studio-chunks/main-6a06q2ax.js.map": "studio-chunks/main-6a06q2ax.js.map",
|
|
17
15
|
"studio-chunks/main-a53sa3y9.js": "studio-chunks/main-a53sa3y9.js",
|
|
18
16
|
"studio-chunks/main-a53sa3y9.js.map": "studio-chunks/main-a53sa3y9.js.map",
|
|
19
|
-
"studio-chunks/main-
|
|
20
|
-
"studio-chunks/main-
|
|
17
|
+
"studio-chunks/main-e4qk2bwv.js": "studio-chunks/main-e4qk2bwv.js",
|
|
18
|
+
"studio-chunks/main-e4qk2bwv.js.map": "studio-chunks/main-e4qk2bwv.js.map",
|
|
21
19
|
"studio-chunks/main-hft323ae.js": "studio-chunks/main-hft323ae.js",
|
|
22
20
|
"studio-chunks/main-hft323ae.js.map": "studio-chunks/main-hft323ae.js.map",
|
|
23
|
-
"studio-chunks/main-
|
|
24
|
-
"studio-chunks/main-
|
|
21
|
+
"studio-chunks/main-k6q9va58.js": "studio-chunks/main-k6q9va58.js",
|
|
22
|
+
"studio-chunks/main-k6q9va58.js.map": "studio-chunks/main-k6q9va58.js.map",
|
|
23
|
+
"studio-chunks/main-rhzszne9.js": "studio-chunks/main-rhzszne9.js",
|
|
24
|
+
"studio-chunks/main-rhzszne9.js.map": "studio-chunks/main-rhzszne9.js.map",
|
|
25
25
|
"studio-chunks/mermaid-GHXKKRXX-rgjg8868.js": "studio-chunks/mermaid-GHXKKRXX-rgjg8868.js",
|
|
26
26
|
"studio-chunks/mermaid-GHXKKRXX-rgjg8868.js.map": "studio-chunks/mermaid-GHXKKRXX-rgjg8868.js.map",
|
|
27
|
-
"studio-chunks/studio-chat-workspace-
|
|
28
|
-
"studio-chunks/studio-chat-workspace-
|
|
27
|
+
"studio-chunks/studio-chat-workspace-m8qqpajr.js": "studio-chunks/studio-chat-workspace-m8qqpajr.js",
|
|
28
|
+
"studio-chunks/studio-chat-workspace-m8qqpajr.js.map": "studio-chunks/studio-chat-workspace-m8qqpajr.js.map"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as c,b as o,c as he,d as ke}from"./main-fxrm4ssk.js";import{Hb as ve,Jb as a,Kb as J,Lb as A,Mb as De,Ob as B,Pb as F,cb as T,gb as y,hb as Y,ic as Fe,jc as ze,kb as X,lc as qe,mc as He,rb as Le,tb as je,tc as be,ub as Be,vb as I,vc as K,wb as D}from"./main-k6jsh4n9.js";import{Cc as Z,wc as v}from"./main-hft323ae.js";var te=v(Z(),1);var Ye=a.object({displayName:a.string(),role:a.enum(["admin","trusted","public"]),profileEntityId:a.string().optional(),passkeys:a.array(a.object({id:a.string(),transports:a.array(a.string()).optional(),credentialDeviceType:a.string().optional(),credentialBackedUp:a.boolean(),createdAt:a.number(),updatedAt:a.number()})),appPasswords:a.array(a.object({id:a.string(),username:a.string(),label:a.string(),access:a.enum(["read","write"]),createdAt:a.number(),expiresAt:a.number(),lastUsedAt:a.number().optional()})),connectedChannels:a.array(a.object({type:a.string(),label:a.string(),verifiedAt:a.number()})),pluginSettings:a.array(a.object({id:a.string(),title:a.string(),description:a.string().optional(),configured:a.boolean(),revision:a.number().nullable(),fields:a.array(a.object({name:a.string(),label:a.string(),control:a.enum(["text","url","number","checkbox"]),secret:a.boolean(),required:a.boolean(),value:a.union([a.string(),a.number(),a.boolean(),a.null()]).optional(),set:a.boolean().optional()}))})),sessions:a.array(a.object({id:a.string(),current:a.boolean(),createdAt:a.number(),expiresAt:a.number()}))});function Ge(e){return Ye.safeParse(e).success}var pe=a.custom(Ge,{message:"Invalid account response"}),ne=a.object({account:pe}),We=a.object({account:pe.optional(),appPassword:a.object({username:a.string(),password:a.string()}).optional(),revoked:a.object({sessions:a.number(),refreshTokens:a.number().optional()}).optional(),signedOut:a.boolean().optional()});function _e(e){return We.safeParse(e).success}var Je=a.custom(_e,{message:"Invalid account mutation response"}),Ke=a.custom((e)=>{if(!J(e))return!1;return typeof e.challenge==="string"&&J(e.rp)&&J(e.user)&&Array.isArray(e.pubKeyCredParams)},{message:"Invalid passkey registration options"});class me extends Error{status;constructor(e,t){super(e);this.name="AccountApiError",this.status=t}}async function H(e,t){let n;try{n=await e.json()}catch{n={}}if(!e.ok){let i=typeof n==="object"&&n!==null&&"error"in n&&typeof n.error==="string"?n.error:"Account request failed";throw new me(i,e.status)}return t.parse(n)}function oe(e){let t=e.replaceAll("-","+").replaceAll("_","/").padEnd(Math.ceil(e.length/4)*4,"=");return Uint8Array.from(atob(t),(n)=>n.charCodeAt(0)).buffer}function ae(e){let t=new Uint8Array(e),n="";for(let i of t)n+=String.fromCharCode(i);return btoa(n).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function Xe(e){return{challenge:oe(e.challenge),rp:e.rp,user:{...e.user,id:oe(e.user.id)},pubKeyCredParams:e.pubKeyCredParams,...e.timeout!==void 0?{timeout:e.timeout}:{},...e.excludeCredentials?{excludeCredentials:e.excludeCredentials.map((t)=>({...t,id:oe(t.id)}))}:{},...e.authenticatorSelection?{authenticatorSelection:e.authenticatorSelection}:{},...e.attestation?{attestation:e.attestation}:{},...e.extensions?{extensions:e.extensions}:{}}}var Ze=(e,t)=>fetch(e,t);class se{fetchFn;constructor(e={}){this.fetchFn=e.fetch??Ze}async fetchAccount(){return(await H(await this.fetchFn("/auth/account",{credentials:"same-origin",cache:"no-store"}),ne)).account}async mutatePluginSettings(e){return(await H(await this.fetchFn("/auth/account/plugin-settings",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),ne)).account}async mutateAccount(e){return H(await this.fetchFn("/auth/account/mutations",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Je)}async registerPasskey(){let e=await H(await this.fetchFn("/auth/account/passkeys/options",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:"{}"}),Ke),t=await navigator.credentials.create({publicKey:Xe(e)});if(!(t instanceof PublicKeyCredential))throw Error("Passkey registration was cancelled");if(!(t.response instanceof AuthenticatorAttestationResponse))throw Error("Authenticator returned an invalid passkey response");let n=t.response,i={id:t.id,rawId:ae(t.rawId),type:t.type,...t.authenticatorAttachment?{authenticatorAttachment:t.authenticatorAttachment}:{},clientExtensionResults:t.getClientExtensionResults(),response:{clientDataJSON:ae(n.clientDataJSON),attestationObject:ae(n.attestationObject),transports:typeof n.getTransports==="function"?n.getTransports():[]}};return(await H(await this.fetchFn("/auth/account/passkeys/verify",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),ne.extend({verified:a.literal(!0)}))).account}}function fe(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map((t)=>t.slice(0,1).toUpperCase()).join("")}function ge(e,t){let n=t.indexOf("/");if(n<=0||n===t.length-1)return;let i=t.slice(0,n),s=t.slice(n+1);return`${e==="/"?"":e.replace(/\/+$/,"")}/entities/${encodeURIComponent(i)}/${encodeURIComponent(s)}`}function L(e,t=!1){return new Date(t?e:e*1000).toISOString()}var P=v(T(),1);function V(e){return P.jsxDEV(y,{variant:e.tone==="danger"?"danger":e.tone==="primary"?"primary":"outline",type:e.type??"button",onClick:e.onClick,disabled:e.disabled,children:e.children},void 0,!1,void 0,this)}function R(e){return P.jsxDEV("div",{className:o("account-access-item",c.access),children:[P.jsxDEV(he,{density:"comfortable",title:e.kind,description:e.description,metadata:e.metadata??[]},void 0,!1,void 0,this),e.action]},void 0,!0,void 0,this)}function x(e){return P.jsxDEV("section",{className:o("account-detail-section",c.section),children:[P.jsxDEV("div",{className:"account-section-label",children:[P.jsxDEV("h3",{className:o("",c.heading,K.section),children:e.title},void 0,!1,void 0,this),e.description?P.jsxDEV("p",{className:o("",c.description),children:e.description},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),P.jsxDEV("div",{className:o("people-stack",c.stack),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ye(e,t){let n=Object.fromEntries(t.entries());for(let i of e)if(i.control==="checkbox")n[i.name]=t.has(i.name);else if(i.control==="number"&&typeof n[i.name]==="string"&&n[i.name]!=="")n[i.name]=Number(n[i.name]);return n}function Ae(e){if(e.secret)return"password";if(e.control==="url"||e.control==="number")return e.control;return"text"}var r=v(T(),1);function Se(e){let{account:t,actions:n,title:i,studioPath:s}=e,h=t.role,g=t.profileEntityId?ge(s,t.profileEntityId):void 0;return r.jsxDEV(r.Fragment,{children:[r.jsxDEV(x,{title:"Profile",children:[r.jsxDEV("div",{className:o("account-identity",c.identity),children:r.jsxDEV("div",{className:o("people-detail-person",c.person),children:[r.jsxDEV("span",{className:o("people-avatar people-avatar--large",c.avatar),children:fe(i)},void 0,!1,void 0,this),r.jsxDEV("span",{className:o("",c.personCopy),children:[r.jsxDEV("span",{className:o("people-detail-name",c.name,K.secondaryDisplay),children:i},void 0,!1,void 0,this),r.jsxDEV("span",{"data-account-role":h,className:o("account-role",c.role),children:ve(h)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t.profileEntityId?r.jsxDEV(r.Fragment,{children:[r.jsxDEV("p",{className:o("account-profile-note",c.description),children:"Managed by the Anchor profile — your account name follows the published profile."},void 0,!1,void 0,this),r.jsxDEV(R,{kind:"Anchor profile",description:i,action:g?r.jsxDEV(y,{asChild:!0,variant:"link",children:r.jsxDEV("a",{href:g,children:"Edit Anchor Profile →"},void 0,!1,void 0,this)},void 0,!1,void 0,this):void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):r.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(C)=>{C.preventDefault(),n.saveName()},children:[r.jsxDEV("label",{className:o("",c.formLabel),htmlFor:"display-name",children:"Display name"},void 0,!1,void 0,this),r.jsxDEV(Y,{id:"display-name",maxLength:200,autoComplete:"name",required:!0,value:n.displayName,onChange:(C)=>n.setDisplayName(C.target.value)},void 0,!1,void 0,this),r.jsxDEV(V,{type:"submit",disabled:n.busy,children:"Save name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r.jsxDEV("p",{className:o("",c.description),children:"Your role controls access to this brain. An administrator manages access in Administration."},void 0,!1,void 0,this),h==="admin"&&r.jsxDEV(y,{asChild:!0,variant:"outline",children:r.jsxDEV("a",{href:be(s,"admin:administration"),children:"Manage people in Administration →"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function we(e){let t=e.account.connectedChannels;return r.jsxDEV(x,{title:"Linked identities",description:"How this brain recognizes messages from you. These are your identities, not services configured for the whole brain.",children:t.length===0?r.jsxDEV("p",{className:o("people-empty",c.empty),children:"No linked identities."},void 0,!1,void 0,this):t.map((n)=>r.jsxDEV(R,{kind:n.type,description:n.label,metadata:[`Verified: ${L(n.verifiedAt,!0)}`]},`${n.type}:${n.label}`,!1,void 0,this))},void 0,!1,void 0,this)}function xe(e){let{account:t,actions:n}=e;return r.jsxDEV(r.Fragment,{children:[r.jsxDEV("p",{className:o("",c.description),children:"Settings for your account only. These do not configure shared services for the brain."},void 0,!1,void 0,this),t.pluginSettings.map((i)=>r.jsxDEV(ke,{label:i.title,density:"comfortable",presentation:"disclosure",children:[r.jsxDEV("p",{className:o("account-settings-description",c.description),children:i.description??"Private settings for this account."},void 0,!1,void 0,this),r.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(s)=>{s.preventDefault(),n.saveSettings(i,new FormData(s.currentTarget))},children:[i.fields.map((s)=>r.jsxDEV("label",{htmlFor:`setting-${i.id}-${s.name}`,className:o("",c.field),children:[r.jsxDEV("span",{className:o("",c.formLabel),children:s.label},void 0,!1,void 0,this),s.control==="checkbox"?r.jsxDEV(X,{id:`setting-${i.id}-${s.name}`,name:s.name,defaultChecked:s.value===!0},void 0,!1,void 0,this):r.jsxDEV(Y,{id:`setting-${i.id}-${s.name}`,name:s.name,type:Ae(s),required:s.required&&(!i.configured||s.secret)&&!s.set,defaultValue:s.secret?"":typeof s.value==="string"||typeof s.value==="number"?s.value:"",placeholder:s.secret&&s.set?"Stored — leave blank to keep":void 0,autoComplete:"off"},void 0,!1,void 0,this)]},s.name,!0,void 0,this)),r.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:[r.jsxDEV(V,{type:"submit",tone:"primary",disabled:n.busy,children:"Save settings"},void 0,!1,void 0,this),i.configured?r.jsxDEV(y,{variant:"danger",disabled:n.busy,type:"button",onClick:()=>n.removeSettings(i),children:"Remove"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},`${i.id}:${i.revision??"unset"}`,!0,void 0,this)]},i.id,!0,void 0,this))]},void 0,!0,void 0,this)}function Ce(e){let{account:t,actions:n}=e,{busy:i}=n;return r.jsxDEV("div",{className:o("",c.column),children:[r.jsxDEV(x,{title:"Sign-in",description:"Passkeys used to access this account. Your final passkey is protected from revocation.",children:[t.passkeys.map((s)=>r.jsxDEV(R,{kind:s.credentialBackedUp?"Synced passkey":"Device passkey",metadata:[`Added: ${L(s.createdAt,!0)}`],action:t.passkeys.length>1?r.jsxDEV(y,{variant:"danger",disabled:i,type:"button",onClick:()=>n.revokePasskey(s.id),children:"Revoke"},void 0,!1,void 0,this):void 0},s.id,!1,void 0,this)),r.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:r.jsxDEV(y,{variant:"outline",disabled:i,type:"button",onClick:n.addPasskey,children:"Add passkey"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.jsxDEV(x,{title:"Signed-in sessions",children:t.sessions.map((s)=>r.jsxDEV(R,{kind:s.current?"This session":"Browser session",metadata:[`Started: ${L(s.createdAt)}`,...s.current?["Current browser"]:[]],action:!s.current?r.jsxDEV(y,{variant:"danger",disabled:i,type:"button",onClick:()=>n.revokeSession(s.id),children:"End"},void 0,!1,void 0,this):void 0},s.id,!1,void 0,this))},void 0,!1,void 0,this),r.jsxDEV("footer",{className:o("account-session-actions",c.footer),children:[r.jsxDEV("small",{children:"Access changes require an Admin."},void 0,!1,void 0,this),r.jsxDEV("div",{className:o("",c.actions),children:[r.jsxDEV(V,{disabled:i||t.sessions.every((s)=>s.current),onClick:n.revokeOtherSessions,children:"End other sessions"},void 0,!1,void 0,this),r.jsxDEV(V,{tone:"danger",disabled:i,onClick:n.revokeAllSessions,children:"Sign out everywhere"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Pe=v(Z(),1);var u={clients:{k1xSpc:"xrvj5dj",kumcoG:"x12p5jtz",kOIVth:"x1af02g3",k7Eaqz:"xeuugli",$$css:!0},client:{k7Eaqz:"xeuugli",k1xSpc:"xrvj5dj",kfiyM8:"x10ukxgv",kOIVth:"x883omv",kmVPX3:"x1np1h16",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"xy1lt07",kaIpWk:"xur7f20",kWkggS:"x18s3upu",$$css:!0},clientName:{kogj98:"x1ghz6dp",kMv6JI:"x5ddh9m",kGuDYH:"xif65rj",k63SB2:"x1s688f",kMwMTN:"xqvuw85",$$css:!0},text:{kogj98:"x1ghz6dp",kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",kLWn49:"x1dbl2gt",kMwMTN:"x1ar3pfp",$$css:!0},steps:{kogj98:"x1ghz6dp",kE3dHu:"x5tiur9",kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",kLWn49:"x1dbl2gt",kMwMTN:"x1ar3pfp",$$css:!0},fields:{k1xSpc:"xrvj5dj",kumcoG:"x16lqc3j",kOIVth:"x1vtxxvk",kogj98:"x1ghz6dp",kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",$$css:!0},field:{k1xSpc:"xjp7ctv",$$css:!0},fieldLabel:{k63SB2:"x1s688f",kMwMTN:"xqvuw85",$$css:!0},fieldValue:{kogj98:"x1ghz6dp",k7Eaqz:"xeuugli",kHjlTd:"xj0a0fe",kMwMTN:"x1ar3pfp",$$css:!0},code:{kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kMwMTN:"xqvuw85",kWkggS:"xbslqsl",kaIpWk:"x12oqio5",kmVPX3:"x1nyoefi",$$css:!0},snippet:{k1xSpc:"x78zum5",kGNEyG:"x1cy8zhl",kOIVth:"x167g77z",k7Eaqz:"xeuugli",$$css:!0},snippetCode:{kUk6DE:"x98rzlu",k7Eaqz:"xeuugli",kogj98:"x1ghz6dp",kmVPX3:"x6yrr3s",kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kLWn49:"x1jjo3f5",kMwMTN:"xqvuw85",kWkggS:"xbslqsl",kaIpWk:"x1kogg8i",khDVqt:"x1sdyfia",kXHlph:"xw2csxc",$$css:!0},developer:{k7Eaqz:"xeuugli",kmVPX3:"x1d8yrva",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"xy1lt07",kaIpWk:"xur7f20",$$css:!0},developerSummary:{kkrTdU:"x1ypdohk",kMv6JI:"x5ddh9m",kGuDYH:"xif65rj",k63SB2:"x1s688f",kMwMTN:"xqvuw85",$$css:!0},developerClients:{keoZOQ:"x1hmvnq2",kumcoG:"x1mkdm3x",$$css:!0},developerHint:{k1xSpc:"x1lliihq",keoZOQ:"x1gslohp",k63SB2:"xo1l8bm",kGuDYH:"xfifm61",kMwMTN:"x1ar3pfp",$$css:!0}};function re(e){return new URL(e).host.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ie(e){return JSON.stringify(e,null,2)}function Ne(e,t,n){return["Already have servers there? Add only the ",{code:`"${n}"`}," entry inside ",{code:`"${t}"`},` of ${e}.`]}function Te(e){let t=re(e),n="Sign in with your passkey when asked.";return[{id:"claude",group:"primary",name:"Claude",note:["Desktop app and claude.ai."],steps:[["Open Settings → Connectors → Add custom connector."],["Name it ",{code:t}," and paste your brain’s address."],["Sign in with your passkey when asked."]]},{id:"chatgpt",group:"primary",name:"ChatGPT",steps:[["Open Settings → Apps & Connectors → Advanced and turn on Developer mode."],["Choose Create, name it ",{code:t},", paste your brain’s address and pick OAuth."],["Sign in with your passkey when asked."]]},{id:"claude-code",group:"developer",name:"Claude Code",lead:[["Add the server in your terminal:"]],snippet:{label:"Claude Code command",code:`claude mcp add --transport http ${t} ${e}`},after:[["Then start Claude Code, run ",{code:"/mcp"},", choose ",{code:t}," and sign in with your passkey."]]},{id:"cursor",group:"developer",name:"Cursor",steps:[["Open Cursor Settings → MCP → Add new global MCP server."],["Name it ",{code:t}," and paste your brain’s address."],["Sign in with your passkey when Cursor asks."]],lead:[["Or add it to ",{code:"~/.cursor/mcp.json"},":"]],snippet:{label:"Cursor configuration",code:ie({mcpServers:{[t]:{url:e}}})},after:[Ne("the file","mcpServers",t)]},{id:"vscode",group:"developer",name:"VS Code",steps:[["Open the Command Palette and run ",{code:"MCP: Add Server"},"."],["Choose HTTP, paste your brain’s address and name it ",{code:t},"."],["Choose Global, then sign in with your passkey when asked."]],lead:[["Or run ",{code:"MCP: Open User Configuration"}," and add:"]],snippet:{label:"VS Code configuration",code:ie({servers:{[t]:{type:"http",url:e}}})},after:[Ne("your user configuration","servers",t)]},{id:"other",group:"developer",name:"Any other MCP client",inlineName:"any other MCP client",note:["Look for “add MCP server”, “connector” or “integration” in the tool’s settings and fill in:"],fields:[{label:"Name",value:[{code:t}]},{label:"Type",value:["Remote server, Streamable HTTP — not stdio, not SSE"]},{label:"URL",value:[{code:e}]},{label:"Authentication",value:["OAuth. Leave API key, token, client ID and secret empty; the tool registers itself."]}],lead:[["When you connect, your browser opens “Authorize <tool>?” on your brain. Approve MCP access with your passkey. The tool then has two tools: ",{code:"chat"},", to ask your brain anything as you would in chat, and ",{code:"confirm"},", to approve changes when the brain asks."],["Tool only takes local (stdio) servers, or insists on an API key? Bridge it with ",{code:"mcp-remote"},", which handles the sign-in:"]],snippet:{label:"mcp-remote bridge configuration",code:ie({mcpServers:{[t]:{command:"npx",args:["-y","mcp-remote",e]}}})}}]}var l=v(T(),1);function G(e){return l.jsxDEV(l.Fragment,{children:e.text.map((t,n)=>typeof t==="string"?t:l.jsxDEV("code",{className:o("",u.code),children:t.code},n,!1,void 0,this))},void 0,!1,void 0,this)}function j(e){let[t,n]=Pe.useState("idle"),i=async()=>{try{await navigator.clipboard.writeText(e.code),n("copied")}catch{n("unavailable")}};return l.jsxDEV("div",{className:o("ai-tools-snippet",u.snippet),children:[l.jsxDEV("pre",{className:o("",u.snippetCode),"aria-label":e.label,children:e.code},void 0,!1,void 0,this),l.jsxDEV(y,{variant:"outline",size:"sm",onClick:()=>void i(),"aria-label":`Copy ${e.label}`,children:t==="copied"?"Copied":t==="unavailable"?"Select to copy":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function W(e){let{client:t}=e;return l.jsxDEV("article",{className:o("ai-tools-client",u.client),children:[l.jsxDEV("h4",{className:o("",u.clientName),children:t.name},void 0,!1,void 0,this),t.note?l.jsxDEV("p",{className:o("",u.text),children:l.jsxDEV(G,{text:t.note},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,t.steps?l.jsxDEV("ol",{className:o("",u.steps),children:t.steps.map((n,i)=>l.jsxDEV("li",{children:l.jsxDEV(G,{text:n},void 0,!1,void 0,this)},i,!1,void 0,this))},void 0,!1,void 0,this):null,t.fields?l.jsxDEV("dl",{className:o("",u.fields),children:t.fields.map((n)=>l.jsxDEV("div",{className:o("",u.field),children:[l.jsxDEV("dt",{className:o("",u.fieldLabel),children:n.label},void 0,!1,void 0,this),l.jsxDEV("dd",{className:o("",u.fieldValue),children:l.jsxDEV(G,{text:n.value},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},n.label,!0,void 0,this))},void 0,!1,void 0,this):null,t.lead?.map((n,i)=>l.jsxDEV("p",{className:o("",u.text),children:l.jsxDEV(G,{text:n},void 0,!1,void 0,this)},`lead-${i}`,!1,void 0,this)),t.snippet?l.jsxDEV(j,{...t.snippet},void 0,!1,void 0,this):null,t.after?.map((n,i)=>l.jsxDEV("p",{className:o("",u.text),children:l.jsxDEV(G,{text:n},void 0,!1,void 0,this)},`after-${i}`,!1,void 0,this))]},void 0,!0,void 0,this)}function Qe(e){return e.length<2?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`}function $e(e){let t=Te(e.mcpUrl),n=t.filter((s)=>s.group==="primary"),i=t.filter((s)=>s.group==="developer");return l.jsxDEV(x,{title:"AI tools",description:"Connect AI tools you already use to this brain. A connected tool talks to the brain as you do in chat — asking, saving and updating within your access — after you sign in with your passkey.",children:[l.jsxDEV("article",{className:o("ai-tools-address",u.client),children:[l.jsxDEV("h4",{className:o("",u.clientName),children:"Your brain’s address"},void 0,!1,void 0,this),l.jsxDEV(j,{label:"brain address",code:e.mcpUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("div",{className:o("ai-tools-clients",u.clients),children:n.map((s)=>l.jsxDEV(W,{client:s},s.id,!1,void 0,this))},void 0,!1,void 0,this),l.jsxDEV("details",{className:o("ai-tools-developer",u.developer),children:[l.jsxDEV("summary",{className:o("",u.developerSummary),children:["Developer tools and other clients",l.jsxDEV("span",{className:o("",u.developerHint),children:Qe(i.map((s)=>s.inlineName??s.name))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("div",{className:o("ai-tools-clients",u.clients,u.developerClients),children:i.map((s)=>l.jsxDEV(W,{client:s},s.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Ee=v(Z(),1);var ce="Enter the username and password of an app password from this page.";function Oe(e){let t=new URL(e),n=`${t.protocol==="https:"?"davs":"dav"}://${t.host}${t.pathname}`,i=re(e);return[{id:"macos",group:"file-manager",name:"macOS",note:["Finder, on any Mac."],steps:[["In Finder, choose Go → Connect to Server (⌘K)."],["Paste the address below and click Connect."],["Choose Registered User. ",ce]],snippet:{label:"macOS address",code:e}},{id:"windows",group:"file-manager",name:"Windows",note:["File Explorer, on Windows 10 and 11."],steps:[["In File Explorer, open This PC and choose Map network drive."],["Paste the address below as the folder, tick Connect using different credentials, and click Finish."],[ce]],snippet:{label:"Windows address",code:e}},{id:"gnome-files",group:"file-manager",name:"GNOME Files",note:["The file manager on Ubuntu, Fedora and other GNOME desktops."],steps:[["Open Files → Other Locations (or Network)."],["Under Connect to Server, enter the address below and connect."],[ce]],snippet:{label:"GNOME Files address",code:n}},{id:"rclone",group:"command-line",name:"rclone",note:["Linux, macOS and Windows, from a terminal."],lead:[["Store the drive as a remote, with your app password’s username and password:"]],snippet:{label:"rclone remote command",code:`rclone config create ${i} webdav url=${e} vendor=other user=YOUR_USERNAME pass=YOUR_PASSWORD --obscure`},after:[["Then mount it on an empty folder: ",{code:`rclone mount ${i}: ~/Brain --vfs-cache-mode writes`},"."]]}]}var d=v(T(),1),Q="app-password-label",Me="app-password-write";function le(e){return L(e).slice(0,10)}function et(e,t){return[`Created: ${le(e.createdAt)}`,`${e.expiresAt<=t?"Expired":"Expires"}: ${le(e.expiresAt)}`,e.lastUsedAt===void 0?"Never used":`Last used: ${le(e.lastUsedAt)}`]}function Re(e){let{account:t,actions:n}=e,{busy:i,createdAppPassword:s}=n,h=Math.floor(Date.now()/1000),[g,C]=Ee.useState(!1),N=Oe(e.davUrl),S=N.filter((p)=>p.group==="file-manager"),w=N.filter((p)=>p.group==="command-line");return d.jsxDEV("div",{className:o("",c.column),children:[d.jsxDEV(x,{title:"Drive",description:"Mount this brain as a network drive. It shows the notes, posts and files you can see here, as folders and files, to open and edit on your computer.",children:d.jsxDEV("article",{className:o("drive-address",u.client),children:[d.jsxDEV("h4",{className:o("",u.clientName),children:"Your brain’s drive address"},void 0,!1,void 0,this),d.jsxDEV(j,{label:"drive address",code:e.davUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),d.jsxDEV(x,{title:"App passwords",description:"A mount signs in with an app password instead of your passkey. It works only for the drive, expires after a year and can be revoked here. It can only read unless you allow saving changes.",children:[s?d.jsxDEV("article",{"data-app-password-reveal":!0,className:o("drive-reveal",u.client),children:[d.jsxDEV("h4",{className:o("",u.clientName),children:"Your new app password"},void 0,!1,void 0,this),d.jsxDEV("p",{className:o("",u.text),children:"Copy both now. The password is shown only once."},void 0,!1,void 0,this),d.jsxDEV(j,{label:"username",code:s.username},void 0,!1,void 0,this),d.jsxDEV(j,{label:"password",code:s.password},void 0,!1,void 0,this),d.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:d.jsxDEV(y,{variant:"outline",type:"button",onClick:n.dismissCreatedAppPassword,children:"Done"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,t.appPasswords.length===0?d.jsxDEV("p",{className:o("",u.text),children:"No app passwords yet."},void 0,!1,void 0,this):t.appPasswords.map((p)=>d.jsxDEV(R,{kind:p.label,description:`${p.username} · ${p.access==="write"?"Read and write":"Read-only"}`,metadata:et(p,h),action:d.jsxDEV(y,{variant:"danger",disabled:i,type:"button",onClick:()=>n.revokeAppPassword(p.id),children:"Revoke"},void 0,!1,void 0,this)},p.id,!1,void 0,this)),d.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(p)=>{p.preventDefault();let M=p.currentTarget,O=String(new FormData(M).get(Q)??"");if(O.trim()==="")return;n.createAppPassword(O.trim(),g?"write":"read"),M.reset(),C(!1)},children:[d.jsxDEV("label",{htmlFor:Q,className:o("",c.field),children:[d.jsxDEV("span",{className:o("",c.formLabel),children:"Name it after the computer it is for"},void 0,!1,void 0,this),d.jsxDEV(Y,{id:Q,name:Q,type:"text",required:!0,maxLength:100,placeholder:"Laptop",autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),d.jsxDEV("label",{htmlFor:Me,className:o("",c.field),children:[d.jsxDEV("span",{className:o("",c.formLabel),children:"Allow saving changes"},void 0,!1,void 0,this),d.jsxDEV(X,{id:Me,"aria-label":"Allow saving changes",checked:g,onCheckedChange:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this),d.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:d.jsxDEV(y,{variant:"outline",disabled:i,type:"submit",children:"New app password"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d.jsxDEV(x,{title:"Connect your computer",description:"Use your computer’s own file manager. The brain then appears as a drive beside your other folders.",children:[d.jsxDEV("div",{className:o("drive-clients",u.clients),children:S.map((p)=>d.jsxDEV(W,{client:p},p.id,!1,void 0,this))},void 0,!1,void 0,this),d.jsxDEV("details",{className:o("drive-command-line",u.developer),children:[d.jsxDEV("summary",{className:o("",u.developerSummary),children:["Command line",d.jsxDEV("span",{className:o("",u.developerHint),children:w.map((p)=>p.name).join(", ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),d.jsxDEV("div",{className:o("drive-command-line-clients",u.clients,u.developerClients),children:w.map((p)=>d.jsxDEV(W,{client:p},p.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var k=v(Z(),1);var ee={revokePasskey:{title:"Revoke this passkey?",message:"You will not be able to use this passkey again.",confirmLabel:"Revoke passkey",pending:"Revoking passkey…",complete:"Passkey revoked."},revokeSession:{title:"End this browser session?",message:"That browser will need a passkey to sign in again.",confirmLabel:"End session",pending:"Ending session…",complete:"Session ended."},revokeAppPassword:{title:"Revoke this app password?",message:"Anything mounted with it stops working at once. Its password cannot be recovered.",confirmLabel:"Revoke app password",pending:"Revoking app password…",complete:"App password revoked."},revokeOtherSessions:{title:"End every other browser session?",message:"Your current browser will remain signed in.",confirmLabel:"End other sessions",pending:"Ending other sessions…",complete:"Other sessions ended."}};function Ie(e){return De(e,"Account request failed")}function Ue(e){let{client:t,initialAccount:n}=e,[i,s]=k.useState(n),[h,g]=k.useState(n?.displayName??e.initialDisplayName),[C,N]=k.useState(""),[S,w]=k.useState(!1),[p,M]=k.useState(!1),[O,z]=k.useState(null),[Ve,ue]=k.useState(null);k.useEffect(()=>{if(n)return;let m=!1;return t.fetchAccount().then((b)=>{if(m)return;s(b),g(b.displayName)}).catch((b)=>{if(m)return;w(!0),N(Ie(b))}),()=>{m=!0}},[t,n]);let E=k.useCallback(async(m,b,U)=>{M(!0),w(!1),N(m);try{let q=await U();if(q)s(q),g(q.displayName);N(b)}catch(q){w(!0),N(Ie(q))}finally{M(!1)}},[]),de=async(m)=>(await t.mutateAccount(m)).account,_=(m,b)=>z({title:m.title,message:m.message,confirmLabel:m.confirmLabel,action:()=>{E(m.pending,m.complete,()=>de(b))}});return{account:i,displayName:h,setDisplayName:g,status:C,error:S,busy:p,confirmation:O,cancelConfirmation:()=>z(null),confirm:()=>{if(!O)return;z(null),O.action()},saveName:()=>{E("Saving…","Display name updated.",()=>de({action:A.updateDisplayName,confirmation:A.updateDisplayName,displayName:h}))},addPasskey:()=>{E("Waiting for your authenticator…","Passkey added.",()=>t.registerPasskey())},revokePasskey:(m)=>_(ee.revokePasskey,{action:A.revokePasskey,confirmation:A.revokePasskey,credentialId:m}),revokeSession:(m)=>_(ee.revokeSession,{action:A.revokeSession,confirmation:A.revokeSession,sessionId:m}),revokeOtherSessions:()=>_(ee.revokeOtherSessions,{action:A.revokeOtherSessions,confirmation:A.revokeOtherSessions}),revokeAllSessions:()=>z({title:"Sign out everywhere?",message:"This ends every session, including this one. You will need your passkey to return.",confirmLabel:"Sign out everywhere",action:()=>{E("Signing out everywhere…","Signed out.",async()=>{await t.mutateAccount({action:A.revokeAllSessions,confirmation:A.revokeAllSessions}),window.location.assign(`/login?return_to=${encodeURIComponent(e.routePath)}`);return})}}),saveSettings:(m,b)=>{let U=ye(m.fields,b);E(`Saving ${m.title}…`,`${m.title} updated.`,()=>t.mutatePluginSettings({action:"save",definitionId:m.id,values:U}))},createdAppPassword:Ve,createAppPassword:(m,b)=>{E("Creating app password…","App password created.",async()=>{let U=await t.mutateAccount({action:A.createAppPassword,confirmation:A.createAppPassword,label:m,...b==="write"?{access:b}:{}});return ue(U.appPassword??null),U.account})},dismissCreatedAppPassword:()=>ue(null),revokeAppPassword:(m)=>_(ee.revokeAppPassword,{action:A.revokeAppPassword,confirmation:A.revokeAppPassword,appPasswordId:m}),removeSettings:(m)=>z({title:`Remove ${m.title}?`,message:"The stored settings for this integration will be removed from your account only.",confirmLabel:"Remove settings",action:()=>{E(`Removing ${m.title}…`,`${m.title} removed.`,()=>t.mutatePluginSettings({action:"delete",definitionId:m.id}))}})}}var f=v(T(),1),tt=["profile","security","identities","settings",B,F];function nt(e){let t=tt.find((n)=>n===e.initialSection);if(!t||t===B&&!e.mcpUrl||t===F&&!e.davUrl)return"profile";return t}function ot(e){let t=["your profile","sign-in security","linked identities",...e.settings?["personal settings"]:[],...e.aiTools?["AI tools"]:[],...e.drive?["your drive"]:[]];return`Your account on this brain. Manage ${`${t.slice(0,-1).join(", ")} and ${t.at(-1)}`} here—not shared services or other people’s access.`}function on({bootstrap:e,initialAccount:t,client:n}){let i=Fe(),s=te.useMemo(()=>n??new se({fetch:i.fetch}),[n,i]),h=Ue({client:s,initialAccount:t,initialDisplayName:e.displayName,routePath:e.routePath}),{account:g,status:C,error:N,busy:S,confirmation:w}=h,[p,M]=te.useState(()=>nt(e)),O=g?.displayName??e.displayName;return f.jsxDEV(f.Fragment,{children:[f.jsxDEV("div",{className:o("account-shell",c.shell,ze.inset),children:[f.jsxDEV(He,{model:{access:qe("public"),title:"Your account",totals:[]}},void 0,!1,void 0,this),f.jsxDEV("p",{className:o("account-scope",c.description),children:ot({settings:(g?.pluginSettings.length??0)>0,aiTools:Boolean(e.mcpUrl),drive:Boolean(e.davUrl)})},void 0,!1,void 0,this),f.jsxDEV("p",{className:o(`account-status${N?" is-error":""}`,c.feedback,N&&c.feedbackError),role:"status","aria-live":"polite",children:C},void 0,!1,void 0,this),!g?f.jsxDEV("p",{className:o("account-loading",c.loading),children:"Reading your account…"},void 0,!1,void 0,this):f.jsxDEV(je,{className:"account-details",value:p,onValueChange:M,children:[f.jsxDEV(Be,{"aria-label":"Account sections",className:o("account-tabs",c.tabs),children:[f.jsxDEV(I,{value:"profile",disabled:S,children:"Profile"},void 0,!1,void 0,this),f.jsxDEV(I,{value:"security",disabled:S,children:"Sign-in & sessions"},void 0,!1,void 0,this),f.jsxDEV(I,{value:"identities",disabled:S,children:"Linked identities"},void 0,!1,void 0,this),g.pluginSettings.length>0&&f.jsxDEV(I,{value:"settings",disabled:S,children:"Personal settings"},void 0,!1,void 0,this),e.mcpUrl&&f.jsxDEV(I,{value:B,disabled:S,children:"AI tools"},void 0,!1,void 0,this),e.davUrl&&f.jsxDEV(I,{value:F,disabled:S,children:"Drive"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f.jsxDEV(D,{value:"profile",forceMount:!0,hidden:p!=="profile",className:o("account-detail-sections",c.tabPanel),children:f.jsxDEV(Se,{account:g,actions:h,title:O,studioPath:e.studioPath},void 0,!1,void 0,this)},void 0,!1,void 0,this),f.jsxDEV(D,{value:"identities",forceMount:!0,hidden:p!=="identities",className:o("",c.tabPanel),children:f.jsxDEV(we,{account:g},void 0,!1,void 0,this)},void 0,!1,void 0,this),g.pluginSettings.length>0&&f.jsxDEV(D,{value:"settings",forceMount:!0,hidden:p!=="settings",className:o("",c.tabPanel),children:f.jsxDEV(xe,{account:g,actions:h},void 0,!1,void 0,this)},void 0,!1,void 0,this),f.jsxDEV(D,{value:"security",forceMount:!0,hidden:p!=="security",className:o("",c.tabPanel),children:f.jsxDEV(Ce,{account:g,actions:h},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.mcpUrl&&f.jsxDEV(D,{value:B,forceMount:!0,hidden:p!==B,className:o("",c.tabPanel),children:f.jsxDEV($e,{mcpUrl:e.mcpUrl},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.davUrl&&f.jsxDEV(D,{value:F,forceMount:!0,hidden:p!==F,className:o("",c.tabPanel),children:f.jsxDEV(Re,{davUrl:e.davUrl,account:g,actions:h},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),w&&f.jsxDEV(Le,{mark:"!",title:w.title,titleId:"account-confirmation-title",cancelLabel:"Cancel",confirmLabel:w.confirmLabel,confirmVariant:"danger",pending:S,onCancel:h.cancelConfirmation,onConfirm:h.confirm,children:f.jsxDEV("p",{children:w.message},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{on as AccountApp};
|
|
1
|
+
import{a as c,b as o,c as he,d as ke}from"./main-k6q9va58.js";import{Hb as ve,Jb as a,Kb as J,Lb as A,Mb as De,Ob as B,Pb as F,cb as T,gb as y,hb as Y,ic as Fe,jc as ze,kb as X,lc as qe,mc as He,rb as Le,tb as je,tc as be,ub as Be,vb as I,vc as K,wb as D}from"./main-e4qk2bwv.js";import{Cc as Z,wc as v}from"./main-hft323ae.js";var te=v(Z(),1);var Ye=a.object({displayName:a.string(),role:a.enum(["admin","trusted","public"]),profileEntityId:a.string().optional(),passkeys:a.array(a.object({id:a.string(),transports:a.array(a.string()).optional(),credentialDeviceType:a.string().optional(),credentialBackedUp:a.boolean(),createdAt:a.number(),updatedAt:a.number()})),appPasswords:a.array(a.object({id:a.string(),username:a.string(),label:a.string(),access:a.enum(["read","write"]),createdAt:a.number(),expiresAt:a.number(),lastUsedAt:a.number().optional()})),connectedChannels:a.array(a.object({type:a.string(),label:a.string(),verifiedAt:a.number()})),pluginSettings:a.array(a.object({id:a.string(),title:a.string(),description:a.string().optional(),configured:a.boolean(),revision:a.number().nullable(),fields:a.array(a.object({name:a.string(),label:a.string(),control:a.enum(["text","url","number","checkbox"]),secret:a.boolean(),required:a.boolean(),value:a.union([a.string(),a.number(),a.boolean(),a.null()]).optional(),set:a.boolean().optional()}))})),sessions:a.array(a.object({id:a.string(),current:a.boolean(),createdAt:a.number(),expiresAt:a.number()}))});function Ge(e){return Ye.safeParse(e).success}var pe=a.custom(Ge,{message:"Invalid account response"}),ne=a.object({account:pe}),We=a.object({account:pe.optional(),appPassword:a.object({username:a.string(),password:a.string()}).optional(),revoked:a.object({sessions:a.number(),refreshTokens:a.number().optional()}).optional(),signedOut:a.boolean().optional()});function _e(e){return We.safeParse(e).success}var Je=a.custom(_e,{message:"Invalid account mutation response"}),Ke=a.custom((e)=>{if(!J(e))return!1;return typeof e.challenge==="string"&&J(e.rp)&&J(e.user)&&Array.isArray(e.pubKeyCredParams)},{message:"Invalid passkey registration options"});class me extends Error{status;constructor(e,t){super(e);this.name="AccountApiError",this.status=t}}async function H(e,t){let n;try{n=await e.json()}catch{n={}}if(!e.ok){let i=typeof n==="object"&&n!==null&&"error"in n&&typeof n.error==="string"?n.error:"Account request failed";throw new me(i,e.status)}return t.parse(n)}function oe(e){let t=e.replaceAll("-","+").replaceAll("_","/").padEnd(Math.ceil(e.length/4)*4,"=");return Uint8Array.from(atob(t),(n)=>n.charCodeAt(0)).buffer}function ae(e){let t=new Uint8Array(e),n="";for(let i of t)n+=String.fromCharCode(i);return btoa(n).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function Xe(e){return{challenge:oe(e.challenge),rp:e.rp,user:{...e.user,id:oe(e.user.id)},pubKeyCredParams:e.pubKeyCredParams,...e.timeout!==void 0?{timeout:e.timeout}:{},...e.excludeCredentials?{excludeCredentials:e.excludeCredentials.map((t)=>({...t,id:oe(t.id)}))}:{},...e.authenticatorSelection?{authenticatorSelection:e.authenticatorSelection}:{},...e.attestation?{attestation:e.attestation}:{},...e.extensions?{extensions:e.extensions}:{}}}var Ze=(e,t)=>fetch(e,t);class se{fetchFn;constructor(e={}){this.fetchFn=e.fetch??Ze}async fetchAccount(){return(await H(await this.fetchFn("/auth/account",{credentials:"same-origin",cache:"no-store"}),ne)).account}async mutatePluginSettings(e){return(await H(await this.fetchFn("/auth/account/plugin-settings",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),ne)).account}async mutateAccount(e){return H(await this.fetchFn("/auth/account/mutations",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Je)}async registerPasskey(){let e=await H(await this.fetchFn("/auth/account/passkeys/options",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:"{}"}),Ke),t=await navigator.credentials.create({publicKey:Xe(e)});if(!(t instanceof PublicKeyCredential))throw Error("Passkey registration was cancelled");if(!(t.response instanceof AuthenticatorAttestationResponse))throw Error("Authenticator returned an invalid passkey response");let n=t.response,i={id:t.id,rawId:ae(t.rawId),type:t.type,...t.authenticatorAttachment?{authenticatorAttachment:t.authenticatorAttachment}:{},clientExtensionResults:t.getClientExtensionResults(),response:{clientDataJSON:ae(n.clientDataJSON),attestationObject:ae(n.attestationObject),transports:typeof n.getTransports==="function"?n.getTransports():[]}};return(await H(await this.fetchFn("/auth/account/passkeys/verify",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),ne.extend({verified:a.literal(!0)}))).account}}function fe(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map((t)=>t.slice(0,1).toUpperCase()).join("")}function ge(e,t){let n=t.indexOf("/");if(n<=0||n===t.length-1)return;let i=t.slice(0,n),s=t.slice(n+1);return`${e==="/"?"":e.replace(/\/+$/,"")}/entities/${encodeURIComponent(i)}/${encodeURIComponent(s)}`}function L(e,t=!1){return new Date(t?e:e*1000).toISOString()}var P=v(T(),1);function V(e){return P.jsxDEV(y,{variant:e.tone==="danger"?"danger":e.tone==="primary"?"primary":"outline",type:e.type??"button",onClick:e.onClick,disabled:e.disabled,children:e.children},void 0,!1,void 0,this)}function R(e){return P.jsxDEV("div",{className:o("account-access-item",c.access),children:[P.jsxDEV(he,{density:"comfortable",title:e.kind,description:e.description,metadata:e.metadata??[]},void 0,!1,void 0,this),e.action]},void 0,!0,void 0,this)}function x(e){return P.jsxDEV("section",{className:o("account-detail-section",c.section),children:[P.jsxDEV("div",{className:"account-section-label",children:[P.jsxDEV("h3",{className:o("",c.heading,K.section),children:e.title},void 0,!1,void 0,this),e.description?P.jsxDEV("p",{className:o("",c.description),children:e.description},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),P.jsxDEV("div",{className:o("people-stack",c.stack),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ye(e,t){let n=Object.fromEntries(t.entries());for(let i of e)if(i.control==="checkbox")n[i.name]=t.has(i.name);else if(i.control==="number"&&typeof n[i.name]==="string"&&n[i.name]!=="")n[i.name]=Number(n[i.name]);return n}function Ae(e){if(e.secret)return"password";if(e.control==="url"||e.control==="number")return e.control;return"text"}var r=v(T(),1);function Se(e){let{account:t,actions:n,title:i,studioPath:s}=e,h=t.role,g=t.profileEntityId?ge(s,t.profileEntityId):void 0;return r.jsxDEV(r.Fragment,{children:[r.jsxDEV(x,{title:"Profile",children:[r.jsxDEV("div",{className:o("account-identity",c.identity),children:r.jsxDEV("div",{className:o("people-detail-person",c.person),children:[r.jsxDEV("span",{className:o("people-avatar people-avatar--large",c.avatar),children:fe(i)},void 0,!1,void 0,this),r.jsxDEV("span",{className:o("",c.personCopy),children:[r.jsxDEV("span",{className:o("people-detail-name",c.name,K.secondaryDisplay),children:i},void 0,!1,void 0,this),r.jsxDEV("span",{"data-account-role":h,className:o("account-role",c.role),children:ve(h)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t.profileEntityId?r.jsxDEV(r.Fragment,{children:[r.jsxDEV("p",{className:o("account-profile-note",c.description),children:"Managed by the Anchor profile — your account name follows the published profile."},void 0,!1,void 0,this),r.jsxDEV(R,{kind:"Anchor profile",description:i,action:g?r.jsxDEV(y,{asChild:!0,variant:"link",children:r.jsxDEV("a",{href:g,children:"Edit Anchor Profile →"},void 0,!1,void 0,this)},void 0,!1,void 0,this):void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this):r.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(C)=>{C.preventDefault(),n.saveName()},children:[r.jsxDEV("label",{className:o("",c.formLabel),htmlFor:"display-name",children:"Display name"},void 0,!1,void 0,this),r.jsxDEV(Y,{id:"display-name",maxLength:200,autoComplete:"name",required:!0,value:n.displayName,onChange:(C)=>n.setDisplayName(C.target.value)},void 0,!1,void 0,this),r.jsxDEV(V,{type:"submit",disabled:n.busy,children:"Save name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r.jsxDEV("p",{className:o("",c.description),children:"Your role controls access to this brain. An administrator manages access in Administration."},void 0,!1,void 0,this),h==="admin"&&r.jsxDEV(y,{asChild:!0,variant:"outline",children:r.jsxDEV("a",{href:be(s,"admin:administration"),children:"Manage people in Administration →"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function we(e){let t=e.account.connectedChannels;return r.jsxDEV(x,{title:"Linked identities",description:"How this brain recognizes messages from you. These are your identities, not services configured for the whole brain.",children:t.length===0?r.jsxDEV("p",{className:o("people-empty",c.empty),children:"No linked identities."},void 0,!1,void 0,this):t.map((n)=>r.jsxDEV(R,{kind:n.type,description:n.label,metadata:[`Verified: ${L(n.verifiedAt,!0)}`]},`${n.type}:${n.label}`,!1,void 0,this))},void 0,!1,void 0,this)}function xe(e){let{account:t,actions:n}=e;return r.jsxDEV(r.Fragment,{children:[r.jsxDEV("p",{className:o("",c.description),children:"Settings for your account only. These do not configure shared services for the brain."},void 0,!1,void 0,this),t.pluginSettings.map((i)=>r.jsxDEV(ke,{label:i.title,density:"comfortable",presentation:"disclosure",children:[r.jsxDEV("p",{className:o("account-settings-description",c.description),children:i.description??"Private settings for this account."},void 0,!1,void 0,this),r.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(s)=>{s.preventDefault(),n.saveSettings(i,new FormData(s.currentTarget))},children:[i.fields.map((s)=>r.jsxDEV("label",{htmlFor:`setting-${i.id}-${s.name}`,className:o("",c.field),children:[r.jsxDEV("span",{className:o("",c.formLabel),children:s.label},void 0,!1,void 0,this),s.control==="checkbox"?r.jsxDEV(X,{id:`setting-${i.id}-${s.name}`,name:s.name,defaultChecked:s.value===!0},void 0,!1,void 0,this):r.jsxDEV(Y,{id:`setting-${i.id}-${s.name}`,name:s.name,type:Ae(s),required:s.required&&(!i.configured||s.secret)&&!s.set,defaultValue:s.secret?"":typeof s.value==="string"||typeof s.value==="number"?s.value:"",placeholder:s.secret&&s.set?"Stored — leave blank to keep":void 0,autoComplete:"off"},void 0,!1,void 0,this)]},s.name,!0,void 0,this)),r.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:[r.jsxDEV(V,{type:"submit",tone:"primary",disabled:n.busy,children:"Save settings"},void 0,!1,void 0,this),i.configured?r.jsxDEV(y,{variant:"danger",disabled:n.busy,type:"button",onClick:()=>n.removeSettings(i),children:"Remove"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},`${i.id}:${i.revision??"unset"}`,!0,void 0,this)]},i.id,!0,void 0,this))]},void 0,!0,void 0,this)}function Ce(e){let{account:t,actions:n}=e,{busy:i}=n;return r.jsxDEV("div",{className:o("",c.column),children:[r.jsxDEV(x,{title:"Sign-in",description:"Passkeys used to access this account. Your final passkey is protected from revocation.",children:[t.passkeys.map((s)=>r.jsxDEV(R,{kind:s.credentialBackedUp?"Synced passkey":"Device passkey",metadata:[`Added: ${L(s.createdAt,!0)}`],action:t.passkeys.length>1?r.jsxDEV(y,{variant:"danger",disabled:i,type:"button",onClick:()=>n.revokePasskey(s.id),children:"Revoke"},void 0,!1,void 0,this):void 0},s.id,!1,void 0,this)),r.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:r.jsxDEV(y,{variant:"outline",disabled:i,type:"button",onClick:n.addPasskey,children:"Add passkey"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r.jsxDEV(x,{title:"Signed-in sessions",children:t.sessions.map((s)=>r.jsxDEV(R,{kind:s.current?"This session":"Browser session",metadata:[`Started: ${L(s.createdAt)}`,...s.current?["Current browser"]:[]],action:!s.current?r.jsxDEV(y,{variant:"danger",disabled:i,type:"button",onClick:()=>n.revokeSession(s.id),children:"End"},void 0,!1,void 0,this):void 0},s.id,!1,void 0,this))},void 0,!1,void 0,this),r.jsxDEV("footer",{className:o("account-session-actions",c.footer),children:[r.jsxDEV("small",{children:"Access changes require an Admin."},void 0,!1,void 0,this),r.jsxDEV("div",{className:o("",c.actions),children:[r.jsxDEV(V,{disabled:i||t.sessions.every((s)=>s.current),onClick:n.revokeOtherSessions,children:"End other sessions"},void 0,!1,void 0,this),r.jsxDEV(V,{tone:"danger",disabled:i,onClick:n.revokeAllSessions,children:"Sign out everywhere"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Pe=v(Z(),1);var u={clients:{k1xSpc:"xrvj5dj",kumcoG:"x12p5jtz",kOIVth:"x1af02g3",k7Eaqz:"xeuugli",$$css:!0},client:{k7Eaqz:"xeuugli",k1xSpc:"xrvj5dj",kfiyM8:"x10ukxgv",kOIVth:"x883omv",kmVPX3:"x1np1h16",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"xy1lt07",kaIpWk:"xur7f20",kWkggS:"x18s3upu",$$css:!0},clientName:{kogj98:"x1ghz6dp",kMv6JI:"x5ddh9m",kGuDYH:"xif65rj",k63SB2:"x1s688f",kMwMTN:"xqvuw85",$$css:!0},text:{kogj98:"x1ghz6dp",kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",kLWn49:"x1dbl2gt",kMwMTN:"x1ar3pfp",$$css:!0},steps:{kogj98:"x1ghz6dp",kE3dHu:"x5tiur9",kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",kLWn49:"x1dbl2gt",kMwMTN:"x1ar3pfp",$$css:!0},fields:{k1xSpc:"xrvj5dj",kumcoG:"x16lqc3j",kOIVth:"x1vtxxvk",kogj98:"x1ghz6dp",kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",$$css:!0},field:{k1xSpc:"xjp7ctv",$$css:!0},fieldLabel:{k63SB2:"x1s688f",kMwMTN:"xqvuw85",$$css:!0},fieldValue:{kogj98:"x1ghz6dp",k7Eaqz:"xeuugli",kHjlTd:"xj0a0fe",kMwMTN:"x1ar3pfp",$$css:!0},code:{kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kMwMTN:"xqvuw85",kWkggS:"xbslqsl",kaIpWk:"x12oqio5",kmVPX3:"x1nyoefi",$$css:!0},snippet:{k1xSpc:"x78zum5",kGNEyG:"x1cy8zhl",kOIVth:"x167g77z",k7Eaqz:"xeuugli",$$css:!0},snippetCode:{kUk6DE:"x98rzlu",k7Eaqz:"xeuugli",kogj98:"x1ghz6dp",kmVPX3:"x6yrr3s",kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kLWn49:"x1jjo3f5",kMwMTN:"xqvuw85",kWkggS:"xbslqsl",kaIpWk:"x1kogg8i",khDVqt:"x1sdyfia",kXHlph:"xw2csxc",$$css:!0},developer:{k7Eaqz:"xeuugli",kmVPX3:"x1d8yrva",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"xy1lt07",kaIpWk:"xur7f20",$$css:!0},developerSummary:{kkrTdU:"x1ypdohk",kMv6JI:"x5ddh9m",kGuDYH:"xif65rj",k63SB2:"x1s688f",kMwMTN:"xqvuw85",$$css:!0},developerClients:{keoZOQ:"x1hmvnq2",kumcoG:"x1mkdm3x",$$css:!0},developerHint:{k1xSpc:"x1lliihq",keoZOQ:"x1gslohp",k63SB2:"xo1l8bm",kGuDYH:"xfifm61",kMwMTN:"x1ar3pfp",$$css:!0}};function re(e){return new URL(e).host.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ie(e){return JSON.stringify(e,null,2)}function Ne(e,t,n){return["Already have servers there? Add only the ",{code:`"${n}"`}," entry inside ",{code:`"${t}"`},` of ${e}.`]}function Te(e){let t=re(e),n="Sign in with your passkey when asked.";return[{id:"claude",group:"primary",name:"Claude",note:["Desktop app and claude.ai."],steps:[["Open Settings → Connectors → Add custom connector."],["Name it ",{code:t}," and paste your brain’s address."],["Sign in with your passkey when asked."]]},{id:"chatgpt",group:"primary",name:"ChatGPT",steps:[["Open Settings → Apps & Connectors → Advanced and turn on Developer mode."],["Choose Create, name it ",{code:t},", paste your brain’s address and pick OAuth."],["Sign in with your passkey when asked."]]},{id:"claude-code",group:"developer",name:"Claude Code",lead:[["Add the server in your terminal:"]],snippet:{label:"Claude Code command",code:`claude mcp add --transport http ${t} ${e}`},after:[["Then start Claude Code, run ",{code:"/mcp"},", choose ",{code:t}," and sign in with your passkey."]]},{id:"cursor",group:"developer",name:"Cursor",steps:[["Open Cursor Settings → MCP → Add new global MCP server."],["Name it ",{code:t}," and paste your brain’s address."],["Sign in with your passkey when Cursor asks."]],lead:[["Or add it to ",{code:"~/.cursor/mcp.json"},":"]],snippet:{label:"Cursor configuration",code:ie({mcpServers:{[t]:{url:e}}})},after:[Ne("the file","mcpServers",t)]},{id:"vscode",group:"developer",name:"VS Code",steps:[["Open the Command Palette and run ",{code:"MCP: Add Server"},"."],["Choose HTTP, paste your brain’s address and name it ",{code:t},"."],["Choose Global, then sign in with your passkey when asked."]],lead:[["Or run ",{code:"MCP: Open User Configuration"}," and add:"]],snippet:{label:"VS Code configuration",code:ie({servers:{[t]:{type:"http",url:e}}})},after:[Ne("your user configuration","servers",t)]},{id:"other",group:"developer",name:"Any other MCP client",inlineName:"any other MCP client",note:["Look for “add MCP server”, “connector” or “integration” in the tool’s settings and fill in:"],fields:[{label:"Name",value:[{code:t}]},{label:"Type",value:["Remote server, Streamable HTTP — not stdio, not SSE"]},{label:"URL",value:[{code:e}]},{label:"Authentication",value:["OAuth. Leave API key, token, client ID and secret empty; the tool registers itself."]}],lead:[["When you connect, your browser opens “Authorize <tool>?” on your brain. Approve MCP access with your passkey. The tool then has two tools: ",{code:"chat"},", to ask your brain anything as you would in chat, and ",{code:"confirm"},", to approve changes when the brain asks."],["Tool only takes local (stdio) servers, or insists on an API key? Bridge it with ",{code:"mcp-remote"},", which handles the sign-in:"]],snippet:{label:"mcp-remote bridge configuration",code:ie({mcpServers:{[t]:{command:"npx",args:["-y","mcp-remote",e]}}})}}]}var l=v(T(),1);function G(e){return l.jsxDEV(l.Fragment,{children:e.text.map((t,n)=>typeof t==="string"?t:l.jsxDEV("code",{className:o("",u.code),children:t.code},n,!1,void 0,this))},void 0,!1,void 0,this)}function j(e){let[t,n]=Pe.useState("idle"),i=async()=>{try{await navigator.clipboard.writeText(e.code),n("copied")}catch{n("unavailable")}};return l.jsxDEV("div",{className:o("ai-tools-snippet",u.snippet),children:[l.jsxDEV("pre",{className:o("",u.snippetCode),"aria-label":e.label,children:e.code},void 0,!1,void 0,this),l.jsxDEV(y,{variant:"outline",size:"sm",onClick:()=>void i(),"aria-label":`Copy ${e.label}`,children:t==="copied"?"Copied":t==="unavailable"?"Select to copy":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function W(e){let{client:t}=e;return l.jsxDEV("article",{className:o("ai-tools-client",u.client),children:[l.jsxDEV("h4",{className:o("",u.clientName),children:t.name},void 0,!1,void 0,this),t.note?l.jsxDEV("p",{className:o("",u.text),children:l.jsxDEV(G,{text:t.note},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,t.steps?l.jsxDEV("ol",{className:o("",u.steps),children:t.steps.map((n,i)=>l.jsxDEV("li",{children:l.jsxDEV(G,{text:n},void 0,!1,void 0,this)},i,!1,void 0,this))},void 0,!1,void 0,this):null,t.fields?l.jsxDEV("dl",{className:o("",u.fields),children:t.fields.map((n)=>l.jsxDEV("div",{className:o("",u.field),children:[l.jsxDEV("dt",{className:o("",u.fieldLabel),children:n.label},void 0,!1,void 0,this),l.jsxDEV("dd",{className:o("",u.fieldValue),children:l.jsxDEV(G,{text:n.value},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},n.label,!0,void 0,this))},void 0,!1,void 0,this):null,t.lead?.map((n,i)=>l.jsxDEV("p",{className:o("",u.text),children:l.jsxDEV(G,{text:n},void 0,!1,void 0,this)},`lead-${i}`,!1,void 0,this)),t.snippet?l.jsxDEV(j,{...t.snippet},void 0,!1,void 0,this):null,t.after?.map((n,i)=>l.jsxDEV("p",{className:o("",u.text),children:l.jsxDEV(G,{text:n},void 0,!1,void 0,this)},`after-${i}`,!1,void 0,this))]},void 0,!0,void 0,this)}function Qe(e){return e.length<2?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`}function $e(e){let t=Te(e.mcpUrl),n=t.filter((s)=>s.group==="primary"),i=t.filter((s)=>s.group==="developer");return l.jsxDEV(x,{title:"AI tools",description:"Connect AI tools you already use to this brain. A connected tool talks to the brain as you do in chat — asking, saving and updating within your access — after you sign in with your passkey.",children:[l.jsxDEV("article",{className:o("ai-tools-address",u.client),children:[l.jsxDEV("h4",{className:o("",u.clientName),children:"Your brain’s address"},void 0,!1,void 0,this),l.jsxDEV(j,{label:"brain address",code:e.mcpUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("div",{className:o("ai-tools-clients",u.clients),children:n.map((s)=>l.jsxDEV(W,{client:s},s.id,!1,void 0,this))},void 0,!1,void 0,this),l.jsxDEV("details",{className:o("ai-tools-developer",u.developer),children:[l.jsxDEV("summary",{className:o("",u.developerSummary),children:["Developer tools and other clients",l.jsxDEV("span",{className:o("",u.developerHint),children:Qe(i.map((s)=>s.inlineName??s.name))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.jsxDEV("div",{className:o("ai-tools-clients",u.clients,u.developerClients),children:i.map((s)=>l.jsxDEV(W,{client:s},s.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Ee=v(Z(),1);var ce="Enter the username and password of an app password from this page.";function Oe(e){let t=new URL(e),n=`${t.protocol==="https:"?"davs":"dav"}://${t.host}${t.pathname}`,i=re(e);return[{id:"macos",group:"file-manager",name:"macOS",note:["Finder, on any Mac."],steps:[["In Finder, choose Go → Connect to Server (⌘K)."],["Paste the address below and click Connect."],["Choose Registered User. ",ce]],snippet:{label:"macOS address",code:e}},{id:"windows",group:"file-manager",name:"Windows",note:["File Explorer, on Windows 10 and 11."],steps:[["In File Explorer, open This PC and choose Map network drive."],["Paste the address below as the folder, tick Connect using different credentials, and click Finish."],[ce]],snippet:{label:"Windows address",code:e}},{id:"gnome-files",group:"file-manager",name:"GNOME Files",note:["The file manager on Ubuntu, Fedora and other GNOME desktops."],steps:[["Open Files → Other Locations (or Network)."],["Under Connect to Server, enter the address below and connect."],[ce]],snippet:{label:"GNOME Files address",code:n}},{id:"rclone",group:"command-line",name:"rclone",note:["Linux, macOS and Windows, from a terminal."],lead:[["Store the drive as a remote, with your app password’s username and password:"]],snippet:{label:"rclone remote command",code:`rclone config create ${i} webdav url=${e} vendor=other user=YOUR_USERNAME pass=YOUR_PASSWORD --obscure`},after:[["Then mount it on an empty folder: ",{code:`rclone mount ${i}: ~/Brain --vfs-cache-mode writes`},"."]]}]}var d=v(T(),1),Q="app-password-label",Me="app-password-write";function le(e){return L(e).slice(0,10)}function et(e,t){return[`Created: ${le(e.createdAt)}`,`${e.expiresAt<=t?"Expired":"Expires"}: ${le(e.expiresAt)}`,e.lastUsedAt===void 0?"Never used":`Last used: ${le(e.lastUsedAt)}`]}function Re(e){let{account:t,actions:n}=e,{busy:i,createdAppPassword:s}=n,h=Math.floor(Date.now()/1000),[g,C]=Ee.useState(!1),N=Oe(e.davUrl),S=N.filter((p)=>p.group==="file-manager"),w=N.filter((p)=>p.group==="command-line");return d.jsxDEV("div",{className:o("",c.column),children:[d.jsxDEV(x,{title:"Drive",description:"Mount this brain as a network drive. It shows the notes, posts and files you can see here, as folders and files, to open and edit on your computer.",children:d.jsxDEV("article",{className:o("drive-address",u.client),children:[d.jsxDEV("h4",{className:o("",u.clientName),children:"Your brain’s drive address"},void 0,!1,void 0,this),d.jsxDEV(j,{label:"drive address",code:e.davUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),d.jsxDEV(x,{title:"App passwords",description:"A mount signs in with an app password instead of your passkey. It works only for the drive, expires after a year and can be revoked here. It can only read unless you allow saving changes.",children:[s?d.jsxDEV("article",{"data-app-password-reveal":!0,className:o("drive-reveal",u.client),children:[d.jsxDEV("h4",{className:o("",u.clientName),children:"Your new app password"},void 0,!1,void 0,this),d.jsxDEV("p",{className:o("",u.text),children:"Copy both now. The password is shown only once."},void 0,!1,void 0,this),d.jsxDEV(j,{label:"username",code:s.username},void 0,!1,void 0,this),d.jsxDEV(j,{label:"password",code:s.password},void 0,!1,void 0,this),d.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:d.jsxDEV(y,{variant:"outline",type:"button",onClick:n.dismissCreatedAppPassword,children:"Done"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,t.appPasswords.length===0?d.jsxDEV("p",{className:o("",u.text),children:"No app passwords yet."},void 0,!1,void 0,this):t.appPasswords.map((p)=>d.jsxDEV(R,{kind:p.label,description:`${p.username} · ${p.access==="write"?"Read and write":"Read-only"}`,metadata:et(p,h),action:d.jsxDEV(y,{variant:"danger",disabled:i,type:"button",onClick:()=>n.revokeAppPassword(p.id),children:"Revoke"},void 0,!1,void 0,this)},p.id,!1,void 0,this)),d.jsxDEV("form",{className:o("name-form",c.form),onSubmit:(p)=>{p.preventDefault();let M=p.currentTarget,O=String(new FormData(M).get(Q)??"");if(O.trim()==="")return;n.createAppPassword(O.trim(),g?"write":"read"),M.reset(),C(!1)},children:[d.jsxDEV("label",{htmlFor:Q,className:o("",c.field),children:[d.jsxDEV("span",{className:o("",c.formLabel),children:"Name it after the computer it is for"},void 0,!1,void 0,this),d.jsxDEV(Y,{id:Q,name:Q,type:"text",required:!0,maxLength:100,placeholder:"Laptop",autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),d.jsxDEV("label",{htmlFor:Me,className:o("",c.field),children:[d.jsxDEV("span",{className:o("",c.formLabel),children:"Allow saving changes"},void 0,!1,void 0,this),d.jsxDEV(X,{id:Me,"aria-label":"Allow saving changes",checked:g,onCheckedChange:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this),d.jsxDEV("div",{className:o("people-inline-actions",c.inlineActions),children:d.jsxDEV(y,{variant:"outline",disabled:i,type:"submit",children:"New app password"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d.jsxDEV(x,{title:"Connect your computer",description:"Use your computer’s own file manager. The brain then appears as a drive beside your other folders.",children:[d.jsxDEV("div",{className:o("drive-clients",u.clients),children:S.map((p)=>d.jsxDEV(W,{client:p},p.id,!1,void 0,this))},void 0,!1,void 0,this),d.jsxDEV("details",{className:o("drive-command-line",u.developer),children:[d.jsxDEV("summary",{className:o("",u.developerSummary),children:["Command line",d.jsxDEV("span",{className:o("",u.developerHint),children:w.map((p)=>p.name).join(", ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),d.jsxDEV("div",{className:o("drive-command-line-clients",u.clients,u.developerClients),children:w.map((p)=>d.jsxDEV(W,{client:p},p.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var k=v(Z(),1);var ee={revokePasskey:{title:"Revoke this passkey?",message:"You will not be able to use this passkey again.",confirmLabel:"Revoke passkey",pending:"Revoking passkey…",complete:"Passkey revoked."},revokeSession:{title:"End this browser session?",message:"That browser will need a passkey to sign in again.",confirmLabel:"End session",pending:"Ending session…",complete:"Session ended."},revokeAppPassword:{title:"Revoke this app password?",message:"Anything mounted with it stops working at once. Its password cannot be recovered.",confirmLabel:"Revoke app password",pending:"Revoking app password…",complete:"App password revoked."},revokeOtherSessions:{title:"End every other browser session?",message:"Your current browser will remain signed in.",confirmLabel:"End other sessions",pending:"Ending other sessions…",complete:"Other sessions ended."}};function Ie(e){return De(e,"Account request failed")}function Ue(e){let{client:t,initialAccount:n}=e,[i,s]=k.useState(n),[h,g]=k.useState(n?.displayName??e.initialDisplayName),[C,N]=k.useState(""),[S,w]=k.useState(!1),[p,M]=k.useState(!1),[O,z]=k.useState(null),[Ve,ue]=k.useState(null);k.useEffect(()=>{if(n)return;let m=!1;return t.fetchAccount().then((b)=>{if(m)return;s(b),g(b.displayName)}).catch((b)=>{if(m)return;w(!0),N(Ie(b))}),()=>{m=!0}},[t,n]);let E=k.useCallback(async(m,b,U)=>{M(!0),w(!1),N(m);try{let q=await U();if(q)s(q),g(q.displayName);N(b)}catch(q){w(!0),N(Ie(q))}finally{M(!1)}},[]),de=async(m)=>(await t.mutateAccount(m)).account,_=(m,b)=>z({title:m.title,message:m.message,confirmLabel:m.confirmLabel,action:()=>{E(m.pending,m.complete,()=>de(b))}});return{account:i,displayName:h,setDisplayName:g,status:C,error:S,busy:p,confirmation:O,cancelConfirmation:()=>z(null),confirm:()=>{if(!O)return;z(null),O.action()},saveName:()=>{E("Saving…","Display name updated.",()=>de({action:A.updateDisplayName,confirmation:A.updateDisplayName,displayName:h}))},addPasskey:()=>{E("Waiting for your authenticator…","Passkey added.",()=>t.registerPasskey())},revokePasskey:(m)=>_(ee.revokePasskey,{action:A.revokePasskey,confirmation:A.revokePasskey,credentialId:m}),revokeSession:(m)=>_(ee.revokeSession,{action:A.revokeSession,confirmation:A.revokeSession,sessionId:m}),revokeOtherSessions:()=>_(ee.revokeOtherSessions,{action:A.revokeOtherSessions,confirmation:A.revokeOtherSessions}),revokeAllSessions:()=>z({title:"Sign out everywhere?",message:"This ends every session, including this one. You will need your passkey to return.",confirmLabel:"Sign out everywhere",action:()=>{E("Signing out everywhere…","Signed out.",async()=>{await t.mutateAccount({action:A.revokeAllSessions,confirmation:A.revokeAllSessions}),window.location.assign(`/login?return_to=${encodeURIComponent(e.routePath)}`);return})}}),saveSettings:(m,b)=>{let U=ye(m.fields,b);E(`Saving ${m.title}…`,`${m.title} updated.`,()=>t.mutatePluginSettings({action:"save",definitionId:m.id,values:U}))},createdAppPassword:Ve,createAppPassword:(m,b)=>{E("Creating app password…","App password created.",async()=>{let U=await t.mutateAccount({action:A.createAppPassword,confirmation:A.createAppPassword,label:m,...b==="write"?{access:b}:{}});return ue(U.appPassword??null),U.account})},dismissCreatedAppPassword:()=>ue(null),revokeAppPassword:(m)=>_(ee.revokeAppPassword,{action:A.revokeAppPassword,confirmation:A.revokeAppPassword,appPasswordId:m}),removeSettings:(m)=>z({title:`Remove ${m.title}?`,message:"The stored settings for this integration will be removed from your account only.",confirmLabel:"Remove settings",action:()=>{E(`Removing ${m.title}…`,`${m.title} removed.`,()=>t.mutatePluginSettings({action:"delete",definitionId:m.id}))}})}}var f=v(T(),1),tt=["profile","security","identities","settings",B,F];function nt(e){let t=tt.find((n)=>n===e.initialSection);if(!t||t===B&&!e.mcpUrl||t===F&&!e.davUrl)return"profile";return t}function ot(e){let t=["your profile","sign-in security","linked identities",...e.settings?["personal settings"]:[],...e.aiTools?["AI tools"]:[],...e.drive?["your drive"]:[]];return`Your account on this brain. Manage ${`${t.slice(0,-1).join(", ")} and ${t.at(-1)}`} here—not shared services or other people’s access.`}function on({bootstrap:e,initialAccount:t,client:n}){let i=Fe(),s=te.useMemo(()=>n??new se({fetch:i.fetch}),[n,i]),h=Ue({client:s,initialAccount:t,initialDisplayName:e.displayName,routePath:e.routePath}),{account:g,status:C,error:N,busy:S,confirmation:w}=h,[p,M]=te.useState(()=>nt(e)),O=g?.displayName??e.displayName;return f.jsxDEV(f.Fragment,{children:[f.jsxDEV("div",{className:o("account-shell",c.shell,ze.inset),children:[f.jsxDEV(He,{model:{access:qe("public"),title:"Your account",totals:[]}},void 0,!1,void 0,this),f.jsxDEV("p",{className:o("account-scope",c.description),children:ot({settings:(g?.pluginSettings.length??0)>0,aiTools:Boolean(e.mcpUrl),drive:Boolean(e.davUrl)})},void 0,!1,void 0,this),f.jsxDEV("p",{className:o(`account-status${N?" is-error":""}`,c.feedback,N&&c.feedbackError),role:"status","aria-live":"polite",children:C},void 0,!1,void 0,this),!g?f.jsxDEV("p",{className:o("account-loading",c.loading),children:"Reading your account…"},void 0,!1,void 0,this):f.jsxDEV(je,{className:"account-details",value:p,onValueChange:M,children:[f.jsxDEV(Be,{"aria-label":"Account sections",className:o("account-tabs",c.tabs),children:[f.jsxDEV(I,{value:"profile",disabled:S,children:"Profile"},void 0,!1,void 0,this),f.jsxDEV(I,{value:"security",disabled:S,children:"Sign-in & sessions"},void 0,!1,void 0,this),f.jsxDEV(I,{value:"identities",disabled:S,children:"Linked identities"},void 0,!1,void 0,this),g.pluginSettings.length>0&&f.jsxDEV(I,{value:"settings",disabled:S,children:"Personal settings"},void 0,!1,void 0,this),e.mcpUrl&&f.jsxDEV(I,{value:B,disabled:S,children:"AI tools"},void 0,!1,void 0,this),e.davUrl&&f.jsxDEV(I,{value:F,disabled:S,children:"Drive"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f.jsxDEV(D,{value:"profile",forceMount:!0,hidden:p!=="profile",className:o("account-detail-sections",c.tabPanel),children:f.jsxDEV(Se,{account:g,actions:h,title:O,studioPath:e.studioPath},void 0,!1,void 0,this)},void 0,!1,void 0,this),f.jsxDEV(D,{value:"identities",forceMount:!0,hidden:p!=="identities",className:o("",c.tabPanel),children:f.jsxDEV(we,{account:g},void 0,!1,void 0,this)},void 0,!1,void 0,this),g.pluginSettings.length>0&&f.jsxDEV(D,{value:"settings",forceMount:!0,hidden:p!=="settings",className:o("",c.tabPanel),children:f.jsxDEV(xe,{account:g,actions:h},void 0,!1,void 0,this)},void 0,!1,void 0,this),f.jsxDEV(D,{value:"security",forceMount:!0,hidden:p!=="security",className:o("",c.tabPanel),children:f.jsxDEV(Ce,{account:g,actions:h},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.mcpUrl&&f.jsxDEV(D,{value:B,forceMount:!0,hidden:p!==B,className:o("",c.tabPanel),children:f.jsxDEV($e,{mcpUrl:e.mcpUrl},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.davUrl&&f.jsxDEV(D,{value:F,forceMount:!0,hidden:p!==F,className:o("",c.tabPanel),children:f.jsxDEV(Re,{davUrl:e.davUrl,account:g,actions:h},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),w&&f.jsxDEV(Le,{mark:"!",title:w.title,titleId:"account-confirmation-title",cancelLabel:"Cancel",confirmLabel:w.confirmLabel,confirmVariant:"danger",pending:S,onCancel:h.cancelConfirmation,onConfirm:h.confirm,children:f.jsxDEV("p",{children:w.message},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{on as AccountApp};
|
|
2
2
|
|
|
3
3
|
//# debugId=690D3B1C44CDDE6564756E2164756E21
|