1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[410],{44838:function(e,n,t){t.r(n),t.d(n,{Delay:function(){return _e},DocumentPane:function(){return ei},DocumentPaneProvider:function(){return fn},index:function(){return li},useDeskTool:function(){return Ae},useDeskToolSetting:function(){return Bn}});var i,o,s,a,r,l,c,d,u,p,h,m,f,x,g,v,j,y,b,w,C,k,P,S,I,_,E,z=t(41844),T=t(55784),M=t(11636),L=t(88710),R=t(57557),O=t.n(R),F=t(9141),B=t(40052),N=t(32817),W=t(1718),D=t(69243),Z=t(9653),A=t(70003),K=t(23071),U=t(53416),V=t(40148),H=t(30218),X=t(34978),$=t(29127),q=t(98430),Y=t(26472),J=t(56542),G=t(53741),Q=t(93833),ee=t(46297),ne=t(42965),te=t(79878),ie=t(42006),oe=t(32932),se=t(38063),ae=t(18446),re=t.n(ae),le=t(933),ce=t(25934),de=t(14141),ue=t(25088),pe=(t(68929),t(44908),t(21804),t(35937),t(13311),t(73955),t(59864)),he=(t(18029),t(18156)),me=t(66996),fe=t(42930),xe=(t(81763),t(47037),t(28440)),ge=t(30222),ve=t(11700),je=t.n(ve),ye=t(34391),be=t.n(ye),we=t(70248),Ce=t.n(we),ke=t(94885),Pe=t.n(ke),Se=t(25684);function Ie(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function _e(e){let{children:n,ms:t=0}=e;const[i,o]=(0,T.useState)(t<=0);return(0,T.useEffect)((()=>{if(t<=0)return;const e=setTimeout((()=>o(!0)),t);return()=>{clearTimeout(e)}}),[t]),i&&n?"function"===typeof n?n():n:(0,z.jsx)(z.Fragment,{})}const Ee=e=>{const{actions:n,children:t,actionProps:i,onActionComplete:o}=e;return(0,z.jsx)(oe.duV,{onReset:o,hooks:n,args:i,children:t})},ze=e=>{const{badges:n,children:t,badgeProps:i,...o}=e;return(0,z.jsx)(oe.duV,{...o,hooks:n,args:i,children:t})},Te=[];function Me(e){const{children:n,flatIndex:t,index:i,params:o,payload:s,siblingIndex:a}=e,{navigate:r,navigateIntent:l}=(0,le.tv)(),c=(0,le.z)(),d=(0,T.useMemo)((()=>(null==c?void 0:c.panes)||Te),[null==c?void 0:c.panes]),u=i-1,p=(0,T.useCallback)((e=>{const n=d[u]||[],t=e(n,n[a]),i=[...d.slice(0,u),t,...d.slice(u+1)],o={...c||{},panes:i};return setTimeout((()=>r(o)),0),o}),[u,r,d,c,a]),h=(0,T.useCallback)((e=>{p(((n,t)=>[...n.slice(0,a),{...t,payload:e},...n.slice(a+1)]))}),[p,a]),m=(0,T.useCallback)((e=>{p(((n,t)=>[...n.slice(0,a),{...t,params:e},...n.slice(a+1)]))}),[p,a]),f=(0,T.useCallback)((e=>{let{id:n,parentRefPath:t,type:i,template:o}=e;r({panes:[...d.slice(0,u+1),[{id:n,params:{template:o.id,parentRefPath:(0,me.BB)(t),type:i},payload:o.params}]]})}),[u,r,d]),x=(0,T.useMemo)((()=>({index:t,groupIndex:u,siblingIndex:a,payload:s,params:o,hasGroupSiblings:!!d[u]&&d[u].length>1,groupLength:d[u]?d[u].length:0,routerPanesState:d,ChildLink:L.aL,BackLink:L.hb,ReferenceChildLink:L.HZ,handleEditReference:f,ParameterizedLink:L.V$,replaceCurrent:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};p((()=>[{id:e.id||"",payload:e.payload,params:e.params||{}}]))},closeCurrent:()=>{p(((e,n)=>e.length>1?e.filter((e=>e!==n)):e))},duplicateCurrent:e=>{p(((n,t)=>{const i={...t,payload:(null==e?void 0:e.payload)||t.payload,params:(null==e?void 0:e.params)||t.params};return[...n.slice(0,a),i,...n.slice(a)]}))},setView:e=>{const n=O()(o,"view");return m(e?{...n,view:e}:n)},setParams:m,setPayload:h,navigateIntent:l})),[t,u,f,p,l,o,s,d,m,h,a]);return(0,z.jsx)(L.ud.Provider,{value:x,children:n})}function Le(e,n){const t=[];let i=n;for(;i!==e;){const n=i.parentElement;if(!n)return t;const o=Array.from(n.childNodes).indexOf(i);if(t.unshift(o),n===e)return t;i=n}return t}const Re=[];function Oe(){const e=[],n=[],t=new WeakMap,i=new Set,o={};let s=null,a=0,r=null,l=new Map,c=!1;function d(e){i.delete(e),r=e,u()}return{collapse:function(e){i.add(e),r===e&&(r=null),u()},expand:d,mount:function(e,i){return t.set(e,{...i,original:i}),n.push(e),s&&function(e,n){const t=new WeakMap;for(const i of n)t.set(i,Le(e,i));n.sort(((e,n)=>{const i=t.get(e)||Re,o=t.get(n)||Re,s=Math.max(i.length,o.length);for(let t=0;t<s;t+=1){const e=i[t]||-1,n=o[t]||-1;if(e!==n)return e-n}return 0}))}(s,n),d(e),()=>{const i=n.indexOf(e);i>-1&&n.splice(i,1),t.delete(e),u()}},resize:function(e,i,s){var a,r,d,p;const h=n.indexOf(i),m=t.get(i);if(!m)return;const f=n[h+1],x=t.get(f);
1if(x){if("start"===e&&(c=!0,o.left={element:i,flex:m.flex||1,width:i.offsetWidth},o.right={element:f,flex:x.flex||1,width:f.offsetWidth},u()),"move"===e&&o.left&&o.right){l=new Map;const{leftW:e,rightW:n,leftFlex:t,rightFlex:a}=function(e,n,t,i){var o,s;const a=e.left.flex+e.right.flex,r=e.left.width+e.right.width,l=null!=(o=n.minWidth)?o:L.nR,c=null!=(s=t.minWidth)?s:L.nR,d=Math.min(n.maxWidth||1/0,r-c),u=Math.min(t.maxWidth||1/0,r-l);let p=l-e.left.width;const h=e.right.width-u;p<h&&(p=h);let m=e.right.width-c;const f=d-e.left.width;m>f&&(m=f);const x=Math.min(Math.max(i,p),m),g=e.left.width+x,v=e.right.width-x;return{leftFlex:g/r*a,leftW:g,rightFlex:v/r*a,rightW:v}}(o,m,x,s);l.set(i,{flex:t,width:e}),l.set(f,{flex:a,width:n}),u()}if("end"===e){c=!1;const e=l.get(i),n=l.get(f);t.set(i,{...m,currentMinWidth:0,currentMaxWidth:null!=(a=m.maxWidth)?a:1/0,flex:null!=(r=null==e?void 0:e.flex)?r:m.flex}),t.set(f,{...x,currentMinWidth:0,currentMaxWidth:null!=(d=m.maxWidth)?d:1/0,flex:null!=(p=null==n?void 0:n.flex)?p:x.flex}),l=new Map,delete o.left,delete o.right,u()}}},setRootElement:function(e){s=e},setRootWidth:function(e){a=e,u()},subscribe:function(n){return e.push(n),()=>{const t=e.push(n);t>-1&&e.splice(t,1)}}};function u(){var o,s,d,u;if(!a)return;const p=[];for(const e of n)e!==r&&p.unshift(e);r&&p.unshift(r);const h=new WeakMap,m=p.length,f=p[0],x=(m-1)*L.AA;let g=a-x;for(const e of p){const n=t.get(e);if(!n)continue;const a=n.currentMinWidth||n.minWidth||L.nR,r=e===f,c=i.has(e),p=a>g,m=!r&&(c||p),x=l.get(e);h.set(e,{element:e,collapsed:m,currentMinWidth:null!=(o=null==x?void 0:x.width)?o:n.currentMinWidth,currentMaxWidth:null!=(s=null==x?void 0:x.width)?s:n.currentMaxWidth,flex:null!=(u=null!=(d=null==x?void 0:x.flex)?d:n.flex)?u:1}),g-=m?L.AA:a-L.AA}const v=[];for(const e of n){const n=h.get(e);n&&v.push(n)}for(const t of e)t({expandedElement:r||n[n.length-1]||null,panes:v,resizing:c})}}class Fe extends Error{constructor(e){let{message:n,context:t,helpId:i,cause:o}=e;super(n),this.context=t,this.helpId=i,this.cause=o}}const Be=new WeakMap;function Ne(e){const n=Be.get(e);if(n)return n;const t=(0,U.x0)();return Be.set(e,t),t}const We=new WeakMap;function De(e,n){const t=We.get(e)||new Map;if(t){const e=t.get(n);if(e)return e}const i=e[n];if("function"!==typeof i)throw new Error("Expected property `".concat(n,"` to be a function but got ").concat(typeof i," instead."));const o=i.bind(e);return t.set(n,o),We.set(e,t),o}function Ze(e){const n=(e=>(n,t,i)=>{try{return e(n,t,i)}catch(o){if(o instanceof Fe)throw o;throw new Fe({message:"string"===typeof(null==o?void 0:o.message)?o.message:"",context:t,cause:o})}})((t=e(((e,t,i)=>{if(!e)throw new Fe({message:"Pane returned no child",context:t,helpId:"structure-item-returned-no-child"});return(o=e)&&"function"===typeof(null==o?void 0:o.then)||(0,F.b)(e)?(0,B.D)(e).pipe((0,X.w)((e=>n(e,t,i)))):(e=>!!(0,oe.Uy$)(e)&&"function"===typeof e.serialize)(e)?n(e.serialize(t),t,i):"function"===typeof e?n(e(t.id,t),t,i):(0,N.of)(e);var o})),function(){return t(...arguments).pipe((0,V._)(1),(0,H.x)())}));var t;return n}function Ae(){const e=(0,T.useContext)(L.zJ);if(!e)throw new Error("DeskTool: missing context value");return e}const Ke=(e,n)=>{const t=e.replace(/^__edit__/,""),{params:i,payload:o,structureContext:{resolveDocumentNode:s}}=n,{type:a,template:r}=i;if(!a)throw new Error("Document type for document with ID ".concat(t," was not provided in the router params."));let l=s({schemaType:a,documentId:t});return l=l.id("editor").title("Editor"),r&&(l=l.initialValueTemplate(r,o)),l.serialize()};const Ue=e=>{const n={type:e.type,id:e.routerPaneSibling.id,params:e.routerPaneSibling.params||{},payload:e.routerPaneSibling.payload||null,flatIndex:e.flatIndex,groupIndex:e.groupIndex,siblingIndex:e.siblingIndex,path:e.path,paneNode:"resolvedMeta"===e.type?Ne(e.paneNode):null};return"metaHash(".concat(JSON.stringify(n),")")};function Ve(e){let{unresolvedPane:n,flattenedRouterPanes:t,parent:i,path:o,resolvePane:s,structureContext:a}=e;const[r,...l]=t,c=l[0],d={id:r.routerPaneSibling.id,splitIndex:r.
1siblingIndex,parent:i,path:[...o,r.routerPaneSibling.id],index:r.flatIndex,params:r.routerPaneSibling.params||{},payload:r.routerPaneSibling.payload,structureContext:a};try{return s(n,d,r.flatIndex).pipe((0,X.w)((e=>{const t={type:"resolvedMeta",...r,paneNode:e,path:d.path},u=l.map(((e,n)=>({type:"loading",path:[...d.path,...l.slice(n).map(((n,t)=>"[".concat(e.flatIndex+t,"]")))],paneNode:null,...e})));if(!l.length)return(0,N.of)([t]);let p;return p=(null==c?void 0:c.routerPaneSibling.id.startsWith("__edit__"))?Ve({unresolvedPane:Ke,flattenedRouterPanes:l,parent:i,path:d.path,resolvePane:s,structureContext:a}):r.groupIndex===(null==c?void 0:c.groupIndex)?Ve({unresolvedPane:n,flattenedRouterPanes:l,parent:i,path:o,resolvePane:s,structureContext:a}):Ve({unresolvedPane:"function"===typeof e.child?De(e,"child"):e.child,flattenedRouterPanes:l,parent:e,path:d.path,resolvePane:s,structureContext:a}),(0,D.z)((0,N.of)([t,...u]),p.pipe((0,$.U)((e=>[t,...e]))))})))}catch(u){if(u instanceof Fe&&(u.context&&console.warn("Pane resolution error at index ".concat(u.context.index).concat(u.context.splitIndex>0?" for split pane index ".concat(u.context.splitIndex):"",": ").concat(u.message).concat(u.helpId?" - see ".concat((0,se.h)(u.helpId)):""),u),"structure-item-returned-no-child"===u.helpId))return(0,N.of)([]);throw u}}function He(e){let{routerPanesStream:n,rootPaneNode:t,initialCacheState:i={cacheKeysByFlatIndex:[],flattenedRouterPanes:[],resolvedPaneCache:new Map,resolvePane:()=>Z.C},structureContext:o}=e;const s=n.pipe((0,$.U)((e=>[[{id:"root"}],...e])),(0,$.U)((e=>{const n=e.flatMap(((e,n)=>e.map(((e,t)=>({routerPaneSibling:e,groupIndex:n,siblingIndex:t}))))).map(((e,n)=>({...e,flatIndex:n})));return n})),(0,q.O)([]),(0,Y.G)(),(0,$.U)((e=>{let[n,t]=e;for(let i=0;i<t.length;i++){const e=n[i],o=t[i];if(!re()(e,o))return{flattenedRouterPanes:t,diffIndex:i}}return{flattenedRouterPanes:t,diffIndex:t.length}})),(0,J.R)(((e,n)=>{const{cacheKeysByFlatIndex:t,resolvedPaneCache:i}=e,{flattenedRouterPanes:o,diffIndex:s}=n,a=t.slice(0,s+1),r=t.slice(s+1),l=new Set(a.flatMap((e=>Array.from(e)))),c=r.flatMap((e=>Array.from(e))).filter((e=>!l.has(e)));for(const d of c)i.delete(d);return{flattenedRouterPanes:o,cacheKeysByFlatIndex:t,resolvedPaneCache:i,resolvePane:Ze((e=>(n,o,s)=>{const a=n&&"".concat(Ne(n),"-").concat(function(e){var n,t;return"contextHash(".concat(JSON.stringify({id:e.id,parentId:parent&&Ne(parent),path:e.path,index:e.index,splitIndex:e.splitIndex,serializeOptionsIndex:null==(n=e.serializeOptions)?void 0:n.index,serializeOptionsPath:null==(t=e.serializeOptions)?void 0:t.path}),")")}(o)),r=a&&i.get(a);if(r)return r;const l=e(n,o,s);if(!a)return l;const c=t[s]||new Set;return c.add(a),t[s]=c,i.set(a,l),l}))}}),i),(0,X.w)((e=>{let{flattenedRouterPanes:n,resolvePane:i}=e;return Ve({unresolvedPane:t,flattenedRouterPanes:n,parent:null,path:[],resolvePane:i,structureContext:o})})));return s.pipe((0,J.R)(((e,n)=>n.map(((n,t)=>{const i=e[t];return i?"loading"!==n.type?n:i.routerPaneSibling.id===n.routerPaneSibling.id?i:n:n}))),[]),(0,G.x)(((e,n)=>{if(e.length!==n.length)return!1;for(let t=0;t<n.length;t++){const i=e[t],o=n[t];if(Ue(i)!==Ue(o))return!1}return!0})))}function Xe(){const[e,n]=(0,T.useState)();if(e)throw e;const{structureContext:t,rootPaneNode:i}
1=Ae(),[o,s]=(0,T.useState)({paneDataItems:[],resolvedPanes:[],routerPanes:[]}),a=function(){const e=(0,T.useMemo)((()=>new A.t(1)),[]),n=(0,T.useMemo)((()=>e.asObservable().pipe((0,$.U)((e=>(null==e?void 0:e.panes)||[])))),[e]),{state:t}=(0,le.tv)();return(0,T.useEffect)((()=>{e.next(t)}),[t,e]),n}();return(0,T.useEffect)((()=>{const e=He({rootPaneNode:i,routerPanesStream:a,structureContext:t}).pipe((0,$.U)((e=>{const n=e.reduce(((e,n)=>{const t=e[n.groupIndex]||[];return t[n.siblingIndex]=n.routerPaneSibling,e[n.groupIndex]=t,e}),[]),t=n.length,i=e.map((i=>{var o;const{groupIndex:s,flatIndex:a,siblingIndex:r,routerPaneSibling:l,path:c}=i,d=l.id,u=n[s+1];return{active:s===t-2,childItemId:null!=(o=null==u?void 0:u[0].id)?o:null,index:a,itemId:l.id,groupIndex:s,key:"".concat("loading"===i.type?"unknown":i.paneNode.id,"-").concat(d,"-").concat(r),pane:"loading"===i.type?L.PF:i.paneNode,params:l.params||{},path:c.join(";"),payload:l.payload,selected:a===e.length-1,siblingIndex:r}}));return{paneDataItems:i,routerPanes:n,resolvedPanes:i.map((e=>e.pane))}}))).subscribe({next:e=>s(e),error:e=>n(e)});return()=>e.unsubscribe()}),[i,a,t]),o}function $e(e){let{panes:n}=e;const{navigate:t}=(0,le.tv)();return(0,T.useEffect)((()=>{t({panes:n},{replace:!0})}),[t,n]),(0,z.jsx)(M.Zb,{height:"fill",children:(0,z.jsx)(_e,{ms:300,children:(0,z.jsxs)(M.kC,{align:"center",direction:"column",height:"fill",justify:"center",children:[(0,z.jsx)(M.$j,{muted:!0}),(0,z.jsx)(M.xu,{marginTop:3,children:(0,z.jsx)(M.xv,{muted:!0,size:1,children:"Redirecting\u2026"})})]})})})}function qe(e){let{intent:n,params:t={},payload:i}=e;const{rootPaneNode:o,structureContext:s}=Ae(),a=(0,oe.H__)(),r=(0,oe.BoV)(t),l=(0,oe.BoV)(i),[c,d]=(0,T.useState)(null),[u,p]=(0,T.useState)(null),h="string"===typeof r.id?r.id:void 0,m="string"===typeof r.type?r.type:void 0;if((0,T.useEffect)((()=>{const e={current:!1};return async function(){const{id:e,type:t}=await async function(e,n,t){if(n&&t)return{id:n,type:t};if(!n&&t)return{id:(0,ce.Z)(),type:t};if(n&&!t)return{id:n,type:await(0,W.z)(e.resolveTypeForDocument(n))};throw new Fe({message:"Neither document `id` or `type` was provided when trying to resolve intent."})}(a,h,m);return async function(e){const n=new Map,t=Ze((e=>(t,i,o)=>{const s=t&&"".concat(Ne(t),"-").concat(i.path.join("__")),a=s&&n.get(s);if(a)return a;const r=e(t,i,o);return s&&n.set(s,r),r})),i=[[{id:"__edit__".concat(e.params.id),params:{...O()(e.params,["id"]),type:e.params.type},payload:e.payload}]],o=await async function e(n){let{currentId:i,flatIndex:o,intent:s,params:a,parent:r,path:l,payload:c,unresolvedPane:d,levelIndex:u,structureContext:p}=n;var h;if(!d)return[];const{id:m,type:f,...x}=a,g={id:i,splitIndex:0,parent:r,path:l,index:o,params:{},payload:void 0,structureContext:p},v=await(0,W.z)(t(d,g,o));return"document"===v.type&&v.id===m?[{panes:[...l.slice(0,l.length-1).map((e=>[{id:e}])),[{id:m,params:x,payload:c}]],depthIndex:l.length,levelIndex:u}]:(null==(h=v.canHandleIntent)?void 0:h.call(v,s,a,{pane:v,index:o}))||"documentList"===v.type&&v.schemaTypeName===f&&"_type == $type"===v.options.filter?[{panes:[...l.map((e=>[{id:e}])),[{id:a.id,params:x,payload:c}]],depthIndex:l.length,levelIndex:u}]:"list"===v.type&&v.child&&v.items?(await Promise.all(v.items.map(((n,t)=>"divider"===n.type?Promise.resolve([]):e({currentId:n._id||n.id,flatIndex:o+1,intent:s,params:a,parent:v,path:[...l,n.id],payload:c,unresolvedPane:"function"===typeof v.child?De(v,"child"):v.child,levelIndex:t,structureContext:p}))))).flat():[]}({currentId:"root",flatIndex:0,levelIndex:0,intent:e.intent,params:e.params,parent:null,path:[],payload:e.payload,unresolvedPane:e.rootPaneNode,structureContext:e.structureContext}),s=o.sort(((e,n)=>e.depthIndex===n.depthIndex?e.levelIndex-n.levelIndex:e.depthIndex-n.depthIndex))[0];return s?s.panes:i}({intent:n,params:{...r,id:e,type:t},payload:l,rootPaneNode:o,structureContext:s})}().then((n=>{e.current||d(n)})).catch(p),()=>{e.current=!0}}),[a,h,n,r,l,o,s,m]),u)throw u;return c?(0,z.jsx)($e,{panes:c}):(0,z.jsx)(M.Zb,{height:"fill",children:(0,z.jsx)(_e,{ms:300,children:(0,z.jsxs)(M.kC,{align:"center",direction:"column",height:"fill",justify:"center",children:[(0,z.jsx)(M.$j,{muted:!0}
1),(0,z.jsx)(M.xu,{marginTop:3,children:(0,z.jsx)(M.xv,{align:"center",muted:!0,size:1,children:"Loading\u2026"})})]})})})}const Ye=de.ZP.span(i||(i=Ie(["\n &:not(:last-child)::after {\n content: ' \u279d ';\n opacity: 0.5;\n }\n"])));function Je(e){return e.replace(/\(\.\.\.\)\./g,"(...)\n .").replace(/__WEBPACK_IMPORTED_MODULE_\d+_+/g,"").replace(/___default\./g,".").replace(new RegExp(" \\(https?:\\/\\/".concat(window.location.host),"g")," (")}function Ge(e){let{error:n}=e;if(!(n instanceof Fe))throw n;const{cause:t}=n,i=(null==t?void 0:t.stack)||n.stack,o=i&&!(t instanceof L.zc)&&!n.message.includes("Module build failed:"),s=t instanceof L.zc?t.path:[],a=t instanceof L.zc&&t.helpId||n.helpId,r=(0,T.useCallback)((()=>{window.location.reload()}),[]);return(0,z.jsx)(M.Zb,{height:"fill",overflow:"auto",padding:4,sizing:"border",tone:"critical",children:(0,z.jsxs)(M.W2,{children:[(0,z.jsx)(M.X6,{as:"h2",children:"Encountered an error while reading structure"}),(0,z.jsxs)(M.Zb,{marginTop:4,padding:4,radius:2,overflow:"auto",shadow:1,tone:"inherit",children:[s.length>0&&(0,z.jsxs)(M.Kq,{space:2,children:[(0,z.jsx)(M.__,{children:"Structure path"}),(0,z.jsx)(M.EK,{children:s.slice(1).map(((e,n)=>(0,z.jsx)(Ye,{children:e},"".concat(e,"-").concat(n))))})]}),(0,z.jsxs)(M.Kq,{marginTop:4,space:2,children:[(0,z.jsx)(M.__,{children:"Error"}),(0,z.jsx)(M.EK,{children:o?Je(i):n.message})]}),a&&(0,z.jsx)(M.xu,{marginTop:4,children:(0,z.jsx)(M.xv,{children:(0,z.jsx)("a",{href:(0,se.h)(a),rel:"noopener noreferrer",target:"_blank",children:"View documentation"})})}),(0,z.jsx)(M.xu,{marginTop:4,children:(0,z.jsx)(M.zx,{text:"Reload",icon:ue.bnu,tone:"primary",onClick:r})})]})]})})}function Qe(e){const{isSelected:n,pane:t,paneKey:i}=e,o=(0,oe.Uy$)(t)&&t.type||null;return(0,z.jsxs)(L.X6,{id:i,selected:n,children:[(0,z.jsx)(L.hX,{title:"Unknown pane type"}),(0,z.jsx)(L.Bh,{children:(0,z.jsx)(M.xu,{padding:4,children:"string"===typeof o?(0,z.jsxs)(M.xv,{as:"p",muted:!0,children:["Structure item of type ",(0,z.jsx)("code",{children:o})," is not a known entity."]}):(0,z.jsxs)(M.xv,{as:"p",muted:!0,children:["Structure item is missing required ",(0,z.jsx)("code",{children:"type"})," property."]})})})]})}function en(e){const n=[{ms:300,message:"Loading\u2026"},{ms:5e3,message:"Still loading\u2026"}];if(oe.r8Q){const t=["Check console for errors?","Is your observable/promise resolving?",e.length>0?"Structure path: ".concat(e.join(" \u279d ")):""];n.push({ms:1e4,message:t.join("\n")})}const t=(0,N.of)(null);return(0,K.T)(...n.map((e=>{let{ms:n,message:i}=e;return t.pipe((0,Q.h)(i),(0,ee.g)(n))})))}const nn=(0,de.ZP)(M.kC)(o||(o=Ie(["\n opacity: 0;\n transition: opacity 200ms;\n\n &[data-mounted] {\n opacity: 1;\n }\n"]))),tn=(0,T.memo)((e=>{const{delay:n=300,flex:t,message:i=en,minWidth:o,paneKey:s,path:a,selected:r,title:l,tone:c}=e,d=(0,T.useMemo)((()=>"function"===typeof i?i(a?a.split(";"):[]):i),[i,a]),[u,p]=(0,T.useState)((()=>"string"===typeof d?d:"Loading\u2026"));(0,T.useEffect)((()=>{if("object"!==typeof d)return;if("function"===typeof d.subscribe)return;const e=d.subscribe(p);return()=>e.unsubscribe()}),[d]);const[h,m]=(0,T.useState)(null),[f,x]=(0,T.useState)(!1);(0,T.useEffect)((()=>{if(h)return(0,M.RE)((()=>x(!0)))}),[h]);const g=(0,z.jsxs)(nn,{align:"center","data-mounted":f?"":void 0,direction:"column",height:"fill",justify:"center",ref:m,children:[(0,z.jsx)(M.$j,{muted:!0}),(l||u)&&(0,z.jsx)(M.xu,{marginTop:3,children:(0,z.jsx)(M.xv,{align:"center",muted:!0,size:1,children:l||u})})]});return(0,z.jsx)(L.X6,{flex:t,id:s,minWidth:o,selected:r,tone:c,children:(0,z.jsx)(L.Bh,{children:g})})}));tn.displayName="LoadingPane";const on={component:(0,T.lazy)((()=>t.e(134).then(t.bind(t,85134)))),document:(0,T.lazy)((()=>t.e(913).then(t.bind(t,15913)))),documentList:(0,T.lazy)((()=>t.e(336).then(t.bind(t,61336)))),list:(0,T.lazy)((()=>t.e(759).then(t.bind(t,64759))))},sn=(0,T.memo)((function(e){const{active:n,childItemId:t,groupIndex:i,index:o,itemId:s,pane:a,paneKey:r,params:l,payload:c,selected:d,siblingIndex:u}=e,p=on[a.type]||Qe;return(0,z.jsx)(Me,{flatIndex:o,index:i,params:l,payload:c,siblingIndex:u,children:(0,z.jsx)(T.Suspense,{fallback:(0,z.jsx)(tn,{paneKey:r}),children:(0,z.jsx)(p,{childItemId:t||"",index:o,itemId:s,isActive:n,isSelected:d,paneKey:r,pane:a})})})}),((e,n)=>{let{params:t={},payload:i=null,...o}=e,{params:s={},payload:a=null,...r}=n;if(!re()(t,s))return!1;if(!re()(i,a))return!1;const l=new Set([...Object.keys(o),...Object.keys(r)]);for(const c of l)if(o[c]!==r[c])return!1;return!0}));function an(e){const{children:n,flex:t,minWidth:i,paneKey:o,title:s="Error",tone:a="critical"}=e;
1return(0,z.jsxs)(L.X6,{flex:t,id:o,minWidth:i,tone:a,children:[(0,z.jsx)(L.hX,{title:s}),(0,z.jsx)(L.Bh,{overflow:"auto",children:(0,z.jsx)(M.xu,{paddingX:4,paddingY:5,children:n})})]})}function rn(e){return"publish"===e?"The document was published":"unpublish"===e?"The document was unpublished. A draft has been created from the latest published version.":"discardChanges"===e?"All changes since last publish has now been discarded. The discarded draft can still be recovered from history":"delete"===e?"This document was deleted. It can still be recovered from history and if you continue editing it will be recreated.":"Successfully performed ".concat(e," on document")}const ln=["patch","commit"],cn=(0,T.memo)((function(){const{push:e}=(0,M.pm)(),{documentId:n,documentType:t}=(0,L.Z3)(),i=(0,oe.E6V)(n,t),o=(0,T.useRef)(i);return(0,T.useEffect)((()=>{var n;i&&i!==o.current&&("error"===i.type&&e({closable:!0,duration:3e4,status:"error",title:(n=i.op,"delete"===n?"An error occurred while attempting to delete this document.\n This usually means that there are other documents that refers to it.":"unpublish"===n?"An error occurred while attempting to unpublish this document.\n This usually means that there are other documents that refers to it.":"An error occurred during ".concat(n)),description:(0,z.jsxs)("details",{children:[(0,z.jsx)("summary",{children:"Details"}),i.error.message]})}),"success"!==i.type||ln.includes(i.op)||e({closable:!0,status:"success",title:rn(i.op)}),o.current=i)}),[i,e]),null})),dn=e=>{const{features:n,hasValue:t,changesOpen:i}=e;return n.reviewChanges?{action:"reviewChanges",title:"Review changes",icon:ue.vaD,isDisabled:i||!t}:null},un=e=>{let{hasValue:n}=e;return{action:"inspect",title:"Inspect",icon:ue.bg6,isDisabled:!n,shortcut:"Ctrl+Alt+I"}},pn=e=>{let{previewUrl:n}=e;return n?{action:"production-preview",title:"Open preview",icon:ue.YE8,shortcut:"Ctrl+Alt+O"}:null};function hn(e){const[n,t]=(0,T.useState)(void 0),[i,o]=(0,T.useState)(null),{resolveProductionUrl:s}=(0,oe.Lky)().document,a=(0,xe.l)(e);if(i)throw i;return(0,T.useEffect)((()=>{a.pipe((0,ne.b)(500),(0,X.w)((e=>(e=>(0,oe.Uy$)(e)&&"string"===typeof e._id&&"string"===typeof e._type)(e)?(0,B.D)(s({document:e})):(0,N.of)(void 0))),(0,te.K)((e=>{const n=(0,oe.Uy$)(e)&&"string"===typeof e.message?e.message:"Unknown error";throw new Error("An error was thrown while trying to get your preview url: ".concat(n))}))).subscribe({next:t,error:o})}),[s,a]),n}const mn={},fn=(0,T.memo)((e=>{const{children:n,index:t,pane:i,paneKey:o}=e,s=(0,oe.m85)(oe.Dr7),a=(0,oe.I_y)(),r=(0,oe.zEW)(),{actions:l,badges:c,unstable_languageFilter:d}=(0,oe.Lky)().document,u=(0,oe.zaX)(),p=(0,oe.ap5)(),h=(0,L.RL)(),{features:m}=Ae(),{push:f}=(0,M.pm)(),{options:x,menuItemGroups:g,title:v=null,views:j=[]}=i,y=(0,oe.BoV)(x),b=y.id,w=(0,oe.vsM)(b),C=x.type,k=(0,oe.BoV)(h.params),P=(0,oe.BoV)(h.payload),{templateName:S,templateParams:I}=(0,T.useMemo)((()=>function(e,n){const t=n.panePayload||{},i=n.templateName;n.urlTemplate&&i&&i!==n.urlTemplate&&console.warn('Conflicting templates: URL says "'.concat(n.urlTemplate,'", structure node says "').concat(i,'". Using "').concat(i,'".'));const o=i||n.urlTemplate,s=e.filter((e=>e.schemaType===n.documentType)),a={...n.templateParams,..."object"===typeof t&&t||{}};let r=o;return o||1!==s.length||(r=s[0].id),{templateName:r,templateParams:a}}(r,{documentType:C,templateName:y.template,templateParams:y.templateParameters,panePayload:P,urlTemplate:null==k?void 0:k.template})),[C,y,k,P,r]),_=(0,oe.t2O)({documentId:w,documentType:C,templateName:S,templateParams:I}),E=(0,oe.BoV)(_),{patch:R}=(0,oe.d9t)(w,C),F=(0,oe.iav)(w,C),{validation:B}=(0,oe.a3k)(w,C),N=(0,oe.z1O)(w,C),W=a.get(C),D=(null==F?void 0:F.draft)||(null==F?void 0:F.published)||E.value,Z=(0,T.useMemo)((()=>l({schemaType:C,documentId:w})),[l,w,C]),A=(0,T.useMemo)((()=>c({schemaType:C,documentId:w})),[c,w,C]),K=(0,T.useMemo)((()=>d({schemaType:C,documentId:w})),[w,C,d]),U=(0,oe.BoV)(B),V=(0,oe.BoV)(j),H=h.params||mn,[X,$]=(0,T.useState)((()=>H.path?(0,me.mL)(H.path):[])),q=H.view||V[0]&&V[0].id||null,Y=(0,T.useMemo)((()=>u.getTimeline({publishedId:w,enableTrace:oe.r8Q})),[w,u]),[J,G]=(0,T.useState)("closed"),{historyController:Q}=(0,xe.m2)((()=>u.getTimelineController({client:s,documentId:w,documentType:C,timeline:Y})),[s,w,C,Y]);Q.setRange(H.since||null,H.rev||null);
1const ee=Q.changesPanelActive(),ne=hn(D),[te,ie]=(0,T.useState)([]);(0,T.useEffect)((()=>{const e=p.documentPresence(w).subscribe((e=>{ie(e)}));return()=>{e.unsubscribe()}}),[w,p]);const se=Boolean(D),ae=(0,T.useMemo)((()=>(e=>[pn,dn,un].filter(Boolean).map((n=>n(e))).filter((e=>null!==e)))({features:m,hasValue:se,changesOpen:ee,previewUrl:ne})),[m,se,ee,ne]),re="on"===H.inspect,le=ee?Q.sinceAttributes():(null==F?void 0:F.published)||null,ce="connected"===N&&F.ready,de=Q.onOlderRevision(),ue=(0,T.useMemo)((()=>de?Q.displayed()||{_id:D._id,_type:D._type}:D),[Q,H.rev,H.since,D,de]),pe=(0,T.useCallback)(((e,n)=>{h.setParams({...h.params,since:e,rev:n||void 0})}),[h]),fe=(0,T.useCallback)((e=>{$(e),p.setLocation([{type:"document",documentId:w,path:e,lastActiveAt:(new Date).toISOString()}])}),[w,p,$]),ve=(0,T.useCallback)((e=>{$([])}),[$]),je=(0,T.useRef)((()=>{throw new Error("Nope")}));je.current=e=>{R.execute((0,oe.GWp)(e.patches),E.value)};const ye=(0,T.useCallback)((e=>je.current(e)),[]),be=(0,T.useCallback)((()=>{h.setParams({...H,since:void 0})}),[h,H]),we=(0,T.useCallback)((()=>{h.setParams({...H,since:"@lastPublished"})}),[h,H]),Ce=(0,T.useCallback)((()=>h.closeCurrent()),[h]),ke=(0,T.useCallback)((()=>h.duplicateCurrent()),[h]),Pe=(0,T.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!re;e?h.setParams({...H,inspect:"on"}):h.setParams(O()(H,"inspect"))}),[re,h,H]),Se=(0,T.useCallback)((e=>"production-preview"===e.action&&ne?(window.open(ne),!0):"inspect"===e.action?(Pe(!0),!0):"reviewChanges"===e.action&&(we(),!0)),[we,ne,Pe]),Ie=(0,T.useCallback)((e=>{for(const n of ae)if(n.shortcut&&(0,he.ZP)(n.shortcut,e))return e.preventDefault(),e.stopPropagation(),void Se(n)}),[Se,ae]),_e=(0,T.useCallback)((()=>Pe(!1)),[Pe]),[Ee,ze]=(0,T.useState)([]),[Te,Me]=(0,T.useState)(),[Le,Re]=(0,T.useState)(),[Oe,Fe]=(0,T.useState)(),Be=(0,T.useCallback)(((e,n)=>{Re((t=>(0,oe.pt$)(t,e,n)))}),[]),Ne=(0,T.useCallback)(((e,n)=>{Fe((t=>(0,oe.pt$)(t,e,n)))}),[]),We=(0,T.useCallback)(((e,n)=>Me((t=>(0,oe.pt$)(t,e,n)))),[]),De=D._createdAt?"update":"create",Ze=(0,T.useMemo)((()=>Boolean(null==W?void 0:W.liveEdit)),[C,a]),Ke=D._id?D._id:"dummy-id",Ue=(0,T.useMemo)((()=>({...D,_id:Ze?(0,oe.vsM)(Ke):(0,oe.qyu)(Ke)})),[Ze,D,Ke]),[Ve,He]=(0,oe.vSY)({document:Ue,permission:De}),{revTime:Xe}=Q,$e=!(null==D?void 0:D._id),qe=(0,T.useMemo)((()=>{const e=!He&&!(null==Ve?void 0:Ve.granted),n=!(0,ge.jA)(W,"update"),t=$e&&!(0,ge.jA)(W,"create");return!ce||null!==Xe||e||n||t||"reconnecting"===N}),[N,$e,He,null==Ve?void 0:Ve.granted,ce,Xe,W]),Ye=(0,oe.clL)(W,{value:ue,readOnly:qe,comparisonValue:le,focusPath:X,openPath:Ee,collapsedPaths:Le,presence:te,validation:U,collapsedFieldSets:Oe,fieldGroupState:Te,changesOpen:ee}),Je=(0,T.useRef)(Ye);Je.current=Ye;const Ge=(0,T.useCallback)((e=>{(0,oe.C8M)(Je.current,e).forEach((e=>{"expandPath"===e.type&&Re((n=>(0,oe.pt$)(n,e.path,!1))),"expandFieldSet"===e.type&&Fe((n=>(0,oe.pt$)(n,e.path,!1))),"setSelectedGroup"===e.type&&Me((n=>(0,oe.pt$)(n,e.path,e.groupName)))})),ze(e)}),[Je]),Qe={actions:Z,activeViewId:q,badges:A,changesOpen:ee,collapsedFieldSets:Oe,collapsedPaths:Le,compareValue:le,connectionState:N,displayed:ue,documentId:w,documentIdRaw:b,documentType:C,editState:F,focusPath:X,menuItems:ae,onBlur:ve,onChange:ye,onFocus:fe,onPathOpen:Ge,onHistoryClose:be,onHistoryOpen:we,onInspectClose:_e,onKeyUp:Ie,onMenuAction:Se,onPaneClose:Ce,onPaneSplit:ke,onSetActiveFieldGroup:We,onSetCollapsedPath:Be,onSetCollapsedFieldSet:Ne,historyController:Q,index:t,inspectOpen:re,validation:U,menuItemGroups:g||[],paneKey:o,previewUrl:ne,ready:ce,schemaType:W,isPermissionsLoading:He,permissions:Ve,setTimelineMode:G,setTimelineRange:pe,timeline:Y,timelineMode:J,title:v,value:D,views:V,formState:Ye,unstable_languageFilter:K};return(0,T.useEffect)((()=>{"reconnecting"===N&&f({id:"sanity/desk/reconnecting",status:"warning",title:(0,z.jsx)(z.Fragment,{children:"Connection lost. Reconnecting\u2026"})})}),[N,f]),(0,T.useEffect)((()=>{$(H.path?(0,me.mL)(H.path):[])}),[w,H.path]),(0,z.jsx)(L.cO.Provider,{value:Qe,children:n})}));fn.displayName="DocumentPaneProvider";const xn={create:"created",delete:"deleted",discardDraft:"discarded draft",initial:"created",editDraft:"edited",editLive:"live edited",publish:"published",unpublish:"unpublished"},gn={create:ue.agZ,delete:ue.XHJ,discardDraft:ue.Two,initial:ue.agZ,editDraft:ue.dY8,editLive:ue.dY8,publish:ue.EI4,unpublish:ue.xEY};function vn(e){return xn[e]}function jn(e,n){return{topSelection:n,bottomSelection:e,disabledBeforeSelection:!0}
1}function yn(e){let{maxLength:n,userIds:t}=e;return(0,z.jsx)(M.Jh,{maxLength:n,children:t.map((e=>(0,z.jsx)(oe.YtX,{user:e,withTooltip:!0},e)))})}const bn=(0,de.ZP)(M.kC)((e=>{let{theme:n}=e;var t;const i=null==(t=n.sanity.color.base.skeleton)?void 0:t.from;return(0,de.iv)(s||(s=Ie(["\n --timeline-hairline-width: 1px;\n position: relative;\n z-index: 2;\n margin: 0;\n padding: 0;\n\n &::before {\n position: absolute;\n content: '';\n height: 100%;\n width: var(--timeline-hairline-width);\n background: ",";\n top: 0;\n left: calc((100% - var(--timeline-hairline-width)) / 2);\n z-index: 1;\n }\n "])),i)})),wn=(0,de.ZP)(M.sN)((e=>{let{state:n="enabled",isHovered:t,theme:i}=e;const{color:o}=i.sanity,s=o.button.default.primary.enabled;return(0,de.iv)(a||(a=Ie(["\n position: relative;\n min-width: 244px;\n\n ","\n\n ","\n\n ","\n\n // line styling \ud83d\udc47\n &:first-child ","::before {\n height: 50%;\n top: unset;\n bottom: 0;\n }\n\n &:last-child ","::before {\n height: 50%;\n }\n\n ","\n\n // Remove timeline lines when using the keyboard to navigate timeline items\n &:focus ","::before {\n background: transparent;\n }\n "])),"selected"===n&&(0,de.iv)(r||(r=Ie(["\n --card-bg-color: ",";\n --card-fg-color: ",";\n --card-muted-fg-color: ",";\n --card-border-color: ",";\n &:not([data-selection-bottom='true']) {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n "])),s.bg,s.fg,s.muted,s.bg),"withinSelection"===n&&(0,de.iv)(l||(l=Ie(["\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n box-shadow: 0px 3px 0px 0px var(--card-bg-color);\n &:not([data-selection-top='true']) {\n border-radius: 0;\n }\n\n "," {\n &::before {\n background: var(--card-hairline-soft-color);\n }\n }\n "])),bn),"disabled"===n&&(0,de.iv)(c||(c=Ie(["\n [data-ui='Avatar'] {\n opacity: 0.2;\n }\n "]))),bn,bn,(t||"selected"===n)&&(0,de.iv)(d||(d=Ie(["\n ","::before {\n background: transparent;\n }\n "])),bn),bn)})),Cn=(0,de.ZP)(M.xu)(u||(u=Ie(["\n background: var(--card-bg-color);\n border-radius: 50px;\n position: relative;\n z-index: 2;\n"]))),kn=(0,de.ZP)(M.xv)(p||(p=Ie(["\n text-transform: capitalize;\n"]))),Pn={initial:"primary",create:"primary",publish:"positive",editLive:"caution",editDraft:"caution",unpublish:"critical",discardDraft:"critical",delete:"critical",withinSelection:"primary"};function Sn(e){const{isSelectionBottom:n,isSelectionTop:t,state:i,onSelect:o,timestamp:s,chunk:a,type:r}=e,l=function(e){return gn[e]}(r),c=Array.from(a.authors),d=(0,oe.INm)(s,{minimal:!0}),u="selected"===i,p="withinSelection"===i,[h,m]=(0,T.useState)(!1),f=(0,T.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),o(a)}),[o,a]);return(0,z.jsx)(wn,{"data-ui":"timelineItem",radius:2,"data-chunk-id":a.id,paddingY:0,paddingX:2,tone:h||u||p?"default":Pn[r],pressed:p,state:i,selected:u,isHovered:h,disabled:"disabled"===i,"data-selection-bottom":n,"data-selection-top":t,onClick:f,children:(0,z.jsx)("div",{onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:(0,z.jsxs)(M.kC,{align:"stretch",children:[(0,z.jsx)(bn,{align:"center",children:(0,z.jsx)(Cn,{padding:2,children:(0,z.jsx)(M.xv,{size:2,children:l&&(0,T.createElement)(l)})})}),(0,z.jsxs)(M.Kq,{space:2,margin:2,children:[(0,z.jsx)(M.xu,{children:(0,z.jsx)(kn,{size:1,weight:"medium",children:vn(r)||(0,z.jsx)("code",{children:r})})}),(0,z.jsx)(M.xv,{size:0,muted:!0,children:d})]}),(0,z.jsx)(M.kC,{flex:1,justify:"flex-end",align:"center",children:(0,z.jsx)(yn,{maxLength:3,userIds:c})})]})})})}const In=(0,de.ZP)(M.xu)(h||(h=Ie(["\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n"]))),_n=(0,de.ZP)(M.Kq)(m||(m=Ie(["\n max-width: 200px;\n"]))),En=(0,de.ZP)(M.v2)(f||(f=Ie(["\n overflow: auto;\n box-sizing: border-box;\n max-height: calc(100vh - 198px);\n"]))),zn=e=>{let{timeline:n,disabledBeforeSelection:t,topSelection:i,bottomSelection:o,onSelect:s,onLoadMore:a}=e;const r=(0,T.useRef)(null),l=(0,T.useRef)(null),[c,d]=(0,T.useState)(null);let u=t?"disabled":"enabled";const p=(0,T.useCallback)((()=>{const e=r.current;if(c&&e){const{offsetHeight:n,scrollTop:t}=e,i=n+t+20,o=c.offsetTop<i;o&&requestAnimationFrame((()=>a(o)))}}),[a,c]);return(0,T.useEffect)(p,[p]),(0,z.jsxs)(In,{ref:r,onScroll:p,"data-ui":"timeline",children:[0===n.chunkCount&&(0,z.jsxs)(_n,{padding:3,space:3,children:[(0,z.jsx)(M.xv,{size:1,weight:"semibold",children:"No document history"}),(0,z.jsx)(M.xv,{muted:!0,size:1,children:"When changing the content of the document, the document versions will appear in this menu."})]}),n.chunkCount>0&&(0,z.jsx)(En,{ref:l,padding:1,space:0,children:n.mapChunks((e=>{const n=i===e,t=o===e;n&&(u="withinSelection"),t&&(u="selected");const a=(0,z.jsx)(Sn,{chunk:e,isSelectionBottom:t,isSelectionTop:n,state:u,onSelect:s,type:e.type,timestamp:e.endTimestamp},e.id);return"selected"===u&&(u="enabled"),a}))}),!n.reachedEarliestEntry&&(0,z.jsx)(M.kC,{align:"center",justify:"center",padding:4,ref:d,children:(0,z.jsx)(M.$j,{muted:!0}
1)})]})};zn.displayName="Timeline";const Tn=(0,de.ZP)(M.J2)(x||(x=Ie(["\n & > div {\n display: flex;\n flex-direction: column;\n\n & > [data-ui='Card'] {\n flex: 1;\n min-height: 0;\n display: flex;\n flex-direction: column;\n\n /* This is the scrollable container rendered by <Timeline /> */\n & > div {\n flex: 1;\n min-height: 0;\n }\n }\n }\n"])));function Mn(e){let{chunk:n,mode:t,placement:i}=e;const{historyController:o,setTimelineRange:s,setTimelineMode:a,timeline:r,ready:l}=(0,L.Z3)(),[c,d]=(0,T.useState)(!1),[u,p]=(0,T.useState)(null),[h,m]=(0,T.useState)(null),f=(0,T.useCallback)((()=>{a(t),d(!0)}),[t,a]),x=(0,T.useCallback)((()=>{a("closed"),d(!1)}),[a]),g=(0,T.useCallback)((()=>{x()}),[x]);(0,M.O8)(g,[h,u]);const v=(0,T.useCallback)((e=>{const[n,t]=o.findRangeForNewRev(e);a("closed"),d(!1),s(n,t)}),[o,a,s]),j=(0,T.useCallback)((e=>{const[n,t]=o.findRangeForNewSince(e);a("closed"),d(!1),s(n,t)}),[o,a,s]),y=(0,T.useCallback)((e=>{o.setLoadMore(e)}),[o]),b=c&&(0,z.jsx)("div",{ref:m,children:"rev"===t?(0,z.jsx)(zn,{onSelect:v,onLoadMore:y,timeline:r,...(w=o.realRevChunk,{topSelection:w,bottomSelection:w})}):(0,z.jsx)(zn,{onSelect:j,onLoadMore:y,timeline:r,...jn(o.sinceTime,o.realRevChunk)})});var w;const C=(0,oe.INm)((null==n?void 0:n.endTimestamp)||"",{agoSuffix:!0}),k=n?"".concat(je()(vn(n.type))," ").concat(C):"Current version",P=n?"Since ".concat(vn(n.type)," ").concat(C):"Since unknown version",S="rev"===t?"Select version":"Review changes since",I="rev"===t?k:P;return(0,z.jsx)(Tn,{constrainSize:!0,content:b,"data-ui":"versionMenu",open:c,placement:i,portal:!0,children:(0,z.jsx)(M.zx,{disabled:!l,mode:"bleed",fontSize:1,padding:2,iconRight:ue.GVG,onClick:c?x:f,ref:p,selected:c,text:c?S:I})})}function Ln(){return(0,z.jsxs)(M.kC,{align:"center",justify:"center",children:[(0,z.jsx)(M.$j,{muted:!0}),(0,z.jsx)(M.xu,{marginTop:3,children:(0,z.jsx)(M.xv,{align:"center",children:"Loading changes\u2026"})})]})}const Rn=(0,de.ZP)(oe.l$t)(g||(g=Ie(["\n height: 100%;\n overflow: auto;\n position: relative;\n scroll-behavior: smooth;\n"])));function On(){const{documentId:e,onHistoryClose:n,historyController:t,schemaType:i,value:o}=(0,L.Z3)(),{collapsed:s}=(0,L.ec)(),a=(0,T.useRef)(null),r="loading"===t.selectionState,l=t.sinceTime,c=t.currentObjectDiff(),d=!t.onOlderRevision(),u=T.useMemo((()=>({documentId:e,schemaType:i,FieldWrapper:oe.MUX,rootDiff:c,isComparingCurrent:d,value:o})),[e,c,d,i,o]),p=T.useMemo((()=>c?function(e){const n=new Map;return(0,oe.Z7x)(e,(e=>{if("unchanged"===e.action||!("annotation"in e)||!e.annotation)return!0;const{author:t,timestamp:i}=e.annotation,o=n.get(t);return(!o||o.timestamp<i)&&n.set(t,e.annotation),!0})),Array.from(n.values()).sort(((e,n)=>e.timestamp<n.timestamp?1:-1))}(c):[]),[c]);return s?null:(0,z.jsxs)(M.kC,{direction:"column",flex:1,style:{borderLeft:"1px dashed var(--card-border-color)",overflow:"hidden",minWidth:320},"data-testid":"review-changes-pane",children:[(0,z.jsx)(L.hX,{actions:(0,z.jsx)(M.zx,{icon:ue.Two,mode:"bleed",onClick:n,padding:3,title:"Hide changes panel"}),subActions:p.length>0&&(0,z.jsx)(M.xu,{paddingRight:1,children:(0,z.jsx)(oe.IIC,{annotations:p,description:"Changes by",placement:"bottom-end",children:(0,z.jsx)(M.Jh,{maxLength:4,children:p.map((e=>{let{author:n}=e;return(0,z.jsx)(oe.YtX,{user:n},n)}))})})}),tabs:(0,z.jsx)(Mn,{mode:"since",chunk:l,placement:"bottom-start"}),title:"Changes"}),(0,z.jsx)(L.Bh,{children:(0,z.jsx)(M.NM,{element:a.current,children:(0,z.jsx)(Rn,{"data-ui":"Scroller",ref:a,children:(0,z.jsx)(M.xu,{flex:1,padding:4,children:(0,z.jsx)(Fn,{diff:c,documentContext:u,loading:r})})})})})]})}function Fn(e){let{diff:n,documentContext:t,loading:i}=e;const{schemaType:o}=(0,L.Z3)();return i?(0,z.jsx)(Ln,{}):n?(0,z.jsx)(oe.H7Z.Provider,{value:t,children:(0,z.jsx)(oe.EyJ,{diff:n,schemaType:o})}):(0,z.jsx)(oe.kwM,{})}function Bn(e,n,t){const i=(0,oe.F2f)(),[o,s]=(0,T.useState)(t),a=(0,T.useMemo)((()=>i.forNamespace("desk-tool")),[i]),r=(0,T.useMemo)((()=>e?a.forNamespace(e).forKey(n):a.forKey(n)),[a,e,n]);(0,T.useEffect)((()=>{const e=r.listen(t).subscribe({next:s});return()=>null==e?void 0:e.unsubscribe()}),[t,n,e,r]);const l=(0,T.useCallback)((e=>{s(e),r.set(e)}),[r]);return(0,T.useMemo)((()=>[o,l]),[l,o])}const Nn={id:"parsed",title:"Parsed"},Wn={id:"raw",title:"Raw JSON"},Dn=[Nn,Wn],Zn=Ce()(1e3);function An(e,n){const t=Zn.get(e);return void 0===t?(Zn.set(e,Array.isArray(n)||(0,oe.Uy$)(n)),An(e,n
1)):t}function Kn(e){const{path:n}=e,t=Zn.get(n);void 0!==t&&Zn.set(n,!t)}function Un(e){const n=window.getSelection();if(n){const t=document.createRange();n.removeAllRanges(),t.selectNodeContents(e),n.addRange(t)}}function Vn(e){Un(e.currentTarget)}function Hn(e){65===e.keyCode&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),Un(e.currentTarget))}function Xn(e){return(0,oe.Uy$)(e)&&(0,oe.HD0)(e._id)&&(0,oe.HD0)(e._type)}const $n=de.ZP.div((e=>{let{theme:n}=e;const{color:t,fonts:i,space:o}=n.sanity;return(0,de.iv)(v||(v=Ie(["\n & .json-inspector,\n & .json-inspector .json-inspector__selection {\n font-family: ",";\n font-size: ","px;\n line-height: ","px;\n color: var(--card-code-fg-color);\n }\n\n & .json-inspector .json-inspector__leaf {\n padding-left: ",";\n }\n\n & .json-inspector .json-inspector__leaf.json-inspector__leaf_root {\n padding-top: ",";\n padding-left: 0;\n }\n\n & .json-inspector > .json-inspector__leaf_root > .json-inspector__line > .json-inspector__key {\n display: none;\n }\n\n & .json-inspector .json-inspector__line {\n display: block;\n position: relative;\n cursor: default;\n }\n\n & .json-inspector .json-inspector__line::after {\n content: '';\n position: absolute;\n top: 0;\n left: -200px;\n right: -50px;\n bottom: 0;\n z-index: -1;\n pointer-events: none;\n }\n\n & .json-inspector .json-inspector__line:hover::after {\n background: var(--card-code-bg-color);\n }\n\n & .json-inspector .json-inspector__leaf_composite > .json-inspector__line {\n cursor: pointer;\n }\n\n & .json-inspector .json-inspector__leaf_composite > .json-inspector__line::before {\n content: '\u25b8 ';\n margin-left: calc(0 - "," + 3px);\n font-size: ","px;\n line-height: ","px;\n }\n\n &\n .json-inspector\n .json-inspector__leaf_expanded.json-inspector__leaf_composite\n > .json-inspector__line::before {\n content: '\u25be ';\n font-size: ","px;\n line-height: ","px;\n }\n\n & .json-inspector .json-inspector__radio,\n & .json-inspector .json-inspector__flatpath {\n display: none;\n }\n\n & .json-inspector .json-inspector__value {\n margin-left: ",";\n }\n\n &\n .json-inspector\n > .json-inspector__leaf_root\n > .json-inspector__line\n > .json-inspector__key\n + .json-inspector__value {\n margin: 0;\n }\n\n & .json-inspector .json-inspector__key {\n color: ",";\n }\n\n & .json-inspector .json-inspector__value_helper,\n & .json-inspector .json-inspector__value_null {\n color: ",";\n }\n\n & .json-inspector .json-inspector__not-found {\n padding-top: ",";\n }\n\n & .json-inspector .json-inspector__value_string {\n color: ",";\n }\n\n & .json-inspector .json-inspector__value_boolean {\n color: ",";\n }\n\n & .json-inspector .json-inspector__value_number {\n color: ",";\n }\n\n & .json-inspector .json-inspector__show-original {\n display: inline-block;\n padding: 0 6px;\n cursor: pointer;\n }\n\n & .json-inspector .json-inspector__show-original:hover {\n color: inherit;\n }\n\n & .json-inspector .json-inspector__show-original::before {\n content: '\u2194';\n }\n\n & .json-inspector .json-inspector__show-original:hover::after {\n content: ' expand';\n }\n "])),i.code.family,i.code.sizes[2].fontSize,i.code.sizes[2].lineHeight,(0,M.hO)(o[4]),(0,M.hO)(o[3]),(0,M.hO)(o[4]),i.code.sizes[2].fontSize,i.code.sizes[2].lineHeight,i.code.sizes[2].fontSize,i.code.sizes[2].lineHeight,(0,M.hO)(o[4]/2),t.syntax.property,t.syntax.constant,(0,M.hO)(o[3]),t.syntax.string,t.syntax.boolean,t.syntax.number)}));function qn(e){const{onChange:n,query:t}=e,i=(0,T.useCallback)((e=>n(e.target.value)),[n]);return(0,z.jsx)(M.oi,{icon:ue.W1M,onChange:i,placeholder:"Search",radius:2,value:t||""})}function Yn(e){const{value:n}=e,{onInspectClose:t,paneKey:i}=(0,L.Z3)(),o="".concat(i,"_inspect_"),[s,a]=Bn("desk-tool","inspect-view-preferred-view-mode-".concat(i),"parsed"),r=Dn.find((e=>e.id===s)),l=(0,T.useCallback)((()=>{a(Nn.id)}),[a]),c=(0,T.useCallback)((()=>{a(Wn.id)}),[a]);return(0,z.jsx)(M.Vq,{id:"".concat(o,"dialog"),header:Xn(n)?(0,z.jsxs)(z.Fragment,{children:["Inspecting"," ",(0,z.jsx)("em",{children:(0,z.jsx)(L.lU,{document:n})})]}):(0,z.jsx)("em",{children:"No value"}),onClose:t,width:3,children:(0,z.jsxs)(M.kC,{direction:"column",height:"fill",children:[(0,z.jsx)(M.Zb,{padding:3,shadow:1,style:{position:"sticky",bottom:0,zIndex:3},children:(0,z.jsxs)(M.td,{space:1,children:[(0,z.jsx)(M.OK,{"aria-controls":"".concat(o,"tabpanel"),fontSize:1,id:"".concat(o,"tab-").concat(Nn.id),label:Nn.title,onClick:l,selected:r===Nn}),(0,z.jsx)(M.OK,{"aria-controls":"".concat(o,"tabpanel"),fontSize:1,id:"".concat(o,"tab-").concat(Wn.id),label:Wn.title,onClick:c,selected:r===Wn})]})}),(0,z.jsxs)(M.x4,{"aria-labelledby":"".concat(o,"tab-").concat(s),flex:1,id:"".concat(o,"tabpanel"),overflow:"auto",padding:4,style:{outline:"none"},children:[r===Nn&&(0,z.jsx)($n,{children:(0,z.jsx)(be(),{data:n,isExpanded:An,onClick:Kn,search:qn})}),r===Wn&&(0,z.jsx)(M.EK,{language:"json",tabIndex:0,onKeyDown:Hn,onDoubleClick:Vn,onFocus:Vn,children:JSON.stringify(n,null,2)})]})]})})}const Jn=(0,de.ZP)(M.Zb)(j||(j=Ie(["\n position: relative;\n z-index: 50;\n"]))),Gn=(0,de.ZP)(M.xv)(y||(y=Ie(["\n & > * {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n"]))),Qn=(0,T.memo)((()=>{var e,n,t,i,o,s;const a=(0,oe.rq_)(),{params:r,groupIndex:l,routerPanesState:c,replaceCurrent:d,BackLink:u}=(0,L.RL)(),p=null==(e=c[l])?void 0:e[0].id,h=c[l-1],m=null==h?void 0:h[0],f=null==m?void 0:m.id,x=Boolean(null==(n=null==m?void 0:m.params)?void 0:n.rev),g=(0,T.useMemo)((()=>(null==r?void 0:r.parentRefPath)&&(0,me.mL)(r.parentRefPath)||null),[null==r?void 0:r.parentRefPath]),v=(0,xe.m2)((()=>{const e=null==g?void 0:g[0];if(!f||!e||!g)return(0,N.of)({loading:!1});const n=(0,oe.vsM)(f),t=(0,me.mL)(e),i=t.findIndex((e=>"object"==typeof e&&"_key"in e));return(0,D.z)((0,N.of)({loading:!0}),a.unstable_observePathsDocumentPair(n,-1===i?t:t.slice(0,i)).pipe((0,ne.b)(750),(0,$.U)((e=>{let{draft:n,published:t}=e;var i;return{loading:!1,result:{availability:{draft:n.availability,published:t.availability},refValue:null==(i=(0,me.U2)(n.snapshot||t.snapshot,g))?void 0:i._ref}}}))))}),[f,g],{loading:!0}),j=(0,T.useCallback)((()=>{var e;v.loading||(null==(e=v.result)?void 0:e.refValue)&&d({id:v.result.refValue,params:r})}),[v.loading,v.result,d,r]);return!f||!g||x||v.loading||!(null==(t=v.result)?void 0:t.availability.draft.available)&&!(null==(i=v.result)?void 0:i.availability.published.available)||(null==(o=v.result)?void 0:o.refValue)===p?null:(0,z.jsx)(Jn,{shadow:1,tone:"caution","data-testid":"reference-changed-banner",children:(0,z.jsx)(M.W2,{paddingX:4,paddingY:2,sizing:"border",width:1,children:(0,z.jsxs)(M.kC,{align:"center",children:[(0,z.jsx)(M.xv,{size:1,children:(0,z.jsx)(ue.foC,{})}),(null==(s=v.result)?void 0:s.refValue)?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(M.xu,{flex:1,marginLeft:3,children:(0,z.jsx)(Gn,{title:"This reference has changed since you opened it.",size:1,children:"This reference has changed since you opened it."})}),(0,z.jsx)(M.xu,{marginLeft:3,children:(0,z.jsx)(M.zx,{onClick:j,icon:ue.bnu,fontSize:1,mode:"ghost",padding:2,space:2,text:"Reload reference"})})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(M.xu,{flex:1,marginLeft:3,children:(0,z.jsx)(Gn,{title:"This reference has been removed since you opened it.",size:1,children:"This reference has been removed since you opened it."})}),(0,z.jsx)(M.xu,{marginLeft:3,children:(0,z.jsx)(M.zx,{as:u,icon:ue.Two,fontSize:1,mode:"ghost",padding:2,space:2,text:"Close reference"})})]})]})})})}));Qn.displayName="ReferenceChangedBanner";const et=(0,de.ZP)(M.Zb)(b||(b=Ie(["\n position: relative;\n z-index: 50;\n"])));function nt(e){let{granted:n,requiredPermission:t}=e;var i,o;const s=(0,oe.xJ)(),a=1!==(null==(i=null==s?void 0:s.roles)?void 0:i.length),r=(l=(null==(o=null==s?void 0:s.roles)?void 0:o.map((e=>(0,z.jsx)("code",{children:e.title},e.name))))||[],c=", ",l.reduce(((e,n)=>null===e?[n]:e.concat([c,n])),null));var l,c;return n?null:(0,z.jsx)(et,{"data-testid":"permission-check-banner",shadow:1,tone:"transparent",children:(0,z.jsx)(M.W2,{paddingX:4,paddingY:3,sizing:"border",width:1,children:(0,z.jsxs)(M.kC,{align:"flex-start",children:[(0,z.jsx)(M.xv,{size:1,children:(0,z.jsx)(ue.CPA,{})}),(0,z.jsx)(M.xu,{flex:1,marginLeft:3,children:(0,z.jsxs)(M.xv,{size:1,children:["Your role",a&&"s"," ",r," ",a?"do":"does"," not have permissions to"," ",t," this document."]})})]})})})}function tt(e){const n=(0,M.pm)(),t=function(e){const n=(0,T.useRef)();return(0,T.useEffect)((()=>{n.current=e}),[e]),n.current}(e.enabled);(0,T.useEffect)((()=>{!t&&e.enabled&&n.push({...e,duration:20736e5}),t&&!e.enabled&&n.push({...e,duration:.01})}),[e,n,t])}const it=e=>e.preventDefault();function ot(e){var n;const{hidden:t,margins:i}=e,{collapsedFieldSets:o,collapsedPaths:s,displayed:a,editState:r,documentId:l,documentType:c,onChange:d,validation:u,ready:p,formState:h,onFocus:m,onBlur:f,onSetCollapsedPath:x,onPathOpen:g,onSetCollapsedFieldSet:v,onSetActiveFieldGroup:j}=(0,L.Z3)(),y=(0,oe.H__)(),b=(0,oe.Dqo)(l),w=(0,T.useMemo)((()=>(0,oe.fm0)()),[]),C=null==(n=null==r?void 0:r.transactionSyncLock)?void 0:n.enabled;tt({id:"sync-lock-".concat(l),status:"warning",enabled:C,title:"Syncing document\u2026",description:"Please hold tight while the document is synced. This usually happens right after the document has been published, and it shouldn't take more than a few seconds"}),(0,T.useEffect)((()=>{const e=y.pair.documentEvents(l,c).pipe((0,ie.b)((e=>{"mutation"===e.type&&w.publish(function(e){const n=e.mutations.map((e=>
1e.patch)).filter(Boolean);return{type:"mutation",snapshot:e.document,patches:(0,oe.Sis)(e.origin,n)}}(e)),"rebase"===e.type&&w.publish(function(e){const n=e.remoteMutations.map((e=>e.patch)).filter(Boolean),t=e.localMutations.map((e=>e.patch)).filter(Boolean);return{type:"rebase",snapshot:e.document,patches:(0,oe.Sis)("remote",n).concat((0,oe.Sis)("local",t))}}(e))}))).subscribe();return()=>{e.unsubscribe()}}),[l,y,c,w]);const k=Boolean(null==a?void 0:a._rev);return(0,T.useEffect)((()=>{k&&w.publish({type:"mutation",patches:[],snapshot:a})}),[k]),(0,z.jsx)(M.W2,{hidden:t,paddingX:4,paddingTop:5,paddingBottom:9,sizing:"border",width:1,children:(0,z.jsx)(oe.$rW,{margins:i,children:(0,z.jsx)(M.xu,{as:"form",onSubmit:it,children:p?null===h?(0,z.jsx)(M.xu,{padding:2,children:(0,z.jsx)(M.xv,{children:"This form is hidden"})}):(0,z.jsx)(oe.quP,{__internal_patchChannel:w,collapsedFieldSets:o,collapsedPaths:s,focusPath:h.focusPath,changed:h.changed,focused:h.focused,groups:h.groups,id:"root",members:h.members,onChange:d,onFieldGroupSelect:j,onPathBlur:f,onPathFocus:m,onPathOpen:g,onSetFieldSetCollapsed:v,onSetPathCollapsed:x,presence:b,readOnly:h.readOnly,schemaType:h.schemaType,validation:u,value:h.value}):(0,z.jsx)(_e,{ms:300,children:(0,z.jsxs)(M.kC,{align:"center",direction:"column",height:"fill",justify:"center",children:[(0,z.jsx)(M.$j,{muted:!0}),(0,z.jsx)(M.xu,{marginTop:3,children:(0,z.jsx)(M.xv,{align:"center",muted:!0,size:1,children:"Loading document"})})]})})})})})}function st(){const{activeViewId:e,paneKey:n,views:t}=(0,L.Z3)(),i="".concat(n,"tabpanel");return(0,z.jsx)(M.td,{space:1,children:t.map(((t,o)=>{var s;return(0,z.jsx)(at,{icon:t.icon,id:"".concat(n,"tab-").concat(t.id),isActive:e===t.id,label:(0,z.jsx)(z.Fragment,{children:t.title}),tabPanelId:i,viewId:0===o?null:null!=(s=t.id)?s:null},t.id)}))})}function at(e){const{icon:n,id:t,isActive:i,label:o,tabPanelId:s,viewId:a}=e,{ready:r}=(0,L.Z3)(),{setView:l}=(0,L.RL)(),c=(0,T.useCallback)((()=>l(a)),[l,a]);return(0,z.jsx)(M.OK,{"aria-controls":s,disabled:!r,fontSize:1,icon:n,id:t,selected:i,label:o,onClick:c})}const rt={error:{tone:"critical",icon:ue.uIy},warning:{tone:"caution",icon:ue.foC},info:{tone:"primary",icon:ue.hQ6}};function lt(e){const{boundaryElement:n,isOpen:t,setOpen:i}=e,{onFocus:o,onPathOpen:s,schemaType:a,validation:r}=(0,L.Z3)(),l=(0,T.useId)(),c=r.length>0,d=r.some(fe.YN),u=r.some(fe.WQ),p=r.some(fe.Ny),h=(0,T.useMemo)((()=>d?rt.error:u?rt.warning:p?rt.info:void 0),[d,p,u]),m=(0,T.useCallback)((()=>i(!1)),[i]);return c?(0,z.jsx)(M.j2,{id:l||"",button:(0,z.jsx)(M.zx,{...h,title:"Show validation issues",mode:"bleed","data-testid":"validation-list-button"}),menu:(0,z.jsx)(M.v2,{open:t,children:(0,z.jsx)(oe.$L,{documentType:a,validation:r,onClose:m,onFocus:s})}),popover:{portal:!0,boundaryElement:n,constrainSize:!0,preventOverflow:!0,width:0},placement:"bottom"}):null}function ct(){const{connectionState:e,schemaType:n,title:t,value:i}=(0,L.Z3)(),o=Boolean(i)&&"connected"===e,{error:s,value:a}=(0,oe._2T)({enabled:o,schemaType:n,value:i});return"connected"!==e?(0,z.jsx)(z.Fragment,{}):i?o?s?(0,z.jsxs)(z.Fragment,{children:["Error: ",s.message]}):(0,z.jsx)(z.Fragment,{children:(null==a?void 0:a.title)||(0,z.jsx)("span",{style:{color:"var(--card-muted-fg-color)"},children:"Untitled"})}):(0,z.jsx)(z.Fragment,{children:t}):(0,z.jsxs)(z.Fragment,{children:["New ",(null==n?void 0:n.title)||(null==n?void 0:n.name)]})}const dt=Pe()((e=>Boolean(e.showAsAction))),ut=(0,T.memo)((0,T.forwardRef)(((e,n)=>{let{rootElement:t}=e;const{onMenuAction:i,onPaneClose:o,onPaneSplit:s,historyController:a,validation:r,menuItems:l,menuItemGroups:c,schemaType:d,ready:u,views:p,unstable_languageFilter:h}=(0,L.Z3)(),{revTime:m}=a,{features:f}=Ae(),{index:x,BackLink:g,hasGroupSiblings:v}=(0,L.RL)(),j=(0,T.useMemo)((()=>l.filter(dt)),[l]),[y,b]=T.useState(!1),w=p.length>1,C=f.reviewChanges,k=f.splitViews&&s&&p.length>1,P=k&&v,S=!P&&!f.backButton;return(0,z.jsx)(L.hX,{ref:n,loading:!u,title:(0,z.jsx)(ct,{}),tabs:w&&(0,z.jsx)(st,{}),backButton:f.backButton&&x>0&&(0,z.jsx)(M.zx,{as:g,"data-as":"a",icon:ue.Y4O,mode:"bleed"}),subActions:C&&(0,z.jsx)(Mn,{chunk:m,mode:"rev",placement:"bottom-end"}),actions:(0,z.jsxs)(M.gF,{space:1,children:[h.length>0&&(0,z.jsx)(z.Fragment,{children:h.map(((e,n)=>(0,T.createElement)(e,{key:"language-filter-".concat(n),schemaType:d}
1)))}),r.length>0&&(0,z.jsx)(lt,{boundaryElement:t,isOpen:y,setOpen:b},"validation-menu"),(0,z.jsx)(L.eu,{itemGroups:c,items:j,onAction:i},"context-menu"),k&&(0,z.jsx)(M.zx,{icon:ue.iro,mode:"bleed",onClick:s,title:"Split pane right"},"split-pane-button"),P&&(0,z.jsx)(M.zx,{icon:ue.Two,mode:"bleed",onClick:o,title:"Close split pane"},"close-view-button"),S&&(0,z.jsx)(M.zx,{icon:ue.Two,mode:"bleed",title:"Close pane group",as:g},"close-view-button")]})})})));ut.displayName="DocumentPanelHeader";const pt=(0,de.ZP)(oe.l$t)((e=>{let{$disabled:n}=e;return n?{height:"100%"}:(0,de.iv)(w||(w=Ie(["\n height: 100%;\n overflow: auto;\n position: relative;\n scroll-behavior: smooth;\n outline: none;\n "])))})),ht=function(e){const{footerHeight:n,isInspectOpen:t,rootElement:i,setDocumentPanelPortalElement:o}=e,{activeViewId:s,displayed:a,documentId:r,editState:l,value:c,views:d,ready:u,schemaType:p,permissions:h,isPermissionsLoading:m}=(0,L.Z3)(),{collapsed:f}=(0,L.Cc)(),x=(0,M.vI)(),{features:g}=Ae(),[v,j]=(0,T.useState)(null),y=(0,M.XL)(v),b=(0,T.useRef)(null),[w,C]=(0,T.useState)(null),k=c._createdAt?"update":"create",P=(0,T.useMemo)((()=>d.find((e=>e.id===s))||d[0]||{type:"form"}),[s,d]),S=g.splitPanes&&b.current||x.element,I=(0,T.useMemo)((()=>f?[(null==y?void 0:y.height)||0,0,n?n+2:2,0]:[0,0,2,0]),[f,n,y]),_="form"!==P.type,E=(0,T.useMemo)((()=>"component"===P.type&&P.component&&(0,T.createElement)(P.component,{document:{draft:(null==l?void 0:l.draft)||null,displayed:a||c,historical:a,published:(null==l?void 0:l.published)||null},documentId:r,options:P.options,schemaType:p})),[P,a,r,null==l?void 0:l.draft,null==l?void 0:l.published,p,c]);(0,T.useEffect)((()=>{(null==w?void 0:w.scrollTo)&&w.scrollTo(0,0)}),[r,w]),(0,T.useEffect)((()=>{S&&o(S)}),[S,o]);const R=(0,T.useMemo)((()=>t?(0,z.jsx)(Yn,{value:a||c}):null),[t,a,c]);return(0,z.jsxs)(M.kC,{direction:"column",flex:2,overflow:f?void 0:"hidden",children:[(0,z.jsx)(ut,{rootElement:i,ref:j}),(0,z.jsx)(L.Bh,{children:(0,z.jsx)(M.Xp,{element:S,__unstable_elements:{documentScrollElement:w},children:(0,z.jsxs)(M.NM,{element:w,children:["form"===P.type&&!m&&u&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(nt,{granted:Boolean(null==h?void 0:h.granted),requiredPermission:k}),(0,z.jsx)(Qn,{})]}),(0,z.jsxs)(pt,{$disabled:f||!1,"data-testid":"document-panel-scroller",ref:C,children:[(0,z.jsx)(ot,{hidden:_,margins:I},r+(u?"_ready":"_pending")),E]}),R,(0,z.jsx)("div",{"data-testid":"document-panel-portal",ref:b})]})})})]})},mt=["left","bottom"],ft={small:0,medium:1,large:2,full:"auto"};function xt(e){const{dialog:n,referenceElement:t}=e;return(0,z.jsx)(M.J2,{content:(0,z.jsx)(gt,{dialog:n}),fallbackPlacements:mt,open:!0,placement:"top",portal:!0,preventOverflow:!0,referenceElement:t})}function gt(e){const{dialog:n}=e,{cancelButtonIcon:t,cancelButtonText:i,confirmButtonIcon:o,confirmButtonText:s,message:a,onCancel:r,onConfirm:l,tone:c}=n,{isTopLayer:d}=(0,M.sJ)(),[u,p]=(0,T.useState)(null),h=(0,T.useCallback)((()=>{d&&r()}),[d,r]),m=(0,T.useCallback)((e=>{"Escape"===e.key&&d&&r()}),[d,r]);return(0,M.O8)(h,[u]),(0,M.qh)(m),(0,z.jsxs)(M.kC,{direction:"column",ref:p,style:{minWidth:304,maxWidth:400},children:[(0,z.jsx)(M.xu,{flex:1,overflow:"auto",padding:4,children:(0,z.jsx)(M.xv,{children:a})}),(0,z.jsx)(M.xu,{paddingX:4,paddingY:3,style:{borderTop:"1px solid var(--card-border-color)"},children:(0,z.jsxs)(M.rj,{columns:2,gap:2,children:[(0,z.jsx)(M.zx,{icon:t,onClick:r,mode:"ghost",text:i||"Cancel"}),(0,z.jsx)(M.zx,{icon:o,onClick:l,text:s||"Confirm",tone:c})]})})]})}function vt(e){const{dialog:n}=e,t=(0,T.useId)(),i=n.footer&&(0,z.jsx)(M.xu,{paddingX:4,paddingY:3,children:n.footer});return(0,z.jsx)(oe.jr5,{zOffset:"fullscreen",children:(0,z.jsx)(M.Vq,{__unstable_hideCloseButton:!1===n.showCloseButton,footer:i,header:n.header,id:t,onClose:n.onClose,onClickOutside:n.onClose,width:void 0===n.width?1:ft[n.width],portal:"documentPanelPortalElement",children:(0,z.jsx)(M.xu,{padding:4,children:n.content})})})}function jt(e){const{dialog:n,referenceElement:t}=e;return(0,z.jsx)(M.J2,{content:(0,z.jsx)(yt,{dialog:n}),fallbackPlacements:mt,open:!0,placement:"top",portal:!0,preventOverflow:!0,referenceElement:t})}function yt(e){const{dialog:n}=e,{content:t,onClose:i}=n,{isTopLayer:o}=(0,M.sJ)(),[s,a]=(0,T.useState)(null),r=(0,T.useCallback)((()=>{o&&i()}),[o,i]),l=(0,T.useCallback)((e=>{"Escape"===e.key&&o&&i()}),[o,i]);return(0,M.O8)(r,[s]),(0,M.qh)(l),(0,z.jsx)("div",{ref:a,children:t})}function bt(e){const{dialog:n,referenceElement:t=null}=e,i=(0,T.useId)();if("confirm"===n.type)return(0,z.jsx)(xt,{dialog:n,referenceElement:t});if("popover"===n.type)return(0,z.jsx)(jt,{dialog:n,referenceElement:t});if("dialog"===n.type||!n.type)return(0,z.jsx)(vt,{dialog:n});const o=n;return console.warn("Unsupported modal type ".concat(o.type)),(0,z.jsx)(M.Vq,{id:i,onClose:o.onClose,onClickOutside:o.onClose,width:2,children:(0,z.jsx)(M.xu,{padding:4,children:o.content||(0,z.jsxs)(z.Fragment,{children:["Unexpected modal type (",(0,z.jsx)("code",{children:o.type}),")"]})})})}function wt(e){const{actionStates:n,disabled:t}=e,i=(0,T.useId)(),o=(0,T.useRef)(null),[s,a]=(0,T.useState)(-1),[r,l]=(0,T.useState)(null),c=(0,T.useCallback)((e=>{a(e)}),[]),d=(0,T.useMemo)((()=>({placement:"top-end",portal:!0,preventOverflow:!0})),[]),u=n[s];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(M.j2,{id:"".concat(i,"-action-menu"),button:(0,z.jsx)(M.zx,{"data-testid":"action-menu-button","aria-label":"Open document actions",disabled:t,icon:ue.v4q,mode:"ghost",ref:o}),menu:(0,z.jsx)(M.v2,{padding:1,children:n.map(((e,n)=>(0,z.jsx)(Ct,{actionState:e,disabled:t,index:n,onAction:c},n)))}),popover:d,ref:l}),u&&u.dialog&&(0,z.jsx)(oe.jr5,{zOffset:"paneFooter",children:(0,z.jsx)(bt,{dialog:u.dialog,referenceElement:r})})]})}function Ct(e){const{actionState:n,disabled:t,index:i,onAction:o}=e,{onHandle:s}=n,a=(0,T.useCallback)((()=>{o(i),s&&s()}),[i,o,s]),r=n.title&&(0,z.jsx)(M.xu,{padding:2,children:(0,z.jsx)(M.xv,{size:1,children:n.title})});return(0,z.jsx)(M.sN,{"data-testid":"action-".concat(n.label.replace(" ","")),disabled:t||Boolean(n.disabled),onClick:a,padding:0,tone:n.tone,children:(0,z.jsx)(M.u,{content:r,disabled:!r,fallbackPlacements:["left","bottom"],placement:"top",portal:!0,children:(0,z.jsxs)(M.kC,{align:"center",paddingX:3,children:[(0,z.jsxs)(M.kC,{flex:1,paddingY:3,children:[n.icon&&(0,z.jsx)(M.xu,{marginRight:3,children:(0,z.jsxs)(M.xv,{children:[(0,T.
1isValidElement)(n.icon)&&n.icon,(0,pe.isValidElementType)(n.icon)&&(0,T.createElement)(n.icon)]})}),(0,z.jsx)(M.xv,{children:n.label})]}),n.shortcut&&(0,z.jsx)(M.xu,{marginLeft:3,children:(0,z.jsx)(M.p8,{keys:String(n.shortcut).split("+").map((e=>e.slice(0,1).toUpperCase()+e.slice(1)))})})]})})})}function kt(e){const{disabled:n,showMenu:t,states:i}=e,[o,...s]=i,[a,r]=(0,T.useState)(null),l=(0,T.useMemo)((()=>o&&(o.title||o.shortcut)?(0,z.jsxs)(M.kC,{padding:2,style:{maxWidth:300},align:"center",children:[(0,z.jsx)(M.xv,{size:1,children:o.title}),o.shortcut&&(0,z.jsx)(M.xu,{marginLeft:o.title?2:0,children:(0,z.jsx)(M.p8,{keys:String(o.shortcut).split("+").map((e=>e.slice(0,1).toUpperCase()+e.slice(1).toLowerCase()))})})]}):null),[o]);return(0,z.jsxs)(M.kC,{children:[o&&(0,z.jsx)(M.li,{zOffset:200,children:(0,z.jsx)(M.u,{disabled:!l,content:l,portal:!0,placement:"top",children:(0,z.jsx)(M.Kq,{flex:1,children:(0,z.jsx)(M.zx,{"data-testid":"action-".concat(o.label),disabled:n||Boolean(o.disabled),icon:o.icon,onClick:o.onHandle,ref:r,text:o.label,tone:o.tone||"primary"})})})}),t&&s.length>0&&(0,z.jsx)(M.xu,{marginLeft:1,children:(0,z.jsx)(wt,{actionStates:s,disabled:n})}),o&&o.dialog&&(0,z.jsx)(bt,{dialog:o.dialog,referenceElement:a})]})}const Pt=(0,T.memo)((function(){const{actions:e,connectionState:n,editState:t}=(0,L.Z3)();return e&&t?(0,z.jsx)(Ee,{actions:e,actionProps:t,children:t=>{let{states:i}=t;return(0,z.jsx)(kt,{disabled:"connected"!==n,showMenu:e.length>1,states:i})}}):null})),St=(0,T.memo)((function(){var e;const{connectionState:n,editState:t,historyController:i}=(0,L.Z3)(),o=(null==(e=i.revTime)?void 0:e.id)||"",s=((null==t?void 0:t.draft)||(null==t?void 0:t.published)||{})._rev===o,a=(0,T.useMemo)((()=>({...t||{},revision:o})),[t,o]),r=(0,T.useMemo)((()=>[L.Ty]),[]);return(0,z.jsx)(Ee,{actions:r,actionProps:a,children:e=>{let{states:t}=e;return(0,z.jsx)(kt,{disabled:"connected"!==n||Boolean(s),showMenu:!1,states:t})}})})),It={primary:"primary",success:"positive",warning:"caution",danger:"critical"};function _t(e){let{states:n}=e;return(0,z.jsx)(M.gF,{space:1,children:n.map(((e,n)=>(0,z.jsx)(M.u,{content:e.title&&(0,z.jsx)(M.xu,{padding:2,children:(0,z.jsx)(M.xv,{size:1,children:e.title})}),disabled:!e.title,placement:"top",portal:!0,children:(0,z.jsx)(M.Ct,{fontSize:1,mode:"outline",paddingX:2,paddingY:1,radius:4,tone:e.color?It[e.color]:void 0,style:{whiteSpace:"nowrap"},children:e.label})},String(n))))})}function Et(){const{badges:e,editState:n}=(0,L.Z3)();return n&&e?(0,z.jsx)(ze,{badges:e,badgeProps:n,children:e=>{let{states:n}=e;return(0,z.jsx)(_t,{states:n})}}):null}const zt=(0,de.ZP)(M.kC)(C||(C=Ie(["\n cursor: default;\n"])));function Tt(e){const{collapsed:n,disabled:t,lastPublished:i,lastUpdated:o,liveEdit:s}=e,a=(0,oe.INm)(i||"",{minimal:!0,agoSuffix:!0}),r=(0,oe.INm)(i||"",{minimal:!0}),l=(0,oe.INm)(o||"",{minimal:!0,agoSuffix:!0}),c=(0,oe.INm)(o||"",{minimal:!0});return(0,z.jsx)(zt,{align:"center","data-ui":"SessionLayout",sizing:"border",children:(0,z.jsx)(M.u,{placement:"top",portal:!0,content:(0,z.jsx)(M.Kq,{padding:3,space:3,children:(0,z.jsx)(M.xv,{size:1,muted:!0,children:s?(0,z.jsxs)(z.Fragment,{children:["Last updated ",o?l:a]}):(0,z.jsxs)(z.Fragment,{children:["Last published ",a]})})}),children:(0,z.jsx)(M.zx,{mode:"bleed",tone:s?"critical":"positive",tabIndex:-1,disabled:t,children:(0,z.jsxs)(M.kC,{align:"center",children:[(0,z.jsx)(M.xu,{marginRight:n?0:3,children:(0,z.jsx)(M.xv,{size:2,children:s?(0,z.jsx)(ue.o1U,{}):(0,z.jsx)(ue.EI4,{})})}),!n&&(0,z.jsx)(M.xv,{size:1,weight:"medium",children:s?(0,z.jsx)(z.Fragment,{children:o?c:r}):r})]})})})})}const Mt=(0,de.ZP)(Se.E.path)(k||(k=Ie(["\n transform-origin: center;
1\n"]))),Lt=e=>(0,z.jsx)(Se.E.circle,{fill:"none",r:"8",cx:"12.5",cy:"12.5",strokeWidth:"1.2",...e}),Rt=e=>(0,z.jsx)(Mt,{fill:"none",d:"M14 17.5619L11.5 20.5L14.5 23.0619M11 7.43811L13.5 4.50001L10.5 1.93811",...e}),Ot=e=>(0,z.jsx)(Se.E.path,{d:"M9.5 12.1316L11.7414 14.5L16 10",...e}),Ft=e=>(0,z.jsx)(Se.E.path,{d:"M15 7L18 10M6 19L7 15L17 5L20 8L10 18L6 19Z",...e}),Bt=(0,de.F4)(P||(P=Ie(["\n 0% {\n transform: rotate(0);\n }\n 100% {\n transform: rotate(360deg);\n }\n"]))),Nt=de.ZP.g(S||(S=Ie(["\n transform-origin: center;\n\n &[data-rotate] {\n animation: "," 1s ease-in-out infinite;\n }\n"])),Bt),Wt={syncing:{scale:1,transition:{duration:0}},saved:{scale:[1,.8,1.2,.9,1.1,.95,1.05,.99,1],transition:{duration:.5,delay:.2}},changes:{transition:{duration:0}}},Dt={syncing:{strokeDasharray:"0, 0, 23, 3, 23, 3",strokeDashoffset:10,opacity:1,transition:{duration:0}},saved:{strokeDasharray:"0, 0, 23, 0, 23, 0",strokeDashoffset:10,opacity:1,transition:{duration:.2}},changes:{strokeDasharray:"0, 60, 23, 0, 23, 0",strokeDashoffset:0,opacity:0,transition:{duration:.5}}},Zt={syncing:{opacity:1,transition:{duration:0}},saved:{opacity:0,transition:{duration:.2}},changes:{opacity:0}},At={syncing:{pathLength:0,transition:{duration:0}},saved:{pathLength:1,transition:{delay:.4,duration:.3}},changes:{pathLength:0,transition:{duration:.2}}},Kt={syncing:{pathLength:0,transition:{duration:0}},saved:{pathLength:0,transition:{duration:0}},changes:{pathLength:1,transition:{duration:.4,delay:.5}}};function Ut(e){const{status:n}=e;return n?(0,z.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 25 25",fill:"none",stroke:"currentColor",strokeWidth:"1.2","data-sanity-icon":"",children:(0,z.jsxs)(Se.E.g,{variants:Wt,initial:n,animate:n,children:[(0,z.jsxs)(Nt,{"data-rotate":"changes"===n?void 0:"",children:[(0,z.jsx)(Rt,{variants:Zt,initial:n,animate:n}),(0,z.jsx)(Lt,{variants:Dt,initial:n,animate:n})]}),(0,z.jsx)(Ot,{variants:At,initial:n,animate:n}),(0,z.jsx)(Ft,{variants:Kt,initial:n,animate:n})]})}):null}const Vt=T.forwardRef((function(e,n){const{collapsed:t,status:i,lastUpdated:o,...s}=e,a=(0,oe.INm)(o||"",{minimal:!0}),r=(0,oe.INm)(o||"",{minimal:!0,agoSuffix:!0}),l=(0,T.useMemo)((()=>"syncing"===i?{text:"Saving...",tone:void 0}:"changes"===i?{text:a,tone:"caution"}:"saved"===i?{text:"Saved!",tone:"positive"}:{}),[i,a]);return i?(0,z.jsx)(M.u,{placement:"top",portal:!0,disabled:"changes"!==i,content:(0,z.jsxs)(M.Kq,{padding:3,space:3,children:[(0,z.jsx)(M.xv,{size:1,weight:"semibold",children:"Review changes"}),(0,z.jsxs)(M.xv,{size:1,muted:!0,children:["Changes saved ",r]})]}),children:(0,z.jsx)(M.zx,{mode:"bleed",justify:"flex-start",tone:null==l?void 0:l.tone,...s,"data-testid":"review-changes-button",ref:n,children:(0,z.jsxs)(M.kC,{align:"center",children:[(0,z.jsx)(M.xu,{marginRight:t?0:3,children:(0,z.jsx)(M.xv,{children:(0,z.jsx)(Ut,{status:i})})}),!t&&(0,z.jsx)(M.xv,{size:1,weight:"medium",children:null==l?void 0:l.text})]})})}):null})),Ht=T.memo(Vt),Xt=(0,T.memo)((function(){var e;const{changesOpen:n,documentId:t,documentType:i,editState:o,onHistoryClose:s,onHistoryOpen:a,historyController:r,value:l}=(0,L.Z3)(),c=(0,oe.nuD)(t,i),d=null==l?void 0:l._updatedAt,u=null==(e=null==o?void 0:o.published)?void 0:e._updatedAt,p=r.onOlderRevision(),h=Boolean(null==o?void 0:o.liveEdit),m=Boolean(null==o?void 0:o.published),f=Boolean(null==o?void 0:o.draft),[x,g]=(0,T.useState)(null),v=(0,M.XL)(x),j=!v||(null==v?void 0:v.width)<300,[y,b]=(0,T.useState)(null);(0,T.useEffect)((()=>{if("syncing"===y&&!c.isSyncing){const e=setTimeout((()=>b("saved")),1e3);return()=>clearTimeout(e)}if("saved"===y){const e=setTimeout((()=>b(null)),3e3);return()=>clearTimeout(e)}}),[y,d,c.isSyncing]),(0,T.useLayoutEffect)((()=>{b(null)}),[t]),(0,T.useLayoutEffect)((()=>{c.isSyncing&&b("syncing")}),[c.isSyncing,d]);const w=(0,T.useMemo)((()=>(0,z.jsx)(Ht,{lastUpdated:d,status:y||(f?"changes":void 0),onClick:n?s:a,disabled:p,selected:n,collapsed:j})),[f,n,s,a,d,p,y,j]),C=(0,T.useMemo)((()=>(h||m)&&(0,z.jsx)(M.xu,{marginRight:1,children:(0,z.jsx)(Tt,{disabled:p,lastPublished:u,lastUpdated:d,liveEdit:h,collapsed:j})})),[j,u,d,h,m,p]);return(0,z.jsxs)(M.kC,{align:"center","data-ui":"DocumentSparkline",ref:g,children:[C,(0,z.jsxs)(M.kC,{align:"center",flex:1,children:[w,!j&&(0,z.jsx)(M.xu,{marginLeft:3,children:(0,z.jsx)(Et,{})})]})]})})),$t=(0,de.ZP)(M.xu)(I||(I=Ie(["\n min-width: 10em;\n max-width: 16em;\n"])));function qt(e){const{actionsBoxRef:n}=e,{badges:t,historyController:i}=(0,L.Z3)(),o=i.onOlderRevision();return(0,T.useMemo)((()=>(0,z.jsx)(M.xu,{paddingLeft:2,paddingRight:[2,3],paddingY:2,children:(0,z.jsxs)(M.kC,{align:"center",children:[(0,z.jsx)(M.xu,{flex:[1,2],children:t&&(0,z.jsx)(Xt,{})}),(0,z.jsx)($t,{flex:1,marginLeft:[1,3],ref:n,children:o?(0,z.jsx)(St,{}):(0,z.jsx)(Pt,{})})]})})),[n,t,o])}function Yt(e){const{actionsBoxElement:n,activeIndex:t,children:i,id:o,onActionStart:s,onKeyDown:a,rootRef:r,states:l,...c}=e,d=l[t],u=(0,T.useCallback)((e=>{const n=l.filter((n=>n.shortcut&&(0,he.ZP)(n.shortcut,e))),t=n[0];if(n.length>1&&console.warn('Keyboard shortcut conflict: More than one document action matches the shortcut "'.concat(t.shortcut,'"')),t&&!t.disabled&&t.onHandle)return e.preventDefault(),t.onHandle(),void s(l.indexOf(t));a&&a(e)}),[s,a,l]);return(0,z.jsxs)(L.X6,{id:o,onKeyDown:u,tabIndex:-1,...c,ref:r,children:[i,d&&d.dialog&&(0,z.jsx)(oe.jr5,{zOffset:"paneFooter",children:(0,z.jsx)(bt,{dialog:d.dialog,referenceElement:n})})]})}const Jt=T.memo((e=>{const{actionsBoxElement:n,children:t,...i}=e,{actions:o,editState:s}=(0,L.Z3)(),[a,r]=(0,T.useState)(-1),l=(0,T.useCallback)((e=>{r(e)}),[]),c=(0,T.useMemo)((()=>s&&{...s,onComplete:()=>{},revision:void 0}),[s]);return c&&o?(0,z.jsx)(Ee,{actionProps:c,actions:o,children:e=>{let{states:o}=e;return(0,z.jsx)(Yt,{...i,activeIndex:a,actionsBoxElement:n,onActionStart:l,states:o,children:t})}}):null}));Jt.displayName="DocumentActionShortcuts";const Gt=["fixed","absolute"],Qt=(0,de.ZP)(oe.jbM)(_||(_=Ie(["\n flex: 1;\n display: flex;\n min-height: 0;\n min-width: 0;\n"]))),ei=(0,T.memo)((function(e){const{name:n}=(0,oe.Lky)();return(0,z.jsx)(oe.cWh,{name:e.pane.source||n,children:(0,z.jsx)(ni,{...e})})}));function ni(e){var n;const{pane:t,paneKey:i}=e,{resolveNewDocumentOptions:o}=(0,oe.Lky)().document,s=(0,L.RL)(),a=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const t=(0,oe.zEW)();return(0,T.useMemo)((()=>
1{if(e.type&&"*"!==e.type)return e;const i=e.template||n.template,o=i?t.find((e=>e.id===i)):void 0,s=null==o?void 0:o.schemaType;return s?{...e,type:s}:e}),[e,n.template,t])}(t.options,s.params),{documentType:r,isLoaded:l}=(0,oe.Hdz)(a.id,a.type),c=(0,T.useMemo)((()=>o({type:"global"})),[o]),[d,u]=(0,oe.UMU)({templateItems:c}),p=l&&!u,h=(0,T.useMemo)((()=>p&&r&&a.type!==r?function(e,n,t){return{...e,pane:{...e.pane,options:{...n,type:t}}}}(e,a,r):e),[e,r,p,a]),{ReferenceChildLink:m,handleEditReference:f,groupIndex:x,routerPanesState:g}=s,v=(null==(n=g[x+1])?void 0:n[0].params)||{},j=g.length,{parentRefPath:y}=v,b=(0,T.useMemo)((()=>y?{path:(0,me.mL)(y),state:x>=j-1?"none":x>=j-2?"selected":"pressed"}:{path:[],state:"none"}),[y,x,j]);return"*"!==a.type||p?r?(0,z.jsx)(fn,{...h,children:(0,z.jsx)(oe.euX,{EditReferenceLinkComponent:m,onEditReference:f,initialValueTemplateItems:d,activePath:b,children:(0,z.jsx)(ti,{})})},r):(0,z.jsx)(an,{flex:2.5,minWidth:320,paneKey:i,title:(0,z.jsx)(z.Fragment,{children:"The document was not found"}),children:(0,z.jsx)(M.Kq,{space:4,children:(0,z.jsxs)(M.xv,{as:"p",children:["The document type is not defined, and a document with the ",(0,z.jsx)("code",{children:a.id})," ","identifier could not be found."]})})}):(0,z.jsx)(tn,{flex:2.5,minWidth:320,paneKey:i,title:"Loading document\u2026"})}function ti(){const{changesOpen:e,documentType:n,onFocus:t,onPathOpen:i,onHistoryOpen:o,onKeyUp:s,inspectOpen:a,paneKey:r,schemaType:l,value:c}=(0,L.Z3)(),{features:d}=Ae(),{collapsed:u}=(0,L.Cc)(),p=(0,oe.Cnp)(),[h,m]=(0,T.useState)(null),[f,x]=(0,T.useState)(null),[g,v]=(0,T.useState)(null),[j,y]=(0,T.useState)(null),b=(0,M.XL)(f),w=null==b?void 0:b.height,C=(0,T.useMemo)((()=>(0,z.jsx)(ht,{footerHeight:w||null,isInspectOpen:a,rootElement:h,setDocumentPanelPortalElement:y})),[w,h,a]),k=(0,T.useMemo)((()=>(0,z.jsx)(M.Xp,{__unstable_elements:{documentPanelPortalElement:j},children:(0,z.jsx)(M.Tu,{position:Gt,zOffset:p.portal,children:(0,z.jsx)(L.PV,{ref:x,children:(0,z.jsx)(qt,{actionsBoxRef:v})})})})),[j,p.portal]),P=(0,T.useMemo)((()=>d.reviewChanges&&e?(0,z.jsx)(M.NM,{element:h,children:(0,z.jsx)(On,{})}):null),[e,d.reviewChanges,h]),S=(0,T.useCallback)((e=>{i(e),t(e)}),[i,t]),I=(0,T.useMemo)((()=>l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(M.Tu,{position:Gt,zOffset:p.portal,children:(0,z.jsx)(M.kC,{direction:"column",flex:1,height:u?void 0:"fill",children:(0,z.jsxs)(Qt,{"data-testid":"change-connector-root",isReviewChangesOpen:e,onOpenReviewChanges:o,onSetFocus:S,children:[C,P]})})}),k,(0,z.jsx)(cn,{})]}):(0,z.jsx)(an,{flex:2.5,minWidth:320,paneKey:r,title:(0,z.jsxs)(z.Fragment,{children:["Unknown document type: ",(0,z.jsx)("code",{children:n})]}),tone:"caution",children:(0,z.jsxs)(M.Kq,{space:4,children:[n&&(0,z.jsxs)(M.xv,{as:"p",children:["This document has the schema type ",(0,z.jsx)("code",{children:n}),", which is not defined as a type in the local content studio schema."]}),!n&&(0,z.jsx)(M.xv,{as:"p",children:"This document does not exist, and no schema type was specified for it."}),oe.r8Q&&c&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(M.xv,{as:"p",children:"Here is the JSON representation of the document:"}),(0,z.jsx)(M.Zb,{padding:3,overflow:"auto",radius:2,shadow:1,tone:"inherit",children:(0,z.jsx)(M.EK,{language:"json",size:[1,1,2],children:JSON.stringify(c,null,2)})})]})]})})),[l,p.portal,u,e,o,S,C,P,k,r,n,c]),_=e?920:600,E=e?640:320;return(0,z.jsx)(Jt,{actionsBoxElement:g,currentMinWidth:_,"data-testid":"document-pane",flex:2.5,id:r,minWidth:E,onKeyUp:s,rootRef:m,children:I})}function ii(){return(0,z.jsx)(M.Zb,{height:"fill",children:(0,z.jsx)(M.kC,{align:"center",height:"fill",justify:"center",padding:4,sizing:"border",children:(0,z.jsx)(M.W2,{width:0,children:(0,z.jsx)(M.Zb,{padding:4,radius:2,shadow:1,tone:"caution",children:(0,z.jsxs)(M.kC,{children:[(0,z.jsx)(M.xu,{children:(0,z.jsx)(M.xv,{size:1,children:(0,z.jsx)(ue.foC,{})})}),(0,z.jsxs)(M.Kq,{flex:1,marginLeft:3,space:3,children:[(0,z.jsx)(M.xv,{as:"h1",size:1,weight:"bold",children:"No document types"}),(0,z.jsx)(M.xv,{as:"p",muted:!0,size:1,children:"Please define at least one document type in your schema."}),(0,z.jsx)(M.xv,{as:"p",muted:!0,size:1,children:(0,z.jsx)("a",{href:"https://beta.sanity.io/docs/platform/studio/config",target:"_blank",rel:"noreferrer",children:"Learn how to add a document type \u2192"})})]})]})})})})})}const oi=(0,de.ZP)((function(e){const{children:n,minWidth:t,onCollapse:i,onExpand:o,...s}=e,a=(0,T.useMemo)((()=>Oe()),[]),[r,l]=(0,T.useState)(null),c=(0,M.XL)(r),d=(null==c?void 0:c.width)||0,u=void 0!==d&&t?d<t:void 0,[p,h]=(0,T.useState)({expandedElement:null,panes:[],resizing:!1});(0,T.useEffect)((()=>a.setRootElement(r)),[a,r]),(0,T.useEffect)((()=>a.setRootWidth(d)),[a,d]),(0,T.useEffect)((()=>a.subscribe(h)),[a]),(0,T.useEffect)((()=>{void 0!==u&&(u&&i&&i(),!u&&o&&o())}),[u,i,o]);const m=(0,T.useMemo)((()=>({collapse:a.collapse,collapsed:u,expand:a.expand,expandedElement:p.expandedElement,mount:a.mount,panes:p.panes,resize:a.resize,resizing:p.resizing})),[u,a,p.expandedElement,p.panes,p.resizing]);return(0,z.jsx)(L.yq.Provider,{value:m,children:(0,z.jsx)(L.fC,{"data-ui":"PaneLayout",...s,"data-collapsed":u?"":void 0,"data-resizing":p.resizing?"":void 0,"data-mounted":d?"":void 0,ref:l,children:n})})}))(E||(E=Ie(["\n min-height: 100%;\n min-width: 320px;\n"]))),si=(0,he.ZP)("mod+s"),ai=(0,T.memo)((function(e){let{onPaneChange:n}=e;var t;const{navigate:i}=(0,le.tv)(),{push:o}=(0,M.pm)(),s=(0,oe.I_y)(),a=(0,M.d2)(),{layoutCollapsed:r,setLayoutCollapsed:l}=Ae(),{paneDataItems:c,resolvedPanes:d,routerPanes:u}=Xe(),[p,h]=(0,T.useState)(null),m=(0,T.useCallback)((()=>l(!0)),[l]),f=(0,T.useCallback)((()=>l(!1)),[l]);(0,T.useEffect)((()=>{d.length&&n(d)}),[n,d]),(0,T.useEffect)((()=>
1{if(a>1||!r)return;if(!u.some((e=>e.length>1)))return;const e=u.map((e=>[e[0]]));i({panes:e},{replace:!0})}),[a,i,r,u]),(0,T.useEffect)((()=>{const e=e=>{si(e)&&(e.preventDefault(),o({closable:!0,id:"auto-save-message",status:"info",title:"Your work is automatically saved!",duration:4e3}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}),[o]);return(null==(t=s._original)?void 0:t.types.some(oe.mPO))?(0,z.jsxs)(M.Xp,{element:p||null,children:[(0,z.jsx)(oi,{flex:1,height:r?void 0:"fill",minWidth:512,onCollapse:m,onExpand:f,children:c.map((e=>{let{active:n,childItemId:t,groupIndex:i,itemId:o,key:s,pane:a,index:r,params:l,path:c,payload:d,siblingIndex:u,selected:p}=e;return(0,z.jsx)(T.Fragment,{children:a===L.PF?(0,z.jsx)(tn,{paneKey:s,path:c,selected:p}):(0,z.jsx)(sn,{active:n,groupIndex:i,index:r,pane:a,childItemId:t,itemId:o,paneKey:s,params:l,payload:d,selected:p,siblingIndex:u})},"".concat(a===L.PF?"loading":a.type,"-").concat(r))}))}),(0,z.jsx)("div",{"data-portal":"",ref:h})]}):(0,z.jsx)(ii,{})})),ri={};var li=Object.freeze({__proto__:null,default:function(e){let{tool:{options:n}}=e;const{unstable_sources:t}=(0,oe.cFj)(),[i]=t,{source:o,defaultDocumentNode:s,structure:a}=n||{},{state:r}=(0,le.tv)(),l=(0,T.useMemo)((()=>{const e="string"===typeof r.intent?r.intent:void 0,n=(0,oe.Uy$)(r.params)?r.params:ri,t=r.payload;return e?{intent:e,params:n,payload:t}:void 0}),[r]);(0,T.useEffect)((()=>((0,L.aR)([]),()=>(0,L.aR)([]))),[]);const[{error:c},d]=(0,T.useState)({error:null});return c?(0,z.jsx)(Ge,{error:c}):(0,z.jsx)(M.SV,{onCatch:d,children:(0,z.jsx)(oe.cWh,{name:o||i.name,children:(0,z.jsx)(L.Sg,{defaultDocumentNode:s,structure:a,children:l?(0,z.jsx)(qe,{...l}):(0,z.jsx)(ai,{onPaneChange:L.aR})})})})}})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.