@rizom/brain 0.2.0-alpha.871 → 0.2.0-alpha.872
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 +4 -4
- package/dist/chunks/{app-h3s5nje0.js → app-99rkqqg5.js} +2 -2
- package/dist/chunks/{index-bk4e0ddm.js → index-722vsjfh.js} +2 -2
- package/dist/chunks/{index-kkxxyma3.js → index-sz6zwm79.js} +3 -3
- package/dist/chunks/{index-kkxxyma3.js.map → index-sz6zwm79.js.map} +1 -1
- package/dist/chunks/{package-d4zjg8ft.js → package-bv30wgfz.js} +3 -3
- package/dist/chunks/{package-d4zjg8ft.js.map → package-bv30wgfz.js.map} +1 -1
- package/dist/model.js +4 -4
- package/dist/model.js.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/ui/{studio-app-5zxnadkd.js → studio-app-1edp4r57.js} +2 -2
- package/dist/ui/studio-asset-manifest.json +7 -7
- package/dist/ui/studio-chunks/main-6qe1jp8h.js +6 -0
- package/dist/ui/studio-chunks/{main-378jj9vt.js.map → main-6qe1jp8h.js.map} +4 -4
- package/dist/ui/studio-chunks/{studio-chat-workspace-sdgj4tp5.js → studio-chat-workspace-jw3pye8a.js} +1 -1
- package/package.json +1 -1
- package/dist/ui/studio-chunks/main-378jj9vt.js +0 -6
- /package/dist/chunks/{app-h3s5nje0.js.map → app-99rkqqg5.js.map} +0 -0
- /package/dist/chunks/{index-bk4e0ddm.js.map → index-722vsjfh.js.map} +0 -0
- /package/dist/ui/{studio-app-5zxnadkd.js.map → studio-app-1edp4r57.js.map} +0 -0
- /package/dist/ui/studio-chunks/{studio-chat-workspace-sdgj4tp5.js.map → studio-chat-workspace-jw3pye8a.js.map} +0 -0
package/dist/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ge as k,he as V,ie as U}from"./chunks/index-
|
|
2
|
+
import{ge as k,he as V,ie as U}from"./chunks/index-sz6zwm79.js";import{Ae as A,Be as x,bf as N,cf as O,df as z,ef as M,ff as q,gf as J,hf as L,je as E,jf as _,kf as j,me as I}from"./chunks/index-wete5qfn.js";import"./chunks/index-n3cy8ttx.js";import{of as D}from"./chunks/index-02pt9z7t.js";import{Ro as B,gj as C,rl as P,sg as h,sl as w}from"./chunks/index-gnbfdewj.js";import{cq as p}from"./chunks/index-m2qv3p6y.js";import{qu as S,su as v}from"./chunks/index-0k63cxm5.js";import"./chunks/index-rwrp530c.js";import"./chunks/index-njqkf4cd.js";import"./chunks/index-74vg6r70.js";import"./chunks/index-cyq5dhvm.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=182C576153C042E364756E2164756E21
|
|
5
5
|
//# sourceMappingURL=testing.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as eR,A as Ae,Aa as nI,B as j2,Ba as $0,C as py,Ca as Y0,D as $I,Da as U8,E as YI,Ea as JI,F as K8,G as _h,H as J8,I as Kt,J as Ro,K as g8,L as by,M as K2,N as J2,O as y8,P as b8,Q as Bn,R as v8,S as k8,T as S8,U as Qw,V as my,W as x8,X as w8,Y as tb,Z as nb,_ as Zd,a as _w,aa as X0,b as Yw,ba as $w,c as sz,ca as Yu,d as V8,da as Pp,e as G8,ea as qw,f as lz,fa as K0,g as M2,ga as Hz,h as R2,ha as Ze,i as O2,ia as Sw,j as dy,ja as DI,k as Xd,ka as Dz,l as sd,la as Cw,m as p8,ma as Gd,n as kw,na as xw,o as Q8,oa as Vz,p as Ip,pa as Gz,q as L2,qa as tI,r as N8,ra as ww,s as ab,sa as Wz,t as z8,ta as Qz,u as F8,ua as vw,v as bn,va as Fz,w as me,wa as Yz,x as U2,xa as Wd,y as La,ya as ib,z as P2,za as Xz}from"./studio-chunks/main-378jj9vt.js";import{Sa as Fd,Va as XI,Wa as KI}from"./studio-chunks/main-cjvg98dr.js";import{$a as As,$b as Y,Ab as vy,Bb as BI,Cb as Nw,Db as NI,Eb as zI,Fb as II,Gb as rr,Hb as HI,Jb as Ln,Kb as dd,Lb as Z8,Mb as e4,Nb as Xw,Ob as hn,Pb as bl,Qb as e0,Rb as Hu,Sb as Li,Tb as f0,Ub as fp,Vb as t0,Wb as _B,Xb as jB,Yb as $u,Zb as tB,_a as n4,_b as nB,ab as o4,ac as h0,bb as H0,bc as m0,cb as Xt,cc as Fx,db as or,dc as ju,eb as _8,ec as wz,fb as r4,fc as MI,gb as j8,gc as ez,hb as ub,ib as Mo,jb as m8,jc as Cz,kb as ba,lb,mb as Ku,nb as ob,ob as _p,pb as nr,rb as H8,sb as $8,tb as s4,ub as Zi,vb as jp,xb as Cu,yb as Q2,zb as Bw}from"./studio-chunks/main-d5szcfbq.js";import"./studio-chunks/main-t14ef5wt.js";import{Ac as _I,Cc as jI,Dc as VI,rc as QI,sc as FI,uc as W8}from"./studio-chunks/main-fqzf25fv.js";import{Ec as jn,Fc as Qn,Hc as TI,Ic as _2,Jc as ir}from"./studio-chunks/main-ggcgvxym.js";import{$c as UI,$d as uI,Bd as rb,Ed as Ww,Fd as O0,Gd as Gk,Hd as Pz,Lc as E,Nc as r8,Oc as fe,Pc as kI,Pd as Cs,Qc as xe,Rc as Eu,Rd as qi,Sc as wu,Sd as ud,Tc as cd,Td as Y8,Ud as Gp,Vc as Ma,Vd as _n,Wc as Ra,Wd as sb,Xc as yI,Xd as si,Yc as Oa,Yd as X8,Zc as bI,Zd as aI,_c as Nn,_d as Ew,ae as Do,be as l4,ce as a4,de as Nt,ed as PI,ee as lo,fd as T0,gd as D0,hd as M0,id as Bp,kd as SI,ld as wR,nd as N0,od as yR,pd as bR,rd as Wk,sd as Qk,td as di,ud as ie,vd as zn,xd as Tu}from"./studio-chunks/main-pqx64crr.js";import{Fe as Ii}from"./studio-chunks/main-7fyr0wv3.js";import{Rf as Xe,Tf as VH}from"./studio-chunks/main-y9skwxac.js";import{Cg as ky,xg as G,zg as jk}from"./studio-chunks/main-f886snck.js";var x2=jk(function(jH){(function(){function e(){if(_=!1,F){var K=jH.unstable_now();Z=K;var le=!0;try{e:{I=!1,H&&(H=!1,P(we),we=-1),T=!0;var se=D;try{t:{a(K);for(A=o(k);A!==null&&!(A.expirationTime>K&&d());){var ge=A.callback;if(typeof ge==="function"){A.callback=null,D=A.priorityLevel;var De=ge(A.expirationTime<=K);if(K=jH.unstable_now(),typeof De==="function"){A.callback=De,a(K),le=!0;break t}A===o(k)&&r(k),a(K)}else r(k);A=o(k)}if(A!==null)le=!0;else{var ct=o(S);ct!==null&&p(c,ct.startTime-K),le=!1}}break e}finally{A=null,D=se,T=!1}le=void 0}}finally{le?oe():F=!1}}}function n(K,le){var se=K.length;K.push(le);e:for(;0<se;){var ge=se-1>>>1,De=K[ge];if(0<l(De,le))K[ge]=le,K[se]=De,se=ge;else break e}}function o(K){return K.length===0?null:K[0]}function r(K){if(K.length===0)return null;var le=K[0],se=K.pop();if(se!==le){K[0]=se;e:for(var ge=0,De=K.length,ct=De>>>1;ge<ct;){var Et=2*(ge+1)-1,zt=K[Et],pe=Et+1,ze=K[pe];if(0>l(zt,se))pe<De&&0>l(ze,zt)?(K[ge]=ze,K[pe]=se,ge=pe):(K[ge]=zt,K[Et]=se,ge=Et);else if(pe<De&&0>l(ze,se))K[ge]=ze,K[pe]=se,ge=pe;else break e}}return le}function l(K,le){var se=K.sortIndex-le.sortIndex;return se!==0?se:K.id-le.id}function a(K){for(var le=o(S);le!==null;){if(le.callback===null)r(S);else if(le.startTime<=K)r(S),le.sortIndex=le.expirationTime,n(k,le);else break;le=o(S)}}function c(K){if(H=!1,a(K),!I)if(o(k)!==null)I=!0,F||(F=!0,oe());else{var le=o(S);le!==null&&p(c,le.startTime-K)}}function d(){return _?!0:jH.unstable_now()-Z<J?!1:!0}function p(K,le){we=L(function(){K(jH.unstable_now())},le)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),jH.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var m=performance;jH.unstable_now=function(){return m.now()}}else{var g=Date,b=g.now();jH.unstable_now=function(){return g.now()-b}}var k=[],S=[],C=1,A=null,D=3,T=!1,I=!1,H=!1,_=!1,L=typeof setTimeout==="function"?setTimeout:null,P=typeof clearTimeout==="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null,F=!1,we=-1,J=5,Z=-1;if(typeof Q==="function")var oe=function(){Q(e)};else if(typeof MessageChannel<"u"){var Te=new MessageChannel,Rt=Te.port2;Te.port1.onmessage=e,oe=function(){Rt.postMessage(null)}}else oe=function(){L(e,0)};jH.unstable_IdlePriority=5,jH.unstable_ImmediatePriority=1,jH.unstable_LowPriority=4,jH.unstable_NormalPriority=3,jH.unstable_Profiling=null,jH.unstable_UserBlockingPriority=2,jH.unstable_cancelCallback=function(K){K.callback=null},jH.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<K?Math.floor(1000/K):5},jH.unstable_getCurrentPriorityLevel=function(){return D},jH.unstable_next=function(K){switch(D){case 1:case 2:case 3:var le=3;break;default:le=D}var se=D;D=le;try{return K()}finally{D=se}},jH.unstable_requestPaint=function(){_=!0},jH.unstable_runWithPriority=function(K,le){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var se=D;D=K;try{return le()}finally{D=se}},jH.unstable_scheduleCallback=function(K,le,se){var ge=jH.unstable_now();switch(typeof se==="object"&&se!==null?(se=se.delay,se=typeof se==="number"&&0<se?ge+se:ge):se=ge,K){case 1:var De=-1;break;case 2:De=250;break;case 5:De=1073741823;break;case 4:De=1e4;break;default:De=5000}return De=se+De,K={id:C++,callback:le,priorityLevel:K,startTime:se,expirationTime:De,sortIndex:-1},se>ge?(K.sortIndex=se,n(S,K),o(k)===null&&K===o(S)&&(H?(P(we),we=-1):H=!0,p(c,se-ge))):(K.sortIndex=De,n(k,K),I||T||(I=!0,F||(F=!0,oe()))),K},jH.unstable_shouldYield=d,jH.unstable_wrapCallback=function(K){var le=D;return function(){var se=D;D=le;try{return K.apply(this,arguments)}finally{D=se}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var w2=jk(function(GH){var dt=G(x2()),od=G(Xe()),Vk=G(VH());(function(){function e(t,i){for(t=t.memoizedState;t!==null&&0<i;)t=t.next,i--;return t}function n(t,i,s,u){if(s>=i.length)return u;var f=i[s],h=Mn(t)?t.slice():Qe({},t);return h[f]=n(t[f],i,s+1,u),h}function o(t,i,s){if(i.length!==s.length)console.warn("copyWithRename() expects paths of the same length");else{for(var u=0;u<s.length-1;u++)if(i[u]!==s[u]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return r(t,i,s,0)}}function r(t,i,s,u){var f=i[u],h=Mn(t)?t.slice():Qe({},t);return u+1===i.length?(h[s[u]]=h[f],Mn(h)?h.splice(f,1):delete h[f]):h[f]=r(t[f],i,s,u+1),h}function l(t,i,s){var u=i[s],f=Mn(t)?t.slice():Qe({},t);if(s+1===i.length)return Mn(f)?f.splice(u,1):delete f[u],f;return f[u]=l(t[u],i,s+1),f}function a(){return!1}function c(){return null}function d(){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 m(){}function g(){}function b(t){var i=[];return t.forEach(function(s){i.push(s)}),i.sort().join(", ")}function k(t,i,s,u){return new L4(t,i,s,u)}function S(t,i){t.context===Yl&&(u1(t.current,2,i,t,null,null),mc())}function C(t,i){if(Wo!==null){var s=i.staleFamilies;i=i.updatedFamilies,Hf(),DC(t.current,i,s),mc()}}function A(t){Wo=t}function D(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function T(t){var i=t,s=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(s=i.return),t=i.return;while(t)}return i.tag===3?s:null}function I(t){if(t.tag===13){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function H(t){if(t.tag===31){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function _(t){if(T(t)!==t)throw Error("Unable to find node on an unmounted component.")}function L(t){var i=t.alternate;if(!i){if(i=T(t),i===null)throw Error("Unable to find node on an unmounted component.");return i!==t?null:t}for(var s=t,u=i;;){var f=s.return;if(f===null)break;var h=f.alternate;if(h===null){if(u=f.return,u!==null){s=u;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===s)return _(f),t;if(h===u)return _(f),i;h=h.sibling}throw Error("Unable to find node on an unmounted component.")}if(s.return!==u.return)s=f,u=h;else{for(var y=!1,v=f.child;v;){if(v===s){y=!0,s=f,u=h;break}if(v===u){y=!0,u=f,s=h;break}v=v.sibling}if(!y){for(v=h.child;v;){if(v===s){y=!0,s=h,u=f;break}if(v===u){y=!0,u=h,s=f;break}v=v.sibling}if(!y)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(s.alternate!==u)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(s.tag!==3)throw Error("Unable to find node on an unmounted component.");return s.stateNode.current===s?t:i}function P(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=P(t),i!==null)return i;t=t.sibling}return null}function Q(t){if(t===null||typeof t!=="object")return null;return t=zT&&t[zT]||t["@@iterator"],typeof t==="function"?t:null}function F(t){if(t==null)return null;if(typeof t==="function")return t.$$typeof===Z6?null:t.displayName||t.name||null;if(typeof t==="string")return t;switch(t){case xc:return"Fragment";case m1:return"Profiler";case rg:return"StrictMode";case y1:return"Suspense";case b1:return"SuspenseList";case v1:return"Activity"}if(typeof t==="object")switch(typeof t.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case Sc:return"Portal";case hs:return t.displayName||"Context";case g1:return(t._context.displayName||"Context")+".Consumer";case Qf:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case sg:return i=t.displayName||null,i!==null?i:F(t.type)||"Memo";case ko:i=t._payload,t=t._init;try{return F(t(i))}catch(s){}}return null}function we(t){return typeof t.tag==="number"?J(t):typeof t.name==="string"?t.name:null}function J(t){var i=t.type;switch(t.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(i._context.displayName||"Context")+".Consumer";case 10:return i.displayName||"Context";case 18:return"DehydratedFragment";case 11:return t=i.render,t=t.displayName||t.name||"",i.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return F(i);case 8:return i===rg?"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 i==="function")return i.displayName||i.name||null;if(typeof i==="string")return i;break;case 29:if(i=t._debugInfo,i!=null){for(var s=i.length-1;0<=s;s--)if(typeof i[s].name==="string")return i[s].name}if(t.return!==null)return J(t.return)}return null}function Z(t){return{current:t}}function oe(t,i){0>Fs?console.error("Unexpected pop."):(i!==S1[Fs]&&console.error("Unexpected Fiber popped."),t.current=k1[Fs],k1[Fs]=null,S1[Fs]=null,Fs--)}function Te(t,i,s){Fs++,k1[Fs]=t.current,S1[Fs]=s,t.current=i}function Rt(t){return t===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),t}function K(t,i){Te(jl,i,t),Te(Ff,t,t),Te(_l,null,t);var s=i.nodeType;switch(s){case 9:case 11:s=s===9?"#document":"#fragment",i=(i=i.documentElement)?(i=i.namespaceURI)?rT(i):al:al;break;default:if(s=i.tagName,i=i.namespaceURI)i=rT(i),i=sT(i,s);else switch(s){case"svg":i=nd;break;case"math":i=oy;break;default:i=al}}s=s.toLowerCase(),s=Zw(null,s),s={context:i,ancestorInfo:s},oe(_l,t),Te(_l,s,t)}function le(t){oe(_l,t),oe(Ff,t),oe(jl,t)}function se(){return Rt(_l.current)}function ge(t){t.memoizedState!==null&&Te(lg,t,t);var i=Rt(_l.current),s=t.type,u=sT(i.context,s);s=Zw(i.ancestorInfo,s),u={context:u,ancestorInfo:s},i!==u&&(Te(Ff,t,t),Te(_l,u,t))}function De(t){Ff.current===t&&(oe(_l,t),oe(Ff,t)),lg.current===t&&(oe(lg,t),qh._currentValue=Su)}function ct(){}function Et(){if(Yf===0){IT=console.log,HT=console.info,$T=console.warn,qT=console.error,UT=console.group,PT=console.groupCollapsed,_T=console.groupEnd;var t={configurable:!0,enumerable:!0,value:ct,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}Yf++}function zt(){if(Yf--,Yf===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Qe({},t,{value:IT}),info:Qe({},t,{value:HT}),warn:Qe({},t,{value:$T}),error:Qe({},t,{value:qT}),group:Qe({},t,{value:UT}),groupCollapsed:Qe({},t,{value:PT}),groupEnd:Qe({},t,{value:_T})})}0>Yf&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function pe(t){var i=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,t=t.stack,Error.prepareStackTrace=i,t.startsWith(`Error: react-stack-top-frame
|
|
1
|
+
import{$ as eR,A as Ae,Aa as nI,B as j2,Ba as $0,C as py,Ca as Y0,D as $I,Da as U8,E as YI,Ea as JI,F as K8,G as _h,H as J8,I as Kt,J as Ro,K as g8,L as by,M as K2,N as J2,O as y8,P as b8,Q as Bn,R as v8,S as k8,T as S8,U as Qw,V as my,W as x8,X as w8,Y as tb,Z as nb,_ as Zd,a as _w,aa as X0,b as Yw,ba as $w,c as sz,ca as Yu,d as V8,da as Pp,e as G8,ea as qw,f as lz,fa as K0,g as M2,ga as Hz,h as R2,ha as Ze,i as O2,ia as Sw,j as dy,ja as DI,k as Xd,ka as Dz,l as sd,la as Cw,m as p8,ma as Gd,n as kw,na as xw,o as Q8,oa as Vz,p as Ip,pa as Gz,q as L2,qa as tI,r as N8,ra as ww,s as ab,sa as Wz,t as z8,ta as Qz,u as F8,ua as vw,v as bn,va as Fz,w as me,wa as Yz,x as U2,xa as Wd,y as La,ya as ib,z as P2,za as Xz}from"./studio-chunks/main-6qe1jp8h.js";import{Sa as Fd,Va as XI,Wa as KI}from"./studio-chunks/main-cjvg98dr.js";import{$a as As,$b as Y,Ab as vy,Bb as BI,Cb as Nw,Db as NI,Eb as zI,Fb as II,Gb as rr,Hb as HI,Jb as Ln,Kb as dd,Lb as Z8,Mb as e4,Nb as Xw,Ob as hn,Pb as bl,Qb as e0,Rb as Hu,Sb as Li,Tb as f0,Ub as fp,Vb as t0,Wb as _B,Xb as jB,Yb as $u,Zb as tB,_a as n4,_b as nB,ab as o4,ac as h0,bb as H0,bc as m0,cb as Xt,cc as Fx,db as or,dc as ju,eb as _8,ec as wz,fb as r4,fc as MI,gb as j8,gc as ez,hb as ub,ib as Mo,jb as m8,jc as Cz,kb as ba,lb,mb as Ku,nb as ob,ob as _p,pb as nr,rb as H8,sb as $8,tb as s4,ub as Zi,vb as jp,xb as Cu,yb as Q2,zb as Bw}from"./studio-chunks/main-d5szcfbq.js";import"./studio-chunks/main-t14ef5wt.js";import{Ac as _I,Cc as jI,Dc as VI,rc as QI,sc as FI,uc as W8}from"./studio-chunks/main-fqzf25fv.js";import{Ec as jn,Fc as Qn,Hc as TI,Ic as _2,Jc as ir}from"./studio-chunks/main-ggcgvxym.js";import{$c as UI,$d as uI,Bd as rb,Ed as Ww,Fd as O0,Gd as Gk,Hd as Pz,Lc as E,Nc as r8,Oc as fe,Pc as kI,Pd as Cs,Qc as xe,Rc as Eu,Rd as qi,Sc as wu,Sd as ud,Tc as cd,Td as Y8,Ud as Gp,Vc as Ma,Vd as _n,Wc as Ra,Wd as sb,Xc as yI,Xd as si,Yc as Oa,Yd as X8,Zc as bI,Zd as aI,_c as Nn,_d as Ew,ae as Do,be as l4,ce as a4,de as Nt,ed as PI,ee as lo,fd as T0,gd as D0,hd as M0,id as Bp,kd as SI,ld as wR,nd as N0,od as yR,pd as bR,rd as Wk,sd as Qk,td as di,ud as ie,vd as zn,xd as Tu}from"./studio-chunks/main-pqx64crr.js";import{Fe as Ii}from"./studio-chunks/main-7fyr0wv3.js";import{Rf as Xe,Tf as VH}from"./studio-chunks/main-y9skwxac.js";import{Cg as ky,xg as G,zg as jk}from"./studio-chunks/main-f886snck.js";var x2=jk(function(jH){(function(){function e(){if(_=!1,F){var K=jH.unstable_now();Z=K;var le=!0;try{e:{I=!1,H&&(H=!1,P(we),we=-1),T=!0;var se=D;try{t:{a(K);for(A=o(k);A!==null&&!(A.expirationTime>K&&d());){var ge=A.callback;if(typeof ge==="function"){A.callback=null,D=A.priorityLevel;var De=ge(A.expirationTime<=K);if(K=jH.unstable_now(),typeof De==="function"){A.callback=De,a(K),le=!0;break t}A===o(k)&&r(k),a(K)}else r(k);A=o(k)}if(A!==null)le=!0;else{var ct=o(S);ct!==null&&p(c,ct.startTime-K),le=!1}}break e}finally{A=null,D=se,T=!1}le=void 0}}finally{le?oe():F=!1}}}function n(K,le){var se=K.length;K.push(le);e:for(;0<se;){var ge=se-1>>>1,De=K[ge];if(0<l(De,le))K[ge]=le,K[se]=De,se=ge;else break e}}function o(K){return K.length===0?null:K[0]}function r(K){if(K.length===0)return null;var le=K[0],se=K.pop();if(se!==le){K[0]=se;e:for(var ge=0,De=K.length,ct=De>>>1;ge<ct;){var Et=2*(ge+1)-1,zt=K[Et],pe=Et+1,ze=K[pe];if(0>l(zt,se))pe<De&&0>l(ze,zt)?(K[ge]=ze,K[pe]=se,ge=pe):(K[ge]=zt,K[Et]=se,ge=Et);else if(pe<De&&0>l(ze,se))K[ge]=ze,K[pe]=se,ge=pe;else break e}}return le}function l(K,le){var se=K.sortIndex-le.sortIndex;return se!==0?se:K.id-le.id}function a(K){for(var le=o(S);le!==null;){if(le.callback===null)r(S);else if(le.startTime<=K)r(S),le.sortIndex=le.expirationTime,n(k,le);else break;le=o(S)}}function c(K){if(H=!1,a(K),!I)if(o(k)!==null)I=!0,F||(F=!0,oe());else{var le=o(S);le!==null&&p(c,le.startTime-K)}}function d(){return _?!0:jH.unstable_now()-Z<J?!1:!0}function p(K,le){we=L(function(){K(jH.unstable_now())},le)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),jH.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var m=performance;jH.unstable_now=function(){return m.now()}}else{var g=Date,b=g.now();jH.unstable_now=function(){return g.now()-b}}var k=[],S=[],C=1,A=null,D=3,T=!1,I=!1,H=!1,_=!1,L=typeof setTimeout==="function"?setTimeout:null,P=typeof clearTimeout==="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null,F=!1,we=-1,J=5,Z=-1;if(typeof Q==="function")var oe=function(){Q(e)};else if(typeof MessageChannel<"u"){var Te=new MessageChannel,Rt=Te.port2;Te.port1.onmessage=e,oe=function(){Rt.postMessage(null)}}else oe=function(){L(e,0)};jH.unstable_IdlePriority=5,jH.unstable_ImmediatePriority=1,jH.unstable_LowPriority=4,jH.unstable_NormalPriority=3,jH.unstable_Profiling=null,jH.unstable_UserBlockingPriority=2,jH.unstable_cancelCallback=function(K){K.callback=null},jH.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<K?Math.floor(1000/K):5},jH.unstable_getCurrentPriorityLevel=function(){return D},jH.unstable_next=function(K){switch(D){case 1:case 2:case 3:var le=3;break;default:le=D}var se=D;D=le;try{return K()}finally{D=se}},jH.unstable_requestPaint=function(){_=!0},jH.unstable_runWithPriority=function(K,le){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var se=D;D=K;try{return le()}finally{D=se}},jH.unstable_scheduleCallback=function(K,le,se){var ge=jH.unstable_now();switch(typeof se==="object"&&se!==null?(se=se.delay,se=typeof se==="number"&&0<se?ge+se:ge):se=ge,K){case 1:var De=-1;break;case 2:De=250;break;case 5:De=1073741823;break;case 4:De=1e4;break;default:De=5000}return De=se+De,K={id:C++,callback:le,priorityLevel:K,startTime:se,expirationTime:De,sortIndex:-1},se>ge?(K.sortIndex=se,n(S,K),o(k)===null&&K===o(S)&&(H?(P(we),we=-1):H=!0,p(c,se-ge))):(K.sortIndex=De,n(k,K),I||T||(I=!0,F||(F=!0,oe()))),K},jH.unstable_shouldYield=d,jH.unstable_wrapCallback=function(K){var le=D;return function(){var se=D;D=le;try{return K.apply(this,arguments)}finally{D=se}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var w2=jk(function(GH){var dt=G(x2()),od=G(Xe()),Vk=G(VH());(function(){function e(t,i){for(t=t.memoizedState;t!==null&&0<i;)t=t.next,i--;return t}function n(t,i,s,u){if(s>=i.length)return u;var f=i[s],h=Mn(t)?t.slice():Qe({},t);return h[f]=n(t[f],i,s+1,u),h}function o(t,i,s){if(i.length!==s.length)console.warn("copyWithRename() expects paths of the same length");else{for(var u=0;u<s.length-1;u++)if(i[u]!==s[u]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return r(t,i,s,0)}}function r(t,i,s,u){var f=i[u],h=Mn(t)?t.slice():Qe({},t);return u+1===i.length?(h[s[u]]=h[f],Mn(h)?h.splice(f,1):delete h[f]):h[f]=r(t[f],i,s,u+1),h}function l(t,i,s){var u=i[s],f=Mn(t)?t.slice():Qe({},t);if(s+1===i.length)return Mn(f)?f.splice(u,1):delete f[u],f;return f[u]=l(t[u],i,s+1),f}function a(){return!1}function c(){return null}function d(){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 m(){}function g(){}function b(t){var i=[];return t.forEach(function(s){i.push(s)}),i.sort().join(", ")}function k(t,i,s,u){return new L4(t,i,s,u)}function S(t,i){t.context===Yl&&(u1(t.current,2,i,t,null,null),mc())}function C(t,i){if(Wo!==null){var s=i.staleFamilies;i=i.updatedFamilies,Hf(),DC(t.current,i,s),mc()}}function A(t){Wo=t}function D(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function T(t){var i=t,s=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(s=i.return),t=i.return;while(t)}return i.tag===3?s:null}function I(t){if(t.tag===13){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function H(t){if(t.tag===31){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function _(t){if(T(t)!==t)throw Error("Unable to find node on an unmounted component.")}function L(t){var i=t.alternate;if(!i){if(i=T(t),i===null)throw Error("Unable to find node on an unmounted component.");return i!==t?null:t}for(var s=t,u=i;;){var f=s.return;if(f===null)break;var h=f.alternate;if(h===null){if(u=f.return,u!==null){s=u;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===s)return _(f),t;if(h===u)return _(f),i;h=h.sibling}throw Error("Unable to find node on an unmounted component.")}if(s.return!==u.return)s=f,u=h;else{for(var y=!1,v=f.child;v;){if(v===s){y=!0,s=f,u=h;break}if(v===u){y=!0,u=f,s=h;break}v=v.sibling}if(!y){for(v=h.child;v;){if(v===s){y=!0,s=h,u=f;break}if(v===u){y=!0,u=h,s=f;break}v=v.sibling}if(!y)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(s.alternate!==u)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(s.tag!==3)throw Error("Unable to find node on an unmounted component.");return s.stateNode.current===s?t:i}function P(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=P(t),i!==null)return i;t=t.sibling}return null}function Q(t){if(t===null||typeof t!=="object")return null;return t=zT&&t[zT]||t["@@iterator"],typeof t==="function"?t:null}function F(t){if(t==null)return null;if(typeof t==="function")return t.$$typeof===Z6?null:t.displayName||t.name||null;if(typeof t==="string")return t;switch(t){case xc:return"Fragment";case m1:return"Profiler";case rg:return"StrictMode";case y1:return"Suspense";case b1:return"SuspenseList";case v1:return"Activity"}if(typeof t==="object")switch(typeof t.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case Sc:return"Portal";case hs:return t.displayName||"Context";case g1:return(t._context.displayName||"Context")+".Consumer";case Qf:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case sg:return i=t.displayName||null,i!==null?i:F(t.type)||"Memo";case ko:i=t._payload,t=t._init;try{return F(t(i))}catch(s){}}return null}function we(t){return typeof t.tag==="number"?J(t):typeof t.name==="string"?t.name:null}function J(t){var i=t.type;switch(t.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(i._context.displayName||"Context")+".Consumer";case 10:return i.displayName||"Context";case 18:return"DehydratedFragment";case 11:return t=i.render,t=t.displayName||t.name||"",i.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return F(i);case 8:return i===rg?"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 i==="function")return i.displayName||i.name||null;if(typeof i==="string")return i;break;case 29:if(i=t._debugInfo,i!=null){for(var s=i.length-1;0<=s;s--)if(typeof i[s].name==="string")return i[s].name}if(t.return!==null)return J(t.return)}return null}function Z(t){return{current:t}}function oe(t,i){0>Fs?console.error("Unexpected pop."):(i!==S1[Fs]&&console.error("Unexpected Fiber popped."),t.current=k1[Fs],k1[Fs]=null,S1[Fs]=null,Fs--)}function Te(t,i,s){Fs++,k1[Fs]=t.current,S1[Fs]=s,t.current=i}function Rt(t){return t===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),t}function K(t,i){Te(jl,i,t),Te(Ff,t,t),Te(_l,null,t);var s=i.nodeType;switch(s){case 9:case 11:s=s===9?"#document":"#fragment",i=(i=i.documentElement)?(i=i.namespaceURI)?rT(i):al:al;break;default:if(s=i.tagName,i=i.namespaceURI)i=rT(i),i=sT(i,s);else switch(s){case"svg":i=nd;break;case"math":i=oy;break;default:i=al}}s=s.toLowerCase(),s=Zw(null,s),s={context:i,ancestorInfo:s},oe(_l,t),Te(_l,s,t)}function le(t){oe(_l,t),oe(Ff,t),oe(jl,t)}function se(){return Rt(_l.current)}function ge(t){t.memoizedState!==null&&Te(lg,t,t);var i=Rt(_l.current),s=t.type,u=sT(i.context,s);s=Zw(i.ancestorInfo,s),u={context:u,ancestorInfo:s},i!==u&&(Te(Ff,t,t),Te(_l,u,t))}function De(t){Ff.current===t&&(oe(_l,t),oe(Ff,t)),lg.current===t&&(oe(lg,t),qh._currentValue=Su)}function ct(){}function Et(){if(Yf===0){IT=console.log,HT=console.info,$T=console.warn,qT=console.error,UT=console.group,PT=console.groupCollapsed,_T=console.groupEnd;var t={configurable:!0,enumerable:!0,value:ct,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}Yf++}function zt(){if(Yf--,Yf===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Qe({},t,{value:IT}),info:Qe({},t,{value:HT}),warn:Qe({},t,{value:$T}),error:Qe({},t,{value:qT}),group:Qe({},t,{value:UT}),groupCollapsed:Qe({},t,{value:PT}),groupEnd:Qe({},t,{value:_T})})}0>Yf&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function pe(t){var i=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,t=t.stack,Error.prepareStackTrace=i,t.startsWith(`Error: react-stack-top-frame
|
|
2
2
|
`)&&(t=t.slice(29)),i=t.indexOf(`
|
|
3
3
|
`),i!==-1&&(t=t.slice(i+1)),i=t.indexOf("react_stack_bottom_frame"),i!==-1&&(i=t.lastIndexOf(`
|
|
4
4
|
`,i)),i!==-1)t=t.slice(0,i);else return"";return t}function ze(t){if(x1===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);x1=i&&i[1]||"",jT=-1<s.stack.indexOf(`
|
|
@@ -264,6 +264,6 @@ ${a}`:`# ${r}`}}var Ee=G(fe(),1),CR=15000,xR=2;function jh(e){return Ee.jsxDEV("
|
|
|
264
264
|
|
|
265
265
|
[Open the Inbox item](${n.backlink})`;return{draft:o,body:n.body?`${n.body}
|
|
266
266
|
|
|
267
|
-
${r}`:r}}function O8(e,n){let o=new URLSearchParams(n).get("starter");return o===null?void 0:e?.starters?.find((r)=>r.id===o)}function L8(e,n){return{draft:{...jp(e),...n.fields},body:n.body??""}}function v_(){let e=window.history.state;return Ww(e)?e:{}}function B8(e){let{api:n,queryClient:o,history:r,studioBasePath:l,routeTarget:a,routePathname:c,routeSearch:d,currentStudioPathname:p,createMode:m,entityType:g,collectionType:b,activeType:k,entityCollectionQuery:S,preferredMobilePane:C,dispatchEditor:A,setMobilePane:D,setFieldAssistState:T}=e,I=k?.capabilities.canCreate===!0,H=k?.hierarchy.nested!==!1,[_,L]=Ui.useState(null),[P,Q]=Ui.useState(0),F=Ui.useRef(null),we=Ui.useRef(0),J=Ui.useRef(g);J.current=g;let Z=Ui.useRef(k);Z.current=k,Ui.useEffect(()=>{if(a.kind==="grouping"){A({type:"collectionChanged"});return}if(!g||a.kind==="workspace"||a.kind==="not-found")return;let le=a.kind==="entity"&&a.entityType===g?a.id:null,se=++we.current;A({type:"collectionChanged"}),D("details"),T({kind:"idle"});let ge=!0,De=()=>ge&&se===we.current;return o.fetchQuery({...tb(n,g,Z.current?.fieldsPerEntry===!0?le:null),staleTime:0}).then(async(ct)=>{if(!ge||se!==we.current)return;let Et=ZI(ct,C.current);if(D(Et),m&&le===null){if(!I){L(`Creating ${g} is not allowed.`);return}let zt=M8(window.history.state,g,()=>window.history.replaceState(D8(v_()),"",window.location.href)),pe=zt?void 0:O8(Z.current,d),ze=pe?L8(ct.fields,pe):R8(ct.fields,zt);A({type:"creationStarted",draft:ze.draft,body:ze.body,...ct.isSingleton&&{singleton:!0},...zt&&{prefilled:!0},...!zt&&!ct.isSingleton&&{prefix:H?Kd(d).prefix:null}});return}if(le!==null)return o.fetchQuery({...Zd(n,g,le),staleTime:0}).then((zt)=>{if(!ge||se!==we.current)return;let pe=Xd(zt),ze=F.current,Tt=_n(l,g,le),li=ze?.pathname===Tt?ze.save:{kind:"idle"};if(ze?.pathname===Tt)F.current=null;A({type:"documentOpened",document:pe,save:li})});if(ct.isSingleton){let zt=await o.ensureQueryData(nb(n,g,Kd("?scope=collection")));if(!De())return;let pe=zt.entities[0];if(pe)return o.fetchQuery({...Zd(n,g,pe.id),staleTime:0}).then((ze)=>{if(!ge||se!==we.current)return;let Tt=Xd(ze);A({type:"documentOpened",document:Tt})});A({type:"creationStarted",singleton:!0,draft:jp(ct.fields)})}return}).catch((ct)=>{if(ge&&se===we.current)L(Na(ct))}),()=>{ge=!1}},[m,p,g,P,o,c,d,a,I,H]);let oe=Ui.useCallback((le,se={kind:"idle"},ge=g)=>{if(!ge||!g)return;let De=_n(l,ge,le);if(!(ge===g&&a.kind==="entity"&&a.entityType===g&&a.id===le)){F.current={pathname:De,save:se};let pe=`${qi(l,b??g)}${ri(S)}`,ze=m&&se.kind==="saved",Tt=r.location.state,li=!ze||Ww(Tt)&&Tt.studioCollectionPath===pe;r[ze?"replace":"push"](`${De}${ri(S)}`,li?{studioCollectionPath:pe}:void 0,se.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let Et=++we.current,zt=g;o.fetchQuery({...Zd(n,g,le),staleTime:0}).then((pe)=>{if(Et!==we.current||J.current!==zt)return;let ze=Xd(pe);A({type:"documentOpened",document:ze,save:se}),T({kind:"idle"})}).catch((pe)=>{if(Et===we.current)L(Na(pe))})},[l,p,a,m,g,b,S,o,r]),Te=Ui.useCallback(()=>{Q((le)=>le+1)},[]),Rt=Ui.useCallback(()=>{we.current+=1},[]),K=Ui.useCallback(()=>we.current,[]);return{openEntity:oe,loadError:_,setLoadError:L,retryOpen:Te,supersedeOpen:Rt,currentOpenRequest:K,pendingOpenState:F}}var Vr=G(Xe(),1);function I8(e){let{api:n,queryClient:o,history:r,studioBasePath:l,entityType:a,collectionType:c,entityCollectionQuery:d,groupReturnPath:p,activeCapabilities:m,schema:g,editor:b,dispatchEditor:k,createPath:S,syncStatus:C,deleting:A,saveEntityMutation:D,deleteEntityMutation:T,openEntity:I,currentOpenRequest:H,setMobilePane:_,setFieldAssistState:L}=e,{mode:P,draft:Q,body:F,save:we}=b,[J,Z]=Vr.useState(null),oe=Vr.useRef(0);Vr.useEffect(()=>{if(we.kind!=="saved"||!C?.git)return;if(xy({save:we,git:C.git,baselineCommit:J}).committed==="done")return;if(Date.now()-oe.current>20000)return;let ge=window.setTimeout(()=>{o.invalidateQueries({queryKey:Bn.syncStatus()})},900);return()=>window.clearTimeout(ge)},[we,C,J,o]);let Te=Vr.useCallback((se,ge)=>{if(!a||P.kind!=="edit"||m?.canUpdate!==!0||m.canAssist!==!0||F.trim().length===0)return;L({kind:"loading",field:ge,variant:se}),n.requestFieldAssist({variant:se,entityType:a,id:P.entity.id,targetField:ge}).then((De)=>{let ct=De.variant==="summarize"?De.suggestion:De.suggestions;L({kind:"suggested",field:De.targetField,variant:De.variant,suggestion:ct})}).catch((De)=>{L({kind:"error",field:ge,message:Ln(De)})})},[m,F,a,P]),Rt=Vr.useCallback((se,ge)=>{k({type:"fieldAssistApplied",field:se,suggestion:ge}),L({kind:"idle"})},[]),K=Vr.useCallback(()=>{if(!a||P.kind==="browse"||!g||a===Cl&&!g.groupingDefinitions||Ip(b)||(P.kind==="create"&&g.isSingleton||a===Cl)&&!ab(b))return;if(P.kind==="create"?m?.canCreate!==!0:m?.canUpdate!==!0)return;oe.current=Date.now(),Z(C?.git?.lastCommit??null),k({type:"saveStarted"});let se=g.hasBody?{body:F}:{},ge=P.kind==="edit"?N8(b).map((pe)=>{let ze=P.entity.versions?.find((Tt)=>Tt.language===pe);return{language:pe,texts:b.versions?.[pe]??{},...ze&&{baseContentHash:ze.contentHash}}}):[],De=ge.length>0?{versions:ge,...!z8(b)&&!Object.values(b.compoundFields??{}).some((pe)=>pe.pendingChanges)&&{entryUnchanged:!0}}:{},ct=ib(g.fields,Q),Et=P.kind==="create"?{kind:"create",entityType:a,...S&&{idPath:S},frontmatter:ct,...se}:{kind:"update",entityType:a,id:P.entity.id,frontmatter:ct,baseContentHash:P.entity.contentHash,...se,...De},zt=H();D.mutate(Et,{onSuccess:async(pe)=>{if(await Promise.all([o.invalidateQueries({queryKey:["studio","groupings"]}),o.invalidateQueries({queryKey:Bn.entities(a)}),...c&&c!==a?[o.invalidateQueries({queryKey:Bn.entities(c)})]:[],o.invalidateQueries({queryKey:Bn.syncStatus()}),...a===Cl?[o.invalidateQueries({queryKey:["studio","schema"]})]:[],...P.kind==="create"||a===Cl?[o.invalidateQueries({queryKey:Bn.navigation()})]:[]]),zt!==H())return;if(pe.versionErrors){k({type:"saveFailed",save:{kind:"error",message:"Some translations were not saved.",versions:pe.versionErrors}});return}let ze="skipped"in pe&&pe.skipped===!0&&!pe.versionsWritten;I(pe.entityId,{kind:"saved",noop:ze})},onError:(pe)=>{if(zt!==H())return;if(pe instanceof Do&&(pe.status===400||pe.status===409))Promise.all([o.invalidateQueries({queryKey:Bn.navigation()}),o.invalidateQueries({queryKey:["studio","schema"]}),o.invalidateQueries({queryKey:["studio","groupings"]})]);if(pe instanceof Do&&pe.issues.length>0)_("details");k({type:"saveFailed",save:pe instanceof Do&&pe.status===409&&P.kind==="edit"?{kind:"conflict",message:Ln(pe),...pe.conflictId!==void 0&&{conflictId:pe.conflictId}}:{kind:"error",message:pe instanceof Do&&pe.issues.length>0?pe.message||"Validation failed":Ln(pe),...pe instanceof Do?{issues:pe.issues}:{}}})}})},[m,a,c,P,S,b,Q,F,g,I,C,o,D]),le=Vr.useCallback(()=>{if(!a||P.kind!=="edit"||A||m?.canDelete!==!0)return;let{id:se}=P.entity;T.mutate({entityType:a,id:se},{onSuccess:async()=>{k({type:"deleteSucceeded"}),o.removeQueries({queryKey:Bn.entity(a,se)}),await Promise.all([o.invalidateQueries({queryKey:["studio","groupings"]}),o.invalidateQueries({queryKey:Bn.entityLists()}),o.invalidateQueries({queryKey:Bn.syncStatus()}),o.invalidateQueries({queryKey:Bn.navigation()})]),r.replace(p??`${qi(l,c??a)}${ri(d)}`,void 0,{ignoreBlocker:!0})},onError:(ge)=>{k({type:"deleteFailed",message:Ln(ge)})}})},[m,l,a,c,P,A,o,T,r,p,d]);return{runFieldAssist:Te,applyFieldAssist:Rt,save:K,remove:le,baselineCommit:J}}var Vp=G(Xe(),1);function q8(e){let{history:n,queryClient:o,studioBasePath:r,routeTarget:l,routePathname:a,routeSearch:c,entityType:d,activeWorkspaceId:p,types:m,groupings:g,workspaces:b,activeType:k,activeWorkspace:S,entityCollectionQuery:C,entityListOffset:A,entityListTotal:D,declarativeWorkspaceData:T,initialUrlWorkspaceQuery:I,setActiveWorkspaceId:H,setEntityType:_,setLoadError:L,supersedeOpen:P}=e;Vp.useEffect(()=>{if(!d||!k||p||l.kind!=="collection"&&l.kind!=="entity"||l.entityType!==d)return;if(D===void 0)return;let Q=Math.floor(Math.max(0,D-1)/C.limit)*C.limit;if(A>Q)n.replace(`${a}${ri({...C,offset:Q})}`,n.location.state)},[k,p,A,D,C,d,a,l,n]),Vp.useEffect(()=>{if(!p||!T?.refreshAfterMs)return;let Q=window.setTimeout(()=>{o.invalidateQueries({queryKey:Bn.workspace(p)})},T.refreshAfterMs);return()=>window.clearTimeout(Q)},[p,T,o]),Vp.useEffect(()=>{if(S?.urlQuery!==!0||l.kind!=="workspace"||l.workspaceId!==S.id)return;let Q=si(r,S.id);if(El(Q,I)!==`${Q}${c}`)eb(n,Q,I,window.location.pathname)},[S,r,I,c,l,n]),Vp.useEffect(()=>{if(!m)return;if(L(null),l.kind==="not-found"){P(),L(`Studio route not found: ${l.pathname}`);return}if(l.kind==="images"||l.kind==="documents"){P(),H(null),_(null);return}if(l.kind==="grouping"){if(P(),H(null),_(null),!g.some((J)=>J.key===l.grouping))L("Collection unavailable for this account.");return}if(l.kind==="workspace"){let J=b.find((Z)=>Z.id===l.workspaceId);if(!J){let Z=H8(r,l.workspaceId,c,b);if(Z){n.replace(Z);return}P(),L(`Workspace unavailable for this account: ${l.workspaceId}`);return}H(J.id),_(null);return}if(l.kind==="entity"&&l.entityType==="document"){n.replace(Gp(r,l.id));return}let Q=l.kind==="collection"||l.kind==="entity"?l.entityType:void 0,F=m.find((J)=>!J.isSingleton)??m[0];if(l.kind==="home"){let J=$8(r,m,b);if(J!==r){n.replace(J);return}}let we=Q??F?.entityType??null;if(Q!==void 0&&!m.some((J)=>J.entityType===Q)){P(),L(`Collection unavailable for this account: ${Q}`);return}H(null),_(we)},[c,l,n,r,m,g,b])}var Fw=G(Xe(),1);function P8(e){let{queryClient:n,workspaces:o,activeWorkspaceId:r,entityType:l,mode:a,declarativeWorkspaceActionMutation:c,openEntity:d}=e,p=Fw.useCallback(async(g)=>{let b=U8(o,g.entityType);if(!b)throw Error("Publishing is unavailable");let k={entityType:g.entityType,entityId:g.entityId,...g.type==="reorder"?{position:g.position}:{}};if(g.type==="publish"&&!g.confirmation){let A=await c.mutateAsync({workspaceId:b.id,action:{actionId:"publish",label:"Publish now",input:k,invocation:{mode:"prepare"}}});if(typeof A!=="object"||A===null||!("kind"in A)||A.kind!=="prepared-confirmation"||!("token"in A)||typeof A.token!=="string"||!("summary"in A)||typeof A.summary!=="string"||!("expiresAt"in A)||typeof A.expiresAt!=="string")throw Error("Publishing confirmation is unavailable");return{needsConfirmation:!0,summary:A.summary,args:{confirmed:!0,confirmationToken:A.token,contentHash:A.token,expiresAt:A.expiresAt}}}let S=await c.mutateAsync({workspaceId:b.id,action:{actionId:g.type,label:g.type,input:k,...g.type==="publish"&&g.confirmation?{invocation:{mode:"execute",token:g.confirmation.confirmationToken}}:{}}});if(typeof S!=="object"||S===null)throw Error("Publishing returned an invalid result");let C="success"in S&&S.success===!1?{success:!1,error:"error"in S&&typeof S.error==="string"?S.error:"Publishing failed",..."code"in S&&typeof S.code==="string"?{code:S.code}:{}}:{success:!0};if(!gw(C)&&!yw(C)){if(await Qw(n,b.id),a.kind==="edit"&&l===g.entityType&&a.entity.id===g.entityId)d(g.entityId)}return C},[l,a,d,n,c,o]),m=Fw.useCallback(async(g)=>{if(!r)throw Error("Declarative workspace is unavailable");try{let b=await c.mutateAsync({workspaceId:r,action:g});return await Qw(n,r),b}finally{c.reset()}},[r,c,n]);return{performPublishingAction:p,performDeclarativeAction:m}}var Mt=G(fe(),1),k_=ut.lazy(()=>Jk(async()=>({default:(await import("./studio-chunks/account-view-j9wkxck6.js")).AccountApp}))),S_=ut.lazy(()=>Jk(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-sdgj4tp5.js")).StudioChatWorkspace}),()=>Mt.jsxDEV(Xu,{message:"Chat could not open.",children:Mt.jsxDEV(Kk,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)));function x_(e){let n=new URLSearchParams(e).get("session")?.trim();return n&&n.length<=256?n:null}var w_=["public","trusted","admin"];function C_(e,n,o){let r=document.querySelector("[data-studio-root]"),l=r?.getAttribute("data-studio-principal-name")??"Your account",a=r?.getAttribute("data-studio-principal-role"),c=w_.find((b)=>b===a)??"public",d=r?.getAttribute("data-studio-mcp-url")??void 0,p=r?.getAttribute("data-studio-dav-url")??void 0,m=new URLSearchParams(o).get("section")??void 0,g=W8(o);return{displayName:l,role:c,routePath:e,studioPath:n,...d?{mcpUrl:d}:{},...p?{davUrl:p}:{},...m?{initialSection:m}:{},...g?{connect:g}:{}}}function t4(){let e=_8(),n=ub({select:(ee)=>ee.location.pathname}),o=ub({select:(ee)=>ee.location.searchStr}),r=ub({select:(ee)=>ee.location.state}),l=nr(),a=ut.useMemo(()=>n===ba?{kind:"workspace",workspaceId:lb}:X8(n,l),[n,l]),c=ut.useMemo(()=>a.kind==="collection"&&new URLSearchParams(o).get("mode")==="create",[o,a]),d=n,[p,m]=ut.useState(null),[g,b]=ut.useState(null),[k,S]=ut.useState({}),[C,A]=ut.useReducer(F8,Q8),{mode:D}=C,T=ab(C),[I]=ut.useState(()=>new e4),H=ut.useSyncExternalStore(I.subscribe,I.hasDrafts,I.hasDrafts),[_,L]=ut.useState({hasDraft:!1,busy:!1}),P=j8({shouldBlockFn:({next:ee})=>T||n===ba&&Z8({..._,hasDraft:H},ee.pathname),enableBeforeUnload:T||H||_.busy,withResolver:!0}),[Q,F]=ut.useState({kind:"idle"}),[we,J]=ut.useState(T2),[Z,oe]=ut.useState("details"),Te=ut.useRef(null),Rt=ut.useCallback((ee)=>{if(ee!=="details")Te.current=ee;oe(ee)},[]),K=As(),le=Nt(),{navigationQuery:se,types:ge,groupings:De,activeType:ct,collectionType:Et,activeCapabilities:zt,entityCollectionQuery:pe,entityListOffset:ze,workspaces:Tt,activeWorkspace:li,activeAccount:Bs,activeChat:Ns,initialUrlWorkspaceQuery:Uo,workspaceRequestQuery:zs,workspaceQuery:ce,workspaceData:In,workspaceError:Pi,agentTargets:Gr,syncStatus:Wr,entityListQuery:et,entities:Is,entityListTotal:Hs,schema:yr,createPath:yt,destinationQuery:za,saveEntityMutation:Po,deleteEntityMutation:ke,declarativeWorkspaceActionMutation:St,deleting:co,declarativeWorkspaceData:bt}=C8({api:le,entityType:g,activeWorkspaceId:p,routeSearch:o,workspaceQueries:k,editor:C}),_o=Tt.find((ee)=>ee.rendererName===Ku),[br,Tl]=ut.useState(!1),[Wp,ef]=ut.useState(null),Ju=C.mode.kind==="edit"?`${C.mode.entity.entityType}:${C.mode.entity.id}`:null;ut.useEffect(()=>{ef(null)},[Ju]);let _i=_o?.chatApiPath;ut.useEffect(()=>{if(!_i||Ju===null)return;let ee=(tn)=>{if(tn.key.toLowerCase()!=="j"||!(tn.metaKey||tn.ctrlKey)||tn.altKey||tn.shiftKey)return;tn.preventDefault(),Tl((Gi)=>!Gi)};return window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)},[_i,Ju]);let tf=C.mode.kind==="edit"&&ge?.find((ee)=>ee.entityType===g)?.capabilities.canAssist===!0;ut.useEffect(()=>{G8(_i!==void 0)},[_i]),ut.useEffect(()=>{if(!_i)return;let ee=()=>{if(tf)Tl(!0);else e.history.push(ba)};return window.addEventListener(Yw,ee),()=>window.removeEventListener(Yw,ee)},[_i,tf,e]);let nf=cR({entityType:g,entities:Is}),Zu=B2({principalId:document.querySelector("[data-studio-root]")?.getAttribute("data-studio-principal-id")??null,entityType:g,editor:C,hasUnsavedChanges:T,fields:yr?.fields??[],dispatch:A}),$s=a.kind==="grouping"?De.find((ee)=>ee.key===a.grouping):void 0,Ia=ut.useMemo(()=>K8(o),[o]),Ha=a.kind==="entity"?J8(r,l,De):null,qs=Ha?.path,Qr=ut.useMemo(()=>g?De.filter((ee)=>ee.types.includes(g)):[],[De,g]),$a=d8(Qr),{openEntity:Fr,loadError:Sn,setLoadError:Yr,retryOpen:Dl,supersedeOpen:Ml,currentOpenRequest:of,pendingOpenState:rf}=B8({api:le,queryClient:K,history:e.history,studioBasePath:l,routeTarget:a,routePathname:n,routeSearch:o,currentStudioPathname:d,createMode:c,entityType:g,collectionType:Et,activeType:ct,entityCollectionQuery:pe,preferredMobilePane:Te,dispatchEditor:A,setMobilePane:oe,setFieldAssistState:F});q8({history:e.history,queryClient:K,studioBasePath:l,routeTarget:a,routePathname:n,routeSearch:o,entityType:g,activeWorkspaceId:p,types:ge,groupings:De,workspaces:Tt,activeType:ct,activeWorkspace:li,entityCollectionQuery:pe,entityListOffset:ze,entityListTotal:Hs,declarativeWorkspaceData:bt,initialUrlWorkspaceQuery:Uo,setActiveWorkspaceId:m,setEntityType:b,setLoadError:Yr,supersedeOpen:Ml});let{openWorkspaceEntity:ec,openWorkspaceLaunch:tc,selectEntityType:fo,changeEntityPage:ji,selectWorkspace:nc,selectFolder:fb,startCreate:sf,backToList:Qp,changeWorkspaceQuery:ic}=T8({history:e.history,studioBasePath:l,routeSearch:o,entityType:g,collectionType:Et,entityCollectionQuery:pe,groupReturnPath:qs,workspaces:Tt,schema:yr,activeCapabilities:zt,pendingOpenState:rf,setFieldAssistState:F,setWorkspaceQueries:S}),{runFieldAssist:Vi,applyFieldAssist:Fp,save:lf,remove:Yp,baselineCommit:af}=I8({api:le,queryClient:K,history:e.history,studioBasePath:l,entityType:g,collectionType:Et,entityCollectionQuery:pe,groupReturnPath:qs,activeCapabilities:zt,schema:yr,editor:C,dispatchEditor:A,createPath:yt,syncStatus:Wr,deleting:co,saveEntityMutation:Po,deleteEntityMutation:ke,openEntity:Fr,currentOpenRequest:of,setMobilePane:oe,setFieldAssistState:F}),{performPublishingAction:Xp,performDeclarativeAction:Kp}=P8({queryClient:K,workspaces:Tt,activeWorkspaceId:p,entityType:g,mode:D,declarativeWorkspaceActionMutation:St,openEntity:Fr}),yi=Sn??(se.error?Na(se.error):et.error?Na(et.error):null),uf=()=>{if(Yr(null),se.error)se.refetch();if(et.error)et.refetch();if(ce.error)ce.refetch();if(D.kind==="browse")Dl()};if(yi&&!ge)return Mt.jsxDEV(Xu,{message:yi,error:!0,onRetry:uf},void 0,!1,void 0,this);if(!ge)return Mt.jsxDEV(Xu,{message:"Loading…"},void 0,!1,void 0,this);let cf=ge.find((ee)=>ee.entityType===g),Jp=async(ee)=>{if(ee.kind==="run")await le.runWorkspaceAction(ee.workspaceId,{actionId:ee.actionId,input:{}}),e.history.push(ee.href);else if(ee.kind==="ask-entry")Tl(!0);else if(ee.kind==="ask-brain")I.update(Xw(_i,null),{text:ee.question}),e.history.push(ba);else if(ee.kind==="create")e.history.push(sb(l,ee.entityType,ee.starter));else if(ee.kind==="climate")V8(document.documentElement.getAttribute("data-climate")==="instrument"?"paper":"instrument");else if(ee.href.startsWith("/"))e.history.push(ee.href);else window.location.assign(ee.href)},oc=Mt.jsxDEV(s8,{types:ge.map((ee)=>({entityType:ee.entityType,singularLabel:ee.singularLabel,classification:ee.classification,isSingleton:ee.isSingleton,canCreate:ee.capabilities.canCreate,...ee.starters&&{starters:ee.starters}})),hasChat:_i!==void 0,openEntry:D.kind==="edit"&&cf?.capabilities.canAssist?{typeLabel:cf.singularLabel.toLowerCase()}:null,onCommand:Jp},void 0,!1,void 0,this);if(Bs&&li){let ee=si(l,rb);return Mt.jsxDEV(Mt.Fragment,{children:[oc,Mt.jsxDEV(e8,{types:ge,workspaces:Tt,workspaceId:li.id,selectEntityType:fo,selectWorkspace:nc,children:Mt.jsxDEV(ut.Suspense,{fallback:Mt.jsxDEV(me,{children:"Opening Account…"},void 0,!1,void 0,this),children:Mt.jsxDEV(k_,{bootstrap:C_(ee,l,o)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}if(Ns&&li)return Mt.jsxDEV(Mt.Fragment,{children:[oc,Mt.jsxDEV(ut.Suspense,{fallback:Mt.jsxDEV(Xu,{message:"Opening Chat…"},void 0,!1,void 0,this),children:Mt.jsxDEV(S_,{apiPath:li.chatApiPath,draftStore:I,onNavigationStateChange:L,studioBasePath:l,sessionId:x_(o),types:ge,workspaces:Tt,handoff:c8(r),question:u8(r),navigate:(ee,tn)=>{e.history.push(ee,void 0,{ignoreBlocker:tn?.preserveWork===!0})},selectEntityType:fo,selectWorkspace:nc},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.status==="blocked"&&Mt.jsxDEV(Nn,{mark:"↩",title:"Leave this conversation?",titleId:"chat-navigation-title",cancelLabel:"Stay",confirmLabel:"Leave",onCancel:()=>P.reset(),onConfirm:()=>P.proceed(),children:Mt.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?p!==_p&&!In&&!Pi:g&&!yr&&!yi)return Mt.jsxDEV(Xu,{message:"Loading…"},void 0,!1,void 0,this);if(!$s&&a.kind!=="images"&&a.kind!=="documents"&&!p&&(!g||!yr&&!yi))return Mt.jsxDEV(Xu,{message:yi??"No readable collections are available for this account.",error:Boolean(yi),...yi?{onHome:()=>e.history.push(l)}:{}},void 0,!1,void 0,this);let df=(ee,tn)=>e.history.push(_n(l,ee,tn));return Mt.jsxDEV(Mt.Fragment,{children:[oc,Mt.jsxDEV(t8,{groupings:{items:De,active:$s?.key??Ha?.grouping??null,onSelect:(ee)=>e.history.push(ud(l,ee))},media:{active:a.kind==="images"||a.kind==="documents"?a.kind:null,onSelect:(ee)=>e.history.push(ee==="images"?Y8(l):Gp(l))},mediaView:a.kind==="images"?Mt.jsxDEV(tR,{onOpen:df},void 0,!1,void 0,this):a.kind==="documents"?Mt.jsxDEV(Z2,{documentId:new URLSearchParams(o).get("id"),onPick:(ee)=>e.history.push(Gp(l,ee??void 0)),onOpen:df},void 0,!1,void 0,this):null,homeView:p===_p?Mt.jsxDEV(AR,{chatApiPath:_o?.chatApiPath,onNavigate:(ee)=>e.history.push(ee),onAsk:(ee)=>{I.update(Xw(_o?.chatApiPath,null),{text:ee}),e.history.push(ba)}},void 0,!1,void 0,this):null,groupReturnLabel:Ha?.label,groupingSuggestions:$a,groupingView:$s?Mt.jsxDEV(V2,{basePath:l,grouping:$s,types:ge,query:Ia,onChange:(ee,tn)=>{let Gi=`${ud(l,$s.key)}${_h(ee)}`,Zp=ee.value!==Ia.value||ee.offset!==Ia.offset;e.history[Zp&&tn?.replace!==!0?"push":"replace"](Gi)},onOpen:(ee,tn)=>{let Gi=_n(l,ee,tn);rf.current={pathname:Gi,save:{kind:"idle"}},e.history.push(Gi,{studioGroupingPath:`${ud(l,$s.key)}${_h(Ia)}`})}},void 0,!1,void 0,this):null,activeWorkspaceId:p,types:ge,workspaces:Tt,workspaceError:Pi,readError:yi,onRetryRead:uf,declarativeWorkspaceData:bt,workspaceQuery:zs,entityType:g,entities:Is,refineNotice:nf.notice,onRefineConfirmed:nf.confirmed,folders:et.data?.folders??[],collectionTrail:et.data?.trail,pageTexts:et.data?.pageTexts,collectionPath:Et?qi(l,Et):l,selectFolder:fb,creationDestination:{data:za.data??null,pending:za.isPending,error:za.error},entityOffset:ze,entityLimit:pe.limit,entityTotal:Hs??0,collectionQuery:pe,onCollectionQueryChange:(ee)=>{if(!Et)return;e.history.push(`${qi(l,Et)}${ri({...ee,offset:0})}`),window.scrollTo({top:0,left:0})},entityListLoading:et.isPending,schema:yr,editor:C,fieldAssistState:Q,bodyMode:we,mobilePane:Z,syncStatus:Wr,baselineCommit:af,agentTargets:Gr,ask:_i?{chatApiPath:_i,draftStore:I,open:br,setOpen:Tl,selection:Wp,setSelection:ef}:void 0,deleting:co,hasUnsavedChanges:T,navigationBlocked:P.status==="blocked",dispatchEditor:A,setFieldAssistState:F,setBodyMode:J,setMobilePane:Rt,backToList:Qp,selectEntityType:fo,selectWorkspace:nc,changeEntityPage:ji,openWorkspaceEntity:ec,openWorkspaceLaunch:tc,performPublishingAction:Xp,performDeclarativeAction:Kp,onWorkspaceQueryChange:ic,startCreate:sf,openEntity:(ee,tn)=>Fr(ee,void 0,tn),runFieldAssist:Vi,applyFieldAssist:Fp,save:lf,remove:Yp,onNavigationReset:()=>P.reset?.(),draftRecovery:Zu,onNavigationProceed:()=>{Zu.forget(),P.proceed?.()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function i4(){return new n4({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var db=G(fe(),1),cb=document.querySelector("[data-studio-root]");if(cb){let e=cb.getAttribute("data-studio-base-path")??"/studio",n=new l4({basePath:e});cb.textContent="";let o=i4(),r=s4(e,t4);u4.createRoot(cb).render(db.jsxDEV(o4,{client:o,children:db.jsxDEV(a4,{api:n,children:db.jsxDEV(r4,{router:r},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}
|
|
267
|
+
${r}`:r}}function O8(e,n){let o=new URLSearchParams(n).get("starter");return o===null?void 0:e?.starters?.find((r)=>r.id===o)}function L8(e,n){return{draft:{...jp(e),...n.fields},body:n.body??""}}function v_(){let e=window.history.state;return Ww(e)?e:{}}function B8(e){let{api:n,queryClient:o,history:r,studioBasePath:l,routeTarget:a,routePathname:c,routeSearch:d,currentStudioPathname:p,createMode:m,entityType:g,collectionType:b,activeType:k,entityCollectionQuery:S,preferredMobilePane:C,dispatchEditor:A,setMobilePane:D,setFieldAssistState:T}=e,I=k?.capabilities.canCreate===!0,H=k?.hierarchy.nested!==!1,[_,L]=Ui.useState(null),[P,Q]=Ui.useState(0),F=Ui.useRef(null),we=Ui.useRef(0),J=Ui.useRef(g);J.current=g;let Z=Ui.useRef(k);Z.current=k,Ui.useEffect(()=>{if(a.kind==="grouping"){A({type:"collectionChanged"});return}if(!g||a.kind==="workspace"||a.kind==="not-found")return;let le=a.kind==="entity"&&a.entityType===g?a.id:null,se=++we.current;A({type:"collectionChanged"}),D("details"),T({kind:"idle"});let ge=!0,De=()=>ge&&se===we.current;return o.fetchQuery({...tb(n,g,Z.current?.fieldsPerEntry===!0?le:null),staleTime:0}).then(async(ct)=>{if(!ge||se!==we.current)return;let Et=ZI(ct,C.current);if(D(Et),m&&le===null){if(!I){L(`Creating ${g} is not allowed.`);return}let zt=M8(window.history.state,g,()=>window.history.replaceState(D8(v_()),"",window.location.href)),pe=zt?void 0:O8(Z.current,d),ze=pe?L8(ct.fields,pe):R8(ct.fields,zt);A({type:"creationStarted",draft:ze.draft,body:ze.body,...ct.isSingleton&&{singleton:!0},...zt&&{prefilled:!0},...!zt&&!ct.isSingleton&&{prefix:H?Kd(d).prefix:null}});return}if(le!==null)return o.fetchQuery({...Zd(n,g,le),staleTime:0}).then((zt)=>{if(!ge||se!==we.current)return;let pe=Xd(zt),ze=F.current,Tt=_n(l,g,le),li=ze?.pathname===Tt?ze.save:{kind:"idle"};if(ze?.pathname===Tt)F.current=null;A({type:"documentOpened",document:pe,save:li})});if(ct.isSingleton){let zt=await o.ensureQueryData(nb(n,g,Kd("?scope=collection")));if(!De())return;let pe=zt.entities[0];if(pe)return o.fetchQuery({...Zd(n,g,pe.id),staleTime:0}).then((ze)=>{if(!ge||se!==we.current)return;let Tt=Xd(ze);A({type:"documentOpened",document:Tt})});A({type:"creationStarted",singleton:!0,draft:jp(ct.fields)})}return}).catch((ct)=>{if(ge&&se===we.current)L(Na(ct))}),()=>{ge=!1}},[m,p,g,P,o,c,d,a,I,H]);let oe=Ui.useCallback((le,se={kind:"idle"},ge=g)=>{if(!ge||!g)return;let De=_n(l,ge,le);if(!(ge===g&&a.kind==="entity"&&a.entityType===g&&a.id===le)){F.current={pathname:De,save:se};let pe=`${qi(l,b??g)}${ri(S)}`,ze=m&&se.kind==="saved",Tt=r.location.state,li=!ze||Ww(Tt)&&Tt.studioCollectionPath===pe;r[ze?"replace":"push"](`${De}${ri(S)}`,li?{studioCollectionPath:pe}:void 0,se.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let Et=++we.current,zt=g;o.fetchQuery({...Zd(n,g,le),staleTime:0}).then((pe)=>{if(Et!==we.current||J.current!==zt)return;let ze=Xd(pe);A({type:"documentOpened",document:ze,save:se}),T({kind:"idle"})}).catch((pe)=>{if(Et===we.current)L(Na(pe))})},[l,p,a,m,g,b,S,o,r]),Te=Ui.useCallback(()=>{Q((le)=>le+1)},[]),Rt=Ui.useCallback(()=>{we.current+=1},[]),K=Ui.useCallback(()=>we.current,[]);return{openEntity:oe,loadError:_,setLoadError:L,retryOpen:Te,supersedeOpen:Rt,currentOpenRequest:K,pendingOpenState:F}}var Vr=G(Xe(),1);function I8(e){let{api:n,queryClient:o,history:r,studioBasePath:l,entityType:a,collectionType:c,entityCollectionQuery:d,groupReturnPath:p,activeCapabilities:m,schema:g,editor:b,dispatchEditor:k,createPath:S,syncStatus:C,deleting:A,saveEntityMutation:D,deleteEntityMutation:T,openEntity:I,currentOpenRequest:H,setMobilePane:_,setFieldAssistState:L}=e,{mode:P,draft:Q,body:F,save:we}=b,[J,Z]=Vr.useState(null),oe=Vr.useRef(0);Vr.useEffect(()=>{if(we.kind!=="saved"||!C?.git)return;if(xy({save:we,git:C.git,baselineCommit:J}).committed==="done")return;if(Date.now()-oe.current>20000)return;let ge=window.setTimeout(()=>{o.invalidateQueries({queryKey:Bn.syncStatus()})},900);return()=>window.clearTimeout(ge)},[we,C,J,o]);let Te=Vr.useCallback((se,ge)=>{if(!a||P.kind!=="edit"||m?.canUpdate!==!0||m.canAssist!==!0||F.trim().length===0)return;L({kind:"loading",field:ge,variant:se}),n.requestFieldAssist({variant:se,entityType:a,id:P.entity.id,targetField:ge}).then((De)=>{let ct=De.variant==="summarize"?De.suggestion:De.suggestions;L({kind:"suggested",field:De.targetField,variant:De.variant,suggestion:ct})}).catch((De)=>{L({kind:"error",field:ge,message:Ln(De)})})},[m,F,a,P]),Rt=Vr.useCallback((se,ge)=>{k({type:"fieldAssistApplied",field:se,suggestion:ge}),L({kind:"idle"})},[]),K=Vr.useCallback(()=>{if(!a||P.kind==="browse"||!g||a===Cl&&!g.groupingDefinitions||Ip(b)||(P.kind==="create"&&g.isSingleton||a===Cl)&&!ab(b))return;if(P.kind==="create"?m?.canCreate!==!0:m?.canUpdate!==!0)return;oe.current=Date.now(),Z(C?.git?.lastCommit??null),k({type:"saveStarted"});let se=g.hasBody?{body:F}:{},ge=P.kind==="edit"?N8(b).map((pe)=>{let ze=P.entity.versions?.find((Tt)=>Tt.language===pe);return{language:pe,texts:b.versions?.[pe]??{},...ze&&{baseContentHash:ze.contentHash}}}):[],De=ge.length>0?{versions:ge,...!z8(b)&&!Object.values(b.compoundFields??{}).some((pe)=>pe.pendingChanges)&&{entryUnchanged:!0}}:{},ct=ib(g.fields,Q),Et=P.kind==="create"?{kind:"create",entityType:a,...S&&{idPath:S},frontmatter:ct,...se}:{kind:"update",entityType:a,id:P.entity.id,frontmatter:ct,baseContentHash:P.entity.contentHash,...se,...De},zt=H();D.mutate(Et,{onSuccess:async(pe)=>{if(await Promise.all([o.invalidateQueries({queryKey:["studio","groupings"]}),o.invalidateQueries({queryKey:Bn.entities(a)}),...c&&c!==a?[o.invalidateQueries({queryKey:Bn.entities(c)})]:[],o.invalidateQueries({queryKey:Bn.syncStatus()}),...a===Cl?[o.invalidateQueries({queryKey:["studio","schema"]})]:[],...P.kind==="create"||a===Cl?[o.invalidateQueries({queryKey:Bn.navigation()})]:[]]),zt!==H())return;if(pe.versionErrors){k({type:"saveFailed",save:{kind:"error",message:"Some translations were not saved.",versions:pe.versionErrors}});return}let ze="skipped"in pe&&pe.skipped===!0&&!pe.versionsWritten;I(pe.entityId,{kind:"saved",noop:ze})},onError:(pe)=>{if(zt!==H())return;if(pe instanceof Do&&(pe.status===400||pe.status===409))Promise.all([o.invalidateQueries({queryKey:Bn.navigation()}),o.invalidateQueries({queryKey:["studio","schema"]}),o.invalidateQueries({queryKey:["studio","groupings"]})]);if(pe instanceof Do&&pe.issues.length>0)_("details");k({type:"saveFailed",save:pe instanceof Do&&pe.status===409&&P.kind==="edit"?{kind:"conflict",message:Ln(pe),...pe.conflictId!==void 0&&{conflictId:pe.conflictId}}:{kind:"error",message:pe instanceof Do&&pe.issues.length>0?pe.message||"Validation failed":Ln(pe),...pe instanceof Do?{issues:pe.issues}:{}}})}})},[m,a,c,P,S,b,Q,F,g,I,C,o,D]),le=Vr.useCallback(()=>{if(!a||P.kind!=="edit"||A||m?.canDelete!==!0)return;let{id:se}=P.entity;T.mutate({entityType:a,id:se},{onSuccess:async()=>{k({type:"deleteSucceeded"}),o.removeQueries({queryKey:Bn.entity(a,se)}),await Promise.all([o.invalidateQueries({queryKey:["studio","groupings"]}),o.invalidateQueries({queryKey:Bn.entityLists()}),o.invalidateQueries({queryKey:Bn.syncStatus()}),o.invalidateQueries({queryKey:Bn.navigation()})]),r.replace(p??`${qi(l,c??a)}${ri(d)}`,void 0,{ignoreBlocker:!0})},onError:(ge)=>{k({type:"deleteFailed",message:Ln(ge)})}})},[m,l,a,c,P,A,o,T,r,p,d]);return{runFieldAssist:Te,applyFieldAssist:Rt,save:K,remove:le,baselineCommit:J}}var Vp=G(Xe(),1);function q8(e){let{history:n,queryClient:o,studioBasePath:r,routeTarget:l,routePathname:a,routeSearch:c,entityType:d,activeWorkspaceId:p,types:m,groupings:g,workspaces:b,activeType:k,activeWorkspace:S,entityCollectionQuery:C,entityListOffset:A,entityListTotal:D,declarativeWorkspaceData:T,initialUrlWorkspaceQuery:I,setActiveWorkspaceId:H,setEntityType:_,setLoadError:L,supersedeOpen:P}=e;Vp.useEffect(()=>{if(!d||!k||p||l.kind!=="collection"&&l.kind!=="entity"||l.entityType!==d)return;if(D===void 0)return;let Q=Math.floor(Math.max(0,D-1)/C.limit)*C.limit;if(A>Q)n.replace(`${a}${ri({...C,offset:Q})}`,n.location.state)},[k,p,A,D,C,d,a,l,n]),Vp.useEffect(()=>{if(!p||!T?.refreshAfterMs)return;let Q=window.setTimeout(()=>{o.invalidateQueries({queryKey:Bn.workspace(p)})},T.refreshAfterMs);return()=>window.clearTimeout(Q)},[p,T,o]),Vp.useEffect(()=>{if(S?.urlQuery!==!0||l.kind!=="workspace"||l.workspaceId!==S.id)return;let Q=si(r,S.id);if(El(Q,I)!==`${Q}${c}`)eb(n,Q,I,window.location.pathname)},[S,r,I,c,l,n]),Vp.useEffect(()=>{if(!m)return;if(L(null),l.kind==="not-found"){P(),L(`Studio route not found: ${l.pathname}`);return}if(l.kind==="images"||l.kind==="documents"){P(),H(null),_(null);return}if(l.kind==="grouping"){if(P(),H(null),_(null),!g.some((J)=>J.key===l.grouping))L("Collection unavailable for this account.");return}if(l.kind==="workspace"){let J=b.find((Z)=>Z.id===l.workspaceId);if(!J){let Z=H8(r,l.workspaceId,c,b);if(Z){n.replace(Z);return}P(),L(`Workspace unavailable for this account: ${l.workspaceId}`);return}H(J.id),_(null);return}if(l.kind==="entity"&&l.entityType==="document"){n.replace(Gp(r,l.id));return}let Q=l.kind==="collection"||l.kind==="entity"?l.entityType:void 0,F=m.find((J)=>!J.isSingleton)??m[0];if(l.kind==="home"){let J=$8(r,m,b);if(J!==r){n.replace(J);return}}let we=Q??F?.entityType??null;if(Q!==void 0&&!m.some((J)=>J.entityType===Q)){P(),L(`Collection unavailable for this account: ${Q}`);return}H(null),_(we)},[c,l,n,r,m,g,b])}var Fw=G(Xe(),1);function P8(e){let{queryClient:n,workspaces:o,activeWorkspaceId:r,entityType:l,mode:a,declarativeWorkspaceActionMutation:c,openEntity:d}=e,p=Fw.useCallback(async(g)=>{let b=U8(o,g.entityType);if(!b)throw Error("Publishing is unavailable");let k={entityType:g.entityType,entityId:g.entityId,...g.type==="reorder"?{position:g.position}:{}};if(g.type==="publish"&&!g.confirmation){let A=await c.mutateAsync({workspaceId:b.id,action:{actionId:"publish",label:"Publish now",input:k,invocation:{mode:"prepare"}}});if(typeof A!=="object"||A===null||!("kind"in A)||A.kind!=="prepared-confirmation"||!("token"in A)||typeof A.token!=="string"||!("summary"in A)||typeof A.summary!=="string"||!("expiresAt"in A)||typeof A.expiresAt!=="string")throw Error("Publishing confirmation is unavailable");return{needsConfirmation:!0,summary:A.summary,args:{confirmed:!0,confirmationToken:A.token,contentHash:A.token,expiresAt:A.expiresAt}}}let S=await c.mutateAsync({workspaceId:b.id,action:{actionId:g.type,label:g.type,input:k,...g.type==="publish"&&g.confirmation?{invocation:{mode:"execute",token:g.confirmation.confirmationToken}}:{}}});if(typeof S!=="object"||S===null)throw Error("Publishing returned an invalid result");let C="success"in S&&S.success===!1?{success:!1,error:"error"in S&&typeof S.error==="string"?S.error:"Publishing failed",..."code"in S&&typeof S.code==="string"?{code:S.code}:{}}:{success:!0};if(!gw(C)&&!yw(C)){if(await Qw(n,b.id),a.kind==="edit"&&l===g.entityType&&a.entity.id===g.entityId)d(g.entityId)}return C},[l,a,d,n,c,o]),m=Fw.useCallback(async(g)=>{if(!r)throw Error("Declarative workspace is unavailable");try{let b=await c.mutateAsync({workspaceId:r,action:g});return await Qw(n,r),b}finally{c.reset()}},[r,c,n]);return{performPublishingAction:p,performDeclarativeAction:m}}var Mt=G(fe(),1),k_=ut.lazy(()=>Jk(async()=>({default:(await import("./studio-chunks/account-view-j9wkxck6.js")).AccountApp}))),S_=ut.lazy(()=>Jk(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-jw3pye8a.js")).StudioChatWorkspace}),()=>Mt.jsxDEV(Xu,{message:"Chat could not open.",children:Mt.jsxDEV(Kk,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)));function x_(e){let n=new URLSearchParams(e).get("session")?.trim();return n&&n.length<=256?n:null}var w_=["public","trusted","admin"];function C_(e,n,o){let r=document.querySelector("[data-studio-root]"),l=r?.getAttribute("data-studio-principal-name")??"Your account",a=r?.getAttribute("data-studio-principal-role"),c=w_.find((b)=>b===a)??"public",d=r?.getAttribute("data-studio-mcp-url")??void 0,p=r?.getAttribute("data-studio-dav-url")??void 0,m=new URLSearchParams(o).get("section")??void 0,g=W8(o);return{displayName:l,role:c,routePath:e,studioPath:n,...d?{mcpUrl:d}:{},...p?{davUrl:p}:{},...m?{initialSection:m}:{},...g?{connect:g}:{}}}function t4(){let e=_8(),n=ub({select:(ee)=>ee.location.pathname}),o=ub({select:(ee)=>ee.location.searchStr}),r=ub({select:(ee)=>ee.location.state}),l=nr(),a=ut.useMemo(()=>n===ba?{kind:"workspace",workspaceId:lb}:X8(n,l),[n,l]),c=ut.useMemo(()=>a.kind==="collection"&&new URLSearchParams(o).get("mode")==="create",[o,a]),d=n,[p,m]=ut.useState(null),[g,b]=ut.useState(null),[k,S]=ut.useState({}),[C,A]=ut.useReducer(F8,Q8),{mode:D}=C,T=ab(C),[I]=ut.useState(()=>new e4),H=ut.useSyncExternalStore(I.subscribe,I.hasDrafts,I.hasDrafts),[_,L]=ut.useState({hasDraft:!1,busy:!1}),P=j8({shouldBlockFn:({next:ee})=>T||n===ba&&Z8({..._,hasDraft:H},ee.pathname),enableBeforeUnload:T||H||_.busy,withResolver:!0}),[Q,F]=ut.useState({kind:"idle"}),[we,J]=ut.useState(T2),[Z,oe]=ut.useState("details"),Te=ut.useRef(null),Rt=ut.useCallback((ee)=>{if(ee!=="details")Te.current=ee;oe(ee)},[]),K=As(),le=Nt(),{navigationQuery:se,types:ge,groupings:De,activeType:ct,collectionType:Et,activeCapabilities:zt,entityCollectionQuery:pe,entityListOffset:ze,workspaces:Tt,activeWorkspace:li,activeAccount:Bs,activeChat:Ns,initialUrlWorkspaceQuery:Uo,workspaceRequestQuery:zs,workspaceQuery:ce,workspaceData:In,workspaceError:Pi,agentTargets:Gr,syncStatus:Wr,entityListQuery:et,entities:Is,entityListTotal:Hs,schema:yr,createPath:yt,destinationQuery:za,saveEntityMutation:Po,deleteEntityMutation:ke,declarativeWorkspaceActionMutation:St,deleting:co,declarativeWorkspaceData:bt}=C8({api:le,entityType:g,activeWorkspaceId:p,routeSearch:o,workspaceQueries:k,editor:C}),_o=Tt.find((ee)=>ee.rendererName===Ku),[br,Tl]=ut.useState(!1),[Wp,ef]=ut.useState(null),Ju=C.mode.kind==="edit"?`${C.mode.entity.entityType}:${C.mode.entity.id}`:null;ut.useEffect(()=>{ef(null)},[Ju]);let _i=_o?.chatApiPath;ut.useEffect(()=>{if(!_i||Ju===null)return;let ee=(tn)=>{if(tn.key.toLowerCase()!=="j"||!(tn.metaKey||tn.ctrlKey)||tn.altKey||tn.shiftKey)return;tn.preventDefault(),Tl((Gi)=>!Gi)};return window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)},[_i,Ju]);let tf=C.mode.kind==="edit"&&ge?.find((ee)=>ee.entityType===g)?.capabilities.canAssist===!0;ut.useEffect(()=>{G8(_i!==void 0)},[_i]),ut.useEffect(()=>{if(!_i)return;let ee=()=>{if(tf)Tl(!0);else e.history.push(ba)};return window.addEventListener(Yw,ee),()=>window.removeEventListener(Yw,ee)},[_i,tf,e]);let nf=cR({entityType:g,entities:Is}),Zu=B2({principalId:document.querySelector("[data-studio-root]")?.getAttribute("data-studio-principal-id")??null,entityType:g,editor:C,hasUnsavedChanges:T,fields:yr?.fields??[],dispatch:A}),$s=a.kind==="grouping"?De.find((ee)=>ee.key===a.grouping):void 0,Ia=ut.useMemo(()=>K8(o),[o]),Ha=a.kind==="entity"?J8(r,l,De):null,qs=Ha?.path,Qr=ut.useMemo(()=>g?De.filter((ee)=>ee.types.includes(g)):[],[De,g]),$a=d8(Qr),{openEntity:Fr,loadError:Sn,setLoadError:Yr,retryOpen:Dl,supersedeOpen:Ml,currentOpenRequest:of,pendingOpenState:rf}=B8({api:le,queryClient:K,history:e.history,studioBasePath:l,routeTarget:a,routePathname:n,routeSearch:o,currentStudioPathname:d,createMode:c,entityType:g,collectionType:Et,activeType:ct,entityCollectionQuery:pe,preferredMobilePane:Te,dispatchEditor:A,setMobilePane:oe,setFieldAssistState:F});q8({history:e.history,queryClient:K,studioBasePath:l,routeTarget:a,routePathname:n,routeSearch:o,entityType:g,activeWorkspaceId:p,types:ge,groupings:De,workspaces:Tt,activeType:ct,activeWorkspace:li,entityCollectionQuery:pe,entityListOffset:ze,entityListTotal:Hs,declarativeWorkspaceData:bt,initialUrlWorkspaceQuery:Uo,setActiveWorkspaceId:m,setEntityType:b,setLoadError:Yr,supersedeOpen:Ml});let{openWorkspaceEntity:ec,openWorkspaceLaunch:tc,selectEntityType:fo,changeEntityPage:ji,selectWorkspace:nc,selectFolder:fb,startCreate:sf,backToList:Qp,changeWorkspaceQuery:ic}=T8({history:e.history,studioBasePath:l,routeSearch:o,entityType:g,collectionType:Et,entityCollectionQuery:pe,groupReturnPath:qs,workspaces:Tt,schema:yr,activeCapabilities:zt,pendingOpenState:rf,setFieldAssistState:F,setWorkspaceQueries:S}),{runFieldAssist:Vi,applyFieldAssist:Fp,save:lf,remove:Yp,baselineCommit:af}=I8({api:le,queryClient:K,history:e.history,studioBasePath:l,entityType:g,collectionType:Et,entityCollectionQuery:pe,groupReturnPath:qs,activeCapabilities:zt,schema:yr,editor:C,dispatchEditor:A,createPath:yt,syncStatus:Wr,deleting:co,saveEntityMutation:Po,deleteEntityMutation:ke,openEntity:Fr,currentOpenRequest:of,setMobilePane:oe,setFieldAssistState:F}),{performPublishingAction:Xp,performDeclarativeAction:Kp}=P8({queryClient:K,workspaces:Tt,activeWorkspaceId:p,entityType:g,mode:D,declarativeWorkspaceActionMutation:St,openEntity:Fr}),yi=Sn??(se.error?Na(se.error):et.error?Na(et.error):null),uf=()=>{if(Yr(null),se.error)se.refetch();if(et.error)et.refetch();if(ce.error)ce.refetch();if(D.kind==="browse")Dl()};if(yi&&!ge)return Mt.jsxDEV(Xu,{message:yi,error:!0,onRetry:uf},void 0,!1,void 0,this);if(!ge)return Mt.jsxDEV(Xu,{message:"Loading…"},void 0,!1,void 0,this);let cf=ge.find((ee)=>ee.entityType===g),Jp=async(ee)=>{if(ee.kind==="run")await le.runWorkspaceAction(ee.workspaceId,{actionId:ee.actionId,input:{}}),e.history.push(ee.href);else if(ee.kind==="ask-entry")Tl(!0);else if(ee.kind==="ask-brain")I.update(Xw(_i,null),{text:ee.question}),e.history.push(ba);else if(ee.kind==="create")e.history.push(sb(l,ee.entityType,ee.starter));else if(ee.kind==="climate")V8(document.documentElement.getAttribute("data-climate")==="instrument"?"paper":"instrument");else if(ee.href.startsWith("/"))e.history.push(ee.href);else window.location.assign(ee.href)},oc=Mt.jsxDEV(s8,{types:ge.map((ee)=>({entityType:ee.entityType,singularLabel:ee.singularLabel,classification:ee.classification,isSingleton:ee.isSingleton,canCreate:ee.capabilities.canCreate,...ee.starters&&{starters:ee.starters}})),hasChat:_i!==void 0,openEntry:D.kind==="edit"&&cf?.capabilities.canAssist?{typeLabel:cf.singularLabel.toLowerCase()}:null,onCommand:Jp},void 0,!1,void 0,this);if(Bs&&li){let ee=si(l,rb);return Mt.jsxDEV(Mt.Fragment,{children:[oc,Mt.jsxDEV(e8,{types:ge,workspaces:Tt,workspaceId:li.id,selectEntityType:fo,selectWorkspace:nc,children:Mt.jsxDEV(ut.Suspense,{fallback:Mt.jsxDEV(me,{children:"Opening Account…"},void 0,!1,void 0,this),children:Mt.jsxDEV(k_,{bootstrap:C_(ee,l,o)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}if(Ns&&li)return Mt.jsxDEV(Mt.Fragment,{children:[oc,Mt.jsxDEV(ut.Suspense,{fallback:Mt.jsxDEV(Xu,{message:"Opening Chat…"},void 0,!1,void 0,this),children:Mt.jsxDEV(S_,{apiPath:li.chatApiPath,draftStore:I,onNavigationStateChange:L,studioBasePath:l,sessionId:x_(o),types:ge,workspaces:Tt,handoff:c8(r),question:u8(r),navigate:(ee,tn)=>{e.history.push(ee,void 0,{ignoreBlocker:tn?.preserveWork===!0})},selectEntityType:fo,selectWorkspace:nc},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.status==="blocked"&&Mt.jsxDEV(Nn,{mark:"↩",title:"Leave this conversation?",titleId:"chat-navigation-title",cancelLabel:"Stay",confirmLabel:"Leave",onCancel:()=>P.reset(),onConfirm:()=>P.proceed(),children:Mt.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?p!==_p&&!In&&!Pi:g&&!yr&&!yi)return Mt.jsxDEV(Xu,{message:"Loading…"},void 0,!1,void 0,this);if(!$s&&a.kind!=="images"&&a.kind!=="documents"&&!p&&(!g||!yr&&!yi))return Mt.jsxDEV(Xu,{message:yi??"No readable collections are available for this account.",error:Boolean(yi),...yi?{onHome:()=>e.history.push(l)}:{}},void 0,!1,void 0,this);let df=(ee,tn)=>e.history.push(_n(l,ee,tn));return Mt.jsxDEV(Mt.Fragment,{children:[oc,Mt.jsxDEV(t8,{groupings:{items:De,active:$s?.key??Ha?.grouping??null,onSelect:(ee)=>e.history.push(ud(l,ee))},media:{active:a.kind==="images"||a.kind==="documents"?a.kind:null,onSelect:(ee)=>e.history.push(ee==="images"?Y8(l):Gp(l))},mediaView:a.kind==="images"?Mt.jsxDEV(tR,{onOpen:df},void 0,!1,void 0,this):a.kind==="documents"?Mt.jsxDEV(Z2,{documentId:new URLSearchParams(o).get("id"),onPick:(ee)=>e.history.push(Gp(l,ee??void 0)),onOpen:df},void 0,!1,void 0,this):null,homeView:p===_p?Mt.jsxDEV(AR,{chatApiPath:_o?.chatApiPath,onNavigate:(ee)=>e.history.push(ee),onAsk:(ee)=>{I.update(Xw(_o?.chatApiPath,null),{text:ee}),e.history.push(ba)}},void 0,!1,void 0,this):null,groupReturnLabel:Ha?.label,groupingSuggestions:$a,groupingView:$s?Mt.jsxDEV(V2,{basePath:l,grouping:$s,types:ge,query:Ia,onChange:(ee,tn)=>{let Gi=`${ud(l,$s.key)}${_h(ee)}`,Zp=ee.value!==Ia.value||ee.offset!==Ia.offset;e.history[Zp&&tn?.replace!==!0?"push":"replace"](Gi)},onOpen:(ee,tn)=>{let Gi=_n(l,ee,tn);rf.current={pathname:Gi,save:{kind:"idle"}},e.history.push(Gi,{studioGroupingPath:`${ud(l,$s.key)}${_h(Ia)}`})}},void 0,!1,void 0,this):null,activeWorkspaceId:p,types:ge,workspaces:Tt,workspaceError:Pi,readError:yi,onRetryRead:uf,declarativeWorkspaceData:bt,workspaceQuery:zs,entityType:g,entities:Is,refineNotice:nf.notice,onRefineConfirmed:nf.confirmed,folders:et.data?.folders??[],collectionTrail:et.data?.trail,pageTexts:et.data?.pageTexts,collectionPath:Et?qi(l,Et):l,selectFolder:fb,creationDestination:{data:za.data??null,pending:za.isPending,error:za.error},entityOffset:ze,entityLimit:pe.limit,entityTotal:Hs??0,collectionQuery:pe,onCollectionQueryChange:(ee)=>{if(!Et)return;e.history.push(`${qi(l,Et)}${ri({...ee,offset:0})}`),window.scrollTo({top:0,left:0})},entityListLoading:et.isPending,schema:yr,editor:C,fieldAssistState:Q,bodyMode:we,mobilePane:Z,syncStatus:Wr,baselineCommit:af,agentTargets:Gr,ask:_i?{chatApiPath:_i,draftStore:I,open:br,setOpen:Tl,selection:Wp,setSelection:ef}:void 0,deleting:co,hasUnsavedChanges:T,navigationBlocked:P.status==="blocked",dispatchEditor:A,setFieldAssistState:F,setBodyMode:J,setMobilePane:Rt,backToList:Qp,selectEntityType:fo,selectWorkspace:nc,changeEntityPage:ji,openWorkspaceEntity:ec,openWorkspaceLaunch:tc,performPublishingAction:Xp,performDeclarativeAction:Kp,onWorkspaceQueryChange:ic,startCreate:sf,openEntity:(ee,tn)=>Fr(ee,void 0,tn),runFieldAssist:Vi,applyFieldAssist:Fp,save:lf,remove:Yp,onNavigationReset:()=>P.reset?.(),draftRecovery:Zu,onNavigationProceed:()=>{Zu.forget(),P.proceed?.()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function i4(){return new n4({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var db=G(fe(),1),cb=document.querySelector("[data-studio-root]");if(cb){let e=cb.getAttribute("data-studio-base-path")??"/studio",n=new l4({basePath:e});cb.textContent="";let o=i4(),r=s4(e,t4);u4.createRoot(cb).render(db.jsxDEV(o4,{client:o,children:db.jsxDEV(a4,{api:n,children:db.jsxDEV(r4,{router:r},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}
|
|
268
268
|
|
|
269
269
|
//# debugId=B66CC3201A3DA3F964756E2164756E21
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 2,
|
|
3
3
|
"entrypoints": {
|
|
4
|
-
"script": "studio-app-
|
|
4
|
+
"script": "studio-app-1edp4r57.js",
|
|
5
5
|
"stylesheet": "studio-app-52032946342ba9bbe65238644c7c7c5b96a58973cfefc9377ffc4db842917c56.css"
|
|
6
6
|
},
|
|
7
7
|
"assets": {
|
|
8
|
+
"studio-app-1edp4r57.js": "studio-app-1edp4r57.js",
|
|
9
|
+
"studio-app-1edp4r57.js.map": "studio-app-1edp4r57.js.map",
|
|
8
10
|
"studio-app-52032946342ba9bbe65238644c7c7c5b96a58973cfefc9377ffc4db842917c56.css": "studio-app-52032946342ba9bbe65238644c7c7c5b96a58973cfefc9377ffc4db842917c56.css",
|
|
9
|
-
"studio-app-5zxnadkd.js": "studio-app-5zxnadkd.js",
|
|
10
|
-
"studio-app-5zxnadkd.js.map": "studio-app-5zxnadkd.js.map",
|
|
11
11
|
"studio-chunks/account-view-j9wkxck6.js": "studio-chunks/account-view-j9wkxck6.js",
|
|
12
12
|
"studio-chunks/account-view-j9wkxck6.js.map": "studio-chunks/account-view-j9wkxck6.js.map",
|
|
13
13
|
"studio-chunks/chat-cph4j688.js": "studio-chunks/chat-cph4j688.js",
|
|
14
14
|
"studio-chunks/chat-cph4j688.js.map": "studio-chunks/chat-cph4j688.js.map",
|
|
15
15
|
"studio-chunks/highlighted-body-OFNGDK62-64y2m0dm.js": "studio-chunks/highlighted-body-OFNGDK62-64y2m0dm.js",
|
|
16
16
|
"studio-chunks/highlighted-body-OFNGDK62-64y2m0dm.js.map": "studio-chunks/highlighted-body-OFNGDK62-64y2m0dm.js.map",
|
|
17
|
-
"studio-chunks/main-
|
|
18
|
-
"studio-chunks/main-
|
|
17
|
+
"studio-chunks/main-6qe1jp8h.js": "studio-chunks/main-6qe1jp8h.js",
|
|
18
|
+
"studio-chunks/main-6qe1jp8h.js.map": "studio-chunks/main-6qe1jp8h.js.map",
|
|
19
19
|
"studio-chunks/main-7fyr0wv3.js": "studio-chunks/main-7fyr0wv3.js",
|
|
20
20
|
"studio-chunks/main-7fyr0wv3.js.map": "studio-chunks/main-7fyr0wv3.js.map",
|
|
21
21
|
"studio-chunks/main-cjvg98dr.js": "studio-chunks/main-cjvg98dr.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"studio-chunks/mermaid-GHXKKRXX-nb261ktq.js.map": "studio-chunks/mermaid-GHXKKRXX-nb261ktq.js.map",
|
|
41
41
|
"studio-chunks/studio-ask-panel-njthpfwq.js": "studio-chunks/studio-ask-panel-njthpfwq.js",
|
|
42
42
|
"studio-chunks/studio-ask-panel-njthpfwq.js.map": "studio-chunks/studio-ask-panel-njthpfwq.js.map",
|
|
43
|
-
"studio-chunks/studio-chat-workspace-
|
|
44
|
-
"studio-chunks/studio-chat-workspace-
|
|
43
|
+
"studio-chunks/studio-chat-workspace-jw3pye8a.js": "studio-chunks/studio-chat-workspace-jw3pye8a.js",
|
|
44
|
+
"studio-chunks/studio-chat-workspace-jw3pye8a.js.map": "studio-chunks/studio-chat-workspace-jw3pye8a.js.map"
|
|
45
45
|
}
|
|
46
46
|
}
|