PageSourceSearch

https://certera.ai/_next/static/immutable/chunks/28gxb-tczd7ci.js

js certera.ai collected 2026-10-05 11:55:25 UTC 94,607 bytes, 19 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0def5-2111-7ca3-b264-bf91c51897d0")}catch(e){}}();(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,710181,648783,e=>{"use strict";let t,n;var i,r=e.i(530343),o=e.i(599752),s=e.i(260462),a=e.i(928335),l=e.i(466213),c=e.i(287924),u=e.i(631111),d=e.i(830502),p=e.i(942404),h=e.i(208788),m=e.i(708490),f=e.i(758347),y=e.i(187287),g=e.i(242316),v=e.i(917844),x=e.i(852564),b=e.i(613678),w=e.i(993062),E=e.i(295197),j=e.i(558832),I=e.i(18138),k=e.i(565017),S=e.i(912539),C=e.i(40544),_=e.i(615848),M=e.i(795576),M=M,T=e.i(494135),P=e.i(413694),A=e.i(667289),$=e.i(988519),R=e.i(980126),O=e.i(143632),D=e.i(414264),N=e.i(143033),V=e.i(150108),z=e.i(878643),F=e.i(916458),L=e.i(968805),B=e.i(121118),U=e.i(599322),U=U,q=e.i(127841);function W(e){let t=function e(t){var n;return!!(n=t)&&("object"==typeof n||"function"==typeof n)&&("reference"===t.name||e(t.type))}(e)&&1===(e.to??[]).length?e.to[0].icon:void 0;return e.icon??e.type?.icon??t}function K(e,t){return{query:"change query"===t.type?t.query:e.query,groups:"select group"===t.type?e.groups.map(e=>({...e,selected:t.name===e.name})):e.groups,views:"toggle view"===t.type?e.views.map(e=>({...e,selected:t.name===e.name})):e.views}}let Y="all-items",G={gridTemplateColumns:"repeat(auto-fill, minmax(118px, 1fr))",alignItems:"start"};function H(e){let t,n,i,s,l,c,u,d,f,x,b,w,E,j,I,k,S=(0,o.c)(54),C=void 0===e.showIcons||e.showIcons,_=void 0===e.filter||"auto"===e.filter?e.schemaTypes.length>5:e.filter;S[0]!==e.groups||S[1]!==e.labels?(t=e.groups?[{name:Y,title:e.labels["insert-menu.filter.all-items"],selected:!0},...e.groups.map(Z)]:[],S[0]=e.groups,S[1]=e.labels,S[2]=t):t=S[2],S[3]!==e.views?(n=e.views??[{name:"list"}],S[3]=e.views,S[4]=n):n=S[4],S[5]!==n?(i=n.map(X),S[5]=n,S[6]=i):i=S[6],S[7]!==t||S[8]!==i?(s={query:"",groups:t,views:i},S[7]=t,S[8]=i,S[9]=s):s=S[9];let[M,T]=(0,a.useReducer)(K,s);if(S[10]!==e||S[11]!==_||S[12]!==C||S[13]!==M.groups||S[14]!==M.query||S[15]!==M.views){var P,A,$;let t,n,i,o=(P=e.schemaTypes,A=M.query,$=M.groups,P.filter(e=>{var t,n;let i,r;return t=e,(!(i=$.find(e=>e.selected))||i.name===Y||i.of?.includes(t.name))&&(n=e,r=A.trim().toLowerCase(),n.title?n.title?.toLowerCase().includes(r):n.name.includes(r))})),s=M.views.find(J),a=_||M.views.length>1,j=M.groups&&M.groups.length>0,I=a||j;u=v.Menu,E=0,c=g.Flex,x="column",b="fill",S[25]!==I?(t=I?{style:{borderBottom:"1px solid var(--card-border-color)"},paddingBottom:1}:{},S[25]=I,S[26]=t):t=S[26],S[27]!==e.labels||S[28]!==_||S[29]!==a||S[30]!==M.query||S[31]!==M.views?(n=a?(0,r.jsxs)(g.Flex,{flex:"none",align:"center",paddingTop:1,paddingX:1,gap:1,children:[_?(0,r.jsx)(h.Box,{flex:1,children:(0,r.jsx)(L.TextInput,{autoFocus:!0,border:!1,fontSize:1,icon:O.SearchIcon,onChange:e=>{T({type:"change query",query:e.target.value})},placeholder:e.labels["insert-menu.search.placeholder"],value:M.query})}):null,M.views.length>1?(0,r.jsx)(h.Box,{flex:"none",children:(0,r.jsx)(et,{views:M.views,onToggle:e=>{T({type:"toggle view",name:e})},labels:e.labels})}):null]}):null,S[27]=e.labels,S[28]=_,S[29]=a,S[30]=M.query,S[31]=M.views,S[32]=n):n=S[32],S[33]!==j||S[34]!==M.groups?(i=j?(0,r.jsx)(h.Box,{paddingTop:1,paddingX:1,children:(0,r.jsx)(V.TabList,{space:1,children:M.groups.map(e=>(0,r.jsx)(z.Tab,{id:`${e.name}-tab`,"aria-controls":`${e.name}-panel`,label:e.title??(0,U.default)(e.name),selected:e.selected,onClick:()=>{T({type:"select group",name:e.name})}},e.name))})}):null,S[33]=j,S[34]=M.groups,S[35]=i):i=S[35],S[36]!==t||S[37]!==n||S[38]!==i?(w=(0,r.jsxs)(h.Box,{...t,children:[n,i]}),S[36]=t,S[37]=n,S[38]=i,S[39]=w):w=S[39],l=h.Box,d=1,f=0===o.length?(0,r.jsx)(h.Box,{padding:2,children:(0,r.jsx)(m.Text,{muted:!0,size:1,children:e.labels["insert-menu.search.no-results"]})}):s?"grid"===s.name?(0,r.jsx)(F.Grid,{autoRows:"auto",flex:1,gap:1,style:G,children:o.map(t=>(0,r.jsx)(ei,{icon:C?W(t):void 0,onClick:()=>{e.onSelect(t)},previewImageUrl:s.previewImageUrl?.(t.name),schemaType:t}
1,t.name))}):(0,r.jsx)(y.Stack,{flex:1,space:1,children:o.map(t=>(0,r.jsx)(p.MenuItem,{icon:C?W(t):void 0,onClick:()=>{e.onSelect(t)},text:t.title??(0,U.default)(t.name)},t.name))}):null,S[10]=e,S[11]=_,S[12]=C,S[13]=M.groups,S[14]=M.query,S[15]=M.views,S[16]=l,S[17]=c,S[18]=u,S[19]=d,S[20]=f,S[21]=x,S[22]=b,S[23]=w,S[24]=E}else l=S[16],c=S[17],u=S[18],d=S[19],f=S[20],x=S[21],b=S[22],w=S[23],E=S[24];return S[40]!==l||S[41]!==d||S[42]!==f?(j=(0,r.jsx)(l,{padding:d,children:f}),S[40]=l,S[41]=d,S[42]=f,S[43]=j):j=S[43],S[44]!==c||S[45]!==j||S[46]!==x||S[47]!==b||S[48]!==w?(I=(0,r.jsxs)(c,{direction:x,height:b,children:[w,j]}),S[44]=c,S[45]=j,S[46]=x,S[47]=b,S[48]=w,S[49]=I):I=S[49],S[50]!==u||S[51]!==I||S[52]!==E?(k=(0,r.jsx)(u,{padding:E,children:I}),S[50]=u,S[51]=I,S[52]=E,S[53]=k):k=S[53],k}function J(e){return e.selected}function X(e,t){return{...e,selected:0===t}}function Z(e){return{...e,selected:!1}}let Q={grid:D.ThLargeIcon,list:N.UlistIcon},ee={grid:"insert-menu.toggle-grid-view.tooltip",list:"insert-menu.toggle-list-view.tooltip"};function et(e){let t,n,i,s,a=(0,o.c)(11),l=e.views.findIndex(en),c=e.views[l+1]??e.views[0],u=e.labels[ee[c.name]];a[0]!==u?(t=(0,r.jsx)(m.Text,{size:1,children:u}),a[0]=u,a[1]=t):t=a[1];let d=Q[c.name];return a[2]!==c.name||a[3]!==e?(n=()=>{e.onToggle(c.name)},a[2]=c.name,a[3]=e,a[4]=n):n=a[4],a[5]!==d||a[6]!==n?(i=(0,r.jsx)(b.Button,{mode:"bleed",icon:d,onClick:n}),a[5]=d,a[6]=n,a[7]=i):i=a[7],a[8]!==t||a[9]!==i?(s=(0,r.jsx)(B.Tooltip,{content:t,placement:"top",portal:!0,children:i}),a[8]=t,a[9]=i,a[10]=s):s=a[10],s}function en(e){return e.selected}function ei(e){let t,n,i,s,l,c,u,d,f,y=(0,o.c)(20),[v,x]=(0,a.useState)(!1),b=e.icon,w=!!e.previewImageUrl&&!v;y[0]===Symbol.for("react.memo_cache_sentinel")?(t={overflow:"hidden"},y[0]=t):t=y[0],y[1]===Symbol.for("react.memo_cache_sentinel")?(n={backgroundColor:"var(--card-muted-bg-color)",paddingBottom:"66.6%",position:"relative"},y[1]=n):n=y[1],y[2]!==b||y[3]!==w?(i=(0,q.isValidElementType)(b)&&!w?(0,r.jsx)(g.Flex,{align:"center",justify:"center",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},children:(0,r.jsx)(m.Text,{size:1,children:(0,r.jsx)(b,{})})}):null,y[2]=b,y[3]=w,y[4]=i):i=y[4],y[5]!==w||y[6]!==e.previewImageUrl?(s=w?(0,r.jsx)("img",{src:e.previewImageUrl,style:{objectFit:"contain",width:"100%",height:"100%",position:"absolute",inset:0},onError:()=>{x(!0)}}):null,y[5]=w,y[6]=e.previewImageUrl,y[7]=s):s=y[7],y[8]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",boxShadow:"inset 0 0 0 0.5px var(--card-fg-color)",opacity:.1}}),y[8]=l):l=y[8],y[9]!==i||y[10]!==s?(c=(0,r.jsxs)(h.Box,{flex:"none",style:n,children:[i,s,l]}),y[9]=i,y[10]=s,y[11]=c):c=y[11];let E=e.schemaType.title??e.schemaType.name;return y[12]!==E?(u=(0,r.jsx)(h.Box,{flex:"none",paddingX:2,paddingY:1,children:(0,r.jsx)(m.Text,{size:1,weight:"medium",children:E})}),y[12]=E,y[13]=u):u=y[13],y[14]!==c||y[15]!==u?(d=(0,r.jsxs)(g.Flex,{direction:"column",gap:1,padding:1,children:[c,u]}),y[14]=c,y[15]=u,y[16]=d):d=y[16],y[17]!==e.onClick||y[18]!==d?(f=(0,r.jsx)(p.MenuItem,{padding:0,radius:2,onClick:e.onClick,style:t,children:d}),y[17]=e.onClick,y[18]=d,y[19]=f):f=y[19],f}var er=e.i(427532),eo=e.i(439062),es=e.i(216328),ea=e.i(657005),el=e.i(81163),ec=e.i(518395),eu=e.i(854815),ed=e.i(76162);let ep=e=>{let t,n,i,s,a,l=(0,o.c)(10);return l[0]!==e?({children:t,style:i,...n}=e,l[0]=e,l[1]=t,l[2]=n,l[3]=i):(t=l[1],n=l[2],i=l[3]),l[4]!==i?(s={...i,pointerEvents:"all"},l[4]=i,l[5]=s):s=l[5],l[6]!==t||l[7]!==n||l[8]!==s?(a=(0,r.jsx)("div",{style:s,"data-sanity-overlay-element":!0,...n,children:t}),l[6]=t,l[7]=n,l[8]=s,l[9]=a):a=l[9],a};function eh(e){return{type:"log",name:e.name,version:e.version,description:e.description,maxSampleRate:e.maxSampleRate,schema:void 0}}let em={"Visual Editing Drag Sequence Completed":eh({name:"Visual Editing Drag Sequence Completed",description:"An array is successfully reordered using drag and drop.",version:1}),"Visual Editing Drag Minimap Enabled":eh({name:"Visual Editing Drag Minimap Enabled",description:"The zoomed-out minimap view is enabled during a drag sequence.",version:1}),"Visual Editing Context Menu Item Removed":eh({name:"Visual Editing Context Menu Item Removed",description:"An item is removed using the Context Menu.",version:1}),"Visual Editing Context Menu Item Duplicated":eh({name:"Visual Editing Context Menu Item Duplicated",description:"An item is duplicated using the Context Menu.",version:1}),"Visual Editing Context Menu Item Moved":eh({name:"Visual Editing Context Menu Item Moved",description:"An item is moved using the Context Menu.",version:1}),"Visual Editing Context Menu Item Inserted":eh({name:"Visual Editing Context Menu Item Inserted",description:"An item is inserted using the Context Menu.",version:1}),"Visual Editing Insert Menu Item Inserted":eh({name:"Visual Editing Insert Menu Item Inserted",description:"An item is inserted using the Insert Menu.",version:1}),"Visual Editing Overlay Clicked":eh({name:"Visual Editing Overlay Clicked",description:"An Overlay is clicked.",version:1})},ef=(0,a.createContext)(void 0);function ey(){let e=(0,a.useContext)(ef);if(!e)throw Error("Telemetry context is missing");return e}let eg=P.css`
2  overflow-y: scroll;
3  overscroll-behavior: contain;
4  -ms-overflow-style: none;
5  scrollbar-width: none;
6
7  &:before {
8    content: '';
9    display: block;
10    height: calc(100% + 1px);
11    position: absolute;
12    top: 0;
13    width: 100%;
14    z-index: -1;
15  }
16`,ev=P.styled.div.withConfig({displayName:"PortalContainer",componentId:"sc-11pn4rs-0"})`height:100%;inset:0;pointer-events:all;position:fixed;width:100%;display:flex;justify-content:center;align-items:center;${e=>e.$blockScroll&&eg}`,ex=P.styled.div.withConfig({displayName:"PortalBackground",componentId:"sc-11pn4rs-1"})`background:transparent;height:100%;inset:0;position:absolute;width:100%;`,eb=e=>{let t,n=(0,o.c)(2);return n[0]!==e?(t=(0,r.jsx)(er.Portal,{children:(0,r.jsx)(ew,{...e})}),n[0]=e,n[1]=t):t=n[1],t},ew=e=>{let t,n,i=(0,o.c)(7),{children:s,onDismiss:a,setBoundaryElement:l,blockScroll:c}=e,u=void 0===c||c;return i[0]!==a?(t=(0,r.jsx)(ex,{onMouseDownCapture:()=>{a?.()}}),i[0]=a,i[1]=t):t=i[1],i[2]!==u||i[3]!==s||i[4]!==l||i[5]!==t?(n=(0,r.jsxs)(ev,{"data-sanity-overlay-element":!0,ref:l,onClick:eE,$blockScroll:u,children:[t,s]}),i[2]=u,i[3]=s,i[4]=l,i[5]=t,i[6]=n):n=i[6],n};function eE(e){e.stopPropagation()}function ej(e){if(!e)return(0,r.jsx)(ea.CubeIcon,{});if("string"===e.type)return(0,r.jsx)(eu.StringIcon,{});if("number"===e.type)return(0,r.jsx)(ec.NumberIcon,{});let{value:t}=e;if("icon"in e&&e.icon)return(0,r.jsx)("div",{dangerouslySetInnerHTML:{__html:e.icon}});let{type:n}=t;if("string"===n)return(0,r.jsx)(eu.StringIcon,{});if("boolean"===n)return(0,r.jsx)(es.CheckmarkCircleIcon,{});if("number"===n)return(0,r.jsx)(ec.NumberIcon,{});if("array"===n||"union"===n)return(Array.isArray(t.of)?t.of:[t.of]).some(e=>"name"in e&&"block"===e.name)?(0,r.jsx)(eo.BlockContentIcon,{}):(0,r.jsx)(ed.ThListIcon,{});if("object"===n){if("image"===e.name)return(0,r.jsx)(el.ImageIcon,{});if("block"===e.name)return(0,r.jsx)(eu.StringIcon,{})}return(0,r.jsx)(ea.CubeIcon,{})}let eI={"insert-menu.filter.all-items":"All","insert-menu.search.no-results":"No results","insert-menu.search.placeholder":"Filter types…","insert-menu.toggle-grid-view.tooltip":"Toggle grid view","insert-menu.toggle-list-view.tooltip":"Toggle list view"},ek=e=>{let t,n,i,s,a=(0,o.c)(11),{node:l,onSelect:c}=e;a[0]!==l.options?.insertMenu?(t=l.options?.insertMenu||{},a[0]=l.options?.insertMenu,a[1]=t):t=a[1];let u=t;a[2]!==u.views?(n=u.views?.map(eS),a[2]=u.views,a[3]=n):n=a[3];let d=n;return a[4]!==l.of?(i=l.of.map(eC),a[4]=l.of,a[5]=i):i=a[5],a[6]!==u||a[7]!==c||a[8]!==i||a[9]!==d?(s=(0,r.jsx)(H,{...u,labels:eI,schemaTypes:i,onSelect:c,views:d}),a[6]=u,a[7]=c,a[8]=i,a[9]=d,a[10]=s):s=a[10],s};function eS(e){return"grid"===e.name?{...e,previewImageUrl:t=>e.previewImageUrls?.[t]}:e}function eC(e){return{...e,icon:ej(e)}}var e_=e.i(807599),eM=e.i(350961),eT=e.i(357468),eP=e.i(100494),eA=e.i(999893),e$=e.i(524055),eR=e.i(136097),eO=e.i(391188),eD=e.i(460140),eN=e.i(493403),eV=e.i(877825),ez=e.i(981564),eF=e.i(983449),eL=e.i(613473),eB=e.i(843354),eU=e.i(187484),eq=e.i(103614),eW=e.i(10412),eK=e.i(411854),eK=eK,eY=e.i(363981),eG=e.i(659454),eH=e.i(791413),eJ=e.i(178480),eX=e.i(878379),eZ=e.i(634809),eQ=e.i(742375),e0=e.i(730917);function e1(e,t){if("number"==typeof t){var n=e.length,i=t;if(0===n&&(-1===i||0===i))return 0;let r=i<0?n+i:i;return r>=n||r<0?null:r}if((0,eZ.isKeyedElement)(t)){let n=e.findIndex(e=>(null!==e&&"object"==typeof e&&"string"==typeof e._key&&e._key||null)===t._key);return -1===n?null:n}throw Error(`Expected path segment to be addressing a single array item either by numeric index or by '_key'. Instead saw ${JSON.stringify(t)}`)}function e2(e,t,n,i){let r=e.slice();return r.splice(t,n,...i||[]),r}function e3(e,t){let n={...e};for(let e of t)delete n[e];return n}function e4(e,t){var n;if(!Array.isArray(t))throw TypeError('Cannot apply "insert()" on non-array value');let i=e1(t,e.referenceItem);if(null===i)throw Error(`Found no matching array element to insert ${e.position}`);return 0===t.length?e.items:e2(t,(n=e.position,"before"===n?i:i+1),0,e.items)}let e5=Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty);var e9=Object.freeze({__proto__:null,assign:function(e,t){if(!(0,eQ.isObject)(t))throw TypeError('Cannot apply "assign()" on non-object value');return!function(e){for(let t in e)if(e5(e,t))return!1;return!0}(e.value)?{...t,...e.value}:t},dec:function(e,t){if("number"!=typeof t)throw TypeError('Cannot apply "dec()" on non-numeric value');return t-e.amount},diffMatchPatch:function(e,t){if("string"!=typeof t)throw TypeError('Cannot apply "diffMatchPatch()" on non-string value');return(0,e0.applyPatches)((0,e0.parsePatch)(e.value),t)[0]},inc:function(e,t){if("number"!=typeof t)throw TypeError('Cannot apply "inc()" on non-numeric value');return t+e.amount},insert:e4,insertIfMissing:function(e,t){if(!Array.isArray(t))throw TypeError('Cannot apply "insertIfMissing()" on non-array value');
16if(0===e.items.length)return t;let n=e.items.filter(e=>!t.find(t=>e._key===t?._key));return 0===n.length?t:e4({items:n,referenceItem:e.referenceItem,position:e.position},t)},remove:function(e,t){if(!Array.isArray(t))throw TypeError('Cannot apply "remove()" on non-array value');let n=e1(t,e.referenceItem);if(null===n)throw Error("Found no matching array element to replace");return e2(t,n,1,[])},replace:function(e,t){if(!Array.isArray(t))throw TypeError('Cannot apply "replace()" on non-array value');let n=e1(t,e.referenceItem);if(null===n)throw Error("Found no matching array element to replace");return e2(t,n,e.items.length,e.items)},set:function(e,t){return e.value},setIfMissing:function(e,t){return t??e.value},truncate:function(e,t){if(!Array.isArray(t))throw TypeError('Cannot apply "truncate()" on non-array value');return"number"==typeof e.endIndex?t.slice(0,e.startIndex).concat(t.slice(e.endIndex)):t.slice(0,e.startIndex)},unassign:function(e,t){if(!(0,eQ.isObject)(t))throw TypeError('Cannot apply "unassign()" on non-object value');return 0===e.keys.length?t:e3(t,e.keys)},unset:function(e){},upsert:function(e,t){if(!Array.isArray(t))throw TypeError('Cannot apply "upsert()" on non-array value');
16if(0===e.items.length)return t;let n={},i=[];e.items.forEach((e,r)=>{let o=t.findIndex(t=>t?._key===e._key);o>=0?n[o]=r:i.push(e)});let r=Object.keys(n);if(0===r.length&&0==i.length)return t;let o=[...t];for(let t of r){let i=Number(t);o[i]=e.items[n[i]]}return e4({items:i,referenceItem:e.referenceItem,position:e.position},o)}});function e6(e,t){return e.reduce((e,t)=>e8(t,e),t)}function e8(e,t){return function e(t,n,i){if(!(t.length>0)){if(!(n.type in e9))throw Error(`Invalid operation type: "${n.type}"`);return e9[n.type](n,i)}let[r,...o]=t;if((0,eZ.isArrayElement)(r)&&Array.isArray(i)){var s=r,a=o,l=n,c=i;let t=e1(c,s);if(null===t||-1===t)return c;let u=c[t],d=e(a,l,u);return d===u?c:e2(c,t,1,void 0===d?[]:[d])}if((0,eZ.isPropertyElement)(r)&&(0,eQ.isObject)(i)){var u=r,d=o,p=n,h=i;let t=h[u];if(void 0===t&&d.length>0)return h;let s=e(d,p,t);return void 0===s?e3(h,[u]):s===t?h:{...h,[u]:s}}throw Error(`Cannot apply operation of type "${n.type}" to path ${(0,eZ.stringify)(t)} on ${typeof i} value`)}(e.path,e.op,t)}function e7(e){return"_id"in e}function te(e,t){if(0===e.length)return t;let n=t;for(let t of e){if((0,eZ.isArrayElement)(t)){if(!Array.isArray(n))return;if((0,eZ.isKeyedElement)(t)){n=n.find(e=>e._key===t._key);continue}n=n[t];continue}n=n[t]}return n}var tt=e.i(618991),tn=e.i(114395);function ti(e){if("patch"===e.type)return e.id;if("create"===e.type)return e.document._id;if("delete"===e.type)return e.id;if("createIfNotExists"===e.type||"createOrReplace"===e.type)return e.document._id;throw Error("Invalid mutation type")}function tr(e,t){return t.reduce((e,t)=>{let n=to(e,t);if("error"===n.status)throw Error(n.message);return"noop"===n.status?e:n.after},e)}function to(e,t){if("create"===t.type){var n,i,r,o,s,a,l,c,u=e,d=t;if(u)return{status:"error",message:"Document already exist"};let p=(l=d.document,c=tt.nanoid,e7(l)?l:{...l,_id:c()});return{status:"created",id:p._id,after:p}}if("createIfNotExists"===t.type){return n=e,e7((i=t).document)?n?{status:"noop"}:{status:"created",id:i.document._id,after:i.document}:{status:"error",message:"Cannot createIfNotExists on document without _id"}}if("delete"===t.type){return r=e,o=t,r?o.id!==r._id?{status:"error",message:"Delete mutation targeted wrong document"}:{status:"deleted",id:o.id,before:r,after:void 0}:{status:"noop"}}if("createOrReplace"===t.type){return s=e,e7((a=t).document)?s?{status:"updated",id:a.document._id,before:s,after:a.document}:{status:"created",id:a.document._id,after:a.document}:{status:"error",message:"Cannot createIfNotExists on document without _id"}}if("patch"===t.type){var p=e,h=t;if(!p)return{status:"error",message:"Cannot apply patch on nonexistent document"};let n=function(e,t){if(e.options?.ifRevision&&t._rev!==e.options.ifRevision)throw Error("Revision mismatch");if(e.id!==t._id)throw Error(`Document id mismatch. Refusing to apply mutation for document with id="${e.id}" on the given document with id="${t._id}"`);return e6(e.patches,t)}(h,p);return p===n?{status:"noop"}:{status:"updated",id:h.id,before:p,after:n}}throw Error(`Invalid mutation type: ${t.type}`)}function ts(e,t,n){let i=[];for(let n of e.slice().reverse()){if(t(n))return i;i.push(n)}return i.reverse()}function ta(e,t){return(0,eZ.stringify)(e)===(0,eZ.stringify)(t)}function tl(e,t){let n=e;return t.reduce((e,t)=>{let i=n;if(n=e8(t,n),"set"===t.op.type&&"string"==typeof t.op.value){let n=te(t.path,i);if("string"==typeof n){let i={...t,op:{type:"diffMatchPatch",value:(0,e0.stringifyPatches)((0,e0.makePatches)(n,t.op.value))}};return e.flatMap(e=>ta(e.path,t.path)&&"diffMatchPatch"===e.op.type?[]:e).concat(i)}}return e.push(t),e},[])}function tc(e,t,n,i){let r=t,o=i.map(t=>{let n=t.mutations.flatMap(t=>{if(ti(t)!==e)return[];let n=r;return r=tr(r,[t]),n&&"patch"===t.type?{type:"dmpified",mutation:{...t,dmpPatches:tl(n,t.patches),original:t.patches}}:t});return{...t,mutations:n}}),s=n;return o.map(t=>{let n=[];return t.mutations.forEach(t=>{if("dmpified"===t.type)try{s=e6(t.mutation.dmpPatches,s),n.push(t)}catch{console.warn("Failed to apply dmp patch, falling back to original");try{s=e6(t.mutation.original,s),n.push(t)}catch(t){throw Error(`Failed to apply patch for document "${e}": ${t.message}`,{cause:t})}}else s=tr(s,[t])})}),[i.map(t=>({...t,mutations:t.mutations.map(t=>"patch"!==t.type||ti(t)!==e?t:{...t,patches:t.patches.map(e=>"set"!==e.op.type?e:{...e,op:{...e.op,value:te(e.path,s)}})})})),s]}var tu=e.i(921335),td=e.i(134671),tp=e.i(80205),th=e.i(704437),tm=e.i(159862),tf=e.i(799798),ty=e.i(597971),tg=eK,tv=eK,tx=eK;function tb(e,t,n,i,{assignment:r}){if(!t.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let o={},s={context:t.context,event:n.event,spawn:function(e,{machine:t,context:n},i,r){return(o,s)=>{let a=((o,s)=>{if("string"!=typeof o)return(0,tx.c)(o,{id:s?.id,parent:e.self,syncSnapshot:s?.syncSnapshot,input:s?.input,src:o,systemId:s?.systemId});{let a=(0,tx.W)(t,o);if(!a)throw Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);let l=(0,tx.c)(a,{id:s?.id,parent:e.self,syncSnapshot:s?.syncSnapshot,input:"function"==typeof s?.input?s.input({context:n,event:i,self:e.self}):s?.input,src:o,systemId:s?.systemId});return r[l.id]=l,l}})(o,s);return r[a.id]=a,e.defer(()=>{a._processingStatus!==tx._.Stopped&&a.start()}),a}}(e,t,n.event,o),self:e.self,system:e.system},a={};if("function"==typeof r)a=r(s,i);else for(let e of Object.keys(r)){let t=r[e];a[e]="function"==typeof t?t(s,i):t}let l=Object.assign({},t.context,a);return[(0,tx.a0)(t,{context:l,children:Object.keys(o).length?{...t.children,...o}:t.children}),void 0,void 0]}function tw(e){function t(e,t){}return t.type="xstate.assign",t.assignment=e,t.resolve=tb,t}let tE=new WeakMap;function tj(e,t,n){let i=tE.get(e);return i?t in i||(i[t]=n()):(i={[t]:n()},tE.set(e,i)),i[t]}let tI={},tk=e=>"string"==typeof e?{type:e}:"function"==typeof e?"resolve"in e?{type:e.type}:{type:e.name}:e;class tS{constructor(e,t){if(this.config=e,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=t._parent,this.key=t._key,this.machine=t._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(tv.S),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?(0,tv.z)(this.config.states,(e,t)=>new tS(e,{_parent:this,_key:t,_machine:this.machine})):tI,"compound"===this.type&&!this.config.initial)throw Error(`No initial state specified for c
16ompound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=!0===this.config.history?"shallow":this.config.history||!1,this.entry=(0,tv.t)(this.config.entry).slice(),this.exit=(0,tv.t)(this.config.exit).slice(),this.meta=this.config.meta,this.output="final"!==this.type&&this.parent?void 0:this.config.output,this.tags=(0,tv.t)(e.tags).slice()}_initialize(){this.transitions=(0,tv.B)(this),this.config.always&&(this.always=(0,tv.C)(this.config.always).map(e=>(0,tv.D)(this,tv.N,e))),Object.keys(this.states).forEach(e=>{this.states[e]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(tk),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(tk),eventType:null})}:void 0,history:this.history,states:(0,tv.z)(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(tk)})),entry:this.entry.map(tk),exit:this.exit.map(tk),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return tj(this,"invoke",()=>(0,tv.t)(this.config.invoke).map((e,t)=>{let{src:n,systemId:i}=e,r=e.id??(0,tv.F)(this.id,t),o="string"==typeof n?n:`xstate.invoke.${(0,tv.F)(this.id,t)}`;return{...e,src:o,id:r,systemId:i,toJSON(){let{onDone:t,onError:n,...i}=e;return{...i,type:"xstate.invoke",src:o,id:r}}}}))}get on(){return tj(this,"on",()=>[...this.transitions].flatMap(([e,t])=>t.map(t=>[e,t])).reduce((e,[t,n])=>(e[t]=e[t]||[],e[t].push(n),e),{}))}get after(){return tj(this,"delayedTransitions",()=>(0,tv.G)(this))}get initial(){return tj(this,"initial",()=>(0,tv.H)(this,this.config.initial))}next(e,t){let n,i=t.type,r=[];for(let o of tj(this,`candidates-${i}`,()=>(0,tv.I)(this,i))){let{guard:s}=o,a=e.context,l=!1;try{l=!s||(0,tv.E)(s,a,t,e)}catch(t){let e="string"==typeof s?s:"object"==typeof s?s.type:void 0;throw Error(`Unable to evaluate guard ${e?`'${e}' `:""}in transition for event '${i}' in state node '${this.id}':
17${t.message}`)}if(l){r.push(...o.actions),n=o;break}}return n?[n]:void 0}get events(){return tj(this,"events",()=>{let{states:e}=this,t=new Set(this.ownEvents);if(e)for(let n of Object.keys(e)){let i=e[n];if(i.states)for(let e of i.events)t.add(`${e}`)}return Array.from(t)})}get ownEvents(){return Array.from(new Set(Object.keys(Object.fromEntries(this.transitions)).filter(e=>this.transitions.get(e).some(e=>!(!e.target&&!e.actions.length&&!e.reenter)))))}}class tC{constructor(e,t){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.options=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=e.id||"(machine)",this.implementations={actors:t?.actors??{},actions:t?.actions??{},delays:t?.delays??{},guards:t?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.options={maxIterations:1/0,...this.config.options},this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new tS(e,{_key:this.id,_machine:this}),this.root._initialize(),(0,tv.J)(this.root),this.states=this.root.states,this.events=this.root.events}provide(e){let{actions:t,guards:n,actors:i,delays:r}=this.implementations;return new tC(this.config,{actions:{...t,...e.actions},guards:{...n,...e.guards},actors:{...i,...e.actors},delays:{...r,...e.delays}})}resolveState(e){let t=(0,tv.K)(this.root,e.value),n=(0,tv.L)((0,tv.q)(this.root,t));return(0,tv.M)({_nodes:[...n],context:e.context||{},children:{},status:(0,tv.O)(n,this.root)?"done":e.status||"active",output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,t,n){return(0,tv.e)(e,t,n,[]).snapshot}microstep(e,t,n){return(0,tv.e)(e,t,n,[]).microsteps.map(([e])=>e)}getTransitionData(e,t){return(0,tv.P)(this.root,e.value,e,t)||[]}_getPreInitialState(e,t,n){let{context:i}=this.config,r=(0,tv.M)({context:"function"!=typeof i&&i?i:{},_nodes:[this.root],children:{},status:"active"},this);return"function"==typeof i?(0,tv.Q)(r,t,e,[tw(({spawn:e,event:t,self:n})=>i({spawn:e,input:t.input,self:n}))],n,void 0):r}getInitialSnapshot(e,t){let n=(0,tv.f)(t),i=[],r=this._getPreInitialState(e,n,i),[o]=(0,tv.g)(this.root,r,e,n,i),{snapshot:s}=(0,tv.e)(o,n,e,i);return s}
17start(e){Object.values(e.children).forEach(e=>{"active"===e.getSnapshot().status&&e.start()})}getStateNodeById(e){let t=(0,tv.R)(e),n=t.slice(1),i=(0,tv.T)(t[0])?t[0].slice(1):t[0],r=this.idMap.get(i);if(!r)throw Error(`Child state node '#${i}' does not exist on machine '${this.id}'`);return(0,tv.U)(r,n)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,t){return(0,tv.V)(e,t)}restoreSnapshot(e,t){let n={},i=e.children;Object.keys(i).forEach(e=>{let r=i[e],o=r.snapshot,s=r.src,a="string"==typeof s?(0,tv.W)(this,s):s;if(!a)return;let l=(0,tv.c)(a,{id:e,parent:t.self,syncSnapshot:r.syncSnapshot,snapshot:o,src:s,systemId:r.systemId});n[e]=l});let r=function(e,t){if(!t||"object"!=typeof t)return{};let n={};for(let i in t)for(let r of t[i]){let t=function(e,t){if(t instanceof tS)return t;try{return e.machine.getStateNodeById(t.id)}catch{}}(e,r);t&&(n[i]??=[],n[i].push(t))}return n}(this.root,e.historyValue),o=(0,tv.M)({...e,children:n,_nodes:Array.from((0,tv.L)((0,tv.q)(this.root,e.value))),historyValue:r},this),s=new Set;return!function e(t,n){if(!s.has(t))for(let i in s.add(t),t){let r=t[i];if(r&&"object"==typeof r){if("xstate$$type"in r&&r.xstate$$type===tv.$){t[i]=n[r.id];continue}e(r,n)}}}(o.context,n),o}}var t_=eK;function tM(e,t,n,i,{event:r}){return[t,{event:"function"==typeof r?r(n,i):r},void 0]}function tT(e,{event:t}){e.defer(()=>e.emit(t))}function tP(e){function t(e,t){}return t.type="xstate.emit",t.event=e,t.resolve=tM,t.execute=tT,t}let tA=((i={}).Parent="#_parent",i.Internal="#_internal",i);function t$(e,t,n,i,{to:r,event:o,id:s,delay:a},l){let c,u,d=t.machine.implementations.delays;if("string"==typeof o)throw Error(`Only event objects may be used with sendTo; use sendTo({ type: "${o}" }) instead`);let p="function"==typeof o?o(n,i):o;if("string"==typeof a){let e=d&&d[a];c="function"==typeof e?e(n,i):e}else c="function"==typeof a?a(n,i):a;let h="function"==typeof r?r(n,i):r;if("string"==typeof h){if(!(u=h===tA.Parent?e.self._parent:h===tA.Internal?e.self:h.startsWith("#_")?t.children[h.slice(2)]:l.deferredActorIds?.includes(h)?h:t.children[h]))throw Error(`Unable to send event to actor '${h}' from machine '${t.machine.id}'.`)}else u=h||e.self;return[t,{to:u,targetId:"string"==typeof h?h:void 0,event:p,id:s,delay:c},void 0]}function tR(e,t,n){"string"==typeof n.to&&(n.to=t.children[n.to])}function tO(e,t){e.defer(()=>{let{to:n,event:i,delay:r,id:o}=t;"number"==typeof r?e.system.scheduler.schedule(e.self,n,i,r,o):e.system._relay(e.self,n,i.type===t_.Y?(0,t_.Z)(e.self.id,i.data):i)})}function tD(e,t,n){function i(e,t){}return i.type="xstate.sendTo",i.to=e,i.event=t,i.id=n?.id,i.delay=n?.delay,i.resolve=t$,i.retryResolve=tR,i.execute=tO,i}function tN(e,t){return tD(tA.Parent,e,t)}function tV(e,t,n,i,{collect:r}){let o=[],s=function(e){o.push(e)};return s.assign=(...e)=>{o.push(tw(...e))},s.cancel=(...e)=>{o.push((0,t_.b)(...e))},s.raise=(...e)=>{o.push((0,t_.r)(...e))},s.sendTo=(...e)=>{o.push(tD(...e))},s.sendParent=(...e)=>{o.push(tN(...e))},s.spawnChild=(...e)=>{o.push((0,t_.d)(...e))},s.stopChild=(...e)=>{o.push((0,t_.s)(...e))},s.emit=(...e)=>{o.push(tP(...e))},r({context:n.context,event:n.event,enqueue:s,check:e=>(0,t_.E)(e,t.context,n.event,t),self:e.self,system:e.system},i),[t,void 0,o]}function tz(e){function t(e,t){}return t.type="xstate.enqueueActions",t.collect=e,t.resolve=tV,t}function tF(e,t,n,i,{value:r,label:o}){return[t,{value:"function"==typeof r?r(n,i):r,label:o},void 0]}function tL({logger:e},{value:t,label:n}){n?e(n,t):e(t)}function tB(e=({context:e,event:t})=>({context:e,event:t}),t){function n(e,t){}return n.type="xstate.log",n.value=e,n.label=t,n.resolve=tF,n.execute=tL,n}function tU(e,t){let n=(0,tg.t)(t);if(!n.some(t=>(0,tg.m)(e.type,t))){let t=1===n.length?`type matching "${n[0]}"`:`one of types matching "${n.join('", "')}"`;throw Error(`Expected event ${JSON.stringify(e)} to have ${t}`)}}function tq({schemas:e,actors:t,actions:n,guards:i,delays:r}){return{assign:tw,sendTo:tD,raise:tg.r,log:tB,cancel:tg.b,stopChild:tg.s,enqueueActions:tz,emit:tP,spawnChild:tg.d,createStateConfig:e=>e,createAction:e=>e,createMachine:o=>new tC({...o,schemas:e},{actors:t,actions:n,guards:i,delays:r}),extend:o=>tq({schemas:e,actors:t,actions:{...n,...o.actions},guards:{...i,...o.guards},delays:{...r,...o.delays}})}}var tW=e.i(879428),tK=eK,tY=eK,tG=eK,tH=e.i(859210);
17function tJ(e){let t=e.listen('*[!(_id in path("_.**"))]',{},{events:["welcome","mutation","reconnect"],includeResult:!1,includePreviousRevision:!1,visibility:"transaction",effectFormat:"mendoza",includeMutations:!1}).pipe((0,td.share)({resetOnRefCountZero:!0})),n=t.pipe((0,tp.filter)(e=>"reconnect"===e.type)),i=t.pipe((0,tp.filter)(e=>"welcome"===e.type)),r=t.pipe((0,tp.filter)(e=>"mutation"===e.type)),o=(0,eJ.merge)(i,n).pipe((0,th.shareReplay)({bufferSize:1,refCount:!0})).pipe((0,tp.filter)(e=>"welcome"===e.type));return(0,eJ.merge)(o,r,n)}let tX=tq({types:{},actions:{"assign error to context":tw({error:({event:e})=>e}),"clear error from context":tw({error:void 0}),"connect to server-sent events":(0,tG.r)({type:"connect"}),"listen to server-sent events":(0,tY.d)("server-sent events",{id:"listener",input:({context:e})=>({listener:e.sharedListener||tJ(e.client),id:e.id})}),"stop listening to server-sent events":(0,tK.s)("listener"),"buffer remote mutation events":tw({mutationEvents:({event:e,context:t})=>(tU(e,"mutation"),[...t.mutationEvents,e])}),"restore stashed changes":tw({stagedChanges:({event:e,context:t})=>(tU(e,"xstate.done.actor.submitTransactions"),t.stashedChanges),stashedChanges:[]}),"rebase fetched remote snapshot":tz(({enqueue:e})=>{e.assign(({event:e,context:t})=>{tU(e,"xstate.done.actor.getDocument");let n=t.remote,i=e.output,r=!1;for(let e of t.mutationEvents)e.effects?.apply&&(e.previousRev||"appear"===e.transition)&&(r||e.previousRev!==i?._rev||(r=!0),r&&(i=tZ(i,e.effects.apply,e.resultRev)));t.cache&&(!t.cache.has(t.id)||t.cache.get(t.id)._rev!==i?._rev)&&t.cache.set(t.id,i);let[o,s]=tc(t.id,null===n?void 0:n,null===i?void 0:i,t.stagedChanges);return{remote:i,local:s,stagedChanges:o,mutationEvents:[]}}),e.sendParent(({context:e})=>({type:"rebased.remote",id:e.id,document:e.remote}))}),"apply mendoza patch":tw(({event:e,context:t})=>{tU(e,"mutation");let n=t.remote;if(e.transactionId===n?._rev)return{};let i=tZ(n,e.effects.apply,e.resultRev);t.cache&&(!t.cache.has(t.id)||t.cache.get(t.id)._rev!==i?._rev)&&t.cache.set(t.id,i);let[r,o]=tc(t.id,null===n?void 0:n,null===i?void 0:i,t.stagedChanges);return{remote:i,local:o,stagedChanges:r}}),"increment fetch attempts":tw({fetchRemoteSnapshotAttempts:({context:e})=>e.fetchRemoteSnapshotAttempts+1}),"reset fetch attempts":tw({fetchRemoteSnapshotAttempts:0}),"increment submit attempts":tw({submitTransactionsAttempts:({context:e})=>e.submitTransactionsAttempts+1}),"reset submit attempts":tw({submitTransactionsAttempts:0}),"stage mutation":tw({stagedChanges:({event:e,context:t})=>(tU(e,"mutate"),[...t.stagedChanges,{transaction:!1,mutations:e.mutations}])}),"stash mutation":tw({stashedChanges:({event:e,context:t})=>(tU(e,"mutate"),[...t.stashedChanges,{transaction:!1,mutations:e.mutations}])}),"rebase local snapshot":tz(({enqueue:e})=>{e.assign({local:({event:e,context:t})=>{var n;tU(e,"mutate");let i=new Map;return t.local&&i.set(t.id,t.local),n=function(e,t){let n=Object.create(null);for(let i of e){let e=ti(i);if(!e)throw Error("Unable to get document id from mutation");let r=n[e]?.after||t.get(e),o=to(r,i);if("error"===o.status)throw Error(o.message);"noop"!==o.status&&("updated"===o.status||"created"===o.status||"deleted"===o.status)&&(e in n||(n[e]={before:r,after:void 0,muts:[]}),t.set(e,o.after),n[e].after=o.after,n[e].muts.push(i))}return Object.entries(n).map(([e,{before:t,after:n,muts:i}])=>({id:e,status:n?t?"updated":"created":"deleted",mutations:i,before:t,after:n}))}(e.mutations,i),n.forEach(e=>{("created"===e.status||"updated"===e.status)&&i.set(e.id,e.after),"deleted"===e.status&&i.delete(e.id)}),i.get(t.id)}}),e.sendParent(({context:e})=>({type:"rebased.local",id:e.id,document:e.local}))}),"send pristine event to parent":tN(({context:e})=>({type:"pristine",id:e.id})),"send sync event to parent":tN(({context:e})=>({type:"sync",id:e.id,document:e.remote})),"send mutation event to parent":tN(({context:e,event:t})=>(tU(t,"mutation"),{type:"mutation",id:e.id,previousRev:t.previousRev,resultRev:t.resultRev,effects:t.effects}))},actors:{"server-sent events":(0,tW.fromEventObservable)(({input:e})=>{let{listener:t,id:n}=e;return(0,tm.defer)(()=>t).pipe((0,tp.filter)(e=>"welcome"===e.type||"reconnect"===e.type||"mutation"===e.type&&e.documentId===n),(0,tf.observeOn)(ty.asapScheduler))}),"fetch remote snapshot":(0,tW.fromPromise)(async({input:e,signal:t})=>{let{client:n,id:i}=e;return await n.getDocument(i,{signal:t}).catch(e=>{if(!(e instanceof Error&&"AbortError"===e.name))throw e})}),"submit mutations as transactions":(0,tW.fromPromise)(async({input:e,signal:t})=>{let{client:n,transactions:i}=e;for(let e of i){if(t.aborted)return;await n.dataRequest("mutate",(0,tH.encodeTransaction)(e),{visibility:"async",returnDocuments:!1,signal:t}).catch(e=>{if(!(e instanceof Error&&"AbortError"===e.name))throw e})}})},delays:{fetchRemoteSnapshotTimeout:({context:e})=>1e3*Math.pow(2,e.fetchRemoteSnapshotAttempts),submitTransactionsTimeout:({context:e})=>1e3*Math.pow(2,e.submitTransactionsAttempts)}}).createMachine({id:"document-mutator",context:({input:e})=>({client:e.client.withConfig({allowReconfigure:!1}),sharedListener:e.sharedListener,id:e.id,remote:void 0,local:void 0,mutationEvents:[],stagedChanges:[],stashedChanges:[],error:void 0,fetchRemoteSnapshotAttempts:0,submitTransactionsAttempts:0,cache:e.cache}),entry:["connect to server-sent events"],on:{mutate:{actions:["rebase local snapshot","stage mutation"]}},initial:"disconnected",states:{disconnected:{on:{connect:{target:"connecting",actions:["listen to server-sent events"]}}},connecting:{on:{welcome:"connected",reconnect:"reconnecting",error:"connectFailure"},tags:["busy"]},connectFailure:{on:{connect:{target:"connecting",actions:["listen to server-sent events"]}},entry:["stop listening to server-sent events","assign error to context"],exit:["clear error from context"],tags:["error"]},reconnecting:{on:{welcome:{target:"connected"},error:{target:"connectFailure"}},tags:["busy","error"]},connected:{on:{mutation:{actions:["buffer remote mutation events"]},reconnect:"reconnecting"},entry:["clear error from context"],initial:"loading",states:{loading:{invoke:{src:"fetch remote snapshot",id:"getDocument",input:({context:e})=>({client:e.client,id:e.id}),onError:{target:"loadFailure"},onDone:{target:"loaded",actions:["rebase fetched remote snapshot","reset fetch attempts"]}},tags:["busy"]},loaded:{entry:["send sync event to parent"],on:{mutation:{actions:["apply mendoza patch","send mutation event to parent"]}},initial:"pristine",states:{pristine:{on:{mutate:{actions:["rebase local snapshot","stage mutation"],target:"dirty"}},tags:["ready"]},dirty:{on:{submit:"submitting"},tags:["ready"]},submitting:{on:{mutate:{actions:["rebase local snapshot","stash mutation"]}},invoke:{src:"submit mutations as transactions",id:"submitTransactions",input:({context:e})=>{var t,n;let i,r,o=new Map;return o.set(e.id,e.remote),{client:e.client,transactions:(t=e.stagedChanges,n=e=>
17!e.transaction,i=[],r=[],t.forEach(e=>{n(e)?r.push(e):(r.length>0&&i.push(r),r=[],i.push([e]))}),r.length>0&&i.push(r),i).flatMap(e=>({...e[0],mutations:e.flatMap(e=>e.mutations)})).map(e=>{var t;return{...e,mutations:(t=e.mutations,Object.values((0,eX.default)(t,ti)).flatMap(e=>{var t,n;return(0===(n=0===(t=e).length?t:t.reduce((e,t)=>"delete"===t.type?[t]:(e.push(t),e),[])).length?n:n.reduce((e,t)=>("createIfNotExists"!==t.type?e.push(t):ts(e,e=>"delete"===e.type).find(e=>"createIfNotExists"===e.type)||e.push(t),e),[])).flat().reduce((e,t)=>{let n=e[e.length-1];return n&&"patch"!==n.type||"patch"!==t.type?e.concat(t):e.slice(0,-1).concat({...t,patches:(n?.patches||[]).concat(t.patches)})},[])}))}}).map(e=>({...e,mutations:e.mutations.map(e=>"patch"!==e.type?e:{...e,patches:e.patches.reduce((e,t)=>{if("unset"!==t.op.type)return e.push(t),e;let n=e.filter(e=>!(0,eZ.startsWith)(t.path,e.path));return n.push(t),n},[]).reduceRight((e,t)=>(e.find(e=>{var n,i;return n=e.op,("set"===(i=t.op).type||"unset"===i.type)&&("set"===n.type||"unset"===n.type)&&ta(e.path,t.path)})||e.unshift(t),e),[]).reduce((e,t)=>("setIfMissing"!==t.op.type?e.push(t):ts(e,e=>"unset"===e.op.type).find(e=>"setIfMissing"===e.op.type&&ta(e.path,t.path))||e.push(t),e),[])})})).map(e=>{var t;return{...e,mutations:(t=o,e.mutations.map((e,n)=>{var i,r;if("patch"!==e.type)return e;let o=t.get(e.id);return o?(i=o,{...r=e,patches:tl(i,r.patches)}):e}))}}).map(e=>e.transaction&&void 0!==e.id?{id:e.id,mutations:e.mutations}:{id:(0,tn.uuid)(),mutations:e.mutations})}},onError:{target:"submitFailure"},onDone:{target:"pristine",actions:["restore stashed changes","reset submit attempts","send pristine event to parent"]}},tags:["busy","ready"]},submitFailure:{exit:["clear error from context"],after:{submitTransactionsTimeout:{actions:["increment submit attempts"],target:"submitting"}},on:{retry:"submitting"},tags:["error","ready"]}}},loadFailure:{exit:["clear error from context"],after:{fetchRemoteSnapshotTimeout:{actions:["increment fetch attempts"],target:"loading"}},on:{retry:"loading"},tags:["error"]}}}}});function tZ(e,t,n){let i=(0,tu.applyPatch)(function(e){if(!e)return null;let{_rev:t,...n}=e;return n}(e),t);return i?Object.assign(i,{_rev:n}):null}var tK=eK;let tQ=e=>{let t=(0,tW.fromPromise)(async({input:t,signal:n})=>{let{id:i}=t,{snapshot:r}=await e.fetch("visual-editing/fetch-snapshot",{documentId:i},{signal:n});return r}),n=(0,tW.fromPromise)(async({input:t})=>{let{transactions:n}=t;for(let t of n){let n=R.SanityEncoder.encodeTransaction(t);return e.post("visual-editing/mutate",n)}});return tX.provide({actions:{"send sync event to parent":tz(({enqueue:e})=>{e.sendParent(({context:e})=>({type:"sync",id:e.id,document:e.remote})),e.emit(({context:e})=>({type:"ready",snapshot:e.local}))})},actors:{"fetch remote snapshot":t,"submit mutations as transactions":n}})},t0=tq({types:{},actions:{"emit sync event":tP(({event:e})=>(tU(e,"sync"),e)),"emit mutation event":tP(({event:e})=>(tU(e,"mutation"),e)),"emit rebased event":tP(({event:e})=>(tU(e,["rebased.local","rebased.remote"]),e)),"emit pristine event":tP(({event:e})=>(tU(e,["pristine"]),e)),"add document actor":tw({documents:({context:e,event:t,spawn:n})=>{tU(t,"observe");let i=t.documentId;return e.documents[i]?e.documents:{...e.documents,[i]:n("documentMutatorMachine",{input
17:{id:i,client:e.client,sharedListener:e.sharedListener||tJ(e.client)},id:i})}}}),"stop remote snapshot":(0,tK.s)(({context:e,event:t})=>(tU(t,"unobserve"),e.documents[t.documentId])),"remove remote snapshot from context":tw({documents:({context:e,event:t})=>{if(tU(t,"unobserve"),!e.documents[t.documentId])return e.documents;let{[t.documentId]:n,...i}=e.documents;return i}})},actors:{documentMutatorMachine:tX}}).createMachine({id:"dataset-mutator",context:({input:e})=>({documents:{},client:e.client,sharedListener:e.sharedListener}),on:{sync:{actions:["emit sync event"]},mutation:{actions:["emit mutation event"]},"rebased.*":{actions:["emit rebased event"]},pristine:{actions:["emit pristine event"]},observe:{actions:["add document actor"]},unobserve:{actions:["stop remote snapshot","remove remote snapshot from context"]}},initial:"pristine",states:{pristine:{}}}),t1=e=>t0.provide({actors:{documentMutatorMachine:tQ(e)}});e.s(["createDatasetMutator",0,t1,"createDocumentMutator",0,tQ],648783);let t2=new Set,t3=null;function t4(e){if(t3!==e)for(let t of(t3=e,t2))t()}let t5=e=>{let t,n,i,r,s=(0,o.c)(8),{comlink:l,history:c}=e;return s[0]!==l||s[1]!==c?(t=()=>l?.on("presentation/navigate",e=>{c?.update(e)}),n=[l,c],s[0]=l,s[1]=c,s[2]=t,s[3]=n):(t=s[2],n=s[3]),(0,a.useEffect)(t,n),s[4]!==l||s[5]!==c?(i=()=>{if(c)return c.subscribe(e=>{e.title=e.title||document.title,l?.post("visual-editing/navigate",e)})},r=[l,c],s[4]=l,s[5]=c,s[6]=i,s[7]=r):(i=s[6],r=s[7]),(0,a.useEffect)(i,r),null},t9=new Set,t6=null,t8=null,t7=null,ne=null,nt=new Set,nn=!1,ni=0;function nr(e){return nt.add(e),()=>nt.delete(e)}function no(){return nn}let ns=e=>{let t,n,i=(0,o.c)(3),{comlink:r}=e;return i[0]!==r?(t=()=>{let e=()=>{r.post("visual-editing/meta",{title:document.title})},t=new MutationObserver(t=>{let[n]=t;"TITLE"===n.target.nodeName&&e()});return t.observe(document.head,{subtree:!0,characterData:!0,childList:!0}),e(),()=>t.disconnect()},n=[r],i[0]=r,i[1]=t,i[2]=n):(t=i[1],n=i[2]),(0,a.useEffect)(t,n),null};function na(e){let t=new CustomEvent("sanity/dragEnd",{detail:e,cancelable:!0});window.dispatchEvent(t)}let nl=(0,a.createContext)(null);function nc(){let e=(0,a.useContext)(nl);if(!e)throw Error("Schema context is missing");return e}function nu(e,t,n,i){if(!e.type)throw Error("Node type is missing");return()=>t.patch(()=>(0,A.getArrayInsertPatches)(e,n,i))}function nd(e){let{node:t,doc:n}=e;return n?[{type:"action",label:"Duplicate",icon:eT.CopyIcon,action:function(e,t){if(!e.type)throw Error("Node type is missing");return()=>t.patch(async({getSnapshot:t})=>(0,A.getArrayDuplicatePatches)(e,await t()))}(t,n),telemetryEvent:"Visual Editing Context Menu Item Duplicated"}]:[]}function np(e){let{node:t,doc:n}=e;return n?[{type:"action",label:"Remove",icon:eR.RemoveIcon,action:function(e,t){if(!e.type)throw Error("Node type is missing");return()=>t.patch(async({getSnapshot:t})=>(0,A.getArrayRemovePatches)(e,await t()))}(t,n),telemetryEvent:"Visual Editing Context Menu Item Removed"}]:[]}async function nh(e,t=!0){let{node:n,doc:i}=e;if(!i)return[];let r=[],o=[],[s,a,l,c]=await Promise.all([(0,A.getArrayMovePatches)(n,i,"previous"),(0,A.getArrayMovePatches)(n,i,"next"),(0,A.getArrayMovePatches)(n,i,"first"),(0,A.getArrayMovePatches)(n,i,"last")]);return l.length&&o.push({type:"action",label:"To top",icon:e$.PublishIcon,action:()=>i.patch(l),telemetryEvent:"Visual Editing Context Menu Item Moved"}),s.length&&o.push({type:"action",label:"Up",icon:eM.ArrowUpIcon,action:()=>i.patch(s),telemetryEvent:"Visual Editing Context Menu Item Moved"}),a.length&&o.push({type:"action",label:"Down",icon:e_.ArrowDownIcon,action:()=>i.patch(a),telemetryEvent:"Visual Editing Context Menu Item Moved"}),c.length&&o.push({type:"action",label:"To bottom",icon:eD.UnpublishIcon,action:()=>i.patch(c),telemetryEvent:"Visual Editing Context Menu Item Moved"}),o.length&&(r.push({type:"group",label:"Move",icon:eO.SortIcon,items:o}),t&&r.push({type:"divider"})),r}async function nm(e){let{node:t,field:n,doc:i}=e,r=[];return r.push(...nd(e)),r.push(...np(e)),r.push(...await nh(e)),r.push({type:"action",label:"Insert before",icon:eP.InsertAboveIcon,action:nu(t,
17i,n.name,"before"),telemetryEvent:"Visual Editing Context Menu Item Inserted"}),r.push({type:"action",label:"Insert after",icon:eA.InsertBelowIcon,action:nu(t,i,n.name,"after"),telemetryEvent:"Visual Editing Context Menu Item Inserted"}),r}let nf=e=>{let t,n,i,s,a,l=(0,o.c)(12),{label:c,parent:d,width:p,onSelect:h,boundaryElement:m}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=["left-start","right","left","right-end","left-end","bottom","top"],l[0]=t):t=l[0],l[1]===Symbol.for("react.memo_cache_sentinel")?(n=[4,4,4,4],l[1]=n):n=l[1],l[2]!==m||l[3]!==p?(i={arrow:!1,constrainSize:!0,floatingBoundary:m,padding:0,placement:"right-start",fallbackPlacements:t,preventOverflow:!0,width:p,__unstable_margins:n},l[2]=m,l[3]=p,l[4]=i):i=l[4],l[5]!==h||l[6]!==d?(s=(0,r.jsx)(ek,{node:d,onSelect:h}),l[5]=h,l[6]=d,l[7]=s):s=l[7],l[8]!==c||l[9]!==i||l[10]!==s?(a=(0,r.jsx)(u.MenuGroup,{fontSize:1,icon:eA.InsertBelowIcon,padding:2,popover:i,space:2,text:c,children:s}),l[8]=c,l[9]=i,l[10]=s,l[11]=a):a=l[11],a};async function ny(e){let{doc:t,node:n,parent:i}=e,o=[];if(o.push(...nd(e)),o.push(...np(e)),o.push(...await nh(e)),i.options?.insertMenu){let e=(i.options.insertMenu||{}).views?.some(e=>"grid"===e.name)?0:void 0;o.push({type:"custom",component:({boundaryElement:o,sendTelemetry:s})=>(0,r.jsx)(nf,{label:"Insert before",onSelect:e=>{nu(n,t,e.name,"before")(),s("Visual Editing Context Menu Item Inserted",null)},parent:i,width:e,boundaryElement:o})}),o.push({type:"custom",component:({boundaryElement:o,sendTelemetry:s})=>(0,r.jsx)(nf,{label:"Insert after",onSelect:e=>{nu(n,t,e.name,"after")(),s("Visual Editing Context Menu Item Inserted",null)},parent:i,width:e,boundaryElement:o})})}else o.push({type:"group",label:"Insert before",icon:eP.InsertAboveIcon,items:i.of.filter(e=>"unionOption"===e.type).map(e=>({type:"action",icon:ej(e),label:"block"===e.name?"Paragraph":e.title||e.name,action:nu(n,t,e.name,"before"),telemetryEvent:"Visual Editing Context Menu Item Inserted"}))}),o.push({type:"group",label:"Insert after",icon:eA.InsertBelowIcon,items:i.of.filter(e=>"unionOption"===e.type).map(e=>({type:"action",label:"block"===e.name?"Paragraph":e.title||e.name,icon:ej(e),action:nu(n,t,e.name,"after"),telemetryEvent:"Visual Editing Context Menu Item Inserted"}))});return o}let ng=[-4,4,-4,4];function nv(e){let t,n=(0,o.c)(27),{node:i,onDismiss:s,boundaryElement:a}=e,l=ey();n[0]!==i||n[1]!==s||n[2]!==l?(t=()=>{"action"===i.type&&(i.action?.(),s?.(),i.telemetryEvent&&l(i.telemetryEvent,null))},n[0]=i,n[1]=s,n[2]=l,n[3]=t):t=n[3];let c=t;if("divider"===i.type){let e;return n[4]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(d.MenuDivider,{}),n[4]=e):e=n[4],e}if("action"===i.type){let e,t=!i.action;return n[5]!==i.hotkeys||n[6]!==i.icon||n[7]!==i.label||n[8]!==c||n[9]!==t?(e=(0,r.jsx)(p.MenuItem,{fontSize:1,hotkeys:i.hotkeys,icon:i.icon,padding:2,space:2,text:i.label,disabled:t,onClick:c}),n[5]=i.hotkeys,n[6]=i.icon,n[7]=i.label,n[8]=c,n[9]=t,n[10]=e):e=n[10],e}if("group"===i.type){let e,t,o,l=i.icon;n[11]===Symbol.for("react.memo_cache_sentinel")?(e={arrow:!1,constrainSize:!0,placement:"right-start",fallbackPlacements:["left-start","right","left","right-end","left-end","bottom","top"],preventOverflow:!0,__unstable_margins:ng},n[11]=e):e=n[11];let c=i.label;if(n[12]!==a||n[13]!==i.items||n[14]!==s){let e;n[16]!==a||n[17]!==s?(e=(e,t)=>(0,r.jsx)(nv,{node:e,onDismiss:s,boundaryElement:a},t),n[16]=a,n[17]=s,n[18]=e):e=n[18],t=i.items.map(e),n[12]=a,n[13]=i.items,n[14]=s,n[15]=t}else t=n[15];return n[19]!==i.icon||n[20]!==i.label||n[21]!==t?(o=(0,r.jsx)(u.MenuGroup,{fontSize:1,icon:l,padding:2,popover:e,space:2,text:c,children:t}),n[19]=i.icon,n[20]=i.label,n[21]=t,n[22]=o):o=n[22],o}if("custom"===i.type){let e,{component:t}=i;return n[23]!==t||n[24]!==a||n[25]!==l?(e=(0,r.jsx)(t,{boundaryElement:a,sendTelemetry:l}),n[23]=t,n[24]=a,n[25]=l,n[26]=e):e=n[26],e}return null}let nx=e=>{let t,n,i,s,l,c,u,p,b,w,E,j,I,k,S,C=(0,o.c)(43),{node:_,onDismiss:M,position:T}=e,{x:P,y:$}=T,[R,O]=(0,a.useState)(null),{getField:D}=nc(),{getDocument:N}=(0,A.useDocuments)();C[0]!==D||C[1]!==_?(t=D(_),C[0]=D,C[1]=_,C[2]=t):t=C[2];let{field:V,parent:z}=t,F=V?.title||V?.name||"Unknown type",[L,B]=(0,a.useState)(void 0);C[3]!==V||C[4]!==N||C[5]!==_||C[6]!==z?(n=()=>{(async()=>{let e=N(_.id);e&&B(await function(e){let{node:t,field:n,parent:i,doc:r}=e;return n?.type==="arrayItem"?nm({node:t,field:n,doc:r}):i?.type==="union"?ny({node:t,parent:i,doc:r}):Promise.resolve([])}({node:_,field:V,parent:z,doc:e}))})()},i=[V,_,z,N],C[3]=V,C[4]=N,C[5]=_,C[6]=z,C[7]=n,C[8]=i):(n=C[7],i=C[8]),(0,a.useEffect)(n,i),C[9]!==P||C[10]!==$?(s={getBoundingClientRect:()=>({bottom:$,left:P,right:P,top:$,width:0,height:0})},C[9]=P,C[10]=$,C[11]=s):s=C[11];let U=s;C[12]!==V?(l=ej(V),C[12]=V,C[13]=l):l=C[13];let q=l;C[14]===Symbol.for("react.memo_cache_sentinel")?(c={minWidth:120,maxWidth:160},C[14]=c):c=C[14],C[15]!==q||C[16]!==L?(u=(0,r.jsx)(h.Box,{flex:"none",children:L?(0,r.jsx)(m.Text,{size:1,children:q}):(0,r.jsx)(f.Spinner,{size:1})}),C[15]=q,C[16]=L,C[17]=u):u=C[17];let W=L?F:"Loading...";C[18]!==W?(p=(0,r.jsx)(y.Stack,{flex:1,space:2,children:(0,r.jsx)(m.Text,{size:1,weight:"semibold",children:W})}),C[18]=W,C[19]=p):p=C[19],C[20]!==u||C[21]!==p?(b=(0,r.jsxs)(g.Flex,{gap:2,padding:2,children:[u,p]}),C[20]=u,C[21]=p,C[22]=b):b=C[22],C[23]!==R||C[24]!==L||C[25]!==M?(w=L&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.MenuDivider,{}),L.map((e,t)=>(0,r.jsx)(nv,{node:e,onDismiss:M,boundaryElement:R},t))]}),C[23]=R,C[24]=L,C[25]=M,C[26]=w):w=C[26],C[27]!==b||C[28]!==w?(E=(0,r.jsxs)(v.Menu,{style:c,children:[b,w]}),C[27]=b,C[28]=w,C[29]=E):E=C[29];let K=`${P}-${$}`;return C[30]!==P||C[31]!==$?(j={position:"absolute",left:P,top:$},C[30]=P,C[31]=$,C[32]=j):j=C[32],C[33]!==K||C[34]!==j?(I=(0,r.jsx)("div",{style:j}
17,K),C[33]=K,C[34]=j,C[35]=I):I=C[35],C[36]!==U||C[37]!==E||C[38]!==I?(k=(0,r.jsx)(x.Popover,{__unstable_margins:ng,arrow:!1,open:!0,placement:"right-start",referenceElement:U,content:E,children:I}),C[36]=U,C[37]=E,C[38]=I,C[39]=k):k=C[39],C[40]!==M||C[41]!==k?(S=(0,r.jsx)(eb,{setBoundaryElement:O,onDismiss:M,children:k}),C[40]=M,C[41]=k,C[42]=S):S=C[42],S},nb=(0,a.createContext)(null),nw=(0,P.styled)(w.Card).withConfig({displayName:"Root",componentId:"sc-e95gnt-0"})`background-color:var(--overlay-bg);border-radius:3px;pointer-events:none;position:absolute;will-change:transform;box-shadow:var(--overlay-box-shadow);transition:none;--overlay-bg:transparent;--overlay-box-shadow:inset 0 0 0 1px transparent;[data-overlays] &{--overlay-bg:color-mix(in srgb,transparent 95%,var(--card-focus-ring-color));--overlay-box-shadow:inset 0 0 0 2px color-mix(in srgb,transparent 50%,var(--card-focus-ring-color));}[data-fading-out] &{transition:box-shadow 1550ms,background-color 1550ms;--overlay-bg:rgba(0,0,255,0);--overlay-box-shadow:inset 0 0 0 1px transparent;}&[data-focused]{--overlay-box-shadow:inset 0 0 0 1px var(--card-focus-ring-color);}&[data-hovered]:not([data-focused]){transition:none;--overlay-box-shadow:inset 0 0 0 2px var(--card-focus-ring-color);}:link{text-decoration:none;}`,nE=(0,P.styled)(g.Flex).withConfig({displayName:"Actions",componentId:"sc-e95gnt-1"})`bottom:100%;cursor:pointer;pointer-events:none;position:absolute;right:0;[data-hovered]:not([data-menu-open]) &{pointer-events:all;}[data-flipped] &{bottom:auto;top:100%;}`,nj=(0,P.styled)(g.Flex).withConfig({displayName:"HUD",componentId:"sc-e95gnt-2"})`top:100%;cursor:pointer;pointer-events:none;position:absolute;left:0;gap:4px;padding:4px 0;flex-wrap:wrap;[data-hovered]:not([data-menu-open]) &{pointer-events:all;}[data-flipped] &{top:calc(100% + 2rem);}`,nI=(0,P.styled)(g.Flex).withConfig({displayName:"MenuWrapper",componentId:"sc-e95gnt-3"})`margin:-0.5rem;[data-hovered]:not([data-menu-open]) &{pointer-events:all;}`,nk=(0,P.styled)(g.Flex).withConfig({displayName:"Tab",componentId:"sc-e95gnt-4"})`bottom:100%;cursor:pointer;pointer-events:none;position:absolute;left:0;[data-hovered]:not([data-menu-open]) &{pointer-events:all;}[data-flipped] &{bottom:auto;top:100%;}`,nS=(0,P.styled)(w.Card).withConfig({displayName:"ActionOpen",componentId:"sc-e95gnt-5"})`cursor:pointer;background-color:var(--card-focus-ring-color);right:0;border-radius:3px;& [data-ui='Text']{color:#fff;white-space:nowrap;}`,nC=(0,P.styled)(g.Flex).withConfig({displayName:"Labels",componentId:"sc-e95gnt-6"})`display:flex;align-items:center;background-color:var(--card-focus-ring-color);right:0;border-radius:3px;& [data-ui='Text'],& [data-sanity-icon]{color:#fff;white-space:nowrap;}`,n_=P.styled.div.withConfig({displayName:"ExclusivePluginContainer",componentId:"sc-e95gnt-7"})`position:absolute;inset:0;pointer-events:all;`,nM=e=>{let t,n,i,s,l,u,f,g,x,w,E,j,I,k,S,C,_,M=(0,o.c)(60),{id:T,element:P,focused:A,componentResolver:R,node:O,showActions:D,draggable:N,targets:V,elementType:z,comlink:F,onActivateExclusivePlugin:L,onMenuOpenChange:B,inFrame:U}=e,{getField:q,getType:W}=nc();M[0]!==W||M[1]!==O?(t=W(O),M[0]=W,M[1]=O,M[2]=t):t=M[2];let K=t;M[3]!==O?(n="path"in O?function(e){let{id:t,type:n,path:i,baseUrl:r,tool:o,workspace:s,perspective:a}=e,[l,u]=(0,c.createEditUrl)({baseUrl:r,workspace:s,tool:o,type:n,id:t,path:i?(0,eB.pathToUrlString)(c.studioPath.fromString(i)):[]}).split("?"),d=new URLSearchParams(u),p=a||d.get("perspective");return"drafts"===p?d.delete("perspective"):p&&d.set("perspective",p),`${l}?${d}`}(O):O.href,M[3]=O,M[4]=n):n=M[4];let Y=n,G=function(){let e=(0,a.useContext)(nb);if(!e)throw Error("Preview Snapshots context is missing");return e}();e:{let e;if(!("path"in O)){i=void 0;break e}M[5]!==O||M[6]!==G?(e=G.find(e=>e._id===O.id)?.title,M[5]=O,M[6]=G,M[7]=e):e=M[7],i=e}let H=i;M[8]!==P||M[9]!==A||M[10]!==q||M[11]!==W?(s=function(e,t){let n=W(e),{field:i,parent:r}=q(e);if(!("id"in e)||!i||!n)return;let o=i.value.type;return{document:n,element:P,targetElement:t||P,field:i,focused:!!A,node:e,parent:r,type:o}},M[8]=P,M[9]=A,M[10]=q,M[11]=W,M[12]=s):s=M[12];let J=s;
17if(M[13]!==z||M[14]!==J||M[15]!==O?(l="element"===z?J(O):void 0,M[13]=z,M[14]=J,M[15]=O,M[16]=l):l=M[16],M[17]!==J||M[18]!==V){let e;M[20]!==J?(e=e=>J(e.sanity,e.element),M[20]=J,M[21]=e):e=M[21],u=V.map(e).filter(n$),M[17]=J,M[18]=V,M[19]=u}else u=M[19];M[22]!==l||M[23]!==u?(f={legacyComponentContext:l,pluginContexts:u},M[22]=l,M[23]=u,M[24]=f):f=M[24];let X=f,Z=function(e,t){let n,i=(0,o.c)(3);if(i[0]!==e||i[1]!==t){e:{if(!e){n=void 0;break e}let i=t?.(e);if(!i){n=void 0;break e}if((0,a.isValidElement)(i)){n=i;break e}n=(Array.isArray(i)?i:[i]).map(nP)}i[0]=e,i[1]=t,i[2]=n}else n=i[2];return n}(X.legacyComponentContext,R),Q=function(e,t){let n,i=(0,o.c)(5);if(i[0]!==e||i[1]!==t){let r;i[3]!==t?(r=e=>{let n={id:(0,$.v4)(),context:e,hud:[],exclusive:[]};return t?.forEach(t=>{t.guard?.(e)&&("hud"===t.type&&n.hud.push(t),"exclusive"===t.type&&n.exclusive.push(t))}),n},i[3]=t,i[4]=r):r=i[4],n=e.map(r),i[0]=e,i[1]=t,i[2]=n}else n=i[2];return n}(X.pluginContexts,e.plugins);M[25]!==K?(g=K?.icon?(0,r.jsx)("div",{dangerouslySetInnerHTML:{__html:K.icon}}):(0,r.jsx)(eN.DocumentIcon,{}),M[25]=K,M[26]=g):g=M[26];let ee=g,et=(0,a.useId)();M[27]!==Q?(x=Q?.some(nR),M[27]=Q,M[28]=x):x=M[28];let en=x||Q?.length>1;M[29]!==T?(w=()=>{window.dispatchEvent(new CustomEvent("sanity-overlay/label-click",{detail:{id:T}}))},M[29]=T,M[30]=w):w=M[30];let ei=w;return M[31]!==Y||M[32]!==U||M[33]!==D?(E=D?(0,r.jsx)(nE,{gap:1,paddingY:1,children:(0,r.jsx)(nA,{inFrame:U,href:Y})}):null,M[31]=Y,M[32]=U,M[33]=D,M[34]=E):E=M[34],M[35]!==F||M[36]!==N||M[37]!==ei||M[38]!==ee||M[39]!==et||M[40]!==Q||M[41]!==L||M[42]!==B||M[43]!==en||M[44]!==H?(j=(H||en)&&(0,r.jsx)(nk,{gap:1,paddingY:1,onClick:ei,children:(0,r.jsxs)(nC,{gap:2,padding:2,children:[N&&(0,r.jsx)(h.Box,{marginRight:1,children:(0,r.jsx)(m.Text,{className:"drag-handle",size:0,children:(0,r.jsx)(eV.DragHandleIcon,{})})}),(0,r.jsx)(m.Text,{size:0,children:ee}),H&&(0,r.jsx)(m.Text,{size:1,weight:"medium",children:H}),en&&(0,r.jsx)(h.Box,{paddingLeft:2,onClick:nO,children:(0,r.jsx)(nI,{children:(0,r.jsx)(eL.MenuButton,{id:et,popover:{animate:!0,placement:"bottom-start",constrainSize:!0,tone:"default"},onOpen:()=>{B?.(!0)},onClose:()=>{B?.(!1)},button:(0,r.jsx)(b.Button,{icon:ez.EllipsisVerticalIcon,tone:"primary",padding:2}),menu:(0,r.jsx)(v.Menu,{paddingY:0,children:(0,r.jsx)(ep,{children:Q?.map((e,t)=>(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(y.Stack,{role:"group",paddingY:1,space:0,children:[(0,r.jsx)(p.MenuItem,{paddingY:2,text:(0,r.jsx)(h.Box,{paddingY:2,children:(0,r.jsx)(m.Text,{muted:!0,size:1,style:{textTransform:"capitalize"},children:`${e.context.document.name}: ${e.context.field?.name}`})}),onClick:()=>{e.context.node&&F?.post("visual-editing/focus",e.context.node)}}),e.exclusive.map(t=>t.component?(0,r.jsx)(p.MenuItem,{paddingY:2,icon:t.icon||(0,r.jsx)(eF.PlugIcon,{}),text:(0,r.jsx)(h.Box,{paddingY:2,children:(0,r.jsx)(m.Text,{size:1,children:t.title||t.name})}),onClick:()=>L?.(t,e.context)},t.name):null)]}),t<Q.length-1&&(0,r.jsx)(d.MenuDivider,{})]},e.id))})})})})})]})}),M[35]=F,M[36]=N,M[37]=ei,M[38]=ee,M[39]=et,M[40]=Q,M[41]=L,M[42]=B,M[43]=en,M[44]=H,M[45]=j):j=M[45],M[46]!==Q?(I=Q?.map(nD),M[46]=Q,M[47]=I):I=M[47],M[48]!==I?(k=(0,r.jsx)(nj,{children:I}),M[48]=I,M[49]=k):k=M[49],M[50]!==E||M[51]!==j||M[52]!==k?(S=(0,r.jsxs)(ep,{children:[E,j,k]}),M[50]=E,M[51]=j,M[52]=k,M[53]=S):S=M[53],M[54]!==Z||M[55]!==X.legacyComponentContext?(C=Array.isArray(Z)?Z.map((e,t)=>{let{component:n,props:i}=e;return(0,r.jsx)(n,{PointerEvents:ep,...X.legacyComponentContext,...i},t)}):Z,M[54]=Z,M[55]=X.legacyComponentContext,M[56]=C):C=M[56],M[57]!==S||M[58]!==C?(_=(0,r.jsxs)(r.Fragment,{children:[S,C]}),M[57]=S,M[58]=C,M[59]=_):_=M[59],_},nT=(0,a.memo)(function(e){let t,n,i,s,l,c,u,d,p,h,m,f,y,g=(0,o.c)(39),{draggable:v,focused:x,hovered:b,re
17ct:w,wasMaybeCollapsed:E,enableScrollIntoView:j,inFrame:I}=e,k=(0,a.useRef)(null),S=(0,a.useRef)(!1),C=`${w.w}px`,_=`${w.h}px`,M=`translate(${w.x}px, ${w.y}px)`;g[0]!==C||g[1]!==_||g[2]!==M?(t={width:C,height:_,transform:M},g[0]=C,g[1]=_,g[2]=M,g[3]=t):t=g[3];let T=t;g[4]!==j||g[5]!==x||g[6]!==E?(n=()=>{if(!S.current&&!E&&!0===x&&k.current&&j){let e=k.current;(0,eU.default)(k.current,{behavior:t=>{0!==t.length&&e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},scrollMode:"if-needed",block:"center",inline:"nearest"})}S.current=!0===x},i=[x,E,j],g[4]=j,g[5]=x,g[6]=E,g[7]=n,g[8]=i):(n=g[7],i=g[8]),(0,a.useEffect)(n,i);let[P,A]=(0,a.useState)(!1);g[9]!==b?(s=()=>{if(!k.current||!b)return;let e=new IntersectionObserver(e=>{let[t]=e;A(t.boundingClientRect.top<0)},{threshold:1});return e.observe(k.current),()=>e.disconnect()},g[9]=b,g[10]=s):s=g[10],g[11]!==b||g[12]!==P?(l=[b,P],g[11]=b,g[12]=P,g[13]=l):l=g[13],(0,a.useEffect)(s,l);let[$,R]=(0,a.useState)(null);g[14]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{R(null),window.dispatchEvent(new CustomEvent("sanity-overlay/exclusive-plugin-closed"))},g[14]=c):c=g[14];let O=c;g[15]===Symbol.for("react.memo_cache_sentinel")?(u=(e,t)=>{R({plugin:e,context:t})},g[15]=u):u=g[15];let D=u,N=$?.plugin.component,[V,z]=(0,a.useState)(!1);g[16]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{(0,a.startTransition)(()=>z(!1))},g[16]=d):d=g[16],g[17]!==b?(p=[b],g[17]=b,g[18]=p):p=g[18],(0,a.useEffect)(d,p),g[19]!==N||g[20]!==V?(h=V||N?(0,r.jsx)(ew,{onDismiss:O,blockScroll:V}):null,g[19]=N,g[20]=V,g[21]=h):h=g[21];let F=x?"":void 0,L=b?"":void 0,B=P?"":void 0,U=v?"":void 0,q=V?"":void 0;return g[22]!==N||g[23]!==$||g[24]!==b||g[25]!==I||g[26]!==e?(m=N?(0,r.jsx)(n_,{"data-sanity-overlay-element":!0,onClick:nN,children:(0,r.jsx)(N,{...$.context,closeExclusiveView:O})}):b?(0,r.jsx)(nM,{...e,inFrame:I,onActivateExclusivePlugin:D,onMenuOpenChange:z}):null,g[22]=N,g[23]=$,g[24]=b,g[25]=I,g[26]=e,g[27]=m):m=g[27],g[28]!==T||g[29]!==F||g[30]!==L||g[31]!==B||g[32]!==U||g[33]!==q||g[34]!==m?(f=(0,r.jsx)(nw,{"data-focused":F,"data-hovered":L,"data-flipped":B,"data-draggable":U,"data-menu-open":q,ref:k,style:T,children:m}),g[28]=T,g[29]=F,g[30]=L,g[31]=B,g[32]=U,g[33]=q,g[34]=m,g[35]=f):f=g[35],g[36]!==h||g[37]!==f?(y=(0,r.jsxs)(r.Fragment,{children:[h,f]}),g[36]=h,g[37]=f,g[38]=y):y=g[38],y});function nP(e){return"object"==typeof e&&"component"in e?e:{component:e,props:{}}}let nA=(0,a.memo)(function(e){let t,n,i,s=(0,o.c)(8),{inFrame:l}=e,c=(0,a.useSyncExternalStore)(nV,nz);s[0]!==e.href||s[1]!==c?(t=function e(t,n){try{let i=new URL(t,typeof location>"u"?void 0:location.origin);if(i.hash){let t=new URL(e(i.hash.slice(1),n));return`${i.origin}${i.pathname}${i.search}#${t.pathname}${t.search}`}return i.searchParams.set("preview",n),i.toString()}catch{return t}}(e.href,c),s[0]=e.href,s[1]=c,s[2]=t):t=s[2];let u=t,d=l?void 0:"_blank",p=l?"noopener":"noopener noreferrer";return s[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)(nS,{padding:2,children:(0,r.jsx)(m.Text,{size:1,weight:"medium",children:"Open in Studio"})}),s[3]=n):n=s[3],s[4]!==u||s[5]!==d||s[6]!==p?(i=(0,r.jsx)(h.Box,{as:"a",href:u,target:d,rel:p,children:n}),s[4]=u,s[5]=d,s[6]=p,s[7]=i):i=s[7],i});function n$(e){return void 0!==e}function nR(e){return e.exclusive.length>0}function nO(e){e.stopPropagation()}function nD(e){return(0,r.jsx)(a.Fragment,{children:e.hud.map(t=>{let n=t.component;return n?(0,r.jsx)(n,{...e.context},t.name):null})},e.id)}function nN(e){e.stopPropagation()}function nV(e){let t=()=>e();return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)}function nz(){return window.location.href}let nF=e=>{let t,n=(0,o.c)(5),{dragGroupRect:i}=e,s=`${i.y}px`,a=`${i.x}px`,l=`${i.w-1}px`,c=`${i.h-1}px`;return n[0]!==s||n[1]!==a||n[2]!==l||n[3]!==c?(t=(0,r.jsx)("div",{style:{position:"absolute",top:s,left:a,width:l,height:c,border:"1px dashed #f0709b",pointerEvents:"none"}}),n[0]=s,n[1]=a,n[2]=l,n[3]=c,n[4]=t):t=n[4],t},nL=e=>{let t,n=(0,o.c)(4),{dragInsertPosition:i}=e;if(null===i)return;let s=i?.left||i?.right?"horizontal":"vertical",a=0,l=0,c=0,u=0;if("horizontal"===s){let{left:e,right:t}=i;if(c=6,t&&e){let n=e.rect.x+e.rect.w,i=t.rect.x,r=.0125*Math.min(t.rect.h,e.rect.h);a=.5*n+.5*i-3,l=e.rect.y+r,u=Math.min(t.rect.h,e.rect.h)-2*r}else if(t&&!e){let e=.0125*t.rect.h;a=t.rect.x-3,l=t.rect.y+e,u=t.rect.h-2*e}else if(e&&!t){let t=.0125*e.rect.h;a=e.rect.x+e.rect.w-3,l=e.rect.y+t,u=e.rect.h-2*t}}else{let{bottom:e,top:t}=i;if(e&&t){let n=Math.min(t.rect.x,e.rect.x),i=t.rect.y+t.rect.h,r=e.rect.y,o=.0125*Math.min(e.rect.w,t.rect.w);u=6,a=n+o,l=.5*i+.5*r-3,c=Math.max(e.rect.w,t.rect.w)-2*o}else if(e&&!t){let t=.0125*e.rect.w;a=e.rect.x+t,l=e.rect.y-3,c=e.rect.w-2*t,u=6}else if(t&&!e){let e=.0125*t.rect.w;a=t.rect.x+e,l=t.rect.y+t.rect.h-3,c=t.rect.w-2*e,u=6}}let d=`${c}px`,p=`${u}px`,h=`translate(${a}px, ${l}px)`;return n[0]!==d||n[1]!==p||n[2]!==h?(t=(0,r.jsx)("div",{style:{position:"absolute",width:d,height:p,transform:h,background:"#556bfc",border:"2px s
17olid white",borderRadius:"999px",zIndex:"999999"}}),n[0]=d,n[1]=p,n[2]=h,n[3]=t):t=n[3],t},nB=P.styled.div.withConfig({displayName:"Root",componentId:"sc-1vb3dia-0"})`--drag-preview-opacity:0.98;--drag-preview-skeleton-stroke:#ffffff;@media (prefers-color-scheme:dark){--drag-preview-skeleton-stroke:#383d51;}position:fixed;display:grid;transform:${({$scaleFactor:e,$width:t,$height:n})=>`translate(calc(var(--drag-preview-x) - ${t/2}px), calc(var(--drag-preview-y) - ${n/2}px)) scale(${e})`};width:${({$width:e})=>`${e}px`};height:${({$height:e})=>`${e}px`};z-index:9999999;opacity:var(--drag-preview-opacity);cursor:move;.drag-preview-content-wrapper{position:relative;width:100%;height:100%;container-type:inline-size;}[data-ui='card']{position:relative;width:100%;height:100%;}.drag-preview-skeleton{position:absolute;inset:0;rect{stroke:var(--drag-preview-skeleton-stroke);}}.drag-preview-handle{position:absolute;top:4cqmin;left:4cqmin;width:6cqmin;fill:var(--drag-preview-handle-fill);}`,nU=e=>{var t,n;let i,s,a,l,c,u,d,p,h,m,f,y,g,v,x,b,I,k,S,C,_,M=(0,o.c)(50),{skeleton:T}=e,P=Math.min(T.maxWidth,window.innerWidth/2),A=T.w>P?P/T.w:1,$=T.offsetX*A,R=T.offsetY*A,O=(0,E.usePrefersDark)(),D=(0,j.useTheme_v2)(),N=D.radius[~~(n=(T.w-0)*((t=D.radius.length-2)-1)/1920+1,n<1?1:n>t?t:n)];if(M[0]!==$||M[1]!==R||M[2]!==O||M[3]!==N||M[4]!==A||M[5]!==T.childRects||M[6]!==T.h||M[7]!==T.w){let e=T.childRects.filter(nq),t=T.childRects.filter(nW);s=nB,l=T.w,c=T.h,u=$,d=R,p=A,i=w.Card,y=N,g=4,v="hidden",x="transparent",b=O?"dark":"light",f="drag-preview-content-wrapper",h="drag-preview-skeleton",m=`0 0 ${T.w} ${T.h}`,a=[...e,...t],M[0]=$,M[1]=R,M[2]=O,M[3]=N,M[4]=A,M[5]=T.childRects,M[6]=T.h,M[7]=T.w,M[8]=i,M[9]=s,M[10]=a,M[11]=l,M[12]=c,M[13]=u,M[14]=d,M[15]=p,M[16]=h,M[17]=m,M[18]=f,M[19]=y,M[20]=g,M[21]=v,M[22]=x,M[23]=b}else i=M[8],s=M[9],a=M[10],l=M[11],c=M[12],u=M[13],d=M[14],p=M[15],h=M[16],m=M[17],f=M[18],y=M[19],g=M[20],v=M[21],x=M[22],b=M[23];return M[24]!==a||M[25]!==D.color?(I=a.map((e,t)=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:D.color.skeleton.from},t)),M[24]=a,M[25]=D.color,M[26]=I):I=M[26],M[27]!==I||M[28]!==h||M[29]!==m?(k=(0,r.jsx)("svg",{className:h,viewBox:m,children:I}),M[27]=I,M[28]=h,M[29]=m,M[30]=k):k=M[30],M[31]!==k||M[32]!==f?(S=(0,r.jsx)("div",{className:f,children:k}),M[31]=k,M[32]=f,M[33]=S):S=M[33],M[34]!==i||M[35]!==S||M[36]!==y||M[37]!==g||M[38]!==v||M[39]!==x||M[40]!==b?(C=(0,r.jsx)(i,{radius:y,shadow:g,overflow:v,tone:x,scheme:b,children:S}),M[34]=i,M[35]=S,M[36]=y,M[37]=g,M[38]=v,M[39]=x,M[40]=b,M[41]=C):C=M[41],M[42]!==s||M[43]!==l||M[44]!==c||M[45]!==u||M[46]!==d||M[47]!==p||M[48]!==C?(_=(0,r.jsx)(s,{$width:l,$height:c,$offsetX:u,$offsetY:d,$scaleFactor:p,children:C}),M[42]=s,M[43]=l,M[44]=c,M[45]=u,M[46]=d,M[47]=p,M[48]=C,M[49]=_):_=M[49],_};function nq(e){return"IMG"===e.tagName}function nW(e){return"IMG"!==e.tagName}let nK=(0,P.styled)(w.Card).withConfig({displayName:"Root",componentId:"sc-1ys1jta-0"})`position:fixed;bottom:2rem;left:2rem;`,nY=()=>{let e,t,n=(0,o.c)(2);return n[0]===Symbol.for("react.memo_cache_sentinel")?(e={zIndex:"999999"},n[0]=e):e=n[0],n[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(nK,{padding:2,shadow:2,radius:2,style:e,children:(0,r.jsxs)(g.Flex,{align:"center",gap:2,children:[(0,r.jsx)(I.Hotkeys,{keys:["Shift"]}),(0,r.jsx)(m.Text,{size:1,children:"Zoom Out"}),(0,r.jsx)(eq.ExpandIcon,{})]})}),n[1]=t):t=n[1],t};function nG(e,t){let{type:n}=t,{contextMenu:i,focusPath:r,perspective:o,isDragging:s,dragInsertPosition:a,dragShowMinimap:l,dragShowMinimapPrompt:c,dragSkeleton:u,dragMinimapTransition:d,dragGroupRect:p}=e,h=!1;if("presentation/focus"===n){let n=e.focusPath;n!==(r=t.data.path)&&(h=n.slice(r.length).startsWith("["))}return"presentation/perspective"===n&&(o=t.data.perspective),"element/contextmenu"===n&&(i="sanity"in t?{node:t.sanity,position:t.position}:null),("element/click"===n||"element/mouseleave"===n||"overlay/blur"===n||"presentation/blur"===n||"presentation/focus"===n)&&(i=null),"overlay/dragUpdateInsertPosition"===n&&(a=t.insertPosition),"overlay/dragStart"===n&&(s=!0),"overlay/dragUpdateSkeleton"===t.type&&(u=t.skeleton),"overlay/dragEnd"===n&&(s=!1),"overlay/dragToggleMinimapPrompt"===t.type&&(c=t.display),"overlay/dragStartMinimapTransition"===n&&(d=!0),"overlay/dragEndMinimapTransition"===n&&(d=!1),"overlay/dragUpdateGroupRect"===n&&(p=t.groupRect),"overlay/dragToggleMinimap"===n&&(l=t.display),{...e,contextMenu:i,elements:((e,t)=>{let{type:n}=t;switch(n){case"element/register":return e.find(e=>e.id===t.id)?e:[...e,{id:t.id,activated:!1,element:t.element,focused:!1,hovered:!1,rect:t.rect,sanity:t.sanity,dragDisabled:t.dragDisabled,targets:t.targets,elementType:t.elementType}];case"element/activate":return e.map(e=>e.id===t.id?{...e,activated:!0}:e);case"element/update":return e.map(e=>e.id===t.id?{...e,sanity:t.sanity,rect:t.rect,targets:t.targets,elementType:t.elementType}:e);case"element/unregister":return e.filter(e=>e.id!==t.id);case"element/deactivate":return e.map(e=>e.id===t.id?{...e,activated:!1,hovered:!1}:e);case"element/mouseenter":return e.map(e=>e.id===t.id?{...e,rect:t.rect,hovered:!0}:{...e,hovered:!1});case"element/mouseleave":return e.map(e=>e.id===t.id?{...e,hovered:!1}:e);case"element/updateRect":return e.map(e=>e.id===t.id?{...e,rect:t.rect}:e);case"element/click":return e.map(e=>({...e,focused:e.id===t.id&&"clicked"}));case"overlay/reset-mouse-state":return e.map(e=>({...e,focused:!1,hovered:!1}));case"overlay/blur":return e.map(e=>({...e,focused:!1}));case"presentation/blur":return e.map(e=>({...e,focused:!1}));case"presentation/focus":{let n=e.find(e=>"clicked"===e.focused);return e.map(e=>
17{let i="path"in e.sanity&&e.sanity.id===t.data.id&&e.sanity.path===t.data.path;return n&&e===n&&i?e:{...e,focused:i&&n?"duplicate":i}})}default:return e}})(e.elements,t),dragInsertPosition:a,dragSkeleton:u,dragGroupRect:p,isDragging:s,focusPath:r,perspective:o,wasMaybeCollapsed:h,dragShowMinimap:l,dragShowMinimapPrompt:c,dragMinimapTransition:d}}let nH=function(e){let t,n,i,s,l,c,u,d=(0,o.c)(13),{comlink:p,children:h}=e;d[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],d[0]=t):t=d[0];let[m,f]=(0,a.useState)(t);d[1]!==p?(n=async e=>{if(p)try{let t=await p.fetch("visual-editing/preview-snapshots",void 0,{signal:e,suppressWarnings:!0});f(t.snapshots)}catch{}},d[1]=p,d[2]=n):n=d[2];let y=n;return d[3]!==p||d[4]!==y?(i=()=>{if(!p)return;let e=new AbortController,t=p.onStatus(()=>{y(e.signal)},"connected");return()=>{e.abort(),t()}},s=[p,y],d[3]=p,d[4]=y,d[5]=i,d[6]=s):(i=d[5],s=d[6]),(0,a.useEffect)(i,s),d[7]!==p?(l=()=>p?.on("presentation/preview-snapshots",e=>{f(e.snapshots)}),c=[p],d[7]=p,d[8]=l,d[9]=c):(l=d[8],c=d[9]),(0,a.useEffect)(l,c),d[10]!==h||d[11]!==m?(u=(0,r.jsx)(nb.Provider,{value:m,children:h}),d[10]=h,d[11]=m,d[12]=u):u=d[12],u};function nJ(e){return"document"===e.type}function nX(e){return"type"===e.type}let nZ=function(e){let t,n,i,s,l,c,u,d,p,h,m,f=(0,o.c)(22),{comlink:y,children:g,elements:v}=e;f[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Map,f[0]=t):t=f[0];let[x,b]=(0,a.useState)(t),[w,E]=(0,a.useState)(null);f[1]!==y?(n=()=>{if(!y)return;let e=async function(e){if(y)try{let t=await y.fetch("visual-editing/schema",void 0,{signal:e,suppressWarnings:!0});E(t.schema)}catch{}},t=new AbortController,n=y.onStatus(()=>{e(t.signal)},"connected");return()=>{t.abort(),n()}},i=[y],f[1]=y,f[2]=n,f[3]=i):(n=f[2],i=f[3]),(0,a.useEffect)(n,i),f[4]===Symbol.for("react.memo_cache_sentinel")?(s=[],f[4]=s):s=f[4];let j=(0,a.useRef)(s),I=(0,a.useDeferredValue)(v);f[5]!==I?(l=I.reduce((e,t)=>{let{sanity:n}=t;if(!("id"in n)||!n.path.includes("[_key=="))return e;let i=n.path.split(".").toReversed().reduce((e,t)=>e.length?[t,...e]:t.includes("[_key==")?[t]:[],[]).join(".");return e.find(e=>e.id===n.id&&e.path===i)||e.push({id:n.id,path:i}),e},[]),f[5]=I,f[6]=l):l=f[6];let k=l,S=(0,a.useRef)(null);f[7]!==y||f[8]!==k?(c=()=>{if(!k.length||!y)return;let e=async(e,t)=>{let n=j.current;try{j.current=e;let n=await y.fetch("visual-editing/schema-union-types",{paths:e},{signal:t,suppressWarnings:!0});if(t.aborted)return;b(n.types),S.current=null}catch{}t.aborted&&(j.current=n)};k.some(e=>!j.current.find(t=>{let{id:n,path:i}=t;return n===e.id&&i===e.path}))&&(S.current?.abort(),S.current=new AbortController,e(k,S.current.signal))},u=[y,k],f[7]=y,f[8]=k,f[9]=c,f[10]=u):(c=f[9],u=f[10]),(0,a.useEffect)(c,u),f[11]!==w?(d=(e,t)=>{if(!w||"string"!=typeof e&&(!("path"in e)||!Array.isArray(w)))return;let n="string"==typeof e?e:e.type;return w.filter("document"===(t||"document")?nJ:nX).find(e=>e.name===n)},f[11]=w,f[12]=d):d=f[12];let C=d;f[13]!==C||f[14]!==x?(p=e=>{if(!("path"in e))return{field:void 0,parent:void 0};let t=C(e);if(!t)return{field:void 0,parent:void 0};let n=e.path.split(".").flatMap(nQ);try{return function t(n,i,r,o){let s=void 0===o?[]:o;if(!n)return{field:void 0,parent:void 0};let[a,...l]=i;if("fields"in n){let e=n.fields[a];if(!e&&"rest"in n)return t(n.rest,i,n,s);if(!l.length)return{field:e,parent:r};if(!e)throw Error(`[@sanity/visual-editing] No field could be resolved at path: "${[...s,...i].join(".")}"`);return t(e.value,l,n,[...s,a])}if("array"===n.type)return t(n.of,i,n,s);if("arrayItem"===n.type)return l.length?t(n.value,l,n,[...s,a]):{field:n,parent:r};if("union"===n.type){let i=a.startsWith("[_key==")?x?.get(e.id)?.get([s.join("."),a].filter(Boolean).join("")):a;return t(n.of.find(e=>"unionOption"===e.type?e.name===i:e),l,n,[...s,a])}if("unionOption"===n.type)return a?t(n.value,i,n,s):{field:n,parent:r};if("inline"===n.type)return t(C(n.name,"type").value,i,n,s);throw Error(`[@sanity/visual-editing] No field could be resolved at path: "${[...s,...i].join(".")}"`)}(t,n,void 0)}catch(e){return e instanceof Error&&console.warn(e.message),{field:void 0,parent:void 0}}},f[13]=C,f[14]=x,f[15]=p):p=f[15];let _=p;f[16]!==_||f[17]!==C?(h={getField:_,getType:C},f[16]=_,f[17]=C,f[18]=h):h=f[18];let M=h;return f[19]!==g||f[20]!==M?(m=(0,r.jsx)(nl.Provider,{value:M,children:g}),f[19]=g,f[20]=M,f[21]=m):m=f[21],m};function nQ(e){return e.includes("[")?e.split(/(\[.+\])/,2):[e]}let n0=(t={},n=new Set,{getState:()=>t,setState:e=>
17{t=e(t),n.forEach(e=>e())},subscribe:e=>(n.add(e),()=>n.delete(e))}),n1=e=>{let t,n,i,s,l,c,u=(0,o.c)(11),{comlink:d,children:p}=e;u[0]!==d?(t=()=>d?.on("presentation/shared-state",n2),n=[d],u[0]=d,u[1]=t,u[2]=n):(t=u[1],n=u[2]),(0,a.useEffect)(t,n),u[3]!==d?(i=()=>{(async function(){let e=await d?.fetch("visual-editing/shared-state",void 0,{suppressWarnings:!0});e&&n0.setState(()=>e.state)})().catch(n3)},s=[d],u[3]=d,u[4]=i,u[5]=s):(i=u[4],s=u[5]),(0,a.useEffect)(i,s),u[6]!==d?(l={comlink:d,store:n0},u[6]=d,u[7]=l):l=u[7];let h=l;return u[8]!==p||u[9]!==h?(c=(0,r.jsx)($.SharedStateContext.Provider,{value:h,children:p}),u[8]=p,u[9]=h,u[10]=c):c=u[10],c};function n2(e){"value"in e?n0.setState(t=>({...t,[e.key]:e.value})):n0.setState(t=>Object.fromEntries(Object.entries(t).filter(t=>{let[n]=t;return n!==e.key})))}function n3(e){console.debug(e),console.warn("[@sanity/visual-editing]: Failed to fetch shared state. Check your version of `sanity` is up-to-date")}let n4=e=>{let t,n,i=(0,o.c)(5),{children:s,comlink:a}=e;i[0]!==a?(t=(e,t)=>{if(!a)return;let n=em[e];if(n)a.post("visual-editing/telemetry-log",{event:n,data:t});else throw Error(`Telemetry event: ${e} does not exist`)},i[0]=a,i[1]=t):t=i[1];let l=t;return i[2]!==s||i[3]!==l?(n=(0,r.jsx)(ef.Provider,{value:l,children:s}),i[2]=s,i[3]=l,i[4]=n):n=i[4],n};function n5(){}function n9(e){let{id:t,type:n,projectId:i,dataset:r}=e;return i&&r?{_id:t,_type:n,_projectId:i,_dataset:r}:{_id:t,_type:n}}function n6(e){return e.id}let n8=P.styled.div.withConfig({displayName:"Root",componentId:"sc-dwbgdv-0"})`background-color:transparent;direction:ltr;inset:0;pointer-events:none;position:absolute;width:100%;height:100%;z-index:${({$zIndex:e})=>e??"9999999"};`;function n7(e){let t,n;return t=requestAnimationFrame(()=>{n=requestAnimationFrame(e)}),()=>{void 0!==t&&cancelAnimationFrame(t),void 0!==n&&cancelAnimationFrame(n)}}let ie=e=>{let t,n,i,r,s,l=(0,o.c)(8),{documentIds:u}=e;l[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],l[0]=t):t=l[0];let[d,p]=(0,a.useState)(t);l[1]!==u?(n=()=>{(0,a.startTransition)(()=>p(e=>{let t=Array.from(new Set(u));return e.length===t.length&&e.reduce(iy,t)?.length===0?e:t}))},i=[u],l[1]=u,l[2]=n,l[3]=i):(n=l[2],i=l[3]),(0,a.useEffect)(n,i);let h=(0,A.useOptimisticActor)();return l[4]!==h||l[5]!==d?(r=()=>{for(let e of d)h.send({type:"observe",documentId:(0,c.getDraftId)(e)}),h.send({type:"observe",documentId:(0,c.getPublishedId)(e)});return()=>{for(let e of d)h.send({type:"unobserve",documentId:(0,c.getDraftId)(e)}),h.send({type:"unobserve",documentId:(0,c.getPublishedId)(e)})}},s=[h,d],l[4]=h,l[5]=d,l[6]=r,l[7]=s):(r=l[6],s=l[7]),(0,a.useEffect)(r,s),null},it=e=>{var t;let n,i,r,s,l,c,u,d,p=(0,o.c)(12),{comlink:h,dispatch:m,inFrame:f,inPopUp:y,onDrag:g,overlayEnabled:v,rootElement:x}=e,{dispatchDragEndEvent:b}=function(){let e,t,n,i=(0,o.c)(4),{getDocument:r}=(0,A.useDocuments)();return i[0]!==r?(e=()=>{let e=e=>{let{insertPosition:t,target:n,preventInsertDefault:i}=e.detail;if(i)return;let o=function(e){if(e){let{top:t,right:n,bottom:i,left:r}=e;if(r||t)return{node:(r??t).sanity,position:"after"};if(n||i)return{node:(n??i).sanity,position:"before"}}}(t);if(o){let e=r(n.id),{node:t,position:i}=o,{key:s,hasExplicitKey:a}=(0,A.getArrayItemKeyAndParentPath)(n),{path:l,key:c}=(0,A.getArrayItemKeyAndParentPath)(t);l&&c&&c!==s&&e.patch(async e=>{let{getSnapshot:t}=e,r=await t(),o=(0,A.get)(r,n.path);return a?[(0,R.at)(l,(0,R.remove)({_key:s})),(0,R.at)(l,(0,R.insert)(o,i,{_key:c}))]:[(0,R.at)(l,(0,R.remove)(~~s)),(0,R.at)(l,(0,R.insert)(o,i,c>s?~~c-1:~~c))]})}};return window.addEventListener("sanity/dragEnd",e),()=>{window.removeEventListener("sanity/dragEnd",e)}},t=[r],i[0]=r,i[1]=e,i[2]=t):(e=i[1],t=i[2]),(0,a.useEffect)(e,t),i[3]===Symbol.for("react.memo_cache_sentinel")?(n={dispatchDragEndEvent:na},i[3]=n):n=i[3],n}(),w=ey();p[0]!==h||p[1]!==m||p[2]!==b||p[3]!==g||p[4]!==w?(n=e=>{if("element/click"===e.type){let{sanity:t}=e;h?.post("visual-editing/focus",t),w("Visual Editing Overlay Clicked",null)}else if("overlay/activate"===e.type)h?.post("visual-editing/toggle",{enabled:!0});else if("overlay/deactivate"===e.type)h?.post("visual-editing/toggle",{enabled:!1});else if("overlay/dragEnd"===e.type){let{insertPosition:t,target:n,dragGroup:i,flow:r,preventInsertDefault:o}=e;b({insertPosition:t,target:n,dragGroup:i,flow:r,preventInsertDefault:o}),t&&w("Visual Editing Drag Sequence Completed",null)}else if("overlay/dragUpdateCursorPosition"===e.type)return void g(e.x,e.y);else if("overlay/dragToggleMinimap"===e.type&&!0===e.display)w("Visual Editing Drag Minimap Enabled",null);else if("overlay/setCursor"===e.type){let{element:t,cursor:n}=e;n?t.style.cursor=n:t.style.removeProperty("cursor")}m(e)},p[0]=h,p[1]=m,p[2]=b,p[3]=g,p[4]=w,p[5]=n):n=p[5];let E=(t=n,c=(0,o.c)(7),u=(0,a.useRef)(void 0),d=(0,A.useOptimisticActorReady)(),c[0]!==x||c[1]!==t||c[2]!==f||c[3]!==y||c[4]!==d?(s=()=>
17{if(x)return u.current=(0,$.createOverlayController)({handler:t,overlayElement:x,inFrame:f,inPopUp:y,optimisticActorReady:d}),()=>{u.current?.destroy(),u.current=void 0}},l=[x,t,f,y,d],c[0]=x,c[1]=t,c[2]=f,c[3]=y,c[4]=d,c[5]=s,c[6]=l):(s=c[5],l=c[6]),(0,a.useEffect)(s,l),u);return p[6]!==E.current||p[7]!==v?(i=()=>{v?E.current?.activate():E.current?.deactivate()},p[6]=E.current,p[7]=v,p[8]=i):i=p[8],p[9]!==E||p[10]!==v?(r=[E,v],p[9]=E,p[10]=v,p[11]=r):r=p[11],(0,a.useEffect)(i,r),null};function ii(e){let t,n,i,s,l,c,u,d,p,h,m,f,y,g,v,x,b,w,j,I,M,T,P,R,O,D,N,V,z,F,L,B,U,q,W,K=(0,o.c)(77),{comlink:Y,comlinkStatus:G,componentResolver:H,inFrame:J,inPopUp:X,zIndex:Z,onPerspectiveChange:Q}=e,ee=(0,E.usePrefersDark)();K[0]===Symbol.for("react.memo_cache_sentinel")?(t={contextMenu:null,dragInsertPosition:null,dragShowMinimap:!1,dragShowMinimapPrompt:!1,dragSkeleton:null,elements:[],focusPath:"",isDragging:!1,perspective:"published",wasMaybeCollapsed:!1,dragMinimapTransition:!1,dragGroupRect:null},K[0]=t):t=K[0];let[et,en]=(0,a.useReducer)(nG,t),{contextMenu:ei,dragInsertPosition:er,dragShowMinimap:eo,dragShowMinimapPrompt:es,dragSkeleton:ea,elements:el,isDragging:ec,perspective:eu,wasMaybeCollapsed:ed,dragMinimapTransition:ep,dragGroupRect:eh}=et,[em,ef]=(0,a.useState)(null),[ey,eg]=(0,a.useState)(!0);K[1]!==Y?(n=()=>{let e=[Y?.on("presentation/focus",e=>{en({type:"presentation/focus",data:e})}),Y?.on("presentation/blur",e=>{en({type:"presentation/blur",data:e})}),Y?.on("presentation/toggle-overlay",()=>{eg(ip)})].filter(Boolean);return()=>e.forEach(id)},i=[Y],K[1]=Y,K[2]=n,K[3]=i):(n=K[2],i=K[3]),(0,a.useEffect)(n,i),N=(0,o.c)(11),V=!!Q,N[0]!==en||N[1]!==Q?(R=e=>{en({type:"presentation/perspective",data:e}),Q?.(e.perspective)},N[0]=en,N[1]=Q,N[2]=R):R=N[2],z=(0,a.useEffectEvent)(R),N[3]!==Y||N[4]!==z||N[5]!==V?(O=()=>{let e=new AbortController;Y?.fetch("visual-editing/fetch-perspective",{handlesPerspectiveChange:V},{signal:e.signal,suppressWarnings:!0}).then(e=>{z(e)}).catch(n5);let t=Y?.on("presentation/perspective",e=>{z(e)});return()=>{t?.(),e.abort()}},N[3]=Y,N[4]=z,N[5]=V,N[6]=O):O=N[6],N[7]!==Y||N[8]!==en||N[9]!==V?(D=[Y,en,V],N[7]=Y,N[8]=en,N[9]=V,N[10]=D):D=N[10],(0,a.useEffect)(O,D),U=(0,o.c)(7),q=(0,a.useRef)(void 0),U[0]!==Y?(F=(e,t)=>{Y?.post("visual-editing/documents",{documents:e,perspective:t})},U[0]=Y,U[1]=F):F=U[1],W=F,U[2]!==el||U[3]!==eu||U[4]!==W?(L=()=>{let e,t,n=(e=[...el].sort((e,t)=>{let n=e.rect.y-t.rect.y;return 0!==n?n:e.rect.x-t.rect.x}),t=new Set,e.reduce((e,n)=>{let{sanity:i}=n;return!(!i||!("id"in i)||t.has(i.id))&&(t.add(i.id),e.push(i)),e},[])),i=n.map(n6),r=q.current?.orderedIds;if(!r||r.length!==i.length||i.some((e,t)=>e!==r[t])||eu!==q.current?.perspective){let e=n.map(n9);q.current={orderedIds:i,perspective:eu},W(e,eu)}},B=[el,eu,W],U[2]=el,U[3]=eu,U[4]=W,U[5]=L,U[6]=B):(L=U[5],B=U[6]),(0,a.useEffect)(L,B),K[4]!==em?(s=(e,t)=>{em&&(em.style.setProperty("--drag-preview-x",`${e}px`),em.style.setProperty("--drag-preview-y",`${t-window.scrollY}px`))},K[4]=em,K[5]=s):s=K[5];let ev=s;K[6]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{let e=!1,t=t=>{im(t)&&e&&(e=!1,eg(ic))},n=t=>{var n,i;if(im(t)){if(t.ctrlKey||t.metaKey||t.shiftKey)return;e||(e=!0,eg(il))}n=["mod","\\"],i=t,n.every(e=>ih[e]?i[ih[e]]:i.key===e.toUpperCase())&&eg(ia)},i=()=>{e&&(e=!1,eg(is))};return window.addEventListener("click",iu),window.addEventListener("keydown",n),window.addEventListener("keyup",t),window.addEventListener("blur",i),()=>{window.removeEventListener("click",iu),window.removeEventListener("keydown",n),window.removeEventListener("keyup",t),window.removeEventListener("blur",i)}},c=[eg],K[6]=l,K[7]=c):(l=K[6],c=K[7]),(0,a.useEffect)(l,c);let[ex,eb]=(0,a.useState)(!1),[ew,eE]=(0,a.useState)(!1),ej=(0,a.useRef)(void 0);K[8]!==ey?(u=()=>{if(ey)return n7(()=>{eb(!0),n7(()=>{eE(!0),ej.current=setTimeout(()=>{eE(!1),eb(!1)},1500)})});ej.current&&(clearTimeout(ej.current),(0,a.startTransition)(()=>{eb(!1),eE(!1)}))},d=[ey],K[8]=ey,K[9]=u,K[10]=d):(u=K[9],d=K[10]),(0,a.useEffect)(u,d),K[11]!==el?(p=el.flatMap(io),K[11]=el,K[12]=p):p=K[12];let eI=p;K[13]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{en({type:"overlay/blur"})},K[13]=h):h=K[13];let ek=h,eS=(0,A.useOptimisticActorReady)(),eC=eS?H:void 0,[e_,eM]=(0,a.useState)(!1);!e_&&J&&"connected"===G&&eM(!0);e:{let t;if(ec){let e;K[14]===Symbol.for("react.memo_cache_sentinel")?(e=[],K[14]=e):e=K[14],m=e;break e}K[15]!==Y||K[16]!==eC||K[17]!==ep||K[18]!==eo||K[19]!==el||K[20]!==J||K[21]!==ec||K[22]!==eS||K[23]!==e.plugins||K[24]!==e_||K[25]!==ed?(t=el.filter(ir).map(t=>{let{id:n,element:i,focused:o,hovered:s,rect:a,sanity:l,dragDisabled:c,targets:u,elementType:d}=t,p=!c&&!!i.getAttribute("data-sanity")&&eS&&el.some(e=>"id"in e.sanity&&"id"in l&&(0,$.sanityNodesExistInSameArray)(e.sanity,l)&&e.sanity.path!==l.path);return(0,r.jsx)(nT,{comlink:Y,componentResolver:eC,plugins:e.plugins,element:i,enableScrollIntoView:!ec&&!ep&&!eo,id:n,focused:o,hovered:s,node:l,rect:a,showActions:!e_,draggable:p,isDragging:ec||ep,wasMaybeCollapsed:o&&ed,targets:u,elementType:d,inFrame:J},n)}),K[15]=Y,K[16]=eC,K[17]=ep,K[18]=eo,K[19]=el,K[20]=J,K[21]=ec,K[22]=eS,K[23]=e.plugins,K[24]=e_,K[25]=ed,K[26]=t):t=K[26],m=t}let eT=m,eP=ee?"dark":"light",eA=ew?"":void 0,e$=ex?"":void 0;return K[27]!==eI||K[28]!==eu?(f=(0,r.jsx)(ie,{documentIds:eI,perspective:eu}),K[27]=eI,K[28]=eu,K[29]=f):f=K[29],K[30]!==Y||K[31]!==J||K[32]!==X||K[33]!==ey||K[34]!==em||K[35]!==ev?(y=(0,r.jsx)(it,{comlink:Y,dispatch:en,inFrame:J,inPopUp:X,onDrag:ev,overlayEnabled:ey,rootElement:em}),K[30]=Y,K[31]=J,K[32]=X,K[33]=ey,K[34]=em,K[35]=ev,K[36]=y):y=K[36],K[37]!==ei?(g=ei&&(0,r.jsx)(nx,{...ei,onDismiss:ek}),K[37]=ei,K[38]=g):g=K[38],K[39]!==eh||K[40]!==er||K[41]!==ep||K[42]!==es||K[43]!==ec?(v=ec&&!ep&&(0,r.jsxs)(r.Fragment,{children:[er&&(0,r.jsx)(nL,{dragInsertPosition:er}),es&&(0,r.jsx)(nY,{}),eh&&(0,r.jsx)(nF,{dragGroupRect:eh})]}),K[39]=eh,K[40]=er,K[41]=ep,K[42]=es,K[43]=ec,K[44]=v):v=K[44],K[45]!==ea||K[46]!==ec?(x=ec&&ea&&(0,r.jsx)(nU,{skeleton:ea}),K[45]=ea,K[46]=ec,K[47]=x):x=K[47],K[48]!==eT||K[49]!==eA||K[50]!==e$||K[51]!==f||K[52]!==y||K[53]!==g||K[54]!==v||K[55]!==x||K[56]!==Z?(b=(0,r.jsxs)(n8,{"data-fading-out":eA,"data-overlays":e$,ref:ef,$zIndex:Z,children:[f,y,g,eT,v,x]}
17),K[48]=eT,K[49]=eA,K[50]=e$,K[51]=f,K[52]=y,K[53]=g,K[54]=v,K[55]=x,K[56]=Z,K[57]=b):b=K[57],K[58]!==Y||K[59]!==b?(w=(0,r.jsx)(n1,{comlink:Y,children:b}),K[58]=Y,K[59]=b,K[60]=w):w=K[60],K[61]!==Y||K[62]!==w?(j=(0,r.jsx)(nH,{comlink:Y,children:w}),K[61]=Y,K[62]=w,K[63]=j):j=K[63],K[64]!==Y||K[65]!==el||K[66]!==j?(I=(0,r.jsx)(nZ,{comlink:Y,elements:el,children:j}),K[64]=Y,K[65]=el,K[66]=j,K[67]=I):I=K[67],K[68]!==em||K[69]!==I?(M=(0,r.jsx)(k.LayerProvider,{children:(0,r.jsx)(S.PortalProvider,{element:em,children:I})}),K[68]=em,K[69]=I,K[70]=M):M=K[70],K[71]!==eP||K[72]!==M?(T=(0,r.jsx)(C.ThemeProvider,{scheme:eP,theme:_.studioTheme,tone:"transparent",children:M}),K[71]=eP,K[72]=M,K[73]=T):T=K[73],K[74]!==Y||K[75]!==T?(P=(0,r.jsx)(n4,{comlink:Y,children:T}),K[74]=Y,K[75]=T,K[76]=P):P=K[76],P}function ir(e){return e.activated||e.focused}function io(e){return"id"in e.sanity?[e.sanity.id]:[]}function is(e){return!e}function ia(e){return!e}function il(e){return!e}function ic(e){return!e}function iu(e){let t=e.target;if(((0,M.vt)(t)||(0,T.isHTMLElement)(t)&&t.closest("a"))&&e.altKey){e.preventDefault(),e.stopPropagation();let t=new MouseEvent(e.type,{...e,altKey:!1,bubbles:!0,cancelable:!0});e.target?.dispatchEvent(t)}}function id(e){return e()}function ip(e){return!e}let ih={alt:"altKey",ctrl:"ctrlKey",mod:"u">typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)?"metaKey":"ctrlKey",shift:"shiftKey"};function im(e){return"Alt"===e.key}function iy(e,t){return e.filter(e=>e!==t)}let ig=e=>{let t,n,i=(0,o.c)(4),{comlink:r,refresh:s}=e,l=(0,a.useRef)(0),c=(0,a.useRef)(0);return i[0]!==r||i[1]!==s?(t=()=>r.on("presentation/refresh",e=>{if("manual"===e.source){clearTimeout(l.current);let t=s(e);if(!1===t)return;r.post("visual-editing/refreshing",e);let n=!1;l.current=window.setTimeout(()=>{r.post("visual-editing/refreshed",e),n=!0},3e3),t?.finally?.(()=>{n||(clearTimeout(l.current),r.post("visual-editing/refreshed",e))})}else if("mutation"===e.source){clearTimeout(c.current);let t=s(e);if(!1===t)return;r.post("visual-editing/refreshing",e),c.current=window.setTimeout(()=>{let t=s(e);!1!==t&&(r.post("visual-editing/refreshing",e),t?.finally?.(()=>{r.post("visual-editing/refreshed",e)})||r.post("visual-editing/refreshed",e))},1e3),t?.finally?.(()=>{r.post("visual-editing/refreshed",e)})||r.post("visual-editing/refreshed",e)}}),n=[r,s],i[0]=r,i[1]=s,i[2]=t,i[3]=n):(t=i[2],n=i[3]),(0,a.useEffect)(t,n),null};function iv(e){let{data:t,origin:n}=e;t&&"object"==typeof t&&"domain"in t&&"sanity/channels"===t.domain&&"from"in t&&"presentation"===t.from&&"type"in t&&"presentation/status"===t.type&&window.parent.postMessage({domain:"sanity/channels",type:"visual-editing/status",data:{origin:location.origin}},n)}function ix(){console.warn("[@sanity/visual-editing] Package version mismatch detected: Please update your Sanity studio to prevent potential compatibility issues.")}function ib(){}let iw=(0,a.lazy)(()=>e.A(450632)),iE=e=>{var t;let n,i,c,u,d,p,h,m,f,y,g,v,x,b,w=(0,o.c)(33),{components:E,plugins:j,history:I,portal:k,refresh:S,zIndex:C,onPerspectiveChange:_}=e,M=void 0===k||k,[T,P]=(0,a.useState)(null),[A,$]=(0,a.useState)(null);w[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{(0,a.startTransition)(()=>{P((0,s.isMaybePreviewIframe)()),$((0,s.isMaybePreviewWindow)())})},i=[],w[0]=n,w[1]=i):(n=w[0],i=w[1]),(0,a.useEffect)(n,i);let[R,O]=(0,a.useState)(null);w[2]!==M?(c=()=>{if(!1===M)return;let e=document.createElement("sanity-visual-editing");return document.documentElement.appendChild(e),(0,a.startTransition)(()=>O(e)),()=>{(0,a.startTransition)(()=>O(null)),document.documentElement.contains(e)&&document.documentElement.removeChild(e)}},u=[M],w[2]=M,w[3]=c,w[4]=u):(c=w[3],u=w[4]),(0,a.useEffect)(c,u);let[D,N]=function(e){let t,n,i,r,l,c=(0,o.c)(9),u=void 0===e||e,[d,p]=(0,a.useState)(),[h,m]=(0,a.useState)("idle");return c[0]!==u?(t=()=>{if(!u)return;let e=(0,eW.createNode)({name:"visual-editing",connectTo:"presentation"},(0,eW.createNodeMachine)().provide({actors:(0,s.createCompatibilityActors)()})),t=e.onStatus(()=>m("connected"),"connected");(0,a.startTransition)(()=>p(e));let n=e.start();return()=>{t(),n(),(0,a.startTransition)(()=>p(void 0))}},n=[u],c[0]=u,c[1]=t,c[2]=n):(t=c[1],n=c[2]),(0,a.useEffect)(t,n),c[3]!==h?(i=()=>
17{if("connected"===h)return;let e=new AbortController;return window.addEventListener("message",iv,{signal:e.signal}),()=>{e.abort()}},r=[h],c[3]=h,c[4]=i,c[5]=r):(i=c[4],r=c[5]),(0,a.useEffect)(i,r),c[6]!==d||c[7]!==h?(l=[d,h],c[6]=d,c[7]=h,c[8]=l):l=c[8],l}(!0===T||!0===A);t="connected"===N?D:void 0,(b=(0,o.c)(3))[0]!==t?(v=()=>{let e,n;if(!t)return;let i=(e=new eG.ReplaySubject(1),n=new eH.Subject,t.fetch("visual-editing/snapshot-welcome",void 0,{suppressWarnings:!0}).then(t=>{e.next(t.event)}).catch(()=>{}),t.on("presentation/snapshot-event",t=>{"reconnect"===t.event.type&&e.next(t.event),"mutation"===t.event.type&&n.next(t.event)}),(0,eJ.merge)(e,n)),r=t1(t),o=(0,eK.c)(r,{input:{client:{withConfig:ib},sharedListener:i}});o.start();let s=new AbortController;return t.fetch("visual-editing/features",void 0,{signal:s.signal,suppressWarnings:!0}).then(e=>{e.features.optimistic&&(0,eY.setActor)(o)}).catch(ix),()=>{o.stop(),s.abort()}},x=[t],b[0]=t,b[1]=v,b[2]=x):(v=b[1],x=b[2]),(0,a.useEffect)(v,x);let V=(0,a.useDeferredValue)((0,a.useSyncExternalStore)(nr,no,ij),!1);w[5]!==N||w[6]!==T||w[7]!==A?(d=()=>{if("connected"===N)t4(A?"presentation-window":"presentation-iframe");else if(T||A){let e=setTimeout(iI,1e3);return()=>{clearTimeout(e),t4(null)}}else t4("standalone");return ik},p=[N,A,T],w[5]=N,w[6]=T,w[7]=A,w[8]=d,w[9]=p):(d=w[8],p=w[9]),(0,a.useEffect)(d,p),w[10]!==D||w[11]!==N||w[12]!==E||w[13]!==T||w[14]!==A||w[15]!==_||w[16]!==j||w[17]!==C?(h=null!==T&&null!==A&&(0,r.jsx)(ii,{comlink:D,comlinkStatus:N,componentResolver:E,onPerspectiveChange:_,plugins:j,inFrame:T,inPopUp:A,zIndex:C}),w[10]=D,w[11]=N,w[12]=E,w[13]=T,w[14]=A,w[15]=_,w[16]=j,w[17]=C,w[18]=h):h=w[18],w[19]!==D||w[20]!==I||w[21]!==S?(m=D&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t5,{comlink:D,history:I}),(0,r.jsx)(ns,{comlink:D}),S&&(0,r.jsx)(ig,{comlink:D,refresh:S})]}),w[19]=D,w[20]=I,w[21]=S,w[22]=m):m=w[22],w[23]!==N||w[24]!==V?(f="connected"===N&&V&&(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(iw,{})}),w[23]=N,w[24]=V,w[25]=f):f=w[25],w[26]!==h||w[27]!==m||w[28]!==f?(y=(0,r.jsxs)(r.Fragment,{children:[h,m,f]}),w[26]=h,w[27]=m,w[28]=f,w[29]=y):y=w[29];let z=y;return!1!==M&&R?(w[30]!==z||w[31]!==R?(g=(0,l.createPortal)(z,R),w[30]=z,w[31]=R,w[32]=g):g=w[32],g):z};function ij(){return!1}function iI(){return t4("standalone")}function ik(){return t4(null)}iE.displayName="VisualEditing",e.s(["VisualEditing",0,iE,"addQueryListener",0,function(){if(ni++,!nn)for(let e of(nn=!0,nt))e();return()=>{if(0==--ni&&nn)for(let e of(nn=!1,nt))e()}},"comlink",()=>t6,"comlinkDataset",()=>t7,"comlinkPerspective",()=>ne,"comlinkProjectId",()=>t8,"getSnapshot",0,function(){return t3},"setLoaderClientConfig",0,function(e,t){for(let n of(t8=e,t7=t,t9))n()},"setLoaderComlink",0,function(e){for(let t of(t6=e,t9))t()},"setLoaderPerspective",0,function(e){for(let t of(ne=e,t9))t()},"subscribe",0,function(e){return t2.add(e),()=>{t2.delete(e)}},"subscribe$1",0,function(e){return t9.add(e),()=>t9.delete(e)}],710181)},599568,(e,t,n)=>{var i=e.r(581511);t.exports=function(){try{var e=i(Object,"defineProperty");return e({},"",{}),e}catch(e){}}()},806016,(e,t,n)=>{var i=e.r(599568);t.exports=function(e,t,n){"__proto__"==t&&i?i(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},878379,(e,t,n)=>{var i=e.r(806016),r=e.r(424516),o=Object.prototype.hasOwnProperty;t.exports=r(function(e,t,n){o.call(e,n)?e[n].push(t):i(e,n,[t])})}]);
18
19//# chunkId=01a0def5-2111-7ca3-b264-bf91c51897d0

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.