@rizom/brain 0.2.0-alpha.874 → 0.2.0-alpha.875
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 +8 -8
- package/dist/chunks/app-ekx3p63b.js +5 -0
- package/dist/chunks/{index-gs532kgg.js → index-02srst5t.js} +3 -3
- package/dist/chunks/{index-gs532kgg.js.map → index-02srst5t.js.map} +1 -1
- package/dist/chunks/{index-qq31xp89.js → index-5fa86d31.js} +2 -2
- package/dist/chunks/{index-nnwk2h8n.js → index-9kdd9kj5.js} +2 -2
- package/dist/chunks/{index-gnbfdewj.js → index-9mfc2kx2.js} +3 -3
- package/dist/chunks/{index-gnbfdewj.js.map → index-9mfc2kx2.js.map} +4 -4
- package/dist/chunks/{index-02pt9z7t.js → index-cywssss6.js} +2 -2
- package/dist/chunks/{index-wete5qfn.js → index-t822ntg2.js} +2 -2
- package/dist/chunks/{package-w9fjvvvv.js → package-c88dkedp.js} +3 -3
- package/dist/chunks/{package-w9fjvvvv.js.map → package-c88dkedp.js.map} +1 -1
- package/dist/entities.js +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +1 -1
- package/dist/interfaces.js +1 -1
- package/dist/model.js +6 -6
- package/dist/model.js.map +5 -5
- package/dist/services.js +1 -1
- package/dist/testing.js +1 -1
- package/dist/ui/{studio-app-1edp4r57.js → studio-app-bb5xxwvn.js} +3 -3
- package/dist/ui/studio-asset-manifest.json +21 -21
- package/dist/ui/studio-chunks/{account-view-j9wkxck6.js → account-view-ak5tfxgg.js} +1 -1
- package/dist/ui/studio-chunks/{main-d5szcfbq.js → main-2g8gcg0r.js} +1 -1
- package/dist/ui/studio-chunks/{main-rt6yh800.js → main-2hbxfr9g.js} +1 -1
- package/dist/ui/studio-chunks/{main-pqx64crr.js → main-45xgzy0v.js} +2 -2
- package/dist/ui/studio-chunks/{main-pqx64crr.js.map → main-45xgzy0v.js.map} +4 -4
- package/dist/ui/studio-chunks/{main-fqzf25fv.js → main-q24zjy7e.js} +1 -1
- package/dist/ui/studio-chunks/{main-ggcgvxym.js → main-qyf00dty.js} +1 -1
- package/dist/ui/studio-chunks/{main-6qe1jp8h.js → main-tcyq2xnp.js} +1 -1
- package/dist/ui/studio-chunks/{studio-ask-panel-njthpfwq.js → studio-ask-panel-vjymeavp.js} +1 -1
- package/dist/ui/studio-chunks/{studio-chat-workspace-jw3pye8a.js → studio-chat-workspace-kzcn37qq.js} +1 -1
- package/package.json +1 -1
- package/dist/chunks/app-zgd7ab53.js +0 -5
- /package/dist/chunks/{app-zgd7ab53.js.map → app-ekx3p63b.js.map} +0 -0
- /package/dist/chunks/{index-qq31xp89.js.map → index-5fa86d31.js.map} +0 -0
- /package/dist/chunks/{index-nnwk2h8n.js.map → index-9kdd9kj5.js.map} +0 -0
- /package/dist/chunks/{index-02pt9z7t.js.map → index-cywssss6.js.map} +0 -0
- /package/dist/chunks/{index-wete5qfn.js.map → index-t822ntg2.js.map} +0 -0
- /package/dist/ui/{studio-app-1edp4r57.js.map → studio-app-bb5xxwvn.js.map} +0 -0
- /package/dist/ui/studio-chunks/{account-view-j9wkxck6.js.map → account-view-ak5tfxgg.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-d5szcfbq.js.map → main-2g8gcg0r.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-rt6yh800.js.map → main-2hbxfr9g.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-fqzf25fv.js.map → main-q24zjy7e.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-ggcgvxym.js.map → main-qyf00dty.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-6qe1jp8h.js.map → main-tcyq2xnp.js.map} +0 -0
- /package/dist/ui/studio-chunks/{studio-ask-panel-njthpfwq.js.map → studio-ask-panel-vjymeavp.js.map} +0 -0
- /package/dist/ui/studio-chunks/{studio-chat-workspace-jw3pye8a.js.map → studio-chat-workspace-kzcn37qq.js.map} +0 -0
|
@@ -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-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
|
|
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-tcyq2xnp.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-2g8gcg0r.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-q24zjy7e.js";import{Ec as jn,Fc as Qn,Hc as TI,Ic as _2,Jc as ir}from"./studio-chunks/main-qyf00dty.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-45xgzy0v.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(`
|
|
@@ -259,11 +259,11 @@ ${a}`:`# ${r}`}}var Ee=G(fe(),1),CR=15000,xR=2;function jh(e){return Ee.jsxDEV("
|
|
|
259
259
|
|
|
260
260
|
`,cursor:5}}],aP={Text:{name:"Text",rank:0},Insert:{name:"Insert",rank:1}};function uP(e,n,o){if(e.insert)return{changes:{from:n,to:o,insert:e.insert.text},selection:{anchor:n+e.insert.cursor},scrollIntoView:!0,userEvent:"input.format"};let r=uw(e.block??"text",0);return{changes:{from:n,to:o,insert:r},selection:{anchor:n+r.length},scrollIntoView:!0,userEvent:"input.format"}}function Z3(e){let n=e.state.doc.lineAt(e.pos),o=e.state.sliceDoc(n.from,e.pos),r=/^(\s*)\/([\p{L} ]*)$/u.exec(o);if(!r)return null;let l=n.from+(r[1]?.length??0);return{from:l+1,options:lP.map((a,c)=>({label:a.label,detail:a.markdown,section:aP[a.section],boost:50-c,apply:(d,p,m,g)=>{if(a.opens==="image"){d.dispatch({changes:{from:l,to:g}}),A0(d);return}d.dispatch(uP(a,l,g))}})),validFor:/^[\p{L} ]*$/u}}var tz={defineNodes:["WikiLink","WikiLinkMark","WikiLinkTarget","WikiLinkWords"],props:[$u({WikiLinkMark:Y.processingInstruction,WikiLinkTarget:Y.url,WikiLinkWords:Y.link})],parseInline:[{name:"WikiLink",before:"Link",parse(e,n,o){if(n!==91||e.char(o+1)!==91||e.char(o-1)===33)return-1;let r=e.slice(o+2,e.end),l=r.indexOf("]]");if(l<=0)return-1;let a=r.slice(0,l);if(/[\n[]/.test(a))return-1;let c=o+2+l+2,d=a.indexOf("|"),p=d>=0?[e.elt("WikiLinkTarget",o+2,o+2+d),e.elt("WikiLinkMark",o+2+d,o+3+d),e.elt("WikiLinkWords",o+3+d,c-2)]:[e.elt("WikiLinkTarget",o+2,c-2)];return e.addElement(e.elt("WikiLink",o,c,[e.elt("WikiLinkMark",o,o+2),...p,e.elt("WikiLinkMark",c-2,c)]))}}]},Op="studio:open-wiki-link";function nz(e,n){let o=e.selection.main,r=e.sliceDoc(o.from,o.to).trim(),l=n.kind==="entry"?ez({type:n.type,id:n.id,words:r||n.title}):`[${(r||n.url).replace(/[[\]]/g,"")}](${n.url})`;return{changes:{from:o.from,to:o.to,insert:l},selection:{anchor:o.from+l.length},scrollIntoView:!0,userEvent:"input.link"}}var zo=G(Xe(),1);var pr={picker:{kVAEAm:"xixxii4",kY2c9j:"x68pp3s",kzqmXN:"xj6ak53 x9nnsnq",ks0D6T:"x1usz39j",k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kOIVth:"x17d4w8g",kmVPX3:"xe8ttls",kaIpWk:"x4pepcl",kWkggS:"x18s3upu",kGVxlE:"x7148in",$$css:!0},input:{kzqmXN:"xh8yej3",kAzted:"x141feeh x1c4ya5t",kmVPX3:"x1p3i4rr",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"xawfzfr",kaIpWk:"xhpnuu7",kWkggS:"x1dd94t5",kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",kGuDYH:"xif65rj xf2x79s",k3XXqK:"x1t137rt",$$css:!0},above:{kXwgrk:"x3ieub6",$$css:!0},list:{kogj98:"x1ghz6dp",kmVPX3:"x1717udv",kB88ic:"xe8uvvx",$$css:!0},option:{k1xSpc:"xrvj5dj",kOIVth:"x195vfkc",kAzted:"x1ba4aug x1yr3hz3",kfiyM8:"xc26acl",kmVPX3:"x1v9t41d",kaIpWk:"xur7f20",kkrTdU:"x1ypdohk",$$css:!0},optionActive:{kWkggS:"xg47p5g",$$css:!0},title:{kVQacm:"xb3r6kr",kg5iWk:"xlyipyv",khDVqt:"xuxw1ft",kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",kGuDYH:"xif65rj",$$css:!0},kind:{kMwMTN:"xgi1xjn",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",$$css:!0}};var wl=G(fe(),1),E0="studio:pick-link";function Lp(e){e.dom.dispatchEvent(new CustomEvent(E0,{bubbles:!0}))}var iz=/^(https?:\/\/|www\.)\S+$/i,cP=340,dP=300;function oz(e,n,o){let{innerWidth:r,innerHeight:l}=window;if(r<=640){let g=o?.querySelector('[role="toolbar"][aria-label="Formatting"]'),b=window.visualViewport;return{style:{left:8,right:8,bottom:(b?Math.max(0,l-b.height-b.offsetTop):0)+(g?.offsetHeight??0)+8},above:!0}}let a=e.coordsAtPos(n),c=e.scrollDOM.getBoundingClientRect(),d=Math.min(Math.max(8,a?.left??c.left),r-cP-8),p=a?.top??c.top,m=a?.bottom??c.top;return l-m>=dP?{style:{left:d,top:m+6},above:!1}:{style:{left:d,bottom:l-p+6},above:!0}}function rz(e){let{view:n,host:o,findEntries:r,onClose:l}=e,a=zo.useId(),c=zo.useRef(null),d=n.state.selection.main,p=n.state.sliceDoc(d.from,d.to).trim(),[m,g]=zo.useState(p),[b,k]=zo.useState([]),[S,C]=zo.useState(0),[A,D]=zo.useState(()=>oz(n,d.from,o.current));zo.useEffect(()=>{let L=d.from,P=()=>D(oz(n,L,o.current)),Q=o.current?.querySelector('[role="toolbar"][aria-label="Formatting"]'),F=new ResizeObserver(P);if(Q)F.observe(Q);let we=window.visualViewport;return we?.addEventListener("resize",P),window.addEventListener("resize",P),n.scrollDOM.addEventListener("scroll",P,{passive:!0}),()=>{F.disconnect(),we?.removeEventListener("resize",P),window.removeEventListener("resize",P),n.scrollDOM.removeEventListener("scroll",P)}},[n,o,d.from]),zo.useEffect(()=>c.current?.focus(),[]),zo.useEffect(()=>{let L=!0,P=m.trim();if(!P||iz.test(P)){k([]);return}let Q=window.setTimeout(()=>{r(P).then((F)=>{if(!L)return;k(F.slice(0,8)),C(0)},()=>{if(L)k([])})},120);return()=>{L=!1,window.clearTimeout(Q)}},[m,r]);let T=iz.test(m.trim())?m.trim().replace(/^www\./i,"https://www."):null,I=T?[{kind:"web",url:T}]:b.map((L)=>({kind:"entry",type:L.type,id:L.id,title:L.title})),H=(L)=>{n.dispatch(nz(n.state,L)),l(),n.focus()},_=(L)=>{if(L.key==="Escape")L.preventDefault(),l(),n.focus();else if(L.key==="ArrowDown"||L.key==="ArrowUp"){L.preventDefault();let P=L.key==="ArrowDown"?1:-1;C((Q)=>I.length?(Q+P+I.length)%I.length:0)}else if(L.key==="Enter"){L.preventDefault();let P=I[S];if(P)H(P)}};return wl.jsxDEV("div",{...E(pr.picker,A.above&&pr.above),style:A.style,"data-link-picker":"",children:[wl.jsxDEV("input",{ref:c,...E(pr.input),value:m,placeholder:"Search your entries, or paste an address","aria-label":"Link to",role:"combobox","aria-expanded":I.length>0,"aria-controls":a,"aria-activedescendant":I.length?`${a}-${S}`:void 0,onChange:(L)=>g(L.currentTarget.value),onKeyDown:_,onBlur:(L)=>{if(!L.currentTarget.parentElement?.contains(L.relatedTarget))l()}},void 0,!1,void 0,this),wl.jsxDEV("ul",{id:a,role:"listbox",hidden:I.length===0,...E(pr.list),children:T?wl.jsxDEV("li",{id:`${a}-0`,role:"option","aria-selected":S===0,...E(pr.option,S===0&&pr.optionActive),onMouseDown:(L)=>{L.preventDefault(),H({kind:"web",url:T})},children:wl.jsxDEV("span",{...E(pr.title),children:["Link to ",T]},void 0,!0,void 0,this)},void 0,!1,void 0,this):b.map((L,P)=>wl.jsxDEV("li",{id:`${a}-${P}`,role:"option","aria-selected":S===P,...E(pr.option,S===P&&pr.optionActive),onMouseDown:(Q)=>{Q.preventDefault(),H({kind:"entry",type:L.type,id:L.id,title:L.title})},children:[wl.jsxDEV("span",{...E(pr.title),children:L.title},void 0,!1,void 0,this),wl.jsxDEV("span",{...E(pr.kind),children:L.typeLabel},void 0,!1,void 0,this)]},`${L.type}/${L.id}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Gu=G(Xe(),1);var pn={bar:{k1xSpc:"x78zum5 xkaaz9w",kGNEyG:"x6s0dn4",kOIVth:"x195vfkc",k7Eaqz:"xeuugli",kVAEAm:"x1uhb9sk x12u6v07",kbCHJM:"x172uiah",kCIrl2:"x106zgql",krVfgx:"x13lx3cz",kY2c9j:"x1u2u1qb",kmVPX3:"x1717udv xe8qg4s",kEafiO:"x972fbf x1mofq2b",kPef9Z:"x13fuv20",kLZC3w:"xltl5i9",kWkggS:"xjbqb8w x1xv2l87",$$css:!0},barWriting:{k1xSpc:"x78zum5 x1ux6vrq",$$css:!0},tool:{k1xSpc:"xwz0xwf",kgQiWS:"x1ku5rj1",kprqdN:"x1mt1orb",kOIVth:"x1jnr06f",k7Eaqz:"x46jg8d x3s7kps",kZKoxP:"x10w6t97 x1fkvin3",kmVPX3:"xst3r74",kMzoRj:"xc342km",kaIpWk:"xu4hgxq",kWkggS:"xjbqb8w xgvbf8n",kMwMTN:"xgi1xjn x18m2ztq",kkrTdU:"x1ypdohk",kMv6JI:"x5ddh9m",kGuDYH:"xif65rj",kMeerF:"x784prv",k3XXqK:"x9v5kkp",kjBf7l:"xxh1od1",kInvED:"x1bqaal",$$css:!0},style:{kg3NbH:"xdqyycr",k63SB2:"xk50ysn",$$css:!0},styleWide:{k1xSpc:"xt0psk2 xkaaz9w",$$css:!0},styleNarrow:{k1xSpc:"x1s85apg xxf1wfy",$$css:!0},separator:{kzqmXN:"x1i1rx1s",kZKoxP:"x1qx5ct2",kUOVxO:"xjgtzcg",kWkggS:"x3ee1ji",$$css:!0},italic:{kMv6JI:"xssy22x",kGuDYH:"x1j61zf2",$$css:!0},code:{kMv6JI:"xa9opjo",kGuDYH:"xfifm61",$$css:!0},icon:{kzqmXN:"x1se2ifz",kZKoxP:"x1ta3ar0",kDwRjp:"xbh8q5q",kjVXCG:"x73je2i",kfJifR:"xhxwl1",kU5bRw:"x1owpc8m",kJdQPc:"x1f6yumg",$$css:!0},wideOnly:{k1xSpc:"xjp7ctv xkaaz9w",$$css:!0},phoneOnly:{k1xSpc:"x1s85apg x1ux6vrq",kGNEyG:"x6s0dn4",koQZXg:"x8x9d4c",kOIVth:"x195vfkc",$$css:!0},done:{kAzted:"x1gg8mnh",kmVPX3:"x1p3i4rr",kMzoRj:"xc342km",kWkggS:"xjbqb8w",kMwMTN:"x1q7454x",kkrTdU:"x1ypdohk",kMv6JI:"x5ddh9m",kGuDYH:"x1jvydc1",k63SB2:"x1s688f",kMeerF:"x784prv",k3XXqK:"x9v5kkp",kjBf7l:"xxh1od1",kInvED:"x1bqaal",$$css:!0},selectionBar:{kVAEAm:"x10l6tqk",kY2c9j:"x1355qak",k1xSpc:"x78zum5 xkaaz9w",kOIVth:"x195vfkc",kmVPX3:"xfawy5m",kaIpWk:"x1q4ynmn",kWkggS:"x18s3upu",kGVxlE:"x1fdd90r",$$css:!0},askLabel:{kGuDYH:"x4z9k3i",k63SB2:"x1s688f",$$css:!0}};var de=G(fe(),1),fw={text:"Text",heading:"Heading",subheading:"Subheading",bullet:"Text",numbered:"Text",checklist:"Text",quote:"Text"};function Io(e,n){if(!e)return;e.dispatch(n(e.state)),e.focus()}function ni(e){return de.jsxDEV("button",{type:"button",...E(pn.tool),"aria-label":e.label,title:e.shortcut?`${e.label} (${e.shortcut})`:e.label,onMouseDown:(n)=>n.preventDefault(),onClick:e.onRun,children:e.children},void 0,!1,void 0,this)}function Wu(e){return de.jsxDEV("svg",{...E(pn.icon),viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:e.children},void 0,!1,void 0,this)}var fP=()=>de.jsxDEV(Wu,{children:[de.jsxDEV("circle",{cx:"5",cy:"7",r:"1.4"},void 0,!1,void 0,this),de.jsxDEV("circle",{cx:"5",cy:"12",r:"1.4"},void 0,!1,void 0,this),de.jsxDEV("circle",{cx:"5",cy:"17",r:"1.4"},void 0,!1,void 0,this),de.jsxDEV("path",{d:"M10 7h10M10 12h10M10 17h10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),hP=()=>de.jsxDEV(Wu,{children:de.jsxDEV("path",{d:"M4 6h2v4M4 10h3M4 14h3l-3 4h3M10 7h10M10 12h10M10 17h10"},void 0,!1,void 0,this)},void 0,!1,void 0,this),pP=()=>de.jsxDEV(Wu,{children:[de.jsxDEV("rect",{x:"3.5",y:"4.5",width:"6",height:"6",rx:"1.2"},void 0,!1,void 0,this),de.jsxDEV("path",{d:"m4.8 7.6 1.4 1.4 2.4-2.6M3.5 13.5h6v6h-6zM13 7.5h8M13 16.5h8"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),az=()=>de.jsxDEV(Wu,{children:de.jsxDEV("path",{d:"M5 17V12c0-3 1.5-5 4-6M14 17V12c0-3 1.5-5 4-6M5 12h4v5H5zM14 12h4v5h-4z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),uz=()=>de.jsxDEV(Wu,{children:[de.jsxDEV("path",{d:"M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"},void 0,!1,void 0,this),de.jsxDEV("path",{d:"M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),mP=()=>de.jsxDEV(Wu,{children:[de.jsxDEV("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"},void 0,!1,void 0,this),de.jsxDEV("circle",{cx:"9",cy:"10",r:"2"},void 0,!1,void 0,this),de.jsxDEV("path",{d:"m21 16-5-5-9 9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),gP=()=>de.jsxDEV(Wu,{children:de.jsxDEV("path",{d:"M3 12h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this);function yP(e){Gu.useEffect(()=>{let n=window.visualViewport,o=e.current;if(!n||!o)return;let r=()=>{let l=window.innerHeight-n.height-n.offsetTop;o.style.setProperty("--keyboard-inset",`${Math.max(0,Math.round(l))}px`)};return r(),n.addEventListener("resize",r),n.addEventListener("scroll",r),()=>{n.removeEventListener("resize",r),n.removeEventListener("scroll",r)}},[e])}function cz(e){let{view:n}=e,o=Gu.useRef(null);yP(o);let r=n?cw(n.state,n.state.selection.main.head):"text";return de.jsxDEV("div",{ref:o,role:"toolbar","aria-label":"Formatting",...E(pn.bar,e.writing&&pn.barWriting),"data-format-bar":"",children:[de.jsxDEV(T0,{children:[de.jsxDEV(D0,{...E(pn.tool,pn.style),"aria-label":`Style: ${fw[r]}`,onMouseDown:(l)=>l.preventDefault(),children:[de.jsxDEV("span",{...E(pn.styleWide),children:fw[r]},void 0,!1,void 0,this),de.jsxDEV("span",{...E(pn.styleNarrow),"aria-hidden":"true",children:"Aa"},void 0,!1,void 0,this),de.jsxDEV("span",{"aria-hidden":"true",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),de.jsxDEV(M0,{align:"start",children:["text","heading","subheading"].map((l)=>de.jsxDEV(Bp,{onSelect:()=>Io(n,(a)=>Vu(a,l==="text"?r:l)),children:fw[l]},l,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),de.jsxDEV("span",{...E(pn.separator),"aria-hidden":"true"},void 0,!1,void 0,this),de.jsxDEV(ni,{label:"Bold",shortcut:"⌘B",onRun:()=>Io(n,(l)=>xl(l,"**")),children:de.jsxDEV("b",{children:"B"},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV(ni,{label:"Italic",shortcut:"⌘I",onRun:()=>Io(n,(l)=>xl(l,"*")),children:de.jsxDEV("i",{...E(pn.italic),children:"I"},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV("span",{...E(pn.wideOnly),children:[de.jsxDEV(ni,{label:"Strikethrough",shortcut:"⌘⇧X",onRun:()=>Io(n,(l)=>xl(l,"~~")),children:de.jsxDEV("s",{children:"S"},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV(ni,{label:"Code",shortcut:"⌘E",onRun:()=>Io(n,(l)=>xl(l,"`")),children:de.jsxDEV("span",{...E(pn.code),children:"</>"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),de.jsxDEV(ni,{label:"Link",shortcut:"⌘K",onRun:()=>{if(n)Lp(n)},children:de.jsxDEV(uz,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV("span",{...E(pn.separator,pn.wideOnly),"aria-hidden":"true"},void 0,!1,void 0,this),de.jsxDEV(ni,{label:"Bulleted list",onRun:()=>Io(n,(l)=>Vu(l,"bullet")),children:de.jsxDEV(fP,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV("span",{...E(pn.wideOnly),children:de.jsxDEV(ni,{label:"Numbered list",onRun:()=>Io(n,(l)=>Vu(l,"numbered")),children:de.jsxDEV(hP,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV(ni,{label:"Checklist",onRun:()=>Io(n,(l)=>Vu(l,"checklist")),children:de.jsxDEV(pP,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV(ni,{label:"Quote",onRun:()=>Io(n,(l)=>Vu(l,"quote")),children:de.jsxDEV(az,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV(ni,{label:"Image",onRun:()=>{if(n)A0(n)},children:de.jsxDEV(mP,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV("span",{...E(pn.wideOnly),children:de.jsxDEV(ni,{label:"Divider",onRun:()=>Io(n,X3),children:de.jsxDEV(gP,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV("span",{...E(pn.phoneOnly),children:[de.jsxDEV(ni,{label:"More blocks",onRun:()=>{if(!n)return;let l=n.state.doc.lineAt(n.state.selection.main.head),a=l.text.trim()?`
|
|
261
261
|
/`:"/",c=l.text.trim()?l.to:l.from;n.dispatch({changes:{from:c,to:l.text.trim()?c:l.to,insert:a},selection:{anchor:c+a.length}}),n.focus(),gp(n)},children:"/"},void 0,!1,void 0,this),de.jsxDEV("button",{type:"button",...E(pn.done),onMouseDown:(l)=>l.preventDefault(),onClick:()=>n?.contentDOM.blur(),children:"Done"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function dz(e){let{view:n,host:o}=e,r=lz(),[l,a]=Gu.useState(null),c=n?.state.selection.main,d=n!==null&&n.hasFocus&&c!==void 0&&!c.empty?c.from:null,p=d!==null;if(Gu.useEffect(()=>{if(n===null||d===null||!o.current){a(null);return}let m=n.coordsAtPos(d),g=o.current.getBoundingClientRect();if(!m){a(null);return}a({top:m.top-g.top-44,left:m.left-g.left})},[n,d,o]),!p||!l)return null;return de.jsxDEV("div",{role:"toolbar","aria-label":"Selected words",...E(pn.selectionBar),style:{top:l.top,left:l.left},"data-selection-bar":"",children:[de.jsxDEV(ni,{label:"Bold",shortcut:"⌘B",onRun:()=>Io(n,(m)=>xl(m,"**")),children:de.jsxDEV("b",{children:"B"},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV(ni,{label:"Italic",shortcut:"⌘I",onRun:()=>Io(n,(m)=>xl(m,"*")),children:de.jsxDEV("i",{...E(pn.italic),children:"I"},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV(ni,{label:"Link",shortcut:"⌘K",onRun:()=>{if(n)Lp(n)},children:de.jsxDEV(uz,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),de.jsxDEV(ni,{label:"Quote",onRun:()=>Io(n,(m)=>Vu(m,"quote")),children:de.jsxDEV(az,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),r&&de.jsxDEV(ni,{label:"Ask about these words",onRun:sz,children:de.jsxDEV("span",{...E(pn.askLabel),children:"Ask"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Np=G(Xe(),1);var ro={grid:{k1xSpc:"xrvj5dj",kumcoG:"x1sipb5g x9ov8se",kOIVth:"x167g77z",kogj98:"x1bjd80g",kmVPX3:"x1717udv",kB88ic:"xe8uvvx",$$css:!0},cell:{k7Eaqz:"xeuugli",$$css:!0},thumb:{k1xSpc:"x1lliihq",kzqmXN:"xh8yej3",kOBAk4:"x1dltgaz",kmVPX3:"x1717udv",kVQacm:"xb3r6kr",kMzoRj:"xc342km",kaIpWk:"xur7f20",kWkggS:"xg47p5g",kkrTdU:"x1ypdohk",kMeerF:"x784prv",k3XXqK:"x9v5kkp",kjBf7l:"xxh1od1",kInvED:"x7s97pk",kGVxlE:"x1gnnqk1 x1dhj52s",$$css:!0},thumbImage:{k1xSpc:"x1lliihq",kzqmXN:"xh8yej3",kZKoxP:"x5yr21d",kVIFPx:"xl1xv1r",$$css:!0},actions:{k1xSpc:"xrvj5dj",kOIVth:"x1jnr06f",keoZOQ:"x1xmf6yo",$$css:!0},action:{kVAEAm:"x1n2onr6",k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kAzted:"x1gg8mnh",kg3NbH:"x1awh872",kaIpWk:"xur7f20",kMwMTN:"xqvuw85",kkrTdU:"x1ypdohk",kMv6JI:"x5ddh9m",kGuDYH:"xif65rj",k63SB2:"xk50ysn",kWkggS:"xjbqb8w xgvbf8n xzwmdui",$$css:!0},file:{kVAEAm:"x10l6tqk",kpwlN0:"x10a8y8t",kzqmXN:"xh8yej3",kZKoxP:"x5yr21d",kSiTet:"xg01cxk",kkrTdU:"x1ypdohk",$$css:!0},phoneOnly:{k1xSpc:"x1s85apg x1ux6vrq",$$css:!0},note:{kogj98:"xe6w4ck",kMwMTN:"xgi1xjn",kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",$$css:!0}};var mi=G(fe(),1),bP=12;function fz(e){let{open:n,source:o}=e,[r,l]=Np.useState(),[a,c]=Np.useState(null);Np.useEffect(()=>{if(!n)return;let m=!0;return c(null),o.library().then((g)=>{if(m)l(g.slice(0,bP))},()=>{if(m)l([]),c("Your images could not be loaded. You can still upload.")}),()=>{m=!1}},[n,o]);let d=(m)=>{e.onChoose(m),e.onOpenChange(!1)},p=(m)=>{let g=w0(m.currentTarget.files??[]);if(m.currentTarget.value="",g.length===0)return;c(g.length===1?"Adding the image…":`Adding ${g.length} images…`),Promise.allSettled(g.map(o.upload)).then((b)=>{let k=b.flatMap((S)=>S.status==="fulfilled"?[S.value]:[]);if(k.length===g.length)d(k);else{if(k.length>0)e.onChoose(k);c(`${g.length-k.length} of ${g.length} could not be uploaded.`)}})};return mi.jsxDEV(Ma,{open:n,onOpenChange:e.onOpenChange,children:mi.jsxDEV(Ra,{"aria-describedby":void 0,"data-body-image-picker":"",children:[mi.jsxDEV(Oa,{children:"Add an image"},void 0,!1,void 0,this),r===void 0?mi.jsxDEV("p",{...E(ro.note),children:"Loading your images…"},void 0,!1,void 0,this):r.length>0?mi.jsxDEV("ul",{...E(ro.grid),"aria-label":"Your recent images",children:r.map((m)=>mi.jsxDEV("li",{...E(ro.cell),children:mi.jsxDEV("button",{type:"button",...E(ro.thumb),"aria-label":m.title||m.alt||m.id,onClick:()=>d([{id:m.id,alt:m.alt||m.title}]),children:mi.jsxDEV(dd,{imageId:m.id,alt:"",thumbnailWidth:200,...E(ro.thumbImage)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},m.id,!1,void 0,this))},void 0,!1,void 0,this):mi.jsxDEV("p",{...E(ro.note),children:"No images yet: upload the first."},void 0,!1,void 0,this),mi.jsxDEV("div",{...E(ro.actions),children:[mi.jsxDEV("label",{...E(ro.action),children:[mi.jsxDEV("input",{type:"file",accept:"image/*",multiple:!0,...E(ro.file),onChange:p},void 0,!1,void 0,this),"Upload from this device"]},void 0,!0,void 0,this),mi.jsxDEV("label",{...E(ro.action,ro.phoneOnly),children:[mi.jsxDEV("input",{type:"file",accept:"image/*",capture:"environment",...E(ro.file),onChange:p},void 0,!1,void 0,this),"Take a photo"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a&&mi.jsxDEV("p",{...E(ro.note),role:"status",children:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var pt=G(Xe(),1);var hw="entity://image/";function vP(e){return e.startsWith(hw)&&e.length>hw.length?decodeURIComponent(e.slice(hw.length)):null}function kP(e){let n=new Set;for(let o of e.selection.ranges){let r=e.doc.lineAt(o.from).number,l=e.doc.lineAt(o.to).number;for(let a=r;a<=l;a+=1)n.add(a)}return n}var SP=new Set(["EmphasisMark","StrikethroughMark"]);function xP(e,n,o=0,r=e.doc.length){let l=px(e,r,200)??lt(e),a=[],c=(g)=>n.has(e.doc.lineAt(g).number),d=(g)=>e.doc.sliceString(g,g+1)===" "?1:0,p=(g,b)=>{if(b>g&&!c(g))a.push({from:g,to:b,kind:"hide"})},m=(g,b)=>{let k=e.doc.lineAt(g.from).number,S=e.doc.lineAt(g.to).number;for(let C=k;C<=S;C+=1){let A=e.doc.line(C).from;a.push({from:A,to:A,kind:b})}};return l.iterate({from:o,to:r,enter:(g)=>{let b=g.node,k=b.parent?.name;switch(b.name){case"Image":{let S=b.getChild("URL");if(S&&!c(b.from)){let C=b.getChildren("LinkMark");a.push({from:b.from,to:b.to,kind:"image",src:e.doc.sliceString(S.from,S.to),alt:C.length>=2?e.doc.sliceString(C[0]?.to??0,C[1]?.from??0):""})}return!1}case"Table":return!1;case"WikiLink":{if(c(b.from))return!1;let S=b.getChild("WikiLinkTarget"),C=b.getChild("WikiLinkWords");if(!S)return!1;let A=C??S;return p(b.from,A.from),p(A.to,b.to),a.push({from:A.from,to:A.to,kind:"link",target:e.doc.sliceString(S.from,S.to)}),!1}case"HeaderMark":if(k?.startsWith("ATXHeading"))p(b.from,b.to+d(b.to));return;case"CodeMark":if(k==="InlineCode")p(b.from,b.to);return;case"Link":{let S=b.getChildren("LinkMark")[1];if(S)a.push({from:b.firstChild?.to??b.from,to:S.from,kind:"link"});return}case"LinkMark":case"URL":case"LinkTitle":if(k==="Link"||k==="Autolink")p(b.from,b.to);return;case"QuoteMark":p(b.from,b.to+d(b.to));return;case"Blockquote":m(b,"quote");return;case"FencedCode":m(b,"code");for(let S of[...b.getChildren("CodeMark"),...b.getChildren("CodeInfo")])p(S.from,S.to);return!1;case"ListMark":{if(b.parent?.parent?.name!=="BulletList")return;let C=b.nextSibling?.name==="Task";if(c(b.from))return;if(C)p(b.from,b.to+d(b.to));else a.push({from:b.from,to:b.to,kind:"bullet"});return}case"TaskMarker":if(!c(b.from))a.push({from:b.from,to:b.to,kind:"task",checked:/x/i.test(e.doc.sliceString(b.from,b.to))});return;case"HorizontalRule":if(!c(b.from))a.push({from:b.from,to:b.to,kind:"rule"});return;default:if(SP.has(b.name))p(b.from,b.to);return}}}),a.sort((g,b)=>g.from-b.from||g.to-b.to)}class gz extends to{eq(){return!0}toDOM(){let e=document.createElement("span");return e.className="cm-live-bullet",e.textContent="•",e}}class yz extends to{checked;position;constructor(e,n){super();this.checked=e,this.position=n}eq(e){return e.checked===this.checked&&e.position===this.position}toDOM(e){let n=document.createElement("span");return n.className="cm-live-task",n.setAttribute("role","checkbox"),n.setAttribute("aria-checked",String(this.checked)),n.setAttribute("aria-label",this.checked?"Done":"Not done"),n.textContent=this.checked?"✓":"",n.addEventListener("mousedown",(o)=>{o.preventDefault(),e.dispatch({changes:{from:this.position+1,to:this.position+2,insert:this.checked?" ":"x"}})}),n}ignoreEvent(){return!1}}class bz extends to{src;alt;load;release;constructor(e,n,o){super();this.src=e,this.alt=n,this.load=o}eq(e){return e.src===this.src&&e.alt===this.alt}toDOM(){let e=document.createElement("span");e.className="cm-live-image";let n=document.createElement("img");if(n.alt=this.alt,e.append(n),this.alt){let r=document.createElement("span");r.className="cm-live-image-caption",r.textContent=this.alt,e.append(r)}let o=vP(this.src);if(o&&this.load){let r=new AbortController,l;this.release=()=>{if(r.abort(),l)URL.revokeObjectURL(l)},this.load(o,r.signal).then((a)=>{if(r.signal.aborted||!a.type.startsWith("image/"))return;l=URL.createObjectURL(a),n.src=l},()=>{return})}else if(/^https?:\/\//i.test(this.src))n.src=this.src;return e}destroy(){this.release?.()}}class vz extends to{eq(){return!0}toDOM(){let e=document.createElement("span");return e.className="cm-live-rule",e.setAttribute("role","separator"),e}}var wP=Ke.replace({}),CP=Ke.replace({widget:new gz}),AP=Ke.replace({widget:new vz}),EP=Ke.mark({class:"cm-live-link"}),TP=Ke.line({class:"cm-live-quote"}),DP=Ke.line({class:"cm-live-code"});function hz(e,n){let o=e.hasFocus?kP(e.state):new Set,r=e.visibleRanges.flatMap((l)=>xP(e.state,o,l.from,l.to).flatMap((a)=>{switch(a.kind){case"hide":return[wP.range(a.from,a.to)];case"bullet":return[CP.range(a.from,a.to)];case"rule":return[AP.range(a.from,a.to)];case"link":if(a.to<=a.from)return[];return[a.target?Ke.mark({class:"cm-live-link",attributes:{"data-wiki-target":a.target,title:"⌘-click to open"}}).range(a.from,a.to):EP.range(a.from,a.to)];case"quote":return[TP.range(a.from)];case"code":return[DP.range(a.from)];case"image":return[Ke.replace({widget:new bz(a.src??"",a.alt??"",n)}).range(a.from,a.to)];case"task":return[Ke.replace({widget:new yz(a.checked===!0,a.from)}).range(a.from,a.to)]}}));return Ke.set(r,!0)}function pz(e){return e.trim().replace(/^\|/,"").replace(/(?<!\\)\|$/,"").split(/(?<!\\)\|/).map((o)=>o.trim())}function MP(e){let n=px(e,e.doc.length,200)??lt(e),o=[];return n.iterate({enter:(r)=>{if(r.name!=="Table")return;let l=e.doc.lineAt(r.from).from,a=e.doc.lineAt(r.to).to;if(e.selection.ranges.some((g)=>g.from<=a&&g.to>=l))return!1;let d=e.doc.sliceString(l,a).split(`
|
|
262
|
-
`),p=pz(d[1]??"").map((g)=>/^:-+:$/.test(g)?"center":/-+:$/.test(g)?"right":"left"),m=[d[0]??"",...d.slice(2)].filter((g)=>g.trim()).map(pz);return o.push({from:l,to:a,rows:m,align:p}),!1}}),o}class kz extends to{block;constructor(e){super();this.block=e}eq(e){return e.block.from===this.block.from&&JSON.stringify(e.block.rows)===JSON.stringify(this.block.rows)&&e.block.align.join()===this.block.align.join()}toDOM(e){let n=document.createElement("div");n.className="cm-live-table",n.tabIndex=0,n.setAttribute("role","region"),n.setAttribute("aria-label","Table, select to edit");let o=document.createElement("table");this.block.rows.forEach((l,a)=>{let c=document.createElement("tr");l.forEach((d,p)=>{let m=document.createElement(a===0?"th":"td");m.textContent=d,m.style.textAlign=this.block.align[p]??"left",c.append(m)}),(a===0?o.tHead??o.createTHead():o.tBodies[0]??o.createTBody()).append(c)}),n.append(o);let r=(l)=>{l.preventDefault(),e.dispatch({selection:{anchor:this.block.from}}),e.focus()};return n.addEventListener("pointerdown",r),n.addEventListener("keydown",(l)=>{if(l.key==="Enter")r(l)}),n}ignoreEvent(){return!0}}var RP=hi.define({create:(e)=>mz(e),update:(e,n)=>n.docChanged||n.selection!==void 0||lt(n.startState)!==lt(n.state)?mz(n.state):e,provide:(e)=>ue.decorations.from(e)});function mz(e){return Ke.set(MP(e).map((n)=>Ke.replace({widget:new kz(n),block:!0}).range(n.from,n.to)))}function Sz(e={}){return[RP,LP(e.loadImage),OP]}var OP=ue.domEventHandlers({mousedown:(e,n)=>{if(!(e.metaKey||e.ctrlKey)||e.button!==0)return!1;let o=e.target instanceof Element?e.target.closest("[data-wiki-target]")?.getAttribute("data-wiki-target"):null;if(!o)return!1;return e.preventDefault(),n.dom.dispatchEvent(new CustomEvent(Op,{bubbles:!0,detail:{target:o}})),!0}});function LP(e){return Bo.fromClass(class{decorations;constructor(n){this.decorations=hz(n,e)}update(n){if(n.docChanged||n.selectionSet||n.viewportChanged||n.focusChanged||lt(n.startState)!==lt(n.state))this.decorations=hz(n.view,e)}},{decorations:(n)=>n.decorations})}var zi=G(fe(),1),Az=Ti.define(),BP=Ld.define([{tag:Y.heading1,fontFamily:"var(--console-display)",fontSize:"1.75em",fontWeight:"600",color:"var(--console-text)"},{tag:Y.heading2,fontFamily:"var(--console-display)",fontSize:"1.4em",fontWeight:"600",color:"var(--console-text)"},{tag:Y.heading3,fontFamily:"var(--console-display)",fontSize:"1.18em",fontWeight:"600",color:"var(--console-text)"},{tag:Y.heading,color:"var(--console-text)",fontWeight:"600"},{tag:Y.monospace,fontFamily:"var(--console-mono)",fontSize:"0.86em"},{tag:Y.meta,color:"var(--console-text-muted)"},{tag:Y.emphasis,fontStyle:"italic"},{tag:Y.strong,fontWeight:"600"},{tag:[Y.link,Y.url],color:"var(--console-text)",textDecoration:"underline"},{tag:Y.quote,color:"var(--console-text-dim)"},{tag:[Y.keyword,Y.bool,Y.null,Y.operator],color:"color-mix(in srgb, var(--console-accent) 55%, var(--console-text))"},{tag:[Y.string,Y.regexp],color:"color-mix(in srgb, var(--console-ok) 55%, var(--console-text))"},{tag:Y.number,color:"color-mix(in srgb, var(--console-warn) 45%, var(--console-text))"},{tag:Y.comment,color:"color-mix(in srgb, var(--console-text-dim) 70%, var(--console-text))",fontStyle:"italic"},{tag:[Y.typeName,Y.propertyName,Y.tagName,Y.attributeName],fontWeight:"600"},{tag:Y.processingInstruction,color:"var(--console-text-dim)",fontFamily:"var(--console-mono)",fontSize:"0.82em",fontWeight:"400"}]),NP=[["TypeScript",["ts","typescript"],ju.configure({dialect:"ts"})],["TSX",["tsx"],ju.configure({dialect:"ts jsx"})],["JavaScript",["js","javascript"],ju],["JSX",["jsx"],ju.configure({dialect:"jsx"})],["CSS",["css"],h0],["HTML",["html"],m0],["JSON",["json"],wz]].map(([e,n,o])=>qu.of({name:e,alias:[...n],support:new ur(qr.define({parser:o}))})),R0=(e)=>(n)=>(n.dispatch(xl(n.state,e)),!0),zP=yl.of([{key:"Mod-k",run:(e)=>{if(e.state.selection.main.empty)return!1;return Lp(e),!0}},{key:"Mod-b",run:R0("**")},{key:"Mod-i",run:R0("*")},{key:"Mod-e",run:R0("`")},{key:"Mod-Shift-x",run:R0("~~")}]),IP=[s3({base:Pd,codeLanguages:NP,extensions:[tz]}),dB(BP),ue.lineWrapping,ue.contentAttributes.of({tabindex:"0"}),b3(),zP,yl.of([...x3,...F3.filter((e)=>e.key!=="Mod-/")])];function xz(e,n){return e?[Sz(n?{loadImage:n}:{}),RB({override:[Z3],icons:!1,activateOnTyping:!0,aboveCursor:!1}),ue.contentAttributes.of({"aria-label":"Writing"})]:[ue.contentAttributes.of({"aria-label":"Markdown source"})]}function HP(e,n=[]){return it.create({doc:e,extensions:[...IP,...n]})}function $P(e,n){if(e.state.doc.toString()===n)return;e.dispatch({changes:{from:0,to:e.state.doc.length,insert:n},annotations:Az.of(!0)})}function qP(e){let{value:n,live:o,onChange:r,onSelectionChange:l,readOnly:a}=e,c=pt.useRef(e.loadImage),d=pt.useRef(null),p=pt.useRef(null),m=pt.useRef(n),g=pt.useRef(a),b=pt.useRef(new Ru),k=pt.useRef(new Ru),S=pt.useRef(o),C=pt.useRef(r),A=pt.useRef(l),D=pt.useRef(e.onView),T=pt.useRef(e.onActivity),I=pt.useRef(e.uploadImage),H=pt.useRef(e.onImageFailure);pt.useEffect(()=>{D.current=e.onView,T.current=e.onActivity,I.current=e.uploadImage,H.current=e.onImageFailure},[e.onView,e.onActivity,e.uploadImage,e.onImageFailure]);let _=pt.useCallback((L)=>{let P=L.state.selection.main;A.current?.(P.empty?null:{from:P.from,to:P.to})},[]);return pt.useEffect(()=>{C.current=r,A.current=l},[r,l]),pt.useEffect(()=>{let L=d.current;if(!L)return;let P=new ue({parent:L,state:HP(m.current,[k.current.of(xz(S.current,c.current)),b.current.of([it.readOnly.of(g.current),ue.editable.of(!g.current)]),ue.updateListener.of((Q)=>{if(!Q.docChanged)return;if(Q.transactions.some((F)=>F.annotation(Az)===!0))return;C.current(Q.state.doc.toString())}),ue.updateListener.of((Q)=>{if(!Q.selectionSet&&!Q.docChanged)return;_(Q.view)}),ue.updateListener.of((Q)=>{if(Q.selectionSet||Q.docChanged||Q.focusChanged)T.current?.()}),J3((Q)=>I.current?I.current(Q):Promise.reject(Error("images cannot be added here")),(Q)=>H.current?.(Q)),ue.domEventHandlers({keyup:(Q,F)=>(_(F),!1),mouseup:(Q,F)=>(window.setTimeout(()=>_(F),0),!1),touchend:(Q,F)=>(window.setTimeout(()=>_(F),0),!1)})])});return p.current=P,D.current?.(P),()=>{if(P.destroy(),p.current===P)p.current=null;D.current?.(null)}},[_]),pt.useEffect(()=>{let L=p.current;if(!L)return;$P(L,n)},[n]),pt.useEffect(()=>{let L=p.current;if(!L)return;L.dispatch({effects:b.current.reconfigure([it.readOnly.of(a),ue.editable.of(!a)])})},[a]),pt.useEffect(()=>{let L=p.current;if(!L)return;L.dispatch({effects:k.current.reconfigure(xz(o,c.current))})},[o]),zi.jsxDEV("div",{ref:d,...E(dl.source),"data-editor":"codemirror6"},void 0,!1,void 0,this)}var pw={write:"Show Markdown",markdown:"Show the writing"};function Ez(e){let{value:n,mode:o,onChange:r,onModeChange:l,onSelectionChange:a,readOnly:c=!1}=e,d=o==="write"?"markdown":"write",p=n.trim()?n.trim().split(/\s+/).length:0,[m,g]=pt.useState(null),[,b]=pt.useState(0),k=pt.useRef(null),S=!c,[C,A]=pt.useState(!1),[D,T]=pt.useState(!1),I=e.links;pt.useEffect(()=>{let L=k.current;if(!L||!I)return;let P=()=>T(!0),Q=(F)=>{let we=F instanceof CustomEvent?F.detail:void 0,J=zn(we)?we.target:void 0;if(typeof J==="string"&&J)I.open(J)};return L.addEventListener(E0,P),L.addEventListener(Op,Q),()=>{L.removeEventListener(E0,P),L.removeEventListener(Op,Q)}},[I]);let[H,_]=pt.useState(null);return pt.useEffect(()=>{let L=k.current;if(!L||!e.images)return;let P=()=>A(!0);return L.addEventListener(C0,P),()=>L.removeEventListener(C0,P)},[e.images]),zi.jsxDEV("div",{ref:k,...E(dl.root),"data-body-mode":o,onKeyDown:(L)=>{if(L.key==="/"&&(L.metaKey||L.ctrlKey)&&!L.altKey&&!L.shiftKey)L.preventDefault(),l(d)},children:[zi.jsxDEV("header",{...E(dl.toolbar),children:[S&&zi.jsxDEV(cz,{view:m,writing:m?.hasFocus??!1},void 0,!1,void 0,this),H&&zi.jsxDEV("span",{...E(dl.imageStatus),role:"status",children:H},void 0,!1,void 0,this),zi.jsxDEV("span",{...E(dl.metadata),children:[p.toLocaleString()," ",p===1?"word":"words"]},void 0,!0,void 0,this),zi.jsxDEV("button",{type:"button",...E(dl.markdownToggle),"aria-pressed":o==="markdown","aria-label":"Markdown","aria-keyshortcuts":"Control+/ Meta+/",title:`${pw[o]} (⌘/)`,"data-markdown-toggle":"",onClick:()=>l(d),children:"M↓"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S&&o==="write"&&zi.jsxDEV(dz,{view:m,host:k},void 0,!1,void 0,this),zi.jsxDEV("div",{...E(dl.panes),children:c&&o==="write"?zi.jsxDEV("div",{...E(dl.preview),"data-studio-preview":"",tabIndex:0,role:"region","aria-label":"Rendered document",children:zi.jsxDEV(Cz,{presentation:"document",documentTitle:e.documentTitle,children:n},void 0,!1,void 0,this)},void 0,!1,void 0,this):zi.jsxDEV(qP,{value:n,live:o==="write",loadImage:e.loadImage,uploadImage:e.images?.upload,onImageFailure:_,onView:g,onActivity:()=>b((L)=>L+1),onChange:r,onSelectionChange:(L)=>a?.(L?{...L,text:n.slice(L.from,L.to)}:null),readOnly:c},void 0,!1,void 0,this)},void 0,!1,void 0,this),S&&I&&D&&m&&zi.jsxDEV(rz,{view:m,host:k,findEntries:I.findEntries,onClose:()=>T(!1)},void 0,!1,void 0,this),S&&e.images&&zi.jsxDEV(fz,{open:C,onOpenChange:A,source:e.images,onChoose:(L)=>{if(!m)return;_(null),m.dispatch(dw(m.state,L)),m.focus()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Cl="grouping-definitions",Qu=20,UP=Ii.strictObject({label:O0.shape.label,excludeTypes:Ii.array(O0.shape.types.element).max(100).refine((e)=>new Set(e).size===e.length,"Excluded types must be unique.").optional(),multiple:Ii.boolean(),values:Ii.array(Ii.string().min(1)).min(1).superRefine((e,n)=>{let o=new Set;e.forEach((r,l)=>{if(o.has(r))n.addIssue({code:"custom",path:[l],message:"Values must be unique (matching is exact)."});o.add(r)})}).optional()}),Tz=Ii.object({groupings:Ii.record(O0.shape.key,UP).refine((e)=>Object.keys(e).length<=Qu,`Define at most ${Qu} groupings.`).default({})});var Fu=G(Xe(),1);var zp=G(fe(),1);function jd(e,n){return n==="split"?e.fields.find((o)=>o.name==="title"&&o.widget==="string"):void 0}function Mz(e){let n=Fu.useId(),o=Dz(),r=Fu.useRef(null),l=Fu.useRef(null),a=e.issues?.find((c)=>c.path[0]===e.descriptor.name);return Fu.useEffect(()=>{let c=r.current;if(!a||!c||c!==c.closest("form")?.querySelector("[data-studio-invalid-field]"))return;l.current?.focus()},[a,e.issues]),zp.jsxDEV("span",{ref:r,...a&&{"data-studio-invalid-field":""},children:[zp.jsxDEV("span",{"data-value":e.value,...E(jn.titleGrow),children:zp.jsxDEV("textarea",{ref:l,rows:1,name:e.descriptor.name,"aria-label":e.descriptor.label,value:e.value,required:e.descriptor.required!==!1,placeholder:e.placeholder,"aria-invalid":a?!0:void 0,"aria-describedby":a?n:void 0,onKeyDown:(c)=>{if(c.key==="Enter")c.preventDefault()},onChange:(c)=>e.onChange(c.currentTarget.value.replace(/\r?\n/g," ")),...E(jn.titleInput)},void 0,!1,void 0,this)},void 0,!1,void 0,this),a&&zp.jsxDEV("span",{id:n,...E(jn.titleIssue),children:[o==="save"&&"Last save: ",a.message]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var L0="studio-save-reason";function B0(e,n,o){if(!mw(e,n,o))return;let r=n.fieldIssues?.some((l)=>l.path[0]!=="segment"&&l.path[0]!=="prefix");if(Ip(e)||r)return"Fix the highlighted fields first.";if(n.destinationBlocked&&e.mode.kind==="create")return n.presentation&&jd(n.entitySchema,n.presentation)?"Give this entry a title to create it.":"Name the file to create this entry.";return}function mw(e,n,o){let r=n.selectedEntityType===Cl,l=r||e.mode.kind==="create"&&n.entitySchema.isSingleton;return!n.canEdit||Ip(e)||r&&!n.entitySchema.groupingDefinitions||n.destinationBlocked||e.save.kind==="saving"||l&&!o}var Vd=G(Xe(),1);var so={root:{keoZOQ:"x1sgpng",kmVPX3:"x6w2896",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"x8tuc8h",kZ1KPB:"x1vo0akb",k4WBpm:"x19ypqd9",kaZRDh:"x1yn89ol",kaIpWk:"xu4hgxq",kWkggS:"x18s3upu",$$css:!0},head:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kjj79g:"x1qughib",kOIVth:"x883omv",kMwMTN:"x1ar3pfp",$$css:!0},state:{kMwMTN:"xgi1xjn",k63SB2:"x1pd3egz",$$css:!0},copy:{kogj98:"x108lf0y",kMwMTN:"x1ar3pfp",kGuDYH:"x1j6dyjg",kLWn49:"xfrs9s4",kHjlTd:"xj0a0fe",$$css:!0},actions:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"x1j9xkj6",keoZOQ:"xk9mzb7",$$css:!0},button:{kAzted:"x1rz828m x1c4ya5t",kmVPX3:"x1jmcyos",kGuDYH:"x1k6wstc",$$css:!0},publish:{kVAM5u:"xawfzfr",kWkggS:"x15vqgvx",kMwMTN:"x1um1dla",$$css:!0},complete:{kMwMTN:"x19k5i5u",kMv6JI:"xa9opjo",$$css:!0},confirmation:{kmVPX3:"x12s40zk",kZ1KPB:"x19sr0n1",k4WBpm:"x19ypqd9",kaZRDh:"xzxeg27",kWkggS:"xc1c755",kVVagm:"x1t8o5tu",$$css:!0}};var ii=G(fe(),1);function gw(e){return"success"in e&&e.success===!1}function yw(e){return"needsConfirmation"in e&&e.needsConfirmation===!0}function PP(e){return ii.jsxDEV(Nn,{mark:"↑",title:`Publish ${e.title} now?`,titleId:"publish-confirm-title",cancelLabel:"Review again",confirmLabel:e.confirming?"Publishing…":"Confirm publication",pending:e.confirming,confirmVariant:"primary",onCancel:e.onCancel,onConfirm:e.onConfirm,children:[ii.jsxDEV("p",{children:e.preview},void 0,!1,void 0,this),ii.jsxDEV("p",{...E(so.confirmation),children:"This sends the current saved version to an external public provider."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Rz(e){let[n,o]=Vd.useState(null),[r,l]=Vd.useState(null),[a,c]=Vd.useState(null),d={entityType:e.entityType,entityId:e.entityId},p=e.unsaved||n!==null,m=e.status==="draft"?e.missing??[]:[],g=m.length>0,b=Vd.useCallback(async(C,A)=>{o(A),l(null);try{let D=await e.onAction(C);if(gw(D))throw Error(D.error);if(yw(D))c({args:D.args,preview:D.preview??`This will publish ${e.entityType}:${e.entityId} publicly.`});else if(C.type==="publish")c(null)}catch(D){l(Ln(D))}finally{o(null)}},[e]),k=e.status==="queued"?{type:"remove",...d}:e.status==="failed"?{type:"retry",...d}:{type:"queue",...d},S=e.status==="queued"?"Remove from queue":e.status==="failed"?"Retry":"Add to queue";return ii.jsxDEV("section",{...E(so.root),"aria-label":"Publication actions",children:[ii.jsxDEV("header",{...E(so.head,lo.eyebrow),children:[ii.jsxDEV("span",{children:"Publication"},void 0,!1,void 0,this),ii.jsxDEV("b",{...E(so.state,N0(e.status==="queued"?"warn":e.status==="failed"?"error":e.status==="published"?"good":void 0)),children:e.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ii.jsxDEV("p",{...E(so.copy),children:"Operates on the saved entity. Publication state is separate from the save pipeline below."},void 0,!1,void 0,this),e.unsaved&&ii.jsxDEV("p",{...E(so.copy,N0("warn")),children:"Save changes before changing publication state."},void 0,!1,void 0,this),g&&ii.jsxDEV("p",{...E(so.copy,N0("warn")),children:_P(m)},void 0,!1,void 0,this),e.status!=="published"&&ii.jsxDEV("div",{...E(so.actions),children:[ii.jsxDEV(xe,{type:"button",variant:"ghost",xstyle:so.button,disabled:p||g,onClick:()=>void b(k,"lifecycle"),children:n==="lifecycle"?"Working…":S},void 0,!1,void 0,this),ii.jsxDEV(xe,{type:"button",xstyle:[so.button,so.publish],disabled:p||g,onClick:()=>void b({type:"publish",...d},"publish"),children:n==="publish"?"Preparing…":"Publish now"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.status==="published"&&ii.jsxDEV("p",{...E(so.copy,so.complete),children:"Published externally."},void 0,!1,void 0,this),r&&ii.jsxDEV(me,{tone:"error",children:r},void 0,!1,void 0,this),a&&ii.jsxDEV(PP,{title:e.title,preview:a.preview,confirming:n==="confirm",onCancel:()=>c(null),onConfirm:()=>void b({type:"publish",...d,confirmation:a.args},"confirm")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function _P(e){return`Add ${e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)??""}`} before publishing.`}var z0=G(Xe(),1);var Ho=G(fe(),1);function Oz(e){e.querySelector("details[data-studio-properties]")?.setAttribute("open","")}function Lz({presentation:e,children:n}){return e==="split"?Ho.jsxDEV(Ho.Fragment,{children:n},void 0,!1,void 0,this):Ho.jsxDEV("div",{"data-studio-editor-content":"",role:"region","aria-label":"Record contents",tabIndex:0,...E(rn.content),children:n},void 0,!1,void 0,this)}function Bz({presentation:e,reveal:n,children:o,summaryDescription:r,hidden:l=!1,sheet:a=!1,onCloseSheet:c}){let d=z0.useRef(null);if(z0.useLayoutEffect(()=>{if(n&&d.current)d.current.open=!0},[n]),e==="document")return Ho.jsxDEV("details",{ref:d,"data-studio-properties":"",...E(rn.disclosure),children:[Ho.jsxDEV("summary",{...E(rn.summary),children:["Properties",r&&Ho.jsxDEV("span",{...E(rn.summaryDescription),children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ho.jsxDEV("div",{...E(rn.disclosedFields),children:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Ho.jsxDEV("aside",{"data-studio-properties":"",...E(Qn.colophon,e==="form"&&Qn.fullWidthProperties,e==="form"&&rn.properties,l&&Qn.colophonHidden,a&&Qn.detailsSheet),"aria-label":a?"Details":void 0,"data-studio-details-sheet":a?"":void 0,"data-studio-sheet":a?"":void 0,children:[a&&c&&Ho.jsxDEV("header",{...E(rn.sheetHead),children:[Ho.jsxDEV("h2",{...E(rn.sheetTitle),children:"Details"},void 0,!1,void 0,this),Ho.jsxDEV("button",{type:"button",...E(rn.sheetDone),onClick:c,children:"Done"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),o]},void 0,!0,void 0,this)}var $p=G(Xe(),1);var oi=G(Xe(),1);function I0(e,n=[]){if(e!==void 0&&!zn(e))return{rows:[],nextId:0,malformed:{value:e}};let o=Object.entries(e??{}).map(([r,l],a)=>({id:a,key:r,value:l,...n.includes(r)?{savedKey:r}:{}}));return{rows:o,nextId:o.length}}function Nz(e){return{...e,rows:[...e.rows,{id:e.nextId,key:"",value:{label:"",multiple:!0}}],nextId:e.nextId+1}}function zz(e,n,o){return{...e,rows:e.rows.map((r)=>{if(r.id!==n)return r;if(r.savedKey!==void 0&&o.key!==void 0&&o.key!==r.savedKey)throw Error("Saved grouping keys cannot be renamed.");return{...r,...o}})}}function Iz(e,n){return{...e,rows:e.rows.filter((o)=>o.id!==n)}}function bw(e){if(e.malformed)return{value:void 0,issues:[{path:["groupings"],message:"Groupings must be a mapping. Repair the source or explicitly replace it."}],pendingChanges:!1};let n=e.rows.filter((a,c)=>e.rows.some((d,p)=>p<c&&d.key===a.key));if(n.length)return{value:void 0,issues:n.map((a)=>({path:["groupings",a.key],message:`The key “${a.key}” is already used. Choose a different key.`})),pendingChanges:!0};let o=Object.fromEntries(e.rows.map((a)=>[a.key,a.value])),r=Tz.safeParse({groupings:o}),l=r.success?[]:r.error.issues.map((a)=>({path:a.path.map((c)=>typeof c==="symbol"?String(c):c),message:a.message}));return{value:o,issues:l,pendingChanges:!1}}var en={intro:{kMwMTN:"xgi1xjn",kGuDYH:"x4z9k3i",kLWn49:"x1dbl2gt",k1K539:"x1hq5gj4",ks0D6T:"x70i6om",$$css:!0},help:{kMwMTN:"xgi1xjn",$$css:!0},grid:{k1xSpc:"xrvj5dj",kumcoG:"xnby9oq x4jmfmw",kOIVth:"xhp1hw2",kqGvvJ:"x1mibpdg",k7Eaqz:"xeuugli",$$css:!0},choices:{kmVPX3:"x1717udv",kogj98:"x1ghz6dp",kMzoRj:"xc342km",k7Eaqz:"xeuugli",$$css:!0},choice:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x883omv",kAzted:"xu0aao5 x1c4ya5t",kHjlTd:"xj0a0fe",$$css:!0},readOnly:{k1xSpc:"x1lliihq",kmVPX3:"x1160tuk",kMzoRj:"xmkeg23",ksu8eU:"xbsl7fq",kVAM5u:"x8tuc8h",kaIpWk:"x1kogg8i",kWkggS:"xbslqsl",kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kHjlTd:"xj0a0fe",$$css:!0},first:{k8WAf4:"x10bfh3y",ks0D6T:"xe0576n",$$css:!0},actions:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kjj79g:"x1qughib",kOIVth:"xou54vl",keoZOQ:"xhrpt6u",$$css:!0},exclusions:{k1K539:"xod5an3",$$css:!0},exclusionsSummary:{k1xSpc:"xtcx8v3",kpqbRz:"x1cy9i3i",kkrTdU:"x1ypdohk",kAzted:"x1gg8mnh",k8WAf4:"x10dr8xq",$$css:!0},rule:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"xfe5i6u",k1K539:"xod5an3",$$css:!0}};var Me=G(fe(),1);function Hp(e,n,o){let r={...e,[n]:o};if(n==="excludeTypes"&&Array.isArray(o)&&o.length===0)delete r[n];return r}function $z(e){let{row:n,readOnly:o}=e,r=zn(n.value)?n.value:void 0,l=n.savedKey!==void 0,a=typeof r?.label==="string"&&r.label.length>0?r.label:l?n.key:"New grouping",c=(d)=>e.onUpdate({value:d});return Me.jsxDEV("section",{...E(La.section),"aria-label":a,"data-definition-row":n.id,children:[Me.jsxDEV("div",{...E(La.head),children:[Me.jsxDEV("h2",{...E(La.title),children:a},void 0,!1,void 0,this),!o&&Me.jsxDEV(xe,{type:"button",variant:"ghost","aria-label":`Remove ${a} grouping`,onClick:(d)=>e.onRemove(d.currentTarget),children:"Remove grouping"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.issues.length>0&&Me.jsxDEV(me,{tone:"error",children:e.issues.map((d)=>d.message).join(" · ")},void 0,!1,void 0,this),!r?Me.jsxDEV(Me.Fragment,{children:[Me.jsxDEV(me,{tone:"error",children:"This definition is not a mapping. Repair its source or explicitly remove the definition."},void 0,!1,void 0,this),Me.jsxDEV("pre",{...E(en.readOnly),children:JSON.stringify(n.value,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Me.jsxDEV(Me.Fragment,{children:[Me.jsxDEV(jP,{entry:r,label:a,rowKey:n.key,saved:l,readOnly:o,onChange:c,onKeyChange:(d)=>e.onUpdate({key:d})},void 0,!1,void 0,this),Me.jsxDEV(VP,{entry:r,contributorTypes:e.contributorTypes,systemTypes:e.systemTypes,readOnly:o,onChange:c},void 0,!1,void 0,this),Me.jsxDEV(GP,{entry:r,label:a,name:e.allowedValuesName,usage:e.usage,readOnly:o,onChange:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function jP(e){let{entry:n,label:o,saved:r,readOnly:l}=e,a=n.multiple;return Me.jsxDEV("div",{...E(en.grid),children:[Me.jsxDEV("label",{...E(Kt.field),children:[Me.jsxDEV("span",{...E(Kt.label),children:"Label"},void 0,!1,void 0,this),l?Me.jsxDEV("span",{...E(en.readOnly),children:o},void 0,!1,void 0,this):Me.jsxDEV(Eu,{"aria-label":`${o} label`,value:typeof n.label==="string"?n.label:"",onChange:(c)=>e.onChange(Hp(n,"label",c.currentTarget.value)),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Me.jsxDEV("label",{...E(Kt.field),children:[Me.jsxDEV("span",{...E(Kt.label),children:"Key"},void 0,!1,void 0,this),l?Me.jsxDEV("code",{...E(en.readOnly),children:e.rowKey},void 0,!1,void 0,this):Me.jsxDEV(Eu,{"aria-label":`${o} key`,value:e.rowKey,readOnly:r,xstyle:r?Kt.readOnly:void 0,required:!0,onChange:(c)=>{if(!r)e.onKeyChange(c.currentTarget.value)}},void 0,!1,void 0,this),Me.jsxDEV("span",{...E(Kt.listHelp,en.help),children:r?"Fixed after creation":"Lowercase letters, digits and hyphens. Fixed when saved."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Me.jsxDEV("label",{...E(Kt.field),children:[Me.jsxDEV("span",{...E(Kt.label),children:"Values per entry"},void 0,!1,void 0,this),l?Me.jsxDEV("span",{...E(en.readOnly),children:a===!0?"Several":a===!1?"One":"Invalid cardinality"},void 0,!1,void 0,this):Me.jsxDEV(wu,{"aria-label":`${o} values per entry`,value:a===!0?"several":a===!1?"one":"",onChange:(c)=>e.onChange(Hp(n,"multiple",c.currentTarget.value==="several")),required:!0,children:[Me.jsxDEV("option",{value:"",disabled:!0,children:"Choose cardinality"},void 0,!1,void 0,this),Me.jsxDEV("option",{value:"one",children:"One"},void 0,!1,void 0,this),Me.jsxDEV("option",{value:"several",children:"Several"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function VP(e){let{entry:n,contributorTypes:o}=e,r=Array.isArray(n.excludeTypes)?n.excludeTypes.filter((c)=>typeof c==="string"):[],l=r.filter((c)=>!e.systemTypes.includes(c)),a=new Set(o.map((c)=>c.entityType));return Me.jsxDEV("details",{...E(en.exclusions),children:[Me.jsxDEV("summary",{...E(Kt.label,en.exclusionsSummary),children:["Exclude types",l.length>0?` (${l.length})`:""]},void 0,!0,void 0,this),Me.jsxDEV("p",{...E(Kt.listHelp,en.help),children:"Content types participate unless excluded. System types never participate."},void 0,!1,void 0,this),e.readOnly?Me.jsxDEV("span",{...E(en.readOnly),children:l.map((c)=>o.find((d)=>d.entityType===c)?.label??`${c} (unavailable)`).join(", ")||"None"},void 0,!1,void 0,this):Me.jsxDEV("fieldset",{...E(en.choices),children:[Me.jsxDEV("legend",{...E(Kt.label),children:"Excluded content types"},void 0,!1,void 0,this),[...o,...l.filter((c)=>!a.has(c)).map((c)=>({entityType:c,label:`${c} (unavailable)`}))].map((c)=>Me.jsxDEV("label",{...E(en.choice),children:[Me.jsxDEV("input",{type:"checkbox","aria-label":`Exclude ${c.label}`,...E(La.checkbox),checked:r.includes(c.entityType),onChange:(d)=>e.onChange(Hp(n,"excludeTypes",d.currentTarget.checked?[...r,c.entityType]:r.filter((p)=>p!==c.entityType)))},void 0,!1,void 0,this),c.label]},c.entityType,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function GP(e){let{entry:n,label:o,usage:r}=e,l=Object.hasOwn(n,"values"),a=r?new Map(r.values.map((c)=>[c.value,c.count])):void 0;return Me.jsxDEV(Me.Fragment,{children:[Me.jsxDEV("fieldset",{...E(en.choices,en.rule),children:[Me.jsxDEV("legend",{...E(Kt.label),children:"Allowed values"},void 0,!1,void 0,this),e.readOnly?Me.jsxDEV("span",{...E(en.readOnly),children:l?"Only these values":"Any value"},void 0,!1,void 0,this):Me.jsxDEV(Me.Fragment,{children:[!1,!0].map((c)=>Me.jsxDEV("label",{...E(en.choice),children:[Me.jsxDEV("input",{type:"radio",name:e.name,"aria-label":`${o}: ${c?"only these values":"any value"}`,checked:l===c,...E(La.checkbox),onChange:()=>e.onChange(c?Hp(n,"values",[]):Object.fromEntries(Object.entries(n).filter(([d])=>d!=="values")))},void 0,!1,void 0,this),c?"Only these values":"Any value"]},String(c),!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l&&Me.jsxDEV(Me.Fragment,{children:[Me.jsxDEV(Hz,{label:`${o} allowed values`,purpose:"allowed-values",definition:{multiple:!0},value:n.values,onChange:(c)=>e.onChange(Hp(n,"values",c)),readOnly:e.readOnly,counts:a},void 0,!1,void 0,this),Me.jsxDEV("p",{...E(Kt.listHelp,en.help),children:Array.isArray(n.values)&&n.values.length===0?"Add at least one allowed value, or choose Any value.":r?"Numbers show current usage. Unused values remain available.":"Usage is unavailable until this grouping can be read."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Qt=G(fe(),1);function qz(e,n){return e&&Object.hasOwn(e,n)?e[n]:void 0}function Uz(e){let[n,o]=oi.useState(()=>I0(e.value,e.savedKeys)),[r,l]=oi.useState(null),a=oi.useRef(null),c=oi.useRef(void 0),d=oi.useRef(null),p=oi.useId(),m=oi.useId(),g=JSON.stringify(e.value),b=JSON.stringify(e.savedKeys),k=oi.useRef(g),S=oi.useRef(b),C=oi.useRef(void 0),A=bw(n);oi.useEffect(()=>{if(g===k.current&&b===S.current)return;k.current=g,S.current=b,o(I0(e.value,e.savedKeys)),l(null)},[g,e.value,b,e.savedKeys]),oi.useEffect(()=>{let _={issues:A.issues,pendingChanges:A.pendingChanges},L=JSON.stringify(_);if(C.current===L)return;C.current=L,e.onStateChange(_)}),oi.useEffect(()=>{if(c.current!==void 0)a.current?.querySelector(`[data-definition-row="${c.current}"] input`)?.focus(),c.current=void 0;if(r===null&&d.current)(d.current.isConnected?d.current:a.current?.querySelector("[data-definition-add]"))?.focus(),d.current=null},[n,r]);let D=(_,L)=>{L.focus(),d.current=L,l(_)},T=(_)=>{if(e.readOnly)return;o(_);let L=bw(_);if(L.value!==void 0)k.current=JSON.stringify(L.value),e.onChange(L.value);let P={issues:L.issues,pendingChanges:L.pendingChanges};C.current=JSON.stringify(P),e.onStateChange(P)},I=n.rows.find((_)=>_.id===r),H=[...A.issues,...e.issues??[]];return Qt.jsxDEV("div",{ref:a,role:"group","aria-label":"Grouping definitions","aria-describedby":H.length?m:void 0,children:[Qt.jsxDEV("p",{...E(en.intro),children:"Groups collect entries by exact frontmatter values. Removing a grouping or a listed value never rewrites entries. Values outside a list stay visible until an editor changes them."},void 0,!1,void 0,this),e.readOnly&&Qt.jsxDEV(me,{children:"You can use these groupings. Only administrators can change their definitions."},void 0,!1,void 0,this),n.malformed?Qt.jsxDEV(Qt.Fragment,{children:[Qt.jsxDEV(me,{tone:"error",children:"The stored groupings are not a mapping. Their source has not been discarded."},void 0,!1,void 0,this),Qt.jsxDEV("pre",{...E(en.readOnly),children:JSON.stringify(n.malformed.value,null,2)},void 0,!1,void 0,this),!e.readOnly&&Qt.jsxDEV(xe,{type:"button",variant:"outline",onClick:(_)=>D("reset",_.currentTarget),children:"Replace invalid definitions"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Qt.jsxDEV(Qt.Fragment,{children:[n.rows.length===0&&Qt.jsxDEV("section",{...E(en.first),children:[Qt.jsxDEV("h2",{...E(La.title),children:"Your first grouping"},void 0,!1,void 0,this),Qt.jsxDEV("p",{...E(en.intro),children:"Bring related entries together, of any content type, without moving them. Give a grouping a label and say whether an entry belongs to one value or several."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n.rows.map((_)=>Qt.jsxDEV($z,{row:_,usage:qz(e.usage,_.key),contributorTypes:e.contributorTypes,systemTypes:e.systemTypes,readOnly:e.readOnly,issues:H.filter((L)=>L.path[1]===_.key),allowedValuesName:`${p}-${_.id}-allowed`,onUpdate:(L)=>T(zz(n,_.id,L)),onRemove:(L)=>D(_.id,L)},_.id,!1,void 0,this)),!e.readOnly&&Qt.jsxDEV("div",{...E(en.actions),children:[Qt.jsxDEV(xe,{type:"button",variant:"outline","data-definition-add":"",disabled:n.rows.length>=Qu,onClick:()=>{c.current=n.nextId,T(Nz(n))},children:"Add grouping"},void 0,!1,void 0,this),Qt.jsxDEV("span",{...E(Kt.kind),children:[n.rows.length," / ",Qu]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.length>0&&Qt.jsxDEV("div",{id:m,children:Qt.jsxDEV(me,{tone:"error",children:["Cannot save:"," ",H.map((_)=>{let L=_.path.slice(1).join(".");return L?`${L}: ${_.message}`:_.message}).join(" · ")]},void 0,!0,void 0,this)},void 0,!1,void 0,this),r!==null&&!e.readOnly&&Qt.jsxDEV(WP,{target:r,row:I,usage:I?qz(e.usage,I.key):void 0,titleId:p,onCancel:()=>l(null),onConfirm:()=>{T(r==="reset"?I0({}):Iz(n,r)),l(null)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function WP(e){let{row:n,usage:o}=e,r=e.target==="reset",l=n&&zn(n.value)&&typeof n.value.label==="string"?n.value.label:n?.key;return Qt.jsxDEV(Nn,{mark:"−",title:r?"Replace invalid definitions?":`Remove ${l?.length?l:"unsaved"} grouping?`,titleId:e.titleId,cancelLabel:r?"Keep definitions":"Keep grouping",confirmLabel:r?"Replace definitions":"Remove grouping",confirmVariant:"danger",onCancel:e.onCancel,onConfirm:e.onConfirm,children:[Qt.jsxDEV("p",{children:[r?"This replaces the invalid definitions with an empty document when you save. ":o?o.entries===1?"1 entry carries this grouping and keeps its values. ":`${o.entries} entries carry this grouping and keep their values. `:"Usage is unavailable. Existing entries keep their values. ","No entries are deleted or moved. The change takes effect after saving."]},void 0,!0,void 0,this),!r&&Qt.jsxDEV("p",{children:"Re-adding the same key can collect those values again."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Al=G(fe(),1);function _z(e){let{editor:n,schema:o,dispatch:r}=e,l=n.draft.groupings,a=n.mode.kind==="edit"?n.mode.entity.frontmatter.groupings:void 0,c=zn(a)?Object.keys(a):[],d=o.issues.filter((T)=>{let I=T.path[1];if(typeof I==="string"&&zn(l)&&zn(a))return Object.hasOwn(l,I)&&JSON.stringify(l[I])===JSON.stringify(a[I]);return JSON.stringify(l)===JSON.stringify(a)}),p=d.length>0;$p.useEffect(()=>{r({type:"compoundFieldStateChanged",field:"grouping-source",invalid:p,pendingChanges:!1})},[r,p]);let m=Nt(),g=$p.useMemo(()=>(zn(a)?Object.keys(a):[]).filter((T)=>Pz.safeParse(T).success&&zn(l)&&Object.hasOwn(l,T)).slice(0,Qu).map((T)=>{let I=zn(l)&&zn(l[T])?l[T]:void 0,H=Array.isArray(I?.values)?I.values.filter((_)=>typeof _==="string"):[];return{key:T,values:H}}),[l,a]),b=$p.useMemo(()=>g.map(({key:T,values:I})=>H2(m,T,I)),[m,g]),k=H0({queries:b}),S=Object.fromEntries(g.flatMap(({key:T},I)=>{let H=k[I];return H?.isSuccess&&!H.isFetching?[[T,H.data]]:[]})),C=k.some((T)=>T.isFetching),A=k.some((T)=>ad(T.failureReason)),D=k.filter((T)=>T.isError&&!T.isFetching);return Al.jsxDEV(Al.Fragment,{children:[C&&Al.jsxDEV(me,{children:Al.jsxDEV("span",{role:"status",children:A?"Groupings are initializing. Usage will load when ready.":"Loading grouping usage…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),D.length>0&&Al.jsxDEV(me,{tone:"error",children:["Some grouping usage is unavailable. Counts are not assumed to be zero."," ",Al.jsxDEV(xe,{type:"button",variant:"outline",size:"sm",onClick:()=>{for(let T of D)T.refetch()},children:"Retry usage"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Al.jsxDEV(Uz,{value:l,savedKeys:c,contributorTypes:o.contributorTypes,systemTypes:o.systemTypes,readOnly:e.readOnly,usage:S,issues:d,onChange:(T)=>r({type:"fieldChanged",descriptor:{name:"groupings",label:"Groupings",widget:"object"},raw:T}),onStateChange:(T)=>r({type:"compoundFieldStateChanged",field:"groupings",pendingChanges:T.pendingChanges,invalid:T.issues.length>0})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var mr=G(Xe(),1);var Le=G(fe(),1),QP=new Set(["preferredTerms","preferred","avoid"]),FP=new Set(["description","purpose","positioning","summary","artDirection","composition"]);function YP(e){return e.widget==="string"&&FP.has(e.name)?{...e,widget:"text"}:e}function Kz(e){let n=xw(),o=Gz(),r=e.fields.filter((p)=>o(p,e.draft[p.name])&&Wd(p,e.draft)&&(!e.readOnly||e.draft[p.name]!==void 0||p.required!==!1));if(r.length===0)return null;if(e.readOnly&&!n)return Le.jsxDEV("div",{"data-studio-system-fields":"",...E(Ze.root),children:[e.title&&Le.jsxDEV("h2",{...E(Ze.heading),children:e.title},void 0,!1,void 0,this),Le.jsxDEV("dl",{...E(Ze.profile),children:r.map((p)=>Le.jsxDEV("div",{...E(Ze.row),children:[Le.jsxDEV("dt",{...E(Ze.term),children:p.label},void 0,!1,void 0,this),Le.jsxDEV("dd",{...E(Ze.value),children:Le.jsxDEV(Sw,{vocabulary:e.vocabularies?.[p.name],literalStrings:e.literalFields?.includes(p.name),value:e.draft[p.name],fields:p.fields},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},p.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let l=r.filter((p)=>p.widget==="object"&&p.fields?.length),a=r.filter((p)=>!l.includes(p)&&p.name!=="visibility"),c=r.filter((p)=>p.name==="visibility"),d=(p)=>Le.jsxDEV(Gd,{segment:p.name,children:Le.jsxDEV(q0,{vocabulary:e.vocabularies?.[p.name],literalList:e.literalFields?.includes(p.name),suggestions:e.suggestions?.[p.name],descriptor:p,value:e.draft[p.name],issues:e.issues,onChange:(m)=>e.onChange(p,m),children:!n&&e.renderAssist?.(p)},void 0,!1,void 0,this)},p.name,!1,void 0,this);return Le.jsxDEV("div",{"data-studio-system-fields":"",...E(Ze.root),children:[a.length>0&&Le.jsxDEV(Le.Fragment,{children:[e.title&&Le.jsxDEV("h2",{...E(Ze.heading),children:e.title},void 0,!1,void 0,this),Le.jsxDEV("div",{"data-studio-system-grid":"",...E(Ze.grid),children:a.map(d)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.map(d),c.length>0&&Le.jsxDEV("section",{...E(Ze.section),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:"Access"},void 0,!1,void 0,this),Le.jsxDEV("div",{"data-studio-system-grid":"",...E(Ze.grid),children:c.map(d)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function q0(e){if(Vz(e.descriptor,e.value)?.kind==="none")return null;let o=YP(e.descriptor);if(o.widget==="object"&&o.fields?.length)return Le.jsxDEV(KP,{...e},void 0,!1,void 0,this);if(o.widget==="list"&&(o.fields?.length||o.field?.widget==="variant"))return Le.jsxDEV(XP,{...e},void 0,!1,void 0,this);if(o.widget==="grid")return Le.jsxDEV("div",{role:"group","aria-label":o.label,...E(Ze.section,Ze.wide),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:o.label},void 0,!1,void 0,this),Le.jsxDEV(Yz,{descriptor:o,value:e.value,onChange:e.onChange,label:!1,renderValue:vw(jz,qp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(o.widget==="map")return Le.jsxDEV("div",{role:"group","aria-label":o.label,...E(Ze.section,Ze.wide),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:o.label},void 0,!1,void 0,this),Le.jsxDEV(Fz,{descriptor:o,value:e.value,onChange:e.onChange,label:!1,renderValue:vw(jz,qp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(o.widget==="variant")return Le.jsxDEV("div",{role:"group","aria-label":o.label,...E(Ze.section,Ze.wide),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:o.label},void 0,!1,void 0,this),Le.jsxDEV(ww,{descriptor:o,value:zn(e.value)?e.value:{},onChange:e.onChange,renderFields:qp},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Le.jsxDEV("div",{...E(Ze.onlyField,(o.widget==="text"||o.widget==="list"&&!QP.has(o.name)||o.widget==="object"||o.widget==="image")&&Ze.wide),"data-studio-field-assist":"",children:[Le.jsxDEV($0,{vocabulary:e.vocabulary,literalList:e.literalList,suggestions:e.suggestions,descriptor:o,value:e.value,issues:e.issues,onChange:e.onChange},void 0,!1,void 0,this),e.children]},void 0,!0,void 0,this)}var jz=(e,n,o)=>Le.jsxDEV(q0,{descriptor:e,value:n,onChange:o},void 0,!1,void 0,this),qp=(e,n,o)=>Le.jsxDEV("div",{"data-studio-system-grid":"",...E(Ze.grid),children:e.filter((r)=>Wd(r,n)).map((r)=>Le.jsxDEV(Gd,{segment:r.name,children:Le.jsxDEV(q0,{descriptor:r,value:n[r.name],onChange:(l)=>o(kw(n,r,l))},void 0,!1,void 0,this)},r.name,!1,void 0,this))},void 0,!1,void 0,this);function XP(e){let n=mr.useMemo(()=>e.issues?.filter((c)=>c.path[0]===e.descriptor.name)??[],[e.issues,e.descriptor.name]),o=mr.useRef(null),r=mr.useId();mr.useEffect(()=>{let c=o.current;if(n.length&&c===c?.closest("form")?.querySelector("[data-studio-invalid-field]"))c?.focus()},[n]);let l=e.descriptor.fields??[],a=e.descriptor.field?.widget==="variant"?e.descriptor.field:void 0;return Le.jsxDEV("div",{ref:o,role:"group","aria-label":e.descriptor.label,tabIndex:-1,"data-studio-invalid-field":n.length?e.descriptor.name:void 0,"aria-describedby":n.length?r:void 0,...E(Ze.section,Ze.wide),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:e.descriptor.label},void 0,!1,void 0,this),n.length>0&&Le.jsxDEV("div",{id:r,children:Le.jsxDEV(me,{tone:"error",children:n.map((c)=>`${c.path.length>1?`${c.path.slice(1).join(".")}: `:""}${c.message}`).join(" · ")},void 0,!1,void 0,this)},void 0,!1,void 0,this),Le.jsxDEV(Qz,{descriptor:e.descriptor,value:e.value,onChange:e.onChange,noun:Xz(e.descriptor.label),label:!1,createItem:a?()=>Wz(a):void 0,renderItemFields:(c,d)=>a?Le.jsxDEV(ww,{descriptor:a,value:c,onChange:d,renderFields:qp},void 0,!1,void 0,this):qp(l,c,d)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function KP(e){let{descriptor:n}=e,o=xw(),r=zn(e.value)?e.value:{},l=n.fields??[],a=mr.useMemo(()=>e.issues?.filter((g)=>g.path[0]===n.name).map((g)=>({...g,path:g.path.slice(1)})),[e.issues,n.name]),c=a?.filter((g)=>g.path.length===0)??[],d=mr.useId(),p=mr.useRef(null);mr.useEffect(()=>{let g=p.current;if(g?.hasAttribute("data-studio-invalid-field")&&g===g.closest("form")?.querySelector("[data-studio-invalid-field]"))g.focus()},[a]);let m=Object.fromEntries(Object.entries(r).filter(([g])=>!l.some((b)=>b.name===g)));return Le.jsxDEV("div",{ref:p,role:"group","aria-label":n.label,tabIndex:-1,"data-studio-invalid-field":c.length?n.name:void 0,"aria-describedby":c.length?d:void 0,...E(Ze.section,Ze.wide),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:n.label},void 0,!1,void 0,this),c.length>0&&Le.jsxDEV("div",{id:d,children:Le.jsxDEV(me,{tone:"error",children:c.map((g)=>g.message).join(" · ")},void 0,!1,void 0,this)},void 0,!1,void 0,this),Le.jsxDEV("div",{"data-studio-system-grid":"",...E(Ze.grid),children:l.filter((g)=>Wd(g,r)).map((g)=>Le.jsxDEV(Gd,{segment:g.name,children:Le.jsxDEV(q0,{descriptor:n.required===!1&&e.value===void 0?{...g,required:!1}:g,value:r[g.name],issues:a,onChange:(b)=>{let k=kw(r,g,b);e.onChange(Object.keys(k).length===0&&n.required===!1?"":k)}},void 0,!1,void 0,this)},g.name,!1,void 0,this))},void 0,!1,void 0,this),!o&&Object.keys(m).length>0&&Le.jsxDEV(Sw,{value:m},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Qd=G(fe(),1);function Jz(e){try{return new Intl.DisplayNames(["en"],{type:"language"}).of(e)??e}catch{return e}}function Aw(e){if(typeof e==="string")return e.trim()===""?[]:[e];if(typeof e==="number")return[String(e)];if(Array.isArray(e))return e.flatMap(Aw);if(typeof e==="object"&&e!==null)return Object.values(e).flatMap(Aw);return[]}function Zz(e){let n=Aw(e.reference.values[e.descriptor.name]);if(n.length===0)return null;let o=Jz(e.reference.language);return Qd.jsxDEV("p",{"data-studio-reference":"",...E(Cw.original,Cw.reference),children:[Qd.jsxDEV("strong",{children:o},void 0,!1,void 0,this)," ",n.map((r,l)=>Qd.jsxDEV("span",{children:[l>0&&Qd.jsxDEV("br",{},void 0,!1,void 0,this),r]},l,!0,void 0,this))]},void 0,!0,void 0,this)}function eI(e){let{language:n,total:o,missing:r}=e.pageTexts,l=Jz(n);return Qd.jsxDEV(me,{tone:r.length===0?"good":void 0,children:r.length===0?`${l}: all ${o} sections have their text.`:`${l}: ${r.length} of ${o} sections have no text yet (${r.join(", ")}). The page appears in ${l} once every section has its text.`},void 0,!1,void 0,this)}var Hi=G(fe(),1);function iI(e){let{editor:n,dispatchEditor:o,fieldAssistState:r}=e,{mode:l,draft:a,body:c}=n,{entitySchema:d,presentation:p,selectedEntityType:m,groupingFields:g,groupingVocabularies:b,systemDesign:k,canEdit:S,canAssist:C,fieldIssues:A}=e.model,D=sd(m,l),T=jd(d,p),I=C&&d.hasBody&&c.trim().length>0,H=(Q)=>I&&!b[Q.name]?.values?Hi.jsxDEV(nI,{descriptor:Q,state:r,onRun:e.runFieldAssist,onApply:e.applyFieldAssist,onDiscard:()=>e.setFieldAssistState({kind:"idle"})},void 0,!1,void 0,this):null,_=(Q,F)=>o({type:"fieldChanged",descriptor:Q,raw:F}),L=m===Cl,P=l.kind==="edit"?l.entity.reference:void 0;return Hi.jsxDEV(tI,{fields:d.fields,draft:a,versions:n.versions,onVersionChange:(Q,F)=>o({type:"versionChanged",language:Q,texts:F}),errors:n.save.kind==="error"?n.save.versions:void 0,children:(Q)=>Hi.jsxDEV("fieldset",{className:ie("",Qn.fields),disabled:!S,children:[k?Hi.jsxDEV(Hi.Fragment,{children:[L&&(d.groupingDefinitions?Hi.jsxDEV(_z,{editor:n,schema:d.groupingDefinitions,readOnly:!S,dispatch:o},void 0,!1,void 0,this):Hi.jsxDEV(me,{tone:"error",children:"Grouping definitions are unavailable. Reload before editing."},void 0,!1,void 0,this)),Hi.jsxDEV(Kz,{vocabularies:b,literalFields:g,suggestions:e.groupingSuggestions,fields:L?d.fields.filter((F)=>F.name!=="groupings"):d.fields,draft:a,title:p==="document"?"":k.fieldsTitle,readOnly:!S,issues:A,onChange:_,renderAssist:Q?void 0:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this):d.fields.filter((F)=>Wd(F,a)).filter((F)=>Q||F!==T).map((F)=>Hi.jsxDEV("div",{"data-studio-field-assist":"",children:[Hi.jsxDEV(Gd,{segment:F.name,children:Hi.jsxDEV($0,{readOnly:!S||F.name==="status"&&e.model.publicationWorkspace!==void 0,vocabulary:b[F.name],literalList:g.includes(F.name),suggestions:e.groupingSuggestions?.[F.name],descriptor:F,issues:A,value:a[F.name],onChange:(we)=>_(F,we)},void 0,!1,void 0,this)},void 0,!1,void 0,this),P&&Hi.jsxDEV(Zz,{descriptor:F,reference:P},void 0,!1,void 0,this),!Q&&H(F)]},`${D}:${F.name}`,!0,void 0,this)),d.format==="raw"&&Hi.jsxDEV(me,{children:"This type is raw markdown — the whole document is the body."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},D,!1,void 0,this)}var oI=G(fe(),1);function U0(e){return oI.jsxDEV(xe,{type:"button",variant:"ghost",xstyle:e.placement==="head"?Fd.toggleHead:Fd.toggleBar,"data-studio-ask-toggle":e.placement,"aria-pressed":e.ask.open,"aria-keyshortcuts":"Control+j Meta+j",title:"Ask about this entry (Ctrl+J or ⌘J)",onClick:()=>e.ask.setOpen(!e.ask.open),children:"Ask"},void 0,!1,void 0,this)}var $i=G(Xe(),1);var Yd={versions:{k1xSpc:"xrvj5dj",kumcoG:"xcjjqqt",kOIVth:"xou54vl",k1JLwA:"x4jmfmw",$$css:!0},version:{kzqmXN:"xh8yej3",k7Eaqz:"xeuugli",kZKoxP:"x1isuwpm",kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kMwMTN:"xqvuw85",kWkggS:"x18s3upu",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"xy1lt07",kmVPX3:"xc7ga6q",$$css:!0},actions:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"x167g77z",keoZOQ:"x14vqqas",$$css:!0}};var Dt=G(fe(),1);function rI(e,n){return JSON.stringify({frontmatter:e,body:n},null,2)}function sI(e){let n=Nt(),[o,r]=$i.useState(!1),[l,a]=$i.useState(null),[c,d]=$i.useState(!1),[p,m]=$i.useState(null),[g,b]=$i.useState(!1),[k,S]=$i.useState(!1),[C,A]=$i.useState(!1),[D,T]=$i.useState(!1),{conflictId:I}=e,H=async(we)=>{if(I===void 0)return;T(!0),m(null);try{await n.resolveConflict(I,we);let J=await n.fetchEntity(e.entity.entityType,e.entity.id);S(!1),A(!1),r(!1),e.onUseLatest(J)}catch(J){S(!1),A(!1),m(Tu(J,"The conflict could not be resolved")||"The conflict could not be resolved")}finally{T(!1)}},_=$i.useRef(0),L=$i.useRef(null);$i.useEffect(()=>()=>{_.current+=1},[]);let P=rI(e.draft,e.body);$i.useEffect(()=>b(!1),[P]);let Q=async()=>{b(!1);try{await navigator.clipboard.writeText(P),b(!0)}catch{m("Copy unavailable. Select Your version manually."),r(!0)}},F=async()=>{let we=++_.current;d(!0),a(null),m(null);try{let J=await n.fetchEntity(e.entity.entityType,e.entity.id);if(_.current===we)a(J)}catch(J){if(_.current===we)m(Tu(J,"Latest version could not be loaded")||"Latest version could not be loaded")}finally{if(_.current===we)d(!1)}};return Dt.jsxDEV(Dt.Fragment,{children:[Dt.jsxDEV("div",{...E(Yd.actions),children:[Dt.jsxDEV("span",{ref:L,children:Dt.jsxDEV(xe,{type:"button",variant:"ghost",onClick:()=>{r(!0),F()},children:"Compare changes"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Dt.jsxDEV(xe,{type:"button",variant:"ghost",onClick:()=>void Q(),children:"Copy my version"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g&&Dt.jsxDEV(me,{children:"Version copied, including properties and body."},void 0,!1,void 0,this),Dt.jsxDEV(Ma,{open:o,onOpenChange:(we)=>{if(r(we),!we)S(!1),_.current+=1,d(!1)},children:Dt.jsxDEV(Ra,{"aria-describedby":"conflict-comparison-description",onCloseAutoFocus:(we)=>{we.preventDefault(),L.current?.querySelector("button")?.focus()},children:[Dt.jsxDEV(Oa,{children:"Compare changes"},void 0,!1,void 0,this),Dt.jsxDEV("p",{id:"conflict-comparison-description",children:"Your draft is unchanged. Review both versions before choosing to replace it."},void 0,!1,void 0,this),I!==void 0&&Dt.jsxDEV("p",{children:"Your version is also kept in the Inbox as a conflict, so it is not lost if you close this page."},void 0,!1,void 0,this),p&&Dt.jsxDEV(me,{tone:"error",children:p},void 0,!1,void 0,this),Dt.jsxDEV("div",{...E(Yd.versions),children:[Dt.jsxDEV("label",{children:["Your version",Dt.jsxDEV("textarea",{...E(Yd.version),readOnly:!0,value:P},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Dt.jsxDEV("label",{children:["Latest saved version",Dt.jsxDEV("textarea",{...E(Yd.version),readOnly:!0,value:l?rI(l.frontmatter,l.body):"Not loaded"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Dt.jsxDEV("div",{...E(Yd.actions),children:[Dt.jsxDEV(xe,{type:"button",variant:"ghost",disabled:c,onClick:()=>void F(),children:c?"Loading latest…":"Retry latest"},void 0,!1,void 0,this),Dt.jsxDEV(xe,{type:"button",variant:"ghost",onClick:()=>r(!1),children:"Keep editing my version"},void 0,!1,void 0,this),I!==void 0&&Dt.jsxDEV(xe,{type:"button",variant:"ghost",disabled:!l||c||D,onClick:()=>A(!0),children:"Save my version"},void 0,!1,void 0,this),Dt.jsxDEV(xe,{type:"button",disabled:!l||c||p!==null,onClick:()=>S(!0),children:"Use latest version"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),k&&l&&Dt.jsxDEV(Nn,{title:"Replace your local draft?",titleId:"replace-conflicted-draft",mark:"↩",cancelLabel:"Keep my draft",confirmLabel:"Replace with latest",onCancel:()=>S(!1),onConfirm:()=>{if(I!==void 0){H("keep-current");return}e.onUseLatest(l),S(!1),r(!1)},children:Dt.jsxDEV("p",{children:"This discards your local edits. Copy your version first if you want to keep it. Nothing is written to the server."},void 0,!1,void 0,this)},void 0,!1,void 0,this),C&&l&&Dt.jsxDEV(Nn,{title:"Save your version over the latest?",titleId:"apply-kept-version",mark:"↑",cancelLabel:"Not now",confirmLabel:"Save over latest",onCancel:()=>A(!1),onConfirm:()=>void H("apply"),children:Dt.jsxDEV("p",{children:"This replaces the latest saved version with the version you tried to save. The latest version's changes are overwritten."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var gr=G(fe(),1);function lI(e){let{editor:n,syncStatus:o,hasUnsavedChanges:r,dispatchEditor:l}=e,{mode:a,draft:c,body:d,save:p}=n,{entitySchema:m,presentation:g,canEdit:b}=e.model,k=b||g==="split"?B0(n,e.model,r):void 0;return gr.jsxDEV("footer",{className:ie("",di.pipeline,Qn.pipeline),"data-studio-save-bar":"",children:[gr.jsxDEV("div",{children:[gr.jsxDEV("span",{"data-studio-save-state":"",className:ie("",Qn.saveState),children:[gr.jsxDEV("span",{role:"status","aria-live":"polite",title:"Saved means stored in this Brain. File export and Git synchronization are separate.",children:!b&&g!=="split"?"Read-only":DR(p,r,a.kind!=="create"?"edit":m.isSingleton?"first-save":"create")},void 0,!1,void 0,this),k&&gr.jsxDEV("span",{id:L0,children:k},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.readError&&gr.jsxDEV(me,{tone:"error",children:["Your draft is unchanged. ",e.readError,gr.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),gr.jsxDEV(TR,{state:o?.directorySync&&p.kind==="saved"&&!p.noop?{kind:"idle"}:p,conflictActions:a.kind==="edit"?gr.jsxDEV(sI,{entity:a.entity,draft:c,body:d,...p.kind==="conflict"&&p.conflictId!==void 0&&{conflictId:p.conflictId},onUseLatest:(S)=>l({type:"documentOpened",document:Xd(S)})},`${a.entity.entityType}:${a.entity.id}`,!1,void 0,this):void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g==="split"&&gr.jsxDEV(xe,{type:"button",variant:"ghost",className:"studio-details-toggle",xstyle:Qn.detailsToggle,"aria-pressed":e.mobilePane==="details",onClick:()=>e.setMobilePane(e.mobilePane==="details"?"write":"details"),children:"Details"},void 0,!1,void 0,this),e.ask&&a.kind==="edit"&&e.model.canAssist&&gr.jsxDEV(U0,{ask:e.ask,placement:"bar"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var _0=G(Xe(),1);function Kd(e){let n=Ew.safeParse(uI(new URLSearchParams(e))),o=n.success?n.data:Ew.parse({});return{...o,offset:Math.floor(o.offset/o.limit)*o.limit}}function ri(e){let n=new URLSearchParams;if(e.prefix)n.set("prefix",JSON.stringify(e.prefix));if(e.scope!=="folder")n.set("scope",e.scope);if(e.offset>0)n.set("offset",String(e.offset));if(e.limit!==aI)n.set("limit",String(e.limit));if(e.q)n.set("q",e.q);if(e.visibility!=="all")n.set("visibility",e.visibility);if(e.status)n.set("status",e.status);if(e.sort!=="updated-desc")n.set("sort",e.sort);let o=n.toString();return o?`?${o}`:""}var Ct={trail:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x883omv",kmVPX3:"x1g8o3q3",kt9PQ7:"xso031l",kfdmCh:"x1q0q8m5",kL6WhQ:"xna4lh4",kMwMTN:"x1ar3pfp",kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",k7Eaqz:"xeuugli",kXHlph:"xw2csxc",khDVqt:"xuxw1ft",kLyoy9:"xz7lfyz",kRugJJ:"x153k8vf",$$css:!0},crumb:{kmuXW:"x2lah0s",kRugJJ:"xxxyo7y",kpC6i:"x1toygy1",kfD2x5:"xtu8bhz",ku5HWf:"xvl04cc",kkLdNC:"x112hdyk",$$css:!0},link:{kMwMTN:"x1heor9g",kybGjl:"x1hl2dhg",kDPRdz:"x18m2ztq",$$css:!0},group:{keoZOQ:"x1sy10c2",k1K539:"xieb3on",$$css:!0},label:{k1xSpc:"x78zum5",kjj79g:"x1qughib",kOIVth:"x1v2ro7d",kMv6JI:"xa9opjo",kGuDYH:"x1k6wstc",kMwMTN:"x1ar3pfp",kmVPX3:"x1jz8oe1",$$css:!0},folder:{kumcoG:"x770nye",kybGjl:"x1hl2dhg",kMwMTN:"xqvuw85",k1JLwA:"x1e5f7iv",$$css:!0},folderTitle:{kMv6JI:"x5ddh9m",kGuDYH:"x1jvydc1",k63SB2:"xk50ysn",k7Eaqz:"xeuugli",kHjlTd:"xj0a0fe",$$css:!0},count:{k1xSpc:"x3nfvp2",kOIVth:"x1v2ro7d",kMv6JI:"xa9opjo",kGuDYH:"x1k6wstc",kMwMTN:"x1ar3pfp",khDVqt:"xuxw1ft",$$css:!0},creationBody:{kBCFzs:"x1osaytk",kbNqZ1:"x7sv70a",k1xSpc:"xrvj5dj",kumcoG:"x4w6khx",k9llMU:"x13b68fn",k7Eaqz:"xeuugli",kAzted:"x2lwn1j",kORKVm:"x1odjw0f",$$css:!0},creationBodySplit:{kbNqZ1:"x7sv70a xj4ozfe",k9llMU:"x13b68fn x1s4lsyz",$$css:!0},destinationFrame:{kBCFzs:"x1osaytk",kbNqZ1:"x1ms6mhf",$$css:!0},destination:{kmVPX3:"x1t7086c",kt9PQ7:"xso031l",kfdmCh:"x1q0q8m5",kL6WhQ:"xna4lh4",k1K539:"xieb3on",$$css:!0},segment:{k1xSpc:"xrvj5dj",kOIVth:"x167g77z",kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",ks0D6T:"x17fpy1y",$$css:!0},input:{kB7OPa:"x9f619",kzqmXN:"xh8yej3",kmVPX3:"x6yrr3s",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"x8tuc8h",kaIpWk:"x12oqio5",kWkggS:"x18s3upu",kMwMTN:"xqvuw85",kMv6JI:"xa9opjo",kGuDYH:"x4z9k3i",$$css:!0},saveAs:{kogj98:"x1uud7ro",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",kMwMTN:"x1ar3pfp",$$css:!0},value:{kMwMTN:"xqvuw85",kMv6JI:"xa9opjo",kHjlTd:"xj0a0fe",khDVqt:"x126k92a",$$css:!0},error:{kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",$$css:!0},context:{k1xSpc:"x1lliihq",kMv6JI:"xa9opjo",kGuDYH:"x1k6wstc",kMwMTN:"x1ar3pfp",keoZOQ:"x1gslohp",$$css:!0}};var at=G(fe(),1);function Up(e){if(!e)return"(empty segment)";return e.replace(/[-_]/g," ").replace(/^\p{L}/u,(n)=>n.toUpperCase())}function Tw(e,n){return`${e.collectionPath}${ri({...e.query,prefix:n,offset:0})}`}function Dw(e,n,o){if(!Mo(e))return;e.preventDefault(),n.onNavigate(o)}function j0(e){let n=e.query.prefix;if(!n)return null;return at.jsxDEV("nav",{"aria-label":e.kind==="page"?"Page trail":"Folder trail",className:ie("",Ct.trail),children:[e.fixed?at.jsxDEV("span",{className:ie("",Ct.crumb),children:e.collectionLabel},void 0,!1,void 0,this):at.jsxDEV("a",{className:ie("",Ct.crumb,Ct.link),href:Tw(e,null),onClick:(o)=>Dw(o,e,null),children:e.collectionLabel},void 0,!1,void 0,this),n.map((o,r)=>{let l=[n[0],...n.slice(1,r+1)],a=r===n.length-1;return at.jsxDEV("span",{children:[at.jsxDEV("span",{"aria-hidden":"true",children:" / "},void 0,!1,void 0,this),a||e.fixed?at.jsxDEV("span",{"aria-current":a?"page":void 0,className:ie("",Ct.crumb),children:e.trail?.[r]??Up(o)},void 0,!1,void 0,this):at.jsxDEV("a",{className:ie("",Ct.crumb,Ct.link),href:Tw(e,l),onClick:(c)=>Dw(c,e,l),children:e.trail?.[r]??Up(o)},void 0,!1,void 0,this)]},r,!0,void 0,this)})]},void 0,!0,void 0,this)}function cI(e){if(!e.folders.length)return null;let n=e.kind==="page"?"Pages":"Folders";return at.jsxDEV("section",{"aria-label":n,className:ie("",Ct.group),children:[at.jsxDEV("div",{className:ie("",Ct.label),children:at.jsxDEV("span",{children:n},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.folders.map((o)=>at.jsxDEV("a",{"data-studio-folder":!0,className:ie("",Ae.row,Ct.folder),href:Tw(e,o.path),onClick:(r)=>Dw(r,e,o.path),children:[at.jsxDEV("span",{"aria-hidden":"true",className:ie("",Ae.index),children:"/"},void 0,!1,void 0,this),at.jsxDEV("span",{className:ie("",Ct.folderTitle),children:o.title??Up(o.name)},void 0,!1,void 0,this),at.jsxDEV("span",{className:ie("",Ct.count),children:[o.descendantCount," ",o.descendantCount===1?"entry":"entries",at.jsxDEV("span",{"aria-hidden":"true",children:"›"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},JSON.stringify(o.path),!0,void 0,this))]},void 0,!0,void 0,this)}function dI(e){return e.active?at.jsxDEV("div",{"data-studio-creation-layout":!0,className:ie("",Ct.creationBody,e.split&&Ct.creationBodySplit),children:e.children},void 0,!1,void 0,this):at.jsxDEV(at.Fragment,{children:e.children},void 0,!1,void 0,this)}function P0(e,n){if(!n||n.start<0||n.end<n.start||n.end>e.length)return e;return at.jsxDEV(at.Fragment,{children:[e.slice(0,n.start),at.jsxDEV("strong",{children:e.slice(n.start,n.end)},void 0,!1,void 0,this),e.slice(n.end)]},void 0,!0,void 0,this)}var JP=[[/path separators|cannot contain ':'/,"Leave out slashes: the file name is a single name, not a path."],[/dot segments/,"Use a name other than “.” or “..”."],[/null bytes/,"Remove the hidden control character from the name."]];function ZP(e){return JP.find(([n])=>n.test(e))?.[1]??e}function fI(e){let n=_0.useId(),o=e.error instanceof Do?e.error.issues:e.issues,r=o?.find((m)=>m.path[0]==="segment"||m.path[0]==="prefix"),l=r?.path[0]==="prefix"?`Cannot create in this ${e.kind??"folder"}: ${r.message}`:r?ZP(r.message):o?.length?void 0:e.error?.message,a=r?.path[0]==="segment"||!o?.length&&Boolean(e.error),c=!e.pending&&!e.error?e.preview:null,[d,p]=_0.useState(!1);if(e.followsTitle&&!d&&!a&&!l)return at.jsxDEV("section",{"aria-label":"New entry destination",className:ie("",Ct.destination),children:at.jsxDEV("p",{className:ie("",Ct.saveAs),children:["Saves as"," ",at.jsxDEV("span",{className:ie("",Ct.value),children:c?c.filePath===null?P0(c.entityId,c.entityLeaf):P0(c.filePath,c.fileLeaf):e.segment||"a file named after its title"},void 0,!1,void 0,this)," ",at.jsxDEV(xe,{type:"button",variant:"ghost",onClick:()=>p(!0),children:"Change"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return at.jsxDEV("section",{"aria-label":"New entry destination",className:ie("",Ct.destination),children:[at.jsxDEV("label",{className:ie("",Ct.segment),children:["File name",at.jsxDEV("input",{name:"segment",className:ie("",Ct.input),value:e.segment,onChange:(m)=>e.onSegmentChange(m.target.value),required:!0,autoComplete:"off",spellCheck:!1,"aria-invalid":a,"aria-describedby":`${n}-help${a?` ${n}-error`:""}`},void 0,!1,void 0,this),at.jsxDEV("small",{id:`${n}-help`,children:["Names the file inside this ",e.kind??"folder",": letters, numbers and hyphens work best, and no slashes."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),l&&at.jsxDEV("p",{id:`${n}-error`,role:"alert",className:ie("",Ct.error),children:l},void 0,!1,void 0,this),e.pending&&e.segment&&at.jsxDEV("p",{role:"status",className:ie("",Ct.context),children:"Checking destination…"},void 0,!1,void 0,this),c&&at.jsxDEV("p",{className:ie("",Ct.saveAs),children:["Saves as"," ",at.jsxDEV("span",{className:ie("",Ct.value),children:c.filePath===null?P0(c.entityId,c.entityLeaf):P0(c.filePath,c.fileLeaf)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var V0={section:{keoZOQ:"x1tfhste",kLKAdn:"x1cnzs8",kg3NbH:"xr244g7 xn3xmfv",kEafiO:"x178xt8z",kPef9Z:"x13fuv20",kLZC3w:"xvg7k2t",$$css:!0},head:{k1xSpc:"x78zum5",kGNEyG:"x1pha0wt",kOIVth:"x1v2ro7d",k1K539:"x1e56ztr",$$css:!0},count:{kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",kMwMTN:"x1ar3pfp",$$css:!0}};var Ms=G(fe(),1);function e_(e){let{page:n}=e;return Ms.jsxDEV("section",{"data-studio-collection-members":"","aria-labelledby":"studio-collection-members",className:ie("",V0.section),children:[Ms.jsxDEV("div",{className:ie("",V0.head),children:[Ms.jsxDEV("h2",{id:"studio-collection-members",className:ie("",lo.eyebrow),children:"Members"},void 0,!1,void 0,this),Ms.jsxDEV("span",{className:ie("",V0.count),children:n.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n.entities.map((o,r)=>Ms.jsxDEV("a",{href:_n(nr(),o.entityType,o.id),"data-studio-record":"",className:ie("",Ae.row,Ae.recordLink,di.listingRow),onClick:(l)=>{if(!Mo(l))return;l.preventDefault(),e.onOpen(o.id,o.entityType)},children:[Ms.jsxDEV("span",{className:ie("",Ae.index),children:String(r+1).padStart(2,"0")},void 0,!1,void 0,this),Ms.jsxDEV("span",{className:ie("",Ae.title),title:o.id,children:Zi(o,o.path?.at(-1))},void 0,!1,void 0,this),Ms.jsxDEV("time",{className:ie("",Ae.updated),dateTime:o.updated,children:Cu(o.updated)},void 0,!1,void 0,this)]},JSON.stringify([o.entityType,o.id]),!0,void 0,this))]},void 0,!0,void 0,this)}function hI(e){let n=Nt(),{data:o}=Xt({queryKey:["studio","collection-members",e.entityType,e.entityId],queryFn:()=>n.fetchCollectionMembers(e.entityType,e.entityId)});return o?Ms.jsxDEV(e_,{page:o,onOpen:e.onOpen},void 0,!1,void 0,this):null}var G0=G(Xe(),1),Mw=(e)=>`studio.inspector.${e}`;function pI(e){try{return window.localStorage.getItem(Mw(e))==="hidden"}catch{return!1}}function mI(e){let[n,o]=G0.useState(()=>({entityType:e,hidden:pI(e)})),r=n.entityType===e?n:{entityType:e,hidden:pI(e)};if(r!==n)o(r);let l=G0.useCallback((a)=>{o({entityType:e,hidden:a});try{if(a)window.localStorage.setItem(Mw(e),"hidden");else window.localStorage.removeItem(Mw(e))}catch{}},[e]);return[r.hidden,l]}var Q0=G(Xe(),1);var gI={list:{k1xSpc:"xrvj5dj",kumcoG:"xrwz996",kOIVth:"xfe5i6u",kogj98:"x1ghz6dp",$$css:!0},keys:{kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kMwMTN:"x1ar3pfp",$$css:!0},row:{k1xSpc:"xjp7ctv",$$css:!0},action:{kogj98:"x1ghz6dp",$$css:!0}};var Rs=G(fe(),1),t_=[["Ctrl+S or ⌘S","Save changes"],["Ctrl+Z or ⌘Z","Undo; with Shift, redo"],["Ctrl+B or ⌘B","Bold"],["Ctrl+I or ⌘I","Italic"],["/ at the start of a line","Headings, lists and more"],["Ctrl+\\ or ⌘\\","Show or hide Details"],["Ctrl+/ or ⌘/","Show the writing or its Markdown"],["Ctrl+K or ⌘K","Search or do anything"],["?","Show these shortcuts"]],W0=gI;function n_(e){return e instanceof HTMLElement&&(e.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(e.tagName))}function vI(){let[e,n]=Q0.useState(!1);return Q0.useEffect(()=>{let o=(r)=>{if(r.key!=="?"||n_(r.target))return;r.preventDefault(),n(!0)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[]),Rs.jsxDEV(Ma,{open:e,onOpenChange:n,children:Rs.jsxDEV(Ra,{children:[Rs.jsxDEV(yI,{children:[Rs.jsxDEV(Oa,{children:"Keyboard shortcuts"},void 0,!1,void 0,this),Rs.jsxDEV(bI,{children:"While an entry is open."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Rs.jsxDEV("dl",{...E(W0.list),children:t_.map(([o,r])=>Rs.jsxDEV("div",{...E(W0.row),children:[Rs.jsxDEV("dt",{...E(W0.keys),children:o},void 0,!1,void 0,this),Rs.jsxDEV("dd",{...E(W0.action),children:r},void 0,!1,void 0,this)]},r,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Os=G(fe(),1);function xI(e){return Os.jsxDEV(T0,{children:[Os.jsxDEV(D0,{className:kI("ghost","icon"),"aria-label":"More document actions",children:"•••"},void 0,!1,void 0,this),Os.jsxDEV(M0,{align:"end",children:[e.view&&Os.jsxDEV(Bp,{onSelect:e.view.onToggle,children:e.view.label},void 0,!1,void 0,this),e.view&&e.onDelete&&Os.jsxDEV(SI,{},void 0,!1,void 0,this),e.onDelete&&Os.jsxDEV(Bp,{variant:"destructive",onSelect:e.onDelete,children:"Delete entry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function wI(e){let{syncStatus:n}=e;if(!n?.directorySync)return null;return Os.jsxDEV("details",{"data-studio-sync-details":"",children:[Os.jsxDEV("summary",{...E(rn.summary),children:"Sync details"},void 0,!1,void 0,this),Os.jsxDEV(MR,{view:xy({save:e.editor.save,git:n.git,baselineCommit:e.baselineCommit}),gitConfigured:n.git!==null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var CI=1500;function Rw(e){return e.modeKind==="edit"&&e.canEdit&&e.publicationState==="draft"}function AI(e){return Rw(e)&&e.hasUnsavedChanges&&!e.saveBlocked&&e.saveKind!=="saving"&&e.saveKind!=="conflict"}function EI(){if(typeof document>"u")return!1;return document.querySelector("[data-studio-root]")?.getAttribute("data-studio-autosave")!=="off"}var qe=G(fe(),1);function Ow(e){let{editor:n,bodyMode:o,mobilePane:r,hasUnsavedChanges:l,dispatchEditor:a,setBodyMode:c,setMobilePane:d,backToList:p,performPublishingAction:m,save:g}=e,{mode:b,body:k,save:S}=n,{entitySchema:C,presentation:A,selectedEntityType:D,systemDesign:T,canEdit:I,namedCreate:H,fieldIssues:_,hierarchyKind:L,canPublish:P,canAssist:Q,collectionLabel:F,publicationWorkspace:we,publicationState:J,editorHead:Z}=e.model,oe=mw(n,e.model,l),Te=B0(n,e.model,l),Rt=b.kind==="create"&&!C.isSingleton,K=A==="split",[le,se]=mI(D),ge=e.ask?.open===!0&&b.kind==="edit"&&Q,De=le||ge,ct=(ke)=>{if(!ke&&ge)e.ask?.setOpen(!1);se(ke)},Et=I?jd(C,A):void 0,zt=typeof n.draft.title==="string"?n.draft.title:"",pe=Et?qe.jsxDEV(Mz,{descriptor:Et,value:zt,placeholder:`Untitled ${e.model.entryLabel.toLowerCase()}`,issues:_,onChange:(ke)=>a({type:"fieldChanged",descriptor:Et,raw:ke})},void 0,!1,void 0,this):void 0;function ze(ke){let St=ke.currentTarget.querySelector("input:invalid, select:invalid, textarea:invalid");if(St&&!St.closest("[data-studio-properties]"))return;Oz(ke.currentTarget);let co=K&&De;if(r==="details"&&!co)return;ke.preventDefault();let bt=ke.currentTarget.querySelector("input:invalid, select:invalid, textarea:invalid");if(ke.target!==bt)return;if(d("details"),co)ct(!1);requestAnimationFrame(()=>{if(bt.isConnected)bt.focus(),bt.reportValidity()})}let Tt=$o.useRef(null),li=$o.useId(),Bs=I||A==="split",Ns=Rw({modeKind:b.kind,publicationState:J,canEdit:I}),Uo=b.kind==="edit"&&J==="published",zs=$o.useRef(null);$o.useEffect(()=>{if(!EI()||!AI({modeKind:b.kind,publicationState:J,canEdit:I,hasUnsavedChanges:l,saveBlocked:oe,saveKind:S.kind}))return;if(zs.current?.draft===n.draft&&zs.current.body===k)return;let ke=window.setTimeout(()=>{let St=Tt.current;if(!(St!==null&&Array.from(St.elements).every((bt)=>!(bt instanceof HTMLInputElement||bt instanceof HTMLTextAreaElement||bt instanceof HTMLSelectElement)||bt.validity.valid)))return;zs.current={draft:n.draft,body:k},g()},CI);return()=>window.clearTimeout(ke)});let ce=qe.jsxDEV("span",{className:`studio-editor-head-save-status ${E(jn.saveStatus).className??""}`,role:"status","aria-live":"polite",title:"Drafts save as you type (Ctrl+S or ⌘S saves now)",children:S.kind==="saving"?"Saving…":S.kind==="error"||S.kind==="conflict"?"Not saved":l?"Unsaved changes":"Saved"},void 0,!1,void 0,this),In=Ns?ce:qe.jsxDEV(xe,{type:"submit",form:li,className:"studio-editor-head-save",variant:l?"default":"outline",title:`${Rt?"Create":Uo?"Publish changes":"Save changes"} (Ctrl+S or ⌘S)`,"aria-keyshortcuts":"Control+s Meta+s",disabled:oe,...Te&&{"aria-describedby":L0},children:S.kind==="saving"?Rt?"Creating…":Uo?"Publishing…":"Saving…":Rt?"Create":Uo?"Publish changes":"Save changes"},void 0,!1,void 0,this),Pi=Nt(),Gr=e.openEntity,Wr=$o.useMemo(()=>{let ke=(St)=>Pi.fetchPalette(St).then((co)=>(co.groups.find((bt)=>bt.id==="entries")?.items??[]).map((bt)=>{let _o=bt.id.indexOf(":");return{type:bt.id.slice(0,_o),id:bt.id.slice(_o+1),title:bt.title,typeLabel:bt.sub??""}}).filter((bt)=>bt.type&&bt.id));return{findEntries:ke,open:(St)=>{let{type:co,id:bt}=MI(St);if(co){Gr(bt,co);return}ke(bt).then((_o)=>{let br=_o.find((Tl)=>Tl.id===bt);if(br)Gr(br.id,br.type)})}}},[Pi,Gr]),et=$o.useMemo(()=>({library:()=>Pi.fetchImageLibrary({offset:0,limit:12}).then(({images:ke})=>ke.map((St)=>({id:St.id,alt:St.alt,title:St.title}))),upload:(ke)=>by(Pi,ke).then(({entityId:St})=>({id:St,alt:K3(ke.name)}))}),[Pi]),Is=(ke)=>{c(ke),D2(ke)},Hs=b.kind==="edit"&&!C.isSingleton&&e.model.canDelete,yr=Hs||C.hasBody?qe.jsxDEV(xI,{view:C.hasBody?{label:pw[o],onToggle:()=>Is(o==="write"?"markdown":"write")}:void 0,onDelete:Hs?()=>a({type:"deleteRequested"}):void 0},void 0,!1,void 0,this):null,yt=e.groupReturnLabel??F,[za]=$o.useState(()=>Symbol("editor"));TI(za,{title:C.isSingleton?Z.title:yt,...!C.isSingleton?{back:{label:yt,onBack:p}}:{},...Bs?{action:qe.jsxDEV(qe.Fragment,{children:[In,yr]},void 0,!0,void 0,this)}:{}}),$o.useEffect(()=>(document.addEventListener("keydown",Po),()=>document.removeEventListener("keydown",Po)));function Po(ke){if(K&&(ke.ctrlKey||ke.metaKey)&&!ke.altKey&&!ke.shiftKey&&ke.key==="\\"){ke.preventDefault(),ct(!De);return}if(!(ke.ctrlKey||ke.metaKey)||ke.altKey||ke.shiftKey||ke.key.toLowerCase()!=="s")return;if(ke.target instanceof HTMLElement&&ke.target.closest('[role="dialog"], [role="alertdialog"]'))return;if(ke.preventDefault(),!oe)Tt.current?.requestSubmit()}return qe.jsxDEV("form",{role:"main","aria-label":"Document editor",className:ie("",Qn.editor,A!=="split"&&rn.editor),"data-studio-editor":"","data-editor-presentation":A,"data-mobile-pane":A==="split"?r:void 0,"data-inspector":K?De?"hidden":"shown":void 0,onInvalidCapture:ze,onSubmit:(ke)=>{if(ke.preventDefault(),!oe)g()},id:li,ref:Tt,children:qe.jsxDEV(DI,{value:S.kind==="error"?"save":"check",children:[qe.jsxDEV(ir,{model:Z,appearance:"document",titleEditor:pe,navigation:!C.isSingleton?qe.jsxDEV(xe,{type:"button",variant:"ghost",onClick:p,"aria-label":`Back to ${yt}`,children:[qe.jsxDEV("span",{"aria-hidden":"true",children:"←"},void 0,!1,void 0,this)," Back to ",yt]},void 0,!0,void 0,this):void 0,action:Bs?qe.jsxDEV(qe.Fragment,{children:[e.ask&&b.kind==="edit"&&Q&&qe.jsxDEV(U0,{ask:e.ask,placement:"head"},void 0,!1,void 0,this),K&&qe.jsxDEV(xe,{type:"button",variant:"ghost",className:"studio-inspector-toggle",xstyle:Qn.inspectorToggle,"aria-pressed":!De,"aria-keyshortcuts":"Control+Backslash Meta+Backslash",title:"Details (Ctrl+\\\\ or ⌘\\\\)",onClick:()=>ct(!De),children:"Details"},void 0,!1,void 0,this),In,yr]},void 0,!0,void 0,this):void 0},void 0,!1,void 0,this),e.draftRecovery?.offer&&qe.jsxDEV("div",{"data-studio-draft-offer":"",children:qe.jsxDEV(me,{className:ie("",jn.inset),children:["Unsaved changes from"," ",qe.jsxDEV("time",{dateTime:new Date(e.draftRecovery.offer.savedAt).toISOString(),children:new Date(e.draftRecovery.offer.savedAt).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})},void 0,!1,void 0,this)," ","were kept in this browser."," ",qe.jsxDEV(xe,{type:"button",variant:"outline",onClick:e.draftRecovery.restore,children:"Restore"},void 0,!1,void 0,this)," ",qe.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.draftRecovery.discard,children:"Discard"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),qe.jsxDEV(dI,{active:H,split:A==="split",children:[b.kind==="create"&&H&&qe.jsxDEV("div",{className:ie("",jn.inset,Ct.destinationFrame),children:[qe.jsxDEV(j0,{kind:L,collectionLabel:F,collectionPath:e.collectionPath,query:{...e.collectionQuery,prefix:b.prefix??null},onNavigate:e.selectFolder,fixed:!0},void 0,!1,void 0,this),qe.jsxDEV(fI,{kind:L,segment:b.segment??"",followsTitle:Et!==void 0&&b.segmentFollowsTitle===!0,onSegmentChange:(ke)=>a({type:"segmentChanged",segment:ke}),preview:e.creationDestination.data,pending:e.creationDestination.pending,error:e.creationDestination.error,issues:S.kind==="error"?S.issues:void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),qe.jsxDEV(Lz,{presentation:A,children:[T&&qe.jsxDEV("p",{"data-studio-system-intro":"",...E(Ze.intro),children:T.intro},void 0,!1,void 0,this),qe.jsxDEV(Bz,{presentation:A,hidden:K&&De,sheet:A==="split"&&r==="details",onCloseSheet:()=>d("write"),summaryDescription:T?C.fields.slice(0,3).map((ke)=>ke.label).join(" · "):void 0,reveal:A==="document"&&!n.body.trim()||(_?.length??0)>0,children:[A!=="document"&&!T&&qe.jsxDEV("div",{className:ie("",di.propertiesHead),children:[qe.jsxDEV("h2",{className:ie("",di.propertiesLabel,lo.eyebrow),children:"Properties"},void 0,!1,void 0,this),b.kind==="create"||J?qe.jsxDEV("span",{className:ie("",di.propertiesLabel,lo.eyebrow),children:b.kind==="create"?"New":J},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),qe.jsxDEV(iI,{...e},void 0,!1,void 0,this),qe.jsxDEV(wI,{syncStatus:e.syncStatus,baselineCommit:e.baselineCommit,editor:n},void 0,!1,void 0,this),we&&b.kind==="edit"&&P&&qe.jsxDEV(Rz,{entityType:D,entityId:b.entity.id,title:Zi(b.entity),missing:(e.model.activeType?.publishRequires??[]).filter((ke)=>{let St=b.entity.frontmatter[ke];return St===void 0||St===null||typeof St==="string"&&St.trim()===""}),status:typeof b.entity.frontmatter.status==="string"?b.entity.frontmatter.status:"draft",unsaved:l,onAction:m},void 0,!1,void 0,this)]},sd(D,b),!0,void 0,this),C.hasBody&&qe.jsxDEV("section",{className:ie("",Qn.manuscript,A!=="split"&&rn.manuscript),children:[T&&qe.jsxDEV("header",{...E(Ze.bodyHeading),children:[qe.jsxDEV("h2",{...E(lo.secondaryDisplay),children:T.bodyTitle},void 0,!1,void 0,this),qe.jsxDEV("p",{...E(Ze.description),children:T.bodyDescription},void 0,!1,void 0,this)]},void 0,!0,void 0,this),qe.jsxDEV(Ez,{value:k,mode:o,onChange:(ke)=>a({type:"bodyChanged",body:ke}),onModeChange:Is,loadImage:(ke,St)=>Pi.fetchImagePreview(ke,St),images:et,links:Wr,readOnly:!I,documentTitle:Et?zt:Z.title,onSelectionChange:e.ask?.setSelection},void 0,!1,void 0,this),b.kind==="edit"&&e.model.activeType?.collection&&qe.jsxDEV(hI,{entityType:D,entityId:b.entity.id,onOpen:e.openEntity},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),qe.jsxDEV(lI,{...e},void 0,!1,void 0,this),qe.jsxDEV(vI,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Ba=G(Xe(),1);var Jd={anchor:{kVAEAm:"x1n2onr6",k1xSpc:"x3nfvp2",$$css:!0},menu:{kVAEAm:"x10l6tqk",kY2c9j:"x1q8xho0",k87sOh:"x1d1n87m",kt4wiu:"xtijo5x",k1xSpc:"xrvj5dj",kOIVth:"x195vfkc",kzqmXN:"xj6ak53",ks0D6T:"xw7nakj",kmVPX3:"x1ruevkc",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"x8tuc8h",kaIpWk:"xhpnuu7",kWkggS:"x18s3upu",kGVxlE:"x1mxzbga",k9WMMc:"x1yc453h",$$css:!0},choice:{k1xSpc:"xrvj5dj",kOIVth:"x1ed6fcf",kAzted:"x1gg8mnh x1kr55ab",k8WAf4:"x1m7iz9m",kg3NbH:"x1awh872",kMzoRj:"xc342km",kaIpWk:"x1kogg8i",kWkggS:"xjbqb8w x1jdv8xm xgvoa9k",kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",k9WMMc:"x1yc453h",kkrTdU:"x1ypdohk",k3XXqK:"x1t137rt x9v5kkp",kMeerF:"x1de99jn",kjBf7l:"x1itw484",kInvED:"x2ssjo2",$$css:!0},choiceLabel:{kGuDYH:"x4z9k3i",k63SB2:"x1s688f",$$css:!0},choiceDescription:{kGuDYH:"xfifm61",kLWn49:"x37zpob",kMwMTN:"x1ar3pfp",$$css:!0}};var Ls=G(fe(),1);function OI(e){let{entryLabel:n,starters:o,disabled:r,onCreate:l}=e,[a,c]=Ba.useState(!1),d=Ba.useRef(null),p=Ba.useId(),m=rr(n),g=`New ${m}`;if(Ba.useEffect(()=>{if(!a)return;d.current?.querySelector('[role="menuitem"]')?.focus();let S=(C)=>{if(C.target instanceof Node&&!d.current?.contains(C.target))c(!1)};return document.addEventListener("pointerdown",S),()=>document.removeEventListener("pointerdown",S)},[a]),!o?.length)return Ls.jsxDEV(xe,{type:"button",disabled:r,"data-studio-library-new":"",onClick:()=>l(),children:g},void 0,!1,void 0,this);let b=(S)=>{c(!1),l(S)},k=(S)=>{let C=[...S.currentTarget.querySelectorAll('[role="menuitem"]')],A=C.findIndex((T)=>T===document.activeElement),D=(T)=>{S.preventDefault(),C[(T+C.length)%C.length]?.focus()};if(S.key==="ArrowDown")D(A+1);else if(S.key==="ArrowUp")D(A-1);else if(S.key==="Home")D(0);else if(S.key==="End")D(C.length-1);else if(S.key==="Escape"||S.key==="Tab"){if(S.key==="Escape")S.preventDefault(),S.stopPropagation(),d.current?.querySelector("[data-studio-library-new]")?.focus();c(!1)}};return Ls.jsxDEV("div",{ref:d,...E(Jd.anchor),children:[Ls.jsxDEV(xe,{type:"button",disabled:r,"data-studio-library-new":"","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?p:void 0,onClick:()=>c((S)=>!S),children:g},void 0,!1,void 0,this),a&&Ls.jsxDEV("div",{id:p,role:"menu","aria-label":`Start a new ${m} from`,"data-studio-new-entry-menu":"",onKeyDown:k,...E(Jd.menu),children:[o.map((S)=>Ls.jsxDEV(RI,{label:S.label,description:S.description,onChoose:()=>b(S.id)},S.id,!1,void 0,this)),Ls.jsxDEV(RI,{label:`Empty ${m}`,description:"Start from nothing and fill in every field.",onChoose:()=>b()},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function RI(e){return Ls.jsxDEV("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:e.onChoose,...E(Jd.choice),children:[Ls.jsxDEV("span",{...E(Jd.choiceLabel),children:e.label},void 0,!1,void 0,this),Ls.jsxDEV("span",{...E(Jd.choiceDescription),children:e.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var F0=G(Xe(),1),Lw="studio.density";function i_(){try{return window.localStorage.getItem(Lw)==="compact"?"compact":"comfortable"}catch{return"comfortable"}}function o_(e){try{if(e==="compact")window.localStorage.setItem(Lw,e);else window.localStorage.removeItem(Lw)}catch{}}function LI(){let[e,n]=F0.useState(i_),o=F0.useCallback((r)=>{n(r),o_(r)},[]);return[e,o]}var Ue=G(fe(),1);function qI(e){let{entities:n,entityOffset:o,entityLimit:r,entityTotal:l,entityListLoading:a,schema:c,changeEntityPage:d,startCreate:p}=e,{activeType:m,entitySchema:g,systemDesign:b,canCreate:k,hierarchyKind:S,collectionLabel:C,entryLabel:A,pageEnd:D,collectionFiltered:T,listingHead:I}=e.model,H=dR({activeType:m,entityType:e.entityType,entities:n,entityOffset:o,entryLabel:A,collectionLabel:C,onConfirmed:e.onRefineConfirmed}),_=H.picked.length>0,[L,P]=LI(),Q=g.fields.some((oe)=>oe.column==="excerpt"||oe.column==="cover"),F=Q&&L==="compact",we=!F&&(n??[]).some((oe)=>Nw(oe,g.fields)),J=rR(H.picked.length,A,C),Z=m?.refinesInto;return Ue.jsxDEV("main",{className:ie("",Ae.listing,jn.inset),"data-studio-library":"","aria-busy":a,onKeyDown:(oe)=>{if(oe.key==="Escape"&&_&&!H.asking)H.clear()},children:[e.readError&&Ue.jsxDEV(me,{tone:"error",children:[n?.length?"Showing previously loaded entries. ":"",e.readError,Ue.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ue.jsxDEV(ir,{model:_?{...I,metadata:[oR(H.picked.length,l)]}:I,action:_?Ue.jsxDEV(Ue.Fragment,{children:[Ue.jsxDEV(xe,{type:"button",variant:"ghost",onClick:H.clear,children:"Cancel"},void 0,!1,void 0,this),Ue.jsxDEV(xe,{type:"button","data-studio-library-refine":"",onClick:H.ask,children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this):(!b||k)&&Ue.jsxDEV(OI,{entryLabel:A,starters:m?.starters,disabled:!k||!c,onCreate:p},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ue.jsxDEV(hR,{notice:e.refineNotice??null},void 0,!1,void 0,this),H.refusal&&Ue.jsxDEV(me,{tone:"error",children:H.refusal},void 0,!1,void 0,this),b&&Ue.jsxDEV("p",{"data-studio-system-intro":"",...E(Ze.collectionIntro),children:b.intro},void 0,!1,void 0,this),Ue.jsxDEV(j0,{kind:S,collectionLabel:C,collectionPath:e.collectionPath,query:e.collectionQuery,trail:e.collectionTrail,onNavigate:e.selectFolder},void 0,!1,void 0,this),e.pageTexts&&Ue.jsxDEV(eI,{pageTexts:e.pageTexts},void 0,!1,void 0,this),!g.isSingleton&&Ue.jsxDEV($I,{kind:S,query:e.collectionQuery,fields:g.fields,total:l,onChange:e.onCollectionQueryChange,...Q&&{density:L,onDensityChange:P}},void 0,!1,void 0,this),!a&&Ue.jsxDEV(cI,{kind:S,folders:e.folders,collectionPath:e.collectionPath,query:e.collectionQuery,onNavigate:e.selectFolder},void 0,!1,void 0,this),e.folders.length>0&&l>0&&Ue.jsxDEV("div",{className:ie("",Ct.label),children:[Ue.jsxDEV("span",{children:"Entries here"},void 0,!1,void 0,this),Ue.jsxDEV("span",{children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!g.isSingleton&&l>0&&Ue.jsxDEV(py,{label:`${m?.label??"Entity"} pagination`,offset:o,count:Math.max(0,D-o),total:l,loading:a,hasNext:o+r<l,onPrevious:()=>d(Math.max(0,o-r)),onNext:()=>d(o+r)},void 0,!1,void 0,this),a&&Ue.jsxDEV(me,{className:ie("",Ae.empty),children:"Loading entries…"},void 0,!1,void 0,this),!a&&(n??[]).map((oe,Te)=>Ue.jsxDEV(r_,{entity:oe,index:String(o+Te+1).padStart(2,"0"),view:e,refine:H,picking:_,compact:F,covers:we},oe.id,!1,void 0,this)),!e.readError&&!a&&n?.length===0&&e.folders.length===0&&Ue.jsxDEV(me,{className:ie("",Ae.empty),children:[e.collectionQuery.q||e.collectionQuery.status||e.collectionQuery.visibility!=="all"?"No entries match these filters. Clear or change the filters to try again.":k?"Nothing here yet — start the first entry.":"No entries are available in this collection.",T&&e.collectionQuery.prefix&&e.collectionQuery.scope==="folder"&&Ue.jsxDEV(xe,{type:"button",variant:"ghost",onClick:()=>e.onCollectionQueryChange({...e.collectionQuery,scope:"collection",offset:0}),children:"Search whole collection"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.asking&&e.entityType&&Z&&Ue.jsxDEV(pR,{entityType:e.entityType,entryLabel:A,collectionLabel:C,targetLabel:Z.label,picked:(n??[]).filter(({id:oe})=>H.picked.includes(oe)),onCancel:H.closeAsk,onRefused:H.refused,onConfirmed:(oe)=>{H.confirmed(oe),e.selectEntityType(Z.entityType)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function r_(e){let{entity:n,view:o,refine:r}=e,{systemDesign:l,entitySchema:a}=o.model,c=o.collectionQuery,d=Zi(n,n.path?.at(-1)),p=II(n),m=BI(n,a.fields),g=zI(n,a.fields),b=e.compact?null:NI(n,a.fields),k=e.covers,S=Nw(n,a.fields),C=k&&Ue.jsxDEV("span",{"data-studio-row-cover":"","aria-hidden":"true",...E(Ae.cover),children:S&&Ue.jsxDEV(dd,{imageId:S,thumbnailWidth:yy,alt:"",placeholder:Ue.jsxDEV("span",{...E(Ae.coverPending)},void 0,!1,void 0,this),...E(Ae.coverImage)},void 0,!1,void 0,this)},void 0,!1,void 0,this),A=()=>o.openEntity(n.id,n.entityType),D=_n(nr(),n.entityType,n.id),T=(H)=>{if(!Mo(H))return;H.preventDefault(),A()},I=Ue.jsxDEV("span",{className:ie("",Ae.title),title:n.id,children:[d,(c.q||c.scope==="collection")&&n.path&&n.path.length>1&&Ue.jsxDEV("span",{className:ie("",Ct.context),children:n.path.slice(0,-1).map(Up).join(" / ")},void 0,!1,void 0,this),b&&Ue.jsxDEV("span",{"data-studio-row-excerpt":"",...E(Ae.excerpt),children:b},void 0,!1,void 0,this),m&&Ue.jsxDEV("span",{className:ie("studio-publication-state",di.publication,e.compact&&Ae.inlineStatus),children:HI(m)},void 0,!1,void 0,this),p&&Ue.jsxDEV("span",{"data-studio-generation":p,className:ie("",di.publication),children:p},void 0,!1,void 0,this),n.members&&Ue.jsxDEV("span",{"data-studio-row-members":"",className:ie("",Ae.members),children:n.members.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(r.available&&!l){let H=r.picked.includes(n.id);return Ue.jsxDEV("div",{"data-studio-row":"",...e.picking&&{"data-picking":""},className:ie("",Ae.row,di.listingRow,Vn.row,k&&Ae.covered,e.compact&&Ae.compact,H&&Vn.rowPicked),children:[Ue.jsxDEV(fR,{index:e.index,title:d,picked:H,onToggle:()=>r.toggle(n.id)},void 0,!1,void 0,this),Ue.jsxDEV("a",{href:D,"data-studio-record":"",...E(Vn.open),onClick:T,children:[C,I,Ue.jsxDEV("time",{className:ie("",Ae.updated,Vn.updated),dateTime:g.iso,title:g.iso,children:Bw(g)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}return Ue.jsxDEV("a",{href:D,className:ie("",Ae.row,Ae.recordLink,di.listingRow,k&&Ae.covered,e.compact&&Ae.compact),"data-studio-record":"",onClick:T,children:[Ue.jsxDEV("span",{className:ie("",Ae.index),children:e.index},void 0,!1,void 0,this),C,I,Ue.jsxDEV("time",{className:ie("",Ae.updated),dateTime:g.iso,title:g.iso,children:Bw(g)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var GI=G(Xe(),1);var s_={surface:{kzqmXN:"xh8yej3",kB7OPa:"x9f619",k7Eaqz:"xeuugli",kAzted:"x2lwn1j",kGO01o:"x1sgudl8",kORKVm:"x1odjw0f",kh9fTk:"x1c54s19",kKq9zD:"xiqhxos",k4sGnE:"x11u2ate",kzrhLs:"x14214pg","--operator-section-spacing":"xn0jjtu","--operator-section-transform":"x6lesxo",$$css:!0}};function zw(e){return`${e} ${E(s_.surface,jn.inset,lo.operatorRoles).className??""}`}var Iw=G(Xe(),1);function l_(e){return Iw.createElement(UI,{...e,children:Iw.createElement("div",E(Ae.readable),e.children)})}var Hw={engine:"app",density:"comfortable",Button:xe,Input:Eu,Select:wu,Textarea:cd,ConfirmDialog:Nn,Disclosure:l_,Tabs:PI};var jr=G(fe(),1);function WI(e){let{activeWorkspaceId:n,workspaceError:o,declarativeWorkspaceData:r,workspaceQuery:l,openWorkspaceEntity:a,openWorkspaceLaunch:c,performDeclarativeAction:d,onWorkspaceQueryChange:p}=e,{declarativeHead:m}=e.model,[g,b]=GI.useState(null);return o&&!r?jr.jsxDEV("main",{className:zw(""),children:jr.jsxDEV(me,{tone:"error",children:[o,jr.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):r&&m?jr.jsxDEV("div",{className:zw("studio-workspace-frame"),children:[o&&jr.jsxDEV(me,{tone:"error",children:["Showing previously loaded content. ",o,jr.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),jr.jsxDEV(ir,{model:m,...g?{back:{label:m.title,onBack:g.close}}:{},...r.view.headQuery&&n?{control:jr.jsxDEV(_I,{control:r.view.headQuery,query:l,onQueryChange:(k)=>p(n,k,k)},void 0,!1,void 0,this)}:{},...m.primaryAction?{action:jr.jsxDEV(jI,{action:m.primaryAction,primary:!0,onAction:d,components:Hw},void 0,!1,void 0,this)}:{}},void 0,!1,void 0,this),jr.jsxDEV(VI,{data:r,components:Hw,renderHead:!1,onDetailChange:b,onOpenEntity:a,onLaunch:c,onAction:d,query:l,...n?{onQueryChange:(k)=>p(n,k,k)}:{}},n,!1,void 0,this)]},void 0,!0,void 0,this):null}var At=G(fe(),1);function ZI(e,n){if(!e.hasBody)return"details";return n??"write"}function Xu(e){return At.jsxDEV("div",{className:ie("studio",Ae.frame,lo.operatorRoles,X0.space),"data-studio-shell":"",children:[At.jsxDEV(K0,{contextLabel:"Studio"},void 0,!1,void 0,this),At.jsxDEV("main",{"aria-label":"Studio status",children:[At.jsxDEV(me,{tone:e.error?"error":void 0,className:ie("",Ae.boot),children:[e.message,e.onRetry&&At.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onRetry,children:"Retry"},void 0,!1,void 0,this),e.onHome&&At.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onHome,children:"Open Studio"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.children&&At.jsxDEV("div",{className:ie("",Ae.boot),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function e8(e){let n=$w();return At.jsxDEV("div",{className:ie("studio",Ae.frame,lo.operatorRoles,X0.space),"data-view":"account","data-studio-shell":"",children:[At.jsxDEV(K0,{contextLabel:"Account",navigation:{types:e.types,workspaces:e.workspaces,activeEntityType:null,activeWorkspaceId:e.workspaceId,workspaceBadges:Y0(e.workspaces),selectEntityType:e.selectEntityType,selectWorkspace:e.selectWorkspace}},void 0,!1,void 0,this),At.jsxDEV("div",{className:Pp("",Qn.body,Yu.shell,n&&Yu.shellCollapsed),"data-studio-body":"",children:[At.jsxDEV("aside",{className:Pp("rail",Yu.rail),children:At.jsxDEV(qw,{renderMode:"desktop",types:e.types,active:null,onSelect:e.selectEntityType,workspaces:e.workspaces,activeWorkspace:e.workspaceId,workspaceBadges:Y0(e.workspaces),onSelectWorkspace:e.selectWorkspace},void 0,!1,void 0,this)},void 0,!1,void 0,this),At.jsxDEV("main",{className:FI("account-studio-pane",QI.pane),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function t8(e){let n=$w(),{activeWorkspaceId:o,types:r,workspaces:l,entityType:a,editor:c,deleting:d,navigationBlocked:p,dispatchEditor:m,selectEntityType:g,selectWorkspace:b,remove:k,onNavigationReset:S,onNavigationProceed:C}=e,{mode:A,deleteOpen:D}=c,T=JI(e),I=u_(e,T),{editing:H,canDelete:_,collectionLabel:L,workspaceBadges:P}=T;return At.jsxDEV("div",{className:ie("studio",Ae.frame,lo.operatorRoles,X0.space),"data-studio-shell":"","data-view":e.groupingView?"grouping":e.mediaView?e.media?.active??"images":o?"workspace":H?"editor":"listing",children:[At.jsxDEV(K0,{pageTitle:H?T.editorHead.title:void 0,contextLabel:e.groupReturnLabel??YI.find((Q)=>Q.key===e.media?.active)?.label??e.groupings?.items.find((Q)=>Q.key===e.groupings?.active)?.label??L,navigation:{groupings:e.groupings,media:e.media,types:r,workspaces:l,activeEntityType:o||e.groupings?.active||e.media?.active?null:a,activeWorkspaceId:o,workspaceBadges:P,selectEntityType:g,selectWorkspace:b,editing:H&&!T.entitySchema.isSingleton}},void 0,!1,void 0,this),At.jsxDEV("div",{className:Pp("",Qn.body,Yu.shell,n&&Yu.shellCollapsed),"data-studio-body":"",children:[At.jsxDEV("aside",{className:Pp("rail",Yu.rail),children:At.jsxDEV(qw,{renderMode:"desktop",focus:H,groupings:e.groupings,media:e.media,types:r,active:o||e.groupings?.active||e.media?.active?null:a,onSelect:g,workspaces:l,activeWorkspace:o,workspaceBadges:Y0(l),onSelectWorkspace:b},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.groupingView??e.mediaView??e.homeView??(o?At.jsxDEV(WI,{...e,model:T},void 0,!1,void 0,this):!H?At.jsxDEV(qI,{...e,model:T},void 0,!1,void 0,this):I?At.jsxDEV("div",{...E(Fd.row),children:[At.jsxDEV("div",{...E(Fd.grow),children:At.jsxDEV(Ow,{...e,model:T},void 0,!1,void 0,this)},void 0,!1,void 0,this),I]},void 0,!0,void 0,this):At.jsxDEV(Ow,{...e,model:T},void 0,!1,void 0,this))]},void 0,!0,void 0,this),D&&A.kind==="edit"&&_&&At.jsxDEV(RR,{title:Zi(A.entity),deleting:d,onCancel:()=>m({type:"deleteCancelled"}),onConfirm:k},void 0,!1,void 0,this),p&&At.jsxDEV(Nn,{mark:"↩",title:"Discard unsaved changes?",titleId:"discard-navigation-title",cancelLabel:"Keep editing",confirmLabel:"Discard and continue",confirmVariant:"danger",onCancel:S,onConfirm:C,children:At.jsxDEV("p",{children:"This draft has not been saved. Continue only if you want to leave it behind."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var a_=J0.lazy(async()=>({default:(await import("./studio-chunks/studio-ask-panel-njthpfwq.js")).StudioAskPanel}));function u_(e,n){let{ask:o,editor:r,dispatchEditor:l}=e,{mode:a,body:c}=r;if(!o?.open||a.kind!=="edit"||!n.canAssist)return null;let d=n.entitySchema.fields,p=(m,g)=>{if(m.field==="selection"){let k=g?XI(c,g,m.text):null;if(k===null)return"The selected passage has changed. Select it again and ask once more.";return l({type:"bodyChanged",body:k}),null}if(m.field==="body")return l({type:"bodyChanged",body:m.text}),null;let b=d.find((k)=>k.name===m.field);if(!b)return`This entry has no ${m.label.toLowerCase()}.`;return l({type:"fieldChanged",descriptor:b,raw:m.text}),null};return At.jsxDEV(J0.Suspense,{fallback:null,children:At.jsxDEV(a_,{chatApiPath:o.chatApiPath,draftStore:o.draftStore,entityType:n.selectedEntityType,entityId:a.entity.id,title:n.editorHead.title,typeLabel:n.entryLabel.toLowerCase(),savedBody:a.entity.body,unsaved:e.hasUnsavedChanges,selection:o.selection,onClearSelection:()=>o.setSelection(null),fields:KI(d),agents:e.agentTargets,onApply:p,onClose:()=>o.setOpen(!1)},`${n.selectedEntityType}:${a.entity.id}`,!1,void 0,this)},void 0,!1,void 0,this)}var uo=G(Xe(),1);function Uw(e,n){return e.toLowerCase().includes(n.toLowerCase())}function i8(e){let n=e.query.trim(),o=e.openEntry&&e.hasChat?[{id:"ask-entry",title:`Ask about this ${e.openEntry.typeLabel}`,kbd:"⌘J",command:{kind:"ask-entry"}}].filter((b)=>!n||Uw(b.title,n)):[],r=e.types.filter((b)=>b.canCreate&&!b.isSingleton&&b.classification!=="system"),l=r.map(n8),a=r.flatMap((b)=>[...(b.starters??[]).map((k)=>({id:`create:${b.entityType}:${k.id}`,title:`New ${Pw(b)}: ${k.label}`,sub:k.description,command:{kind:"create",entityType:b.entityType,starter:k.id}})),n8(b)]),c={id:"climate",title:"Switch light and dark",command:{kind:"climate"}},d=n?[...[...a,c].filter((b)=>Uw(b.title,n)||b.sub!==void 0&&Uw(b.sub,n)),...e.hasChat?[{id:"ask-brain",title:`Ask your brain “${n}”`,command:{kind:"ask-brain",question:n}}]:[]]:[...l.slice(0,3),c],p=(e.remote?.groups??[]).map((b)=>({id:b.id,label:b.label,items:b.items.map((k)=>({id:`${b.id}:${k.id}`,title:k.title,sub:k.sub,command:k.run?{kind:"run",...k.run,href:k.href}:{kind:"open",href:k.href}}))})),m=p.filter((b)=>b.id==="actions").flatMap((b)=>b.items),g=[...d,...m];return[...o.length>0&&e.openEntry?[{id:"for-open",label:`For this ${e.openEntry.typeLabel}`,items:o}]:[],...g.length>0?[{id:"actions",label:"Actions",items:g}]:[],...p.filter((b)=>b.id!=="actions")].filter((b)=>b.items.length>0)}function o8(e,n,o){if(o===0)return-1;return((e+n)%o+o)%o}function Pw(e){return e.singularLabel.toLowerCase()}function n8(e){return{id:`create:${e.entityType}`,title:`New ${Pw(e)}`,...(e.starters?.length??0)>0&&{sub:`Empty ${Pw(e)}`},command:{kind:"create",entityType:e.entityType}}}var ao={content:{kB7OPa:"x9f619",kzqmXN:"xcs98ov",kskxy:"xu180u2",kmVPX3:"x1717udv",k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kVQacm:"xb3r6kr",kMv6JI:"x5ddh9m",$$css:!0},field:{k8WAf4:"x10dr8xq",kg3NbH:"x1hr3lfm",kt9PQ7:"xso031l",kfdmCh:"x1q0q8m5",kL6WhQ:"xpqg30t",$$css:!0},input:{kB7OPa:"x9f619",kzqmXN:"xh8yej3",kMzoRj:"xc342km",ksu8eU:"xng3xce",k3XXqK:"x1t137rt",kWkggS:"xjbqb8w",kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",kGuDYH:"x1j61zf2",$$css:!0},list:{kORKVm:"x1odjw0f",k8WAf4:"x1t0vds8",kogj98:"x1ghz6dp",$$css:!0},section:{k8WAf4:"x12ulsxz",$$css:!0},label:{kogj98:"x1ghz6dp",k8WAf4:"x1t0vds8",kg3NbH:"x1hr3lfm",kGuDYH:"x1j6dyjg",kb6lSQ:"x1vyo3qp",kP9fke:"xtvhhri",kMwMTN:"xqvuw85",kMv6JI:"xa9opjo",$$css:!0},item:{k1xSpc:"x78zum5",kGNEyG:"x1pha0wt",kOIVth:"x883omv",k8WAf4:"x1vvogim",kg3NbH:"x1hr3lfm",kMwMTN:"xqvuw85",kkrTdU:"x1ypdohk",$$css:!0},active:{kWkggS:"x9kxhyz",$$css:!0},title:{kGuDYH:"xif65rj",$$css:!0},sub:{kGuDYH:"xfifm61",kMwMTN:"xqvuw85",$$css:!0},kbd:{k1xSpc:"x15n0non xkaaz9w",keTefX:"xvc5jky",kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",kMwMTN:"xqvuw85",$$css:!0},empty:{kogj98:"x1ghz6dp",k8WAf4:"x1xn8qrt",kg3NbH:"x1hr3lfm",kGuDYH:"x4z9k3i",kMwMTN:"x1ar3pfp",$$css:!0}};var gi=G(fe(),1),c_=150;function s8(e){let n=Nt(),o=uo.useId(),[r,l]=uo.useState(!1),[a,c]=uo.useState(""),[d,p]=uo.useState(null),[m,g]=uo.useState(0),[b,k]=uo.useState(null),[S,C]=uo.useState(null);uo.useEffect(()=>{let L=(Q)=>{if(Q.key.toLowerCase()!=="k"||!(Q.metaKey||Q.ctrlKey)||Q.altKey||Q.shiftKey)return;Q.preventDefault(),l((F)=>!F)},P=()=>l(!0);return window.addEventListener("keydown",L),window.addEventListener(_w,P),()=>{window.removeEventListener("keydown",L),window.removeEventListener(_w,P)}},[]),uo.useEffect(()=>{if(!r)return;let L=!0,P=window.setTimeout(()=>{n.fetchPalette(a).then((Q)=>{if(L)p(Q)}).catch(()=>{if(L)p(null)})},c_);return()=>{L=!1,window.clearTimeout(P)}},[n,r,a]);let A=uo.useMemo(()=>i8({query:a,types:e.types,hasChat:e.hasChat,openEntry:e.openEntry,remote:d}),[a,e.types,e.hasChat,e.openEntry,d]),D=A.flatMap((L)=>L.items),T=Math.min(m,D.length-1),I=()=>{l(!1),c(""),g(0),C(null)},H=(L)=>{if(L.kind!=="run"){I(),e.onCommand(L);return}if(b)return;k(L.actionId),C(null),Promise.resolve(e.onCommand(L)).then(I).catch((P)=>C(Ln(P))).finally(()=>k(null))},_=(L)=>{if(L.key==="ArrowDown"||L.key==="ArrowUp")L.preventDefault(),g(o8(T,L.key==="ArrowDown"?1:-1,D.length));else if(L.key==="Enter"){let P=D[T];if(!P)return;L.preventDefault(),H(P.command)}};return gi.jsxDEV(Ma,{open:r,onOpenChange:(L)=>{if(!L)I()},children:gi.jsxDEV(Ra,{"aria-describedby":void 0,"data-studio-palette":"",...E(ao.content),children:[gi.jsxDEV(r8.Root,{children:gi.jsxDEV(Oa,{children:"Search or run a command"},void 0,!1,void 0,this)},void 0,!1,void 0,this),gi.jsxDEV("div",{...E(ao.field),children:gi.jsxDEV("input",{...E(ao.input),role:"combobox","aria-expanded":"true","aria-controls":o,"aria-activedescendant":D[T]?`${o}-${T}`:void 0,"aria-label":"Search or run a command",placeholder:"Search or do…",value:a,autoFocus:!0,onChange:(L)=>{c(L.currentTarget.value),g(0)},onKeyDown:_},void 0,!1,void 0,this)},void 0,!1,void 0,this),(b??S)&&gi.jsxDEV("p",{...E(ao.empty),role:"status",children:b?"Running…":S},void 0,!1,void 0,this),gi.jsxDEV("div",{...E(ao.list),id:o,role:"listbox",children:D.length===0?gi.jsxDEV("p",{...E(ao.empty),children:["Nothing matches “",a.trim(),"”."]},void 0,!0,void 0,this):A.map((L)=>gi.jsxDEV("div",{role:"group","aria-labelledby":`${o}-${L.id}`,...E(ao.section),children:[gi.jsxDEV("div",{id:`${o}-${L.id}`,role:"presentation",...E(ao.label),children:L.label},void 0,!1,void 0,this),L.items.map((P)=>{let Q=D.indexOf(P);return gi.jsxDEV("div",{id:`${o}-${Q}`,role:"option","aria-selected":Q===T,"data-palette-item":P.id,...E(ao.item,Q===T&&ao.active),onMouseMove:()=>g(Q),onClick:()=>H(P.command),children:[gi.jsxDEV("span",{...E(ao.title),children:P.title},void 0,!1,void 0,this),P.sub&&gi.jsxDEV("span",{...E(ao.sub),children:P.sub},void 0,!1,void 0,this),P.kbd&&gi.jsxDEV("kbd",{...E(ao.kbd),children:P.kbd},void 0,!1,void 0,this)]},P.id,!0,void 0,this)})]},L.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function l8(e,n,o){return{studioChatHandoff:{version:1,sourceId:e,itemId:n,label:o,prompt:"Help me understand this Inbox item and decide what to do next."}}}var d_=500;function a8(e){return{studioChatQuestion:{version:1,question:e.trim()}}}function u8(e){if(typeof e!=="object"||e===null)return null;let n=Reflect.get(e,"studioChatQuestion");if(typeof n!=="object"||n===null)return null;let o=Reflect.get(n,"question");if(Reflect.get(n,"version")!==1||typeof o!=="string"||o.trim().length===0||o.length>d_)return null;return o.trim()}function c8(e){if(typeof e!=="object"||e===null)return null;let n=Reflect.get(e,"studioChatHandoff");if(typeof n!=="object"||n===null)return null;let o=Reflect.get(n,"version"),r=Reflect.get(n,"sourceId"),l=Reflect.get(n,"itemId"),a=Reflect.get(n,"label"),c=Reflect.get(n,"prompt");if(o!==1||typeof r!=="string"||!/^[a-z][a-z0-9-]*$/.test(r)||r.length>64||typeof l!=="string"||l.trim().length===0||l.length>300||typeof a!=="string"||a.trim().length===0||a.length>160||typeof c!=="string"||c.trim().length===0||c.length>1e4)return null;return{sourceId:r,itemId:l,label:a,prompt:c}}function Na(e){if(e instanceof Do)switch(e.status){case 401:return"Your session is no longer authenticated. Sign in again in another tab, then retry here. Keep this tab open to preserve your draft.";case 403:return"You do not currently have permission to read this content. Ask an administrator to check access, then retry.";case 404:return"This content is unavailable. It may have moved, been removed, or be outside your access. Choose another destination or retry.";case 429:return"Studio is receiving too many requests. Wait briefly before retrying."}return`Studio could not load this data. Check your connection or retry later. ${Ln(e)}`}var Z0=G(Xe(),1);var f_=Cs.parse({});function d8(e){let n=Nt(),o=Z0.useMemo(()=>e.filter((d)=>!d.rules?.values),[e]),r=Z0.useMemo(()=>o.map((d)=>fy(n,d.key,f_)),[n,o]),l=H0({queries:r}),a={};l.forEach((d,p)=>{let m=o[p];if(m&&d.isSuccess&&d.data.kind==="catalog")a[m.field]=d.data.values.map((g)=>g.value)});let c=JSON.stringify(a);return Z0.useMemo(()=>JSON.parse(c),[c])}var Vw=G(Xe(),1);var f8=new Set(["offset","limit"]);function h8(e,n){if(e?.urlQuery!==!0)return{};let o={};for(let[r,l]of new URLSearchParams(n))if(!f8.has(r))o[r]=l;return o}function jw(e){let n=new URLSearchParams,o=Object.entries(e).filter(([l,a])=>!f8.has(l)&&a!==void 0&&(typeof a!=="number"||Number.isFinite(a))).sort(([l],[a])=>l.localeCompare(a));for(let[l,a]of o)n.set(l,String(a));let r=n.toString();return r?`?${r}`:""}function El(e,n){return`${e}${jw(n)}`}function eb(e,n,o,r){if(r!==n)return;e.replace(El(n,o))}var h_=[],p_=[],m_=[],g_={};function C8(e){let{api:n,entityType:o,activeWorkspaceId:r,routeSearch:l,workspaceQueries:a,editor:c}=e,{mode:d,draft:p,body:m}=c,g=Xt(k8(n)),b=g.data?.types??null,k=g.data?.groupings??h_,S=b?.find((In)=>In.entityType===o),C=b?S?.containedIn??o:null,A=S?.capabilities,D=Vw.useMemo(()=>S?.isSingleton?Kd("?scope=collection"):Kd(l),[S?.isSingleton,l]),T=D.offset,I=g.data?.workspaces??m_,H=I.find((In)=>In.id===r),_=H?.rendererName===m8,L=H?.rendererName===Ku,P=H?.rendererName==="DeclarativeOperatorWorkspace"&&H.id!==_p,Q=r?a[r]:void 0,F=H?.urlQuery!==!0||Q?.urlSearch===l,we=Vw.useMemo(()=>h8(H,l),[H,l]),J=r?Q&&F?Q.query:we:g_,Z=Xt({...S8(n,r??"",J),enabled:P}),oe=Z.data??null,Te=oe?.data??null,Rt=Z.error?Na(Z.error):null,K=d.kind==="edit"?d.entity.id:null,le=Xt({...x8(n,o??"",K??""),enabled:o!==null&&K!==null&&A?.canAssist===!0&&A.canUpdate}),se=le.data??p_,ge=Xt({...w8(n),enabled:o!==null}),De=ge.data??null,ct=Xt({...nb(n,C??"",D),enabled:C!==null}),Et=C?ct.data?.entities??null:null,zt=ct.data?.total,pe=Xt({...tb(n,o??"",S?.fieldsPerEntry===!0?K:null),enabled:o!==null&&(K===null||b!==null)}),ze=o?pe.data??null:null,Tt=p8(d),li=Xt(v8(n,o&&Tt&&d.kind==="create"&&d.segment?{entityType:o,idPath:Tt,frontmatter:ib(ze?.fields??[],p),...ze?.hasBody&&{body:m}}:null));Xt({...Zd(n,o??"",K??""),enabled:o!==null&&K!==null});let Bs=or({mutationFn:(In)=>b8(n,In)}),Ns=or({mutationFn:(In)=>y8(n,In)}),Uo=or({mutationFn:(In)=>g8(n,In)}),zs=Ns.isPending,ce=P&&oe?oe.data:null;return{navigationQuery:g,types:b,groupings:k,activeType:S,collectionType:C,activeCapabilities:A,entityCollectionQuery:D,entityListOffset:T,workspaces:I,activeWorkspace:H,activeAccount:_,activeChat:L,activeDeclarativeWorkspace:P,storedWorkspaceQuery:Q,storedQueryMatchesLocation:F,initialUrlWorkspaceQuery:we,workspaceRequestQuery:J,workspaceQuery:Z,workspaceResponse:oe,workspaceData:Te,workspaceError:Rt,activeEntityId:K,agentTargetsQuery:le,agentTargets:se,syncStatusQuery:ge,syncStatus:De,entityListQuery:ct,entities:Et,entityListTotal:zt,entitySchemaQuery:pe,schema:ze,createPath:Tt,destinationQuery:li,saveEntityMutation:Bs,deleteEntityMutation:Ns,declarativeWorkspaceActionMutation:Uo,deleting:zs,declarativeWorkspaceData:ce}}var qo=G(Xe(),1);var A8=(e)=>Ii.string().trim().min(1).max(e).refine((n)=>!/[\p{Cc}\p{Cf}]/u.test(n)),y_=(e)=>Ii.string().trim().min(1).max(e).refine((n)=>Array.from(n).every((o)=>o===`
|
|
262
|
+
`),p=pz(d[1]??"").map((g)=>/^:-+:$/.test(g)?"center":/-+:$/.test(g)?"right":"left"),m=[d[0]??"",...d.slice(2)].filter((g)=>g.trim()).map(pz);return o.push({from:l,to:a,rows:m,align:p}),!1}}),o}class kz extends to{block;constructor(e){super();this.block=e}eq(e){return e.block.from===this.block.from&&JSON.stringify(e.block.rows)===JSON.stringify(this.block.rows)&&e.block.align.join()===this.block.align.join()}toDOM(e){let n=document.createElement("div");n.className="cm-live-table",n.tabIndex=0,n.setAttribute("role","region"),n.setAttribute("aria-label","Table, select to edit");let o=document.createElement("table");this.block.rows.forEach((l,a)=>{let c=document.createElement("tr");l.forEach((d,p)=>{let m=document.createElement(a===0?"th":"td");m.textContent=d,m.style.textAlign=this.block.align[p]??"left",c.append(m)}),(a===0?o.tHead??o.createTHead():o.tBodies[0]??o.createTBody()).append(c)}),n.append(o);let r=(l)=>{l.preventDefault(),e.dispatch({selection:{anchor:this.block.from}}),e.focus()};return n.addEventListener("pointerdown",r),n.addEventListener("keydown",(l)=>{if(l.key==="Enter")r(l)}),n}ignoreEvent(){return!0}}var RP=hi.define({create:(e)=>mz(e),update:(e,n)=>n.docChanged||n.selection!==void 0||lt(n.startState)!==lt(n.state)?mz(n.state):e,provide:(e)=>ue.decorations.from(e)});function mz(e){return Ke.set(MP(e).map((n)=>Ke.replace({widget:new kz(n),block:!0}).range(n.from,n.to)))}function Sz(e={}){return[RP,LP(e.loadImage),OP]}var OP=ue.domEventHandlers({mousedown:(e,n)=>{if(!(e.metaKey||e.ctrlKey)||e.button!==0)return!1;let o=e.target instanceof Element?e.target.closest("[data-wiki-target]")?.getAttribute("data-wiki-target"):null;if(!o)return!1;return e.preventDefault(),n.dom.dispatchEvent(new CustomEvent(Op,{bubbles:!0,detail:{target:o}})),!0}});function LP(e){return Bo.fromClass(class{decorations;constructor(n){this.decorations=hz(n,e)}update(n){if(n.docChanged||n.selectionSet||n.viewportChanged||n.focusChanged||lt(n.startState)!==lt(n.state))this.decorations=hz(n.view,e)}},{decorations:(n)=>n.decorations})}var zi=G(fe(),1),Az=Ti.define(),BP=Ld.define([{tag:Y.heading1,fontFamily:"var(--console-display)",fontSize:"1.75em",fontWeight:"600",color:"var(--console-text)"},{tag:Y.heading2,fontFamily:"var(--console-display)",fontSize:"1.4em",fontWeight:"600",color:"var(--console-text)"},{tag:Y.heading3,fontFamily:"var(--console-display)",fontSize:"1.18em",fontWeight:"600",color:"var(--console-text)"},{tag:Y.heading,color:"var(--console-text)",fontWeight:"600"},{tag:Y.monospace,fontFamily:"var(--console-mono)",fontSize:"0.86em"},{tag:Y.meta,color:"var(--console-text-muted)"},{tag:Y.emphasis,fontStyle:"italic"},{tag:Y.strong,fontWeight:"600"},{tag:[Y.link,Y.url],color:"var(--console-text)",textDecoration:"underline"},{tag:Y.quote,color:"var(--console-text-dim)"},{tag:[Y.keyword,Y.bool,Y.null,Y.operator],color:"color-mix(in srgb, var(--console-accent) 55%, var(--console-text))"},{tag:[Y.string,Y.regexp],color:"color-mix(in srgb, var(--console-ok) 55%, var(--console-text))"},{tag:Y.number,color:"color-mix(in srgb, var(--console-warn) 45%, var(--console-text))"},{tag:Y.comment,color:"color-mix(in srgb, var(--console-text-dim) 70%, var(--console-text))",fontStyle:"italic"},{tag:[Y.typeName,Y.propertyName,Y.tagName,Y.attributeName],fontWeight:"600"},{tag:Y.processingInstruction,color:"var(--console-text-dim)",fontFamily:"var(--console-mono)",fontSize:"0.82em",fontWeight:"400"}]),NP=[["TypeScript",["ts","typescript"],ju.configure({dialect:"ts"})],["TSX",["tsx"],ju.configure({dialect:"ts jsx"})],["JavaScript",["js","javascript"],ju],["JSX",["jsx"],ju.configure({dialect:"jsx"})],["CSS",["css"],h0],["HTML",["html"],m0],["JSON",["json"],wz]].map(([e,n,o])=>qu.of({name:e,alias:[...n],support:new ur(qr.define({parser:o}))})),R0=(e)=>(n)=>(n.dispatch(xl(n.state,e)),!0),zP=yl.of([{key:"Mod-k",run:(e)=>{if(e.state.selection.main.empty)return!1;return Lp(e),!0}},{key:"Mod-b",run:R0("**")},{key:"Mod-i",run:R0("*")},{key:"Mod-e",run:R0("`")},{key:"Mod-Shift-x",run:R0("~~")}]),IP=[s3({base:Pd,codeLanguages:NP,extensions:[tz]}),dB(BP),ue.lineWrapping,ue.contentAttributes.of({tabindex:"0"}),b3(),zP,yl.of([...x3,...F3.filter((e)=>e.key!=="Mod-/")])];function xz(e,n){return e?[Sz(n?{loadImage:n}:{}),RB({override:[Z3],icons:!1,activateOnTyping:!0,aboveCursor:!1}),ue.contentAttributes.of({"aria-label":"Writing"})]:[ue.contentAttributes.of({"aria-label":"Markdown source"})]}function HP(e,n=[]){return it.create({doc:e,extensions:[...IP,...n]})}function $P(e,n){if(e.state.doc.toString()===n)return;e.dispatch({changes:{from:0,to:e.state.doc.length,insert:n},annotations:Az.of(!0)})}function qP(e){let{value:n,live:o,onChange:r,onSelectionChange:l,readOnly:a}=e,c=pt.useRef(e.loadImage),d=pt.useRef(null),p=pt.useRef(null),m=pt.useRef(n),g=pt.useRef(a),b=pt.useRef(new Ru),k=pt.useRef(new Ru),S=pt.useRef(o),C=pt.useRef(r),A=pt.useRef(l),D=pt.useRef(e.onView),T=pt.useRef(e.onActivity),I=pt.useRef(e.uploadImage),H=pt.useRef(e.onImageFailure);pt.useEffect(()=>{D.current=e.onView,T.current=e.onActivity,I.current=e.uploadImage,H.current=e.onImageFailure},[e.onView,e.onActivity,e.uploadImage,e.onImageFailure]);let _=pt.useCallback((L)=>{let P=L.state.selection.main;A.current?.(P.empty?null:{from:P.from,to:P.to})},[]);return pt.useEffect(()=>{C.current=r,A.current=l},[r,l]),pt.useEffect(()=>{let L=d.current;if(!L)return;let P=new ue({parent:L,state:HP(m.current,[k.current.of(xz(S.current,c.current)),b.current.of([it.readOnly.of(g.current),ue.editable.of(!g.current)]),ue.updateListener.of((Q)=>{if(!Q.docChanged)return;if(Q.transactions.some((F)=>F.annotation(Az)===!0))return;C.current(Q.state.doc.toString())}),ue.updateListener.of((Q)=>{if(!Q.selectionSet&&!Q.docChanged)return;_(Q.view)}),ue.updateListener.of((Q)=>{if(Q.selectionSet||Q.docChanged||Q.focusChanged)T.current?.()}),J3((Q)=>I.current?I.current(Q):Promise.reject(Error("images cannot be added here")),(Q)=>H.current?.(Q)),ue.domEventHandlers({keyup:(Q,F)=>(_(F),!1),mouseup:(Q,F)=>(window.setTimeout(()=>_(F),0),!1),touchend:(Q,F)=>(window.setTimeout(()=>_(F),0),!1)})])});return p.current=P,D.current?.(P),()=>{if(P.destroy(),p.current===P)p.current=null;D.current?.(null)}},[_]),pt.useEffect(()=>{let L=p.current;if(!L)return;$P(L,n)},[n]),pt.useEffect(()=>{let L=p.current;if(!L)return;L.dispatch({effects:b.current.reconfigure([it.readOnly.of(a),ue.editable.of(!a)])})},[a]),pt.useEffect(()=>{let L=p.current;if(!L)return;L.dispatch({effects:k.current.reconfigure(xz(o,c.current))})},[o]),zi.jsxDEV("div",{ref:d,...E(dl.source),"data-editor":"codemirror6"},void 0,!1,void 0,this)}var pw={write:"Show Markdown",markdown:"Show the writing"};function Ez(e){let{value:n,mode:o,onChange:r,onModeChange:l,onSelectionChange:a,readOnly:c=!1}=e,d=o==="write"?"markdown":"write",p=n.trim()?n.trim().split(/\s+/).length:0,[m,g]=pt.useState(null),[,b]=pt.useState(0),k=pt.useRef(null),S=!c,[C,A]=pt.useState(!1),[D,T]=pt.useState(!1),I=e.links;pt.useEffect(()=>{let L=k.current;if(!L||!I)return;let P=()=>T(!0),Q=(F)=>{let we=F instanceof CustomEvent?F.detail:void 0,J=zn(we)?we.target:void 0;if(typeof J==="string"&&J)I.open(J)};return L.addEventListener(E0,P),L.addEventListener(Op,Q),()=>{L.removeEventListener(E0,P),L.removeEventListener(Op,Q)}},[I]);let[H,_]=pt.useState(null);return pt.useEffect(()=>{let L=k.current;if(!L||!e.images)return;let P=()=>A(!0);return L.addEventListener(C0,P),()=>L.removeEventListener(C0,P)},[e.images]),zi.jsxDEV("div",{ref:k,...E(dl.root),"data-body-mode":o,onKeyDown:(L)=>{if(L.key==="/"&&(L.metaKey||L.ctrlKey)&&!L.altKey&&!L.shiftKey)L.preventDefault(),l(d)},children:[zi.jsxDEV("header",{...E(dl.toolbar),children:[S&&zi.jsxDEV(cz,{view:m,writing:m?.hasFocus??!1},void 0,!1,void 0,this),H&&zi.jsxDEV("span",{...E(dl.imageStatus),role:"status",children:H},void 0,!1,void 0,this),zi.jsxDEV("span",{...E(dl.metadata),children:[p.toLocaleString()," ",p===1?"word":"words"]},void 0,!0,void 0,this),zi.jsxDEV("button",{type:"button",...E(dl.markdownToggle),"aria-pressed":o==="markdown","aria-label":"Markdown","aria-keyshortcuts":"Control+/ Meta+/",title:`${pw[o]} (⌘/)`,"data-markdown-toggle":"",onClick:()=>l(d),children:"M↓"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S&&o==="write"&&zi.jsxDEV(dz,{view:m,host:k},void 0,!1,void 0,this),zi.jsxDEV("div",{...E(dl.panes),children:c&&o==="write"?zi.jsxDEV("div",{...E(dl.preview),"data-studio-preview":"",tabIndex:0,role:"region","aria-label":"Rendered document",children:zi.jsxDEV(Cz,{presentation:"document",documentTitle:e.documentTitle,children:n},void 0,!1,void 0,this)},void 0,!1,void 0,this):zi.jsxDEV(qP,{value:n,live:o==="write",loadImage:e.loadImage,uploadImage:e.images?.upload,onImageFailure:_,onView:g,onActivity:()=>b((L)=>L+1),onChange:r,onSelectionChange:(L)=>a?.(L?{...L,text:n.slice(L.from,L.to)}:null),readOnly:c},void 0,!1,void 0,this)},void 0,!1,void 0,this),S&&I&&D&&m&&zi.jsxDEV(rz,{view:m,host:k,findEntries:I.findEntries,onClose:()=>T(!1)},void 0,!1,void 0,this),S&&e.images&&zi.jsxDEV(fz,{open:C,onOpenChange:A,source:e.images,onChoose:(L)=>{if(!m)return;_(null),m.dispatch(dw(m.state,L)),m.focus()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Cl="grouping-definitions",Qu=20,UP=Ii.strictObject({label:O0.shape.label,excludeTypes:Ii.array(O0.shape.types.element).max(100).refine((e)=>new Set(e).size===e.length,"Excluded types must be unique.").optional(),multiple:Ii.boolean(),values:Ii.array(Ii.string().min(1)).min(1).superRefine((e,n)=>{let o=new Set;e.forEach((r,l)=>{if(o.has(r))n.addIssue({code:"custom",path:[l],message:"Values must be unique (matching is exact)."});o.add(r)})}).optional()}),Tz=Ii.object({groupings:Ii.record(O0.shape.key,UP).refine((e)=>Object.keys(e).length<=Qu,`Define at most ${Qu} groupings.`).default({})});var Fu=G(Xe(),1);var zp=G(fe(),1);function jd(e,n){return n==="split"?e.fields.find((o)=>o.name==="title"&&o.widget==="string"):void 0}function Mz(e){let n=Fu.useId(),o=Dz(),r=Fu.useRef(null),l=Fu.useRef(null),a=e.issues?.find((c)=>c.path[0]===e.descriptor.name);return Fu.useEffect(()=>{let c=r.current;if(!a||!c||c!==c.closest("form")?.querySelector("[data-studio-invalid-field]"))return;l.current?.focus()},[a,e.issues]),zp.jsxDEV("span",{ref:r,...a&&{"data-studio-invalid-field":""},children:[zp.jsxDEV("span",{"data-value":e.value,...E(jn.titleGrow),children:zp.jsxDEV("textarea",{ref:l,rows:1,name:e.descriptor.name,"aria-label":e.descriptor.label,value:e.value,required:e.descriptor.required!==!1,placeholder:e.placeholder,"aria-invalid":a?!0:void 0,"aria-describedby":a?n:void 0,onKeyDown:(c)=>{if(c.key==="Enter")c.preventDefault()},onChange:(c)=>e.onChange(c.currentTarget.value.replace(/\r?\n/g," ")),...E(jn.titleInput)},void 0,!1,void 0,this)},void 0,!1,void 0,this),a&&zp.jsxDEV("span",{id:n,...E(jn.titleIssue),children:[o==="save"&&"Last save: ",a.message]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var L0="studio-save-reason";function B0(e,n,o){if(!mw(e,n,o))return;let r=n.fieldIssues?.some((l)=>l.path[0]!=="segment"&&l.path[0]!=="prefix");if(Ip(e)||r)return"Fix the highlighted fields first.";if(n.destinationBlocked&&e.mode.kind==="create")return n.presentation&&jd(n.entitySchema,n.presentation)?"Give this entry a title to create it.":"Name the file to create this entry.";return}function mw(e,n,o){let r=n.selectedEntityType===Cl,l=r||e.mode.kind==="create"&&n.entitySchema.isSingleton;return!n.canEdit||Ip(e)||r&&!n.entitySchema.groupingDefinitions||n.destinationBlocked||e.save.kind==="saving"||l&&!o}var Vd=G(Xe(),1);var so={root:{keoZOQ:"x1sgpng",kmVPX3:"x6w2896",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"x8tuc8h",kZ1KPB:"x1vo0akb",k4WBpm:"x19ypqd9",kaZRDh:"x1yn89ol",kaIpWk:"xu4hgxq",kWkggS:"x18s3upu",$$css:!0},head:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kjj79g:"x1qughib",kOIVth:"x883omv",kMwMTN:"x1ar3pfp",$$css:!0},state:{kMwMTN:"xgi1xjn",k63SB2:"x1pd3egz",$$css:!0},copy:{kogj98:"x108lf0y",kMwMTN:"x1ar3pfp",kGuDYH:"x1j6dyjg",kLWn49:"xfrs9s4",kHjlTd:"xj0a0fe",$$css:!0},actions:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"x1j9xkj6",keoZOQ:"xk9mzb7",$$css:!0},button:{kAzted:"x1rz828m x1c4ya5t",kmVPX3:"x1jmcyos",kGuDYH:"x1k6wstc",$$css:!0},publish:{kVAM5u:"xawfzfr",kWkggS:"x15vqgvx",kMwMTN:"x1um1dla",$$css:!0},complete:{kMwMTN:"x19k5i5u",kMv6JI:"xa9opjo",$$css:!0},confirmation:{kmVPX3:"x12s40zk",kZ1KPB:"x19sr0n1",k4WBpm:"x19ypqd9",kaZRDh:"xzxeg27",kWkggS:"xc1c755",kVVagm:"x1t8o5tu",$$css:!0}};var ii=G(fe(),1);function gw(e){return"success"in e&&e.success===!1}function yw(e){return"needsConfirmation"in e&&e.needsConfirmation===!0}function PP(e){return ii.jsxDEV(Nn,{mark:"↑",title:`Publish ${e.title} now?`,titleId:"publish-confirm-title",cancelLabel:"Review again",confirmLabel:e.confirming?"Publishing…":"Confirm publication",pending:e.confirming,confirmVariant:"primary",onCancel:e.onCancel,onConfirm:e.onConfirm,children:[ii.jsxDEV("p",{children:e.preview},void 0,!1,void 0,this),ii.jsxDEV("p",{...E(so.confirmation),children:"This sends the current saved version to an external public provider."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Rz(e){let[n,o]=Vd.useState(null),[r,l]=Vd.useState(null),[a,c]=Vd.useState(null),d={entityType:e.entityType,entityId:e.entityId},p=e.unsaved||n!==null,m=e.status==="draft"?e.missing??[]:[],g=m.length>0,b=Vd.useCallback(async(C,A)=>{o(A),l(null);try{let D=await e.onAction(C);if(gw(D))throw Error(D.error);if(yw(D))c({args:D.args,preview:D.preview??`This will publish ${e.entityType}:${e.entityId} publicly.`});else if(C.type==="publish")c(null)}catch(D){l(Ln(D))}finally{o(null)}},[e]),k=e.status==="queued"?{type:"remove",...d}:e.status==="failed"?{type:"retry",...d}:{type:"queue",...d},S=e.status==="queued"?"Remove from queue":e.status==="failed"?"Retry":"Add to queue";return ii.jsxDEV("section",{...E(so.root),"aria-label":"Publication actions",children:[ii.jsxDEV("header",{...E(so.head,lo.eyebrow),children:[ii.jsxDEV("span",{children:"Publication"},void 0,!1,void 0,this),ii.jsxDEV("b",{...E(so.state,N0(e.status==="queued"?"warn":e.status==="failed"?"error":e.status==="published"?"good":void 0)),children:e.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ii.jsxDEV("p",{...E(so.copy),children:"Operates on the saved entity. Publication state is separate from the save pipeline below."},void 0,!1,void 0,this),e.unsaved&&ii.jsxDEV("p",{...E(so.copy,N0("warn")),children:"Save changes before changing publication state."},void 0,!1,void 0,this),g&&ii.jsxDEV("p",{...E(so.copy,N0("warn")),children:_P(m)},void 0,!1,void 0,this),e.status!=="published"&&ii.jsxDEV("div",{...E(so.actions),children:[ii.jsxDEV(xe,{type:"button",variant:"ghost",xstyle:so.button,disabled:p||g,onClick:()=>void b(k,"lifecycle"),children:n==="lifecycle"?"Working…":S},void 0,!1,void 0,this),ii.jsxDEV(xe,{type:"button",xstyle:[so.button,so.publish],disabled:p||g,onClick:()=>void b({type:"publish",...d},"publish"),children:n==="publish"?"Preparing…":"Publish now"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.status==="published"&&ii.jsxDEV("p",{...E(so.copy,so.complete),children:"Published externally."},void 0,!1,void 0,this),r&&ii.jsxDEV(me,{tone:"error",children:r},void 0,!1,void 0,this),a&&ii.jsxDEV(PP,{title:e.title,preview:a.preview,confirming:n==="confirm",onCancel:()=>c(null),onConfirm:()=>void b({type:"publish",...d,confirmation:a.args},"confirm")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function _P(e){return`Add ${e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)??""}`} before publishing.`}var z0=G(Xe(),1);var Ho=G(fe(),1);function Oz(e){e.querySelector("details[data-studio-properties]")?.setAttribute("open","")}function Lz({presentation:e,children:n}){return e==="split"?Ho.jsxDEV(Ho.Fragment,{children:n},void 0,!1,void 0,this):Ho.jsxDEV("div",{"data-studio-editor-content":"",role:"region","aria-label":"Record contents",tabIndex:0,...E(rn.content),children:n},void 0,!1,void 0,this)}function Bz({presentation:e,reveal:n,children:o,summaryDescription:r,hidden:l=!1,sheet:a=!1,onCloseSheet:c}){let d=z0.useRef(null);if(z0.useLayoutEffect(()=>{if(n&&d.current)d.current.open=!0},[n]),e==="document")return Ho.jsxDEV("details",{ref:d,"data-studio-properties":"",...E(rn.disclosure),children:[Ho.jsxDEV("summary",{...E(rn.summary),children:["Properties",r&&Ho.jsxDEV("span",{...E(rn.summaryDescription),children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ho.jsxDEV("div",{...E(rn.disclosedFields),children:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Ho.jsxDEV("aside",{"data-studio-properties":"",...E(Qn.colophon,e==="form"&&Qn.fullWidthProperties,e==="form"&&rn.properties,l&&Qn.colophonHidden,a&&Qn.detailsSheet),"aria-label":a?"Details":void 0,"data-studio-details-sheet":a?"":void 0,"data-studio-sheet":a?"":void 0,children:[a&&c&&Ho.jsxDEV("header",{...E(rn.sheetHead),children:[Ho.jsxDEV("h2",{...E(rn.sheetTitle),children:"Details"},void 0,!1,void 0,this),Ho.jsxDEV("button",{type:"button",...E(rn.sheetDone),onClick:c,children:"Done"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),o]},void 0,!0,void 0,this)}var $p=G(Xe(),1);var oi=G(Xe(),1);function I0(e,n=[]){if(e!==void 0&&!zn(e))return{rows:[],nextId:0,malformed:{value:e}};let o=Object.entries(e??{}).map(([r,l],a)=>({id:a,key:r,value:l,...n.includes(r)?{savedKey:r}:{}}));return{rows:o,nextId:o.length}}function Nz(e){return{...e,rows:[...e.rows,{id:e.nextId,key:"",value:{label:"",multiple:!0}}],nextId:e.nextId+1}}function zz(e,n,o){return{...e,rows:e.rows.map((r)=>{if(r.id!==n)return r;if(r.savedKey!==void 0&&o.key!==void 0&&o.key!==r.savedKey)throw Error("Saved grouping keys cannot be renamed.");return{...r,...o}})}}function Iz(e,n){return{...e,rows:e.rows.filter((o)=>o.id!==n)}}function bw(e){if(e.malformed)return{value:void 0,issues:[{path:["groupings"],message:"Groupings must be a mapping. Repair the source or explicitly replace it."}],pendingChanges:!1};let n=e.rows.filter((a,c)=>e.rows.some((d,p)=>p<c&&d.key===a.key));if(n.length)return{value:void 0,issues:n.map((a)=>({path:["groupings",a.key],message:`The key “${a.key}” is already used. Choose a different key.`})),pendingChanges:!0};let o=Object.fromEntries(e.rows.map((a)=>[a.key,a.value])),r=Tz.safeParse({groupings:o}),l=r.success?[]:r.error.issues.map((a)=>({path:a.path.map((c)=>typeof c==="symbol"?String(c):c),message:a.message}));return{value:o,issues:l,pendingChanges:!1}}var en={intro:{kMwMTN:"xgi1xjn",kGuDYH:"x4z9k3i",kLWn49:"x1dbl2gt",k1K539:"x1hq5gj4",ks0D6T:"x70i6om",$$css:!0},help:{kMwMTN:"xgi1xjn",$$css:!0},grid:{k1xSpc:"xrvj5dj",kumcoG:"xnby9oq x4jmfmw",kOIVth:"xhp1hw2",kqGvvJ:"x1mibpdg",k7Eaqz:"xeuugli",$$css:!0},choices:{kmVPX3:"x1717udv",kogj98:"x1ghz6dp",kMzoRj:"xc342km",k7Eaqz:"xeuugli",$$css:!0},choice:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x883omv",kAzted:"xu0aao5 x1c4ya5t",kHjlTd:"xj0a0fe",$$css:!0},readOnly:{k1xSpc:"x1lliihq",kmVPX3:"x1160tuk",kMzoRj:"xmkeg23",ksu8eU:"xbsl7fq",kVAM5u:"x8tuc8h",kaIpWk:"x1kogg8i",kWkggS:"xbslqsl",kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kHjlTd:"xj0a0fe",$$css:!0},first:{k8WAf4:"x10bfh3y",ks0D6T:"xe0576n",$$css:!0},actions:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kjj79g:"x1qughib",kOIVth:"xou54vl",keoZOQ:"xhrpt6u",$$css:!0},exclusions:{k1K539:"xod5an3",$$css:!0},exclusionsSummary:{k1xSpc:"xtcx8v3",kpqbRz:"x1cy9i3i",kkrTdU:"x1ypdohk",kAzted:"x1gg8mnh",k8WAf4:"x10dr8xq",$$css:!0},rule:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"xfe5i6u",k1K539:"xod5an3",$$css:!0}};var Me=G(fe(),1);function Hp(e,n,o){let r={...e,[n]:o};if(n==="excludeTypes"&&Array.isArray(o)&&o.length===0)delete r[n];return r}function $z(e){let{row:n,readOnly:o}=e,r=zn(n.value)?n.value:void 0,l=n.savedKey!==void 0,a=typeof r?.label==="string"&&r.label.length>0?r.label:l?n.key:"New grouping",c=(d)=>e.onUpdate({value:d});return Me.jsxDEV("section",{...E(La.section),"aria-label":a,"data-definition-row":n.id,children:[Me.jsxDEV("div",{...E(La.head),children:[Me.jsxDEV("h2",{...E(La.title),children:a},void 0,!1,void 0,this),!o&&Me.jsxDEV(xe,{type:"button",variant:"ghost","aria-label":`Remove ${a} grouping`,onClick:(d)=>e.onRemove(d.currentTarget),children:"Remove grouping"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.issues.length>0&&Me.jsxDEV(me,{tone:"error",children:e.issues.map((d)=>d.message).join(" · ")},void 0,!1,void 0,this),!r?Me.jsxDEV(Me.Fragment,{children:[Me.jsxDEV(me,{tone:"error",children:"This definition is not a mapping. Repair its source or explicitly remove the definition."},void 0,!1,void 0,this),Me.jsxDEV("pre",{...E(en.readOnly),children:JSON.stringify(n.value,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Me.jsxDEV(Me.Fragment,{children:[Me.jsxDEV(jP,{entry:r,label:a,rowKey:n.key,saved:l,readOnly:o,onChange:c,onKeyChange:(d)=>e.onUpdate({key:d})},void 0,!1,void 0,this),Me.jsxDEV(VP,{entry:r,contributorTypes:e.contributorTypes,systemTypes:e.systemTypes,readOnly:o,onChange:c},void 0,!1,void 0,this),Me.jsxDEV(GP,{entry:r,label:a,name:e.allowedValuesName,usage:e.usage,readOnly:o,onChange:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function jP(e){let{entry:n,label:o,saved:r,readOnly:l}=e,a=n.multiple;return Me.jsxDEV("div",{...E(en.grid),children:[Me.jsxDEV("label",{...E(Kt.field),children:[Me.jsxDEV("span",{...E(Kt.label),children:"Label"},void 0,!1,void 0,this),l?Me.jsxDEV("span",{...E(en.readOnly),children:o},void 0,!1,void 0,this):Me.jsxDEV(Eu,{"aria-label":`${o} label`,value:typeof n.label==="string"?n.label:"",onChange:(c)=>e.onChange(Hp(n,"label",c.currentTarget.value)),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Me.jsxDEV("label",{...E(Kt.field),children:[Me.jsxDEV("span",{...E(Kt.label),children:"Key"},void 0,!1,void 0,this),l?Me.jsxDEV("code",{...E(en.readOnly),children:e.rowKey},void 0,!1,void 0,this):Me.jsxDEV(Eu,{"aria-label":`${o} key`,value:e.rowKey,readOnly:r,xstyle:r?Kt.readOnly:void 0,required:!0,onChange:(c)=>{if(!r)e.onKeyChange(c.currentTarget.value)}},void 0,!1,void 0,this),Me.jsxDEV("span",{...E(Kt.listHelp,en.help),children:r?"Fixed after creation":"Lowercase letters, digits and hyphens. Fixed when saved."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Me.jsxDEV("label",{...E(Kt.field),children:[Me.jsxDEV("span",{...E(Kt.label),children:"Values per entry"},void 0,!1,void 0,this),l?Me.jsxDEV("span",{...E(en.readOnly),children:a===!0?"Several":a===!1?"One":"Invalid cardinality"},void 0,!1,void 0,this):Me.jsxDEV(wu,{"aria-label":`${o} values per entry`,value:a===!0?"several":a===!1?"one":"",onChange:(c)=>e.onChange(Hp(n,"multiple",c.currentTarget.value==="several")),required:!0,children:[Me.jsxDEV("option",{value:"",disabled:!0,children:"Choose cardinality"},void 0,!1,void 0,this),Me.jsxDEV("option",{value:"one",children:"One"},void 0,!1,void 0,this),Me.jsxDEV("option",{value:"several",children:"Several"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function VP(e){let{entry:n,contributorTypes:o}=e,r=Array.isArray(n.excludeTypes)?n.excludeTypes.filter((c)=>typeof c==="string"):[],l=r.filter((c)=>!e.systemTypes.includes(c)),a=new Set(o.map((c)=>c.entityType));return Me.jsxDEV("details",{...E(en.exclusions),children:[Me.jsxDEV("summary",{...E(Kt.label,en.exclusionsSummary),children:["Exclude types",l.length>0?` (${l.length})`:""]},void 0,!0,void 0,this),Me.jsxDEV("p",{...E(Kt.listHelp,en.help),children:"Content types participate unless excluded. System types never participate."},void 0,!1,void 0,this),e.readOnly?Me.jsxDEV("span",{...E(en.readOnly),children:l.map((c)=>o.find((d)=>d.entityType===c)?.label??`${c} (unavailable)`).join(", ")||"None"},void 0,!1,void 0,this):Me.jsxDEV("fieldset",{...E(en.choices),children:[Me.jsxDEV("legend",{...E(Kt.label),children:"Excluded content types"},void 0,!1,void 0,this),[...o,...l.filter((c)=>!a.has(c)).map((c)=>({entityType:c,label:`${c} (unavailable)`}))].map((c)=>Me.jsxDEV("label",{...E(en.choice),children:[Me.jsxDEV("input",{type:"checkbox","aria-label":`Exclude ${c.label}`,...E(La.checkbox),checked:r.includes(c.entityType),onChange:(d)=>e.onChange(Hp(n,"excludeTypes",d.currentTarget.checked?[...r,c.entityType]:r.filter((p)=>p!==c.entityType)))},void 0,!1,void 0,this),c.label]},c.entityType,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function GP(e){let{entry:n,label:o,usage:r}=e,l=Object.hasOwn(n,"values"),a=r?new Map(r.values.map((c)=>[c.value,c.count])):void 0;return Me.jsxDEV(Me.Fragment,{children:[Me.jsxDEV("fieldset",{...E(en.choices,en.rule),children:[Me.jsxDEV("legend",{...E(Kt.label),children:"Allowed values"},void 0,!1,void 0,this),e.readOnly?Me.jsxDEV("span",{...E(en.readOnly),children:l?"Only these values":"Any value"},void 0,!1,void 0,this):Me.jsxDEV(Me.Fragment,{children:[!1,!0].map((c)=>Me.jsxDEV("label",{...E(en.choice),children:[Me.jsxDEV("input",{type:"radio",name:e.name,"aria-label":`${o}: ${c?"only these values":"any value"}`,checked:l===c,...E(La.checkbox),onChange:()=>e.onChange(c?Hp(n,"values",[]):Object.fromEntries(Object.entries(n).filter(([d])=>d!=="values")))},void 0,!1,void 0,this),c?"Only these values":"Any value"]},String(c),!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l&&Me.jsxDEV(Me.Fragment,{children:[Me.jsxDEV(Hz,{label:`${o} allowed values`,purpose:"allowed-values",definition:{multiple:!0},value:n.values,onChange:(c)=>e.onChange(Hp(n,"values",c)),readOnly:e.readOnly,counts:a},void 0,!1,void 0,this),Me.jsxDEV("p",{...E(Kt.listHelp,en.help),children:Array.isArray(n.values)&&n.values.length===0?"Add at least one allowed value, or choose Any value.":r?"Numbers show current usage. Unused values remain available.":"Usage is unavailable until this grouping can be read."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Qt=G(fe(),1);function qz(e,n){return e&&Object.hasOwn(e,n)?e[n]:void 0}function Uz(e){let[n,o]=oi.useState(()=>I0(e.value,e.savedKeys)),[r,l]=oi.useState(null),a=oi.useRef(null),c=oi.useRef(void 0),d=oi.useRef(null),p=oi.useId(),m=oi.useId(),g=JSON.stringify(e.value),b=JSON.stringify(e.savedKeys),k=oi.useRef(g),S=oi.useRef(b),C=oi.useRef(void 0),A=bw(n);oi.useEffect(()=>{if(g===k.current&&b===S.current)return;k.current=g,S.current=b,o(I0(e.value,e.savedKeys)),l(null)},[g,e.value,b,e.savedKeys]),oi.useEffect(()=>{let _={issues:A.issues,pendingChanges:A.pendingChanges},L=JSON.stringify(_);if(C.current===L)return;C.current=L,e.onStateChange(_)}),oi.useEffect(()=>{if(c.current!==void 0)a.current?.querySelector(`[data-definition-row="${c.current}"] input`)?.focus(),c.current=void 0;if(r===null&&d.current)(d.current.isConnected?d.current:a.current?.querySelector("[data-definition-add]"))?.focus(),d.current=null},[n,r]);let D=(_,L)=>{L.focus(),d.current=L,l(_)},T=(_)=>{if(e.readOnly)return;o(_);let L=bw(_);if(L.value!==void 0)k.current=JSON.stringify(L.value),e.onChange(L.value);let P={issues:L.issues,pendingChanges:L.pendingChanges};C.current=JSON.stringify(P),e.onStateChange(P)},I=n.rows.find((_)=>_.id===r),H=[...A.issues,...e.issues??[]];return Qt.jsxDEV("div",{ref:a,role:"group","aria-label":"Grouping definitions","aria-describedby":H.length?m:void 0,children:[Qt.jsxDEV("p",{...E(en.intro),children:"Groups collect entries by exact frontmatter values. Removing a grouping or a listed value never rewrites entries. Values outside a list stay visible until an editor changes them."},void 0,!1,void 0,this),e.readOnly&&Qt.jsxDEV(me,{children:"You can use these groupings. Only administrators can change their definitions."},void 0,!1,void 0,this),n.malformed?Qt.jsxDEV(Qt.Fragment,{children:[Qt.jsxDEV(me,{tone:"error",children:"The stored groupings are not a mapping. Their source has not been discarded."},void 0,!1,void 0,this),Qt.jsxDEV("pre",{...E(en.readOnly),children:JSON.stringify(n.malformed.value,null,2)},void 0,!1,void 0,this),!e.readOnly&&Qt.jsxDEV(xe,{type:"button",variant:"outline",onClick:(_)=>D("reset",_.currentTarget),children:"Replace invalid definitions"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Qt.jsxDEV(Qt.Fragment,{children:[n.rows.length===0&&Qt.jsxDEV("section",{...E(en.first),children:[Qt.jsxDEV("h2",{...E(La.title),children:"Your first grouping"},void 0,!1,void 0,this),Qt.jsxDEV("p",{...E(en.intro),children:"Bring related entries together, of any content type, without moving them. Give a grouping a label and say whether an entry belongs to one value or several."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n.rows.map((_)=>Qt.jsxDEV($z,{row:_,usage:qz(e.usage,_.key),contributorTypes:e.contributorTypes,systemTypes:e.systemTypes,readOnly:e.readOnly,issues:H.filter((L)=>L.path[1]===_.key),allowedValuesName:`${p}-${_.id}-allowed`,onUpdate:(L)=>T(zz(n,_.id,L)),onRemove:(L)=>D(_.id,L)},_.id,!1,void 0,this)),!e.readOnly&&Qt.jsxDEV("div",{...E(en.actions),children:[Qt.jsxDEV(xe,{type:"button",variant:"outline","data-definition-add":"",disabled:n.rows.length>=Qu,onClick:()=>{c.current=n.nextId,T(Nz(n))},children:"Add grouping"},void 0,!1,void 0,this),Qt.jsxDEV("span",{...E(Kt.kind),children:[n.rows.length," / ",Qu]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.length>0&&Qt.jsxDEV("div",{id:m,children:Qt.jsxDEV(me,{tone:"error",children:["Cannot save:"," ",H.map((_)=>{let L=_.path.slice(1).join(".");return L?`${L}: ${_.message}`:_.message}).join(" · ")]},void 0,!0,void 0,this)},void 0,!1,void 0,this),r!==null&&!e.readOnly&&Qt.jsxDEV(WP,{target:r,row:I,usage:I?qz(e.usage,I.key):void 0,titleId:p,onCancel:()=>l(null),onConfirm:()=>{T(r==="reset"?I0({}):Iz(n,r)),l(null)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function WP(e){let{row:n,usage:o}=e,r=e.target==="reset",l=n&&zn(n.value)&&typeof n.value.label==="string"?n.value.label:n?.key;return Qt.jsxDEV(Nn,{mark:"−",title:r?"Replace invalid definitions?":`Remove ${l?.length?l:"unsaved"} grouping?`,titleId:e.titleId,cancelLabel:r?"Keep definitions":"Keep grouping",confirmLabel:r?"Replace definitions":"Remove grouping",confirmVariant:"danger",onCancel:e.onCancel,onConfirm:e.onConfirm,children:[Qt.jsxDEV("p",{children:[r?"This replaces the invalid definitions with an empty document when you save. ":o?o.entries===1?"1 entry carries this grouping and keeps its values. ":`${o.entries} entries carry this grouping and keep their values. `:"Usage is unavailable. Existing entries keep their values. ","No entries are deleted or moved. The change takes effect after saving."]},void 0,!0,void 0,this),!r&&Qt.jsxDEV("p",{children:"Re-adding the same key can collect those values again."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Al=G(fe(),1);function _z(e){let{editor:n,schema:o,dispatch:r}=e,l=n.draft.groupings,a=n.mode.kind==="edit"?n.mode.entity.frontmatter.groupings:void 0,c=zn(a)?Object.keys(a):[],d=o.issues.filter((T)=>{let I=T.path[1];if(typeof I==="string"&&zn(l)&&zn(a))return Object.hasOwn(l,I)&&JSON.stringify(l[I])===JSON.stringify(a[I]);return JSON.stringify(l)===JSON.stringify(a)}),p=d.length>0;$p.useEffect(()=>{r({type:"compoundFieldStateChanged",field:"grouping-source",invalid:p,pendingChanges:!1})},[r,p]);let m=Nt(),g=$p.useMemo(()=>(zn(a)?Object.keys(a):[]).filter((T)=>Pz.safeParse(T).success&&zn(l)&&Object.hasOwn(l,T)).slice(0,Qu).map((T)=>{let I=zn(l)&&zn(l[T])?l[T]:void 0,H=Array.isArray(I?.values)?I.values.filter((_)=>typeof _==="string"):[];return{key:T,values:H}}),[l,a]),b=$p.useMemo(()=>g.map(({key:T,values:I})=>H2(m,T,I)),[m,g]),k=H0({queries:b}),S=Object.fromEntries(g.flatMap(({key:T},I)=>{let H=k[I];return H?.isSuccess&&!H.isFetching?[[T,H.data]]:[]})),C=k.some((T)=>T.isFetching),A=k.some((T)=>ad(T.failureReason)),D=k.filter((T)=>T.isError&&!T.isFetching);return Al.jsxDEV(Al.Fragment,{children:[C&&Al.jsxDEV(me,{children:Al.jsxDEV("span",{role:"status",children:A?"Groupings are initializing. Usage will load when ready.":"Loading grouping usage…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),D.length>0&&Al.jsxDEV(me,{tone:"error",children:["Some grouping usage is unavailable. Counts are not assumed to be zero."," ",Al.jsxDEV(xe,{type:"button",variant:"outline",size:"sm",onClick:()=>{for(let T of D)T.refetch()},children:"Retry usage"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Al.jsxDEV(Uz,{value:l,savedKeys:c,contributorTypes:o.contributorTypes,systemTypes:o.systemTypes,readOnly:e.readOnly,usage:S,issues:d,onChange:(T)=>r({type:"fieldChanged",descriptor:{name:"groupings",label:"Groupings",widget:"object"},raw:T}),onStateChange:(T)=>r({type:"compoundFieldStateChanged",field:"groupings",pendingChanges:T.pendingChanges,invalid:T.issues.length>0})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var mr=G(Xe(),1);var Le=G(fe(),1),QP=new Set(["preferredTerms","preferred","avoid"]),FP=new Set(["description","purpose","positioning","summary","artDirection","composition"]);function YP(e){return e.widget==="string"&&FP.has(e.name)?{...e,widget:"text"}:e}function Kz(e){let n=xw(),o=Gz(),r=e.fields.filter((p)=>o(p,e.draft[p.name])&&Wd(p,e.draft)&&(!e.readOnly||e.draft[p.name]!==void 0||p.required!==!1));if(r.length===0)return null;if(e.readOnly&&!n)return Le.jsxDEV("div",{"data-studio-system-fields":"",...E(Ze.root),children:[e.title&&Le.jsxDEV("h2",{...E(Ze.heading),children:e.title},void 0,!1,void 0,this),Le.jsxDEV("dl",{...E(Ze.profile),children:r.map((p)=>Le.jsxDEV("div",{...E(Ze.row),children:[Le.jsxDEV("dt",{...E(Ze.term),children:p.label},void 0,!1,void 0,this),Le.jsxDEV("dd",{...E(Ze.value),children:Le.jsxDEV(Sw,{vocabulary:e.vocabularies?.[p.name],literalStrings:e.literalFields?.includes(p.name),value:e.draft[p.name],fields:p.fields},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},p.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let l=r.filter((p)=>p.widget==="object"&&p.fields?.length),a=r.filter((p)=>!l.includes(p)&&p.name!=="visibility"),c=r.filter((p)=>p.name==="visibility"),d=(p)=>Le.jsxDEV(Gd,{segment:p.name,children:Le.jsxDEV(q0,{vocabulary:e.vocabularies?.[p.name],literalList:e.literalFields?.includes(p.name),suggestions:e.suggestions?.[p.name],descriptor:p,value:e.draft[p.name],issues:e.issues,onChange:(m)=>e.onChange(p,m),children:!n&&e.renderAssist?.(p)},void 0,!1,void 0,this)},p.name,!1,void 0,this);return Le.jsxDEV("div",{"data-studio-system-fields":"",...E(Ze.root),children:[a.length>0&&Le.jsxDEV(Le.Fragment,{children:[e.title&&Le.jsxDEV("h2",{...E(Ze.heading),children:e.title},void 0,!1,void 0,this),Le.jsxDEV("div",{"data-studio-system-grid":"",...E(Ze.grid),children:a.map(d)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.map(d),c.length>0&&Le.jsxDEV("section",{...E(Ze.section),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:"Access"},void 0,!1,void 0,this),Le.jsxDEV("div",{"data-studio-system-grid":"",...E(Ze.grid),children:c.map(d)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function q0(e){if(Vz(e.descriptor,e.value)?.kind==="none")return null;let o=YP(e.descriptor);if(o.widget==="object"&&o.fields?.length)return Le.jsxDEV(KP,{...e},void 0,!1,void 0,this);if(o.widget==="list"&&(o.fields?.length||o.field?.widget==="variant"))return Le.jsxDEV(XP,{...e},void 0,!1,void 0,this);if(o.widget==="grid")return Le.jsxDEV("div",{role:"group","aria-label":o.label,...E(Ze.section,Ze.wide),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:o.label},void 0,!1,void 0,this),Le.jsxDEV(Yz,{descriptor:o,value:e.value,onChange:e.onChange,label:!1,renderValue:vw(jz,qp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(o.widget==="map")return Le.jsxDEV("div",{role:"group","aria-label":o.label,...E(Ze.section,Ze.wide),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:o.label},void 0,!1,void 0,this),Le.jsxDEV(Fz,{descriptor:o,value:e.value,onChange:e.onChange,label:!1,renderValue:vw(jz,qp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(o.widget==="variant")return Le.jsxDEV("div",{role:"group","aria-label":o.label,...E(Ze.section,Ze.wide),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:o.label},void 0,!1,void 0,this),Le.jsxDEV(ww,{descriptor:o,value:zn(e.value)?e.value:{},onChange:e.onChange,renderFields:qp},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Le.jsxDEV("div",{...E(Ze.onlyField,(o.widget==="text"||o.widget==="list"&&!QP.has(o.name)||o.widget==="object"||o.widget==="image")&&Ze.wide),"data-studio-field-assist":"",children:[Le.jsxDEV($0,{vocabulary:e.vocabulary,literalList:e.literalList,suggestions:e.suggestions,descriptor:o,value:e.value,issues:e.issues,onChange:e.onChange},void 0,!1,void 0,this),e.children]},void 0,!0,void 0,this)}var jz=(e,n,o)=>Le.jsxDEV(q0,{descriptor:e,value:n,onChange:o},void 0,!1,void 0,this),qp=(e,n,o)=>Le.jsxDEV("div",{"data-studio-system-grid":"",...E(Ze.grid),children:e.filter((r)=>Wd(r,n)).map((r)=>Le.jsxDEV(Gd,{segment:r.name,children:Le.jsxDEV(q0,{descriptor:r,value:n[r.name],onChange:(l)=>o(kw(n,r,l))},void 0,!1,void 0,this)},r.name,!1,void 0,this))},void 0,!1,void 0,this);function XP(e){let n=mr.useMemo(()=>e.issues?.filter((c)=>c.path[0]===e.descriptor.name)??[],[e.issues,e.descriptor.name]),o=mr.useRef(null),r=mr.useId();mr.useEffect(()=>{let c=o.current;if(n.length&&c===c?.closest("form")?.querySelector("[data-studio-invalid-field]"))c?.focus()},[n]);let l=e.descriptor.fields??[],a=e.descriptor.field?.widget==="variant"?e.descriptor.field:void 0;return Le.jsxDEV("div",{ref:o,role:"group","aria-label":e.descriptor.label,tabIndex:-1,"data-studio-invalid-field":n.length?e.descriptor.name:void 0,"aria-describedby":n.length?r:void 0,...E(Ze.section,Ze.wide),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:e.descriptor.label},void 0,!1,void 0,this),n.length>0&&Le.jsxDEV("div",{id:r,children:Le.jsxDEV(me,{tone:"error",children:n.map((c)=>`${c.path.length>1?`${c.path.slice(1).join(".")}: `:""}${c.message}`).join(" · ")},void 0,!1,void 0,this)},void 0,!1,void 0,this),Le.jsxDEV(Qz,{descriptor:e.descriptor,value:e.value,onChange:e.onChange,noun:Xz(e.descriptor.label),label:!1,createItem:a?()=>Wz(a):void 0,renderItemFields:(c,d)=>a?Le.jsxDEV(ww,{descriptor:a,value:c,onChange:d,renderFields:qp},void 0,!1,void 0,this):qp(l,c,d)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function KP(e){let{descriptor:n}=e,o=xw(),r=zn(e.value)?e.value:{},l=n.fields??[],a=mr.useMemo(()=>e.issues?.filter((g)=>g.path[0]===n.name).map((g)=>({...g,path:g.path.slice(1)})),[e.issues,n.name]),c=a?.filter((g)=>g.path.length===0)??[],d=mr.useId(),p=mr.useRef(null);mr.useEffect(()=>{let g=p.current;if(g?.hasAttribute("data-studio-invalid-field")&&g===g.closest("form")?.querySelector("[data-studio-invalid-field]"))g.focus()},[a]);let m=Object.fromEntries(Object.entries(r).filter(([g])=>!l.some((b)=>b.name===g)));return Le.jsxDEV("div",{ref:p,role:"group","aria-label":n.label,tabIndex:-1,"data-studio-invalid-field":c.length?n.name:void 0,"aria-describedby":c.length?d:void 0,...E(Ze.section,Ze.wide),children:[Le.jsxDEV("h2",{...E(Ze.heading),children:n.label},void 0,!1,void 0,this),c.length>0&&Le.jsxDEV("div",{id:d,children:Le.jsxDEV(me,{tone:"error",children:c.map((g)=>g.message).join(" · ")},void 0,!1,void 0,this)},void 0,!1,void 0,this),Le.jsxDEV("div",{"data-studio-system-grid":"",...E(Ze.grid),children:l.filter((g)=>Wd(g,r)).map((g)=>Le.jsxDEV(Gd,{segment:g.name,children:Le.jsxDEV(q0,{descriptor:n.required===!1&&e.value===void 0?{...g,required:!1}:g,value:r[g.name],issues:a,onChange:(b)=>{let k=kw(r,g,b);e.onChange(Object.keys(k).length===0&&n.required===!1?"":k)}},void 0,!1,void 0,this)},g.name,!1,void 0,this))},void 0,!1,void 0,this),!o&&Object.keys(m).length>0&&Le.jsxDEV(Sw,{value:m},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Qd=G(fe(),1);function Jz(e){try{return new Intl.DisplayNames(["en"],{type:"language"}).of(e)??e}catch{return e}}function Aw(e){if(typeof e==="string")return e.trim()===""?[]:[e];if(typeof e==="number")return[String(e)];if(Array.isArray(e))return e.flatMap(Aw);if(typeof e==="object"&&e!==null)return Object.values(e).flatMap(Aw);return[]}function Zz(e){let n=Aw(e.reference.values[e.descriptor.name]);if(n.length===0)return null;let o=Jz(e.reference.language);return Qd.jsxDEV("p",{"data-studio-reference":"",...E(Cw.original,Cw.reference),children:[Qd.jsxDEV("strong",{children:o},void 0,!1,void 0,this)," ",n.map((r,l)=>Qd.jsxDEV("span",{children:[l>0&&Qd.jsxDEV("br",{},void 0,!1,void 0,this),r]},l,!0,void 0,this))]},void 0,!0,void 0,this)}function eI(e){let{language:n,total:o,missing:r}=e.pageTexts,l=Jz(n);return Qd.jsxDEV(me,{tone:r.length===0?"good":void 0,children:r.length===0?`${l}: all ${o} sections have their text.`:`${l}: ${r.length} of ${o} sections have no text yet (${r.join(", ")}). The page appears in ${l} once every section has its text.`},void 0,!1,void 0,this)}var Hi=G(fe(),1);function iI(e){let{editor:n,dispatchEditor:o,fieldAssistState:r}=e,{mode:l,draft:a,body:c}=n,{entitySchema:d,presentation:p,selectedEntityType:m,groupingFields:g,groupingVocabularies:b,systemDesign:k,canEdit:S,canAssist:C,fieldIssues:A}=e.model,D=sd(m,l),T=jd(d,p),I=C&&d.hasBody&&c.trim().length>0,H=(Q)=>I&&!b[Q.name]?.values?Hi.jsxDEV(nI,{descriptor:Q,state:r,onRun:e.runFieldAssist,onApply:e.applyFieldAssist,onDiscard:()=>e.setFieldAssistState({kind:"idle"})},void 0,!1,void 0,this):null,_=(Q,F)=>o({type:"fieldChanged",descriptor:Q,raw:F}),L=m===Cl,P=l.kind==="edit"?l.entity.reference:void 0;return Hi.jsxDEV(tI,{fields:d.fields,draft:a,versions:n.versions,onVersionChange:(Q,F)=>o({type:"versionChanged",language:Q,texts:F}),errors:n.save.kind==="error"?n.save.versions:void 0,children:(Q)=>Hi.jsxDEV("fieldset",{className:ie("",Qn.fields),disabled:!S,children:[k?Hi.jsxDEV(Hi.Fragment,{children:[L&&(d.groupingDefinitions?Hi.jsxDEV(_z,{editor:n,schema:d.groupingDefinitions,readOnly:!S,dispatch:o},void 0,!1,void 0,this):Hi.jsxDEV(me,{tone:"error",children:"Grouping definitions are unavailable. Reload before editing."},void 0,!1,void 0,this)),Hi.jsxDEV(Kz,{vocabularies:b,literalFields:g,suggestions:e.groupingSuggestions,fields:L?d.fields.filter((F)=>F.name!=="groupings"):d.fields,draft:a,title:p==="document"?"":k.fieldsTitle,readOnly:!S,issues:A,onChange:_,renderAssist:Q?void 0:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this):d.fields.filter((F)=>Wd(F,a)).filter((F)=>Q||F!==T).map((F)=>Hi.jsxDEV("div",{"data-studio-field-assist":"",children:[Hi.jsxDEV(Gd,{segment:F.name,children:Hi.jsxDEV($0,{readOnly:!S||F.name==="status"&&e.model.publicationWorkspace!==void 0,vocabulary:b[F.name],literalList:g.includes(F.name),suggestions:e.groupingSuggestions?.[F.name],descriptor:F,issues:A,value:a[F.name],onChange:(we)=>_(F,we)},void 0,!1,void 0,this)},void 0,!1,void 0,this),P&&Hi.jsxDEV(Zz,{descriptor:F,reference:P},void 0,!1,void 0,this),!Q&&H(F)]},`${D}:${F.name}`,!0,void 0,this)),d.format==="raw"&&Hi.jsxDEV(me,{children:"This type is raw markdown — the whole document is the body."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},D,!1,void 0,this)}var oI=G(fe(),1);function U0(e){return oI.jsxDEV(xe,{type:"button",variant:"ghost",xstyle:e.placement==="head"?Fd.toggleHead:Fd.toggleBar,"data-studio-ask-toggle":e.placement,"aria-pressed":e.ask.open,"aria-keyshortcuts":"Control+j Meta+j",title:"Ask about this entry (Ctrl+J or ⌘J)",onClick:()=>e.ask.setOpen(!e.ask.open),children:"Ask"},void 0,!1,void 0,this)}var $i=G(Xe(),1);var Yd={versions:{k1xSpc:"xrvj5dj",kumcoG:"xcjjqqt",kOIVth:"xou54vl",k1JLwA:"x4jmfmw",$$css:!0},version:{kzqmXN:"xh8yej3",k7Eaqz:"xeuugli",kZKoxP:"x1isuwpm",kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kMwMTN:"xqvuw85",kWkggS:"x18s3upu",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"xy1lt07",kmVPX3:"xc7ga6q",$$css:!0},actions:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"x167g77z",keoZOQ:"x14vqqas",$$css:!0}};var Dt=G(fe(),1);function rI(e,n){return JSON.stringify({frontmatter:e,body:n},null,2)}function sI(e){let n=Nt(),[o,r]=$i.useState(!1),[l,a]=$i.useState(null),[c,d]=$i.useState(!1),[p,m]=$i.useState(null),[g,b]=$i.useState(!1),[k,S]=$i.useState(!1),[C,A]=$i.useState(!1),[D,T]=$i.useState(!1),{conflictId:I}=e,H=async(we)=>{if(I===void 0)return;T(!0),m(null);try{await n.resolveConflict(I,we);let J=await n.fetchEntity(e.entity.entityType,e.entity.id);S(!1),A(!1),r(!1),e.onUseLatest(J)}catch(J){S(!1),A(!1),m(Tu(J,"The conflict could not be resolved")||"The conflict could not be resolved")}finally{T(!1)}},_=$i.useRef(0),L=$i.useRef(null);$i.useEffect(()=>()=>{_.current+=1},[]);let P=rI(e.draft,e.body);$i.useEffect(()=>b(!1),[P]);let Q=async()=>{b(!1);try{await navigator.clipboard.writeText(P),b(!0)}catch{m("Copy unavailable. Select Your version manually."),r(!0)}},F=async()=>{let we=++_.current;d(!0),a(null),m(null);try{let J=await n.fetchEntity(e.entity.entityType,e.entity.id);if(_.current===we)a(J)}catch(J){if(_.current===we)m(Tu(J,"Latest version could not be loaded")||"Latest version could not be loaded")}finally{if(_.current===we)d(!1)}};return Dt.jsxDEV(Dt.Fragment,{children:[Dt.jsxDEV("div",{...E(Yd.actions),children:[Dt.jsxDEV("span",{ref:L,children:Dt.jsxDEV(xe,{type:"button",variant:"ghost",onClick:()=>{r(!0),F()},children:"Compare changes"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Dt.jsxDEV(xe,{type:"button",variant:"ghost",onClick:()=>void Q(),children:"Copy my version"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g&&Dt.jsxDEV(me,{children:"Version copied, including properties and body."},void 0,!1,void 0,this),Dt.jsxDEV(Ma,{open:o,onOpenChange:(we)=>{if(r(we),!we)S(!1),_.current+=1,d(!1)},children:Dt.jsxDEV(Ra,{"aria-describedby":"conflict-comparison-description",onCloseAutoFocus:(we)=>{we.preventDefault(),L.current?.querySelector("button")?.focus()},children:[Dt.jsxDEV(Oa,{children:"Compare changes"},void 0,!1,void 0,this),Dt.jsxDEV("p",{id:"conflict-comparison-description",children:"Your draft is unchanged. Review both versions before choosing to replace it."},void 0,!1,void 0,this),I!==void 0&&Dt.jsxDEV("p",{children:"Your version is also kept in the Inbox as a conflict, so it is not lost if you close this page."},void 0,!1,void 0,this),p&&Dt.jsxDEV(me,{tone:"error",children:p},void 0,!1,void 0,this),Dt.jsxDEV("div",{...E(Yd.versions),children:[Dt.jsxDEV("label",{children:["Your version",Dt.jsxDEV("textarea",{...E(Yd.version),readOnly:!0,value:P},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Dt.jsxDEV("label",{children:["Latest saved version",Dt.jsxDEV("textarea",{...E(Yd.version),readOnly:!0,value:l?rI(l.frontmatter,l.body):"Not loaded"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Dt.jsxDEV("div",{...E(Yd.actions),children:[Dt.jsxDEV(xe,{type:"button",variant:"ghost",disabled:c,onClick:()=>void F(),children:c?"Loading latest…":"Retry latest"},void 0,!1,void 0,this),Dt.jsxDEV(xe,{type:"button",variant:"ghost",onClick:()=>r(!1),children:"Keep editing my version"},void 0,!1,void 0,this),I!==void 0&&Dt.jsxDEV(xe,{type:"button",variant:"ghost",disabled:!l||c||D,onClick:()=>A(!0),children:"Save my version"},void 0,!1,void 0,this),Dt.jsxDEV(xe,{type:"button",disabled:!l||c||p!==null,onClick:()=>S(!0),children:"Use latest version"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),k&&l&&Dt.jsxDEV(Nn,{title:"Replace your local draft?",titleId:"replace-conflicted-draft",mark:"↩",cancelLabel:"Keep my draft",confirmLabel:"Replace with latest",onCancel:()=>S(!1),onConfirm:()=>{if(I!==void 0){H("keep-current");return}e.onUseLatest(l),S(!1),r(!1)},children:Dt.jsxDEV("p",{children:"This discards your local edits. Copy your version first if you want to keep it. Nothing is written to the server."},void 0,!1,void 0,this)},void 0,!1,void 0,this),C&&l&&Dt.jsxDEV(Nn,{title:"Save your version over the latest?",titleId:"apply-kept-version",mark:"↑",cancelLabel:"Not now",confirmLabel:"Save over latest",onCancel:()=>A(!1),onConfirm:()=>void H("apply"),children:Dt.jsxDEV("p",{children:"This replaces the latest saved version with the version you tried to save. The latest version's changes are overwritten."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var gr=G(fe(),1);function lI(e){let{editor:n,syncStatus:o,hasUnsavedChanges:r,dispatchEditor:l}=e,{mode:a,draft:c,body:d,save:p}=n,{entitySchema:m,presentation:g,canEdit:b}=e.model,k=b||g==="split"?B0(n,e.model,r):void 0;return gr.jsxDEV("footer",{className:ie("",di.pipeline,Qn.pipeline),"data-studio-save-bar":"",children:[gr.jsxDEV("div",{children:[gr.jsxDEV("span",{"data-studio-save-state":"",className:ie("",Qn.saveState),children:[gr.jsxDEV("span",{role:"status","aria-live":"polite",title:"Saved means stored in this Brain. File export and Git synchronization are separate.",children:!b&&g!=="split"?"Read-only":DR(p,r,a.kind!=="create"?"edit":m.isSingleton?"first-save":"create")},void 0,!1,void 0,this),k&&gr.jsxDEV("span",{id:L0,children:k},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.readError&&gr.jsxDEV(me,{tone:"error",children:["Your draft is unchanged. ",e.readError,gr.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),gr.jsxDEV(TR,{state:o?.directorySync&&p.kind==="saved"&&!p.noop?{kind:"idle"}:p,conflictActions:a.kind==="edit"?gr.jsxDEV(sI,{entity:a.entity,draft:c,body:d,...p.kind==="conflict"&&p.conflictId!==void 0&&{conflictId:p.conflictId},onUseLatest:(S)=>l({type:"documentOpened",document:Xd(S)})},`${a.entity.entityType}:${a.entity.id}`,!1,void 0,this):void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g==="split"&&gr.jsxDEV(xe,{type:"button",variant:"ghost",className:"studio-details-toggle",xstyle:Qn.detailsToggle,"aria-pressed":e.mobilePane==="details",onClick:()=>e.setMobilePane(e.mobilePane==="details"?"write":"details"),children:"Details"},void 0,!1,void 0,this),e.ask&&a.kind==="edit"&&e.model.canAssist&&gr.jsxDEV(U0,{ask:e.ask,placement:"bar"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var _0=G(Xe(),1);function Kd(e){let n=Ew.safeParse(uI(new URLSearchParams(e))),o=n.success?n.data:Ew.parse({});return{...o,offset:Math.floor(o.offset/o.limit)*o.limit}}function ri(e){let n=new URLSearchParams;if(e.prefix)n.set("prefix",JSON.stringify(e.prefix));if(e.scope!=="folder")n.set("scope",e.scope);if(e.offset>0)n.set("offset",String(e.offset));if(e.limit!==aI)n.set("limit",String(e.limit));if(e.q)n.set("q",e.q);if(e.visibility!=="all")n.set("visibility",e.visibility);if(e.status)n.set("status",e.status);if(e.sort!=="updated-desc")n.set("sort",e.sort);let o=n.toString();return o?`?${o}`:""}var Ct={trail:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x883omv",kmVPX3:"x1g8o3q3",kt9PQ7:"xso031l",kfdmCh:"x1q0q8m5",kL6WhQ:"xna4lh4",kMwMTN:"x1ar3pfp",kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",k7Eaqz:"xeuugli",kXHlph:"xw2csxc",khDVqt:"xuxw1ft",kLyoy9:"xz7lfyz",kRugJJ:"x153k8vf",$$css:!0},crumb:{kmuXW:"x2lah0s",kRugJJ:"xxxyo7y",kpC6i:"x1toygy1",kfD2x5:"xtu8bhz",ku5HWf:"xvl04cc",kkLdNC:"x112hdyk",$$css:!0},link:{kMwMTN:"x1heor9g",kybGjl:"x1hl2dhg",kDPRdz:"x18m2ztq",$$css:!0},group:{keoZOQ:"x1sy10c2",k1K539:"xieb3on",$$css:!0},label:{k1xSpc:"x78zum5",kjj79g:"x1qughib",kOIVth:"x1v2ro7d",kMv6JI:"xa9opjo",kGuDYH:"x1k6wstc",kMwMTN:"x1ar3pfp",kmVPX3:"x1jz8oe1",$$css:!0},folder:{kumcoG:"x770nye",kybGjl:"x1hl2dhg",kMwMTN:"xqvuw85",k1JLwA:"x1e5f7iv",$$css:!0},folderTitle:{kMv6JI:"x5ddh9m",kGuDYH:"x1jvydc1",k63SB2:"xk50ysn",k7Eaqz:"xeuugli",kHjlTd:"xj0a0fe",$$css:!0},count:{k1xSpc:"x3nfvp2",kOIVth:"x1v2ro7d",kMv6JI:"xa9opjo",kGuDYH:"x1k6wstc",kMwMTN:"x1ar3pfp",khDVqt:"xuxw1ft",$$css:!0},creationBody:{kBCFzs:"x1osaytk",kbNqZ1:"x7sv70a",k1xSpc:"xrvj5dj",kumcoG:"x4w6khx",k9llMU:"x13b68fn",k7Eaqz:"xeuugli",kAzted:"x2lwn1j",kORKVm:"x1odjw0f",$$css:!0},creationBodySplit:{kbNqZ1:"x7sv70a xj4ozfe",k9llMU:"x13b68fn x1s4lsyz",$$css:!0},destinationFrame:{kBCFzs:"x1osaytk",kbNqZ1:"x1ms6mhf",$$css:!0},destination:{kmVPX3:"x1t7086c",kt9PQ7:"xso031l",kfdmCh:"x1q0q8m5",kL6WhQ:"xna4lh4",k1K539:"xieb3on",$$css:!0},segment:{k1xSpc:"xrvj5dj",kOIVth:"x167g77z",kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",ks0D6T:"x17fpy1y",$$css:!0},input:{kB7OPa:"x9f619",kzqmXN:"xh8yej3",kmVPX3:"x6yrr3s",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"x8tuc8h",kaIpWk:"x12oqio5",kWkggS:"x18s3upu",kMwMTN:"xqvuw85",kMv6JI:"xa9opjo",kGuDYH:"x4z9k3i",$$css:!0},saveAs:{kogj98:"x1uud7ro",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",kMwMTN:"x1ar3pfp",$$css:!0},value:{kMwMTN:"xqvuw85",kMv6JI:"xa9opjo",kHjlTd:"xj0a0fe",khDVqt:"x126k92a",$$css:!0},error:{kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",$$css:!0},context:{k1xSpc:"x1lliihq",kMv6JI:"xa9opjo",kGuDYH:"x1k6wstc",kMwMTN:"x1ar3pfp",keoZOQ:"x1gslohp",$$css:!0}};var at=G(fe(),1);function Up(e){if(!e)return"(empty segment)";return e.replace(/[-_]/g," ").replace(/^\p{L}/u,(n)=>n.toUpperCase())}function Tw(e,n){return`${e.collectionPath}${ri({...e.query,prefix:n,offset:0})}`}function Dw(e,n,o){if(!Mo(e))return;e.preventDefault(),n.onNavigate(o)}function j0(e){let n=e.query.prefix;if(!n)return null;return at.jsxDEV("nav",{"aria-label":e.kind==="page"?"Page trail":"Folder trail",className:ie("",Ct.trail),children:[e.fixed?at.jsxDEV("span",{className:ie("",Ct.crumb),children:e.collectionLabel},void 0,!1,void 0,this):at.jsxDEV("a",{className:ie("",Ct.crumb,Ct.link),href:Tw(e,null),onClick:(o)=>Dw(o,e,null),children:e.collectionLabel},void 0,!1,void 0,this),n.map((o,r)=>{let l=[n[0],...n.slice(1,r+1)],a=r===n.length-1;return at.jsxDEV("span",{children:[at.jsxDEV("span",{"aria-hidden":"true",children:" / "},void 0,!1,void 0,this),a||e.fixed?at.jsxDEV("span",{"aria-current":a?"page":void 0,className:ie("",Ct.crumb),children:e.trail?.[r]??Up(o)},void 0,!1,void 0,this):at.jsxDEV("a",{className:ie("",Ct.crumb,Ct.link),href:Tw(e,l),onClick:(c)=>Dw(c,e,l),children:e.trail?.[r]??Up(o)},void 0,!1,void 0,this)]},r,!0,void 0,this)})]},void 0,!0,void 0,this)}function cI(e){if(!e.folders.length)return null;let n=e.kind==="page"?"Pages":"Folders";return at.jsxDEV("section",{"aria-label":n,className:ie("",Ct.group),children:[at.jsxDEV("div",{className:ie("",Ct.label),children:at.jsxDEV("span",{children:n},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.folders.map((o)=>at.jsxDEV("a",{"data-studio-folder":!0,className:ie("",Ae.row,Ct.folder),href:Tw(e,o.path),onClick:(r)=>Dw(r,e,o.path),children:[at.jsxDEV("span",{"aria-hidden":"true",className:ie("",Ae.index),children:"/"},void 0,!1,void 0,this),at.jsxDEV("span",{className:ie("",Ct.folderTitle),children:o.title??Up(o.name)},void 0,!1,void 0,this),at.jsxDEV("span",{className:ie("",Ct.count),children:[o.descendantCount," ",o.descendantCount===1?"entry":"entries",at.jsxDEV("span",{"aria-hidden":"true",children:"›"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},JSON.stringify(o.path),!0,void 0,this))]},void 0,!0,void 0,this)}function dI(e){return e.active?at.jsxDEV("div",{"data-studio-creation-layout":!0,className:ie("",Ct.creationBody,e.split&&Ct.creationBodySplit),children:e.children},void 0,!1,void 0,this):at.jsxDEV(at.Fragment,{children:e.children},void 0,!1,void 0,this)}function P0(e,n){if(!n||n.start<0||n.end<n.start||n.end>e.length)return e;return at.jsxDEV(at.Fragment,{children:[e.slice(0,n.start),at.jsxDEV("strong",{children:e.slice(n.start,n.end)},void 0,!1,void 0,this),e.slice(n.end)]},void 0,!0,void 0,this)}var JP=[[/path separators|cannot contain ':'/,"Leave out slashes: the file name is a single name, not a path."],[/dot segments/,"Use a name other than “.” or “..”."],[/null bytes/,"Remove the hidden control character from the name."]];function ZP(e){return JP.find(([n])=>n.test(e))?.[1]??e}function fI(e){let n=_0.useId(),o=e.error instanceof Do?e.error.issues:e.issues,r=o?.find((m)=>m.path[0]==="segment"||m.path[0]==="prefix"),l=r?.path[0]==="prefix"?`Cannot create in this ${e.kind??"folder"}: ${r.message}`:r?ZP(r.message):o?.length?void 0:e.error?.message,a=r?.path[0]==="segment"||!o?.length&&Boolean(e.error),c=!e.pending&&!e.error?e.preview:null,[d,p]=_0.useState(!1);if(e.followsTitle&&!d&&!a&&!l)return at.jsxDEV("section",{"aria-label":"New entry destination",className:ie("",Ct.destination),children:at.jsxDEV("p",{className:ie("",Ct.saveAs),children:["Saves as"," ",at.jsxDEV("span",{className:ie("",Ct.value),children:c?c.filePath===null?P0(c.entityId,c.entityLeaf):P0(c.filePath,c.fileLeaf):e.segment||"a file named after its title"},void 0,!1,void 0,this)," ",at.jsxDEV(xe,{type:"button",variant:"ghost",onClick:()=>p(!0),children:"Change"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return at.jsxDEV("section",{"aria-label":"New entry destination",className:ie("",Ct.destination),children:[at.jsxDEV("label",{className:ie("",Ct.segment),children:["File name",at.jsxDEV("input",{name:"segment",className:ie("",Ct.input),value:e.segment,onChange:(m)=>e.onSegmentChange(m.target.value),required:!0,autoComplete:"off",spellCheck:!1,"aria-invalid":a,"aria-describedby":`${n}-help${a?` ${n}-error`:""}`},void 0,!1,void 0,this),at.jsxDEV("small",{id:`${n}-help`,children:["Names the file inside this ",e.kind??"folder",": letters, numbers and hyphens work best, and no slashes."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),l&&at.jsxDEV("p",{id:`${n}-error`,role:"alert",className:ie("",Ct.error),children:l},void 0,!1,void 0,this),e.pending&&e.segment&&at.jsxDEV("p",{role:"status",className:ie("",Ct.context),children:"Checking destination…"},void 0,!1,void 0,this),c&&at.jsxDEV("p",{className:ie("",Ct.saveAs),children:["Saves as"," ",at.jsxDEV("span",{className:ie("",Ct.value),children:c.filePath===null?P0(c.entityId,c.entityLeaf):P0(c.filePath,c.fileLeaf)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var V0={section:{keoZOQ:"x1tfhste",kLKAdn:"x1cnzs8",kg3NbH:"xr244g7 xn3xmfv",kEafiO:"x178xt8z",kPef9Z:"x13fuv20",kLZC3w:"xvg7k2t",$$css:!0},head:{k1xSpc:"x78zum5",kGNEyG:"x1pha0wt",kOIVth:"x1v2ro7d",k1K539:"x1e56ztr",$$css:!0},count:{kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",kMwMTN:"x1ar3pfp",$$css:!0}};var Ms=G(fe(),1);function e_(e){let{page:n}=e;return Ms.jsxDEV("section",{"data-studio-collection-members":"","aria-labelledby":"studio-collection-members",className:ie("",V0.section),children:[Ms.jsxDEV("div",{className:ie("",V0.head),children:[Ms.jsxDEV("h2",{id:"studio-collection-members",className:ie("",lo.eyebrow),children:"Members"},void 0,!1,void 0,this),Ms.jsxDEV("span",{className:ie("",V0.count),children:n.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n.entities.map((o,r)=>Ms.jsxDEV("a",{href:_n(nr(),o.entityType,o.id),"data-studio-record":"",className:ie("",Ae.row,Ae.recordLink,di.listingRow),onClick:(l)=>{if(!Mo(l))return;l.preventDefault(),e.onOpen(o.id,o.entityType)},children:[Ms.jsxDEV("span",{className:ie("",Ae.index),children:String(r+1).padStart(2,"0")},void 0,!1,void 0,this),Ms.jsxDEV("span",{className:ie("",Ae.title),title:o.id,children:Zi(o,o.path?.at(-1))},void 0,!1,void 0,this),Ms.jsxDEV("time",{className:ie("",Ae.updated),dateTime:o.updated,children:Cu(o.updated)},void 0,!1,void 0,this)]},JSON.stringify([o.entityType,o.id]),!0,void 0,this))]},void 0,!0,void 0,this)}function hI(e){let n=Nt(),{data:o}=Xt({queryKey:["studio","collection-members",e.entityType,e.entityId],queryFn:()=>n.fetchCollectionMembers(e.entityType,e.entityId)});return o?Ms.jsxDEV(e_,{page:o,onOpen:e.onOpen},void 0,!1,void 0,this):null}var G0=G(Xe(),1),Mw=(e)=>`studio.inspector.${e}`;function pI(e){try{return window.localStorage.getItem(Mw(e))==="hidden"}catch{return!1}}function mI(e){let[n,o]=G0.useState(()=>({entityType:e,hidden:pI(e)})),r=n.entityType===e?n:{entityType:e,hidden:pI(e)};if(r!==n)o(r);let l=G0.useCallback((a)=>{o({entityType:e,hidden:a});try{if(a)window.localStorage.setItem(Mw(e),"hidden");else window.localStorage.removeItem(Mw(e))}catch{}},[e]);return[r.hidden,l]}var Q0=G(Xe(),1);var gI={list:{k1xSpc:"xrvj5dj",kumcoG:"xrwz996",kOIVth:"xfe5i6u",kogj98:"x1ghz6dp",$$css:!0},keys:{kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kMwMTN:"x1ar3pfp",$$css:!0},row:{k1xSpc:"xjp7ctv",$$css:!0},action:{kogj98:"x1ghz6dp",$$css:!0}};var Rs=G(fe(),1),t_=[["Ctrl+S or ⌘S","Save changes"],["Ctrl+Z or ⌘Z","Undo; with Shift, redo"],["Ctrl+B or ⌘B","Bold"],["Ctrl+I or ⌘I","Italic"],["/ at the start of a line","Headings, lists and more"],["Ctrl+\\ or ⌘\\","Show or hide Details"],["Ctrl+/ or ⌘/","Show the writing or its Markdown"],["Ctrl+K or ⌘K","Search or do anything"],["?","Show these shortcuts"]],W0=gI;function n_(e){return e instanceof HTMLElement&&(e.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(e.tagName))}function vI(){let[e,n]=Q0.useState(!1);return Q0.useEffect(()=>{let o=(r)=>{if(r.key!=="?"||n_(r.target))return;r.preventDefault(),n(!0)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[]),Rs.jsxDEV(Ma,{open:e,onOpenChange:n,children:Rs.jsxDEV(Ra,{children:[Rs.jsxDEV(yI,{children:[Rs.jsxDEV(Oa,{children:"Keyboard shortcuts"},void 0,!1,void 0,this),Rs.jsxDEV(bI,{children:"While an entry is open."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Rs.jsxDEV("dl",{...E(W0.list),children:t_.map(([o,r])=>Rs.jsxDEV("div",{...E(W0.row),children:[Rs.jsxDEV("dt",{...E(W0.keys),children:o},void 0,!1,void 0,this),Rs.jsxDEV("dd",{...E(W0.action),children:r},void 0,!1,void 0,this)]},r,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Os=G(fe(),1);function xI(e){return Os.jsxDEV(T0,{children:[Os.jsxDEV(D0,{className:kI("ghost","icon"),"aria-label":"More document actions",children:"•••"},void 0,!1,void 0,this),Os.jsxDEV(M0,{align:"end",children:[e.view&&Os.jsxDEV(Bp,{onSelect:e.view.onToggle,children:e.view.label},void 0,!1,void 0,this),e.view&&e.onDelete&&Os.jsxDEV(SI,{},void 0,!1,void 0,this),e.onDelete&&Os.jsxDEV(Bp,{variant:"destructive",onSelect:e.onDelete,children:"Delete entry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function wI(e){let{syncStatus:n}=e;if(!n?.directorySync)return null;return Os.jsxDEV("details",{"data-studio-sync-details":"",children:[Os.jsxDEV("summary",{...E(rn.summary),children:"Sync details"},void 0,!1,void 0,this),Os.jsxDEV(MR,{view:xy({save:e.editor.save,git:n.git,baselineCommit:e.baselineCommit}),gitConfigured:n.git!==null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var CI=1500;function Rw(e){return e.modeKind==="edit"&&e.canEdit&&e.publicationState==="draft"}function AI(e){return Rw(e)&&e.hasUnsavedChanges&&!e.saveBlocked&&e.saveKind!=="saving"&&e.saveKind!=="conflict"}function EI(){if(typeof document>"u")return!1;return document.querySelector("[data-studio-root]")?.getAttribute("data-studio-autosave")!=="off"}var qe=G(fe(),1);function Ow(e){let{editor:n,bodyMode:o,mobilePane:r,hasUnsavedChanges:l,dispatchEditor:a,setBodyMode:c,setMobilePane:d,backToList:p,performPublishingAction:m,save:g}=e,{mode:b,body:k,save:S}=n,{entitySchema:C,presentation:A,selectedEntityType:D,systemDesign:T,canEdit:I,namedCreate:H,fieldIssues:_,hierarchyKind:L,canPublish:P,canAssist:Q,collectionLabel:F,publicationWorkspace:we,publicationState:J,editorHead:Z}=e.model,oe=mw(n,e.model,l),Te=B0(n,e.model,l),Rt=b.kind==="create"&&!C.isSingleton,K=A==="split",[le,se]=mI(D),ge=e.ask?.open===!0&&b.kind==="edit"&&Q,De=le||ge,ct=(ke)=>{if(!ke&&ge)e.ask?.setOpen(!1);se(ke)},Et=I?jd(C,A):void 0,zt=typeof n.draft.title==="string"?n.draft.title:"",pe=Et?qe.jsxDEV(Mz,{descriptor:Et,value:zt,placeholder:`Untitled ${e.model.entryLabel.toLowerCase()}`,issues:_,onChange:(ke)=>a({type:"fieldChanged",descriptor:Et,raw:ke})},void 0,!1,void 0,this):void 0;function ze(ke){let St=ke.currentTarget.querySelector("input:invalid, select:invalid, textarea:invalid");if(St&&!St.closest("[data-studio-properties]"))return;Oz(ke.currentTarget);let co=K&&De;if(r==="details"&&!co)return;ke.preventDefault();let bt=ke.currentTarget.querySelector("input:invalid, select:invalid, textarea:invalid");if(ke.target!==bt)return;if(d("details"),co)ct(!1);requestAnimationFrame(()=>{if(bt.isConnected)bt.focus(),bt.reportValidity()})}let Tt=$o.useRef(null),li=$o.useId(),Bs=I||A==="split",Ns=Rw({modeKind:b.kind,publicationState:J,canEdit:I}),Uo=b.kind==="edit"&&J==="published",zs=$o.useRef(null);$o.useEffect(()=>{if(!EI()||!AI({modeKind:b.kind,publicationState:J,canEdit:I,hasUnsavedChanges:l,saveBlocked:oe,saveKind:S.kind}))return;if(zs.current?.draft===n.draft&&zs.current.body===k)return;let ke=window.setTimeout(()=>{let St=Tt.current;if(!(St!==null&&Array.from(St.elements).every((bt)=>!(bt instanceof HTMLInputElement||bt instanceof HTMLTextAreaElement||bt instanceof HTMLSelectElement)||bt.validity.valid)))return;zs.current={draft:n.draft,body:k},g()},CI);return()=>window.clearTimeout(ke)});let ce=qe.jsxDEV("span",{className:`studio-editor-head-save-status ${E(jn.saveStatus).className??""}`,role:"status","aria-live":"polite",title:"Drafts save as you type (Ctrl+S or ⌘S saves now)",children:S.kind==="saving"?"Saving…":S.kind==="error"||S.kind==="conflict"?"Not saved":l?"Unsaved changes":"Saved"},void 0,!1,void 0,this),In=Ns?ce:qe.jsxDEV(xe,{type:"submit",form:li,className:"studio-editor-head-save",variant:l?"default":"outline",title:`${Rt?"Create":Uo?"Publish changes":"Save changes"} (Ctrl+S or ⌘S)`,"aria-keyshortcuts":"Control+s Meta+s",disabled:oe,...Te&&{"aria-describedby":L0},children:S.kind==="saving"?Rt?"Creating…":Uo?"Publishing…":"Saving…":Rt?"Create":Uo?"Publish changes":"Save changes"},void 0,!1,void 0,this),Pi=Nt(),Gr=e.openEntity,Wr=$o.useMemo(()=>{let ke=(St)=>Pi.fetchPalette(St).then((co)=>(co.groups.find((bt)=>bt.id==="entries")?.items??[]).map((bt)=>{let _o=bt.id.indexOf(":");return{type:bt.id.slice(0,_o),id:bt.id.slice(_o+1),title:bt.title,typeLabel:bt.sub??""}}).filter((bt)=>bt.type&&bt.id));return{findEntries:ke,open:(St)=>{let{type:co,id:bt}=MI(St);if(co){Gr(bt,co);return}ke(bt).then((_o)=>{let br=_o.find((Tl)=>Tl.id===bt);if(br)Gr(br.id,br.type)})}}},[Pi,Gr]),et=$o.useMemo(()=>({library:()=>Pi.fetchImageLibrary({offset:0,limit:12}).then(({images:ke})=>ke.map((St)=>({id:St.id,alt:St.alt,title:St.title}))),upload:(ke)=>by(Pi,ke).then(({entityId:St})=>({id:St,alt:K3(ke.name)}))}),[Pi]),Is=(ke)=>{c(ke),D2(ke)},Hs=b.kind==="edit"&&!C.isSingleton&&e.model.canDelete,yr=Hs||C.hasBody?qe.jsxDEV(xI,{view:C.hasBody?{label:pw[o],onToggle:()=>Is(o==="write"?"markdown":"write")}:void 0,onDelete:Hs?()=>a({type:"deleteRequested"}):void 0},void 0,!1,void 0,this):null,yt=e.groupReturnLabel??F,[za]=$o.useState(()=>Symbol("editor"));TI(za,{title:C.isSingleton?Z.title:yt,...!C.isSingleton?{back:{label:yt,onBack:p}}:{},...Bs?{action:qe.jsxDEV(qe.Fragment,{children:[In,yr]},void 0,!0,void 0,this)}:{}}),$o.useEffect(()=>(document.addEventListener("keydown",Po),()=>document.removeEventListener("keydown",Po)));function Po(ke){if(K&&(ke.ctrlKey||ke.metaKey)&&!ke.altKey&&!ke.shiftKey&&ke.key==="\\"){ke.preventDefault(),ct(!De);return}if(!(ke.ctrlKey||ke.metaKey)||ke.altKey||ke.shiftKey||ke.key.toLowerCase()!=="s")return;if(ke.target instanceof HTMLElement&&ke.target.closest('[role="dialog"], [role="alertdialog"]'))return;if(ke.preventDefault(),!oe)Tt.current?.requestSubmit()}return qe.jsxDEV("form",{role:"main","aria-label":"Document editor",className:ie("",Qn.editor,A!=="split"&&rn.editor),"data-studio-editor":"","data-editor-presentation":A,"data-mobile-pane":A==="split"?r:void 0,"data-inspector":K?De?"hidden":"shown":void 0,onInvalidCapture:ze,onSubmit:(ke)=>{if(ke.preventDefault(),!oe)g()},id:li,ref:Tt,children:qe.jsxDEV(DI,{value:S.kind==="error"?"save":"check",children:[qe.jsxDEV(ir,{model:Z,appearance:"document",titleEditor:pe,navigation:!C.isSingleton?qe.jsxDEV(xe,{type:"button",variant:"ghost",onClick:p,"aria-label":`Back to ${yt}`,children:[qe.jsxDEV("span",{"aria-hidden":"true",children:"←"},void 0,!1,void 0,this)," Back to ",yt]},void 0,!0,void 0,this):void 0,action:Bs?qe.jsxDEV(qe.Fragment,{children:[e.ask&&b.kind==="edit"&&Q&&qe.jsxDEV(U0,{ask:e.ask,placement:"head"},void 0,!1,void 0,this),K&&qe.jsxDEV(xe,{type:"button",variant:"ghost",className:"studio-inspector-toggle",xstyle:Qn.inspectorToggle,"aria-pressed":!De,"aria-keyshortcuts":"Control+Backslash Meta+Backslash",title:"Details (Ctrl+\\\\ or ⌘\\\\)",onClick:()=>ct(!De),children:"Details"},void 0,!1,void 0,this),In,yr]},void 0,!0,void 0,this):void 0},void 0,!1,void 0,this),e.draftRecovery?.offer&&qe.jsxDEV("div",{"data-studio-draft-offer":"",children:qe.jsxDEV(me,{className:ie("",jn.inset),children:["Unsaved changes from"," ",qe.jsxDEV("time",{dateTime:new Date(e.draftRecovery.offer.savedAt).toISOString(),children:new Date(e.draftRecovery.offer.savedAt).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})},void 0,!1,void 0,this)," ","were kept in this browser."," ",qe.jsxDEV(xe,{type:"button",variant:"outline",onClick:e.draftRecovery.restore,children:"Restore"},void 0,!1,void 0,this)," ",qe.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.draftRecovery.discard,children:"Discard"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),qe.jsxDEV(dI,{active:H,split:A==="split",children:[b.kind==="create"&&H&&qe.jsxDEV("div",{className:ie("",jn.inset,Ct.destinationFrame),children:[qe.jsxDEV(j0,{kind:L,collectionLabel:F,collectionPath:e.collectionPath,query:{...e.collectionQuery,prefix:b.prefix??null},onNavigate:e.selectFolder,fixed:!0},void 0,!1,void 0,this),qe.jsxDEV(fI,{kind:L,segment:b.segment??"",followsTitle:Et!==void 0&&b.segmentFollowsTitle===!0,onSegmentChange:(ke)=>a({type:"segmentChanged",segment:ke}),preview:e.creationDestination.data,pending:e.creationDestination.pending,error:e.creationDestination.error,issues:S.kind==="error"?S.issues:void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),qe.jsxDEV(Lz,{presentation:A,children:[T&&qe.jsxDEV("p",{"data-studio-system-intro":"",...E(Ze.intro),children:T.intro},void 0,!1,void 0,this),qe.jsxDEV(Bz,{presentation:A,hidden:K&&De,sheet:A==="split"&&r==="details",onCloseSheet:()=>d("write"),summaryDescription:T?C.fields.slice(0,3).map((ke)=>ke.label).join(" · "):void 0,reveal:A==="document"&&!n.body.trim()||(_?.length??0)>0,children:[A!=="document"&&!T&&qe.jsxDEV("div",{className:ie("",di.propertiesHead),children:[qe.jsxDEV("h2",{className:ie("",di.propertiesLabel,lo.eyebrow),children:"Properties"},void 0,!1,void 0,this),b.kind==="create"||J?qe.jsxDEV("span",{className:ie("",di.propertiesLabel,lo.eyebrow),children:b.kind==="create"?"New":J},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),qe.jsxDEV(iI,{...e},void 0,!1,void 0,this),qe.jsxDEV(wI,{syncStatus:e.syncStatus,baselineCommit:e.baselineCommit,editor:n},void 0,!1,void 0,this),we&&b.kind==="edit"&&P&&qe.jsxDEV(Rz,{entityType:D,entityId:b.entity.id,title:Zi(b.entity),missing:(e.model.activeType?.publishRequires??[]).filter((ke)=>{let St=b.entity.frontmatter[ke];return St===void 0||St===null||typeof St==="string"&&St.trim()===""}),status:typeof b.entity.frontmatter.status==="string"?b.entity.frontmatter.status:"draft",unsaved:l,onAction:m},void 0,!1,void 0,this)]},sd(D,b),!0,void 0,this),C.hasBody&&qe.jsxDEV("section",{className:ie("",Qn.manuscript,A!=="split"&&rn.manuscript),children:[T&&qe.jsxDEV("header",{...E(Ze.bodyHeading),children:[qe.jsxDEV("h2",{...E(lo.secondaryDisplay),children:T.bodyTitle},void 0,!1,void 0,this),qe.jsxDEV("p",{...E(Ze.description),children:T.bodyDescription},void 0,!1,void 0,this)]},void 0,!0,void 0,this),qe.jsxDEV(Ez,{value:k,mode:o,onChange:(ke)=>a({type:"bodyChanged",body:ke}),onModeChange:Is,loadImage:(ke,St)=>Pi.fetchImagePreview(ke,St),images:et,links:Wr,readOnly:!I,documentTitle:Et?zt:Z.title,onSelectionChange:e.ask?.setSelection},void 0,!1,void 0,this),b.kind==="edit"&&e.model.activeType?.collection&&qe.jsxDEV(hI,{entityType:D,entityId:b.entity.id,onOpen:e.openEntity},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),qe.jsxDEV(lI,{...e},void 0,!1,void 0,this),qe.jsxDEV(vI,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Ba=G(Xe(),1);var Jd={anchor:{kVAEAm:"x1n2onr6",k1xSpc:"x3nfvp2",$$css:!0},menu:{kVAEAm:"x10l6tqk",kY2c9j:"x1q8xho0",k87sOh:"x1d1n87m",kt4wiu:"xtijo5x",k1xSpc:"xrvj5dj",kOIVth:"x195vfkc",kzqmXN:"xj6ak53",ks0D6T:"xw7nakj",kmVPX3:"x1ruevkc",kMzoRj:"xmkeg23",ksu8eU:"x1y0btm7",kVAM5u:"x8tuc8h",kaIpWk:"xhpnuu7",kWkggS:"x18s3upu",kGVxlE:"x1mxzbga",k9WMMc:"x1yc453h",$$css:!0},choice:{k1xSpc:"xrvj5dj",kOIVth:"x1ed6fcf",kAzted:"x1gg8mnh x1kr55ab",k8WAf4:"x1m7iz9m",kg3NbH:"x1awh872",kMzoRj:"xc342km",kaIpWk:"x1kogg8i",kWkggS:"xjbqb8w x1jdv8xm xgvoa9k",kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",k9WMMc:"x1yc453h",kkrTdU:"x1ypdohk",k3XXqK:"x1t137rt x9v5kkp",kMeerF:"x1de99jn",kjBf7l:"x1itw484",kInvED:"x2ssjo2",$$css:!0},choiceLabel:{kGuDYH:"x4z9k3i",k63SB2:"x1s688f",$$css:!0},choiceDescription:{kGuDYH:"xfifm61",kLWn49:"x37zpob",kMwMTN:"x1ar3pfp",$$css:!0}};var Ls=G(fe(),1);function OI(e){let{entryLabel:n,starters:o,disabled:r,onCreate:l}=e,[a,c]=Ba.useState(!1),d=Ba.useRef(null),p=Ba.useId(),m=rr(n),g=`New ${m}`;if(Ba.useEffect(()=>{if(!a)return;d.current?.querySelector('[role="menuitem"]')?.focus();let S=(C)=>{if(C.target instanceof Node&&!d.current?.contains(C.target))c(!1)};return document.addEventListener("pointerdown",S),()=>document.removeEventListener("pointerdown",S)},[a]),!o?.length)return Ls.jsxDEV(xe,{type:"button",disabled:r,"data-studio-library-new":"",onClick:()=>l(),children:g},void 0,!1,void 0,this);let b=(S)=>{c(!1),l(S)},k=(S)=>{let C=[...S.currentTarget.querySelectorAll('[role="menuitem"]')],A=C.findIndex((T)=>T===document.activeElement),D=(T)=>{S.preventDefault(),C[(T+C.length)%C.length]?.focus()};if(S.key==="ArrowDown")D(A+1);else if(S.key==="ArrowUp")D(A-1);else if(S.key==="Home")D(0);else if(S.key==="End")D(C.length-1);else if(S.key==="Escape"||S.key==="Tab"){if(S.key==="Escape")S.preventDefault(),S.stopPropagation(),d.current?.querySelector("[data-studio-library-new]")?.focus();c(!1)}};return Ls.jsxDEV("div",{ref:d,...E(Jd.anchor),children:[Ls.jsxDEV(xe,{type:"button",disabled:r,"data-studio-library-new":"","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?p:void 0,onClick:()=>c((S)=>!S),children:g},void 0,!1,void 0,this),a&&Ls.jsxDEV("div",{id:p,role:"menu","aria-label":`Start a new ${m} from`,"data-studio-new-entry-menu":"",onKeyDown:k,...E(Jd.menu),children:[o.map((S)=>Ls.jsxDEV(RI,{label:S.label,description:S.description,onChoose:()=>b(S.id)},S.id,!1,void 0,this)),Ls.jsxDEV(RI,{label:`Empty ${m}`,description:"Start from nothing and fill in every field.",onChoose:()=>b()},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function RI(e){return Ls.jsxDEV("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:e.onChoose,...E(Jd.choice),children:[Ls.jsxDEV("span",{...E(Jd.choiceLabel),children:e.label},void 0,!1,void 0,this),Ls.jsxDEV("span",{...E(Jd.choiceDescription),children:e.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var F0=G(Xe(),1),Lw="studio.density";function i_(){try{return window.localStorage.getItem(Lw)==="compact"?"compact":"comfortable"}catch{return"comfortable"}}function o_(e){try{if(e==="compact")window.localStorage.setItem(Lw,e);else window.localStorage.removeItem(Lw)}catch{}}function LI(){let[e,n]=F0.useState(i_),o=F0.useCallback((r)=>{n(r),o_(r)},[]);return[e,o]}var Ue=G(fe(),1);function qI(e){let{entities:n,entityOffset:o,entityLimit:r,entityTotal:l,entityListLoading:a,schema:c,changeEntityPage:d,startCreate:p}=e,{activeType:m,entitySchema:g,systemDesign:b,canCreate:k,hierarchyKind:S,collectionLabel:C,entryLabel:A,pageEnd:D,collectionFiltered:T,listingHead:I}=e.model,H=dR({activeType:m,entityType:e.entityType,entities:n,entityOffset:o,entryLabel:A,collectionLabel:C,onConfirmed:e.onRefineConfirmed}),_=H.picked.length>0,[L,P]=LI(),Q=g.fields.some((oe)=>oe.column==="excerpt"||oe.column==="cover"),F=Q&&L==="compact",we=!F&&(n??[]).some((oe)=>Nw(oe,g.fields)),J=rR(H.picked.length,A,C),Z=m?.refinesInto;return Ue.jsxDEV("main",{className:ie("",Ae.listing,jn.inset),"data-studio-library":"","aria-busy":a,onKeyDown:(oe)=>{if(oe.key==="Escape"&&_&&!H.asking)H.clear()},children:[e.readError&&Ue.jsxDEV(me,{tone:"error",children:[n?.length?"Showing previously loaded entries. ":"",e.readError,Ue.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ue.jsxDEV(ir,{model:_?{...I,metadata:[oR(H.picked.length,l)]}:I,action:_?Ue.jsxDEV(Ue.Fragment,{children:[Ue.jsxDEV(xe,{type:"button",variant:"ghost",onClick:H.clear,children:"Cancel"},void 0,!1,void 0,this),Ue.jsxDEV(xe,{type:"button","data-studio-library-refine":"",onClick:H.ask,children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this):(!b||k)&&Ue.jsxDEV(OI,{entryLabel:A,starters:m?.starters,disabled:!k||!c,onCreate:p},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ue.jsxDEV(hR,{notice:e.refineNotice??null},void 0,!1,void 0,this),H.refusal&&Ue.jsxDEV(me,{tone:"error",children:H.refusal},void 0,!1,void 0,this),b&&Ue.jsxDEV("p",{"data-studio-system-intro":"",...E(Ze.collectionIntro),children:b.intro},void 0,!1,void 0,this),Ue.jsxDEV(j0,{kind:S,collectionLabel:C,collectionPath:e.collectionPath,query:e.collectionQuery,trail:e.collectionTrail,onNavigate:e.selectFolder},void 0,!1,void 0,this),e.pageTexts&&Ue.jsxDEV(eI,{pageTexts:e.pageTexts},void 0,!1,void 0,this),!g.isSingleton&&Ue.jsxDEV($I,{kind:S,query:e.collectionQuery,fields:g.fields,total:l,onChange:e.onCollectionQueryChange,...Q&&{density:L,onDensityChange:P}},void 0,!1,void 0,this),!a&&Ue.jsxDEV(cI,{kind:S,folders:e.folders,collectionPath:e.collectionPath,query:e.collectionQuery,onNavigate:e.selectFolder},void 0,!1,void 0,this),e.folders.length>0&&l>0&&Ue.jsxDEV("div",{className:ie("",Ct.label),children:[Ue.jsxDEV("span",{children:"Entries here"},void 0,!1,void 0,this),Ue.jsxDEV("span",{children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!g.isSingleton&&l>0&&Ue.jsxDEV(py,{label:`${m?.label??"Entity"} pagination`,offset:o,count:Math.max(0,D-o),total:l,loading:a,hasNext:o+r<l,onPrevious:()=>d(Math.max(0,o-r)),onNext:()=>d(o+r)},void 0,!1,void 0,this),a&&Ue.jsxDEV(me,{className:ie("",Ae.empty),children:"Loading entries…"},void 0,!1,void 0,this),!a&&(n??[]).map((oe,Te)=>Ue.jsxDEV(r_,{entity:oe,index:String(o+Te+1).padStart(2,"0"),view:e,refine:H,picking:_,compact:F,covers:we},oe.id,!1,void 0,this)),!e.readError&&!a&&n?.length===0&&e.folders.length===0&&Ue.jsxDEV(me,{className:ie("",Ae.empty),children:[e.collectionQuery.q||e.collectionQuery.status||e.collectionQuery.visibility!=="all"?"No entries match these filters. Clear or change the filters to try again.":k?"Nothing here yet — start the first entry.":"No entries are available in this collection.",T&&e.collectionQuery.prefix&&e.collectionQuery.scope==="folder"&&Ue.jsxDEV(xe,{type:"button",variant:"ghost",onClick:()=>e.onCollectionQueryChange({...e.collectionQuery,scope:"collection",offset:0}),children:"Search whole collection"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.asking&&e.entityType&&Z&&Ue.jsxDEV(pR,{entityType:e.entityType,entryLabel:A,collectionLabel:C,targetLabel:Z.label,picked:(n??[]).filter(({id:oe})=>H.picked.includes(oe)),onCancel:H.closeAsk,onRefused:H.refused,onConfirmed:(oe)=>{H.confirmed(oe),e.selectEntityType(Z.entityType)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function r_(e){let{entity:n,view:o,refine:r}=e,{systemDesign:l,entitySchema:a}=o.model,c=o.collectionQuery,d=Zi(n,n.path?.at(-1)),p=II(n),m=BI(n,a.fields),g=zI(n,a.fields),b=e.compact?null:NI(n,a.fields),k=e.covers,S=Nw(n,a.fields),C=k&&Ue.jsxDEV("span",{"data-studio-row-cover":"","aria-hidden":"true",...E(Ae.cover),children:S&&Ue.jsxDEV(dd,{imageId:S,thumbnailWidth:yy,alt:"",placeholder:Ue.jsxDEV("span",{...E(Ae.coverPending)},void 0,!1,void 0,this),...E(Ae.coverImage)},void 0,!1,void 0,this)},void 0,!1,void 0,this),A=()=>o.openEntity(n.id,n.entityType),D=_n(nr(),n.entityType,n.id),T=(H)=>{if(!Mo(H))return;H.preventDefault(),A()},I=Ue.jsxDEV("span",{className:ie("",Ae.title),title:n.id,children:[d,(c.q||c.scope==="collection")&&n.path&&n.path.length>1&&Ue.jsxDEV("span",{className:ie("",Ct.context),children:n.path.slice(0,-1).map(Up).join(" / ")},void 0,!1,void 0,this),b&&Ue.jsxDEV("span",{"data-studio-row-excerpt":"",...E(Ae.excerpt),children:b},void 0,!1,void 0,this),m&&Ue.jsxDEV("span",{className:ie("studio-publication-state",di.publication,e.compact&&Ae.inlineStatus),children:HI(m)},void 0,!1,void 0,this),p&&Ue.jsxDEV("span",{"data-studio-generation":p,className:ie("",di.publication),children:p},void 0,!1,void 0,this),n.members&&Ue.jsxDEV("span",{"data-studio-row-members":"",className:ie("",Ae.members),children:n.members.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(r.available&&!l){let H=r.picked.includes(n.id);return Ue.jsxDEV("div",{"data-studio-row":"",...e.picking&&{"data-picking":""},className:ie("",Ae.row,di.listingRow,Vn.row,k&&Ae.covered,e.compact&&Ae.compact,H&&Vn.rowPicked),children:[Ue.jsxDEV(fR,{index:e.index,title:d,picked:H,onToggle:()=>r.toggle(n.id)},void 0,!1,void 0,this),Ue.jsxDEV("a",{href:D,"data-studio-record":"",...E(Vn.open),onClick:T,children:[C,I,Ue.jsxDEV("time",{className:ie("",Ae.updated,Vn.updated),dateTime:g.iso,title:g.iso,children:Bw(g)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}return Ue.jsxDEV("a",{href:D,className:ie("",Ae.row,Ae.recordLink,di.listingRow,k&&Ae.covered,e.compact&&Ae.compact),"data-studio-record":"",onClick:T,children:[Ue.jsxDEV("span",{className:ie("",Ae.index),children:e.index},void 0,!1,void 0,this),C,I,Ue.jsxDEV("time",{className:ie("",Ae.updated),dateTime:g.iso,title:g.iso,children:Bw(g)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var GI=G(Xe(),1);var s_={surface:{kzqmXN:"xh8yej3",kB7OPa:"x9f619",k7Eaqz:"xeuugli",kAzted:"x2lwn1j",kGO01o:"x1sgudl8",kORKVm:"x1odjw0f",kh9fTk:"x1c54s19",kKq9zD:"xiqhxos",k4sGnE:"x11u2ate",kzrhLs:"x14214pg","--operator-section-spacing":"xn0jjtu","--operator-section-transform":"x6lesxo",$$css:!0}};function zw(e){return`${e} ${E(s_.surface,jn.inset,lo.operatorRoles).className??""}`}var Iw=G(Xe(),1);function l_(e){return Iw.createElement(UI,{...e,children:Iw.createElement("div",E(Ae.readable),e.children)})}var Hw={engine:"app",density:"comfortable",Button:xe,Input:Eu,Select:wu,Textarea:cd,ConfirmDialog:Nn,Disclosure:l_,Tabs:PI};var jr=G(fe(),1);function WI(e){let{activeWorkspaceId:n,workspaceError:o,declarativeWorkspaceData:r,workspaceQuery:l,openWorkspaceEntity:a,openWorkspaceLaunch:c,performDeclarativeAction:d,onWorkspaceQueryChange:p}=e,{declarativeHead:m}=e.model,[g,b]=GI.useState(null);return o&&!r?jr.jsxDEV("main",{className:zw(""),children:jr.jsxDEV(me,{tone:"error",children:[o,jr.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):r&&m?jr.jsxDEV("div",{className:zw("studio-workspace-frame"),children:[o&&jr.jsxDEV(me,{tone:"error",children:["Showing previously loaded content. ",o,jr.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),jr.jsxDEV(ir,{model:m,...g?{back:{label:m.title,onBack:g.close}}:{},...r.view.headQuery&&n?{control:jr.jsxDEV(_I,{control:r.view.headQuery,query:l,onQueryChange:(k)=>p(n,k,k)},void 0,!1,void 0,this)}:{},...m.primaryAction?{action:jr.jsxDEV(jI,{action:m.primaryAction,primary:!0,onAction:d,components:Hw},void 0,!1,void 0,this)}:{}},void 0,!1,void 0,this),jr.jsxDEV(VI,{data:r,components:Hw,renderHead:!1,onDetailChange:b,onOpenEntity:a,onLaunch:c,onAction:d,query:l,...n?{onQueryChange:(k)=>p(n,k,k)}:{}},n,!1,void 0,this)]},void 0,!0,void 0,this):null}var At=G(fe(),1);function ZI(e,n){if(!e.hasBody)return"details";return n??"write"}function Xu(e){return At.jsxDEV("div",{className:ie("studio",Ae.frame,lo.operatorRoles,X0.space),"data-studio-shell":"",children:[At.jsxDEV(K0,{contextLabel:"Studio"},void 0,!1,void 0,this),At.jsxDEV("main",{"aria-label":"Studio status",children:[At.jsxDEV(me,{tone:e.error?"error":void 0,className:ie("",Ae.boot),children:[e.message,e.onRetry&&At.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onRetry,children:"Retry"},void 0,!1,void 0,this),e.onHome&&At.jsxDEV(xe,{type:"button",variant:"ghost",onClick:e.onHome,children:"Open Studio"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.children&&At.jsxDEV("div",{className:ie("",Ae.boot),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function e8(e){let n=$w();return At.jsxDEV("div",{className:ie("studio",Ae.frame,lo.operatorRoles,X0.space),"data-view":"account","data-studio-shell":"",children:[At.jsxDEV(K0,{contextLabel:"Account",navigation:{types:e.types,workspaces:e.workspaces,activeEntityType:null,activeWorkspaceId:e.workspaceId,workspaceBadges:Y0(e.workspaces),selectEntityType:e.selectEntityType,selectWorkspace:e.selectWorkspace}},void 0,!1,void 0,this),At.jsxDEV("div",{className:Pp("",Qn.body,Yu.shell,n&&Yu.shellCollapsed),"data-studio-body":"",children:[At.jsxDEV("aside",{className:Pp("rail",Yu.rail),children:At.jsxDEV(qw,{renderMode:"desktop",types:e.types,active:null,onSelect:e.selectEntityType,workspaces:e.workspaces,activeWorkspace:e.workspaceId,workspaceBadges:Y0(e.workspaces),onSelectWorkspace:e.selectWorkspace},void 0,!1,void 0,this)},void 0,!1,void 0,this),At.jsxDEV("main",{className:FI("account-studio-pane",QI.pane),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function t8(e){let n=$w(),{activeWorkspaceId:o,types:r,workspaces:l,entityType:a,editor:c,deleting:d,navigationBlocked:p,dispatchEditor:m,selectEntityType:g,selectWorkspace:b,remove:k,onNavigationReset:S,onNavigationProceed:C}=e,{mode:A,deleteOpen:D}=c,T=JI(e),I=u_(e,T),{editing:H,canDelete:_,collectionLabel:L,workspaceBadges:P}=T;return At.jsxDEV("div",{className:ie("studio",Ae.frame,lo.operatorRoles,X0.space),"data-studio-shell":"","data-view":e.groupingView?"grouping":e.mediaView?e.media?.active??"images":o?"workspace":H?"editor":"listing",children:[At.jsxDEV(K0,{pageTitle:H?T.editorHead.title:void 0,contextLabel:e.groupReturnLabel??YI.find((Q)=>Q.key===e.media?.active)?.label??e.groupings?.items.find((Q)=>Q.key===e.groupings?.active)?.label??L,navigation:{groupings:e.groupings,media:e.media,types:r,workspaces:l,activeEntityType:o||e.groupings?.active||e.media?.active?null:a,activeWorkspaceId:o,workspaceBadges:P,selectEntityType:g,selectWorkspace:b,editing:H&&!T.entitySchema.isSingleton}},void 0,!1,void 0,this),At.jsxDEV("div",{className:Pp("",Qn.body,Yu.shell,n&&Yu.shellCollapsed),"data-studio-body":"",children:[At.jsxDEV("aside",{className:Pp("rail",Yu.rail),children:At.jsxDEV(qw,{renderMode:"desktop",focus:H,groupings:e.groupings,media:e.media,types:r,active:o||e.groupings?.active||e.media?.active?null:a,onSelect:g,workspaces:l,activeWorkspace:o,workspaceBadges:Y0(l),onSelectWorkspace:b},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.groupingView??e.mediaView??e.homeView??(o?At.jsxDEV(WI,{...e,model:T},void 0,!1,void 0,this):!H?At.jsxDEV(qI,{...e,model:T},void 0,!1,void 0,this):I?At.jsxDEV("div",{...E(Fd.row),children:[At.jsxDEV("div",{...E(Fd.grow),children:At.jsxDEV(Ow,{...e,model:T},void 0,!1,void 0,this)},void 0,!1,void 0,this),I]},void 0,!0,void 0,this):At.jsxDEV(Ow,{...e,model:T},void 0,!1,void 0,this))]},void 0,!0,void 0,this),D&&A.kind==="edit"&&_&&At.jsxDEV(RR,{title:Zi(A.entity),deleting:d,onCancel:()=>m({type:"deleteCancelled"}),onConfirm:k},void 0,!1,void 0,this),p&&At.jsxDEV(Nn,{mark:"↩",title:"Discard unsaved changes?",titleId:"discard-navigation-title",cancelLabel:"Keep editing",confirmLabel:"Discard and continue",confirmVariant:"danger",onCancel:S,onConfirm:C,children:At.jsxDEV("p",{children:"This draft has not been saved. Continue only if you want to leave it behind."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var a_=J0.lazy(async()=>({default:(await import("./studio-chunks/studio-ask-panel-vjymeavp.js")).StudioAskPanel}));function u_(e,n){let{ask:o,editor:r,dispatchEditor:l}=e,{mode:a,body:c}=r;if(!o?.open||a.kind!=="edit"||!n.canAssist)return null;let d=n.entitySchema.fields,p=(m,g)=>{if(m.field==="selection"){let k=g?XI(c,g,m.text):null;if(k===null)return"The selected passage has changed. Select it again and ask once more.";return l({type:"bodyChanged",body:k}),null}if(m.field==="body")return l({type:"bodyChanged",body:m.text}),null;let b=d.find((k)=>k.name===m.field);if(!b)return`This entry has no ${m.label.toLowerCase()}.`;return l({type:"fieldChanged",descriptor:b,raw:m.text}),null};return At.jsxDEV(J0.Suspense,{fallback:null,children:At.jsxDEV(a_,{chatApiPath:o.chatApiPath,draftStore:o.draftStore,entityType:n.selectedEntityType,entityId:a.entity.id,title:n.editorHead.title,typeLabel:n.entryLabel.toLowerCase(),savedBody:a.entity.body,unsaved:e.hasUnsavedChanges,selection:o.selection,onClearSelection:()=>o.setSelection(null),fields:KI(d),agents:e.agentTargets,onApply:p,onClose:()=>o.setOpen(!1)},`${n.selectedEntityType}:${a.entity.id}`,!1,void 0,this)},void 0,!1,void 0,this)}var uo=G(Xe(),1);function Uw(e,n){return e.toLowerCase().includes(n.toLowerCase())}function i8(e){let n=e.query.trim(),o=e.openEntry&&e.hasChat?[{id:"ask-entry",title:`Ask about this ${e.openEntry.typeLabel}`,kbd:"⌘J",command:{kind:"ask-entry"}}].filter((b)=>!n||Uw(b.title,n)):[],r=e.types.filter((b)=>b.canCreate&&!b.isSingleton&&b.classification!=="system"),l=r.map(n8),a=r.flatMap((b)=>[...(b.starters??[]).map((k)=>({id:`create:${b.entityType}:${k.id}`,title:`New ${Pw(b)}: ${k.label}`,sub:k.description,command:{kind:"create",entityType:b.entityType,starter:k.id}})),n8(b)]),c={id:"climate",title:"Switch light and dark",command:{kind:"climate"}},d=n?[...[...a,c].filter((b)=>Uw(b.title,n)||b.sub!==void 0&&Uw(b.sub,n)),...e.hasChat?[{id:"ask-brain",title:`Ask your brain “${n}”`,command:{kind:"ask-brain",question:n}}]:[]]:[...l.slice(0,3),c],p=(e.remote?.groups??[]).map((b)=>({id:b.id,label:b.label,items:b.items.map((k)=>({id:`${b.id}:${k.id}`,title:k.title,sub:k.sub,command:k.run?{kind:"run",...k.run,href:k.href}:{kind:"open",href:k.href}}))})),m=p.filter((b)=>b.id==="actions").flatMap((b)=>b.items),g=[...d,...m];return[...o.length>0&&e.openEntry?[{id:"for-open",label:`For this ${e.openEntry.typeLabel}`,items:o}]:[],...g.length>0?[{id:"actions",label:"Actions",items:g}]:[],...p.filter((b)=>b.id!=="actions")].filter((b)=>b.items.length>0)}function o8(e,n,o){if(o===0)return-1;return((e+n)%o+o)%o}function Pw(e){return e.singularLabel.toLowerCase()}function n8(e){return{id:`create:${e.entityType}`,title:`New ${Pw(e)}`,...(e.starters?.length??0)>0&&{sub:`Empty ${Pw(e)}`},command:{kind:"create",entityType:e.entityType}}}var ao={content:{kB7OPa:"x9f619",kzqmXN:"xcs98ov",kskxy:"xu180u2",kmVPX3:"x1717udv",k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kVQacm:"xb3r6kr",kMv6JI:"x5ddh9m",$$css:!0},field:{k8WAf4:"x10dr8xq",kg3NbH:"x1hr3lfm",kt9PQ7:"xso031l",kfdmCh:"x1q0q8m5",kL6WhQ:"xpqg30t",$$css:!0},input:{kB7OPa:"x9f619",kzqmXN:"xh8yej3",kMzoRj:"xc342km",ksu8eU:"xng3xce",k3XXqK:"x1t137rt",kWkggS:"xjbqb8w",kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",kGuDYH:"x1j61zf2",$$css:!0},list:{kORKVm:"x1odjw0f",k8WAf4:"x1t0vds8",kogj98:"x1ghz6dp",$$css:!0},section:{k8WAf4:"x12ulsxz",$$css:!0},label:{kogj98:"x1ghz6dp",k8WAf4:"x1t0vds8",kg3NbH:"x1hr3lfm",kGuDYH:"x1j6dyjg",kb6lSQ:"x1vyo3qp",kP9fke:"xtvhhri",kMwMTN:"xqvuw85",kMv6JI:"xa9opjo",$$css:!0},item:{k1xSpc:"x78zum5",kGNEyG:"x1pha0wt",kOIVth:"x883omv",k8WAf4:"x1vvogim",kg3NbH:"x1hr3lfm",kMwMTN:"xqvuw85",kkrTdU:"x1ypdohk",$$css:!0},active:{kWkggS:"x9kxhyz",$$css:!0},title:{kGuDYH:"xif65rj",$$css:!0},sub:{kGuDYH:"xfifm61",kMwMTN:"xqvuw85",$$css:!0},kbd:{k1xSpc:"x15n0non xkaaz9w",keTefX:"xvc5jky",kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",kMwMTN:"xqvuw85",$$css:!0},empty:{kogj98:"x1ghz6dp",k8WAf4:"x1xn8qrt",kg3NbH:"x1hr3lfm",kGuDYH:"x4z9k3i",kMwMTN:"x1ar3pfp",$$css:!0}};var gi=G(fe(),1),c_=150;function s8(e){let n=Nt(),o=uo.useId(),[r,l]=uo.useState(!1),[a,c]=uo.useState(""),[d,p]=uo.useState(null),[m,g]=uo.useState(0),[b,k]=uo.useState(null),[S,C]=uo.useState(null);uo.useEffect(()=>{let L=(Q)=>{if(Q.key.toLowerCase()!=="k"||!(Q.metaKey||Q.ctrlKey)||Q.altKey||Q.shiftKey)return;Q.preventDefault(),l((F)=>!F)},P=()=>l(!0);return window.addEventListener("keydown",L),window.addEventListener(_w,P),()=>{window.removeEventListener("keydown",L),window.removeEventListener(_w,P)}},[]),uo.useEffect(()=>{if(!r)return;let L=!0,P=window.setTimeout(()=>{n.fetchPalette(a).then((Q)=>{if(L)p(Q)}).catch(()=>{if(L)p(null)})},c_);return()=>{L=!1,window.clearTimeout(P)}},[n,r,a]);let A=uo.useMemo(()=>i8({query:a,types:e.types,hasChat:e.hasChat,openEntry:e.openEntry,remote:d}),[a,e.types,e.hasChat,e.openEntry,d]),D=A.flatMap((L)=>L.items),T=Math.min(m,D.length-1),I=()=>{l(!1),c(""),g(0),C(null)},H=(L)=>{if(L.kind!=="run"){I(),e.onCommand(L);return}if(b)return;k(L.actionId),C(null),Promise.resolve(e.onCommand(L)).then(I).catch((P)=>C(Ln(P))).finally(()=>k(null))},_=(L)=>{if(L.key==="ArrowDown"||L.key==="ArrowUp")L.preventDefault(),g(o8(T,L.key==="ArrowDown"?1:-1,D.length));else if(L.key==="Enter"){let P=D[T];if(!P)return;L.preventDefault(),H(P.command)}};return gi.jsxDEV(Ma,{open:r,onOpenChange:(L)=>{if(!L)I()},children:gi.jsxDEV(Ra,{"aria-describedby":void 0,"data-studio-palette":"",...E(ao.content),children:[gi.jsxDEV(r8.Root,{children:gi.jsxDEV(Oa,{children:"Search or run a command"},void 0,!1,void 0,this)},void 0,!1,void 0,this),gi.jsxDEV("div",{...E(ao.field),children:gi.jsxDEV("input",{...E(ao.input),role:"combobox","aria-expanded":"true","aria-controls":o,"aria-activedescendant":D[T]?`${o}-${T}`:void 0,"aria-label":"Search or run a command",placeholder:"Search or do…",value:a,autoFocus:!0,onChange:(L)=>{c(L.currentTarget.value),g(0)},onKeyDown:_},void 0,!1,void 0,this)},void 0,!1,void 0,this),(b??S)&&gi.jsxDEV("p",{...E(ao.empty),role:"status",children:b?"Running…":S},void 0,!1,void 0,this),gi.jsxDEV("div",{...E(ao.list),id:o,role:"listbox",children:D.length===0?gi.jsxDEV("p",{...E(ao.empty),children:["Nothing matches “",a.trim(),"”."]},void 0,!0,void 0,this):A.map((L)=>gi.jsxDEV("div",{role:"group","aria-labelledby":`${o}-${L.id}`,...E(ao.section),children:[gi.jsxDEV("div",{id:`${o}-${L.id}`,role:"presentation",...E(ao.label),children:L.label},void 0,!1,void 0,this),L.items.map((P)=>{let Q=D.indexOf(P);return gi.jsxDEV("div",{id:`${o}-${Q}`,role:"option","aria-selected":Q===T,"data-palette-item":P.id,...E(ao.item,Q===T&&ao.active),onMouseMove:()=>g(Q),onClick:()=>H(P.command),children:[gi.jsxDEV("span",{...E(ao.title),children:P.title},void 0,!1,void 0,this),P.sub&&gi.jsxDEV("span",{...E(ao.sub),children:P.sub},void 0,!1,void 0,this),P.kbd&&gi.jsxDEV("kbd",{...E(ao.kbd),children:P.kbd},void 0,!1,void 0,this)]},P.id,!0,void 0,this)})]},L.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function l8(e,n,o){return{studioChatHandoff:{version:1,sourceId:e,itemId:n,label:o,prompt:"Help me understand this Inbox item and decide what to do next."}}}var d_=500;function a8(e){return{studioChatQuestion:{version:1,question:e.trim()}}}function u8(e){if(typeof e!=="object"||e===null)return null;let n=Reflect.get(e,"studioChatQuestion");if(typeof n!=="object"||n===null)return null;let o=Reflect.get(n,"question");if(Reflect.get(n,"version")!==1||typeof o!=="string"||o.trim().length===0||o.length>d_)return null;return o.trim()}function c8(e){if(typeof e!=="object"||e===null)return null;let n=Reflect.get(e,"studioChatHandoff");if(typeof n!=="object"||n===null)return null;let o=Reflect.get(n,"version"),r=Reflect.get(n,"sourceId"),l=Reflect.get(n,"itemId"),a=Reflect.get(n,"label"),c=Reflect.get(n,"prompt");if(o!==1||typeof r!=="string"||!/^[a-z][a-z0-9-]*$/.test(r)||r.length>64||typeof l!=="string"||l.trim().length===0||l.length>300||typeof a!=="string"||a.trim().length===0||a.length>160||typeof c!=="string"||c.trim().length===0||c.length>1e4)return null;return{sourceId:r,itemId:l,label:a,prompt:c}}function Na(e){if(e instanceof Do)switch(e.status){case 401:return"Your session is no longer authenticated. Sign in again in another tab, then retry here. Keep this tab open to preserve your draft.";case 403:return"You do not currently have permission to read this content. Ask an administrator to check access, then retry.";case 404:return"This content is unavailable. It may have moved, been removed, or be outside your access. Choose another destination or retry.";case 429:return"Studio is receiving too many requests. Wait briefly before retrying."}return`Studio could not load this data. Check your connection or retry later. ${Ln(e)}`}var Z0=G(Xe(),1);var f_=Cs.parse({});function d8(e){let n=Nt(),o=Z0.useMemo(()=>e.filter((d)=>!d.rules?.values),[e]),r=Z0.useMemo(()=>o.map((d)=>fy(n,d.key,f_)),[n,o]),l=H0({queries:r}),a={};l.forEach((d,p)=>{let m=o[p];if(m&&d.isSuccess&&d.data.kind==="catalog")a[m.field]=d.data.values.map((g)=>g.value)});let c=JSON.stringify(a);return Z0.useMemo(()=>JSON.parse(c),[c])}var Vw=G(Xe(),1);var f8=new Set(["offset","limit"]);function h8(e,n){if(e?.urlQuery!==!0)return{};let o={};for(let[r,l]of new URLSearchParams(n))if(!f8.has(r))o[r]=l;return o}function jw(e){let n=new URLSearchParams,o=Object.entries(e).filter(([l,a])=>!f8.has(l)&&a!==void 0&&(typeof a!=="number"||Number.isFinite(a))).sort(([l],[a])=>l.localeCompare(a));for(let[l,a]of o)n.set(l,String(a));let r=n.toString();return r?`?${r}`:""}function El(e,n){return`${e}${jw(n)}`}function eb(e,n,o,r){if(r!==n)return;e.replace(El(n,o))}var h_=[],p_=[],m_=[],g_={};function C8(e){let{api:n,entityType:o,activeWorkspaceId:r,routeSearch:l,workspaceQueries:a,editor:c}=e,{mode:d,draft:p,body:m}=c,g=Xt(k8(n)),b=g.data?.types??null,k=g.data?.groupings??h_,S=b?.find((In)=>In.entityType===o),C=b?S?.containedIn??o:null,A=S?.capabilities,D=Vw.useMemo(()=>S?.isSingleton?Kd("?scope=collection"):Kd(l),[S?.isSingleton,l]),T=D.offset,I=g.data?.workspaces??m_,H=I.find((In)=>In.id===r),_=H?.rendererName===m8,L=H?.rendererName===Ku,P=H?.rendererName==="DeclarativeOperatorWorkspace"&&H.id!==_p,Q=r?a[r]:void 0,F=H?.urlQuery!==!0||Q?.urlSearch===l,we=Vw.useMemo(()=>h8(H,l),[H,l]),J=r?Q&&F?Q.query:we:g_,Z=Xt({...S8(n,r??"",J),enabled:P}),oe=Z.data??null,Te=oe?.data??null,Rt=Z.error?Na(Z.error):null,K=d.kind==="edit"?d.entity.id:null,le=Xt({...x8(n,o??"",K??""),enabled:o!==null&&K!==null&&A?.canAssist===!0&&A.canUpdate}),se=le.data??p_,ge=Xt({...w8(n),enabled:o!==null}),De=ge.data??null,ct=Xt({...nb(n,C??"",D),enabled:C!==null}),Et=C?ct.data?.entities??null:null,zt=ct.data?.total,pe=Xt({...tb(n,o??"",S?.fieldsPerEntry===!0?K:null),enabled:o!==null&&(K===null||b!==null)}),ze=o?pe.data??null:null,Tt=p8(d),li=Xt(v8(n,o&&Tt&&d.kind==="create"&&d.segment?{entityType:o,idPath:Tt,frontmatter:ib(ze?.fields??[],p),...ze?.hasBody&&{body:m}}:null));Xt({...Zd(n,o??"",K??""),enabled:o!==null&&K!==null});let Bs=or({mutationFn:(In)=>b8(n,In)}),Ns=or({mutationFn:(In)=>y8(n,In)}),Uo=or({mutationFn:(In)=>g8(n,In)}),zs=Ns.isPending,ce=P&&oe?oe.data:null;return{navigationQuery:g,types:b,groupings:k,activeType:S,collectionType:C,activeCapabilities:A,entityCollectionQuery:D,entityListOffset:T,workspaces:I,activeWorkspace:H,activeAccount:_,activeChat:L,activeDeclarativeWorkspace:P,storedWorkspaceQuery:Q,storedQueryMatchesLocation:F,initialUrlWorkspaceQuery:we,workspaceRequestQuery:J,workspaceQuery:Z,workspaceResponse:oe,workspaceData:Te,workspaceError:Rt,activeEntityId:K,agentTargetsQuery:le,agentTargets:se,syncStatusQuery:ge,syncStatus:De,entityListQuery:ct,entities:Et,entityListTotal:zt,entitySchemaQuery:pe,schema:ze,createPath:Tt,destinationQuery:li,saveEntityMutation:Bs,deleteEntityMutation:Ns,declarativeWorkspaceActionMutation:Uo,deleting:zs,declarativeWorkspaceData:ce}}var qo=G(Xe(),1);var A8=(e)=>Ii.string().trim().min(1).max(e).refine((n)=>!/[\p{Cc}\p{Cf}]/u.test(n)),y_=(e)=>Ii.string().trim().min(1).max(e).refine((n)=>Array.from(n).every((o)=>o===`
|
|
263
263
|
`||o==="\t"||!/[\p{Cc}\p{Cf}]/u.test(o))),b_=Ii.strictObject({version:Ii.literal(2),entityType:Ii.literal("note"),title:A8(160),body:y_(1000).optional(),backlink:A8(500).regex(/^entity:\/\/[^/]+\/.+$/)}),Gw=Ii.looseObject({studioCreatePrefill:b_});function E8(e,n,o){return Gw.parse({studioCreatePrefill:{version:2,entityType:"note",title:e,...o?{body:o}:{},backlink:n}})}function T8(e){let{history:n,studioBasePath:o,routeSearch:r,entityType:l,collectionType:a,entityCollectionQuery:c,groupReturnPath:d,workspaces:p,schema:m,activeCapabilities:g,pendingOpenState:b,setFieldAssistState:k,setWorkspaceQueries:S}=e,C=a??l,A=qo.useCallback((Z,oe)=>{let Te=_n(o,Z,oe);b.current={pathname:Te,save:{kind:"idle"}},n.push(Te,{studioCollectionPath:qi(o,Z)})},[o,n]),D=qo.useCallback((Z,oe,Te,Rt)=>{n.push(sb(o,"note"),E8(Z,`entity://${encodeURIComponent(Te)}/${encodeURIComponent(Rt)}`,oe))},[o,n]),T=qo.useCallback((Z,oe,Te)=>{if(p.some((Rt)=>Rt.rendererName===Ku)){n.push(ob(o),l8(Z,oe,Te));return}},[n,o,p]),I=qo.useCallback((Z)=>{if(p.some((oe)=>oe.rendererName===Ku))n.push(ob(o),a8(Z))},[n,o,p]),H=qo.useCallback((Z)=>{switch(Z.target){case"account-settings":{n.push(si(o,rb));return}case"invitations":n.push(El(si(o,"admin:administration"),{tab:"invitations"}));return;case"admin-peer-invite":{n.push(El(si(o,"admin:administration"),{tab:"invitations",peerId:Z.peerId,displayName:Z.displayName}));return}case"inbox":{let oe={};if("source"in Z){if(oe.sourceId="mail-items",Z.filter==="high-priority")oe["facet.mail-priority"]="high";else if(Z.filter==="needs-reply")oe["facet.needs-reply"]="true";else if(Z.filter==="unclassified")oe["facet.category"]="unclassified"}n.push(El(si(o,"unified-inbox:inbox"),oe));return}case"publishing":n.push(si(o,"content-pipeline:publishing"));return;case"site":n.push(si(o,"site-builder:site"));return;case"traffic":n.push(si(o,"analytics:traffic"));return;case"board":n.push(si(o,"action-board:board"));return;case"memory":n.push(El(si(o,"conversation-memory:memory"),{...Z.channel?{channel:Z.channel}:{},...Z.selected?{selected:Z.selected}:{}}));return;case"inbox-track-action-item":n.push(El(si(o,"action-board:board"),{trackSource:Z.sourceId,trackType:Z.entityType,trackId:Z.entityId,trackTitle:Z.title.slice(0,160),trackSummary:(Z.summary??"").slice(0,500)}));return;case"inbox-open-entity":A(Z.entityType,Z.entityId);return;case"inbox-capture-note":D(Z.title,Z.summary,Z.entityType,Z.entityId);return;case"inbox-discuss-in-chat":T(Z.sourceId,Z.itemId,Z.label);return;case"ask-in-chat":I(Z.question)}},[I,D,o,T,A,r,n]),_=qo.useCallback((Z)=>{n.push(qi(o,Z)),window.scrollTo({top:0,left:0})},[o,n]),L=qo.useCallback((Z)=>{if(!C)return;n.push(`${qi(o,C)}${ri({...c,offset:Z})}`),window.scrollTo({top:0,left:0})},[C,c,o,n]),P=qo.useCallback((Z)=>{n.push(Z===lb?ob(o):si(o,Z)),window.scrollTo({top:0,left:0})},[o,n]),Q=qo.useCallback((Z)=>{if(!C)return;n.push(`${qi(o,C)}${ri({...c,prefix:Z,offset:0})}`),window.scrollTo({top:0,left:0})},[C,o,c,n]),F=qo.useCallback((Z)=>{if(!m||!l||g?.canCreate!==!0)return;let oe=new URLSearchParams(ri(c));if(oe.set("mode","create"),Z!==void 0)oe.set("starter",Z);n.push(`${qi(o,l)}?${oe.toString()}`,{studioCollectionPath:`${qi(o,l)}${ri(c)}`}),k({kind:"idle"})},[g,m,l,c,o,n]),we=qo.useCallback(()=>{if(d){if(n.canGoBack())n.back();else n.replace(d);return}if(!C)return;let Z=`${qi(o,C)}${ri(c)}`,oe=n.location.state;if(typeof oe==="object"&&oe!==null&&"studioCollectionPath"in oe&&oe.studioCollectionPath===Z&&n.canGoBack()){n.back();return}n.replace(Z)},[o,C,c,n,d]),J=qo.useCallback((Z,oe,Te)=>{let Rt=p.find((le)=>le.id===Z),K=Rt?.urlQuery===!0?r:void 0;if(Rt?.urlQuery===!0&&Te!==void 0){let le=si(o,Z);K=jw(Te),eb(n,le,Te,window.location.pathname)}S((le)=>({...le,[Z]:{query:oe,...K!==void 0?{urlSearch:K}:{}}}))},[o,r,n,p]);return{openWorkspaceEntity:A,captureInboxAsNote:D,discussInboxInChat:T,openWorkspaceLaunch:H,selectEntityType:_,changeEntityPage:L,selectWorkspace:P,selectFolder:Q,startCreate:F,backToList:we,changeWorkspaceQuery:J}}var Ui=G(Xe(),1);function D8(e){let{studioCreatePrefill:n,...o}=e;return o}function M8(e,n,o){let r=Gw.safeParse(e);if(!r.success||r.data.studioCreatePrefill.entityType!==n)return;return o(),{title:r.data.studioCreatePrefill.title,...r.data.studioCreatePrefill.body?{body:r.data.studioCreatePrefill.body}:{},backlink:r.data.studioCreatePrefill.backlink}}function R8(e,n){let o=jp(e);if(!n)return{draft:o,body:""};if(e.some((l)=>l.name==="title"))o.title=n.title;let r=`## Source
|
|
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-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))}
|
|
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-ak5tfxgg.js")).AccountApp}))),S_=ut.lazy(()=>Jk(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-kzcn37qq.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
|