PageSourceSearch

https://2theloo.com/_next/static/chunks/34ad4f53-a152a3d2351857d5.js

js 2theloo.com collected 2026-10-04 11:28:44 UTC 894,527 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9230],{77070:function(e,n,r){let i,a,o;r.d(n,{$3t:function(){return PZ},$CC:function(){return d0},$G7:function(){return dV},$Tr:function(){return fI},$rW:function(){return yQ},Ahg:function(){return wV},AvK:function(){return da},BoV:function(){return ds},Bwn:function(){return u4},CKw:function(){return Il},CVH:function(){return pK},C_I:function(){return dd},CbY:function(){return fA},Cnp:function(){return Br},Dqo:function(){return Mt},Dr7:function(){return h$},EIy:function(){return vk},EZo:function(){return ha},EyJ:function(){return x3},F27:function(){return Aj},F2f:function(){return Me},FMn:function(){return uR},Fa1:function(){return vs},H7Z:function(){return mN},HD0:function(){return dw},HPs:function(){return Ii},H__:function(){return z6},IIC:function(){return f1},I_y:function(){return h1},Int:function(){return dl},LMB:function(){return z3},LOQ:function(){return qS},LPT:function(){return LT},LZ8:function(){return dy},L_b:function(){return AO},Lky:function(){return RA},LvP:function(){return pU},Lwp:function(){return Av},M1Z:function(){return Ax},MBS:function(){return AC},NFh:function(){return Si},NLM:function(){return vj},NZS:function(){return vB},NuZ:function(){return dv},P4c:function(){return Ab},P9l:function(){return hU},PtK:function(){return f$},Q$I:function(){return vm},Q5d:function(){return vQ},QMc:function(){return vV},Rfe:function(){return v_},RgL:function(){return dg},RlW:function(){return w4},Rvm:function(){return dQ},Rx1:function(){return Ay},TEJ:function(){return Mr},UMU:function(){return zr},Uy$:function(){return dj},VQJ:function(){return wd},WDH:function(){return wu},WEl:function(){return u_},WVR:function(){return VL},WiK:function(){return bp},YG6:function(){return K7},YtX:function(){return yl},Z7x:function(){return function e(n,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(r(n,i)){if("array"===n.type){"unchanged"!==n.action&&n.items.forEach(n=>{var a;let o="object"===n.diff.type&&(null==(a=n.diff.toValue)?void 0:a._key),l=o?{_key:o}:void 0===n.toIndex?n.fromIndex||0:n.toIndex;e(n.diff,r,i.concat(l))});return}if("object"===n.type){"unchanged"!==n.action&&Object.keys(n.fields).forEach(a=>{e(n.fields[a],r,i.concat(a))});return}"string"===n.type&&"unchanged"!==n.action&&n.segments.forEach(n=>{e(n,r,i)})}}},ZLF:function(){return u7},_eo:function(){return fR},_mO:function(){return jn},aAo:function(){return jo},aFb:function(){return hV},ap5:function(){return z9},bsC:function(){return di},cFj:function(){return St},cNP:function(){return fC},cWh:function(){return RO},cYR:function(){return uv},d9t:function(){return hH},d_2:function(){return vO},e8h:function(){return ux},eLL:function(){return AE},ek8:function(){return dc},euX:function(){return v3},fXW:function(){return dr},g_H:function(){return vf},hHf:function(){return I9},iWf:function(){return vu},iZE:function(){return z7},jGt:function(){return Io},jr5:function(){return Bi},kJl:function(){return fO},kLJ:function(){return zm},kNp:function(){return v$},kqP:function(){return fj},kwM:function(){return xQ},l$t:function(){return d2},lRb:function(){return fV},lU9:function(){return SF},lXN:function(){return bA},lvI:function(){return fo},m85:function(){return hN},mEJ:function(){return yr},nXU:function(){return wR},nhK:function(){return hY},nmQ:function(){return Ak},oUE:function(){return uY},ofl:function(){return h0},ogX:function(){return h8},qGk:function(){return vW},qyu:function(){return df},r8Q:function(){return xh},rEz:function(){return dt},rRV:function(){return vp},rdu:function(){return vX},rq_:function(){return z8},sr_:function(){return uG},t2O:function(){return I4},t8m:function(){return fz},tM3:function(){return ul},tdq:function(){return vc},tv4:function(){return ql},uhD:function(){return wE},uwK:function(){return fs},v0Z:function(){return uX},v7n:function(){return fi},vNl:function(){return uz},vSY:function(){return zt},va7:function(){return fH},vsM:function(){return dm},w2F:function(){return Aw},w2y:function(){return vS},wBu:function(){return fp},wRD:function(){return ui},x$w:function(){return dC},xJ:function(){return hK},xMr:function(){return Be},zEW:function(){return h2},zNf:function(){return fM},zaX:function(){return z5}});var l,s,c,d,u,p,h,f,m,g,x,v,y,b,j,w,k,C,_,T,S,E,P,O,A,I,z,M,R,F,D,q,Z,N,L,V,K,B,U,H,$,W,Y,X,G,J,Q,ee,et,en,er,ei,ea,eo,el,es,ec,ed,eu,ep,eh,ef,em,eg,ex,ev,ey,eb,ej,ew,ek,eC,e_,eT,eS,eE,eP,eO,eA,eI,ez,eM,eR,eF,eD,eq,eZ,eN,eL,eV,eK,eB,eU,eH,e$,eW,eY,eX,eG,eJ,eQ,e0,e1,e2,e3,e4,e5,e8,e6,e9,e7,te,tt,tn,tr,ti,ta,to,tl,ts,tc,td,tu,tp,th,tf,tm,tg,tx,tv,ty,tb,tj,tw,tk,tC,t_,tT,tS,tE,tP,tO,tA,tI,tz,tM,tR,tF,tD,tq,tZ,tN,tL,tV,tK,tB,tU,tH,t$,tW,tY,tX,tG,tJ,tQ,t0,t1,t2,t3,t4,t5,t8,t6,t9,t7,ne,nt,nn,nr,ni,na,no,nl,ns,nc,nd,nu,np,nh,nf,nm,ng,nx,nv,ny,nb,nj,nw,nk,nC,n_,nT,nS,nE,nP,nO,nA,nI,nz,nM,nR,nF,nD,nq,nZ,nN,nL,nV,nK,nB,nU,nH,n$,nW,nY,nX,nG,nJ,nQ,n0,n1,n2,n3,n4,n5,n8,n6,n9,n7,re,rt,rn,rr,ri,ra,ro,rl,rs,rc,rd,ru,rp,rh,rf,rm,rg,rx,rv,ry,rb,rj,rw,rk,rC,r_,rT,rS,rE,rP,rO,rA,rI,rz,rM,rR,rF,rD,rq,rZ,rN,rL,rV,rK,rB,rU,rH,r$,rW,rY,rX,rG,rJ,rQ,r0,r1,r2,r3,r4,r5,r8,r6,r9,r7,ie,it,ir,ii,ia,io,il,is,ic,id,iu,ip,ih,im,ig,ix,iv,iy,ib,ij,iw,ik,iC,i_,iT,iS,iE,iP,iO,iA,iI,iz,iM,iR,iF,iD,iq,iZ,iN,iL,iV,iK,iB,iU,iH,i$,iW,iY,iX,iG,iJ,iQ,i0,i1,i2,i3,i4,i5,i8,i6,i9,i7,ae,at,an,ar,ai,aa,ao,al,as,ac,ad,au,ap,ah,af,am,ag,ax,av,ay,ab,aj,aw,ak,aC,a_,aT,aS,aE,aP,aO,aA,aI,az,aM,aR,aF,aD,aq,aZ,aN,aL,aV,aK,aB,aU,aH,a$=r(34978),aW=r(29127),aY=r(56542),aX=r(53741),aG=r(79878),aJ=r(68515),aQ=r(5014),a0=r(44367),a1=r(30062),a2=r(94975),a3=r(98430),a4=r(42006),a5=r(48902),a8=r(83505),a6=r(74727),a9=r(46297),a7=r(51313),oe=r(91458),ot=r(77270),on=r(65583),or=r(40148),oi=r(30218),oa=r(63428),oo=r(71932),ol=r(56890),os=r(9132),oc=r(25631),od=r(47753),ou=r(42965),op=r(48848),oh=r(58550),of=r(58796),om=r(92574),og=r(32817),ox=r(69243),ov=r(1545),oy=r(80230),ob=r(40052),oj=(r(83286),r(19917)),ow=r(23071),ok=r(22401),oC=r(82649),o_=r(83610),oT=r(6222),oS=r(9653),oE=r(40564),oP=r(9141),oO=r(86515),oA=r(37991
1),oI=r(36861),oz=r(30743),oM=r(82976),oR=r(28440),oF=r(97398),oD=r.n(oF),oq=r(30222),oZ=r(85893),oN=r(67294),oL=r(75219),oV=r(37946),oK=r(11636),oB=r(18612),oU=r.n(oB),oH=r(6979),o$=r.n(oH),oW=r(36155),oY=r.n(oW),oX=r(45950),oG=r.n(oX),oJ=r(96412),oQ=r.n(oJ),o0=r(4979),o1=r.n(o0),o2=r(66996),o3=r(21052),o4=r.n(o3),o5=r(23279),o8=r.n(o5),o6=r(47252),o9=r(18446),o7=r.n(o9),le=r(58354),lt=r(23493),ln=r.n(lt),lr=r(88899),li=r(61819),la=r(89734),lo=r.n(la),ll=r(42930),ls=r(1014),lc=r(60754),ld=r(38993),lu=r.n(ld),lp=r(40168),lh=r(18029),lf=r.n(lh),lm=r(933),lg=r(81817),lx=r(98235),lv=r(47037),ly=r.n(lv),lb=r(79668),lj=r(42145),lw=r(59864),lk=r(42076),lC=r(50361),l_=r.n(lC),lT=r(27361),lS=r.n(lT),lE=r(68630),lP=r.n(lE),lO=r(42298),lA=r(85564),lI=r.n(lA),lz=r(45578),lM=r.n(lz),lR=r(88306),lF=r.n(lR),lD=r(36609),lq=r(21827),lZ=r(55648),lN=r(31103),lL=r(3522),lV=r.n(lL),lK=r(57278),lB=r(31397),lU=r(69295),lH=r(67803),l$=r(76972),lW=r(69690),lY=r(11699),lX=r(43703),lG=r(86298),lJ=r(8230),lQ=r(77349),l0=r(13956),l1=r(3151),l2=r(49160),l3=r(34176),l4=r(16218),l5=r(11640),l8=r(44749),l6=r(4543),l9=r(37042),l7=r(23855),se=r(39159),st=r(61436),sn=r(42699),sr=r(313),si=r(92311),sa=r(83894),so=r(69119),sl=r(41691),ss=r(46038),sc=r(28366),sd=r(18717),su=r(55250),sp=r(6803),sh=r.n(sp),sf=r(81548),sm=r(94184),sg=r.n(sm),sx=r(98756),sv=r(73955),sy=r.n(sv),sb=r(39693),sj=r.n(sb),sw=r(25325),sk=r.n(sw),sC=r(24350),s_=r.n(sC),sT=r(43174),sS=r.n(sT),sE=r(7334),sP=r.n(sE),sO=r(93386),sA=r.n(sO),sI=r(44908),sz=r.n(sI),sM=r(58748),sR=r.n(sM),sF=r(59242),sD=r.n(sF),sq=r(92742),sZ=r.n(sq),sN=r(25934),sL=r(57122),sV=r(60814),sK=r(49733),sB=r(25066),sU=r(57557),sH=r.n(sU),s$=r(75472),sW=r.n(s$),sY=r(17723),sX=r(98434),sG=r(76566),sJ=r.n(sG),sQ=r(40288),s0=r(7739),s1=r.n(s0),s2=r(76590),s3=r(17423),s4=r(4527),s5=r(45587),s8=r(48403),s6=r.n(s8),s9=r(26642),s7=r.n(s9),ce=r(13311),ct=r.n(ce),cn=r(60887),cr=r(24285),ci=r(32339),ca=r(96026),co=r.n(ca),cl=r(989),cs=r.n(cl),cc=r(91966),cd=r.n(cc);r(84596);var cu=r(78718),cp=r.n(cu),ch=r(99119),cf=r(63706),cm=r.n(cf),cg=r(6557),cx=r.n(cg),cv=r(52628),cy=r.n(cv),cb=r(28092),cj=r(85092),cw=r(34167),ck=r(80979),cC=r(76356),c_=r(75175),cT=r(45933),cS=r.n(cT),cE=r(54087),cP=r.n(cE),cO=r(53416),cA=r(95534),cI=r.n(cA),cz=r(83508);r(20745);var cM=r(18156),cR=r(41609),cF=r.n(cR),cD=r(97762),cq=r(11700),cZ=r.n(cq),cN=r(90634),cL=r.n(cN),cV=r(13218),cK=r.n(cV),cB=r(30998),cU=r.n(cB),cH=r(66678),c$=r.n(cH),cW=r(21137),cY=r(37885),cX=r(51526),cG=r(5814),cJ=r(38063),cQ=r(9095),c0=r(61021),c1=r.n(c0),c2=r(34155);function c3(e){return"function"==typeof e?e():e}let c4=()=>void 0,c5=!1,c8=e=>{c5||console.warn(Error('No context provided for reporter. Make sure that the component calling "useReporter('.concat(e,', ...)", is wrapped in a <Tracker> element'))),c5=!0},c6={add:c8,update:c8,remove:c8,subscribe:()=>(c5||console.warn(Error('No context provided for reporter. Make sure that the component calling "useReportedValues()", is wrapped inside a <Tracker> element')),c5=!0,()=>{}),read:function(){return c5||console.warn(Error('No context provided for reporter. Make sure that the component calling "useReportedValues()", is wrapped inside a <Tracker> element')),c5=!0,[]}},c9=0,c7=()=>++c9;function de(){let e=oN.createContext(c6),n=function(n,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.is,{add:a,update:o,remove:l}=oN.useContext(e),s=oN.useRef();oN.useLayoutEffect(()=>{if(null===n)return c4;let e=c3(r);return a(n,e),s.current=e,()=>{l(n)}},[a,n,l,r]),oN.useLayoutEffect(()=>{let e=c3(r);void 0===s.current||i(s.current,e)||null===n||o(n,e),s.current=e})};return{Tracker:function(n){let r=oN.useMemo(()=>(function(){let e=new Map,{publish:n,subscribe:r}=(0,o6.Z)(),i=o8()(n,10,{trailing:!0}),a=()=>Array.from(e.entries());return{add:function(n,r){e.has(n),e.set(n,r),i(a())},remove:function(n){e.has(n),e.delete(n),i(a())},update:function(n,r){e.has(n),e.set(n,r),i(a())},read:a,subscribe:r}})(),[]);return(0,oZ.jsx)(e.Provider,{value:r,children:n.children})},useReportedValues:function(){let n=oN.useContext(e),[r,i]=oN.useState(n.read());return oN.useLayoutEffect(()=>(i(n.read()),n.subscribe(i)),[n]),r},useReporter:n,useAutoIdReporter:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.is;return n("element-".concat(oN.useRef(c7()).current),e,r)}}}let dt=!1,dn=de(),dr=dn.Tracker,di=dn.useReportedValues,da=dn.useReporter,dl=(0,oN.createContext)({isReviewChangesOpen:!1,onOpenReviewChanges:()=>void 0,onSetFocus:()=>void 0});function ds(e){let n=(0,oN.useRef)(e);return o7()(n.current,e)||(n.current=e),n.current}function dc(e,n){let r=[n,!0],i={type:"tuple",tuple:r};return function(n){let a=ds(n),o=(0,oR.m2)(()=>(0,og.of)(a).pipe((0,a$.w)(n=>(0,ox.z)((0,og.of)({type:"loading"}),e(n).pipe((0,aW.U)(e=>({type:"value",value:e}))))),(0,aY.R)((e,n)=>{let[r]=e;return"loading"===n.type?[r,!0]:[n.value,!1]},r),(0,aX.x)((e,n)=>{let[r,i]=e,[a,o]=n;return r===a&&i===o}),(0,aW.U)(e=>({type:"tuple",tuple:e})),(0,aG.K)(e=>(0,og.of)({type:"error",error:e}))),[a],i);if("error"===o.type)throw o.error;return o.tuple}}function dd(e){return null!=e}let du="".concat("drafts",".");function dp(e){return e.startsWith(du)}function dh(e){return{draftId:df(e),publishedId:dm(e)}}function df(e){return dp(e)?e:du+e}function dm(e){return dp(e)?e.slice(du.length):e}function dg(e){return Array.from(e.reduce((e,n)=>{let r=dm(n._id),i=e.get(r);
1return i||(i={id:r,type:n._type,published:void 0,draft:void 0},e.set(r,i)),i[r===n._id?"published":"draft"]=n,e},new Map).values())}function dx(e){return dg(e).map(e=>e.draft||e.published).filter(dd)}let dv=Object.freeze({}),dy=Object.freeze([]),db=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof window)return window;if("undefined"!=typeof self)return self;if(void 0!==r.g)return r.g;throw Error("@sanity/ui: could not locate global scope")}();function dj(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function dw(e){return"string"==typeof e}let dk="object"==typeof document&&"object"==typeof window&&window.ResizeObserver?window.ResizeObserver:le.do,dC=(()=>{let e=(0,o6.Z)(),n=new dk(n=>e.publish(n));return{observe:(r,i,a)=>{let o=e.subscribe(e=>{let n=e.find(e=>e.target===r);n&&i(n)});return n.observe(r,a),()=>{o(),n.unobserve(r)}},unobserve:e=>n.unobserve(e)}})(),d_=["match","in","asc","desc","true","false","null"],dT=/^[a-zA-Z_][a-zA-Z0-9_]*$/,dS=e=>!dT.test(e)||d_.includes(e),dE=e=>'["'.concat(e,'"]'),dP=e=>"@".concat(dE(e)),dO=e=>Array.isArray(e)&&0===e.length,dA=e=>{let n="";for(let r=0;r<e.length;r++){let i=e[r];if(dO(i)){n+="[]";continue}if("number"==typeof i){n+="[".concat(i,"]");continue}let a=0===r;n=dS(i)?a?dP(i):"".concat(n).concat(dE(i)):a?i:"".concat(n,".").concat(i)}return n},dI="undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),dz="object"==typeof Intl&&"Segmenter"in Intl?new Intl.Segmenter:void 0;function dM(e,n){let r=function(e,n,r){if(r<n)throw Error("End must be greater than start, use `String.prototype.slice()` for negative values");if(!dz)return e.slice(n,r);let i=0,a="";for(let n of dz.segment(e)){if(i===r)break;a+=n.segment,i++}return a}(e,0,n);return r===e?r:"".concat(r,"…")}let dR={isLoading:!0,value:void 0,error:null};function dF(e,n){return(0,oR.m2)(()=>e.pipe(e=>e.pipe((0,aW.U)(e=>({isLoading:!1,value:e,error:null})),(0,aG.K)(e=>(0,og.of)({isLoading:!1,value:void 0,error:e})))),[e],void 0===n?dR:{isLoading:!1,value:n,error:null})}function dD(e,n){return null!==e&&e.roles.some(e=>e.name===n)}let dq=void 0!==c2&&(null==(eA=null==c2?void 0:c2.env)?void 0:eA.SANITY_STUDIO_DEBUG_I18N),dZ={reverse:e=>"‮".concat(e),triangles:e=>"◤ ".concat(e," ◢")};function dN(e){let n="reverse"===dq||"triangles"===dq?dZ[dq]:null;return n?function(){return n(e(...arguments))}:e}let dL={bindI18n:!1};function dV(e,n){let{t:r}=(0,li.$G)(e,n?{keyPrefix:n.keyPrefix,lng:n.lng,...dL}:dL);return{t:dN(r)}}var dK=Object.freeze,dB=Object.defineProperty,dU=(e,n)=>dK(dB(e,"raw",{value:dK(n||e.slice())}));let dH=oV.ZP.div(e=>{let{$changed:n,$disabled:r,$hasFocus:i,$isReviewChangeOpen:a}=e;return r?(0,oV.iv)(eI||(eI=dU(["\n        ",":after {\n          display: none;\n        }\n      "])),dY):(0,oV.iv)(eF||(eF=dU(["\n      --change-bar-offset: 4px;\n\n      display: flex;\n      position: relative;\n\n      ",":after {\n        opacity: 0.5;\n      }\n\n      @media (hover: hover) {\n        &:hover {\n          z-index: 10;\n          ",":after {\n            opacity: 1;\n          }\n        }\n      }\n\n      /* hide when field is not changed */\n      ","\n\n      /* hide when field is not changed */\n      ","\n\n      /* hide hover effect when review changes is open */\n      ","\n    "])),dY,dY,i&&(0,oV.iv)(ez||(ez=dU(["\n        ",":after {\n          opacity: 1;\n        }\n      "])),dY),!n&&(0,oV.iv)(eM||(eM=dU(["\n        ",":after {\n          opacity: 0;\n          pointer-events: none;\n        }\n      "])),dY),a&&(0,oV.iv)(eR||(eR=dU(["\n        "," {\n          opacity: 0;\n        }\n      "])),dX))}),d$=oV.ZP.div(eD||(eD=dU(["\n  flex-grow: 1;\n  min-width: 0;\n"]))),dW=oV.ZP.div(eq||(eq=dU(["\n  position: relative;\n  opacity: 1;\n  transition: opacity 100ms;\n  z-index: ",";\n"])),e=>{let{$zIndex:n}=e;return n}),dY=oV.ZP.div(e=>{let{media:n}=(0,oL.aQ)(e.theme);return(0,oV.iv)(eZ||(eZ=dU(["\n    position: absolute;\n    top: -1px;\n    left: var(--change-bar-offset);\n    width: 1px;\n    bottom: -1px;\n    background-color: var(--card-bg-color);\n\n    @media (min-width: ","px) {\n      display: unset;\n    }\n\n    &:after {\n      content: '';\n      display: block;\n      position: absolute;\n      top: 1px;\n      left: 0;\n      width: 1px;\n      bottom: 1px;\n      background-color: var(--card-badge-caution-dot-color);\n      border-radius: 0.5px;\n    }\n  "])),n[0])}),dX=oV.ZP.button(e=>{let{$withHoverEffect:n}=e;return(0,oV.iv)(eL||(eL=dU(["\n    appearance: none;\n    border: 0;\n    outline: 0;\n    display: block;\n    padding: 0;\n    background: transparent;\n    opacity: 0;\n    position: absolute;\n    height: 100%;\n    cursor: pointer;\n    pointer-events: all;\n    left: calc(-0.25rem + var(--change-bar-offset));\n    width: calc(1rem - 1px);\n    transition: opacity ","ms;\n\n    &:focus {\n      border: 0;\n      outline: 0;\n    }\n\n    &:focus {\n      border: 0;\n      outline: 0;\n    }\n\n    ","\n  "])),250,n&&(0,oV.iv)(eN||(eN=dU(["\n      @media (hover: hover) {\n        &:hover {\n          opacity: 0.2;\n        }\n      }\n    "]))))});function dG(e){let{children:n,disabled:r,hasFocus:i,isChanged:a,withHoverEffect:o=!0}=e,{onOpenReviewChanges:l,isReviewChangesOpen:s}=oN.useContext(dl),{zIndex:c}=(0,oK.sJ)(),{t:d}=dV(),u=(0,oN.useMemo)(()=>r||!a?null:(0,oZ.jsxs)(dW,{"data-testid":"change-bar",$zIndex:c,children:[(0,oZ.jsx)(dY,{"data-testid":"change-bar__marker"}),(0,oZ.jsx)(lr.u,{content:d("changes.change-bar.aria-label"),portal:!0,children:(0,oZ.jsx)(dX,{"aria-label":d("changes.change-bar.aria-label"),"data-testid":"change-bar__button",onClick:s?void 0:l,tabIndex:-1,type:"button",$withHoverEffect:o})})]}),[r,a,s,l,d,o,c]);return(0,oZ.jsxs)(dH,{"data-testid":"change-bar-wrapper",$changed:a,$disabled:r,$hasFocus:i,$isReviewChangeOpen:s,children:[(0,oZ.jsx)(d$,{"data-testid":"change-bar__field-wrapper",children:n}),u]})}let dJ=(0,oN.memo)(function(e){let{children:n,disabled:r,hasFocus:i,isChanged:a,onMouseEnter:o,onMouseLeave:l,path:s=dy,withHoverEffect:c,...d}=e,u=(0,oK.sJ)(),[p,h]=(0,oN.useState)(!1),f=(0,oN.useCallback)(e=>{null==o||o(e),h(!0)},[o]),m=(0,oN.useCallback)(e=>{null==l||l(e),h(!1)},[l]),g=(0,oN.useRef)(null);return da(r?null:"field-".concat(o2.BB(s)),()=>({element:g.current,path:s,isChanged:a,hasFocus:i,hasHover:p,zIndex:u.zIndex}),o4()),(0,oZ.jsx)("div",{...d,ref:g,onMouseEnter:f,onMouseLeave:m,children:(0,oZ.jsx)(dG,{hasFocus:i,isChanged:a,disabled:r,withHoverEffect:c,children:n})})});function dQ(e){let{children:n,hasFocus:r,isChanged:i,path:a,withHoverEffect:o,...l}=e;return(0,oZ.jsx)(dJ,{...l,path:a,hasFocus:r,isChanged:i,withHoverEffect:o,children:n})}oN.createContext({path:[],fullPath:[],focusPath:[],isChanged:!1});let d0=oN.createContext(null),d1=()=>void 0,d2=oN.forwardRef(function(e,n){let{as:r="div",onScroll:i,...a}=e,o=(0,oK.ts)(n),l=(0,oN.useContext)(d0),s=(0,oN.useMemo)(()=>(0,o6.Z)(),[]);return(0,oN.useEffect)(()=>i?s.subscribe(i):d1,[s,i]),(0,oN.useEffect)(()=>l?s.subscribe(l.publish):d1,[l,s]),(0,oN.useEffect)(()=>{let e=e=>{s.publish(e)},n=o.current;if(n)return n.addEventListener("scroll",e,{passive:!0,capture:!0}),()=>{n.removeEventListener("scroll",e)}},[s,o]),(0,oZ.jsx)(d0.Provider,{value:s,children:oN.createElement(r,{ref:o,"data-testid":"scroll-container",...a})})});function d3(e,n,r){return["M ".concat(e-4," ").concat(n-4*r," "),"L ".concat(e," ").concat(n),"L ".concat(e+4," ").concat(n-4*r)].join("")}function d4(e,n){return"M".concat(e," ").concat(n)}function d5(e,n){return"L".concat(e," ").concat(n)}function d8(e,n,r,i){return"Q".concat(e," ").concat(n," ").concat(r," ").concat(i)}function d6(e,n){let r=e.top+e.height/2,i=e.top+e.height<n.top+2,a=e.top>n.top+n.height-2;return{bounds:n,left:e.left,top:r,centerY:r,startY:e.top+8,endY:e.top+e.height-8,isAbove:i,isBelow:a,outOfBounds:i||a}}var d9=Object.freeze,d7=Object.defineProperty,ue=(e,n)=>d9(d7(e,"raw",{value:d9(n||e.slice())}));oV.ZP.rect(eV||(eV=ue(["\n  stroke: #ccc;\n  fill: none;\n  pointer-events: none;\n  stroke-linecap: round;\n"])));let ut=oV.ZP.path(eK||(eK=ue(["\n  fill: none;\n  pointer-events: none;\n  stroke-linejoin: round;\n  stroke: var(--card-badge-caution-dot-color);\n"]))),un=oV.ZP.path(eB||(eB=ue(["\n  fill: none;\n  pointer-events: stroke;\n  stroke: transparent;\n  cursor: pointer;\n  stroke-linecap: round;\n  stroke-linejoin: round;\n  opacity: 0;\n\n  &:hover {\n    opacity: 0.2;\n  }\n"]))),ur=(0,oV.ZP)(function(e){let{bounds:n,...r}=e,i=Math.max(n.left,e.left),a=Math.max(e.top,n.top),o=Math.max(0,e.height-(a-e.top)),l=Math.max(0,e.width-(i-e.left));return(0,oZ.jsx)("rect",{...r,x:i,y:a,height:o,width:l})})(eU||(eU=ue(["\n  stroke: none;\n  pointer-events: none;\n  fill: var(--card-badge-caution-dot-color);\n"]))),ui=(0,oN.memo)(function(e){let{from:n,to:r}=e,i=function(e){let n={top:e.from.bounds.top+12,bottom:e.from.bounds.top+e.from.bounds.height-12,left:e.from.bounds.left,right:e.from.bounds.left+e.from.bounds.width,width:e.from.bounds.width,height:e.from.bounds.height-24},r=d6(e.from.rect,n);r.left=e.from.rect.left+e.from.rect.width+1;let i={top:e.to.bounds.top+12,bottom:e.to.bounds.top+e.to.bounds.height-12,left:e.to.bounds.left,right:e.to.bounds.left+e.to.bounds.width,width:e.to.bounds.width,height:e.to.bounds.height-24},a=d6(e.to.rect,i),o=Math.max(a.startY,r.startY);return r.top=Math.min(o,r.endY),r.top<i.top?r.top=Math.min(i.top,r.endY):r.top>i.bottom&&(r.top=Math.max(i.bottom,r.startY)),a.top=Math.min(o,a.endY),a.top<n.top?a.top=Math.min(n.top,a.endY):a.top>n.bottom&&(a.top=Math.max(n.bottom,a.startY)),r.top=Math.min(Math.max(r.top,n.top),n.bottom),a.top=Math.min(Math.max(a.top,i.top),i.bottom),{from:r,to:a}}({from:n,to:r});if(i.from.outOfBounds&&i.to.outOfBounds)return null;let a=function(e){let{from:n,to:r}=e,{left:i,top:a}=n,{left:o,top:l}=r,s=[],c=Math.min(4,Math.abs(a-l)/2);return n.isAbove?s.push(d4(i+8,a-12+2),d5(i+8,a-4),d8(i+8,a,i+8+4,a)):n.isBelow?s.push(d4(i+8,a+12-2),d5(i+8,a+4),d8(i+8,a,i+8+4,a)):s.push(d4(i,a)),r.isAbove?a<r.boun
1ds.top?s.push(d5(r.bounds.left-8-c,a),d8(r.bounds.left-8,a,r.bounds.left-8,a+c),d5(r.bounds.left-8,l-c),d8(r.bounds.left-8,l,r.bounds.left-8+c,l),d5(r.bounds.left+8-4,l),d8(r.bounds.left+8,l,r.bounds.left+8,l-4),d5(r.bounds.left+8,l-12+2)):s.push(d5(r.bounds.left+8-4,a),d8(r.bounds.left+8,a,r.bounds.left+8,a-4),d5(r.bounds.left+8,l-12+2)):r.isBelow?a>r.bounds.top+r.bounds.height?s.push(d5(r.bounds.left-8-c,a),d8(r.bounds.left-8,a,r.bounds.left-8,a-c),d5(r.bounds.left-8,l+c),d8(r.bounds.left-8,l,r.bounds.left-8+c,l),d5(r.bounds.left+8-4,l),d8(r.bounds.left+8,l,r.bounds.left+8,l+4),d5(r.bounds.left+8,l+12-2)):s.push(d5(r.bounds.left+8-4,a),d8(r.bounds.left+8,a,r.bounds.left+8,a+4),d5(r.bounds.left+8,l+12-2)):a<l?s.push(d5(r.bounds.left+8-c,a),d8(r.bounds.left+8,a,r.bounds.left+8,a+c),d5(r.bounds.left+8,l-c),d8(r.bounds.left+8,l,r.bounds.left+8+c,l),d5(o,l)):s.push(d5(r.bounds.left+8-c,a),d8(r.bounds.left+8,a,r.bounds.left+8,a-c),d5(r.bounds.left+8,l+c),d8(r.bounds.left+8,l,r.bounds.left+8+c,l),d5(o,l)),function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.join(n)}(s)}(i);return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(un,{d:a,strokeWidth:16}),(0,oZ.jsx)(ut,{d:a,strokeWidth:1}),(0,oZ.jsx)(ur,{top:r.rect.top,left:r.rect.left-.5,height:r.rect.height,width:1,bounds:r.bounds}),i.from.isAbove&&(0,oZ.jsx)(ut,{d:d3(i.from.left+8,i.from.bounds.top-12+2,-1),strokeWidth:1}),i.from.isBelow&&(0,oZ.jsx)(ut,{d:d3(i.from.left+8,i.from.bounds.top+i.from.bounds.height+12-2,1),strokeWidth:1}),i.to.isAbove&&(0,oZ.jsx)(ut,{d:d3(i.to.bounds.left+8,i.to.bounds.top-12+2,-1),strokeWidth:1}),i.to.isBelow&&(0,oZ.jsx)(ut,{d:d3(i.to.bounds.left+8,i.to.bounds.top+i.to.bounds.height+12-2,1),strokeWidth:1}),!1]})});var ua=Object.freeze,uo=Object.defineProperty;let ul=oV.ZP.svg(eH||(eH=ua(uo(l=["\n  pointer-events: none;\n  position: absolute;\n  left: 0;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  width: 100%;\n  height: 100%;\n"],"raw",{value:ua(l.slice())}))));function us(e){let{base:n,border:r,focusRing:i}=e,a=i.offset+i.width,o=0-i.offset,l=n?n.bg:"var(--card-bg-color)";return[o>0&&"inset 0 0 0 ".concat(o,"px var(--card-focus-ring-color)"),r&&"inset 0 0 0 ".concat(r.width,"px ").concat(r.color),o<0&&"0 0 0 ".concat(0-o,"px ").concat(l),a>0&&"0 0 0 ".concat(a,"px var(--card-focus-ring-color)")].filter(Boolean).join(",")}var uc=Object.freeze,ud=Object.defineProperty,uu=(e,n)=>uc(ud(e,"raw",{value:uc(n||e.slice())}));let up="a,button",uh=oV.ZP.div(e=>{let{theme:n,offset:r}=e;return(0,oV.iv)(e$||(e$=uu(["\n    bottom: ","px;\n    border-radius: ",";\n    left: ","px;\n    pointer-events: none;\n    position: absolute;\n    right: ","px;\n    top: ","px;\n    z-index: 2;\n\n    ",":focus-visible & {\n      box-shadow: ",";\n    }\n  "])),-r,(0,oK.hO)(n.sanity.radius[1]),-r,-r,-r,um,us({base:n.sanity.color.base,focusRing:n.sanity.focusRing}))}),uf=oV.ZP.div(eW||(eW=uu(["\n  bottom: 0;\n  display: none;\n  left: 0;\n  position: absolute;\n  right: 0;\n  top: 0;\n  z-index: 1;\n\n  @media (hover: hover) {\n    &[data-enabled='true'] {\n      display: block;\n    }\n  }\n"]))),um=(0,oV.ZP)(oK.xu)(eY||(eY=uu(["\n  height: 100%;\n  outline: none;\n  overflow-x: hidden;\n  overflow-y: auto;\n  overscroll-behavior: contain;\n  width: 100%;\n"]))),ug=(0,oV.ZP)(oK.xu).attrs(e=>{let{$height:n}=e;return{style:{height:"".concat(n,"px")}}})(eX||(eX=uu(["\n  position: relative;\n  width: 100%;\n"]))),ux=(0,oN.forwardRef)(function(e,n){let{activeItemDataAttr:r="data-active",ariaLabel:i,ariaMultiselectable:a=!1,autoFocus:o,canReceiveFocus:l,fixedHeight:s,focusRingOffset:c=0,getItemDisabled:d,getItemKey:u,getItemSelected:p,initialIndex:h,initialScrollAlign:f="start",inputElement:m,itemHeight:g,items:x,onEndReached:v,onEndReachedIndexOffset:y=0,onlyShowSelectionWhenActive:b,overscan:j,renderItem:w,wrapAround:k=!0,...C}=e,_=(0,oN.useRef)(!1),T=(0,oN.useRef)((0,oN.useId)()),S=(0,oN.useRef)(null!=h?h:0),[E,P]=(0,oN.useState)(null),[O,A]=(0,oN.useState)(!1),[I,z]=(0,oN.useState)(null),[M,R]=(0,oN.useState)(null),F=(0,oN.useCallback)(e=>{if(!v)return;let[n]=[...e.getVirtualItems()].reverse();n&&n.index>=x.length-y-1&&_.current&&v()},[v,x.length,y]),D=(0,ls.MG)({count:x.length,getItemKey:u,getScrollElement:()=>M,estimateSize:()=>g,onChange:F,overscan:j}),q=(0,oN.useMemo)(()=>{let e=-1;return x.reduce((n,r,i)=>{var a,o;let l=null!=(a=null==d?void 0:d(i))&&a,s=null!=(o=null==p?void 0:p(i))&&o;return l||(e+=1),n[i]={activeIndex:l?null:e,disabled:l,selected:s},n},[])},[d,p,x]),Z=(0,oN.useMemo)(()=>q.filter(e=>!e.disabled).length,[q]),N=(0,oN.useCallback)(e=>null==I?void 0:I.setAttribute("data-enabled",(!e).toString()),[I]),L=(0,oN.useCallback)(e=>"".concat(T.current,"-item-").concat(e),[]),V=(0,oN.useCallback)(()=>"".concat(T.current,"-children"),[]),K=(0,oN.useCallback)(()=>{let e=[m,M].some(e=>document.activeElement===e);if(b&&!e&&!O)return;
1let n=Array.from((null==E?void 0:E.children)||[]);null==n||n.forEach(e=>{var n,i,a;let o=null==(i=q[Number(null==(n=e.dataset)?void 0:n.index)])?void 0:i.activeIndex;null==(a=e.querySelector(up))||a.toggleAttribute(r,o===S.current)})},[r,null==E?void 0:E.children,O,m,q,b,M]),B=(0,oN.useCallback)(()=>{let e=Array.from((null==E?void 0:E.children)||[]);null==e||e.forEach(e=>{var n;null==(n=e.querySelector(up))||n.toggleAttribute(r,!1)})},[r,null==E?void 0:E.children]),U=(0,oN.useMemo)(()=>ln()(K,200),[K]),H=(0,oN.useCallback)(()=>{let e=null==S?void 0:S.current;x.length>0?(null==m||m.setAttribute("aria-activedescendant",L(e)),null==M||M.setAttribute("aria-activedescendant",L(e))):(null==m||m.removeAttribute("aria-activedescendant"),null==M||M.removeAttribute("aria-activedescendant"))},[L,m,x.length,M]),$=(0,oN.useCallback)(()=>{var e,n;let r=null==E?void 0:E.parentElement;if(E&&r){let i=r.getBoundingClientRect().top-E.getBoundingClientRect().top;return null!=(n=null==(e=D.getVirtualItemForOffset(i))?void 0:e.index)?n:-1}return -1},[E,D]),W=(0,oN.useCallback)(e=>{let{index:n,scrollAlign:r,scrollIntoView:i=!0}=e;if(S.current=n,H(),K(),i){let e=q.findIndex(e=>e.activeIndex===n);e>-1&&D.scrollToIndex(e,r?{align:r}:{})}},[H,q,K,D]),Y=(0,oN.useCallback)(e=>{let n=-1,r=Z-1;"next"===e&&(n=S.current<Z-1?S.current+1:k?0:r),"previous"===e&&(n=S.current>0?S.current-1:k?r:0),W({index:n,scrollIntoView:!0}),N(!1)},[Z,N,W,k]),X=(0,oN.useCallback)(e=>{switch(e){case"input":null==m||m.focus();break;case"list":null==M||M.focus()}},[m,M]),G=(0,oN.useCallback)(()=>{null==m||m.focus()},[m]),J=(0,oN.useCallback)(()=>{null==M||M.focus()},[M]),Q=(0,oN.useCallback)(e=>()=>{W({index:e,scrollIntoView:!1})},[W]),ee=(0,oN.useCallback)(()=>{K()},[K]),et=(0,oN.useCallback)(e=>n=>{let r=Array.from((null==E?void 0:E.children)||[]);if(r.length&&("ArrowDown"===n.key&&(n.preventDefault(),X(e),Y("next")),"ArrowUp"===n.key&&(n.preventDefault(),X(e),Y("previous")),"Enter"===n.key)){n.preventDefault(),X(e);let i=r.find(e=>Number(e.dataset.index)===q.findIndex(e=>e.activeIndex===S.current));if(i){let e=null==i?void 0:i.querySelector(up);null==e||e.click()}}},[null==E?void 0:E.children,X,q,Y]),en=(0,oN.useCallback)(e=>et("input")(e),[et]),er=(0,oN.useCallback)(e=>et("list")(e),[et]),ei=(0,oN.useCallback)(()=>{b&&(K(),A(!0))},[b,K]),ea=(0,oN.useCallback)(()=>{b&&(B(),A(!1))},[B,b]);(0,oN.useImperativeHandle)(n,()=>({focusInputElement(){G()},focusListElement(){J()},getTopIndex:()=>
1$(),scrollToIndex(e){W({index:e}),N(!0)}}),[N,G,J,$,W]),(0,oN.useEffect)(()=>{void 0===h||_.current||W({index:h,scrollAlign:f,scrollIntoView:!0}),_.current=!0},[h,f,b,W]),(0,oN.useEffect)(()=>{function e(){N(!0)}return null==M||M.addEventListener("mousemove",e),null==M||M.addEventListener("wheel",e,{passive:!0}),()=>{null==M||M.removeEventListener("mousemove",e),null==M||M.removeEventListener("wheel",e)}},[N,M]),(0,oN.useEffect)(()=>(null==m||m.addEventListener("focus",ee),null==m||m.addEventListener("keydown",en),null==M||M.addEventListener("focus",ee),null==M||M.addEventListener("keydown",er),()=>{null==m||m.removeEventListener("focus",ee),null==m||m.removeEventListener("keydown",en),null==M||M.removeEventListener("focus",ee),null==M||M.removeEventListener("keydown",er)}),[l,ee,et,en,er,B,m,K,M]),(0,oN.useEffect)(()=>{H()},[H,x]),(0,oN.useEffect)(()=>{let e=new MutationObserver(U);return E&&e.observe(E,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[E,U]),(0,oN.useEffect)(()=>{null==m||m.setAttribute("aria-autocomplete","list"),null==m||m.setAttribute("aria-expanded","true"),null==m||m.setAttribute("aria-controls",V()),null==m||m.setAttribute("role","combobox")},[V,m]),(0,oN.useEffect)(()=>{o&&X(o)},[o,l,J,G,X]);let eo=l?0:-1;return(0,oZ.jsxs)(um,{id:V(),onMouseEnter:ei,onMouseLeave:ea,ref:R,sizing:"border",tabIndex:eo,...C,children:[l&&(0,oZ.jsx)(uh,{offset:c}),(0,oZ.jsx)(uf,{"aria-hidden":"true","data-enabled":!0,ref:z}),D&&(0,oZ.jsx)(ug,{forwardedAs:"ul",$height:D.getTotalSize(),"aria-label":i,"aria-multiselectable":a,flex:1,ref:P,role:"listbox",children:D.getVirtualItems().map(e=>{let n=e.index,{activeIndex:r,disabled:i,selected:o}=q[n],l=w(x[n],{activeIndex:r,disabled:i,selected:o,virtualIndex:n}),c=(0,oN.cloneElement)(l,{tabIndex:-1}),d="number"!=typeof r||i?{}:{"aria-posinset":r+1,...a?{"aria-selected":o.toString()}:{},"aria-setsize":Z,id:L(r),role:"option",onMouseEnter:Q(r)};return(0,oZ.jsx)(oK.Kq,{as:"li","data-index":n,ref:s?void 0:D.measureElement,style:{flex:1,...s?{height:"".concat(e.size,"px")}:{},left:0,position:"absolute",top:0,transform:"translateY(".concat(e.start,"px)"),width:"100%"},tabIndex:-1,...d,children:c},e.key)})})]})}),uv=(0,oN.memo)(function(e){let{hook:n,args:r,id:i,onNext:a,onReset:o,onRequestUpdate:l}=e,s=n({...r,onComplete:()=>{o(i)}});return(0,oN.useEffect)(()=>(a(i,s),l(),()=>{a(i,null),l()}),function(e){let n=(0,oN.useRef)(void 0);return lu()(e,n.current)||(n.current=e),[n.current]}(s)),null},(e,n)=>e.args===n.args),uy=(()=>{let e={dateTimeFormat:ub(),listFormat:ub(),numberFormat:ub(),relativeTimeFormat:ub()};return{dateTimeFormat:function(n,r){let i=uj(n,r),a=e.dateTimeFormat[i];return a||(a=new Intl.DateTimeFormat(n,r),e.dateTimeFormat[i]=a),a},listFormat:function(n,r){let i=uj(n,r),a=e.listFormat[i];return a||(a=new Intl.ListFormat(n,r),e.listFormat[i]=a),a},numberFormat:function(n,r){let i=uj(n,r),a=e.numberFormat[i];return a||(a=new Intl.NumberFormat(n,r),e.numberFormat[i]=a),a},relativeTimeFormat:function(n,r){let i=uj(n,r),a=e.relativeTimeFormat[i];return a||(a=new Intl.RelativeTimeFormat(n,r),e.relativeTimeFormat[i]=a),a}}})();function ub(){return Object.create(null)}function uj(e,n){return"".concat(e,"-").concat(JSON.stringify(function(e){let n=[];for(let[r,i]of Object.entries(e))n.push("".concat(r,"=").concat(JSON.stringify(i)));return n.sort().join("\n")}(n)))}let uw=(0,oN.createContext)(void 0);function uk(){return uC().currentLocale}function uC(){let e=(0,oN.useContext)(uw);if(!e)throw Error("Sanity LocaleContext value missing. Is this hook being used outside LocaleContext.Provider?");return e}function u_(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=uk().id;return uy.listFormat(n,e)}let uT=/^<(?<tag>[^\s\d<][^/?><]+)\/?>/,uS=/<\/(?<tag>[^>]+)>/,uE=/<[^>]+\/>/,uP=/^[A-Z][A-Za-z0-9]+$/,uO=/^[a-z]+$/,uA=/^[A-Z]/,uI=["abbr","address","cite","code","del","em","ins","kbd","q","samp","strong","sub","sup"];function uz(e){let n=e.t(e.i18nKey,{context:e.context,replace:e.values,count:e.values&&"count"in e.values&&"number"==typeof e.values.count?e.values.count:void 0}),r=(0,oN.useMemo)(()=>(function(e){let n=[],r="",i="",a=e;for(;a.length>0;
1)if(i||"<"!==a[0]){if(i&&"<"===a[0]&&"<"!==a[1]){let e=a.match(uS);if(e){let o=e.groups.tag;if("/"!==a[1])throw Error("Expected closing tag for <".concat(i,">, but found new opening tag <").concat(o,">. Nested tags is not supported."));if(o!==i)throw Error("Expected closing tag for <".concat(i,">, but found closing tag </").concat(o,"> instead. Make sure each opening tag has a matching closing tag."));r&&(n.push({type:"text",text:r}),r=""),n.push({type:"tagClose",name:o}),i="",a=a.substring(e[0].length)}else r+=a[0],a=a.substring(1)}else r+=a[0],a=a.substring(1)}else{let e=a.match(uT);if(e){var o;let l=e.groups.tag;(function(e){if(!(uP.test(e)||uO.test(e)))throw Error(e.trim()===e?'Invalid tag "<'.concat(e,'>". Tag names must be lowercase HTML tags or start with an uppercase letter and can only include letters and numbers.'):'Invalid tag "<'.concat(e,'>". No whitespace allowed in tags.'))})(l),r&&(n.push({type:"text",text:r}),r=""),(o=e[0],uE.test(o))?n.push({type:"tagOpen",selfClosing:!0,name:l}):(n.push({type:"tagOpen",name:l}),i=l),a=a.substring(e[0].length)}else r+=a[0],a=a.substring(1)}if(i)throw Error("No matching closing tag for <".concat(i,'> found. Either make it self closing (e.g. "<').concat(i,'/>") or close it (e.g "<').concat(i,">...</").concat(i,'>").'));return r&&n.push({type:"text",text:r}),n})(n),[n]);return(0,oZ.jsx)(oZ.Fragment,{children:function e(n,r){let[i,...a]=n;if(!i)return null;if("text"===i.type)return(0,oZ.jsxs)(oZ.Fragment,{children:[i.text,e(a,r)]});if("tagOpen"===i.type&&i.selfClosing){let n=r[i.name];if(!n)throw Error("Component not found: ".concat(i.name));return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(n,{}),e(a,r)]})}if("tagOpen"===i.type&&!i.selfClosing){let n=a.findIndex(e=>"tagClose"===e.type),o=a[n];if(o&&i.name!==o.name)throw Error("Nested tags is not allowed");let l=r[i.name];if(!l&&uA.test(i.name))throw Error("Component not defined: ".concat(i.name));if(!l&&!uI.includes(i.name))throw Error('HTML tag "'.concat(i.name,'" is not allowed'));let s=a.slice(0,n),c=a.slice(n+1);return l?(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(l,{children:e(s,r)}),e(c,r)]}):(0,oZ.jsxs)(oZ.Fragment,{children:[oN.createElement(i.name,{},e(s,r)),e(c,r)]})}return null}(r,e.components||{})})}let uM=[];function uR(e){let{currentUser:n,context:r}=e,{t:i}=dV(),a=u_({style:"short",type:"unit"}),o=(null==n?void 0:n.roles)||uM,l=(0,oN.useCallback)(()=>(0,oZ.jsx)(oZ.Fragment,{children:a.formatToParts(o.map(e=>e.title||lf()(e.name))).map((e,n)=>"element"===e.type?(0,oZ.jsx)("code",{children:e.value},"".concat(e.value,"-").concat(n)):(0,oZ.jsx)(oN.Fragment,{children:e.value},"".concat(e.value,"-").concat(n)))}),[o,a]);return(0,oZ.jsxs)(oK.xu,{children:[(0,oZ.jsxs)(oK.gF,{space:2,children:[(0,oZ.jsx)(oK.xv,{size:0,children:(0,oZ.jsx)(lp.vaB,{})}),(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:i("insufficient-permissions-message.title")})]}),(0,oZ.jsx)(oK.gF,{marginTop:4,children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(uz,{i18nKey:"insufficient-permissions-message.not-authorized-explanation",t:i,context:r})})}),(0,oZ.jsx)(oK.gF,{marginTop:4,marginBottom:1,children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(uz,{i18nKey:"insufficient-permissions-message.roles",t:i,components:{Roles:l}})})})]})}let uF=(0,oV.ZP)(oK.W2)(e=>{let{theme:n}=e,{container:r,media:i}=n.sanity;return(0,oK.Lt)(i,e.$width,e=>({width:"auto"===e?"none":(0,oK.hO)(r[e]),maxWidth:"100%"}))}),uD=oN.forwardRef(function(e,n){let{width:r,...i}=e,a=(0,oK.Q5)(r);return(0,oZ.jsx)(uF,{...i,"data-ui":"PopoverContainer",$width:a,ref:n})});var uq=Object.freeze,uZ=Object.defineProperty,uN=(e,n)=>uq(uZ(e,"raw",{value:uq(n||e.slice())}));let uL=(0,oV.ZP)(lr.J2)(()=>(0,oV.iv)(eG||(eG=uN(["\n    // Make the popover scrollable if it overflows the viewport\n    [data-ui='Popover__wrapper'] {\n      overflow: auto;\n    }\n  "])))),uV=(0,oV.ZP)(oK.mh)(e=>{let n=e.theme.sanity.radius[3];return(0,oV.iv)(eJ||(eJ=uN(["\n    position: sticky;\n    top: 0;\n    width: 100%;\n    background: var(--card-bg-color);\n    border-bottom: 1px solid var(--card-border-color);\n    border-top-left-radius: ","px;\n    border-top-right-radius: ","px;\n  "])),n,n)});function uK(e){let{children:n,header:r,onClose:i,referenceElement:a,containerRef:o,width:l}=e,s=(0,oN.useCallback)(()=>{i(),null==a||a.focus()},[i,a]),c=(0,oZ.jsx)(uD,{width:l,children:(0,oZ.jsx)(lg.ZP,{autoFocus:!0,children:(0,oZ.jsxs)(oK.Kq,{ref:o,children:[(0,oZ.jsx)(uV,{children:(0,oZ.jsx)(oK.xu,{padding:2,paddingLeft:4,children:(0,oZ.jsxs)(oK.kC,{align:"center",gap:2,children:[(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.xv,{size:1,textOverflow:"ellipsis",weight:"medium",children:r})}),(0,oZ.jsx)(lr.zx,{icon:lp.Two,mode:"bleed",onClick:s,tooltipProps:{content:"Close"}})]})})}),(0,oZ.jsx)(oK.xu,{padding:4,children:n})]})})});return(0,oZ.jsx)(uL,{portal:!0,constrainSize:!0,content:c,open:!0,referenceElement:a})}var uB=Object.freeze,uU=Object.defineProperty,uH=(e,n)=>uB(uU(e,"raw",{value:uB(n||e.slice())}));let u$=(0,oV.ZP)(oK.Zb)(()=>(0,oV.iv)(eQ||(eQ=uH(["\n    /* TextWithTone uses its own logic to set color, and we therefore need */\n    /* to override this logic in order to set the correct color in different states */\n    &[data-selected],\n    &[data-pressed],\n    &:active {\n      [data-ui='TextWithTone'] {\n        color: inherit;\n      }\n    }\n  "])))),uW=(0,oN.createContext)({selected:!1}),uY=(0,oN.forwardRef)(function(e,n){let{children:r,selected:i,as:a,...o}=e;return(0,oZ.jsx)(u$,{"data-ui":"PreviewCard",...o,forwardedAs:a,ref:n,selected:i,children:(0,oZ.jsx)(uW.Provider,{value:{selected:i},children:r})})});function uX(e){let{t:n}=dV((0,oN.useMemo)(()=>e.i18n?Array.from(new Set(Object.values(e.i18n).map(e=>{let{ns:n}=e;return n}))).sort():[],[e.i18n]));return(0,oN.useMemo)(()=>{let{i18n:r}=e;return r?new Proxy(e,{get:(e,i)=>{let a=e[i];if("string"==typeof i&&i in r){let{key:e,ns:o}=r[i];return n(e,{ns:o,..."string"==typeof a&&{defaultValue:a}})}return a}}):e},[e,n])}function uG(e){let n=JSON.stringify((Array.isArray(e)?e:[e]).flatMap(e=>(null==e?void 0:e.i18n)?Object.values(e.i18n).map(e=>{let{ns:n}=e;return n}):[]).filter(dd).sort()),{t:r}=dV((0,oN.useMemo)(()=>JSON.parse(n),[n]));return(0,oN.useCallback)(function(e){let{i18n:n}=e;return n?new Proxy(e,{get:(e,i)=>{let a=e[i];if("string"==typeof i&&i in n){let{key:e,ns:o}=n[i];return r(e,{ns:o,..."string"==typeof a&&{defaultValue:a}})}return a}}):e},[r])}var uJ=Object.freeze,uQ=Object.defineProperty,u0=(e,n)=>uJ(uQ(e,"raw",{value:uJ(n||e.slice())}));let u1=(0,oV.ZP)(oK.Zb)(e=>{let{$fill:n}=e;
1return(0,oV.iv)(e2||(e2=u0(["\n    align-items: center;\n    box-sizing: border-box;\n    display: flex;\n    flex-direction: column;\n    justify-content: center;\n\n    ","\n\n    ","\n\n    > * {\n      position: absolute;\n    }\n  "])),n?(0,oV.iv)(e0||(e0=u0(["\n          bottom: 0;\n          height: 100%;\n          left: 0;\n          position: absolute;\n          right: 0;\n          top: 0;\n          width: 100%;\n        "]))):(0,oV.iv)(e1||(e1=u0(["\n          min-height: 75px;\n          height: stretch;\n          height: -webkit-fill-available;\n          width: stretch;\n          width: -webkit-fill-available;\n        "]))),!1)}),u2=(0,oV.ZP)(oK.$j)(e=>{let{$animatePosition:n=!0}=e;return(0,oV.iv)(e3||(e3=u0(["\n    @keyframes fadeIn {\n      from {\n        opacity: 0;\n      }\n      to {\n        opacity: 1;\n      }\n    }\n    @keyframes slideUp {\n      from {\n        transform: translateY(0);\n      }\n      to {\n        transform: translateY(-15px);\n      }\n    }\n    animation: ",";\n  "])),n?"500ms ease-out ".concat(750,"ms 1 normal both running fadeIn, 750ms ease-out ").concat(2e3,"ms 1 normal both running slideUp"):"500ms ease-out ".concat(750,"ms 1 normal both running fadeIn"))}),u3=(0,oV.ZP)(oK.xv)(e4||(e4=u0(["\n  @keyframes fadeIn {\n    from {\n      opacity: 0;\n    }\n    to {\n      opacity: 1;\n    }\n  }\n  @keyframes slideDown {\n    from {\n      transform: translateY(0);\n    }\n    to {\n      transform: translateY(15px);\n    }\n  }\n  animation:\n    1500ms ease-out ","ms 1 normal both running fadeIn,\n    750ms ease-out ","ms 1 normal both running slideDown;\n"])),2e3,2e3);function u4(e){let{fill:n,showText:r,title:i}=e;return(0,oZ.jsxs)(u1,{$fill:n,as:n?oK.mh:"div",children:[(0,oZ.jsx)(u2,{$animatePosition:!!r,muted:!0}),r&&(0,oZ.jsx)(u5,{title:i})]})}function u5(e){let{title:n}=e,{t:r}=dV();return(0,oZ.jsx)(u3,{muted:!0,size:1,children:n||r("common.loading")})}var u8=Object.freeze,u6=Object.defineProperty,u9=(e,n)=>u8(u6(e,"raw",{value:u8(n||e.slice())}));let u7=(0,oV.vJ)(e=>{let{color:n,font:r}=(0,oL.aQ)(e.theme);return(0,oV.iv)(e5||(e5=u9(["\n    ::-webkit-resizer {\n      background-image: ",";\n      background-repeat: no-repeat;\n      background-position: bottom right;\n    }\n\n    ::-webkit-scrollbar {\n      width: ","px;\n      height: ","px;\n    }\n\n    ::-webkit-scrollbar-corner {\n      background-color: transparent;\n    }\n\n    ::-webkit-scrollbar-thumb {\n      background-clip: content-box;\n      background-color: var(--card-border-color, ",");\n      border: ","px solid transparent;\n    }\n\n    ::-webkit-scrollbar-thumb:hover {\n      background-color: var(--card-muted-fg-color, ",");\n    }\n\n    ::-webkit-scrollbar-track {\n      background: transparent;\n    }\n\n    *::selection {\n      background-color: ",";\n    }\n\n    html {\n      background-color: ",";\n    }\n\n    body {\n      scrollbar-gutter: stable;\n    }\n\n    #sanity {\n      font-family: ",";\n    }\n\n    b {\n      font-weight: ",";\n    }\n\n    strong {\n      font-weight: ",";\n    }\n  "])),function(e){let n=encodeURIComponent(e),r="%3Csvg width='9' height='9' viewBox='0 0 9 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 8L8 1' stroke='".concat(n,"' stroke-linecap='round'/%3E%3Cpath d='M5 8L8 5' stroke='").concat(n,"' stroke-linecap='round'/%3E%3C/svg%3E%0A");return'url("data:image/svg+xml,'.concat(r,'")')}(n.icon),12,12,n.border,4,n.muted.fg,(0,oL.m4)(n.focusRing,.3),n.bg,r.text.family,r.text.weights.medium,r.text.weights.medium)}),pe=(0,oN.createContext)(null);function pt(){let e=(0,oN.useContext)(pe);if(!e)throw Error("UserColorManager: missing context value");return e}let pn=["green","red","gray"],pr=sx.mE.filter(e=>!pn.includes(e)),pi=e=>{let n="dark"===e;return{background:n?"900":"100",border:n?"700":"300",text:n?"200":"700"}},pa=e=>{let{background:n,border:r,text:i}=pi(e);return pr.reduce((e,a)=>(e[a]={name:a,background:sx.VG[a][n].hex,border:sx.VG[a][r].hex,text:sx.VG[a][i].hex,tints:sx.VG[a]},e),{})},po=e=>{let{background:n,border:r,text:i}=pi(e);return{name:"gray",background:sx.VG.gray[n].hex,border:sx.VG.gray[r].hex,text:sx.VG.gray[i].hex,tints:sx.VG.gray}};function pl(e){let{children:n,manager:r}=e,{scheme:i}=ql(),a=(0,oN.useMemo)(()=>r||function(e){let n;let{anonymousColor:r,colors:i,currentUserColor:a,scheme:o}=e,l=i||pa(o),s=r||po(o),c=a||"purple";if(!l.hasOwnProperty(c))throw Error("'colors' must contain 'currentUserColor' (".concat(c,")"));let d=Object.keys(l),u=new Map,p=new Map,h=d.reduce((e,n)=>(e[n]=0,e),{}),f=new Map;return(null==e?void 0:e.userStore)&&e.userStore.me.subscribe(e=>{var r;n=r=e?e.id:null,h[c]+=r?1:-1}
1),{get:function(e){return e?l[m(e)]:s},listen:function(e){let n=u.get(e);if(n)return n;let r=m(e);return n=new oy.y(n=>{let i=l[r];return n.next(i),()=>{u.delete(e),f.delete(e),h[r]--}}).pipe((0,aJ.d)({refCount:!0})),u.set(e,n),n}};function m(e){let r,i;if(e===n)return c;let a=f.get(e);if(a)return a;let o=p.get(e);if(o&&(0===h[o]||!d.find(e=>0===h[e])))return g(e,o);let l=function(e){let n=0;for(let r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r)|0;return d[Math.abs(n)%d.length]}(e);return 0===h[l]?g(e,l):g(e,(r=1/0,i=[],d.forEach(e=>{let n=h[e];n===r?i.push(e):n<r&&(r=n,i=[e])}),o&&i.includes(o)?o:i[0]))}function g(e,n){return f.set(e,n),p.set(e,n),h[n]++,n}}({scheme:i}),[r,i]);return(0,oZ.jsx)(pe.Provider,{value:a,children:n})}let ps=(e,n,r)=>{let{document:i}=n,a=null==i?void 0:i.unstable_fieldActions;if(!a)return e;if("function"==typeof a)return a(e,r);if(Array.isArray(a))return[...e,...a];throw Error("Expected `document.unstable_fieldActions` to be an array or a function, but received ".concat(typeof a))},pc=[];function pd(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.reduce((e,n,r)=>{let i=typeof n;if("number"===i)return"".concat(e,"[").concat(n,"]");if("string"===i)return"".concat(e).concat(0===r?"":".").concat(n);if((0,ll.fU)(n))return"".concat(e,'[_key=="').concat(n._key,'"]');throw Error('Unsupported path segment "'.concat(n,'"'))},"")}function pu(e){return null!==e||void 0!==e}function pp(e,n,r){if(!r)throw Error("missing context");if(!0===e)return[];if(Array.isArray(e))return e.flatMap(e=>pp(e,n,r)).filter(pu);if("string"==typeof e)return pp({message:e},n,r);if("string"!=typeof e.message)throw Error("".concat(pd(r.path),": Validator must return 'true' if valid or an error message as a string on errors"));let{message:i}=e,a=[];for(let n of(e.path&&a.push(e.path),e.paths||[]))a.push(n);return a.length?a.map(e=>({path:(r.path||[]).concat(e),level:n||"error",item:{message:i},message:i})):[{level:n||"error",item:{message:i},message:i,path:r.path||[]}]}function ph(e,n){let{currentLocale:r}=n,i=r.id;if(e[i])return e[i];if(i.includes("-")){let n=i.split("-",1)[0];if(e[n])return e[n]}return e["en-US"]||e["en-GB"]||e.en||"Unknown validation error (not localized)"}function pf(e){return!0!==e&&void 0!==e&&"string"!=typeof e&&lP()(e)&&!("message"in e)}let pm={}.toString,pg=[Object,Function,Array,String,Boolean,Number,Date,RegExp,Error];function px(e){let n=pm.call(e).slice(8,-1);if(null==e)return n.toLowerCase();let r=e.constructor;return r&&!function(e){for(let n=0;n<pg.length;n++)if(pg[n]===e)return!0;return!1}(r)?r.name:n}function pv(e,n){if(e===n)return!0;if(Array.isArray(e)&&Array.isArray(n)){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!pv(e[r],n[r]))return!1;return!0}if(Array.isArray(e)!=Array.isArray(n))return!1;if(e&&n&&"object"==typeof e&&"object"==typeof n){let r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;if(e instanceof Date&&n instanceof Date)return e.getTime()===n.getTime();if(e instanceof Date!=n instanceof Date)return!1;if(e instanceof RegExp&&n instanceof RegExp)return e.toString()==n.toString();if(e instanceof RegExp!=n instanceof RegExp)return!1;for(let e=0;e<r.length;e++)if("_key"!==r[e]&&!Object.prototype.hasOwnProperty.call(n,r[e]))return!1;for(let i=0;i<r.length;i++){let a=r[i];if("_key"!==a&&!pv(e[a],n[a]))return!1}return!0}return!1}let py=e=>{var n;return e.message?e.message:1===e.results.length?null==(n=e.results[0])?void 0:n.message:e.i18n.t("{{messages, list}}",{messages:e.results.map(e=>{var n;return e.message||(null==(n=e.item)?void 0:n.message)}),formatParams:{messages:{style:"long",type:e.operation}}})},pb={type:(e,n,r,i)=>{let{i18n:a}=i,o=px(n);return o===e||"undefined"===o||r||a.t("validation:generic.incorrect-type",{actualType:o,expectedType:e})},presence:(e,n,r,i)=>{let{i18n:a}=i;return void 0!==n||"required"!==e||r||a.t("validation:generic.required")},all:async(e,n,r,i)=>{let a=(await Promise.all(e.map(e=>e.validate(n,i)))).flat();return 0===a.length||py({message:r,results:a,operation:"conjunction",i18n:i.i18n})},either:async(e,n,r,i)=>{let a=await Promise.all(e.map(e=>e.validate(n,i))),o=a.flat();return!!a.find(e=>!e.length)||py({message:r,results:o,operation:"disjunction",i18n:i.i18n})},valid:(e,n,r,i)=>{let{i18n:a}=i,o=typeof n;if("undefined"===o)return!0;let l=("number"===o||"string"===o)&&"".concat(n),s=l&&l.length>30?"".concat(l.slice(0,30),"…"):l;return!!e.some(e=>pv(e,n))||r||a.t("validation:generic.not-allowed",l?{context:"hint",replace:{hint:s}}:{})},custom:async(e,n,r,i)=>{let a;let o=setTimeout(()=>{"studio"===i.environment&&console.warn("Custom validator at ".concat(pd(i.path)," has taken more than ").concat(5e3,"ms to respond"))},5e3);try{a=await e(n,i)}finally{clearTimeout(o)}return pf(a)?ph(a,i.i18n):"string"==typeof a&&r||a}},pj={...pb,presence:(e,n,r,i)=>{let{i18n:a}=i;return"required"!==e||"boolean"==typeof n||r||a.t("validation:generic.required",{context:"boolean"})}},pw=/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,pk={...pb,integer:(e,n,r,i)=>{let{i18n:a}=i;return!!Number.isInteger(n)||r||a.t("validation:number.non-integer")},precision:(e,n,r,i)=>{let{i18n:a}=i;if(void 0===n)return!0;let o=n.toString().match(pw);return!(Math.max((o[1]?o[1].length:0)-(o[2]?parseInt(o[2],10):0),0)>e)||r||a.t("validation:number.maximum-precision",{limit:e})},min:(e,n,r,i)=>{let{i18n:a}=i;return n>=e||r||a.t("validation:number.minimum",{minNumber:e})},max:(e,n,r,i)=>{let{i18n:a}=i;return n<=e||r||a.t("validation:number.maximum",{maxNumber:e})},greaterThan:(e,n,r,i)=>{let{i18n:a}=i;return n>e||r||a.t("validation:number.greater-than",{threshold:e})},lessThan:(e,n,r,i)=>{let{i18n:a}=i;return n<e||r||a.t("validation:number.less-than",{threshold:e})}},pC="http://sanity",p_=e=>/^\.*\//.test(e),pT=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,pS={...pb,min:(e,n,r,i)=>{let{i18n:a}=i;return!n||n.length>=e||r||a.t("validation:string.minimum-length",{minLength:e})},max:(e,n,r,i)=>{let{i18n:a}=i;return!n||n.length<=e||r||a.t("validation:string.maximum-length",{maxLength:e})},length:(e,n,r,i)=>{let{i18n:a}=i;return(n||"").length===e||r||a.t("validation:string.exact-length",{wantedLength:e})},uri:(e,n,r,i)=>{let a,{i18n:o}=i,l=n||"";if(!l)return!0;let{options:s}=e,{allowCredentials:c,relativeOnly:d}=s,u=s.allowRelative||d;try{a=u?new URL(l,pC):new URL(l)}
1catch(e){return r||o.t("validation:string.url.invalid")}if(d&&a.origin!==pC)return r||o.t("validation:string.url.not-relative");if(!u&&a.origin===pC&&p_(l))return r||o.t("validation:string.url.not-absolute");if(!c&&(a.username||a.password))return r||o.t("validation:string.url.includes-credentials");let p=a.protocol.replace(/:$/,"");return!!s.scheme.some(e=>e.test(p))||r||o.t("validation:string.url.disallowed-scheme",{scheme:p})},stringCasing:(e,n,r,i)=>{let{i18n:a}=i,o=n||"";return"uppercase"===e&&o!==o.toLocaleUpperCase()?r||a.t("validation:string.uppercase"):"lowercase"!==e||o===o.toLocaleLowerCase()||r||a.t("validation:string.lowercase")},presence:(e,n,r,i)=>{let{i18n:a}=i;return"required"!==e||!!n||r||a.t("validation:generic.required",{context:"string"})},regex:(e,n,r,i)=>{let{i18n:a}=i,{pattern:o,name:l,invert:s}=e,c=l||"".concat(o.toString());o.lastIndex=0;let d=o.test(n||"");return(!!s||!!d)&&(!s||!d)||r||(s?a.t("validation:string.regex-match",{name:c}):a.t("validation:string.regex-does-not-match",{name:c}))},email:(e,n,r,i)=>{let{i18n:a}=i,o="".concat(n||"").trim();return!!(!o||pT.test(o))||r||a.t("validation:string.email")}},pE={...pb,min:(e,n,r,i)=>{let{i18n:a,type:o}=i;if(!n||n.length>=e)return!0;let l=(0,ll.js)(o)?"blocks":void 0;return r||a.t("validation:array.minimum-length",{minLength:e,context:l})},max:(e,n,r,i)=>{let{i18n:a,type:o}=i;if(!n||n.length<=e)return!0;let l=(0,ll.js)(o)?"blocks":void 0;return r||a.t("validation:array.maximum-length",{maxLength:e,context:l})},length:(e,n,r,i)=>{let{i18n:a,type:o}=i;if(!n||n.length===e)return!0;let l=(0,ll.js)(o)?"blocks":void 0;return r||a.t("validation:array.exact-length",{wantedLength:e,context:l})},presence:(e,n,r,i)=>{let{i18n:a}=i;return"required"!==e||!!n||r||a.t("validation:generic.required",{context:"array"})},valid:(e,n,r,i)=>{let{i18n:a}=i;if(void 0===n)return!0;let o=[];for(let r=0;r<n.length;r++){let i=n[r];if(e.some(e=>pv(e,i)))continue;let a=i&&i._key?{_key:i._key}:r;o.push([a])}let l=r||a.t("validation:generic.not-allowed");return o.map(e=>({message:l,path:e}))},unique:(e,n,r,i)=>{let{i18n:a}=i,o=[];if(!n)return!0;for(let e=0;e<n.length;e++)for(let r=e+1;r<n.length;r++)pv(n[e],n[r])&&(-1===o.indexOf(e)&&o.push(e),-1===o.indexOf(r)&&o.push(r));let l=o.map(e=>{let r=n[e];return[r&&r._key?{_key:r._key}:e]}),s=r||a.t("validation:array.item-duplicate");return l.map(e=>({message:s,path:e}))}},pP=["_key","_type","_weak"],pO={...pb,presence:(e,n,r,i)=>{let{i18n:a}=i;if("required"!==e)return!0;let o=n&&Object.keys(n).filter(e=>!pP.includes(e));return void 0!==n&&(!o||0!==o.length)||r||a.t("validation:generic.required",{context:"object"})},reference:async(e,n,r,i)=>{if(!n)return!0;let{type:a,getDocumentExists:o,i18n:l}=i;if(!(0,ll.Yk)(n))return r||l.t("validation:object.not-reference");if(!a)throw Error("`type` was not provided in validation context");if("weak"in a&&a.weak)return!0;if(!o)throw Error("`getDocumentExists` was not provided in validation context");return!!await o({id:n._ref})||l.t("validation:object.reference-not-published",{documentId:n._ref})},assetRequired:(e,n,r,i)=>{let{i18n:a}=i;return!!n&&!!n.asset&&!!n.asset._ref||r||a.t("validation:object.asset-required",{context:e.assetType||""})}};function pA(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let pI=/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/,pz=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i="yyyy-MM-dd";return r&&r.dateFormat&&(i=r.dateFormat),"date"===e||(r&&r.timeFormat?i+=" ".concat(r.timeFormat):i+=" HH:mm"),(0,lO.Z)(new Date(n),i)};function pM(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;if("now"===e)return new Date;let r=new Date(e),i=isNaN(r.getTime());if(i&&n)throw Error('Unable to parse "'.concat(e,'" to a date'));return i?null:r}let pR={Boolean:pj,Number:pk,String:pS,Array:pE,Object:pO,Date:{...pb,type:(e,n,r,i)=>{let{i18n:a}=i;return!!(void 0===n||pI.test("".concat(n)))||r||a.t("validation:date.invali
1d-format")},min:(e,n,r,i)=>{let{type:a,i18n:o}=i,l=pM(n);if(!l||!n||l>=pM(e,!0))return!0;if(!a)throw Error("`type` was not provided in validation context.");let s=pA(a.options)?a.options:{};return r||o.t("validation:date.minimum",{minDate:pz(a.name,e,s),providedMinDate:e})},max:(e,n,r,i)=>{let{type:a,i18n:o}=i,l=pM(n);if(!l||!n||l<=pM(e,!0))return!0;if(!a)throw Error("`type` was not provided in validation context.");let s=pA(a.options)?a.options:{};return r||o.t("validation:date.maximum",{maxDate:pz(a.name,e,s),providedMaxDate:e})}}},pF=e=>e&&e.type?pF(e.type):e,pD=e=>"object"==typeof e&&!!e&&e.type===pL.FIELD_REF,pq=[],pZ=Symbol("FIELD_REF"),pN=["Array","Boolean","Date","Number","Object","String"],pL=((e8=class{constructor(e){this._type=void 0,this._level=void 0,this._required=void 0,this._typeDef=void 0,this._message=void 0,this._rules=[],this._fieldRules=void 0,this.valueOfField=e8.valueOfField.bind(e8),this._typeDef=e,this.reset()}_mergeRequired(e){return"required"===this._required||"required"===e._required?"required":"optional"===this._required||"optional"===e._required?"optional":void 0}error(e){let n=this.clone();return n._level="error",n._message=e||void 0,n}warning(e){let n=this.clone();return n._level="warning",n._message=e||void 0,n}info(e){let n=this.clone();return n._level="info",n._message=e||void 0,n}reset(){return this._type=this._type||void 0,this._rules=(this._rules||[]).filter(e=>"type"===e.flag),this._message=void 0,this._required=void 0,this._level="error",this._fieldRules=void 0,this}isRequired(){return"required"===this._required}clone(){let e=new e8;return e._type=this._type,e._message=this._message,e._required=this._required,e._rules=l_()(this._rules),e._level=this._level,e._fieldRules=this._fieldRules,e._typeDef=this._typeDef,e}cloneWithRules(e){let n=this.clone(),r=new Set;return e.forEach(e=>{"type"===e.flag&&(n._type=e.constraint),r.add(e.flag)}),n._rules=n._rules.filter(e=>{let n=["type","uri","email"].includes(e.flag),i=r.has(e.flag);return!(n&&i)}).concat(e),n}merge(e){if(this._type&&e._type&&this._type!==e._type)throw Error("merge() failed: conflicting types");let n=this.cloneWithRules(e._rules);return n._type=this._type||e._type,n._message=this._message||e._message,n._required=this._mergeRequired(e),n._level="error"===this._level?e._level:this._level,n}type(e){let n="".concat(e.slice(0,1).toUpperCase()).concat(e.slice(1));if(!pN.includes(n))throw Error('Unknown type "'.concat(e,'"'));let r=this.cloneWithRules([{flag:"type",constraint:n}]);return r._type=n,r}all(e){return this.cloneWithRules([{flag:"all",constraint:e}])}either(e){return this.cloneWithRules([{flag:"either",constraint:e}])}optional(){let e=this.cloneWithRules([{flag:"presence",constraint:"optional"}]);return e._required="optional",e}required(){let e=this.cloneWithRules([{flag:"presence",constraint:"required"}]);return e._required="required",e}custom(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n.bypassConcurrencyLimit&&Object.assign(e,{bypassConcurrencyLimit:!0}),this.cloneWithRules([{flag:"custom",constraint:e}])}min(e){return this.cloneWithRules([{flag:"min",constraint:e}])}max(e){return this.cloneWithRules([{flag:"max",constraint:e}])}length(e){return this.cloneWithRules([{flag:"length",constraint:e}])}valid(e){let n=Array.isArray(e)?e:[e];return this.cloneWithRules([{flag:"valid",constraint:n}])}integer(){return this.cloneWithRules([{flag:"integer"}])}precision(e){return this.cloneWithRules([{flag:"precision",constraint:e}])}positive(){return this.cloneWithRules([{flag:"min",constraint:0}])}negative(){return this.cloneWithRules([{flag:"lessThan",constraint:0}])}greaterThan(e){return this.cloneWithRules([{flag:"greaterThan",constraint:e}])}lessThan(e){return this.cloneWithRules([{flag:"lessThan",constraint:e}])}uppercase(){return this.cloneWithRules([{flag:"stringCasing",constraint:"uppercase"}])}lowercase(){return this.cloneWithRules([{flag:"stringCasing",constraint:"lowercase"}])}regex(e,n,r){var i,a;let o="string"==typeof n?n:null!=(i=null==n?void 0:n.name)?i:null==r?void 0:r.name,l="string"!=typeof n&&(null!=(a=null==n?void 0:n.invert)?a:null==r?void 0:r.invert);return this.cloneWithRules([{flag:"regex",constraint:{pattern:e,name:o,invert:l||!1}}])}email(){return this.cloneWithRules([{flag:"email"}])}
1uri(e){let n=(null==e?void 0:e.scheme)||["http","https"],r=Array.isArray(n)?n:[n];if(!r.length)throw Error("scheme must have at least 1 scheme specified");let i={options:{scheme:r.map(e=>{if(!(e instanceof RegExp)&&"string"!=typeof e)throw Error("scheme must be a RegExp or a String");return"string"==typeof e?new RegExp("^".concat(e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&"),"$")):e}),allowRelative:(null==e?void 0:e.allowRelative)||!1,relativeOnly:(null==e?void 0:e.relativeOnly)||!1,allowCredentials:(null==e?void 0:e.allowCredentials)||!1}};return this.cloneWithRules([{flag:"uri",constraint:i}])}unique(){return this.cloneWithRules([{flag:"unique"}])}reference(){return this.cloneWithRules([{flag:"reference"}])}fields(e){if("Object"!==this._type)throw Error("fields() can only be called on an object type");let n=this.cloneWithRules([]);return n._fieldRules=e,n}assetRequired(){let e;let n=pF(this._typeDef);return e=n&&["image","file"].includes(n.name)?"image"===n.name?"image":"file":"asset",this.cloneWithRules([{flag:"assetRequired",constraint:{assetType:e}}])}async validate(e,n){let{__internal:r={},...i}=n,{customValidationConcurrencyLimiter:a}=r,o=null==e;if(o&&"optional"===this._required)return pq;let l=void 0===this._required&&o?this._rules.filter(e=>"custom"===e.flag):this._rules,s=this._type&&pR[this._type]||pb;return(await Promise.all(l.map(async n=>{if(void 0===n.flag)throw Error('Invalid rule, did not contain "flag"-property');let r=s[n.flag];if(!r){let e=this._type?'type "'.concat(this._type,'"'):"rule without declared type";throw Error('Validator for flag "'.concat(n.flag,'" not found for ').concat(e))}let o="constraint"in n?n.constraint:null;if(pD(o)&&(o=lS()(i.parent,o.path)),"custom"===n.flag&&a&&!(null==o?void 0:o.bypassConcurrencyLimit)){let e=o;o=async function(){await a.ready();try{return await e(...arguments)}finally{a.release()}}}let l=pf(this._message)?ph(this._message,i.i18n):this._message;try{let n=await r(o,e,l,i);return pp(n,this._level,i)}catch(e){return pp({message:"".concat(pd(i.path),": Exception occurred while validating value: ").concat(e.message)},"error",i)}}))).flat()}}).FIELD_REF=pZ,e8.array=e=>new e8(e).type("Array"),e8.object=e=>new e8(e).type("Object"),e8.string=e=>new e8(e).type("String"),e8.number=e=>new e8(e).type("Number"),e8.boolean=e=>new e8(e).type("Boolean"),e8.dateTime=e=>new e8(e).type("Date"),e8.valueOfField=e=>({type:pZ,path:e}),e8),pV="studio";function pK(e){return e}function pB(e){return!("then"in e.resources&&"function"==typeof e.resources.then)}function pU(e,n){return n}let pH={id:"en-US",title:"English (US)",bundles:[{locale:"en-US",namespace:pV,resources:{"asset-source.asset-list.menu.delete":"Delete","asset-source.asset-list.menu.show-usage":"Show usage","asset-source.asset-usage-dialog.header_file":"Documents using file","asset-source.asset-usage-dialog.header_image":"Documents using image","asset-source.asset-usage-dialog.loading":"Loading…","asset-source.delete-dialog.action.cancel":"Cancel","asset-source.delete-dialog.action.delete":"Delete","asset-source.delete-dialog.header_file":"Delete file","asset-source.delete-dialog.header_image":"Delete image","asset-source.delete-dialog.loading":"Loading…","asset-source.delete-dialog.usage-list.confirm-delete-file_named":"You are about to delete the file <strong>{{filename}}}</strong> and its metadata. Are you sure?","asset-source.delete-dialog.usage-list.confirm-delete-file_unnamed":"You are about to delete the file and its metadata. Are you sure?","asset-source.delete-dialog.usage-list.confirm-delete-image_named":"You are about to delete the image <strong>{{filename}}</strong> and its metadata. Are you sure?","asset-source.delete-dialog.usage-list.confirm-delete-image_unnamed":"You are about to delete the image and its metadata. Are you sure?","asset-source.delete-dialog.usage-list.image-preview-alt":"Preview of image","asset-source.delete-dialog.usage-list.warning-file-is-in-use_named":"{{filename}} cannot be deleted because it's being used. In order to delete this file, you first need to remove all uses of it.","asset-source.delete-dialog.usage-list.warning-file-is-in-use_unnamed":"This file cannot be deleted because it's being used. In order to delete it, you first need to remove all uses of it.","asset-source.delete-dialog.usage-list.warning-image-is-in-use_named":"{{filename}} cannot be deleted because it's being used. In order to delete this image, you first need to remove all uses of it.","asset-source.delete-dialog.usage-list.warning-image-is-in-use_unnamed":"This image cannot be deleted because it's being used. In order to delete it, you first need to remove all uses of it.","asset-source.dialog.accept-message":"Only showing assets of accepted types: <strong>{{acceptTypes}}</strong>","asset-source.dialog.default-title_file":"Select file","asset-source.dialog.default-title_image":"Select image","asset-source.dialog.load-more":"Load more","asset-source.dialog.no-assets_file":"No files","asset-source.dialog.no-assets_image":"No images","asset-source.file.asset-list.action.delete.disabled-cannot-delete-current-file":"Cannot delete currently selected file","asset-source.file.asset-list.action.delete.text":"Delete","asset-source.file.asset-list.action.delete.title":"Delete file","asset-source.file.asset-list.action.select-file.title":"Select the file {{filename}}","asset-source.file.asset-list.action.show-usage.title":"Show usage","asset-source.file.asset-list.delete-failed":"File could not be deleted","asset-source.file.asset-list.delete-successful":"File was deleted","asset-source.file.asset-list.header.date-added":"Date added","asset-source.file.asset-list.header.filename":"Filename","asset-source.file.asset-list.header.size":"Size","asset-source.file.asset-list.header.type":"Type","asset-source.file.title":"Uplaoded files","asset-source.image.asset-list.delete-failed":"Image could not be deleted","asset-source.image.asset-list.delete-successful":"Image was deleted","asset-source.image.t
1itle":"Uploaded images","asset-source.usage-list.documents-using-file_named_one":"One document is using file <code>{{filename}}</code>","asset-source.usage-list.documents-using-file_named_other":"{{count}} documents are using file <code>{{filename}}</code>","asset-source.usage-list.documents-using-file_named_zero":"No documents are using file <code>{{filename}}</code>","asset-source.usage-list.documents-using-file_unnamed_one":"One document is using this file","asset-source.usage-list.documents-using-file_unnamed_other":"{{count}} documents are using this file","asset-source.usage-list.documents-using-file_unnamed_zero":"No documents are using this file","asset-source.usage-list.documents-using-image_named_one":"One document is using image <code>{{filename}}</code>","asset-source.usage-list.documents-using-image_named_other":"{{count}} documents are using image <code>{{filename}}</code>","asset-source.usage-list.documents-using-image_named_zero":"No documents are using image <code>{{filename}}</code>","asset-source.usage-list.documents-using-image_unnamed_one":"One document is using this image","asset-source.usage-list.documents-using-image_unnamed_other":"{{count}} documents are using this image","asset-source.usage-list.documents-using-image_unnamed_zero":"No documents are using this image","calendar.action.go-to-next-month":"Go to next month","calendar.action.go-to-next-year":"Go to next year","calendar.action.go-to-previous-month":"Go to previous month","calendar.action.go-to-previous-year":"Go to previous year","calendar.action.go-to-today":"Today","calendar.action.go-to-today-aria-label":"Go to today","calendar.action.go-to-tomorrow":"Tomorrow","calendar.action.go-to-yesterday":"Yesterday","calendar.action.include-time-label":"Include time","calendar.action.select-hour":"Select hour","calendar.action.select-minute":"Select minute","calendar.action.set-to-current-time":"Set to current time","calendar.action.set-to-time-preset":"{{time}} on {{date, datetime}}","calendar.error.must-be-in-format":"Must be in the format: {{exampleDate}}","calendar.month-names.april":"April","calendar.month-names.august":"August","calendar.month-names.december":"December","calendar.month-names.february":"February","calendar.month-names.january":"January","calendar.month-names.july":"July","calendar.month-names.june":"June","calendar.month-names.march":"March","calendar.month-names.may":"May","calendar.month-names.november":"November","calendar.month-names.october":"October","calendar.month-names.september":"September","calendar.weekday-names.short.friday":"Fri","calendar.weekday-names.short.monday":"Mon","calendar.weekday-names.short.saturday":"Sat","calendar.weekday-names.short.sunday":"Sun","calendar.weekday-names.short.thursday":"Thu","calendar.weekday-names.short.tuesday":"Tue","calendar.weekday-names.short.wednesday":"Wed","changes.action.close-label":"Close review changes","changes.action.revert-all-cancel":"Cancel","changes.action.revert-all-confirm":"Revert all","changes.action.revert-all-description":"Are you sure you want to revert all {{count}} changes?","changes.action.revert-changes-confirm-change_one":"Revert change","changes.action.revert-changes-confirm-change_other":"Revert changes","changes.action.revert-changes-description":"Are you sure you want to revert the changes?","changes.action.revert-changes-description_one":"Are you sure you want to revert the change?","changes.added-label":"Added","changes.array.item-added-in-position":"Added in position {{position}}","changes.array.item-moved_down_one":"Moved {{count}} position down","changes.array.item-moved_down_other":"Moved {{count}} positions down","changes.array.item-moved_up_one":"Moved {{count}} position up","changes.array.item-moved_up_other":"Moved {{count}} positions up","changes.array.item-removed-from-position":"Removed from position {{position}}","changes.change-bar.aria-label":"Review changes","changes.changed-label":"Changed","changes.changes-by-author":"Changes by","changes.error-boundary.developer-info":"Check the developer console for more information","changes.error-boundary.title":"Rendering the changes to this field caused an error","changes.error.incorrect-type-message":'Value error: Value is of type "<code>{{actualType}}</code>", expected "<code>{{expectedType}}</code>"',"changes.file.meta-info-fallback-title":"Untitled","changes.image.crop-changed":"Crop changed","changes.image.deleted":"Image deleted","changes.image.error-loading-image":"Error loading image","changes.image.hotspot-changed":"Hotspot changed","changes.image.meta-info-fallback-title":"Untitled","changes.image.no-asset-set":"Image not set","changes.image.no-image-placeholder":"(no image)","changes.inspector.from-label":"From","changes.inspector.meta-label":"Meta","changes.inspector.to-label":"To","changes.loading-author":"Loading…","changes.loading-changes":"Loading changes…","changes.no-changes-description":"Edit the document or select an older version in the timeline to see a list of changes appear in this panel.","changes.no-changes-title":"There are no changes","changes.portable-text.annotation_added":"Added annotation","changes.portable-text.annotation_changed":"Changed annotation","changes.portable-text.annotation_removed":"Removed annotation","changes.portable-text.annotation_unchanged":"Unchanged annotation","changes.portable-text.block-style-changed":'Changed block style from "{{fromStyle}}" to "{{toStyle}}"',"changes.portable-text.changed-formatting":"Changed formatting","changes.portable-text.empty-inline-object":"Empty {{inlineObjectType}}","changes.portable-text.empty-object-annotation":"Empty {{annotationType}}","changes.portable-text.empty-text_added":"Added empty text","changes.portable-text.empty-text_changed":"Changed empty text","changes.portable-text.empty-text_removed":"Removed empty text","changes.portable-text.inline-object_added":"Added inline object","changes.portable-text.inline-object_changed":"Changed inline object","changes.portable-text.inline-object_removed":"Removed inline object","changes.portable-text.inline-object_unchanged":"Unchanged inline object","changes.portable-text.text_added":"Added text","changes.portable-text.text_removed":"Removed text","changes.portable-text.unknown-annotation-schema-type":"Unknown schema type","changes.portable-text.unknown-inline-object-schema-type":"Unknown schema type","changes.removed-label":"Removed","changes.title":"Review changes","common.context-menu-button.tooltip":"Show more","common.dialog.cancel-button.text":"Cancel","common.dialog.confirm-button.text":"Confirm","common.loading":"Loading","configuration-issues.button.tooltip":"Found configuration issues","default-menu-item.fallback-title":"Sort by {{title}}","default-orderings.caption":"Sort by Caption","default-orderings.description":"Sort by Description","default-orderings.header":"Sort by Header","default-orderings.heading":"Sort by Heading","default-orderings.label":"Sort by Label","default-orderings.name":"Sort by Name","default-orderings.title":"Sort by Title","document-status.edited":"Edited {{date}}","document-status.not-published":"Not published","document-status.published":"Published {{date}}","form.error.duplicate-keys-alert.details.additional-description":"The value of the <code>_key</code> property must be a unique string.","form.error.duplicate-keys-alert.details.description":"This usually happens when items are created using an API client, and the <code>_key</code> property of each elements has been generated non-uniquely.","form.error.duplicate-keys-alert.details.title":"Developer info","form.error.duplicate-keys-alert.generate-button.text":"Generate unique keys","form.error.duplicate-keys-alert.summary":"Several items in this list share the same identifier (key). Every item must have an unique identifier.","form.error.duplicate-keys-alert.title":"Non-unique keys","form.error.field-not-found":'Field "{{fieldName}}" not found among members – verify that it is defined in the schema and that it has not been conditionally hidden.',"form.error.missing-keys-alert.add-button.text":"Add missing keys","form.error.missing-keys-alert.details.additional-description":"The value of the <code>_key</code> property must be a unique string.","form.error.missing-keys-alert.details.description":"This usually happens when items are created using an API client, and the <code>_key</code> property has not been included.","form.error.missing-keys-alert.details.title":"Developer info","form.error.missing-keys-alert.summary":"Some items in the list are missing their keys. This must be fixed in order to edit the list.","form.error.missing-keys-alert.title":"Missing keys","form.error.mixed-array-alert.details.description":"This usually happens when items are created using an API client, or when a custom input component has added invali
1d data to the list.","form.error.mixed-array-alert.details.title":"Developer info","form.error.mixed-array-alert.remove-button.text":"Remove non-object values","form.error.mixed-array-alert.summary":"Some items in this list are not objects. This must be fixed in order to edit the list.","form.error.mixed-array-alert.title":"Invalid list values","form.error.no-array-item-at-index":"No array item at index <code>{{index}}</code> found at path <code>{{path}}</code>","form.error.no-array-item-at-key":'No array item with `_key` <code>"{{key}}"</code> found at path <code>{{path}}</code>',"form.field.deprecated-label":"deprecated","form.field.untitled-field-label":"Untitled","form.field.untitled-fieldset-label":"Untitled","form.validation.has-error-aria-label":"Has error","form.validation.has-info-aria-label":"Has information","form.validation.has-warning-aria-label":"Has warning","form.validation.summary.errors-count_one":"{{count}} error","form.validation.summary.errors-count_other":"{{count}} errors","form.validation.summary.warnings-count_one":"{{count}} warning","form.validation.summary.warnings-count_other":"{{count}} warnings","free-trial.tooltip.days-count_one":"{{count}} day left in trial","free-trial.tooltip.days-count_other":"{{count}} days left in trial","free-trial.tooltip.trial-finished":"Upgrade your project","help-resources.action.contact-sales":"Contact sales","help-resources.action.help-and-support":"Help and support","help-resources.action.join-our-community":"Join our community","help-resources.latest-sanity-version":"Latest version is {{latestVersion}}","help-resources.studio-version":"Sanity Studio version {{studioVersion}}","help-resources.title":"Help and resources","input.files.common.cancel-upload":"Cancel","input.files.common.upload-placeholder.file-input-button.text":"Upload","input.files.common.upload-progress":"Uploading <FileName/>","input.reference.document-cannot-be-opened.failed-to-resolve-url":"This document cannot be opened (unable to resolve URL to Studio)","inputs.array.action.add-after":"Add item after","inputs.array.action.add-before":"Add item before","inputs.array.action.add-item":"Add item","inputs.array.action.add-item-select-type":"Add item...","inputs.array.action.drag.tooltip":"Drag to re-order","inputs.array.action.duplicate":"Duplicate","inputs.array.action.edit":"Edit {{itemTypeTitle}}","inputs.array.action.remove":"Remove","inputs.array.action.remove-invalid-item":"Remove","inputs.array.action.view":"View {{itemTypeTitle}}","inputs.array.error.can-delete-but-no-edit-description":"You can still move or delete this item, but it cannot be edited since the schema definition for its type is nowhere to be found.","inputs.array.error.cannot-resolve-initial-value-title":"Unable to resolve initial value for type: {{schemaTypeTitle}}: {{errorMessage}}.","inputs.array.error.cannot-upload-unable-to-convert_one":"The following item can't be uploaded because there's no known conversion from content type to array item:","inputs.array.error.cannot-upload-unable-to-convert_other":"The following items can't be uploaded because there's no known conversion from content types to array item:","inputs.array.error.current-schema-not-declare-description":"The current schema does not declare items of type <code>{{typeName}}</code> as valid for this list. This could mean that the type has been removed as a valid item type, or that someone else has added it to their own local schema that is not yet deployed.","inputs.array.error.json-representation-description":"JSON representation of this item:","inputs.array.error.type-is-incompatible-prompt":"Item of type <code>{{typeName}}</code> not valid for this list","inputs.array.error.type-is-incompatible-title":"Why is this happening?","inputs.array.error.unexpected-error":"Unexpected Error: {{error}}","inputs.array.no-items-label":"No items","inputs.array.read-only-label":"This field is read-only","inputs.array.resolving-initial-value":"Resolving initial value…","inputs.datetime.placeholder":"e.g. {{example}}","inputs.file.actions-menu.file-options.aria-label":"Open file options menu","inputs.file.browse-button.text":"Browse","inputs.file.dialog.title":"Select file","inputs.file.error.unknown-member-kind":"Unknown member kind: {{kind}}
1","inputs.file.invalid-file-warning.description":"The value of this field is not a valid file. Resetting this field will let you choose a new file.","inputs.file.invalid-file-warning.reset-button.text":"Reset value","inputs.file.invalid-file-warning.title":"Invalid file value","inputs.file.multi-browse-button.text":"Select","inputs.file.upload-failed.description":"The upload could not be completed at this time.","inputs.file.upload-failed.title":"Upload failed","inputs.files.common.actions-menu.clear-field.label":"Clear field","inputs.files.common.actions-menu.copy-url.label":"Copy URL","inputs.files.common.actions-menu.download.label":"Download","inputs.files.common.actions-menu.notification.url-copied":"The URL is copied to the clipboard","inputs.files.common.actions-menu.replace.label":"Replace","inputs.files.common.actions-menu.upload.label":"Upload","inputs.files.common.drop-message.drop-to-upload":"Drop to upload","inputs.files.common.drop-message.drop-to-upload-multi_one":"Drop to upload {{count}} file","inputs.files.common.drop-message.drop-to-upload-multi_other":"Drop to upload {{count}} files","inputs.files.common.drop-message.drop-to-upload.no-accepted-file-message_one":"Can't upload this file here","inputs.files.common.drop-message.drop-to-upload.no-accepted-file-message_other":"Can't upload any of these files here","inputs.files.common.drop-message.drop-to-upload.rejected-file-message_one":"{{count}} file can't be uploaded here","inputs.files.common.drop-message.drop-to-upload.rejected-file-message_other":"{{count}} files can't be uploaded here","inputs.files.common.placeholder.cannot-upload-some-files_one":"Cannot upload file","inputs.files.common.placeholder.cannot-upload-some-files_other":"Cannot upload {{count}} files","inputs.files.common.placeholder.drag-or-paste-to-upload_file":"Drag or paste file here","inputs.files.common.placeholder.drag-or-paste-to-upload_image":"Drag or paste image here","inputs.files.common.placeholder.drop-to-upload_file":"Drop to upload file","inputs.files.common.placeholder.drop-to-upload_image":"Drop to upload image","inputs.files.common.placeholder.read-only":"Read only","inputs.files.common.placeholder.upload-not-supported":"Can't upload files here","inputs.files.common.stale-upload-warning.clear":"Clear upload","inputs.files.common.stale-upload-warning.description":"An upload has made no progress for at least {{staleThresholdMinutes}} minutes and likely got interrupted. You can safely clear the incomplete upload and try uploading again.","inputs.files.common.stale-upload-warning.title":"Incomplete upload","inputs.image.actions-menu.crop-image-tooltip":"Crop image","inputs.image.actions-menu.edit-details.aria-label":"Open image edit dialog","inputs.image.actions-menu.options.aria-label":"Open image options menu","inputs.image.browse-menu.text":"Select","inputs.image.drag-overlay.cannot-upload-here":"Cannot upload this file here","inputs.image.drag-overlay.drop-to-upload-image":"Drop image to upload","inputs.image.drag-overlay.this-field-is-read-only":"This field is read only","inputs.image.error.unknown-member-kind":"Unknown member kind: {{kind}}","inputs.image.hotspot-dialog.title":"Edit hotspot and crop","inputs.image.invalid-image-warning.description":"The value of this field is not a valid image. Resetting this field will let you choose a new image.","inputs.image.invalid-image-warning.reset-button.text":"Reset value","inputs.image.invalid-image-warning.title":"Invalid image value","inputs.image.preview-uploaded-image":"Preview of uploaded image","inputs.image.upload-error.description":"The upload could not be completed at this time.","inputs.image.upload-error.title":"Upload failed","inputs.imagetool.description":"Adjust the rectangle to crop image. Adjust the circle to specify the area that should always be visible.","inputs.imagetool.load-error":"Error: {{errorMessage}}","inputs.imagetool.title":"Hotspot & Crop","inputs.invalid-value.convert-button.text":"Convert to {{targetType}}","inputs.invalid-value.current-type":"The current value (<code>{{actualType}}</code>)","inputs.invalid-value.description":"The property value is stored as a value type that does not match the expected type.","inputs.invalid-value.details.description":"The value of this property must be of type <code>{{validType}}</code> according to the schema.","inputs.invalid-value.details.multi-type-description":"Only the following types are valid here according to schema:","inputs.invalid-value.details.possible-reason":"Mismatching value types typically occur when the schema has recently been changed.","inputs.invalid-value.details.title":"Developer info","inputs.invalid-value.reset-button.text":"Reset value","inputs.invalid-value.title":"Invalid property value","inputs.object.field-group-tabs.aria-label":"Field groups","inputs.object.unknown-fields.read-only.description":"This field is <strong>read only</strong> according to the document’s schema and cannot be unset. If you want to be able to unset this in Studio, make sure you remove the <code>readOnly</code> field from the enclosing type in the schema.","inputs.object.unknown-fields.remove-field-button.text":"Remove field","inputs.object.unknown-fields.warning.description_one":"Encountered a field that is not defined in the schema.","inputs.object.unknown-fields.warning.description_other":"Encountered {{count}} fields that are not defined in the schema.","inputs.object.unknown-fields.warning.details.description_one":"This field is not defined in the schema, which could mean that the field definition has been removed or that someone else has added it to their own local project and have not deployed their changes yet.","inputs.object.unknown-fields.warning.details.description_other":"These fields are not defined in the document’s schema, which could mean that the field definitions have been removed or that someone else has added them to their own local project and have not deployed their changes yet.","inputs.object.unknown-fields.warning.details.title":"Developer info","inputs.object.unknown-fields.warning.title_one":"Unknown field found","inputs.object.unknown-fields.warning.title_other":"Unknown fields foun
1d","inputs.portable-text.action.collapse-editor":"Collapse editor","inputs.portable-text.action.edit-annotation":"Edit annotation","inputs.portable-text.action.expand-editor":"Expand editor","inputs.portable-text.action.insert-block":"Insert {{typeName}}","inputs.portable-text.action.insert-block-aria-label":"Insert {{typeName}} (block)","inputs.portable-text.action.insert-inline-object":"Insert {{typeName}}","inputs.portable-text.action.insert-inline-object-aria-label":"Insert {{typeName}} (inline)","inputs.portable-text.action.remove-annotation":"Remove annotation","inputs.portable-text.activate-on-focus-message_click":"Click to activate","inputs.portable-text.activate-on-focus-message_click-focused":"Click or press space to activate","inputs.portable-text.activate-on-focus-message_tap":"Tap to activate","inputs.portable-text.annotation-editor.title":"Edit {{schemaType}}","inputs.portable-text.annotation.link":"Link","inputs.portable-text.block.edit":"Edit","inputs.portable-text.block.open-menu-aria-label":"Open menu","inputs.portable-text.block.open-reference":"Open reference","inputs.portable-text.block.remove":"Remove","inputs.portable-text.block.view":"View","inputs.portable-text.decorator.code":"Code","inputs.portable-text.decorator.emphasis":"Italic","inputs.portable-text.decorator.strike-through":"Strike","inputs.portable-text.decorator.strong":"Strong","inputs.portable-text.decorator.underline":"Underline","inputs.portable-text.empty-placeholder":"Empty","inputs.portable-text.inline-object.edit":"Edit object","inputs.portable-text.inline-object.remove":"Remove object","inputs.portable-text.invalid-value.action-disclaimer":"NOTE: It’s generally safe to perform the action above, but if you are in doubt, get in touch with those responsible for configuring your studio.","inputs.portable-text.invalid-value.disallowed-child-type.action":"Remove the object","inputs.portable-text.invalid-value.disallowed-child-type.description":"Child with key {{childKey}} of block with key <code>{{key}}</code> is of type <code>{{childType}}</code>, which is not allowed by the schema.","inputs.portable-text.invalid-value.disallowed-type.action":"Remove the block","inputs.portable-text.invalid-value.disallowed-type.description":"Block with key <code>{{key}}</code> is of type <code>{{typeName}}</code>, which is not allowed by the schema.","inputs.portable-text.invalid-value.empty-children.action":"Insert empty text span","inputs.portable-text.invalid-value.empty-children.description":"Text block with key <code>{{key}}</code> has no text spans.","inputs.portable-text.invalid-value.ignore-button.text":"Ignore","inputs.portable-text.invalid-value.incorrect-block-type.action":"Use type <code>{{expectedTypeName}}</code>","inputs.portable-text.invalid-value.incorrect-block-type.description":"Block with key <code>{{key}}</code> has an invalid type name. According to the schema, it should be <code>{{expectedTypeName}}</code>
1.","inputs.portable-text.invalid-value.invalid-span-text.action":"Set empty text value","inputs.portable-text.invalid-value.invalid-span-text.description":"Span with key {{childKey}} of block with key <code>{{key}}</code> has a missing or invalid <code>text</code> property.","inputs.portable-text.invalid-value.missing-block-type.action":"Use type <code>{{expectedTypeName}}</code>","inputs.portable-text.invalid-value.missing-block-type.description":"Block with key <code>{{key}}</code> is missing a type name. According to the schema, it should be <code>{{expectedTypeName}}</code>.","inputs.portable-text.invalid-value.missing-child-key.action":"Assign random key","inputs.portable-text.invalid-value.missing-child-key.description":"Child at index <code>{{index}}</code> of block with key <code>{{key}}</code> is missing <code>_key</code> property.","inputs.portable-text.invalid-value.missing-child-type.action":"Remove the object","inputs.portable-text.invalid-value.missing-child-type.description":"Child with key {{childKey}} of block with key <code>{{key}}</code> is missing <code>_type</code> property.","inputs.portable-text.invalid-value.missing-key.action":"Assign random key","inputs.portable-text.invalid-value.missing-key.description":"Block at index <code>{{index}}</code> is missing required <code>_key</code> property.","inputs.portable-text.invalid-value.missing-or-invalid-children.action":"Remove the block","inputs.portable-text.invalid-value.missing-or-invalid-children.description":"Text block with key <code>{{key}}</code> has an invalid or missing `children` property.","inputs.portable-text.invalid-value.missing-or-invalid-markdefs.action":"Add property","inputs.portable-text.invalid-value.missing-or-invalid-markdefs.description":"Text block with key <code>{{key}}</code> has an invalid or missing `markDefs` property.","inputs.portable-text.invalid-value.missing-type.action":"Remove the block","inputs.portable-text.invalid-value.missing-type.description":"Block with key <code>{{key}}</code> is missing a type name.","inputs.portable-text.invalid-value.non-object-child.action":"Remove the item","inputs.portable-text.invalid-value.non-object-child.description":"Child at index <code>{{index}}</code> of block with key <code>{{key}}</code> is not an object.","inputs.portable-text.invalid-value.not-an-array.action":"Unset the value","inputs.portable-text.invalid-value.not-an-array.description":"Value must be an array of Portable Text blocks, or undefined.","inputs.portable-text.invalid-value.not-an-object.action":"Remove item","inputs.portable-text.invalid-value.not-an-object.description":"Item at <code>{{index}}</code> is not an object,.","inputs.portable-text.invalid-value.orphaned-marks.action":"Remove disallowed marks","inputs.portable-text.invalid-value.orphaned-marks.description":"Text block with key <code>{{key}}</code> contains marks <code>({{orphanedMarks, list}})</code> that are not allowed by the schema.","inputs.portable-text.invalid-value.title":"Invalid Portable Text value","inputs.portable-text.list-type.bullet":"Bulleted list","inputs.portable-text.list-type.number":"Numbered list","inputs.portable-text.style.h1":"Heading 1","inputs.portable-text.style.h2":"Heading 2","inputs.portable-text.style.h3":"Heading 3","inputs.portable-text.style.h4":"Heading 4","inputs.portable-text.style.h5":"Heading 5","inputs.portable-text.style.h6":"Heading 6","inputs.portable-text.style.multiple":"Multiple","inputs.portable-text.style.none":"No style","inputs.portable-text.style.normal":"Normal","inputs.portable-text.style.quote":"Quote","inputs.reference.action.clear":"Clear","inputs.reference.action.create-new-document":"Create","inputs.reference.action.create-new-document-select":"Create…","inputs.reference.action.duplicate":"Duplicate","inputs.reference.action.open-in-new-tab":"Open in new tab","inputs.reference.action.remove":"Remove","inputs.reference.action.replace":"Replace","inputs.reference.action.replace-cancel":"Cancel replace","inputs.reference.cross-dataset.feature-disabled-actions":"You can still clear this field's existing reference, but it cannot be changed to a different document as long as the feature is disabled.","inputs.reference.cross-dataset.feature-disabled-description":"This feature has been disabled. Read how to enable it in <DocumentationLink>the documentation</DocumentationLink>.","inputs.reference.cross-dataset.feature-unavailable-title":"Unavailable feature: Cross dataset reference","inputs.reference.cross-dataset.invalid-type":"The referenced document is of invalid type ({{typeName}}) <JsonValue/>","inputs.reference.document-opens-in-new-tab":"This document opens in a new tab","inputs.reference.error.document-unavailable-title":"Document unavailable","inputs.reference.error.failed-to-load-document-title":"Failed to load referenced document","inputs.reference.error.invali
1d-search-result-type-title":'Search returned a type that\'s not valid for this reference: "{{returnedType}}"',"inputs.reference.error.invalid-type-description":"Referenced document (<code>{{documentId}}</code>) is of type <code>{{actualType}}</code>. According to the schema, referenced documents can only be of type <AllowedTypes />.","inputs.reference.error.invalid-type-title":"Document of invalid type","inputs.reference.error.missing-read-permissions-description":"The referenced document could not be accessed due to insufficient permissions","inputs.reference.error.missing-read-permissions-title":"Insufficient permissions","inputs.reference.error.nonexistent-document-description":"The referenced document does not exist (ID: <code>{{documentId}}</code>). You can either remove the reference or replace it with another document.","inputs.reference.error.nonexistent-document-title":"Not found","inputs.reference.error.nonexistent-document.clear-button-label":"Clear","inputs.reference.error.search-failed-title":"Reference search failed","inputs.reference.image-preview-alt-text":"Image preview of referenced document","inputs.reference.incomplete-reference.finalize-action-description":"<strong>{{referencedDocument}}</strong> is published and this reference should now be finalized.","inputs.reference.incomplete-reference.finalize-action-title":"Finalize reference","inputs.reference.incomplete-reference.strengthen-action-description":"<strong>{{referencedDocument}}</strong> is published and this reference should now be converted to a strong reference.","inputs.reference.incomplete-reference.strengthen-action-title":"Convert to strong reference","inputs.reference.incomplete-reference.strengthen-button-label":"Convert to strong reference","inputs.reference.metadata-error.retry-button-label":"Retry","inputs.reference.metadata-error.title":"Unable to load reference metadata","inputs.reference.no-results-for-query":"No results for <strong>“{{searchTerm}}”</strong>","inputs.reference.preview.edited-at-time":"Edited <RelativeTime/>","inputs.reference.preview.has-no-unpublished-changes-aria-label":"No unpublished edits","inputs.reference.preview.has-unpublished-changes-aria-label":"Edited","inputs.reference.preview.is-not-published-aria-label":"Not published","inputs.reference.preview.is-published-aria-label":"Published","inputs.reference.preview.no-unpublished-edits":"No unpublished edits","inputs.reference.preview.not-published":"Not published","inputs.reference.preview.published-at-time":"Published <RelativeTime/>","inputs.reference.referenced-document-does-not-exist":"The referenced document no longer exist and might have been deleted (document ID: <code>{{documentId}}</code>).","inputs.reference.referenced-document-insufficient-permissions":"The referenced document could not be accessed due to insufficient permissions","inputs.reference.resolving-initial-value":"Resolving initial value…","inputs.reference.search-placeholder":"Type to search","inputs.reference.strength-mismatch.is-strong-consquences":"It will not be possible to delete the reference document without first removing this reference or converting it to weak.","inputs.reference.strength-mismatch.is-strong-description":"This reference is <em>strong</em>, but according to the current schema it should be <em>weak</em>.","inputs.reference.strength-mismatch.is-weak-consquences":"This makes it possible to delete the referenced document without first deleting this reference, leav
1ing this field referencing a nonexisting document.","inputs.reference.strength-mismatch.is-weak-description":"This reference is <em>weak</em>, but according to the current schema it should be <em>strong</em>.","inputs.reference.strength-mismatch.strengthen-button-label":"Convert to strong reference","inputs.reference.strength-mismatch.title":"Reference strength mismatch","inputs.reference.strength-mismatch.weaken-button-label":"Convert to weak reference","inputs.slug.action.generate":"Generate","inputs.slug.action.generating":"Generating…","inputs.slug.error.missing-source":"Source is missing. Check source on type {{schemaType}} in schema","inputs.tags.placeholder":"Enter tag and press ENTER…","inputs.tags.placeholder_touch":"Enter tag…","inputs.untyped-value.convert-button.text":"Convert to {{targetType}}","inputs.untyped-value.description":"Encountered an object value without a <code>_type</code> property.","inputs.untyped-value.details.description":"Either remove the <code>name</code> property of the object declaration, or set <code>_type</code> property on items.","inputs.untyped-value.details.json-dump-prefix":"Current value (<code>object</code>):","inputs.untyped-value.details.multi-type-description":"The following types are valid here according to schema:","inputs.untyped-value.details.title":"Developer info","inputs.untyped-value.title":"Property value missing <code>_type</code>","inputs.untyped-value.unset-item-button.text":"Unset value","insufficient-permissions-message.not-authorized-explanation":"You do not have permission to access this feature.","insufficient-permissions-message.not-authorized-explanation_create-any-document":"You do not have permission to create a document.","insufficient-permissions-message.not-authorized-explanation_create-document":"You do not have permission to create this document.","insufficient-permissions-message.not-authorized-explanation_create-document-type":"You do not have permission to create this kind of document.","insufficient-permissions-message.not-authorized-explanation_create-new-reference":"You do not have permission to create a new reference.","insufficient-permissions-message.not-authorized-explanation_delete-document":"You do not have permission to delete this document.","insufficient-permissions-message.not-authorized-explanation_discard-changes":"You do not have permission to discard changes in this document.","insufficient-permissions-message.not-authorized-explanation_duplicate-document":"You do not have permission to duplicate this document.","insufficient-permissions-message.not-authorized-explanation_publish-document":"You do not have permission to publish this document.","insufficient-permissions-message.not-authorized-explanation_unpublish-document":"You do not have permission to unpublish this document.","insufficient-permissions-message.roles":"Your roles: <Roles/>","insufficient-permissions-message.title":"Insufficient permissions","member-field-error.unexpected-error":"Unexpected error: {{error}}","new-document.button":"Create","new-document.create-new-document-label":"New document…","new-document.filter-placeholder":"Filter","new-document.loading":"Loading…","new-document.new-document-aria-label":"New document","new-document.no-document-types-found":"No document types found","new-document.no-document-types-label":"No document types","new-document.no-results":"No results for <strong>{{searchQuery}}</strong>","new-document.open-dialog-aria-label":"Create new document","new-document.title":"Create new document","presence.action.manage-members":"Manage members","presence.aria-label":"Who is here","presence.no-one-else-description":"Invite people to the project to see their online status.","presence.no-one-else-title":"No one else is here","presence.not-in-a-document":"Not in a document","preview.default.title-fallback":"Untitled","preview.fallback.no-value":"(no value)","preview.image.file-is-being-uploaded.alt-text":"The image currently being uploaded","relative-time.just-now":"just now","
1search.action-open-aria-label":"Open search","search.action.add-filter":"Add filter","search.action.clear-filters":"Clear filters","search.action.clear-recent-searches":"Clear recent searches","search.action.clear-type-filters-aria-label":"Clear checked filters","search.action.clear-type-filters-label":"Clear","search.action.close-search-aria-label":"Close search","search.action.filter-by-document-type-aria-label":"Filter by document type","search.action.remove-filter-aria-label":"Remove filter","search.action.search-all-types":"Search all documents","search.action.search-specific-types":"Search for {{types, list}}","search.action.search-specific-types-truncated":"Search for {{types, list}} +{{count}} more","search.action.select-asset":"Select asset","search.action.select-asset_file":"Select file","search.action.select-asset_image":"Select image","search.action.toggle-filters-aria-label_hide":"Hide filters","search.action.toggle-filters-aria-label_show":"Show filters","search.action.toggle-filters-label_hide":"Hide filters","search.action.toggle-filters-label_show":"Show filters","search.button.tooltip":"Search","search.document-type-list":"{{types, list}}","search.document-type-list-all-types":"All types","search.document-type-list-truncated":"{{types, list}} +{{count}} more","search.document-types-aria-label":"Document types","search.document-types-no-matches-found":"No matches for {{filter}}","search.error.display-filter-description":"This may indicate invalid options defined in your schema.","search.error.display-filter-title":"An error occurred whilst displaying this filter.","search.error.no-valid-asset-source-check-config-description":"Please ensure it's enabled in your studio configuration file.","search.error.no-valid-asset-source-only-default-description":"Currently, only the default asset source is supported.","search.error.no-valid-asset-source-title":"No valid asset sources found.","search.error.unspecified-error-help-description":"Please try again or check your connection","search.error.unspecified-error-title":"Something went wrong while searching","search.filter-all-fields-header":"All fields","search.filter-asset-change_file":"Change file","search.filter-asset-change_image":"Change image","search.filter-asset-clear":"Clear","search.filter-asset-select_file":"Select file","search.filter-asset-select_image":"Select image","search.filter-boolean-false":"False","search.filter-boolean-true":"True","search.filter-by-title-aria-label":"Filter by title","search.filter-date-aria-label":"Date","search.filter-date-range-end-date-aria-label":"End date","search.filter-date-range-start-date-aria-label":"Start date","search.filter-date-unit-aria-label":"Select unit","search.filter-date-unit_days":"Days","search.filter-date-unit_months":"Months","search.filter-date-unit_years":"Years","search.filter-date-value-aria-label":"Unit value","search.filter-field-tooltip-description":"Field description","search.filter-field-tooltip-name":"Field name","search.filter-field-tooltip-used-in-document-types":"Used in document types","search.filter-no-matches-found":"No matches for {{filter}}","search.filter-number-max-value-placeholder":"Max value","search.filter-number-min-value-placeholder":"Min value","search.filter-number-value-placeholder":"Value","search.filter-placeholder":"Filter","search.filter-reference-clear":"Clear","search.filter-shared-fields-header":"Shared fields","search.filter-string-value-placeholder":"Value","search.filter-string-value-select-predefined-value":"Select…","search.filters-aria-label_one":"Filter","search.filters-aria-label_other":"Filters","search.instructions":"Use <ControlsIcon/> to refine your search","search.no-results-help-description":"Try another keyword or adju
1st your filters","search.no-results-title":"No results found","search.operator.array-count-equal.description_one":"<Field/> <Operator>has</Operator> <Value>{{count}} item</Value>","search.operator.array-count-equal.description_other":"<Field/> <Operator>has</Operator> <Value>{{count}} items</Value>","search.operator.array-count-equal.name":"quantity is","search.operator.array-count-gt.description_one":"<Field/> <Operator>has ></Operator> <Value>{{count}} item</Value>","search.operator.array-count-gt.description_other":"<Field/> <Operator>has ></Operator> <Value>{{count}} items</Value>","search.operator.array-count-gt.name":"quantity greater than","search.operator.array-count-gte.description_one":"<Field/> <Operator>has ≥</Operator> <Value>{{count}} item</Value>","search.operator.array-count-gte.description_other":"<Field/> <Operator>has ≥</Operator> <Value>{{count}} items</Value>","search.operator.array-count-gte.name":"quantity greater than or equal to","search.operator.array-count-lt.description_one":"<Field/> <Operator>has <</Operator> <Value>{{count}} item</Value>","search.operator.array-count-lt.description_other":"<Field/> <Operator>has <</Operator> <Value>{{count}} items</Value>","search.operator.array-count-lt.name":"quantity less than","search.operator.array-count-lte.description_one":"<Field/> <Operator>has ≤</Operator> <Value>{{count}} item</Value>","search.operator.array-count-lte.description_other":"<Field/> <Operator>has ≤</Operator> <Value>{{count}} items</Value>","search.operator.array-count-lte.name":"quantity less than or equal to","search.operator.array-count-not-equal.description_one":"<Field/> <Operator>does not have</Operator> <Value>{{count}} item</Value>","search.operator.array-count-not-equal.description_other":"<Field/> <Operator>does not have</Operator> <Value>{{count}} items</Value>","search.operator.array-count-not-equal.name":"quantity is not","search.operator.array-count-range.description":"<Field/> <Operator>has between</Operator> <Value>{{from}} → {{to}} items</Value>","search.operator.array-count-range.name":"quantity is between","search.operator.array-list-includes.description":"<Field/> <Operator>includes</Operator> <Value>{{value}}</Value>","search.operator.array-list-includes.name":"includes","search.operator.array-list-not-includes.description":"<Field/> <Operator>does not include</Operator> <Value>{{value}}</Value>","search.operator.array-list-not-includes.name":"does not include","search.operator.array-reference-includes.description":"<Field/> <Operator>includes</Operator> <Value>{{value}}</Value>","search.operator.array-reference-includes.name":"includes","search.operator.array-reference-not-includes.description":"<Field/> <Operator>does not include</Operator> <Value>{{value}}</Value>","search.operator.array-reference-not-includes.name":"does not include","search.operator.asset-file-equal.description":"<Field/> <Operator>is</Operator> <Value>{{value}}</Value>","search.operator.asset-file-equal.name":"is","search.operator.asset-file-not-equal.description":"<Field/> <Operator>is not</Operator> <Value>{{value}}</Value>","search.operator.asset-file-not-equal.name":"is not","search.operator.asset-image-equal.description":"<Field/> <Operator>is</Operator> <Value>{{value}}</Value>","search.operator.asset-image-equal.name":"is","search.operator.asset-image-not-equal.description":"<Field/> <Operator>is not</Operator> <Value>{{value}}</Value>","search.operator.asset-image-not-equal.name":"is not","search.operator.boolean-equal.description":"<Field/> <Operator>is</Operator> <Value>{{value}}</Value>","search.operator.boolean-equal.name":"is","search.operator.date-after.description":"<Field/> <Operator>is after</Operator> <Value>{{value}}</Value>","search.operator.date-after.name":"after","search.operator.date-before.description":"<Field/> <Operator>is before</Operator> <Value>{{value}}</Value>","search.operator.date-before.name":"before","search.operator.date-equal.description":"<Field/> <Operator>is</Operator> <Value>{{value}}</Value>","search.operator.date-equal.name":"is","search.operator.date-last.description":"<Field/> <Operator>is in the last</Operator> <Value>{{value}}</Value>","search.operator.date-last.name":"last","search.operator.date-not-equal.description":"<Field/> <Operator>is not</Operator> <Value>{{value}}</Value>","search.operator.date-not-equal.name":"is not","search.operator.date-range.description":"<Field/> <Operator>is between</Operator> <Value/>","search.operator.date-range.name":"is between","search.operator.date-time-after.description":"<Field/> <Operator>is after</Operator> <Value>{{value}}</Value>","search.operator.date-time-after.name":"after","search.operator.date-time-before.description":"<Field/> <Operator>is before</Operator> <Value>{{value}}</Value>","search.operator.date-time-before.name":"before","search.operator.date-time-equal.description":"<Field/> <Operator>is</Operator> <Value>{{value}}</Value>","search.operator.date-time-equal.name":"is","search.operator.date-time-last.description":"<Field/> <Operator>is in the last</Operator> <Value>{{value}}</Value>","search.operator.date-time-last.name":"last","search.operator.date-time-not-equal.description":"<Field/> <Operator>is not</Operator> <Value>{{value}}</Value>","search.operator.date-time-not-equal.name":"is not","search.operator.date-time-range.description":"<Field/> <Operator>is between</Operator> <Value/>","search.operator.date-time-range.name":"is between","search.operator.defined.description":"<Field/> <Operator>is</Operator> <Value>not empty</Value>","search.operator.defined.name":"not empty","search.operator.not-defined.description":"<Field/> <Operator>is</Operator> <Value>empty</Value>","search.operator.not-defined.name":"empty","search.operator.number-equal.description":"<Field/> <Operator>is</Operator> <Value>{{value}}</Value>","search.operator.number-equal.name":"is","search.operator.number-gt.description":"<Field/> <Operator>></Operator> <Value>{{value}}</Value>
1","search.operator.number-gt.name":"greater than","search.operator.number-gte.description":"<Field/> <Operator>≥</Operator> <Value>{{value}}</Value>","search.operator.number-gte.name":"greater than or equal to","search.operator.number-lt.description":"<Field/> <Operator><</Operator> <Value>{{value}}</Value>","search.operator.number-lt.name":"less than","search.operator.number-lte.description":"<Field/> <Operator>≤</Operator> <Value>{{value}}</Value>","search.operator.number-lte.name":"less than or equal to","search.operator.number-not-equal.description":"<Field/> <Operator>is not</Operator> <Value>{{value}}</Value>","search.operator.number-not-equal.name":"is not","search.operator.number-range.description":"<Field/> <Operator>is between</Operator> <Value>{{from}} → {{to}}</Value>","search.operator.number-range.name":"is between","search.operator.portable-text-contains.description":"<Field/> <Operator>contains</Operator> <Value>{{value}}</Value>","search.operator.portable-text-contains.name":"contains","search.operator.portable-text-equal.description":"<Field/> <Operator>is</Operator> <Value>{{value}}</Value>","search.operator.portable-text-equal.name":"is","search.operator.portable-text-not-contains.description":"<Field/> <Operator>does not contain</Operator> <Value>{{value}}</Value>","search.operator.portable-text-not-contains.name":"does not contain","search.operator.portable-text-not-equal.description":"<Field/> <Operator>is not</Operator> <Value>{{value}}</Value>","search.operator.portable-text-not-equal.name":"is not","search.operator.reference-asset-file.description":"<Field/> <Operator>→</Operator> <Value>{{value}}</Value>","search.operator.reference-asset-file.name":"file","search.operator.reference-asset-image.description":"<Field/> <Operator>→</Operator> <Value>{{value}}</Value>","search.operator.reference-asset-image.name":"image","search.operator.reference-document.description":"<Field/> <Operator>→</Operator> <Value>{{value}}</Value>","search.operator.reference-document.name":"document","search.operator.reference-equal.description":"<Field/> <Operator>is</Operator> <Value>{{value}}</Value>","search.operator.reference-equal.name":"is","search.operator.reference-not-equal.description":"<Field/> <Operator>is not</Operator> <Value>{{value}}</Value>","search.operator.reference-not-equal.name":"is not","search.operator.slug-contains.description":"<Field/> <Operator>contains</Operator> <Value>{{value}}</Value>","search.operator.slug-contains.name":"contains","search.operator.slug-equal.description":"<Field/> <Operator>is</Operator> <Value>{{value}}</Value>","search.operator.slug-equal.name":"is","search.operator.slug-not-contains.description":"<Field/> <Operator>does not contain</Operator> <Value>{{value}}</Value>","search.operator.slug-not-contains.name":"does not contain","search.operator.slug-not-equal.description":"<Field/> <Operator>is not</Operator> <Value>{{value}}</Value>","search.operator.slug-not-equal.name":"is not","search.operator.string-contains.description":"<Field/> <Operator>contains</Operator> <Value>{{value}}</Value>","search.operator.string-contains.name":"contains","search.operator.string-equal.description":"<Field/> <Operator>is</Operator> <Value>{{value}}</Value>","search.operator.string-equal.name":"is","search.operator.string-list-equal.description":"<Field/> <Operator>is</Operator> <Value>{{value}}</Value>","search.operator.string-list-equal.name":"is","search.operator.string-list-not-equal.description":"<Field/> <Operator>is not</Operator> <Value>{{value}}</Value>","search.operator.string-list-not-equal.name":"is not","search.operator.string-not-contains.description":"<Field/> <Operator>does not contain</Operator> <Value>{{value}}</Value>","search.operator.string-not-contains.name":"does not contain","search.operator.string-not-equal.description":"<Field/> <Operator>is not</Operator> <Value>{{value}}</Value>","search.operator.string-not-equal.name":"is not","search.ordering.best-match-label":"Best match","search.ordering.created-ascending-label":"Created: Oldest first","search.ordering.created-descending-label":"Created: Newest first","search.ordering.updated-ascending-label":"Updated: Oldest first","search.ordering.updated-descending-label":"Updated: Newest first","search.placeholder":"Search","search.recent-searches-aria-label":"Recent searches","search.recent-searches-label":"Recent searches","search.search-results-aria-label":"Search results","timeline.error.load-document-changes-description":"Document history transactions have not been affected.","timeline.error.load-document-changes-title":"An error occurred whilst retrieving document changes.","timeline.error.no-document-history-description":"When changing the content of the document, the document versions will appear in this menu.","timeline.error.no-document-history-title":"No document history","timeline.error.unable-to-load-revision":"Unable to load revision","timeline.latest":"Latest","timeline.latest-version":"Latest version","timeline.list.aria-label":"Document revisions","timeline.loading-history":"Loading history…","timeline.operation.created":"Created","timeline.operation.created-initial":"Created","timeline.operation.created-initial_timestamp":"Created: {{timestamp, datetime}}","timeline.operation.created_timestamp":"Created: {{timestamp, datetime}}","timeline.operation.deleted":"Deleted","timeline.operation.deleted_timestamp":"Deleted: {{timestamp, datetime}}","timeline.operation.draft-discarded":"Discarded draft","timeline.operation.draft-discarded_timestamp":"Discarded draft: {{timestamp, datetime}}","timeline.operation.edited-draft":"Edited","timeline.operation.edited-draft_timestamp":"Edited: {{timestamp, datetime}}","timeline.operation.edited-live":"Live edited","timeline.operation.edited-live_timestamp":"Live edited: {{timestamp, datetime}}","timeline.operation.published":"Published","timeline.operation.published_timestamp":"Published: {{timestamp, datetime}}","timeline.operation.unpublished":"Unpublished","timeline.operation.unpublished_timestamp":"Unpublished: {{timestamp, datetime}}","timeline.since":"Since: {{timestamp, datetime}}","timeline.since-version-missing":"Since: unknown version","user-menu.action.free-trial-finished":"Upgrade from free","user-menu.action.free-trial_one":"{{count}} day left in trial","user-menu.action.free-trial_other":"{{count}} days left in trial","user-menu.action.invite-members":"Invite members","user-menu.action.invite-members-aria-label":"Invite members","user-menu.action.manage-project":"Manage project","user-menu.action.manage-project-aria-label":"Manage project","user-menu.action.portable-text.annotation-disabled_empty-block":"Cannot apply {{name}} to empty block","user-menu.action.portable-text.annotation-disabled_multiple-blocks":"Cannot apply {{name}} to multiple blocks","user-menu.action.sign-out":"Sign out","user-menu.appearance-title":"Appearance","user-menu.close-menu":"Close menu","user-menu.color-scheme.dar
1k-description":"Use dark appearance","user-menu.color-scheme.dark-title":"Dark","user-menu.color-scheme.light-description":"Use light appearance","user-menu.color-scheme.light-title":"Light","user-menu.color-scheme.system-description":"Use system appearance","user-menu.color-scheme.system-title":"System","user-menu.locale-title":"Language","user-menu.login-provider":"Signed in with {{providerTitle}}","user-menu.open-menu":"Open menu","workspaces.action.add-workspace":"Add workspace","workspaces.action.choose-another-workspace":"Choose another workspace","workspaces.choose-your-workspace-label":"Choose your workspace","workspaces.select-workspace-aria-label":"Select workspace","workspaces.select-workspace-label":"Select workspace","workspaces.select-workspace-tooltip":"Select workspace","workspaces.title":"Workspaces"}},{locale:"en-US",namespace:"validation",resources:{"array.exact-length":"Must have exactly {{wantedLength}} items","array.exact-length_blocks":"Must have exactly {{wantedLength}} blocks","array.item-duplicate":"Can't be a duplicate","array.maximum-length":"Must have at most {{maxLength}} items","array.maximum-length_blocks":"Must have at most {{maxLength}} blocks","array.minimum-length":"Must have at least {{minLength}} items","array.minimum-length_blocks":"Must have at least {{minLength}} blocks","date.invalid-format":"Must be a valid ISO-8601 formatted date string","date.maximum":"Must be at or before {{maxDate}}","date.minimum":"Must be at or after {{minDate}}","generic.incorrect-type":'Expected type "{{expectedType}}", got "{{actualType}}"',"generic.not-allowed":"Value did not match any allowed values","generic.not-allowed_hint":'Value "{{hint}}" did not match any allowed values',"generic.required":"Required","number.greater-than":"Must be greater than {{threshold}}","number.less-than":"Must be less than {{threshold}}","number.maximum":"Must be lower than or equal to {{maxNumber}}","number.maximum-precision":"Max precision is {{limit}}","number.minimum":"Must be greater than or equal to {{minNumber}}","number.non-integer":"Must be an integer","object.asset-required":"Asset is required","object.asset-required_file":"File is required","object.asset-required_image":"Image is required","object.not-reference":"Must be a reference to a document","object.reference-not-published":"Referenced document must be published","panel.close-button-aria-label":"Close validation","panel.no-errors-message":"No validation errors","panel.title":"Validation","slug.missing-current":"Slug must have a value","slug.not-object":"Slug must be an object","slug.not-unique":"Slug is already in use","string.email":"Must be a valid email address","string.exact-length":"Must be exactly {{wantedLength}}
1 characters long","string.lowercase":"Must be all lowercase characters","string.maximum-length":"Must be at most {{maxLength}} characters long","string.minimum-length":"Must be at least {{minLength}} characters long","string.regex-does-not-match":'Does not match "{{name}}"-pattern',"string.regex-match":'Should not match "{{name}}"-pattern',"string.uppercase":"Must be all uppercase characters","string.url.disallowed-scheme":"Does not match allowed protocols/schemes","string.url.includes-credentials":"Username/password not allowed","string.url.invalid":"Not a valid URL","string.url.not-absolute":"Relative URLs are not allowed","string.url.not-relative":"Only relative URLs are allowed"}}],weekInfo:{firstDay:7,weekend:[6,7],minimalDays:1}},p$="undefined"==typeof window||"undefined"==typeof document,pW=[pH],pY=lF()(function(){let e=function(){var e;let n={[pH.id]:{}},r=(null==(e=pH.bundles)?void 0:e.filter(pB))||[],i=new Set;for(let e of r)n[pH.id][e.namespace]=e.resources,i.add(e.namespace);return(0,lD.Fs)({ns:Array.from(i),defaultNS:pV,initImmediate:!0,partialBundledLanguages:!0,fallbackLng:pH.id,lng:pH.id,supportedLngs:[pH.id],debug:!1,load:"currentOnly",resources:n,interpolation:{escapeValue:p$}})}();return e.init(),{currentLocale:pH,locales:pW,loadNamespaces:e.loadNamespaces,t:e.t}}),pX="undefined"==typeof window?void 0:window,pG=(null==pX?void 0:pX.requestIdleCallback)||function(e,n){let r=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,Date.now()-r)})},0)},pJ=(null==pX?void 0:pX.cancelIdleCallback)||function(e){return window.clearTimeout(e)},pQ=lF()(function(e){console.warn(["Slug field at path ".concat(e," is within an array and cannot be automatically checked for uniqueness"),'If you need to check for uniqueness, provide your own "isUnique" method',"To disable this message, set `disableArrayWarning: true` on the slug `options` field"].join("\n"))});function p0(e){return e.reduce((e,n,r)=>{let i="number"==typeof n,a=(0,ll.fU)(n),o=i||a?"[]":"".concat(0===r?"":".").concat(n);return"".concat(e).concat(o)},"")}let p1=(e,n)=>{let{getClient:r,document:i,path:a,type:o}=n,l=null==o?void 0:o.options;if(!i)throw Error("`document` was not provided in validation context.");if(!a)throw Error("`path` was not provided in validation context.");let s=(null==l?void 0:l.disableArrayWarning)||!1,{published:c,draft:d}=function(e){let n=0===e.indexOf("drafts.");return{published:n?e.slice(7):e,draft:n?e:"drafts.".concat(e)}}(i._id),u=i._type,p=p0(a.concat("current"));!s&&p.includes("[]")&&"studio"===n.environment&&pQ(p0(a));let h=["_type == $docType","!(_id in [$draft, $published])","".concat(p," == $slug")].join(" && ");return r({apiVersion:"2023-11-13"}).fetch("!defined(*[".concat(h,"][0]._id)"),{docType:u,draft:d,published:c,slug:e},{tag:"validation.slug-is-unique"})},p2=async(e,n)=>{var r;if(!e)return!0;let{i18n:i}=n;if("object"!=typeof e||Array.isArray(e))return i.t("validation:slug.not-object");if(!(0,ll.hb)(e)||0===e.current.trim().length)return i.t("validation:slug.missing-current");let a=null==(r=null==n?void 0:n.type)?void 0:r.options,o=(null==a?void 0:a.isUnique)||p1,l={...n,parent:n.parent,type:n.type,defaultIsUnique:p1};return!!await o(e.current,l)||i.t("validation:slug.not-unique",{slug:e.current})},p3={array:!0,boolean:!0,date:!0,number:!0,object:!0,string:!0},p4=e=>e in p3;function p5(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set;return!e||n.has(e)?[]:(n.add(e),[...e.type?p5(e.type,n):[],e])}function p8(e,n){let r=e;p4(n.jsonType)&&(r=r.type(n.jsonType));let i=(null==n?void 0:n.options)&&"object"==typeof n.options&&"list"in n.options&&n.options.list;return(Array.isArray(i)&&(r=r.valid(i.map(e=>"object"===n.jsonType&&function e(n){return!!n&&("fields"in n||!n.type?!!("fields"in n&&Array.isArray(n.fields))&&n.fields.some(e=>"value"===e.name):e(n.type))}(n)?e:void 0===e.value?e:e.value))),"datetime"===n.name||"date"===n.name)?r.type("Date"):"url"===n.name?r.uri():"slug"===n.name?r.custom(p2,{bypassConcurrencyLimit:!0}):"reference"===n.name?r.reference():"email"===n.name?r.email():r}function p6(e){if(!e)return[];let n=e.validation;if(Array.isArray(n))return n.flatMap(n=>p6({...e,validation:n}));if(n&&"object"==typeof n)return[n];let r=Object.values(p5(e).reduce((e,n)=>(e[n.name]=n,e),{})).reduce(p8,new pL(e));return n?p6({...e,validation:n(r)}):[r]}class p9{constructor(e){this.max=e,this.current=0,this.resolvers=[],this.ready=()=>this.max===1/0?Promise.resolve():this.current<this.max?(this.current++,Promise.resolve()):new Promise(e=>{this.resolvers.push(e)}),this.release=()=>{if(this.max===1/0)return;let e=this.resolvers.shift();if(e){e();return}this.current=Math.max(0,this.current-1)}}}let p7=e=>n=>{var r;if("object"!=typeof n||!n)return!0;let i=new Set(null==(r=e.fields)?void 0:r.map(e=>e.name));return Object.keys(n).filter(e=>!e.startsWith("_")).filter(e=>!i.has(e)).map(n=>({message:"Field '".concat(n,"' does not exist on type '").concat(e.name,"'"),path:[n]}))};new p9(10);let he=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),ht=e=>null!=e,hn=new WeakMap,hr=e=>"error"===e.severity,hi=[{name:"sanity.assetSourceData",title:"Asset Source Data",type:"object",fields:[{name:"name",title:"Source name",description:"A canonical name for the source this asset is originating from",type:"string"},{name:"id",title:"Asset Source ID",description:"The unique ID for the asset within the originating source so you can programatically find back to it",type:"string"},{name:"url",title:"Asset information URL",description:"A URL to find more information about this asset in the originating source",type:"string"}]},{title:"Slug",name:"slug",type:"object",fields:[{name:"current",title:"Current slug",type:"string"},{name:"source",title:"Source field",type:"string",hidden:!0}]},{title:"Geographical Point",name:"geopoint",type:"object",fields:[{name:"lat",type:"number",title:"Latitude"},{name:"lng",type:"number",title:"Longitude"},{name:"alt",type:"number",title:"Altitude"}]},{name:"sanity.imageAsset",title:"Image",type:"document",fieldsets:[{name:"system",title:"System fields",description:"These fields are managed by the system and not editable"}],fields:[{name:"originalFilename",type:"string",title:"Original file name",readOnly:!0},{name:"label",type:"string",title:"Label"},{name:"title",type:"string",title:"Title"},{name:"description",type:"string",title:"Description"},{name:"altText",type:"string",title:"Alternative text"},{name:"sha1hash",type:"string",title:"SHA1 hash",readOnly:!0,fieldset:"system"},{name:"extension",type:"string",readOnly:!0,title:"File extension",fieldset:"system"},{name:"mimeType",type:"string",readOnly:!0,title:"Mime type",fieldset:"system"},{name:"size",type:"number",title:"File size in bytes",readOnly:!0,fieldset:"system"},{name:"assetId",type:"string",title:"Asset ID",readOnly:!0,fieldset:"system"},{name:"uploadId",type:"string",readOnly:!0,hidden:!0,fieldset:"system"},{name:"path",type:"string",title:"Path",readOnly:!0,fieldset:"system"},{name:"url",type:"string",title:"Url",readOnly:!0,fieldset:"system"},{name:"metadata",type:"sanity.imageMetadata",title:"Metadata"},{name:"source",type:"sanity.assetSourceData",title:"Source",readOnly:!0,fieldset:"system"}],preview:{select:{id:"_id",title:"originalFilename",mimeType:"mimeType",size:"size"},prepare:e=>({title:e.title||"string"==typeof e.path&&e.path.split("/").slice(-1)[0],media:{asset:{_ref:e.id}},subtitle:"".concat(e.mimeType," (").concat((Number(e.size)/1024/1024).toFixed(2)," MB)")})},orderings:[{title:"File size",name:"fileSizeDesc",by:[{field:"size",direction:"desc"}]}]},{name:"sanity.fileAsset",title:"File",type:"document",fieldsets:[{name:"system",title:"System fields",description:"These fields are managed by the system and not editable"}],fields:[{name:"originalFilename",type:"string",title:"Original file name",readOnly:!0},{name:"label",type:"string",title:"Label"},{name:"title",type:"string",title:"Title"},{name:"description",type:"string",title:"Description"},{name:"altText",type:"string",title:"Alternative text"},{name:"sha1hash",type:"string",title:"SHA1 hash",readOnly:!0,fieldset:"system"},{name:"extension",type:"string",title:"File extension",readOnly:!0,fieldset:"system"},{name:"mimeType",type:"string",title:"Mime type",readOnly:!0,fieldset:"system"},{name:"size",type:"number",title:"File size in bytes",readOnly:!0,fieldset:"system"},{name:"assetId",type:"string",title:"Asset ID",readOnly:!0,fieldset:"system"},{name:"uploadId",type:"string",readOnly:!0,hidden:!0,fieldset:"system"},{name:"path",type:"string",title:"Path",readOnly:!0,fieldset:"system"},{name:"url",type:"string",title:"Url",readOnly:!0,fieldset:"system"},{name:"source",type:"sanity.assetSourceData",title:"Source",readOnly:!0,fieldset:"system"}],preview:{select:{title:"originalFilename",path:"path",mimeType:"mimeType",size:"size"},prepare:e=>({title:e.title||e.path.split("/").slice(-1)[0],subtitle:"".concat(e.mimeType," (").concat((e.size/1024/1024).toFixed(2)," MB)")})},orderings:[{title:"File size",name:"fileSizeDesc",by:[{field:"size",direction:"desc"}]}]},{name:"sanity.imageCrop",title:"Image crop",type:"object",fields:[{name:"top",type:"number"},{name:"bottom",type:"number"},{name:"left",type:"number"},{name:"right",type:"number"}]},{name:"sanity.imageHotspot",title:"Image hotspot",type:"object",fields:[{name:"x",type:"number"},{name:"y",type:"number"},{name:"height",type:"number"},{name:"width",type:"number"}]},{name:"sanity.imageMetadata",title:"Image metadata",type:"object",fieldsets:[{name:"extra",title:"Extra metadata…",options:{collapsable:!0}}],fields:[{name:"location",type:"geopoint"},{name:"dimensions",title:"Dimensions",type:"sanity.imageDimensions",fieldset:"extra"},{name:"palette",type:"sanity.imagePalette",title:"Palette",fieldset:"extra"},{name:"lqip",title:"LQIP (Low-Quality Image Placeholder)",type:"string",readOnly:!0}
1,{name:"blurHash",title:"BlurHash",type:"string",readOnly:!0},{name:"hasAlpha",title:"Has alpha channel",type:"boolean",readOnly:!0},{name:"isOpaque",title:"Is opaque",type:"boolean",readOnly:!0}]},{name:"sanity.imageDimensions",type:"object",title:"Image dimensions",fields:[{name:"height",type:"number",title:"Height",readOnly:!0},{name:"width",type:"number",title:"Width",readOnly:!0},{name:"aspectRatio",type:"number",title:"Aspect ratio",readOnly:!0}]},{name:"sanity.imagePalette",title:"Image palette",type:"object",fields:[{name:"darkMuted",type:"sanity.imagePaletteSwatch",title:"Dark Muted"},{name:"lightVibrant",type:"sanity.imagePaletteSwatch",title:"Light Vibrant"},{name:"darkVibrant",type:"sanity.imagePaletteSwatch",title:"Dark Vibrant"},{name:"vibrant",type:"sanity.imagePaletteSwatch",title:"Vibrant"},{name:"dominant",type:"sanity.imagePaletteSwatch",title:"Dominant"},{name:"lightMuted",type:"sanity.imagePaletteSwatch",title:"Light Muted"},{name:"muted",type:"sanity.imagePaletteSwatch",title:"Muted"}]},{name:"sanity.imagePaletteSwatch",title:"Image palette swatch",type:"object",fields:[{name:"background",type:"string",title:"Background",readOnly:!0},{name:"foreground",type:"string",title:"Foreground",readOnly:!0},{name:"population",type:"number",title:"Population",readOnly:!0},{name:"title",type:"string",title:"String",readOnly:!0}]}];function ha(e){return"string"==typeof e.title?e.title:e.type?ha(e.type):e.name||e.jsonType}let ho=(0,oN.createContext)(null);function hl(e){let{children:n}=e,r=(0,oN.useMemo)(()=>{let e=new Map,n={};return{get:r=>{let{namespace:i,dependencies:a}=r,o=a.map(e=>null===e?n:e),l=e.get(i);return null==l?void 0:l.get(o)},set:r=>{let{namespace:i,dependencies:a,value:o}=r,l=e.get(i)||function(){let e=new WeakMap,n=new WeakMap;function r(e){return Array.from(new Set(e)).map(e=>[function(e){let r=n.get(e);if(r)return r;let i=Array.from({length:10}).map(()=>Math.floor(255*Math.random()).toString(16).padStart(2,"0")).join("");return n.set(e,i),i}(e),e]).sort((e,n)=>{let[r]=e,[i]=n;return r.localeCompare(i,"en")}).map(e=>{let[,n]=e;return n})}return{get:function(n){return function e(n,r){if(!n.length)return;let[i,...a]=n,o=r.get(i);if(o)return a.length?e(a,o.next):o.value}(r(n),e)},set:function(n,i){!function e(n,r,i){if(!n.length)return;let[a,...o]=n,l=r.get(a)||{type:"multi-key-weak-map-node",value:void 0,next:new WeakMap};if(r.set(a,l),!o.length){l.value=i;return}e(o,l.next,i)}(r(n),e,i)}}}(),s=a.map(e=>null===e?n:e);e.set(i,l),l.set(s,o)}}},[]);return(0,oZ.jsx)(ho.Provider,{value:r,children:n})}function hs(){let e=(0,oN.useContext)(ho);if(!e)throw Error("Could not find `cache` context");return e}
1class hc extends Error{constructor(e){let{projectId:n}=e;super("CorsOriginError"),this.projectId=n}}let hd=(()=>{let e="__tmp_supports_local_storage";try{if("undefined"==typeof localStorage)return!1;return localStorage.setItem(e,"---"),localStorage.removeItem(e),!0}catch(e){return!1}})(),hu={};function hp(e,n){hd?localStorage[e]=n:hu[e]=n}function hh(e){hd?localStorage.removeItem(e):delete hu[e]}let hf=/sid=([^&]{20,})&?/,hm=function(){if("undefined"==typeof window||"object"!=typeof window.location)return null;let e=window.location.hash,[,n]=e.match(hf)||[];if(!n)return null;let r=e.replace(hf,""),i=new URL(window.location.href);return i.hash=r.length>1?r:"",history.replaceState(null,"",i),n}(),hg=()=>{let e=hm;return e&&(hm=null),e};var hx=Object.freeze,hv=Object.defineProperty,hy=(e,n)=>hx(hv(e,"raw",{value:hx(n||e.slice())}));let hb=oV.ZP.svg(e=>{let{theme:n}=e,{fg:r}=n.sanity.color.base;return(0,oV.iv)(e6||(e6=hy(["\n    fill: ",";\n  "])),r)}),hj=oV.ZP.img(e9||(e9=hy(["\n  height: 19px;\n  width: 19px;\n  object-fit: contain;\n"])));function hw(e){let{provider:n}=e;return n.logo?(0,oZ.jsx)(hj,{src:n.logo,alt:"Logo for ".concat(n.name)}):void 0}let hk={google:()=>(0,oZ.jsxs)("svg",{width:"1em",height:"1em",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",children:[(0,oZ.jsx)("path",{d:"M11 24a13 13 0 0 1 .66-4.08l-7.4-5.66a22.18 22.18 0 0 0 0 19.49l7.4-5.67A13 13 0 0 1 11 24z",fill:"#fbbc05"}),(0,oZ.jsx)("path",{d:"M24 11a12.72 12.72 0 0 1 8.1 2.9l6.4-6.4a22 22 0 0 0-34.24 6.75l7.4 5.66A13 13 0 0 1 24 11z",fill:"#ea4335"}),(0,oZ.jsx)("path",{d:"M24 37a13 13 0 0 1-12.34-8.92l-7.4 5.66A21.93 21.93 0 0 0 24 46a21 21 0 0 0 14.33-5.48l-7-5.44A13.59 13.59 0 0 1 24 37zm-12.35-8.93l-7.4 5.67 7.4-5.66z",fill:"#34a853"}),(0,oZ.jsx)("path",{d:"M44.5 20H24v8.5h11.8a9.91 9.91 0 0 1-4.49 6.58l7 5.44C42.37 36.76 45 31.17 45 24a18.25 18.25 0 0 0-.5-4z",fill:"#4285f4"})]}),github:()=>(0,oZ.jsx)(hb,{width:"1em",height:"1em",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 438.55 438.55",children:(0,oZ.jsx)("path",{d:"M409.13 114.57a218.32 218.32 0 0 0-79.8-79.8Q278.94 5.36 219.27 5.36T109.21 34.77a218.29 218.29 0 0 0-79.8 79.8Q0 165 0 224.63q0 71.67 41.83 128.91t108.06 79.23q7.71 1.43 11.42-2a11.17 11.17 0 0 0 3.69-8.57q0-.86-.14-15.42t-.14-25.41l-6.57 1.14a83.77 83.77 0 0 1-15.85 1 120.73 120.73 0 0 1-19.84-2 44.34 44.34 0 0 1-19.11-8.51 36.23 36.23 0 0 1-12.56-17.6l-2.86-6.57a71.34 71.34 0 0 0-9-14.56q-6.14-8-12.42-10.85l-2-1.43a21 21 0 0 1-3.71-3.43 15.66 15.66 0 0 1-2.57-4q-.86-2 1.43-3.29C61.2 310.42 64 310 68 310l5.71.85q5.71 1.14 14.13 6.85a46.08 46.08 0 0 1 13.85 14.84q6.57 11.71 15.85 17.85t18.7 6.14a81.19 81.19 0 0 0 16.27-1.42 56.78 56.78 0 0 0 12.85-4.29q2.57-19.14 14-29.41a195.49 195.49 0 0 1-29.36-5.13 116.52 116.52 0 0 1-26.83-11.14 76.86 76.86 0 0 1-23-19.13q-9.14-11.42-15-30t-5.8-42.81q0-34.55 22.56-58.82-10.57-26 2-58.24 8.28-2.57 24.55 3.85t23.84 11q7.57 4.56 12.13 7.71a206.2 206.2 0 0 1 109.64 0l10.85-6.85a153.65 153.65 0 0 1 26.26-12.56q15.13-5.71 23.13-3.14 12.84 32.26 2.28 58.24 22.55 24.27 22.56 58.82 0 24.27-5.85 43t-15.12 30a79.82 79.82 0 0 1-23.13 19 116.74 116.74 0 0 1-26.84 11.14 195.29 195.29 0 0 1-29.23 5.07q14.8 12.84 14.81 40.58v60.2a11.37 11.37 0 0 0 3.57 8.56q3.57 3.42 11.28 2 66.24-22 108.07-79.23t41.83-128.91q-.03-59.62-29.43-110.05z"})})};async function hC(e){let{client:n,mode:r,providers:i=[]}=e;if("replace"===r&&Array.isArray(i))return i;let{providers:a}=await n.request({uri:"/auth/providers"});return"function"==typeof i?i(a):0===i.length?a:"replace"===r?i:a.filter(e=>i.some(n=>n.url!==e.url)).concat(i)}function h_(e){let{loginMethod:n="dual",projectId:r,url:i,basePath:a}=e,o=new URLSearchParams;return o.set("origin","".concat(window.location.origin).concat(a)),o.set("projectId",r),"token"===n?o.set("withSid","true"):o.set("type",n),"".concat(i,"?").concat(o)}let hT=e=>{if(!e)throw Error("Invalid project id");return"__studio_auth_token_".concat(e)},hS=e=>{try{var n;let r=(n=hT(e),hd?localStorage[n]:hu[n]);if(r){let{token:e}=JSON.parse(r);if(e&&"string"==typeof e)return e}}catch(e){console.error(e)}return null},hE=e=>{try{hh(hT(e))}catch(e){console.error(e)}},hP=e=>{let{token:n,projectId:r}=e;try{hp(hT(r),JSON.stringify({token:n,time:new Date().toISOString()}))}catch(e){console.error(e)}},hO=async(e,n)=>{var r;try{let n=await e.request({uri:"/users/me",withCredentials:!0,tag:"users.get-current"});return"string"==typeof(null==n?void 0:n.id)?n:null}catch(i){if(401===i.statusCode)return hE(e.config().projectId||""),n(null),null;if(await e.request({uri:"/ping",withCredentials:!1,tag:"cors-check"}).then(()=>!0,()=>!1))throw new hc({projectId:null==(r=e.config())?void 0:r.projectId});if(i.isNetworkError&&!i.message&&i.request&&i.request.url){let e=new URL(i.request.url).host;throw Error("Unknown network error attempting to reach ".concat(e))}throw i}},hA=lF()(function(e){let{clientFactory:n,projectId:r,dataset:i,apiHost:a,loginMethod:o="dual",...l}=e,{broadcast:s,messages:c}=function(e){let n="undefined"==typeof window?(0,og.of)():(0,ok.R)(window,"storage"),r="__studio_local_storage_messaging_".concat(e),i=new oC.x;return{messages:(0,ow.T)(i,n.pipe((0,a2.h)(e=>e.key===r),(0,aW.U)(e=>e.newValue),(0,a2.h)(dd),(0,aW.U)(e=>JSON.parse(e)))).pipe((0,aJ.d)(1)),broadcast:function(e){try{hp(r,JSON.stringify(e)),hh(r),i.next(e)}catch(e){}}}}("dual_mode_auth_".concat(r)),d=null!=n?n:lb.eI,u=c.pipe((0,a3.O)(["dual","token"].includes(o)?hS(r):null)),p={};a?p.apiHost=a:"undefined"!=typeof __SANITY_STAGING__&&!0===__SANITY_STAGING__&&(p.apiHost="https://api.sanity.work");let h=u.pipe((0,aW.U)(e=>d({projectId:r,dataset:i,apiVersion:"2021-06-07",useCdn:!1,...e&&{token:e},withCredentials:!0,requestTagPrefix:"sanity.studio",ignoreBrowserTokenWarning:!0,allowReconfigure:!1,...p})),(0,a$.w)(e=>(0,oj.P)(async()=>{let n=await hO(e,s);return{currentUser:n,client:e,authenticated:!!n}})),(0,aX.x)((e,n)=>o7()(e.currentUser,n.currentUser)),(0,aJ.d)(1));async function f(){let e;let n=hg();if(!n){s("cookie"===o?null:hS(r));return}let a=d({projectId:r,dataset:i,useCdn:!0,withCredentials:!0,apiVersion:"2021-06-07",requestTagPrefix:"sanity.studio",...p});if(("dual"===o||"cookie"===o)&&(e=await hO(a,s)),e||"cookie"===o){s(null);return}let l=await m(a,n);s(null!=l?l:null)}async function m(e,n){let{token:i}=await e.request({method:"GET",uri:"/auth/fetch",query:{sid:n},tag:"auth.fetch-token"});return hP({token:i,projectId:r}),i}async function g(){var e;let n=d({projectId:r,dataset:i,useCdn:!0,withCredentials:!0,token:null!=(e=hS(r))?e:void 0,apiVersion:"2021-06-07",requestTagPrefix:"sanity.studio",...p});hE(r),await n.request({uri:"/auth/logout",method:"POST"}),s(null)}let x=function(e){let{getClient:n,loginMethod:r,redirectOnSingle:i,...a}=e,o=dc(n);return function(e){let{projectId:n,basePath:l}=e,[s,c]=(0,oN.useState)(null),[d,u]=(0,oN.useState)(null);if(d)throw d;let[p]=o();(0,oN.useEffect)(()=>{p&&hC({client:p,...a}).then(c).catch(u)},[p]);let h=i&&(null==s?void 0:s.length)===1&&(null==s?void 0:s[0])&&h_({loginMethod:r,projectId:n,url:s[0].url,basePath:l}),f=!s||h;return((0,oN.useEffect)(()=>{h&&(window.location.href=h)},[h]),f)?(0,oZ.jsx)(u4,{showText:!0}):(0,oZ.jsxs)(oK.Kq,{space:4,children:[(0,oZ.jsx)(oK.X6,{align:"center",size:1,children:"Choose login provider"}),(0,oZ.jsx)(oK.Kq,{space:2,children:s.map((e,i)=>(0,oZ.jsx)(lr.zx,{as:"a",icon:hk[e.name]||(0,oZ.jsx)(hw,{provider:e}),href:h_({loginMethod:r,projectId:n,url:e.url,basePath:l}),mode:"ghost",size:"large",text:e.title},"".concat(e.url,"_").concat(i)))})]})}}({...l,getClient:()=>h.pipe((0,aW.U)(e=>e.client)),loginMethod:o});return{handleCallbackUrl:f,token:u,state:h,LoginComponent:x,logout:g}},function e(n){return"object"!=typeof n||null===n?"".concat(n):JSON.stringify(Object.fromEntries(Object.entries(n).sort((e,n)=>{let[r]=e,[i]=n;return r.localeCompare(i,"en")}).map(n=>{let[r,i]=n;return[r,e(i)]})))});function hI(e){return"google"===e?"Google":"github"===e?"GitHub":"sanity"===e?"Sanity":(null==e?void 0:e.startsWith("saml-"))?"SAML/SSO":void 0}let hz="undefined"==typeof window?(0,og.of)({}):(0,ok.R)(window,"online"),hM="undefined"==typeof window?(0,og.of)({}):(0,ok.R)(window,"offline"),hR=e=>100*Math.pow(2,e),hF={type:"connecting"},hD=(0,lq.E)(),hq=hD[0];hD[1];let hZ=e=>{let{error:n,isOffline:r,attemptNo:i,retryAt:a}=e;return{type:"error",error:n,attemptNo:i,isOffline:r,retryAt:a}};function hN(e){let n=RA();return e?n.getClient(e):(console.warn('Calling `useClient()` without specifying an API version is deprecated and will stop working in the next dev-preview release - please migrate to use `useClient({apiVersion: "2021-06-07"})`.'),n.getClient({apiVersion:"2021-06-07"}))}let hL=dc(e=>{let[n,r]=e;return(0,ob.D)(n.getUser(r).catch(e=>(console.error(e),null)))});function hV(e){let n=z3();return hL((0,oN.useMemo)(()=>[n,e],[e,n]))}function hK(){let{currentUser:e}=RA();return e}function hB(){return RA().dataset}function hU(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=uk().id;return uy.dateTimeFormat(n,e)}function hH(e,n){let r=z6();return(0,oR.m2)(()=>r.pair.editOperations(e,n),[n,r.pair,e])}let h$={apiVersion:"2023-11-13"},hW={isLoading:!0,enabled:!0,features:[]};function hY(e){let n=hN(h$);
1return i||(i=(function(e){let{versionedClient:n}=e;return n.observable.request({uri:"/features",tag:"features"})})({versionedClient:n}).pipe((0,aJ.d)(),(0,aG.K)(e=>(console.error(e),(0,og.of)([]))))),(0,oR.m2)(()=>i.pipe((0,aW.U)(function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{isLoading:!1,enabled:!!(null==n?void 0:n.includes(e)),features:n}}),(0,a3.O)(hW),(0,aG.K)(e=>(console.error(e),(0,og.of)({isLoading:!1,enabled:!0,features:[]})))),[e],hW)}function hX(){return RA().projectId}let hG={month:"short",day:"numeric"},hJ={...hG,year:"numeric"},hQ={...hJ,hour:"numeric",minute:"numeric"};function h0(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{t:r}=dV(),i=uk().id,{timeZone:a,minimal:o}=n,l=e instanceof Date?e:new Date(e),s=!!n.useTemporalPhrase,c=(0,oN.useCallback)(function(e,n){let r="day"===n&&1===Math.abs(e),a="week"===n&&1===Math.abs(e);return s||r?uy.relativeTimeFormat(i,{style:o&&!a?"short":"long",numeric:"auto"}).format(e,n):uy.numberFormat(i,{style:"unit",unit:n,unitDisplay:o?"short":"long"}).format(Math.abs(e))},[i,s,o]);if(!l.getTime())return{timestamp:"",refreshInterval:null};let d=n.relativeTo||Date.now(),u=(0,lK.Z)(d,l),p=(0,lB.Z)(d,l);if(u||p)return n.minimal&&0===p?{timestamp:uy.dateTimeFormat(i,{...hG,timeZone:a}).format(l),refreshInterval:null}:n.minimal?{timestamp:uy.dateTimeFormat(i,{...hJ,timeZone:a}).format(l),refreshInterval:null}:{timestamp:uy.dateTimeFormat(i,{...hQ,timeZone:a}).format(l),refreshInterval:null};let h=(0,lU.Z)(l,d);if(h)return{timestamp:c(h,"week"),refreshInterval:36e5};let f=(0,lH.Z)(l,d);if(f)return{timestamp:c(f,"day"),refreshInterval:36e5};let m=(0,l$.Z)(l,d);if(m)return{timestamp:c(m,"hour"),refreshInterval:6e4};let g=(0,lW.Z)(l,d);if(g)return{timestamp:c(g,"minute"),refreshInterval:2e4};let x=(0,lY.Z)(l,d);return Math.abs(x)>10?{timestamp:c(x,"second"),refreshInterval:5e3}:{timestamp:r("relative-time.just-now"),refreshInterval:5e3}}(e,n),[,i]=(0,oN.useReducer)(e=>e+1,0);return(0,oN.useEffect)(()=>{let e;return null!==r.refreshInterval&&function n(r){e=window.setTimeout(()=>{i(),e=window.setTimeout(()=>n(r),r)},r)}(r.refreshInterval),()=>{null!==e&&clearTimeout(e)}},[i,r.refreshInterval]),r.timestamp}function h1(){return RA().schema}function h2(){return RA().templates}function h3(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=uk().id,r={unitDisplay:"long",...e,style:"unit"};return function(e,i){return uy.numberFormat(n,{...r,unit:i}).format(e)}}let h4={block:function(e){let{actions:n,title:r,subtitle:i,description:a,mediaDimensions:o=KU,media:l,status:s,children:c}=e;return(0,oZ.jsxs)(oK.Kq,{"data-testid":"block-preview",space:1,children:[(0,oZ.jsxs)(KH,{"data-testid":"block-preview__header",children:[l&&(0,oZ.jsx)(VG,{dimensions:o,layout:"block",media:l}),(0,oZ.jsxs)(oK.xu,{flex:1,paddingLeft:l?2:1,children:[(0,oZ.jsx)(oK.xv,{size:1,textOverflow:"ellipsis",weight:"medium",children:r?VH(r,"block"):"Untitled"}),i&&(0,oZ.jsx)(oK.xu,{marginTop:2,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,textOverflow:"ellipsis",children:VH(i,"block")})}),a&&(0,oZ.jsx)(oK.xu,{marginTop:3,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,textOverflow:"ellipsis",children:VH(a,"block")})})]}),(0,oZ.jsxs)(oK.kC,{gap:1,paddingLeft:1,children:[s&&(0,oZ.jsx)(oK.xu,{paddingX:2,paddingY:3,children:VH(s,"block")}),n]})]}),c&&(0,oZ.jsx)("div",{"data-testid":"block-preview__children",children:c})]})},blockImage:function(e){let{actions:n,title:r,subtitle:i,description:a,fallbackTitle:o="Untitled",mediaDimensions:l=KL,media:s,children:c,status:d}=e;return(0,oZ.jsxs)(KN,{children:[(0,oZ.jsxs)(oK.Kq,{children:[(0,oZ.jsxs)(Kq,{paddingBottom:3,paddingLeft:2,paddingRight:1,paddingTop:1,children:[(0,oZ.jsxs)(oK.Kq,{flex:1,space:2,children:[(r||o)&&(0,oZ.jsx)(oK.xv,{size:1,textOverflow:"ellipsis",weight:"medium",children:r?VH(r,"block"):o}),i&&(0,oZ.jsx)(oK.xv,{muted:!0,size:1,textOverflow:"ellipsis",children:VH(i,"block")})]}),(0,oZ.jsxs)(oK.kC,{gap:1,paddingLeft:1,children:[d&&(0,oZ.jsx)(oK.xu,{paddingX:2,paddingY:3,children:VH(d,"block")}),n]})]}),(0,oZ.jsx)(KZ,{$ratio:KV(l),__unstable_checkered:!0,display:"flex",sizing:"border",radiu
1s:2,tone:"inherit",children:(0,oZ.jsx)(VG,{border:!1,dimensions:l,layout:"blockImage",media:s,radius:0,responsive:!0})})]}),a&&(0,oZ.jsx)(oK.xu,{paddingX:2,paddingY:3,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:VH(a,"block")})}),c&&(0,oZ.jsx)("div",{children:c})]})},compact:function(e){let{children:n,isPlaceholder:r,media:i,status:a,title:o}=e,{t:l}=dV(),s=a&&(0,oZ.jsx)(oK.xu,{"data-testid":"compact-preview__status",paddingLeft:4,paddingRight:1,children:VH(a,"compact")});return r?(0,oZ.jsx)(V2,{align:"center","data-testid":"default-preview",paddingLeft:i?1:2,paddingRight:2,paddingY:1,children:(0,oZ.jsxs)(oK.kC,{align:"center",flex:1,gap:2,children:[i&&(0,oZ.jsx)(oK.Od,{animated:!0,radius:2,style:VU.compact.media}),(0,oZ.jsx)(oK.Kq,{"data-testid":"compact-preview__heading",flex:1,space:2,children:(0,oZ.jsx)(V3,{})}),s]})}):(0,oZ.jsxs)(V2,{align:"center","data-testid":"compact-preview",paddingLeft:i?1:2,paddingRight:2,paddingY:1,children:[(0,oZ.jsxs)(oK.kC,{align:"center",flex:1,gap:2,children:[i&&(0,oZ.jsx)(VG,{border:!1,dimensions:V1,layout:"compact",media:i}),(0,oZ.jsx)(oK.Kq,{"data-testid":"compact-preview__header",flex:1,space:2,children:(0,oZ.jsxs)(oK.xv,{size:1,style:{color:"inherit"},textOverflow:"ellipsis",weight:"medium",children:[o&&VH(o,"compact"),!o&&(0,oZ.jsx)("span",{style:{color:"var(--card-muted-fg-color)"},children:l("preview.default.title-fallback")})]})}),s]}),n&&(0,oZ.jsx)(oK.xu,{marginLeft:1,children:n})]})},default:Kt,detail:function(e){let{title:n,subtitle:r,description:i,mediaDimensions:a=Kp,media:o,status:l,children:s,isPlaceholder:c}=e,{t:d}=dV(),u=l&&(0,oZ.jsx)(Ko,{marginLeft:3,paddingRight:1,children:VH(l,"detail")});return c?(0,oZ.jsx)(Ka,{"data-testid":"detail-preview",paddingLeft:o?2:3,paddingRight:2,paddingY:2,children:(0,oZ.jsxs)(oK.kC,{align:"center",flex:1,gap:3,children:[o&&(0,oZ.jsx)(Kl,{"data-testid":"detail-preview__media"}),(0,oZ.jsx)(oK.kC,{align:"center","data-testid":"detail-preview__header",flex:1,children:(0,oZ.jsxs)(oK.Kq,{flex:1,space:2,children:[(0,oZ.jsx)(Ks,{}),(0,oZ.jsx)(Kc,{}),i&&(0,oZ.jsx)(oK.xu,{marginTop:1,children:(0,oZ.jsx)(Kd,{})})]})}),u]})}):(0,oZ.jsx)(Ka,{"data-testid":"detail-preview",paddingLeft:o?2:3,paddingRight:2,paddingY:2,children:(0,oZ.jsxs)(oK.kC,{align:"center",flex:1,gap:3,children:[o&&(0,oZ.jsx)(VG,{dimensions:a,layout:"detail",media:o}),(0,oZ.jsxs)(oK.kC,{align:"center","data-testid":"detail-preview__header",flex:1,children:[(0,oZ.jsxs)(oK.Kq,{flex:1,space:2,children:[(0,oZ.jsxs)(oK.xv,{textOverflow:"ellipsis",size:1,style:{color:"inherit"},weight:"medium",children:[n&&VH(n,"detail"),!n&&(0,oZ.jsx)(oZ.Fragment,{children:d("preview.default.title-fallback")})]}),r&&(0,oZ.jsx)(oK.xv,{muted:!0,size:1,textOverflow:"ellipsis",children:VH(r,"detail")}),i&&(0,oZ.jsx)(oK.xu,{marginTop:1,children:(0,oZ.jsx)(Ku,{muted:!0,size:1,children:VH(i,"detail")})})]}),u]}),s]})})},inline:function(e){let{title:n,fallbackTitle:r="Untitled",media:i,mediaDimensions:a=KQ}=e;return(0,oZ.jsxs)(KX,{"data-testid":"inline-preview",children:[i&&(0,oZ.jsxs)(KG,{"data-testid":"inline-preview-media",children:[(0,lw.isValidElementType)(i)?(0,oN.createElement)(i,{layout:"inline",dimensions:a}):"string"==typeof i?(0,oZ.jsx)("div",{children:i}):i,(0,oZ.jsx)("span",{})]}),(0,oZ.jsx)(KJ,{"data-testid":"inline-preview-title",size:1,children:VH(n,"inline",r)})]})},media:function(e){let{media:n,mediaDimensions:r=KM,children:i,isPlaceholder:a,progress:o=-1,subtitle:l,title:s,withBorder:c=!0,withRadius:d=!0}=e,u=r.aspect||1,p=(0,oN.useMemo)(()=>({paddingBottom:"".concat(100/u,"%")}),[u]),h=(0,oN.useMemo)(()=>s&&l?(0,oZ.jsxs)(Kz,{children:[s&&(0,oZ.jsx)(oK.xv,{align:"center",size:1,weight:"medium",children:VH(s,"media")}),l&&(0,oZ.jsx)(oK.xv,{align:"center",muted:!0,size:1,children:VH(l,"media")})]}):null,[l,s]);return(0,oZ.jsx)(oK.xu,{padding:2,children:(0,oZ.jsxs)(KP,{"data-testid":"media-preview",flex:1,overflow:"hidden",children:[(0,oZ.jsx)("div",{style:p}),(0,oZ.jsx)(lr.u,{content:h,disabled:!h,placement:"top",portal:!0,children:(0,oZ.jsxs)(KO,{children:[a?(0,oZ.jsx)(KA,{}):(0,oZ.jsx)(VG,{border:c,dimensions:r,layout:"media",media:n,radius:d?1:0,responsive:!0}),"number"==typeof o&&o>-1&&(0,oZ.jsx)(KI,{children:(0,oZ.jsx)(Ky,{value:o})})]})}),i]})})}};function h5(){return(0,oZ.jsx)(lp.$lS,{className:"sanity-studio__preview-fallback-icon"})}function h8(e){let{icon:n,layout:r,media:i,imageUrl:a,title:o,tooltip:l,...s}=e,c=hN(h$),d=(0,oN.useMemo)(()=>sh()(c),[c]),u=(0,oN.useCallback)(e=>{let{dimensions:n}=e;
1return(0,oZ.jsx)("img",{alt:dw(o)?o:void 0,referrerPolicy:"strict-origin-when-cross-origin",src:d.image(i).width(n.width||100).height(n.height||100).fit(n.fit).dpr(n.dpr||1).url()||""})},[d,i,o]),p=(0,oN.useCallback)(()=>(0,oN.createElement)(n||h5),[n]),h=(0,oN.useMemo)(()=>!1!==n&&((0,lw.isValidElementType)(i)||(0,oN.isValidElement)(i)?i:(0,sf.JZ)(i)?u:dw(a)?(0,oZ.jsx)("img",{src:a,alt:dw(o)?o:void 0,referrerPolicy:"strict-origin-when-cross-origin"}):p),[n,a,i,p,u,o]),f=(0,oN.useMemo)(()=>({...s,media:h,title:o}),[h,s,o]),m=h4[r||"default"],g=(0,oN.createElement)(m,f);return l?(0,oZ.jsx)(lr.u,{content:l,disabled:!l,fallbackPlacements:["top-end"],placement:"bottom-end",children:(0,oZ.jsx)("div",{children:g})}):g}let h6="undefined"==typeof window?ov.E:(0,ok.R)(window,"resize").pipe((0,aJ.d)(1)),h9="undefined"==typeof window?ov.E:(0,ok.R)(window,"scroll",{passive:!0,capture:!0}).pipe((0,aJ.d)(1)),h7="undefined"==typeof window?ov.E:(0,ok.R)(window,"orientationchange").pipe((0,aJ.d)(1)),fe="undefined"!=typeof window&&"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in IntersectionObserverEntry.prototype&&("isIntersecting"in IntersectionObserverEntry.prototype||Object.defineProperty(IntersectionObserverEntry.prototype,"isIntersecting",{get(){return this.intersectionRatio>0}}),1)?function(){let e=new oC.x,n=new IntersectionObserver(n=>{n.forEach(n=>{e.next(n)})},{threshold:0,rootMargin:"".concat(150,"px")});return function(r){return new oy.y(e=>(n.observe(r),e.next(),()=>n.unobserve(r))).pipe((0,aQ.z)(()=>e.asObservable()),(0,a2.h)(e=>e.target===r),(0,aW.U)(e=>({isIntersecting:e.isIntersecting})))}}():function(e){let n=()=>{var n,r;return n=e.getBoundingClientRect(),r={left:0,right:window.innerWidth,top:0,bottom:window.innerHeight},n.left<=r.right+150&&n.right>=r.left-150&&n.top<=r.bottom+150&&n.bottom>=r.top-150};return(0,ow.T)((0,og.of)(n()),h6,h9,h7).pipe((0,aW.U)(n),(0,aW.U)(e=>({isIntersecting:e})))},ft="undefined"==typeof window?ov.E:(0,ok.R)(document,"visibilitychange").pipe((0,aJ.d)(1)),fn={isLoading:!0},fr={isLoading:!1};function fi(e){let{enabled:n=!0,ordering:r,schemaType:i,value:a}=e||{},{observeForPreview:o}=z8();return(0,oR.m2)(()=>n&&a&&i?o(a,i,{ordering:r}).pipe((0,aW.U)(e=>({isLoading:!1,value:e.snapshot||void 0})),(0,aG.K)(e=>(0,og.of)({isLoading:!1,error:e}))):(0,og.of)(fr),[n,o,r,i,a],fn)}function fa(e){return dw(e)?e:void 0}function fo(e){let{layout:n,value:r,component:i,style:a,schemaType:o,skipVisibilityCheck:l,...s}=e,{t:c}=dV(),[d,u]=(0,oN.useState)(null),p=function(e){let{element:n,hideDelay:r=0}=e,[i,a]=(0,oN.useState)(!1);return(0,oN.useEffect)(()=>{if(!n)return;let e=(0,ox.z)((0,og.of)(!document.hidden),ft.pipe((0,aW.U)(e=>{var n;return e.target instanceof Document&&!(null==(n=null==e?void 0:e.target)?void 0:n.hidden)}))).pipe((0,aX.x)()),i=fe(n).pipe((0,aW.U)(e=>e.isIntersecting)),o=e.pipe((0,a$.w)(e=>e?i:(0,og.of)(!1)),(0,a$.w)(e=>e?(0,og.of)(!0):(0,og.of)(!1).pipe((0,a9.g)(r))),(0,aX.x)()).subscribe(a);return()=>o.unsubscribe()},[n,r]),i}({element:l?null:d,hideDelay:2e3}),h=fi({enabled:l||p,schemaType:o,value:r}),f=(0,oN.useMemo)(()=>({...a,minWidth:(null==a?void 0:a.minWidth)||1,minHeight:(null==a?void 0:a.minHeight)||1}),[a]),m=(0,oN.useMemo)(()=>(function(e){var n,r;if(!dj(e))return;let i="number"==typeof e.progress?e.progress:0,a=fa(e.initiated||e.createdAt),o=fa(e.updated||e.updatedAt),l=fa(null==(n=null==e?void 0:e.file)?void 0:n.name),s=fa(null==(r=null==e?void 0:e.file)?void 0:r.type),c=fa(e.previewImage);if(a&&o&&l&&s)return{progress:i,createdAt:a,updatedAt:o,file:{name:l,type:s},previewImage:c}})(null==r?void 0:r._upload),[r]),g=(0,oN.useMemo)(()=>{var e,n;return(null==m?void 0:m.previewImage)?(0,oZ.jsx)("img",{alt:c("preview.image.file-is-being-uploaded.alt-text"),src:m.previewImage}):(null==(e=null==h?void 0:h.value)?void 0:e.media)?null==(n=null==h?void 0:h.value)?void 0:n.media:o.icon},[h,o,m,c]);return(0,oZ.jsx)("div",{ref:u,style:f,children:(0,oN.createElement)(i,{...s,...(null==h?void 0:h.value)||{},media:g,error:null==h?void 0:h.error,isPlaceholder:null==h?void 0:h.isLoading,layout:n,schemaType:o})})}let fl=()=>(0,oN.createElement)(oN.Fragment);function fs(e){let{options:n}=RA().__internal,{defaultComponent:r,pick:i}=e;return(0,oN.useMemo)(()=>{let e=[...FR(n,[])];e.reverse();let a=e.map(e=>{let{config:n}=e;return i(n)}
1).filter(Boolean);return e=>{let n=e=>(0,oN.createElement)(r,e);for(let e of a){let r=n;n=n=>(0,oN.createElement)(e,{...n,renderDefault:r})}return n({...e,renderDefault:fl})}},[r,n,i])}function fc(e,n){return n.name===e||!!(n.type&&fc(e,n.type))}let fd=e=>!!(e.type&&"document"===e.type.name),fu=e=>e.name.startsWith("sanity."),fp=e=>e.getTypeNames().map(n=>e.get(n)).filter(dd).filter(e=>fd(e)).filter(e=>!fu(e)),fh=(e,n)=>{let{phrases:r,words:i}=function(e){let n=sz()(e.map(sP())),[r,i]=sS()(n,e=>/^".*"$/.test(e));return{phrases:sz()(r).map(sP()).map(fm),words:sz()(i.map(sP()))}}(e),[a,o]=function(e,n){let r=n.toLowerCase().trim(),i=0,a=0;return e.forEach(e=>{r.includes(e)&&(i+=e.length/r.length,a+=e.length)}),1===i?[1,"[Phrase] Exact match"]:[i/2,"[Phrase] Matched ".concat(a," of ").concat(r.length," characters")]}(r,n),[l,s]=function(e,n){let r=sz()(sj()(sR()(sP()(n)))),i=sk()(e,r),a=sA()(r,e),o=i.length/a.length;return 1===o?[1,"[Word] Exact match"]:[o/2,"[Word] Matched ".concat(i.length," of ").concat(a.length," terms: [").concat(i.join(", "),"]")]}(i,n);return[a+l,[s,o].join(", ")]},ff=e=>"string"==typeof e?e:JSON.stringify(e);function fm(e){return e.replace(/^"(.*)"$/,"$1")}let fg=/([^!@#$%^&*(),\\/?";:{}|[\]+<>\s-])+/g,fx=/(^[.]+)|([.]+$)/,fv=sD()([lI(),sA(),sj()]);function fy(e,n){let r=!1;return{specs:e.map(e=>({typeName:e.name,paths:e.__experimental_search.map(e=>{let i=e.path.map(e=>"number"==typeof e&&(r=!0,n)?[]:e);return{weight:e.weight,path:dA(i),mapWith:e.mapWith}})})),hasIndexedPaths:r}}let fb=e=>{let{mapWith:n,path:r}=e;return n?"".concat(n,"(").concat(r,")"):r};function fj(e){var n,r;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{filter:a,params:o,tag:l}=i,{specs:s,hasIndexedPaths:c}=fy(e.types,!1),d=function(e){let n=[],r=e.replace(/("[^"]*")/g,e=>sR()(e).length>1?(n.push(e),""):e);return[...n.map(e=>sZ()(sP()(e))),...sz()(sj()((sP()(r).match(fg)||[]).map(e=>e.replace(fx,""))))]}(e.query),u=c?fy(e.types,!0).specs:s,p=["_type in $__types",!1===i.includeDrafts&&"!(_id in path('drafts.**'))",...function(e,n){let r=fv(n.map(e=>(e.paths||[]).map(e=>fb(e))));return e.map((e,n)=>r.map(e=>"".concat(e," match $t").concat(n))).filter(e=>e.length>0).map(e=>"(".concat(e.join(" || "),")"))}(d,u),a?"(".concat(a,")"):"",e.filter?"(".concat(e.filter,")"):""].filter(Boolean),h=s.map(e=>{let n='_type == "'.concat(e.typeName,'" => '),r="{ ".concat(e.paths.map((e,n)=>'"w'.concat(n,'": ').concat(fb(e)))," }");return"".concat(n).concat(r)}),f=((null==i?void 0:i.sort)||[{field:"_id",direction:"asc"}]).map(e=>[e.mapWith?"".concat(e.mapWith,"(").concat(e.field,")"):e.field,(e.direction||"").toLowerCase()].map(e=>e.trim()).filter(Boolean).join(" ")).join(","),m=["_type","_id"],g=h.length>0?"...select(".concat(h.join(",\n"),")"):"",x=m.join(", ")+(g?", ".concat(g):""),v="*[".concat(p.join(" && "),"]")+"| order(".concat(f,")")+"[$__offset...$__limit]"+"{".concat(x,"}");if(null==i?void 0:i.__unstable_extendedProjection){let e=null==i?void 0:i.__unstable_extendedProjection,n=m.concat(e).join(", ");v=["*[".concat(p.join(" && "),"]{").concat(n,"}"),"order(".concat(f,")[$__offset...$__limit]{").concat(x,"}")].join("|")}let y=["findability-mvi:".concat(4)].concat((null==i?void 0:i.comments)||[]).map(e=>"// ".concat(e)).join("\n"),b=y?"".concat(y,"\n").concat(v):v,j=null!=(n=null==i?void 0:i.offset)?n:0,w=(null!=(r=null==i?void 0:i.limit)?r:1e3)+j;return{query:b,params:{...fw(d),__types:s.map(e=>e.typeName),__limit:w,__offset:j,...o||{}},options:{tag:l},searchSpec:s,terms:d}}let fw=e=>e.reduce((e,n,r)=>(e["t".concat(r)]="".concat(n,"*"),e),{});function fk(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(i){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{query:o,params:l,options:s,searchSpec:c,terms:d}=fj("string"==typeof i?{query:i,types:e}:i.types.length?i:{...i,types:e},{...r,...a});return n.observable.fetch(o,l,s).pipe(r.unique?(0,aW.U)(dx):(0,a4.b)(),(0,aW.U)(e=>(function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=s_()(e,e=>e.typeName);return n.map((e,a)=>{var o;let l=null==(o=i[e._type].paths||[])?void 0:o.map((n,i)=>{let a=ff(e["w".concat(i)]);if(!a)return{path:n.path,score:0,why:"No match"};let[o,l]=fh(r,a);return{path:n.path,score:o*n.weight,why:"".concat(l," (*").concat(n.weight,")")}}),s=l.reduce((e,n)=>e+n.score,0);return{hit:e,resultIndex:n.length-a,score:s,stories:l}})})(c,e,d)),(null==a?void 0:a.skipSortByScore)?(0,a4.b)():(0,aW.U)(e=>lo()(e,e=>-e.score)))}}function fC(e,n){return e.map(e=>({title:e.title,name:e.name,__experimental_search:(0,oq.i8)(e,n)}))}let f_={available:!0,reason:"READABLE"},fT={available:!1,reason:"PERMISSION_DENIED"},fS={available:!1,reason:"NOT_FOUND"};function fE(e,n,r){let{publishedId:i,draftId:a}=dh(n);return e.unstable_observeDocumentPairAvailability(n).pipe((0,a$.w)(o=>{if(!o.draft.available&&!o.published.available){let e="PERMISSION_DENIED"===o.draft.reason||"PERMISSION_DENIED"===o.published.reason?fT:fS;return(0,og.of)({id:n,type:void 0,availability:e,preview:{draft:void 0,published:void 0}})}let l={_type:"reference",_ref:a},s={_type:"reference",_ref:i};return(0,oE.a)([e.observeDocumentTypeFromId(a),e.observeDocumentTypeFromId(i)]).pipe((0,aW.U)(e=>{let[n,r]=e;return n||r})).pipe((0,a$.w)(c=>{if(!c)return(0,og.of)({id:n,type:void 0,availability:{available:!0,reason:"READABLE"},preview:{draft:void 0,published:void 0}});let d=r.to.find(e=>e.name===c);if(!d)return(0,og.of)({id:n,type:c,availability:{available:!0,reason:"READABLE"},preview:{draft:void 0,published:void 0}});let u=AT(null==d?void 0:d.preview)||[],p=e.observePaths(l,u).pipe((0,aW.U)(e=>e?{_id:a,...AW(e,d)}:void 0),(0,a3.O)(void 0)),h=e.observePaths(s,u).pipe((0,aW.U)(e=>e?{_id:i,...AW(e,d)}:void 0),(0,a3.O)(void 0));return(0,oE.a)([p,h]).pipe((0,aW.U)(e=>{let[n,r]=e;return{draft:n,published:r}})).pipe((0,aW.U)(e=>({type:c,id:i,availability:o.draft.available||o.published.available?f_:"PERMISSION_DENIED"===o.draft.reason||"PERMISSION_DENIED"===o.published.reason?fT:fS,preview:{draft:dj(e.draft)?e.draft:void 0,published:dj(e.published)?e.published:void 0}})))}))}))}function fP(e,n,r,i){return fk(fC(r.to,i.maxFieldDepth),e,i)(n,{includeDrafts:!0}).pipe((0,aW.U)(e=>e.map(e=>e.hit)),(0,aW.U)(dg),(0,aW.U)(e=>e.slice(0,100)),(0,aQ.z)(n=>{var r;return(0===(r=n.filter(e=>!e.draft||!e.published).map(e=>e.draft?e.id:df(e.id))).length?(0,og.of)([]):e.observable.fetch("*[_id in $ids]._id",{ids:r},{tag:"get-counterpart-ids"})).pipe((0,aW.U)(e=>n.map(n=>{let r=df(n.id);return{id:n.id,type:n.type,draft:n.draft||e.includes(r)?{_id:r,_type:n.type}
1:void 0,published:n.published||e.includes(n.id)?{_id:n.id,_type:n.type}:void 0}})))}))}let fO=Symbol.for("sanity.patch");function fA(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{patchType:fO,type:"setIfMissing",path:n,value:e}}function fI(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return{patchType:fO,type:"insert",path:r,position:n,items:e}}function fz(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{patchType:fO,type:"set",path:n,value:e}}function fM(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{patchType:fO,type:"unset",path:e}}class fR{static from(e){return e instanceof fR?e:new fR(Array.isArray(e)?lI()(e):[e])}constructor(e){this.patches=e}prepend(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return fR.from([...lI()(n),...this.patches])}append(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return fR.from([...this.patches,...lI()(n)])}prefixAll(e){return fR.from(this.patches.map(n=>({...n,path:[e,...n.path]})))}}var fF=Object.freeze,fD=Object.defineProperty;let fq={warning:"caution",error:"critical"},fZ=(0,oV.ZP)(oK.xu)(e7||(e7=fF(fD(s=["\n  border-top: 1px solid var(--card-border-color);\n"],"raw",{value:fF(s.slice())}))));function fN(e){let{children:n,status:r="warning",suffix:i,title:a,...o}=e;return(0,oZ.jsxs)(oK.Zb,{radius:2,tone:fq[r],...o,"data-ui":"Alert",children:[(0,oZ.jsxs)(oK.kC,{padding:4,children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsxs)(oK.xv,{size:1,children:["warning"===r&&(0,oZ.jsx)(lp.foC,{}),"error"===r&&(0,oZ.jsx)(lp.uIy,{})]})}),(0,oZ.jsxs)(oK.xu,{flex:1,marginLeft:3,children:[(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:a}),n&&(0,oZ.jsx)(oK.xu,{marginTop:3,children:n})]})]}),i&&(0,oZ.jsx)(fZ,{children:i})]})}function fL(e,n){let r=(0,oN.useRef)(n||null);return(0,oN.useEffect)(()=>{r.current=e},[e]),r.current}function fV(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:lu(),i=fL(e);(0,oN.useEffect)(()=>{r(i,e)||n(i,e)},[n,e,i,r])}function fK(e,n){(0,oN.useEffect)(()=>{let r=r=>{let i=r.target;if(i instanceof HTMLElement){if(e.some(e=>{var n;return null==(n=e.current)?void 0:n.contains(i)}))return;n(r)}};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r)}},[e,n])}let fB=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fU=/_key\s*==\s*['"](.*)['"]/;function fH(e){if(!Array.isArray(e))throw Error("Path is not an array");return e.reduce((e,n,r)=>{if((0,ll.dw)(n))return"".concat(e,"[").concat(n,"]");if((0,ll.Fd)(n)&&n._key)return"".concat(e,'[_key=="').concat(n._key,'"]');if((0,ll.lo)(n)){let[r,i]=n;return"".concat(e,"[").concat(r,":").concat(i,"]")}if("string"==typeof n)return"".concat(e).concat(0===r?"":".").concat(n);throw Error("Unsupported path segment `".concat(JSON.stringify(n),"`"))},"")}function f$(e,n){let r=n[0];if(!r)return e;let i=n.slice(1);if((0,ll.dw)(r))return f$(Array.isArray(e)?e[r]:void 0,i);if((0,ll.Fd)(r))return f$(Array.isArray(e)?e.find(e=>e._key===r._key):void 0,i);if("string"==typeof r)return f$(dj(e)?e[r]:void 0,i);throw Error("Unknown segment type ".concat(JSON.stringify(r)))}function fW(e){return(0,ll.dw)(e)?Number(e.replace(/[^\d]/g,"")):(0,ll.Fd)(e)?function(e){let n=e.match(fU);if(!n)throw Error("Invalid key segment");return{_key:n[1]}}(e):(0,ll.lo)(e)?function(e){let[n,r]=e.split(":").map(e=>""===e?e:Number(e));return[n,r]}(e):e}function fY(e,n){return e.length===n.length&&e.every((e,r)=>{let i=n[r];return(0,ll.Fd)(e)&&(0,ll.Fd)(i)?e._key===i._key:(0,ll.dw)(e)?Number(e)===Number(i):(0,ll.lo)(e)&&(0,ll.lo)(i)?e[0]===i[0]&&e[1]===i[1]:e===i})}function fX(e){return(0,ll.fU)(e)?e._key:void 0}function fG(e){let n=fX(e);return n?{_key:n}:void 0}function fJ(e,n){return e.get((null==n?void 0:n.author)||null)}function fQ(e,n){return function(e,n){let r=function e(n,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(0===r.length)return n;let a=r[0],o=r.slice(1);if((0,ll.lo)(a))throw Error("Index tuples are not supported in diff paths");if((0,ll.dw)(a)||(0,ll.Fd)(a)){let r=(0,ll.dw)(a)?"at index ".concat(a):"with key ".concat(a._key);if("array"!==n.type){"Failed to get item ".concat(r," at path ").concat(fH(i)," (not an array)");return}let l=n.items.find((0,ll.dw)(a)?e=>e.toIndex===a:e=>(function(e,n){let r=e.diff;return"object"===r.type&&!!r.toValue&&r.toValue._key===n})(e,a));if(!l){"Failed to get item ".concat(r," at path ").concat(fH(i)," (item missing)");return}return e(l.diff,o,i.concat(a))}if("object"!==n.type){"Failed to get property ".concat(a," at path ").concat(fH(i)," (not an object)");return}let l=n.fields[a];if(void 0===l){"Failed to get property ".concat(a," at path ").concat(fH(i)," (field did not exist)");return}return e(l,o,i.concat(a))}(e,n);if(r&&"unchanged"!==r.action)return r.annotation||void 0}(e,Array.isArray(n)?n:function(e){let n=e.match(fB);if(!n)throw Error("Invalid path string");return n.map(fW)}(n))}function f0(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=pt(),i=(0,oN.useMemo)(()=>fQ(e,n),[e,n]);return(0,oN.useMemo)(()=>fJ(r,i),[i,r])}function f1(e){if(!("diff"in e))return(0,oZ.jsx)(f2,{...e});let{diff:n,path:r=[],...i}=e,a=fQ(n,r);return(0,oZ.jsx)(f2,{...i,annotations:a?[a]:[]})}function f2(e){let{annotations:n,children:r,description:i,...a}=e,{t:o}=dV();if(!n)return r;let l=(0,oZ.jsxs)(oK.Kq,{space:2,children:[(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:i||o("changes.changed-label")}),(0,oZ.jsx)(oK.Kq,{space:2,children:n.map((e,n)=>(0,oZ.jsx)(f3,{annotation:e},n))})]});return(0,oZ.jsx)(Bi,{zOffset:"paneFooter",children:(0,oZ.jsx)(lr.u,{content:l,portal:!0,...a,children:r})})}function f3(e){let{annotation:n}=e,{author:r,timestamp:i}=n,[a]=hV(r),o=fJ(pt(),n),l=h0(i,{minimal:!0}),{t:s}=dV();return(0,oZ.jsxs)(oK.gF,{space:2,children:[(0,oZ.jsxs)(oK.kC,{align:"center",paddingRight:3,style:{backgroundColor:o.background,color:o.text,borderRadius:"calc(23px / 2)"},children:[(0,oZ.jsx)(yl,{user:r}),(0,oZ.jsx)(oK.gF,{paddingLeft:2,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,style:{color:o.text},children:a?a.displayName:s("changes.loading-author")})})]}),(0,oZ.jsx)(oK.xv,{as:"time",muted:!0,size:1,dateTime:i,children:l})]})}var f4=Object.freeze,f5=Object.defineProperty;let f8=(0,oV.ZP)(oK.Zb)(te||(te=f4(f5(c=["\n  --diff-card-radius: ",";\n  --diff-card-bg-color: ",";\n\n  max-width: 100%;\n  position: relative;\n  border-radius: var(--diff-card-radius);\n\n  &:not(del) {\n    text-decoration: none;\n  }\n\n  &[data-hover] {\n    &::after {\n      content: '';\n      display: block;\n      position: absolute;\n      left: 0;\n      right: 0;\n      bottom: 0;\n    }\n\n    &:hover {\n      border-bottom-left-radius: 0;\n      border-bottom-right-radius: 0;\n\n      &::after {\n        bottom: -3px;\n        border-top: 1px solid var(---diff-card-bg-color);\n        border-bottom: 2px solid currentColor;\n        border-bottom-left-radius: var(--diff-card-radius);\n        border-bottom-right-radius: var(--diff-card-radius);\n      }\n    }\n\n    [data-from-to-layout]:hover & {\n      border-bottom-left-radius: 0;\n      border-bottom-right-radius: 0;\n\n      &::after {\n        bottom: -3px;\n        border-top: 1px solid var(---diff-card-bg-color);\n        border-bottom: 2px solid currentColor;\n        border-bottom-left-radius: var(--diff-card-radius);\n        border-bottom-right-radius: var(--diff-card-radius);\n      }\n    }\n  }\n"],"raw",{value:f4(c.slice())}))),e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.radius[2])},e=>{let{theme:n}=e;return n.sanity.color.card.enabled.bg}),f6=[],f9=(0,oN.forwardRef)(function(e,n){let{annotation:r,as:i="div",children:a,className:o,diff:l,disableHoverEffect:s,path:c=f6,style:d={},tooltip:u,...p}=e,h=(0,oN.useMemo)(()=>r||fQ(l,c),[r,l,c]),f=fJ(pt(),h),m=(0,oZ.jsx)(f8,{...p,as:i,className:o,"data-hover":s||!h?void 0:"",ref:n,radius:1,style:{...d,backgroundColor:f.background,color:f.text},children:a});return u&&h?(0,oZ.jsx)(f1,{annotations:[h],description:u&&"object"==typeof u&&u.description,children:m}):m});var f7=Object.freeze,me=Object.defineProperty,mt=(e,n)=>f7(me(e,"raw",{value:f7(n||e.slice())}));let mn=oV.ZP.div(tt||(tt=mt(["\n  border-radius: ",";\n  padding: ",";\n"])),e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.radius[2])},e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.space[1])}),mr=(0,oV.ZP)(oK.xv)(tn||(tn=mt(["\n  &:not([hidden]) {\n    color: inherit;\n  }\n"])));function mi(e){let{change:n,segment:r}=e;if("string"==typeof r)return(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{title:r,size:1,weight:"medium",textOverflow:"ellipsis",children:r})});let{hasMoved:i,fromIndex:a,toIndex:o,annotation:l}=r,s=void 0===o;if(void 0===a)return(0,oZ.jsx)(ma,{annotation:l,change:n,toIndex:o});if(s)return(0,oZ.jsx)(mo,{annotation:l,fromIndex:a});if(i&&void 0!==o&&void 0!==a)return(0,oZ.jsx)(ml,{annotation:l,fromIndex:a,toIndex:o});let c=(o||0)+1;return(0,oZ.jsx)(oK.xu,{padding:1,children:(0,oZ.jsxs)(oK.xv,{size:1,weight:"medium",children:["#",c]})})}function ma(e){let{annotation:n,change:r,toIndex:i=0}=e,{t:a}=dV(),o=i+1,l=a("changes.array.item-added-in-position",{position:o}),s=(0,oZ.jsxs)(oZ.Fragment,{children:["#",o]}),c=((null==r?void 0:r.diff)?fQ(r.diff,[]):void 0)||n;return c?(0,oZ.jsx)(f9,{annotation:c,tooltip:{description:l},as:mn,children:(0,oZ.jsx)(mr,{size:1,weight:"medium",forwardedAs:"ins",style:{textDecoration:"none"},children:s})}):(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:s})}function mo(e){let{annotation:n,fromIndex:r=0}=e,{t:i}=dV(),a=r+1,o=i("changes.array.item-removed-from-position",{position:a});return(0,oZ.jsx)(f9,{annotation:n||null,as:mn,tooltip:{description:o},children:(0,oZ.jsxs)(mr,{size:1,weight:"medium",forwardedAs:"del",children:["#",a]})})}function ml(e){let{annotation:n,fromIndex:r,toIndex:i}=e,{t:a}=dV(),o=i-r,l=a("changes.array.item-moved",{count:Math.abs(o),context:o<0?"up":"down"});return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(oK.xu,{padding:1,children:(0,oZ.jsxs)(mr,{size:1,weight:"medium",children:["#",i+1]})}),(0,oZ.jsx)(f9,{annotation:n,as:mn,tooltip:{description:l}
1,children:(0,oZ.jsxs)(mr,{size:1,weight:"medium",children:[o<0?"↑":"↓",Math.abs(o)]})})]})}function ms(e){let{change:n,titlePath:r}=e;return(0,oZ.jsx)(oK.Oo,{maxLength:4,separator:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:(0,oZ.jsx)(lp.XCv,{})}),children:r.map((e,r)=>"string"==typeof e||!n||n.showIndex?(0,oZ.jsx)(mi,{change:n,segment:e},r):null)})}let mc=e=>{let{checkProperty:n=!1,checkPropertyKey:r,document:i,parent:a,value:o}=e,l=ds(o);return function(e,n,r){let{currentUser:i,document:a,parent:o,value:l}=r,s=(0,oN.useRef)(!1);return(0,oN.useMemo)(()=>{var r;let c=!1;if("boolean"==typeof e||void 0===e)return e||!1;try{c=e({document:a,parent:o,value:l,currentUser:i})}catch(e){return console.error("An error occurred while running the callback from `".concat(n,"`: ").concat(e.message)),!1}return dj(r=c)&&"function"==typeof(null==r?void 0:r.then)&&!s.current?(console.warn("The `".concat(n,"` option is either a promise or a promise returning function. Async callbacks for `").concat(n,"` option is not currently supported.")),!1):(void 0===c&&console.warn("The `".concat(n,"` option is or returned `undefined`. `").concat(n,"` should return a boolean.")),c)},[e,a,o,l,i,n])}(n,r,{currentUser:hK(),document:i,parent:a,value:l})},md=(0,oN.createContext)({path:[]});function mu(e){let n=typeof e;if("object"===n){if(null===e)return"null";if(Array.isArray(e))return"array";if(e instanceof Object&&"Object"!==e.constructor.name)return e.constructor.name}return n}function mp(e,n){let{jsonType:r}=n,i=Array.isArray(e)?"array":typeof e;if(null!==e&&"undefined"!==i){var a;if(i!==r)return{messageKey:"changes.error.incorrect-type-message",value:e,expectedType:r,actualType:mu(e)};if("object"===n.jsonType&&null!==(a=e)&&!Array.isArray(a)&&"object"==typeof a)for(let r of n.fields){let n=mp(e[r.name],r.type);if(n)return n}}}function mh(e,n){let r=(0,ll.ay)(n)?n._type:Array.isArray(n)?"array":null===n?"null":typeof n;return e.of.find(e=>e.name===r)||(1===e.of.length?e.of[0]:void 0)}let mf=[["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""]],mm=[["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""]],mg=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],mx=mm.map(e=>e[0]).concat(mf.map(e=>e[0])),mv=mm.map(e=>e[1]).concat(mf.map(e=>e[1])),my=mx.concat(mv).concat(mg).concat("").concat("⁠"),mb=RegExp("".concat(my.join("|")),"g"),mj=RegExp("".concat(my.join("|"),"|\n"),"g");function mw(e){return"object"===e.jsonType&&"block"===e.name}function mk(e,n){return e.fields.children.items.filter(e=>e.diff.isChanged&&(e.diff.toValue===n||e.diff.fromValue===n)).map(e=>e.diff).map(e=>e)[0]}function mC(e,n){let r=e.find(e=>"children"===e.name);return r&&r.type&&"array"===r.type.jsonType&&r.type.of.find(e=>e.name===n._type)||void 0}function m_(e){return e.decorators?sW()(e.decorators,["value"],["asc"]):[]}function mT(e,n){return m_(n).some(n=>n.value===e)}function mS(e,n,r,i,a){return n?n.children.map(n=>{var o;let l=(0,ll.NG)(n)?null==(o=n.text)?void 0:o.replace(mb,""):"";if((0,ll.NG)(n)){let a=mP(e,n),o=null==a?void 0:a.fields.text;o&&o.toValue===n.text&&"string"===o.type&&"unchanged"!==o.action&&(l=o.segments.filter(e=>"removed"!==e.action).map(e=>e.text.replace(mb,"")).join("⁠")),n.marks&&n.marks.forEach(e=>{r[e]?l="".concat(r[e][0]).concat(l).concat(r[e][1]):i[e]&&(l="".concat(i[e][0]).concat(l).concat(i[e][1]))})}else l=a[n._key];return"".concat("").concat(l)}).join(""):""}function mE(e){let n=[...e.toValue?e.toValue.children.filter(e=>"span"!==e._type):[]];return(e.fromValue?e.fromValue.children.filter(e=>
1"span"!==e._type):[]).forEach(e=>{n.some(n=>e._key===n._key)||n.push(e)}),sW()(n,["_key"],["asc"])}function mP(e,n){let r=e.fields.children&&"unchanged"!==e.fields.children.action&&"array"===e.fields.children.type&&e.fields.children.items.find(e=>e.diff&&"object"===e.diff.type&&("removed"===e.diff.action?e.diff.fromValue&&e.diff.fromValue._key===n._key:(e.diff.toValue&&e.diff.toValue._key)===n._key));if(r)return r.diff}function mO(e){return e&&o7()(Object.keys(e),["_key","_type"])||!1}function mA(e){let n=[...e.toValue&&e.toValue.markDefs?e.toValue.markDefs:[]];return(e.fromValue&&e.fromValue.markDefs?e.fromValue.markDefs:[]).forEach(e=>{n.some(n=>e._key===n._key)||n.push(e)}),sW()(n,["_key"],["asc"])}let mI=[];function mz(e){let{checked:n,color:r}=e;return(0,oZ.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 17 17",xmlns:"http://www.w3.org/2000/svg",fill:null==r?void 0:r.background,children:[(0,oZ.jsx)("rect",{x:"0",y:"0",width:"17",height:"17",rx:"2.5"}),void 0===n&&(0,oZ.jsx)("path",{d:"M4.07996 8.5H12.92",stroke:null==r?void 0:r.text,strokeWidth:"2"}),n&&(0,oZ.jsx)("path",{d:"M3.5 8L7 11.5L13.5 5",stroke:null==r?void 0:r.text,strokeWidth:"2"})]})}function mM(e){let{checked:n,color:r}=e;return(0,oZ.jsxs)("svg",{width:"38",height:"22",viewBox:"0 0 38 22",xmlns:"http://www.w3.org/2000/svg",children:[(0,oZ.jsx)("rect",{width:"38",height:"22",rx:"11",fill:n?null==r?void 0:r.border:null==r?void 0:r.background}),void 0===n&&(0,oZ.jsx)("rect",{x:"11",y:"3",width:"16",height:"16",rx:"8",fill:"white"}),n&&(0,oZ.jsx)("rect",{x:"18",y:"3",width:"16",height:"16",rx:"8",fill:"white"}),"boolean"==typeof n&&!n&&(0,oZ.jsx)("rect",{x:"4",y:"3",width:"16",height:"16",rx:"8",fill:"white"})]})}var mR=Object.freeze,mF=Object.defineProperty;let mD=oV.ZP.div(tr||(tr=mR(mF(d=["\n  display: inline-block;\n  word-wrap: break-word;\n"],"raw",{value:mR(d.slice())})))),mq=function(e){let{value:n,schemaType:r}=e;return(0,oZ.jsx)(oK.xu,{as:mD,paddingX:2,paddingY:1,children:function(e,n){let{options:r,name:i}=n,a=(null==r?void 0:r.dateFormat)||"YYYY-MM-DD",o=(null==r?void 0:r.timeFormat)||"HH:mm";return sX.W(new Date(e),"date"===i?a:"".concat(a," ").concat(o))}(n,r)})},mZ=e=>{let{diff:n,schemaType:r}=e;return(0,oZ.jsx)(xI,{align:"center",diff:n,layout:"grid",previewComponent:mq,schemaType:r})},mN=(0,oN.createContext)(null);function mL(){let e=(0,oN.useContext)(mN);if(!e)throw Error("DocumentChange: missing context value");return e}function mV(e){let[n,r]=(0,oN.useState)(void 0),i=hN(h$);return(0,oN.useEffect)(()=>{if(!e)return;let n=i.observable.getDocument(e).subscribe(r);return()=>{n.unsubscribe()}},[i,e]),e?n:void 0}function mK(e,n){return e<1e3?n(e,"byte"):e<1e6?n(e/1e3,"kilobyte"):e<1e9?n(e/1e6,"megabyte"):e<1e12?n(e/1e9,"gigabyte"):n(e/1e12,"terabyte")}var mB=Object.freeze,mU=Object.defineProperty;let mH=oV.ZP.div(ti||(ti=mB(mU(u=["\n  ","\n  &:not([hidden]) {\n    display: inline-block;\n  }\n\n  [data-number='positive'] {\n    color: var(--size-diff-positive);\n  }\n\n  [data-number='negative'] {\n    color: var(--size-diff-negative);\n  }\n"],"raw",{value:mB(u.slice())}))),e=>{let{theme:n}=e;return"\n    --size-diff-positive: ".concat(n.sanity.color.solid.positive.enabled.bg,";\n    --size-diff-negative: ").concat(n.sanity.color.solid.critical.enabled.bg,";\n  ")});function m$(e,n){let r=(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e)||[]).slice(1).map(e=>parseInt(e,16)).concat(n);return"rgba(".concat(r.join(", "),")")}function mW(e){let{crop:n,diff:r,hash:i,hotspot:a,width:o=100,height:l=100,...s}=e,{t:c}=dV(),d=f0(r,"crop"),u=f0(r,"hotspot");return(0,oZ.jsxs)("svg",{...s,fill:"none",width:o,height:l,viewBox:"0 0 ".concat(o," ").concat(l),children:[(0,oZ.jsx)("defs",{children:n&&a&&(0,oZ.jsxs)("mask",{id:"mask-hotspot-".concat(i),children:[(0,oZ.jsx)("rect",{x:0,y:0,width:o,height:l,fill:"#fff"}),(0,oZ.jsx)(mX,{hotspot:a,fill:"#000",offset:1,width:o,height:l,stroke:"#000",strokeWidth:3})]})}),n&&(0,oZ.jsx)(f1,{diff:r,path:"crop",description:c("changes.image.crop-changed"),children:(0,oZ.jsx)("g",{children:(0,oZ.jsx)(mY,{crop:n,fill:m$(d.border,.25),mask:a?"url(#mask-hotspot-".concat(i,")"):void 0,stroke:d.border,strokeWidth:1,width:o,height:l})})}),a&&(0,oZ.jsx)(f1,{diff:r,path:"hotspot",description:c("changes.image.crop-changed"),children:(0,oZ.jsx)("g",{children:(0,oZ.jsx)(mX,{hotspot:a,fill:m$(u.border,.25),stroke:u.border,strokeWidth:1,width:o,height:l})})})]})}function mY(e){let{crop:n,width:r,height:i,...a}=e,o={x:n.left*r,y:n.top*i,width:(1-n.right-n.left)*r,height:(1-n.bottom-n.top)*i};return(0,oZ.jsx)("rect",{...a,...o,style:{vectorEffect:"non-scaling-stroke"}})}function mX(e){let{hotspot:n,offset:r=0,width:i,height:a,...o}=e,l={cx:n.x*i,cy:n.y*a,rx:n.width/2*i+r,ry:n.height/2*a+r};return(0,oZ.jsx)("ellipse",{...o,...l,style:{vectorEffect:"non-scaling-stroke"}})}var mG=Object.freeze,mJ=Object.defineProperty,mQ=(e,n)=>mG(mJ(e,"raw",{value:mG(n||e.slice())}));let m0=["originalFilename"],m1=()=>{let{t:e}=dV();return(0,oZ.jsx)(oK.Zb,{flex:1,tone:"transparent",padding:4,radius:2,height:"stretch",children:(0,oZ.jsx)(oK.kC,{align:"center",justify:"center",height:"fill",children:(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:e("changes.image.no-image-placeholder")})})})},m2=oV.ZP.div(ta||(ta=mQ(["\n  height: 100%;\n  max-height: 190px;\n  position: relative;\n\n  /* Ideally the checkerboard component currently in the form builder should be made available and used here */\n  background-color: ",";\n  background-image: linear-gradient(45deg, "," 25%, transparent 25%),\n    linear-gradient(-45deg, "," 25%, transparent 25%),\n    linear-gradient(45deg, transparent 75%, "," 75%),\n    linear-gradient(-45deg, transparent 75%, "," 75%);\n  background-size: 16px 16px;\n  background-position:\n    0 0,\n    0 8px,\n    8px -8px,\n    -8px 0;\n\n  &::after {\n    content: '';\n    display: block;\n    position: absolute;\n    top: 0;\n    left: 0;\n    right: 0;\n    bottom: 0;\n    box-shadow: inset 0 0 0 1px var(--card-border-color);\n    pointer-events: none;\n  }\n\n  &[data-changed] {\n    opacity: 0.45;\n  }\n"])),sx.VG.gray[100].hex,sx.VG.gray[50].hex,sx.VG.gray[50].hex,sx.VG.gray[50].hex,sx.VG.gray[50].hex),m3=oV.ZP.img(to||(to=mQ(["\n  display: block;\n  flex: 1;\n  min-height: 0;\n  object-fit: contain;\n  width: 100%;\n  height: 100%;\n\n  &[data-action='removed'] {\n    opacity: 0.45;\n  }\n"]))),m4=oV.ZP.div(tl||(tl=mQ(["\n  svg {\n    display: block;\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n  }\n"])));function m5(e){var n,r,i,a;let o;let{id:l,action:s,diff:c,hotspot:d,crop:u,is:p}=e,{t:h}=dV(),f=hN(h$),[m,g]=oN.useState(),{value:x}=function(e,n){let r=z8();return dF((0,oN.useMemo)(()=>e?r.observePaths({_type:"reference",_ref:e},n):(0,og.of)(void 0),[e,r,n]))}(l,m0),v=(0,sf.pz)(l),y=(0,oN.useMemo)(()=>sh()(f),[f]),b=null===x,j=x&&x.originalFilename,w=y.image(l).height(190).dpr(Math.min(3,Math.max(1,Math.ceil(window.devicePixelRatio||1)))).fit("max"),k=(null==(r=null==(n=c.fromValue)?void 0:n.asset)?void 0:r._ref)!==(null==(a=null==(i=c.toValue)?void 0:i.asset)?void 0:a._ref);return s&&"changed"!==s&&(o=h("added"===s?"changes.added-label":"changes.removed-label")),(0,oZ.jsxs)(oK.kC,{direction:"column",height:"fill",flex:1,children:[(0,oZ.jsx)(oK.xu,{flex:1,padding:2,paddingBottom:0,children:(0,oZ.jsxs)(oK.kC,{as:m2,direction:"column","data-changed":"from"===p&&k?"":void 0,"data-error":m?"":void 0,children:[!b&&!m&&(0,oZ.jsx)(m3,{src:w.toString()||"",alt:j,"data-action":"changed"===s?void 0:s,onError:g,width:v.width,height:v.height}),(b||m)&&(0,oZ.jsx)(oK.xu,{paddingY:5,children:(0,oZ.jsx)(oK.xv,{size:1,muted:!0,align:"center",children:h(b?"changes.image.deleted":"changes.image.error-loading-image")})}),(0,oZ.jsx)(m4,{children:(0,oZ.jsx)(mW,{crop:u&&!(0,sf.aM)(u)?u:void 0,diff:c,hash:function(e){let n=0;if(0==e.length)return n.toString();for(let r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r),n&=n;return n.toString()}("".concat(w.toString()||"","-").concat(p)),hotspot:d&&!(0,sf.Rq)(d)?d:void 0,width:v.width,height:v.height})})]})}),(0,oZ.jsx)(vi,{title:j||h("changes.image.meta-info-fallback-title"),icon:lp.XBm,markRemoved:k&&"from"===p,children:o?(0,oZ.jsx)("div",{children:o}):(0,oZ.jsxs)("div",{children:[v.width," \xd7 ",v.height]})})]})}let m8=["asset","crop","hotspot"],m6={flex:1};var m9=Object.freeze,m7=Object.defineProperty;let ge=oV.ZP.div(ts||(ts=m9(m7(p=["\n  display: inline-block;\n  word-break: break-all;\n"],"raw",{value:m9(p.slice())})))),gt=e=>{let{value:n}=e;return(0,oZ.jsx)(oK.xu,{as:ge,paddingX:2,paddingY:1,children:n})};var gn=Object.freeze,gr=Object.defineProperty;let gi=oV.ZP.blockquote(tc||(tc=gn(gr(h=["\n  margin: 0;\n"],"raw",{value:gn(h.slice())}))));function ga(e){let{children:n}=e;return(0,oZ.jsx)("div",{children:(0,oZ.jsx)(gi,{children:n})})}var go=Object.freeze,gl=Object.defineProperty;let gs={h1:2,h2:1,h3:0,h4:0,h5:0,h6:0},gc=(0,oV.ZP)(oK.X6)(td||(td=go(gl(f=["\n  &:not([hidden]) {\n    display: inline;\n    text-transform: none;\n    margin: 0;\n\n    &::before,\n    &::after {\n      content: unset;\n    }\n  }\n"],"raw",{value:go(f.slice())}))));function gd(e){let{style:n,children:r}=e;return(0,oZ.jsx)(gc,{size:gs[n],children:r})}var gu=Object.freeze,gp=Object.defineProperty;let gh=oV.ZP.div(tu||(tu=gu(gp(m=["\n  text-transform: none;\n  white-space: wrap;\n  overflow-wrap: break-word;\n  margin: 0;\n"],"raw",{value:gu(m.slice())}))));function gf(e){let{children:n}=e;return(0,oZ.jsx)(gh,{children:n})}let gm=[];function gg(e){var n,r,i;let a;let{diff:o,block:l,children:s}=e,c=f0(o,gm),{path:d}=(0,oN.useContext)(md),{onSetFocus:u}=(0,oN.useContext)(dl),{t:p}=dV(),h="removed"===o.action,f=s,m=(0,oN.useCallback)(e=>{e.stopPropagation(),h||u(d)},[d,h,u]);if(f="blockquote"===l.style?(0,oZ.jsx)(ga,{children:f}):l.style&&(0,ll.DG)(l)&&l.style&&["h1","h2","h3","h4","h5","h6"].includes(l.style)?(0,oZ.jsx)(gd,{style:l.style,children:f}):(0,oZ.jsx)(gf,{children:f}),"changed"===o.origin.action&&o.origin.fields.style&&"changed"===o.origin.fields.style.action&&o.origin.fields.style.annotation){a=null==(r=null==(n=null==o?void 0:o.origin)?void 0:n.fromValue)?void 0:r.style;let e=c?{background:c.background,color:c.text}:{};f=(0,oZ.jsx)(oK.Zb,{padding:3,border:!0,radius:2,style:{borderStyle:"dotted"},"diff-block-action":o.action,"data-block-note":"changed_from_style_".concat(a||"undefined"),children:(0,oZ.jsxs)(oK.Kq,{space:2,children:[(0,oZ.jsx)(f1,{annotations:[null==(i=o.origin.fields.style)?void 0:i.annotation],diff:o.origin.fields.style,children:(0,oZ.jsx)(oK.xv,{size:0,children:p("changes.portable-text.block-style-changed",{fromStyle:a,toStyle:l.style})})}),(0,oZ.jsx)(oK.xu,{style:e,children:f})]})})}return(0,oZ.jsx)("div",{onClick:m,"data-diff-block-action":o.action,"data-block-note":"changed_from_style_".concat(a||"undefined"),children:f})}var gx=Object.freeze,gv=Object.defineProperty,gy=(e,n)=>gx(gv(e,"raw",{value:gx(n||e.slice())}));let gb=(0,oV.ZP)(oK.xu)(tp||(tp=gy(["\n  &:not([hidden]) {\n    display: inline;
1\n    align-items: center;\n\n    &[data-changed] {\n      cursor: pointer;\n    }\n  }\n"]))),gj=(0,oV.ZP)(oK.xv)(th||(th=gy(["\n  &:not([hidden]) {\n    display: inline;\n    color: inherit;\n  }\n"]))),gw=(0,oV.ZP)(oK.xu)(tf||(tf=gy(["\n  &:not([hidden]) {\n    display: inline-flex;\n    align-items: center;\n\n    ",' [data-ui="Text"] {\n      opacity: 0.5;\n    }\n  }\n'])),gb),gk=(0,oV.ZP)(oK.xu)(tm||(tm=gy(["\n  min-width: 160px;\n  max-height: 40vh;\n  overflow-y: auto;\n"])));var gC=Object.freeze,g_=Object.defineProperty;let gT=oV.ZP.div(tg||(tg=gC(g_(g=["\n  text-decoration: none;\n  display: inline;\n  position: relative;\n  border: 0;\n  padding: 0;\n  border-bottom: 2px dotted currentColor;\n  box-shadow: inset 0 0 0 1px var(--card-border-color);\n  white-space: nowrap;\n  align-items: center;\n  background-color: color(var(--card-fg-color) a(10%));\n\n  &[data-changed] {\n    cursor: pointer;\n  }\n\n  &[data-removed] {\n    text-decoration: line-through;\n  }\n\n  &:hover "," {\n    opacity: 1;\n  }\n"],"raw",{value:gC(g.slice())}))),gw);function gS(e){let{children:n,diff:r,object:i,schemaType:a,path:o,...l}=e,{t:s}=dV();return a?r&&"unchanged"!==r.action?(0,oZ.jsx)(gE,{...l,diff:r,object:i,schemaType:a,path:o,children:n}):(0,oZ.jsx)(gT,{children:n}):(0,oZ.jsx)(gT,{...l,children:s("changes.portable-text.unknown-annotation-schema-type")})}function gE(e){let{diff:n,children:r,object:i,schemaType:a,path:o,...l}=e,{onSetFocus:s}=(0,oN.useContext)(dl),{path:c}=(0,oN.useContext)(md),[d,u]=(0,oN.useState)(null),{t:p}=dV(),h=f0(n,[]),f=(0,oN.useMemo)(()=>h?{background:h.background,color:h.text}:{},[h]),m="removed"===n.action,[g,x]=(0,oN.useState)(!1),v=i&&mO(i),y=(0,oN.useMemo)(()=>[o[0]].concat(["markDefs",{_key:i._key}]),[i._key,o]),b=(0,oN.useMemo)(()=>c.slice(0,c.findIndex(e=>(0,ll.Fd)(e)&&e._key===i._key)),[c,i._key]),j=(0,oN.useMemo)(()=>b.concat(o),[o,b]),w=(0,oN.useMemo)(()=>b.concat(y),[y,b]),k="field-".concat((0,o2.BB)(w)),C=di(),_=(0,oN.useMemo)(()=>C.filter(e=>{let[n]=e;return n.startsWith(k)}).length>0,[k,C]);(0,oN.useEffect)(()=>{!g&&_&&(x(!0),s(w))},[_,w,s,g]);let T=(0,oN.useCallback)(e=>{e.stopPropagation(),x(!0),m||(e.preventDefault(),s(j),setTimeout(()=>s(w),10))},[j,m,w,s]),S=(0,oN.useCallback)(()=>{_||x(!1)},[_]);(0,oK.O8)(S,[d]);let E="unchanged"!==n.action&&n.annotation||null,P=(0,oN.useMemo)(()=>E?[E]:[],[E]),O=(0,oZ.jsx)(md.Provider,{value:{path:w},children:(0,oZ.jsx)(gk,{padding:3,children:(0,oZ.jsxs)("div",{children:[v&&(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:p("changes.portable-text.empty-object-annotation",{annotationType:a.title||a.name})}),!v&&(0,oZ.jsx)(x3,{diff:n,schemaType:a})]})})});return(0,oZ.jsx)(gT,{...l,onClick:T,style:f,"data-changed":"","data-removed":"removed"===n.action?"":void 0,children:(0,oZ.jsx)(lr.J2,{content:O,open:g,ref:u,portal:!0,children:(0,oZ.jsx)(gw,{paddingLeft:1,children:(0,oZ.jsx)(f1,{annotations:P,description:p("changes.portable-text.annotation",{context:n.action}),children:(0,oZ.jsxs)(gb,{style:{display:"inline-flex"},children:[(0,oZ.jsx)("span",{children:r}),(0,oZ.jsx)(oK.kC,{align:"center",paddingX:1,children:(0,oZ.jsx)(gj,{size:0,children:(0,oZ.jsx)(lp.v4q,{})})})]})})})})})}var gP=Object.freeze,gO=Object.defineProperty;let gA=oV.ZP.span(tx||(tx=gP(gO(x=["\n  display: inline;\n  ","\n"],"raw",{value:gP(x.slice())}))),e=>{let{theme:n,decoration:r}=e;switch(r){case"strong":return"font-weight: bold;";case"em":return"font-style: italic;";case"underline":return"text-decoration: underline;";case"overline":return"text-decoration: overline;";case"strike-through":return"text-decoration: line-through;";case"code":return"\n          font-family: ".concat(n.sanity.fonts.code.family,";\n          background: ").concat(n.sanity.color.muted.default.enabled.bg,";\n        ");default:return""}});function gI(e){let{mark:n,children:r}=e;return(0,oZ.jsx)(gA,{decoration:n,children:r})}var gz=Object.freeze,gM=Object.defineProperty;let gR=(0,oV.ZP)(oK.Zb)(tv||(tv=gz(gM(v=["\n  &:not([hidden]) {\n    display: inline;\n    cursor: pointer;\n    white-space: nowrap;
1\n    align-items: center;\n\n    &[data-removed] {\n      text-decoration: line-through;\n    }\n\n    "," {\n      display: inline-flex;\n    }\n  }\n"],"raw",{value:gz(v.slice())}))),gb);function gF(e){let{diff:n,object:r,schemaType:i,...a}=e,{t:o}=dV();return i?n?(0,oZ.jsx)(gD,{...a,diff:n,object:r,schemaType:i}):(0,oZ.jsx)(gR,{children:(0,oZ.jsx)(AC,{schemaType:i,value:r,layout:"inline"})}):(0,oZ.jsx)(gR,{...a,border:!0,radius:1,children:o("changes.portable-text.unknown-inline-object-schema-type",{schemaType:r._type})})}function gD(e){let{diff:n,object:r,path:i,schemaType:a,...o}=e,{path:l}=(0,oN.useContext)(md),{onSetFocus:s}=(0,oN.useContext)(dl),{t:c}=dV(),d=f0(n,[]),u=(0,oN.useMemo)(()=>d?{background:d.background,color:d.text}:{},[d]),[p,h]=(0,oN.useState)(!1),f=r&&mO(r),m="removed"===n.action,g=l.slice(0,l.findIndex(e=>(0,ll.Fd)(e)&&e._key===r._key)).concat(i),x="field-".concat((0,o2.BB)(g)),v=di().filter(e=>{let[n]=e;return n.startsWith(x)}).length>0,y=l.slice(0,-1).concat(i).concat([o2.Zg]);(0,oN.useEffect)(()=>{v&&(h(!0),s(y))},[y,v,s]);let b=(0,oN.useCallback)(e=>{if(e.stopPropagation(),h(!0),!m){s(y);return}e.preventDefault()},[y,m,s]),j=(0,oN.useCallback)(()=>{h(!1)},[]),w=(0,oZ.jsx)(md.Provider,{value:{path:g},children:(0,oZ.jsx)(gq,{diff:n,emptyObject:f,onClose:j,schemaType:a})}),k="unchanged"!==n.action&&n.annotation||null;return(0,oZ.jsx)(gR,{...o,onClick:b,style:u,"data-removed":"removed"===n.action?"":void 0,border:!0,radius:2,children:(0,oZ.jsx)(lr.J2,{content:w,open:p,portal:!0,children:(0,oZ.jsx)(gw,{children:(0,oZ.jsx)(f1,{annotations:k?[k]:[],description:c("changes.portable-text.inline-object",{context:n.action}),children:(0,oZ.jsxs)(gb,{children:[(0,oZ.jsx)(AC,{schemaType:a,value:r,layout:"inline"}),(0,oZ.jsx)(oK.kC,{align:"center",paddingX:1,children:(0,oZ.jsx)(gj,{size:0,children:(0,oZ.jsx)(lp.v4q,{})})})]})})})})})}function gq(e){let{diff:n,emptyObject:r,onClose:i,schemaType:a}=e,{t:o}=dV(),[l,s]=(0,oN.useState)(null);return(0,oK.O8)(i,[l]),(0,oZ.jsxs)(gk,{ref:s,padding:3,children:[r&&(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:o("changes.portable-text.empty-inline-object",{inlineObjectType:a.title||a.name})}),!r&&(0,oZ.jsx)(x3,{diff:n,schemaType:a})]})}function gZ(e){let{diff:n,childDiff:r,children:i,path:a,segment:o,...l}=e,s=n||r;return s&&"unchanged"!==s.action&&"unchanged"!==o.action?(0,oZ.jsx)(gN,{...l,childDiff:r,diff:n,segment:o,path:a,children:i}):(0,oZ.jsx)(gb,{children:i})}function gN(e){let{diff:n,childDiff:r,children:i,path:a,segment:o,...l}=e,{onSetFocus:s}=(0,oN.useContext)(dl),{path:c}=(0,oN.useContext)(md),d=(0,oN.useMemo)(()=>a.slice(-2,1)[0],[a]),{t:u}=dV(),p=n&&"removed"===n.action,h=c.slice(0,c.findIndex(e=>(0,ll.Fd)(e)&&(0,ll.Fd)(d)&&e._key===d._key)).concat(a),f=(0,oN.useCallback)(e=>{e.stopPropagation(),p||(e.preventDefault(),s(h))},[h,p,s]),m=n&&n.segments.find(e=>e.text===o.text)||n||r,g=m&&"unchanged"!==m.action&&m.annotation||null,x=g&&"unchanged"!==o.action?(0,oZ.jsx)(f9,{annotation:g,as:"removed"===o.action?"del":"ins",tooltip:{description:u("changes.portable-text.text",{context:o.action})},children:i}):null;return(0,oZ.jsx)(gb,{...l,onClick:f,"data-changed":"",children:(0,oZ.jsx)("span",{children:(0,oZ.jsx)(oZ.Fragment,{children:x||i})})})}let gL=mm.map(e=>e[0]),gV=mm.map(e=>e[1]),gK=mf.map(e=>e[0]),gB=mf.map(e=>e[1]),gU=gL.concat(gK),gH=gV.concat(gB),g$=gL.concat(gV),gW=RegExp("".concat(g$.concat(gH).join("|")),"g");function gY(e){let{diff:n,schemaType:r}=e,i=n.origin.toValue||n.origin.fromValue,{t:a}=dV(),o=(0,oN.useMemo)(()=>n.origin.toValue?mE(n.origin):[],[n.origin]),l=(0,oN.useCallback)(e=>{let l=mC(r.fields,e),s=[];if(l){let e;s=m_(l);let c=n.fields.children,d=c.items[0].diff&&"object"===c.items[0].diff.type&&"string"===c.items[0].diff.fields.text.type&&c.items[0].diff.fields.text.segments||[],u=[],p={};if(1===i.children.length&&"span"===i.children[0]._type&&"string"==typeof i.children[0].text&&""===i.children[0].text&&"unchanged"!==n.origin.action&&("added"===n.origin.action||"removed"===n.origin.action)){let e=mk(n.origin,i.children[0])||n.origin;if(e&&"unchanged"!==e.action)return(0,oZ.jsx)(f9,{annotation:e.annotation,as:"removed"===e.action?"del":"ins",tooltip:{description:a("changes.portable-text.empty-text",{context:e.action})},children:(0,oZ.jsx)("span",{children:"↲"})},"empty-block-".concat(i._key))}let h=-1,f=-1,m=[],g=mA(n.origin);return d.forEach(c=>{var d,x,v,y,b,j,w;f++;let k=mg.includes(c.text),C=gU.includes(c.text),_=gH.includes(c.text),T=""===c.text,S="removed"===c.action;if(T)!S&&h++;else if(C||_){if(C&&gK.includes(c.text)){let e=g[gK.indexOf(c.text)];e&&m.push({mark:e._key,symbols:[c.text,gB[gK.indexOf(c.text)]],object:e})}_&&gB.includes(c.text)&&(e=m.pop())}
1else if(k){let e=mg.findIndex(e=>e===c.text),a=null==(d=o[e])?void 0:d._key,l=o[e];if(a){let e=mC(r.fields,l),a=mk(n.origin,l);u.push((0,oZ.jsx)(gF,{object:l,path:[{_key:i._key},"children",{_key:l._key}],diff:a,schemaType:e},"inline-object-".concat(l._key)))}}else if(c.text){let r=i.children[h]||(null==(y=n.origin.fromValue)?void 0:y.children.find(e=>e.text&&e.text.match(c.text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")))),o=r&&mP(n.origin,r);if(!r)throw Error("Could not find child");let d=(null==(x=null==o?void 0:o.fields)?void 0:x.text)?null==(v=null==o?void 0:o.fields)?void 0:v.text:void 0,g=(0,oZ.jsx)(gZ,{diff:d,path:[{_key:i._key},"children",{_key:r._key}],childDiff:o,segment:c,children:function(e){let{diff:n,child:r,decoratorTypes:i,seg:a,segIndex:o,spanSchemaType:l,t:s}=e;if("\n"===a.text)return(0,oZ.jsx)("br",{});let c=(0,oZ.jsx)("span",{children:a.text.replace(/ /g," ")},"text-".concat(o)),d=r&&mP(n.origin,r),u=(0,ll.NG)(r)&&r.marks||[];return d&&(c=function(e){var n;let{activeMarks:r,decoratorTypes:i,diff:a,children:o,seg:l,segIndex:s,spanDiff:c,spanSchemaType:d,t:u}=e,p=(0,oZ.jsx)("span",{children:o},"text-segment-".concat(s)),h=a.origin.fromValue&&a.fromValue&&a.fromValue.children[0].text||"",f=c&&"unchanged"!==c.action&&c.annotation||void 0,m=null==(n=null==c?void 0:c.fields)?void 0:n.marks,g=m&&"unchanged"!==m.action&&m.annotation||f,x=[],v=h.split("").filter(e=>!!e).join(""),y=v.substring(0,v.indexOf(l.text)+l.text.length),b=y.substring(0,y.indexOf(l.text)),j=[];return[...b.matchAll(gW)].forEach(e=>{var n;let r=e[0],a=mm.concat(mf).find(e=>e.indexOf(r)>-1);if(a){let e=(null==(n=i[r===a[0]?gL.indexOf(r):gV.indexOf(r)])?void 0:n.value)||r;b.lastIndexOf(r)>b.lastIndexOf(a[1])&&j.push(e)}}),x=sJ()(r,sz()(j)),g&&x.length>0&&x.some(e=>mT(e,d))&&(p=(0,oZ.jsx)(f9,{annotation:g,as:"ins",tooltip:{description:u("changes.portable-text.changed-formatting")},children:p},"diffcard-annotation-".concat(s,"-").concat(x.join("-")))),p}({activeMarks:u,decoratorTypes:i,diff:n,children:c,seg:a,segIndex:o,spanDiff:d,spanSchemaType:l,t:s})),u&&u.length>0&&u.forEach(e=>{mT(e,l)&&(c=(0,oZ.jsx)(gI,{mark:e,children:c},"decorator-".concat(e,"-").concat(r._key,"-").concat(o)))}),c}({diff:n,child:r,decoratorTypes:s,seg:c,segIndex:f,spanSchemaType:l,t:a})},"text-".concat(r._key,"-").concat(f));if(m.length>0&&m.forEach(e=>{p[e.mark]=p[e.mark]||[],p[e.mark].push(g)}),e){let a="annotation-".concat(e.object._key),o=u[u.length-1];if(o&&o.key!==a){let o=(b=n.origin,j=e.mark,b.fields.markDefs&&b.fields.markDefs.isChanged&&"array"===b.fields.markDefs.type&&(null==(w=b.fields.markDefs.items.find(e=>e.diff&&"object"===e.diff.type&&(e.diff.toValue&&e.diff.toValue._key&&e.diff.toValue._key===j||e.diff.fromValue&&e.diff.fromValue._key&&e.diff.fromValue._key===j)))?void 0:w.diff)||void 0),s=e&&l.annotations&&l.annotations.find(n=>e&&e.object&&n.name===e.object._type);u.push((0,oZ.jsx)(gS,{object:e.object,diff:o,path:[{_key:i._key},"children",{_key:r._key}],schemaType:s,children:(0,oZ.jsx)(oZ.Fragment,{children:p[e.mark]})},a))}e=void 0}0===m.length&&u.push(g)}}),oN.createElement("div",{key:i._key},...u)}throw Error("'span' schemaType not found")},[i,n,o,r,a]);return(0,oZ.jsx)(gg,{block:n.displayValue,diff:n,children:(0,oZ.jsx)(oZ.Fragment,{children:(n.displayValue.children||[]).map(e=>l(e))})})}var gX=Object.freeze,gG=Object.defineProperty;let gJ=oV.ZP.div(ty||(ty=gX(gG(y=["\n  word-wrap: break-word;\n"],"raw",{value:gX(y.slice())})))),gQ=e=>{let{value:n,schemaType:r}=e;return(0,oZ.jsx)(oK.xu,{as:gJ,padding:2,children:(0,oZ.jsx)(AC,{schemaType:r,value:n,layout:"default"})})};var g0=Object.freeze,g1=Object.defineProperty;let g2=oV.ZP.div(tb||(tb=g0(g1(b=["\n  display: inline-block;\n  word-break: break-all;\n  white-space: pre-wrap;\n"],"raw",{value:g0(b.slice())})))),g3=e=>{let{value:n}=e;return(0,oZ.jsx)(oK.xu,{as:g2,paddingX:2,paddingY:1,children:n})};var g4=Object.freeze,g5=Object.defineProperty;let g8=oV.ZP.div(tj||(tj=g4(g5(j=["\n  white-space: pre-wrap;\n  word-wrap: break-word;\n"],"raw",{value:g4(j.slice())})))),g6={block:e=>{let{diff:n,schemaType:r}=e,i=(0,oN.useMemo)(()=>(function(e,n){let r="removed"===e.action?e.fromValue:e.toValue,i={...e,origin:e,displayValue:r};if(r){let a={},o={},l={},s=mC(n.fields,{_key:"bogus",_type:"span"});
1s&&m_(s).forEach((e,n)=>{o[e.value]=mm[n]}),mA(i.origin).forEach((e,n)=>{a[e._key]=mf[n]}),mE(i.origin).forEach((e,n)=>{l[e._key]=mg[n]});let c=mS(i.origin,i.fromValue,o,a,l),d=mS(i.origin,i.toValue,o,a,l),u={...r,children:[{_type:"span",_key:"pseudoSpanKey",text:d,marks:[]}]},p={displayValue:r,children:[{_type:"span",_key:"pseudoSpanKey",text:c,marks:[]}]};return{origin:e,action:"changed",type:"object",displayValue:u,fromValue:p,toValue:u,isChanged:!0,fields:{children:{action:"changed",type:"array",isChanged:!0,items:[{diff:{action:"changed",type:"object",isChanged:!0,fields:{text:{type:"string",action:"changed",isChanged:!0,fromValue:c,toValue:d,segments:(function(e,n){let r=[],i=(0,sY.Hy)((0,sY.$T)(e,n)),a=0,o=0;for(let[l,s]of i)switch(l){case sY.JZ:r.push({type:"stringSegment",action:"unchanged",text:s}),a+=s.length,o+=s.length;break;case sY.NL:r.push({type:"stringSegment",action:"removed",text:e.substring(a,a+s.length),annotation:null}),a+=s.length;break;case sY.D$:r.push({type:"stringSegment",action:"added",text:n.substring(o,o+s.length),annotation:null}),o+=s.length}return lI()(r.map(e=>{let n=[];if(e.text.length>1){let r=[...e.text.matchAll(mj)],i=-1;r.forEach(a=>{let o=a.index||0;o>i&&(n.push({...e,text:e.text.substring(i+1,o)}),n.push({...e,text:a[0]})),a===r[r.length-1]&&n.push({...e,text:e.text.substring(o+1)}),i=o}),0===r.length&&n.push(e)}else n.push(e);return n}))})(c,d).map(e=>({...e,..."unchanged"!==i.action&&i.annotation?{annotation:i.annotation}:{}}))}},fromValue:p.children[0],toValue:u.children[0]},annotation:null,fromIndex:0,toIndex:0,hasMoved:!1}],fromValue:p.children,toValue:u.children}}}}throw Error("Can not display this diff")})(n,r),[n,r]);return(0,oZ.jsx)("div",{"data-diff-action":n.action,children:(0,oZ.jsx)(gY,{diff:i,schemaType:r})})},boolean:{component:e=>{let{diff:n,schemaType:r}=e,{fromValue:i,toValue:a}=n,{title:o,options:l}=r,s=(null==l?void 0:l.layout)==="checkbox"?mz:mM,c=f0(n,[]),d=null!=a;return(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(f1,{diff:n,children:(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(s,{checked:i,color:c}),d&&(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(oK.xu,{marginX:2,children:(0,oZ.jsx)(xg,{})}),(0,oZ.jsx)(s,{checked:a,color:c})]})]})}),d&&o&&(0,oZ.jsx)(oK.xu,{marginLeft:2,children:(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:o})})]})},showHeader:!1},date:mZ,datetime:mZ,file:e=>{var n,r;let{diff:i,schemaType:a}=e,{fromValue:o,toValue:l,fields:s}=i,c=null==o?void 0:o.asset,d=null==l?void 0:l.asset,{t:u}=dV(),p=mV(null==c?void 0:c._ref),h=mV(null==d?void 0:d._ref),f=h3({unitDisplay:"short",maximumFractionDigits:2}),m=Object.entries(s).filter(e=>{let[n,r]=e;return r.isChanged&&"_type"!==n}).map(e=>{let[n]=e;return n}),g=m.includes("asset"),x=a.fields.filter(e=>"asset"!==e.name&&m.includes(e.name)).map(e=>e.name),v=(n=null==p?void 0:p.size,r=null==h?void 0:h.size,n&&r?Math.round((r-n)/n*100):0),y=(null==p?void 0:p.size)&&mK(p.size,f),b=(null==h?void 0:h.size)&&mK(h.size,f),j=(0,oN.useMemo)(()=>({display:"block",flex:1}),[]),w=p&&(0,oZ.jsx)(f9,{as:"del",diff:i,path:"asset._ref",style:j,children:(0,oZ.jsx)(vi,{title:p.originalFilename||u("changes.file.meta-info-fallback-title"),icon:lp.$lS,children:(0,oZ.jsx)(oK.xv,{size:0,style:{color:"inherit"},children:y})})}),k=h&&(0,oZ.jsx)(f9,{as:"ins",diff:i,path:"asset._ref",style:j,children:(0,oZ.jsx)(vi,{title:h.originalFilename||u("changes.file.meta-info-fallback-title"),icon:lp.$lS,children:(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(oK.xv,{size:0,style:{color:"inherit"},children:b}),0!==v&&(0,oZ.jsx)(oK.Zb,{radius:2,padding:1,as:mH,marginLeft:2,children:(0,oZ.jsxs)(oK.xv,{size:0,"data-number":v>0?"positive":"negative",children:[v>0?"+":"-",v,"%"]})})]})})}),C=(0,oZ.jsxs)(oZ.Fragment,{children:[w&&!k&&(0,oZ.jsx)(f1,{diff:i,path:"asset._ref",description:u("changes.removed-label"),children:w}),w&&k&&(0,oZ.jsx)(f1,{diff:i,path:"asset._ref",children:(0,oZ.jsx)(xO,{from:w,layout:"grid",to:k})}),!w&&k&&(0,oZ.jsx)(f1,{diff:i,path:"asset._ref",description:u("changes.added-label"),children:k})]});return(0,oZ.jsxs)(oZ.Fragment,{children:[g&&C,x.length>0&&(0,oZ.jsx)(oK.xu,{marginTop:g?4:3,children:(0,oZ.jsx)(x3,{diff:i,schemaType:a,fields:x})})]})},image:e=>{var n,r;let{diff:i,schemaType:a}=e,{t:o}=dV(),{fromValue:l,toValue:s,fields:c,isChanged:d}=i,u=null==(n=null==l?void 0:l.asset)?void 0:n._ref,p=null==(r=null==s?void 0:s.asset)?void 0:r._ref,h=fQ(i,["asset","_ref"]),f=Object.keys(c).filter(e=>c[e].isChanged&&"_type"!==e),m=a.fields.filter(e=>!m8.includes(e.name)&&f.includes(e.name)).map(e=>e.name),g="changed";!u&&p?g="added":!p&&u&&(g="removed");let x=f.includes("asset"),v=f.includes("crop"),y=f.includes("hotspot"),b=v||y,j=x||b,w=b&&!x,k=l&&u?(0,oZ.jsx)(f9,{annotation:h,style:m6,children:(0,oZ.jsx)(m5,{is:"from",id:u,diff:i,action:g,hotspot:w&&y?l.hotspot:void 0,crop:w&&v?l.crop:void 0})}):(0,oZ.jsx)(m1,{}),C=s&&p?(0,oZ.jsx)(f9,{annotation:h,style:m6,children:(0,oZ.jsx)(m5,{is:"to",id:p,diff:i,hotspot:w&&y?s.hotspot:void 0,crop:w&&v?s.crop:void 0})}):(0,oZ.jsx)(m1,{});if(!k&&!C)return(0,oZ.jsx)(oK.Zb,{padding:4,radius:2,tone:"transparent",children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,align:"center",children:o("changes.image.no-asset-set")})});if(!d)return p?(0,oZ.jsx)(f9,{annotation:h,style:m6,children:(0,oZ.jsx)(m5,{id:p,is:"to",diff:i})}):null;let _=(0,oZ.jsx)(xO,{align:"center",from:k,layout:"grid",to:C});return(0,oZ.jsxs)(oZ.Fragment,{children:[j&&(x?(0,oZ.jsx)(f1,{annotations:h?[h]:[],description:function(e,n){switch(e){case"changed":return n("changes.changed-label");case"added":return n("changes.added-label");case"removed":return n("changes.removed-label");default:return"Unknown change"}}(g,o),children:_}):_),m.length>0&&(0,oZ.jsx)(oK.xu,{marginTop:j?4:3,children:(0,oZ.jsx)(x3,{diff:i,schemaType:a,fields:m})})]})},number:e=>{let{diff:n,schemaType:r}=e;return(0,oZ.jsx)(xI,{diff:n,schemaType:r,previewComponent:gt,layout:"inline"})},reference:e=>{let{diff:n,schemaType:r}=e;return(0,oZ.jsx)(xI,{align:"center",diff:n,layout:"grid",path:"_ref",previewComponent:gQ,schemaType:r})}
1,string:e=>{let{diff:n,schemaType:r}=e,{options:i}=r;return(null==i?void 0:i.list)?(0,oZ.jsx)(xI,{diff:n,previewComponent:g3,schemaType:r}):(0,oZ.jsx)(g8,{children:(0,oZ.jsx)(ve,{diff:n})})}};function g9(e,n){var r;let i=e;for(;i;){let e=(null==(r=null==i?void 0:i.components)?void 0:r.diff)||function(e,n){let r;for(let i of mI){if("function"!=typeof i){console.error("Diff component resolver is not a function: ",i);continue}if(r=i({schemaType:e,parentSchemaType:n}))return r}}(i,n)||g6[i.name];if(e)return e;i=i.type}return g6[["date","datetime"].includes(e.name)?e.name:e.jsonType]}function g7(e){return"field"===e.type}function xe(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(!g9(e,a.parentSchema)){if("object"===e.jsonType&&"object"===n.type)return xt(e,n,r,i,a);if("array"===e.jsonType&&"array"===n.type)return function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=n.items.filter(e=>e.hasMoved&&e.fromIndex!==e.toIndex||"unchanged"!==e.diff.action);if(0===a.length)return[];let o=e.of.some(mw),l=a.reduce((a,l)=>{var s;let c="added"===(s=l.diff).action?{toType:mh(e,s.toValue)}:"changed"===s.action?{fromType:mh(e,s.fromValue),toType:mh(e,s.toValue)}:"removed"===s.action?{fromType:mh(e,s.fromValue)}:{toType:mh(e,s.toValue)},d=c.toType||c.fromType;if(!d)return console.warn("Could not determine schema type for item at %s",fH(r)),a;let u=fG(l.diff.fromValue)||fG(l.diff.toValue)||n.items.indexOf(l),p=r.concat(u),h={itemDiff:l,parentDiff:n,parentSchema:e},f=i.concat({hasMoved:l.hasMoved,toIndex:l.toIndex,fromIndex:l.fromIndex,annotation:"unchanged"===l.diff.action?l.annotation:l.diff.annotation}),m=xe(d,l.diff,p,f,h).map(e=>("field"===e.type&&fY(p,e.path)&&(e.itemDiff=l),e));
1return o&&m.filter(g7).forEach((e,n,r)=>{e.showHeader=1===r.length,e.showIndex=l.fromIndex!==l.toIndex&&l.hasMoved}),0===m.length?a.push(...xn(d,l.diff,p,f,h)):a.push(...m),a},[]);return l.length>1?[{type:"group",key:fH(r)||"root",path:r,titlePath:i,changes:xr(l,i.length),schemaType:e}]:l}(e,n,r,i)}return xn(e,n,r,i,a)}function xt(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=[],l={...a,parentSchema:e};for(let a of e.fieldsets||e.fields.map(e=>({single:!0,field:e})))a.single?o.push(...function(e,n,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},{fieldFilter:o,...l}=a,s=n.fields[e.name];if(!s||!s.isChanged||o&&!o.includes(e.name))return[];let c=r.concat([e.name]),d=i.concat([e.type.title||e.name]);return xe(e.type,s,c,d,l)}(a.field,n,r,i,l)):o.push(...function(e,n,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},{fields:o,name:l,title:s,readOnly:c,hidden:d}=e,{fieldFilter:u,...p}=a,h=i.concat([s||l]),f=[];for(let e of o){let i=n.fields[e.name];if(!i||!i.isChanged||u&&!u.includes(e.name))continue;let a=r.concat([e.name]),o=h.concat([e.type.title||e.name]);f.push(...xe({readOnly:c,hidden:d,...e.type},i,a,o,p))}return f.length<2?f:[{type:"group",key:fH(r)||"root",fieldsetName:l,path:r,titlePath:h,changes:xr(f,h.length),readOnly:c,hidden:d}]}(a,n,r,i,l));return o.length<2?o:[{type:"group",key:fH(r)||"root",path:r,titlePath:i,changes:xr(o,i.length),schemaType:e}]}function xn(e,n,r,i){let a,o,{itemDiff:l,parentDiff:s,parentSchema:c}=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},{fromValue:d,toValue:u,type:p}=n;if("array"===p&&xi(d)&&xi(u))return[];void 0!==d&&(a=mp(d,e)),a||void 0===u||(a=mp(u,e));let h=!0,f=g9(e,c);return f&&"function"==typeof f?o=f:f&&(o=f.component,h=void 0===f.showHeader?h:f.showHeader),[{type:"field",diff:n,path:r,error:a,itemDiff:l,parentDiff:s,titlePath:i,schemaType:e,showHeader:h,showIndex:!0,key:fH(r)||"root",diffComponent:a?void 0:o,parentSchema:c}]}function xr(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.map(e=>(e.titlePath=e.titlePath.slice(n),e))}function xi(e){return Array.isArray(e)&&0===e.length||null==e}let xa=e=>"field"===e.type&&"added"===e.diff.action,xo=e=>{if("group"!==e.type)return[e];let n=[];
1return e.changes.forEach(e=>{n.push(...xo(e))}),n},xl=(e,n)=>{if(n.length>=e.length)return!1;for(let r=0;r<n.length;r++)if(n[r]!==e[r])return!1;return!0},xs=(e,n)=>{let r=fX(e[n]);return r?{_key:r}:Array.isArray(e)?parseInt(n,10):n},xc={diffMatchPatch:{enabled:!1,lengthThresholdAbsolute:30,lengthThresholdRelative:1.2}};function xd(e,n,r){if(!n)return;let i=[];if("group"===e.type){let a=xo(e),o=a.filter(xa);a.filter(e=>!xa(e)).forEach(e=>xd(e,n,r)),i.push(...xu(n,o.map(e=>e.path).reverse()))}else"added"===e.diff.action?i.push(...xu(n,[e.path])):"field"===e.type&&e.itemDiff&&e.parentDiff&&"array"===e.parentDiff.type&&e.itemDiff.hasMoved?i.push(...function(e,n,r){let i;let a=r.slice(0,-1),{parentValue:o,fromIndex:l,fromValue:s}=function(e,n){if(e.fromValue&&"number"==typeof n.fromIndex){let r=e.fromValue[n.fromIndex];return{parentValue:e.fromValue,fromIndex:n.fromIndex,fromValue:r}}throw Error("Failed to find item at index ".concat(n.fromIndex))}(n,e);if(0===l)i={before:fH([...a,0])};else{let e=l-1;i={after:fH([...a,fG(o[e])||e])}}return[{unset:[fH(r)]},{insert:{...i,items:[s]}}]}(e.itemDiff,e.parentDiff,e.path)):i.push(...function(e,n,r){let i=(0,sQ.C)(e.toValue,e.fromValue,xc,r),a=i.filter(e=>"insert"===e.op).map(e=>{let{after:n,items:r}=e;return{insert:{after:fH(n),items:r}}}),o=i.filter(e=>"unset"===e.op).reduce((e,n)=>e.concat(fH(n.path)),[]),l=new Set,s=[],c=!1,d=i.filter(e=>"set"===e.op).reduce((e,r)=>(c=!0,s.push(...function(e,n,r){let i=n.fromValue,a=n.toValue,o=[];for(let n=1;n<=e.length;n++){let l=e.slice(0,n),s=fH(l);if(r.has(s))continue;let c=e[n],d=(0,ll.Fd)(c)||(0,ll.dw)(c),u=f$(i,l),p=xp(u);if(d&&Array.isArray(u)&&!f$(a,e.slice(0,n+1))){let e=function(e,n){return"number"==typeof n||(0,ll.Fd)(n)?"number"==typeof n?n:e.findIndex(e=>(0,ll.fU)(e)&&e._key===n._key):-1}(u,c),r=u[e-1],a=f$(i,l.concat(c)),d=(0,ll.fU)(r)?{_key:r._key}:e-1,p=fH(l.concat(e<1?0:d));o.push({setIfMissing:{[s]:[]}}),o.push({insert:{after:p,items:[xp(a)]}}),n++;continue}void 0!==p&&(r.add(s),o.push({setIfMissing:{[s]:p}}))}return o}(r.path,n,l)),e[fH(r.path)]=r.value,e),{});return[...s,...a,...o.length>0?[{unset:o}]:[],...c?[{set:d}]:[]]}(e.diff,n,e.path));r.patch.execute(i)}function xu(e,n){let r=[];for(let a=0;a<n.length;a++){var i;r.some(e=>xl(n[a],e))||r.push((i=n[a],function e(n,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=arguments.length>3?arguments[3]:void 0;if(r.length<=0){if(!a)throw Error("Root has no ancestor");return a}let o=r.slice(0,-1),l=f$(n,o),s=[o,...i.filter(e=>!xl(e,o))];return!function e(n,r,i){let a=null==i?void 0:i.some(e=>fH(e)===fH(r)),o=Array.isArray(n)&&n.length<=0;return a||null==n||o||"object"==typeof n&&null!==n&&Object.keys(n).length<=0||function(n,r,i){if(!dj(n)||!Array.isArray(n))return!1;for(let a in n){if(!Object.prototype.hasOwnProperty.call(n,a)||"_type"===a||"_key"===a)continue;let o=[...r,xs(n,a)];if(!e(n[a],o,i))return!1}return!0}(n,r,i)}(l,o,i)?r:e(n,o,s,a)}(e.toValue,i,n)))}return[{unset:[...new Set(r.map(fH))]}]}function xp(e){if(Array.isArray(e))return[];if("object"!=typeof e||null===e)return;let n={};return(0,ll.fU)(e)&&(n._key=e._key),(0,ll.ay)(e)&&(n._type=e._type),n}let xh=!1;class xf extends oN.Component{constructor(){super(...arguments),this.state={}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e){console.error("Error rendering diff component: "),console.error(e)}render(){let{t:e}=this.props,{error:n}=this.state;return n?(0,oZ.jsx)(oK.Zb,{padding:3,radius:2,tone:"critical",children:(0,oZ.jsxs)(oK.kC,{children:[(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(lp.uIy,{})}),(0,oZ.jsxs)(oK.xu,{paddingLeft:3,children:[(0,oZ.jsx)(oK.xv,{as:"h3",size:1,weight:"medium",children:e("changes.error-boundary.title")}),xh&&(0,oZ.jsx)(oK.xu,{marginTop:2,children:(0,oZ.jsx)(oK.xv,{as:"p",size:1,children:e("changes.error-boundary.developer-info")})})]})]})}):this.props.children}}let xm={down:lp.veu,right:lp.LZ3};function xg(e){let{direction:n="right",...r}=e,i=xm[n];return(0,oZ.jsx)(oK.xv,{muted:!0,size:1,...r,children:(0,oN.createElement)(i)})}var xx=Object.freeze,xv=Object.defineProperty,xy=(e,n)=>xx(xv(e,"raw",{value:xx(n||e.slice())}));let xb=oV.ZP.pre(tw||(tw=xy(["\n  overflow-x: auto;\n  position: relative;\n"]))),xj=oV.ZP.div(tk||(tk=xy(["\n  position: absolute;\n  top: 0;\n  right: 0;\n"])));function xw(e){let{children:n,as:r,change:i,...a}=e,o=(0,oN.useRef)(!1),[l,s]=(0,oN.useState)(!1),c=(0,oN.useCallback)(()=>s(e=>!e),[s]),d=(0,oN.useCallback)(()=>o.current=!0,[]),u=(0,oN.useCallback)(()=>o.current=!1,[o]);return(0,oN.useEffect)(()=>{function e(e){let{metaKey:n,key:r}=e;n&&"i"===r&&o.current&&c()}return window.addEventListener("keydown",e,!1),()=>window.removeEventListener("keydown",e,!1)},[c]),(0,oZ.jsx)(oK.xu,{as:r,onMouseEnter:d,onMouseLeave:u,...a,children:l?(0,oZ.jsx)(xC,{change:i}):n})}let xk=e=>{let{title:n}=e;return(0,oZ.jsx)(oK.xu,{padding:3,display:"inline-block",as:xj,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:n})})};function xC(e){var n,r,i;let{change:a}=e,{t:o}=dV();return(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsxs)(oK.Zb,{padding:3,tone:"transparent",as:xb,radius:1,children:[(0,oZ.jsx)(xk,{title:o("changes.inspector.meta-label")}),(0,oZ.jsx)(oK.EK,{language:"json",size:1,children:function(e){let n=[];
1return Object.entries(e).forEach(e=>{let[r,i]=e;null!=i&&n.push("".concat(r,": ").concat(i))}),n.join("\n")}({path:fH(a.path),fromIndex:null==(n=a.itemDiff)?void 0:n.fromIndex,toIndex:null==(r=a.itemDiff)?void 0:r.toIndex,hasMoved:null==(i=a.itemDiff)?void 0:i.hasMoved,action:a.diff.action,isChanged:a.diff.isChanged})})]}),(0,oZ.jsxs)(oK.Zb,{as:xb,tone:"critical",padding:3,radius:1,children:[(0,oZ.jsx)(xk,{title:o("changes.inspector.from-label")}),(0,oZ.jsx)(oK.EK,{language:"json",size:1,children:x_(a.diff.fromValue)})]}),(0,oZ.jsx)(oK.Zb,{children:(0,oZ.jsx)(xg,{direction:"down",align:"center"})}),(0,oZ.jsxs)(oK.Zb,{as:xb,tone:"positive",padding:3,radius:1,children:[(0,oZ.jsx)(xk,{title:o("changes.inspector.to-label")}),(0,oZ.jsx)(oK.EK,{language:"json",size:1,children:x_(a.diff.toValue)})]})]})}function x_(e){return void 0===e?"undefined":JSON.stringify(e,null,2)}function xT(e){return null!=e&&""!==e}let xS={flexShrink:0},xE={alignItems:"stretch"},xP={top:"flex-start",center:"center",bottom:"flex-end",default:"flex-start"},xO=(0,oN.forwardRef)(function(e,n){let{align:r="top",layout:i="inline",from:a,to:o,style:l,...s}=e,c=(0,oK.Fg)(),d="inline"===i?oK.kC:oK.rj,u=(0,oN.useMemo)(()=>({...l,..."inline"===i?{maxWidth:"100%",display:"inline-flex"}:{gridTemplateColumns:"minmax(0, 1fr) ".concat((0,oK.hO)(c.sanity.space[5])," minmax(0, 1fr)")}}),[i,l,c]),p="inline"===i?xS:xE;return(0,oZ.jsxs)(d,{...s,ref:n,style:u,"data-from-to-layout":!0,children:[a&&(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(oK.kC,{align:xP[r],style:p,children:a}),(0,oZ.jsx)(oK.kC,{align:"center",justify:"center",padding:2,children:(0,oZ.jsx)(xg,{})})]}),(0,oZ.jsx)(oK.kC,{align:xP[r],style:p,children:o})]})}),xA={flex:1,minWidth:0,display:"block",whiteSpace:"break-spaces"};function xI(e){let{align:n,cardClassName:r,diff:i,layout:a,path:o,previewComponent:l,schemaType:s}=e,{action:c}=i,d=function(e){let{t:n}=dV(),r=xT(e.fromValue),i=xT(e.toValue);return n(!r&&i?"changes.added-label":!i&&r?"changes.removed-label":"changes.changed-label")}(i);if("unchanged"===c)return(0,oZ.jsx)(f9,{className:r,style:xA,children:(0,oN.createElement)(l,{schemaType:s,value:i.toValue})});let u=void 0!==i.fromValue&&null!==i.fromValue&&(0,oZ.jsx)(f9,{as:"del",className:r,diff:i,path:o,style:xA,children:(0,oN.createElement)(l,{schemaType:s,value:i.fromValue})}),p=void 0!==i.toValue&&null!==i.toValue&&(0,oZ.jsx)(f9,{as:"ins",className:r,diff:i,path:o,style:xA,children:(0,oN.createElement)(l,{schemaType:s,value:i.toValue})});return u&&!p?(0,oZ.jsx)(f1,{description:d,diff:i,path:o,children:u}):!u&&p?(0,oZ.jsx)(f1,{description:d,diff:i,path:o,children:p}):(0,oZ.jsx)(f1,{description:d,diff:i,path:o,children:(0,oZ.jsx)(xO,{align:n,from:u,layout:a,to:p})})}let xz=e=>{let{value:n,schemaType:r}=e;return(0,oZ.jsx)(oK.xu,{padding:2,children:(0,oZ.jsx)(AC,{schemaType:r,value:n,layout:"default"})})},xM=e=>{let{diff:n,schemaType:r}=e;return(0,oZ.jsx)(xI,{diff:n,schemaType:r,previewComponent:xz,layout:"grid"})};var xR=Object.freeze,xF=Object.defineProperty;let xD=(0,oV.ZP)(lr.zx)(tC||(tC=xR(xF(w=["\n  [data-ui='Text'] {\n    font-weight: normal;\n  }\n\n  div[data-ui='Box'] {\n    display: none;\n  }\n\n  &:not([data-disabled='true']):hover,\n  &:not([data-disabled='true']):focus {\n    --card-fg-color: ",";\n    --card-bg-color: transparent;\n    --card-border-color: transparent;\n\n    div[data-ui='Box'] {\n      display: block;\n    }\n  }\n"],"raw",{value:xR(w.slice())}))),e=>{let{theme:n}=e;return n.sanity.color.solid.critical.enabled.bg}),xq=(0,oN.forwardRef)(function(e,n){let{selected:r,changeCount:i,...a}=e,{t:o}=dV();return(0,oZ.jsx)(xD,{icon:lp.V13,selected:r,text:o("changes.action.revert-changes-confirm-change",{count:i}),mode:"bleed",ref:n,tooltipProps:null,...a})});function xZ(e){let{error:n}=e,{t:r}=dV();return(0,oZ.jsx)(oK.Zb,{tone:"critical",padding:3,children:(0,oZ.jsxs)(oK.kC,{align:"flex-start",children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{children:(0,oZ.jsx)(lp.uIy,{})})}),(0,oZ.jsx)(oK.xu,{flex:1,paddingLeft:3,children:(0,oZ.jsx)(oK.xv,{size:1,as:"p",children:r(n.messageKey,{expectedType:n.expectedType,actualType:n.actualType})})})]})})}var xN=Object.freeze,xL=Object.defineProperty,xV=(e,n)=>xN(xL(e,"raw",{value:xN(n||e.slice())}));let xK=oV.ZP.div(t_||(t_=xV(["\n  --field-change-error: ",";\n  &[data-revert-all-changes-hover] [data-revert-all-hover]::before {\n    border-left: 2px solid var(--field-change-error);\n  }\n"])),e=>{let{theme:n}=e;return n.sanity.color.solid.critical.enabled.bg}),xB=oV.ZP.div(tT||(tT=xV(["\n  --field-change-error: ",";\n  --diff-inspect-padding-xsmall: ",";\n  --diff-inspect-padding-small: ",";\n\n  position: relative;\n  padding: var(--diff-inspect-padding-xsmall) 0 var(--diff-inspect-padding-xsmall)\n    var(--diff-inspect-padding-small);\n\n  &::before {\n    content: '';\n    display: block;\n    position: absolute;\n    top: 0;\n    left: 0;\n    bottom: 0;\n    border-left: 1px solid var(--card-border-color);\n  }\n\n  &[data-error]:hover::before,\n  &[data-revert-field-hover]:hover::before {\n    border-left: 2px solid var(--field-change-error);\n  }\n"])),e=>{let{theme:n}=e;return n.sanity.color.solid.critical.enabled.bg},e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.space[1])},e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.space[2])});function xU(e){var n;let{change:r,hidden:i,readOnly:a}=e,o=r.diffComponent||xM,{documentId:l,schemaType:s,rootDiff:c,isComparingCurrent:d,FieldWrapper:u=oN.Fragment}=mL(),p=hH(l,s.name),[h,f]=(0,oN.useState)(!1),[m,g]=(0,oN.useState)(!1),[x,v]=(0,oN.useState)(null),{t:y}=dV(),[b,j]=I9({id:l,type:s.name,permission:"update"}),w=(0,oN.useCallback)(()=>{xd(r,c,p)},[r,c,p]),k=(0,oN.useCallback)(()=>{f(!0)},[]),C=oN.useCallback(()=>{f(!1)},[]),_=(0,oN.useCallback)(()=>{g(!0)},[]),T=(0,oN.useCallback)(()=>{g(!1)},[]),S=(0,oN.useCallback)(()=>f(!1),[]);(0,oK.O8)(S,[x]);let E=(null==(n=r.parentSchema)?void 0:n.jsonType)==="array"?r.path.slice(0,-1):r.path;return(0,oN.useMemo)(()=>i?null:(0,oZ.jsxs)(oK.Kq,{space:1,as:xK,children:[r.showHeader&&(0,oZ.jsx)(ms,{change:r,titlePath:r.titlePath}),(0,oZ.jsx)(u,{path:E,hasHover:m,children:(0,oZ.jsxs)(xw,{change:r,as:xB,"data-revert-field-hover":m?"":void 0,"data-error":r.error?"":void 0,"data-revert-all-hover":!0,children:[r.error?(0,oZ.jsx)(xZ,{error:r.error}):(0,oZ.jsx)(xf,{t:y,children:(0,oZ.jsx)(md.Provider,{value:{path:r.path},children:(0,oZ.jsx)(o,{diff:r.diff,schemaType:r.schemaType})})}),d&&!j&&(null==b?void 0:b.granted)&&(0,oZ.jsx)(lr.J2,{content:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xu,{paddingY:3,children:(0,oZ.jsx)(oK.xv,{size:1,children:y("changes.action.revert-changes-description",{count:1})})}),(0,oZ.jsxs)(oK.kC,{gap:3,justify:"flex-end",children:[(0,oZ.jsx)(lr.zx,{mode:"ghost",onClick:C,text:y("changes.action.revert-all-cancel")}),(0,oZ.jsx)(lr.zx,{tone:"critical",onClick:w,text:y("changes.action.revert-changes-confirm-change",{count:1})})]})]}),open:h,padding:3,portal:!0,placement:"left",ref:v,children:(0,oZ.jsx)(xq,{changeCount:1,onClick:k,onMouseEnter:_,onMouseLeave:T,selected:h,disabled:a,"data-testid":"single-change-revert-button-".concat(null==r?void 0:r.key)})})]})})]}),[r,C,h,o,E,u,_,T,w,k,i,d,j,null==b?void 0:b.granted,a,m,y])}
1var xH=Object.freeze,x$=Object.defineProperty,xW=(e,n)=>xH(x$(e,"raw",{value:xH(n||e.slice())}));let xY=oV.ZP.div(tS||(tS=xW(["\n  display: grid;\n  grid-template-columns: minmax(0, 1fr);\n"]))),xX=oV.ZP.div(tE||(tE=xW(["\n  --field-change-error: ",";\n  --diff-inspect-padding-xsmall: ",";\n  --diff-inspect-padding-small: ",";\n\n  position: relative;\n  padding: var(--diff-inspect-padding-xsmall) var(--diff-inspect-padding-small);\n\n  &::before {\n    content: '';\n    display: block;\n    position: absolute;\n    top: 0;\n    left: 0;\n    bottom: 0;\n    border-left: 1px solid var(--card-border-color);\n  }\n\n  &[data-error]:hover::before,\n  &[data-revert-group-hover]:hover::before,\n  &[data-revert-all-groups-hover]::before {\n    border-left: 2px solid var(--field-change-error);\n  }\n"])),e=>{let{theme:n}=e;return n.sanity.color.solid.critical.enabled.bg},e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.space[1])},e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.space[2])});function xG(e){let{change:n,readOnly:r,hidden:i,...a}=e,{titlePath:o,changes:l,path:s}=n,{path:c}=(0,oN.useContext)(md),{documentId:d,schemaType:u,FieldWrapper:p,rootDiff:h,isComparingCurrent:f}=mL(),{t:m}=dV(),g=l.every(e=>g7(e)&&mw(e.schemaType)),x=fY(c,s),[v,y]=function(){let e=(0,oN.useRef)(null),[n,r]=(0,oN.useState)(!1);return(0,oN.useEffect)(()=>{let n=e.current;if(!n)return()=>void 0;let i=()=>r(!0),a=()=>r(!1);return n.addEventListener("mouseover",i),n.addEventListener("mouseout",a),()=>{n.removeEventListener("mouseover",i),n.removeEventListener("mouseout",a)}},[]),[e,n]}(),b=hH(d,u.name),[j,w]=(0,oN.useState)(!1),[k,C]=(0,oN.useState)(null),[_,T]=I9({id:d,type:u.name,permission:"update"}),S=(0,oN.useCallback)(()=>xd(n,h,b),[n,h,b]),E=(0,oN.useCallback)(()=>{w(!0)},[]),P=(0,oN.useCallback)(()=>{w(!1)},[]);(0,oK.O8)(()=>w(!1),[k]);let O=(0,oN.useMemo)(()=>i?null:(0,oZ.jsxs)(oK.Kq,{space:1,as:xX,"data-revert-group-hover":y?"":void 0,"data-portable-text":g?"":void 0,children:[(0,oZ.jsx)(oK.Kq,{as:xY,space:5,children:l.map(e=>(0,oZ.jsx)(xJ,{change:e,readOnly:r,hidden:i},e.key))}),f&&!T&&(null==_?void 0:_.granted)&&(0,oZ.jsx)(lr.J2,{content:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xu,{paddingY:3,children:(0,oZ.jsx)(oK.xv,{size:1,children:m("changes.action.revert-changes-description",{count:l.length})})}),(0,oZ.jsxs)(oK.kC,{gap:3,justify:"flex-end",children:[(0,oZ.jsx)(lr.zx,{mode:"ghost",onClick:P,text:m("changes.action.revert-all-cancel")}),(0,oZ.jsx)(lr.zx,{tone:"critical",onClick:S,text:m("changes.action.revert-changes-confirm-change",{count:1})})]})]}),padding:3,portal:!0,placement:"left",open:j,ref:C,children:(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(xq,{changeCount:l.length,onClick:E,ref:v,selected:j,disabled:r,"data-testid":"group-change-revert-button-".concat(n.fieldsetName)})})})]}),[l,P,j,n.fieldsetName,S,E,i,f,T,g,y,null==_?void 0:_.granted,r,v,m]);return i?null:(0,oZ.jsxs)(oK.Kq,{space:1,...a,children:[(0,oZ.jsx)(ms,{titlePath:o}),x||!p?O:(0,oZ.jsx)(p,{hasHover:y,path:n.path,children:O})]})}function xJ(e){var n,r;let{change:i,hidden:a,readOnly:o}=e,{value:l}=mL(),s=mc({document:l,checkProperty:a||(null==(n=i.schemaType)?void 0:n.hidden),checkPropertyKey:"hidden",value:"field"===i.type?i.diff.toValue:void 0}),c=mc({document:l,checkProperty:o||(null==(r=i.schemaType)?void 0:r.readOnly),checkPropertyKey:"readOnly",value:"field"===i.type?i.diff.toValue:void 0});return s?null:"field"===i.type?(0,oZ.jsx)(xU,{change:i,readOnly:c}):"group"===i.type?(0,oZ.jsx)(xG,{change:i,"data-testid":"group-change-".concat(i.fieldsetName),readOnly:c}):(0,oZ.jsxs)(oK.xv,{children:["Unknown change type: ",(0,oZ.jsx)("code",{children:i.type||"undefined"})]})}function xQ(){let{t:e}=dV();return(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",as:"h3",children:e("changes.no-changes-title")}),(0,oZ.jsx)(oK.xv,{as:"p",size:1,muted:!0,children:e("changes.no-changes-description")})]})}var x0=Object.freeze,x1=Object.defineProperty;let x2=oV.ZP.div(tP||(tP=x0(x1(k=["\n  display: grid;\n  grid-template-columns: minmax(0, 1fr);\n"],"raw",{value:x0(k.slice())}))));function x3(e){let{diff:n,fields:r,schemaType:i}=e,{documentId:a,isComparingCurrent:o,value:l}=mL(),s=hH(a,i.name),{path:c}=(0,oN.useContext)(md),d=0===c.length,[u,p]=(0,oN.useState)(!1),[h,f]=(0,oN.useState)(!1),{t:m}=dV(),g=mc({document:l,value:void 0,checkProperty:i.readOnly,checkPropertyKey:"readOnly"});if("object"!==i.jsonType)throw Error("Only object schema types are allowed in ChangeList");let[x,v]=I9({id:a,type:i.name,permission:"update"}),y=(0,oN.useMemo)(()=>xt(i,n,c,[],{fieldFilter:r}),[i,r,c,n]),b=(0,oN.useMemo)(()=>r&&0===r.length?[]:1===y.length&&"group"===y[0].type&&0===y[0].path.length?y[0].changes:y,[y,r]),j=y[0],w=(0,oN.useCallback)(()=>{xd(j,n,s),p(!1)},[j,n,s]),k=(0,oN.useCallback)(()=>{p(!0)},[]),C=(0,oN.useCallback)(()=>{f(!0)},[]),_=(0,oN.useCallback)(()=>{f(!1)},[]),T=(0,oN.useCallback)(()=>{p(!1)},[]),[S,E]=(0,oN.useState)(null),P=(0,oN.useCallback)(()=>p(!1),[]);if((0,oK.O8)(P,[S]),0===b.length)return d?(0,oZ.jsx)(xQ,{}):null;let O=d&&b.length>1;return(0,oZ.jsx)(oK.Zb,{children:(0,oZ.jsxs)(oK.Kq,{space:5,children:[(0,oZ.jsx)(oK.Kq,{as:x2,space:5,children:b.map(e=>(0,oZ.jsx)("div",{children:(0,oZ.jsx)(xJ,{change:e,"data-revert-all-changes-hover":h?"":void 0,readOnly:g||(null==e?void 0:e.readOnly),hidden:null==e?void 0:e.hidden},e.key)},e.key))}),O&&o&&!v&&(null==x?void 0:x.granted)&&(0,oZ.jsx)(lr.J2,{content:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xu,{paddingY:3,children:(0,oZ.jsx)(oK.xv,{size:1,children:m("changes.action.revert-all-description",{count:b.length})})}),(0,oZ.jsxs)(oK.kC,{gap:3,justify:"flex-end",children:[(0,oZ.jsx)(lr.zx,{mode:"ghost",text:m("changes.action.revert-all-cancel"),onClick:T}),(0,oZ.jsx)(lr.zx,{tone:"critical",text:m("changes.action.revert-all-confirm"),onClick:w})]})]}),open:u,padding:3,placement:"left",portal:!0,ref:E,children:(0,oZ.jsx)(oK.Kq,{children:(0,oZ.jsx)(lr.zx,{tone:"critical",mode:"ghost",text:m("changes.action.revert-all-confirm"),icon:lp.V13,onClick:k,onMouseEnter:C,onMouseLeave:_,disabled:g,size:"large"})})})]})})}var x4=Object.freeze,x5=Object.defineProperty,x8=(e,n)=>x4(x5(e,"raw",{value:x4(n||e.slice())}));let x6=oV.ZP.span(tO||(tO=x8(["\n  border-radius: ",";\n"])),e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.radius[1])}),x9=(0,oV.ZP)(oK.xv)(tA||(tA=x8(["\n  &:not([hidden]) {\n    display: inline;\n    line-height: calc(1.25em + 2px);\n  }\n\n  &:hover {\n    background-color: none !important;\n    background-image: linear-gradient(\n      to bottom,\n      var(--card-bg-color) 0,\n      var(--card-bg-color) 33.333%,\n      currentColor 33.333%,\n      currentColor 100%\n    );\n    background-size: 1px 3px;\n    background-repeat: repeat-x;\n    background-position-y: bottom;\n    padding-bottom: 3px;\n    box-shadow: 0 0 0 1px var(--card-bg-color);\n    z-index: 1;\n  }\n"])));function x7(e){let{segment:n}=e,{text:r}=n,{t:i}=dV();return"added"===n.action?(0,oZ.jsx)(f9,{annotation:n.annotation,disableHoverEffect:!0,tooltip:{description:i("changes.added-label")},as:x6,children:(0,oZ.jsx)(x9,{as:"ins",style:{textDecoration:"none"},children:r})}):"removed"===n.action?(0,oZ.jsx)(f9,{annotation:n.annotation,as:x6,disableHoverEffect:!0,tooltip:{description:i("changes.removed-label")},children:(0,oZ.jsx)(x9,{as:"del",children:r})}):(0,oZ.jsx)(oK.Zb,{as:"span",radius:2,style:{display:"inline"},children:r})}function ve(e){let{diff:n}=e;return(0,oZ.jsx)(oZ.Fragment,{children:(n.segments||[]).map((e,n)=>(0,oZ.jsx)(x7,{segment:e},n))})}var vt=Object.freeze,vn=Object.defineProperty;let vr=(0,oV.ZP)(oK.xv)(tI||(tI=vt(vn(C=["\n  color: inherit;\n"],"raw",{value:vt(C.slice())}))));function vi(e){let{title:n,action:r,icon:i,children:a,markRemoved:o}=e;return(0,oZ.jsxs)(oK.kC,{padding:2,align:"center",children:[i&&(0,oZ.jsx)(oK.xu,{padding:2,children:(0,oZ.jsx)(vr,{size:4,forwardedAs:o?"del":"div",children:(0,oN.createElement)(i)})}),(0,oZ.jsxs)(oK.Kq,{space:2,paddingLeft:2,children:[(0,oZ.jsx)(vr,{size:1,weight:"medium",forwardedAs:o?"del":"h3",textOverflow:"ellipsis",children:n}),r&&(0,oZ.jsx)("div",{children:r}),(0,oZ.jsx)(vr,{size:0,textOverflow:"ellipsis",children:a})]})]})}var va=Object.freeze,vo=Object.defineProperty;oV.ZP.div(tz||(tz=va(vo(_=["\n  display: inline-block;\n  word-break: break-all;\n  white-space: pre-wrap;\n"],"raw",{value:va(_.slice())}))));let vl=(0,oN.createContext)(null);function vs(e){let n=(0,oN.useMemo)(()=>({value:e.value}),[e.value]);return(0,oZ.jsx)(vl.Provider,{value:n,children:e.children})}function vc(e){let n=(0,o2.s6)(e),r=(0,oN.useContext)(vl);if(!r)throw Error("useFormValue must be used within a FormValueProvider");return f$(null==r?void 0:r.value,n)}let vd=(0,oN.createContext)(null);function vu(e){let n=(0,oN.useRef)(e.value);n.current=e.value;let r=(0,oN.useCallback)(e=>f$(n.current,e),[n]);return(0,oZ.jsx)(vd.Provider,{value:r,children:e.children})}let vp=(0,oN.createContext)(null),vh={constrainSize:!0,portal:!0,fallbackPlacements:["top","bottom"]};function vf(e){let{schemaType:n,readOnly:r,children:i,onValueCreate:a,onItemAppend:o}=e,l=(0,oN.useId)(),{t:s}=dV(),c=(0,oN.useCallback)(e=>{o(a(e))},[a,o]),d=oN.useCallback(()=>{c(n.of[0])},[n,c]),u=n.of.length>1?"inputs.array.action.add-item-select-type":"inputs.array.action.add-item";return r?(0,oZ.jsx)(lr.u,{portal:!0,content:s("inputs.array.read-only-label"),children:(0,oZ.jsx)(oK.rj,{children:(0,oZ.jsx)(lr.zx,{icon:lp.dtP,mode:"ghost",disabled:!0,size:"large",text:s(u)})})}):(0,oZ.jsxs)(oK.rj,{gap:1,style:{gridTemplateColumns:"repeat(auto-fit, minmax(100px, 1fr))"},children:[1===n.of.length?(0,oZ.jsx)(lr.zx,{icon:lp.dtP,mode:"ghost",onClick:d,size:"large",text:s(u)}):(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(lr.zx,{icon:lp.dtP,mode:"ghost",size:"large",text:s(u)}),id:l||"",menu:(0,oZ.jsx)(oK.v2,{children:n.of.map((e,n)=>{var r,i;let a=(0,ll.dD)(e)&&1===(e.to||[]).length&&e.to[0].icon,o=e.icon||(null==(r=e.type)?void 0:r.icon)||a;return(0,oZ.jsx)(lr.sN,{text:e.title||(null==(i=e.type)?void 0:i.name),onClick:()=>c(e),icon:o},n)})}),popover:vh}),i]})}function vm(){let e=(0,oN.useContext)(vp);if(!e)throw Error("FormBuilder: missing context value");return e}var vg=Object.freeze,vx=Object.defineProperty,vv=(e,n)=>vg(vx(e,"raw",{value:vg(n||e.slice())}));let vy=e=>"error"===e?(0,oZ.jsx)(lp.uIy,{}):"warning"===e?(0,oZ.jsx)(lp.foC,{}):(0,oZ.jsx)(lp.hQ6,{}),vb=(0,oV.ZP)(oK.xv)(e=>{let{theme:n}=e;return(0,oV.iv)(tM||(tM=vv(["\n    &[data-info] {\n      color: ",";\n    }\n\n    &[data-warning] {\n      color: ",";\n    }\n\n    &[data-error] {\n      color: ",";\n    }\n  "])),n.sanity.color.muted.primary.enabled.fg,n.sanity.color.muted.caution.enabled.fg,n.sanity.color.muted.critical.enabled.fg)});function vj(e){let{markers:n,validation:r,renderCustomMarkers:i}=e,{CustomMarkers:a}=vm().__internal.components;return 0===n.length&&0===r.length?null:(0,oZ.jsxs)(oK.Kq,{space:1,children:[r.length>0&&r.map((e,n)=>{let{message:i,level:a}=e;return(0,oZ.jsxs)(oK.kC,{children:[(0,oZ.jsx)(oK.xu,{marginRight:2,marginBottom:n+1===r.length?0:2,children:(0,oZ.jsx)(vb,{size:1,"data-error":"error"===a?"":void 0,"data-warning":"warning"===a?"":void 0,"data-info":"info"===a?"":void 0,children:vy(a)})}),(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{size:1,children:i||"Error"})})]},"validationItem-".concat(n))}),n.length>0&&(0,oZ.jsxs)(oK.xu,{marginTop:r.length>0?3:0,children:[i&&i(n),!i&&(0,oZ.jsx)(a,{markers:n})]})]})}let vw=oN.createContext(null),vk=(0,oN.memo)(function(e){let n=(0,oN.useRef)(e);n.current=e;let r=(0,oN.useCallback)(e=>{var r,i,a;return null!=(a=null==(i=null==(r=n.current)?void 0:r.transformPatches)?void 0:i.call(r,e))?a:[]},[n]),i=(0,oN.useCallback)(e=>{n.current.onChange(e)},[]),a=(0,oN.useCallback)(e=>{n.current.onPathFocus(e)},[]),o=(0,oN.useCallback)(e=>{n.current.onPathBlur(e)},[]),l=(0,oN.useCallback)(e=>{n.current.onPathOpen(e)},[]),s=(0,oN.useCallback)((e,r)=>{n.current.onSetPathCollapsed(e,r)},[]),c=(0,oN.useCallback)((e,r)=>{n.current.onSetFieldSetCollapsed(e,r)},[]),d=(0,oN.useCallback)((e,r)=>{n.current.onFieldGroupSelect(e,r)},[]),u=(0,oN.useMemo)(()=>
1({transformPatches:r,onChange:i,onPathFocus:a,onPathBlur:o,onPathOpen:l,onSetPathCollapsed:s,onSetFieldSetCollapsed:c,onFieldGroupSelect:d}),[i,d,o,a,l,c,s,r]);return(0,oZ.jsx)(vw.Provider,{value:u,children:e.children})});function vC(){let e=(0,oN.useContext)(vw);if(!e)throw Error("Form context not provided");return e}function v_(e,n){return function e(n,r,i){if(n===r)return n;if(i.has(r)||null==n||null==r||typeof n!=typeof r)return r;if(Array.isArray(r)){i.add(r);let a=n.length===r.length,o=[];for(let l=0;l<r.length;l++){let s=e(n[l],r[l],i);s!==n[l]&&(a=!1),o[l]=s}return i.delete(r),a?n:o}if("object"==typeof r){i.add(r);let a=Object.keys(r),o=Object.keys(n).length===a.length,l={};for(let s of a){let a=e(n[s],r[s],i);a!==n[s]&&(o=!1),l[s]=a}return i.delete(r),o?n:l}return r}(e,n,new WeakSet)}let vT=(0,oN.createContext)([]);function vS(e){return(0,oZ.jsx)(vT.Provider,{value:e.presence,children:e.children})}function vE(e,n){let r=function(){let e=(0,oN.useContext)(vT);if(!e)throw Error("Form context not provided");return e}(),i=(0,oN.useRef)(r),a=v_(i.current,r.filter(r=>(0,o2.Ny)(e,r.path)&&(n||!(0,o2.Xy)(e,r.path))));return i.current=a,a}let vP=(0,oN.createContext)([]);function vO(e){return(0,oZ.jsx)(vP.Provider,{value:e.validation,children:e.children})}function vA(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=function(){let e=(0,oN.useContext)(vP);if(!e)throw Error("Form context not provided");return e}();return(0,oN.useMemo)(()=>r.filter(r=>(0,o2.Ny)(e,r.path)&&(n||!(0,o2.Xy)(e,r.path))).map(e=>({message:e.message,level:e.level,path:e.path})),[n,e,r])}function vI(e){let{action:n}=e,{title:r}=uX(n),i=(0,oN.useCallback)(()=>{n.onAction()},[n]),a="object"==typeof n.disabled&&(0,oZ.jsx)(oK.xv,{size:1,children:n.disabled.reason});return(0,oZ.jsx)(Be,{content:a,placement:"left",children:(0,oZ.jsx)(lr.sN,{disabled:!!n.disabled,icon:n.icon,iconRight:n.iconRight||(n.selected?lp.KML:void 0),onClick:i,pressed:n.selected,text:r,tone:n.tone})})}let vz={placement:"right",fallbackPlacements:["top","bottom"]};function vM(e){let{group:n}=e,{title:r}=uX(n);return n.expanded?(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(oK.xu,{padding:2,paddingTop:3,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:r})}),n.children.map((e,r)=>{var i;return(0,oZ.jsx)(vR,{action:e,isFirst:0===r,prevIsGroup:(null==(i=n.children[r-1])?void 0:i.type)==="group"},r)})]}):(0,oZ.jsx)(lr.kS,{icon:n.icon,popover:vz,text:r,tone:n.tone,children:n.children.map((e,r)=>{var i;return(0,oZ.jsx)(vR,{action:e,isFirst:0===r,prevIsGroup:(null==(i=n.children[r-1])?void 0:i.type)==="group"},r)})})}function vR(e){let{action:n,isFirst:r,prevIsGroup:i}=e;return"divider"===n.type?(0,oZ.jsx)(oK.R,{}):"group"===n.type?(0,oZ.jsxs)(oZ.Fragment,{children:[!r&&(0,oZ.jsx)(oK.R,{}),(0,oZ.jsx)(vM,{group:n})]}):(0,oZ.jsxs)(oZ.Fragment,{children:[i&&(0,oZ.jsx)(oK.R,{}),(0,oZ.jsx)(vI,{action:n})]})}let vF={placement:"top"};function vD(e){return"renderAsButton"in e&&e.renderAsButton}let vq=(0,oN.memo)(function(e){let{nodes:n,onMenuOpenChange:r}=e,[i,a]=(0,oN.useState)(!1),o=(0,oN.useCallback)(()=>{r(!0),a(!0)},[r]),l=(0,oN.useCallback)(()=>{r(!1),a(!1)},[r]),s=(0,oN.useMemo)(()=>n.filter(vD),[n]),c=(0,oN.useMemo)(()=>n.filter(e=>!vD(e)),[n]),d=(0,oN.useMemo)(()=>{let e=c.length;if(0===e||e>1)return c;let n=c[0];return"group"===n.type?[{...n,expanded:!0}]:c},[c]),u=(0,oN.useMemo)(()=>[...d.length?[{type:"group",children:d,icon:lp.xXb,title:"Field actions"}]:[],...s],[s,d]);return(0,oZ.jsx)(oZ.Fragment,{children:u.map((e,n)=>(0,oZ.jsx)(vZ,{node:e,onOpen:o,onClose:l,open:i},n))})}),vZ=(0,oN.memo)(function(e){let{node:n,onOpen:r,onClose:i,open:a}=e;return"divider"===n.type?(0,oZ.jsx)(oK.Zb,{borderLeft:!0,flex:"none"}):"action"===n.type?(0,oZ.jsx)(lr.zx,{icon:n.icon,mode:"bleed",onClick:n.onAction,tooltipProps:{...vF,content:n.title}}):(0,oZ.jsx)(vL,{node:n,onOpen:r,onClose:i,open:a})}),vN={constrainSize:!0,placement:"right",portal:!0,fallbackPlacements:["top","bottom"]};function vL(e){let{node:n,onOpen:r,onClose:i,open:a}=e,{title:o}=uX(n);return(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(lr.zx,{icon:n.icon,label:a?void 0:o,mode:"bleed",tooltipProps:{...vF,content:n.title}}),id:(0,oN.useId)(),menu:(0,oZ.jsx)(oK.v2,{children:n.children.map((e,r)=>{var i;return(0,oZ.jsx)(vR,{action:e,isFirst:0===r,prevIsGroup:(null==(i=n.children[r-1])?void 0:i.type)==="group"},r)})}),onOpen:r,onClose:i,popover:vN})}let vV=(0,oN.memo)(function(e){let{actions:n,documentId:r,documentType:i,onActions:a,path:o,schemaType:l}=e,s=n.length,c=(0,oN.useRef)(s),[d,u]=(0,oN.useState)(()=>
1Array.from(Array(s))),p=(0,oN.useRef)(d),h=(0,oN.useCallback)((e,n)=>{u(r=>{let i=[...r];return i[e]=n,i})},[]);return(0,oN.useEffect)(()=>{p.current!==d&&(p.current=d,a(function e(n){return n.filter(Boolean).filter(e=>!("hidden"in e)||!0!==e.hidden).map(n=>"group"===n.type?{...n,children:e(n.children)}:n)}(d)))},[d,a]),(0,oN.useEffect)(()=>{if(c.current!==s){let e=Array.from(Array(s));for(let n=0;n<s;n++)e[n]=p.current[n];c.current=s,u(e),p.current=e}},[s]),(0,oZ.jsx)(oZ.Fragment,{children:n.map((e,n)=>(0,oZ.jsx)(vK,{action:e,index:n,documentId:r,documentType:i,path:o,schemaType:l,setFieldAction:h},n))})}),vK=(0,oN.memo)(function(e){let{action:n,documentId:r,documentType:i,index:a,path:o,schemaType:l,setFieldAction:s}=e,c=ds(n.useAction({documentId:r,documentType:i,path:o,schemaType:l}));return(0,oN.useEffect)(()=>{s(a,c)},[a,c,s]),null}),vB=(0,oN.createContext)({hoveredStack:[],onMouseEnter:()=>void 0,onMouseLeave:()=>void 0});function vU(){return(0,oN.useContext)(vB)}let vH=(0,oN.createContext)({actions:[],focused:!1,hovered:!1,onMouseEnter:()=>void 0,onMouseLeave:()=>void 0});function v$(e){let{actions:n,children:r,path:i,focused:a}=e,{onMouseEnter:o,onMouseLeave:l}=vU(),s=vU().hoveredStack[0],c=dI||!!s&&fH(i)===s,d=(0,oN.useCallback)(()=>{o(i)},[o,i]),u=(0,oN.useCallback)(()=>{l(i)},[l,i]),p=(0,oN.useMemo)(()=>({actions:n,focused:a,hovered:c,onMouseEnter:d,onMouseLeave:u}),[n,a,d,u,c]);return(0,oZ.jsx)(vH.Provider,{value:p,children:r})}function vW(){return(0,oN.useContext)(vH)}let vY=(0,oN.createContext)(null);function vX(e){let n=(0,oN.useMemo)(()=>({id:e.id}),[e.id]);return(0,oZ.jsx)(vY.Provider,{value:n,children:e.children})}function vG(){return dm(function(){let e=(0,oN.useContext)(vY);if(!e)throw Error("useDocumentId must be used within a DocumentIdProvider");return e.id}())}let vJ=(0,oN.createContext)(null);function vQ(e){let n=(0,oN.useMemo)(()=>({actions:e.actions||dy}),[e.actions]);return(0,oZ.jsx)(vJ.Provider,{value:n,children:e.children})}function v0(){let e=oN.useContext(vJ);if(!e)throw Error("useDocumentFieldActions must be used within a DocumentFieldActionsProvider");return e.actions}let v1=(0,oN.createContext)({});function v2(){return(0,oN.useContext)(v1)}function v3(e){let{children:n,activePath:r,EditReferenceLinkComponent:i,onEditReference:a,initialValueTemplateItems:o}=e,l=(0,oN.useMemo)(()=>({activePath:r,EditReferenceLinkComponent:i,onEditReference:a,initialValueTemplateItems:o}),[r,i,a,o]);return(0,oZ.jsx)(v1.Provider,{value:l,children:n})}function v4(e,n){return fV(n,(0,oN.useCallback)((n,r)=>{e.current&&!n&&r&&(0,s3.Z)(e.current,{scrollMode:"always"})},[e]))}(0,oN.createContext)(null);let v5=()=>{if(a)return a;a=[];for(let e=0;e<256;++e)a[e]=(e+256).toString(16).substring(1);return a};function v8(e){let n=v5();return(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,n=new Uint8Array(e);return(0,s4.Z)(n),n})(e).reduce((e,r)=>e+n[r],"").slice(0,e)}var v6=Object.freeze,v9=Object.defineProperty,v7=(e,n)=>v6(v9(e,"raw",{value:v6(n||e.slice())}));let ye={portal:!0},yt=oV.ZP.div(e=>{let{space:n}=(0,oL.aQ)(e.theme);return(0,oV.iv)(tR||(tR=v7(["\n    margin: ","px;\n  "])),0-n[1])}),yn=e=>1===e.length?"".concat(e[0].user.displayName," is editing this document"):e.length>1?"".concat(e.length," people are editing this document right now"):void 0;function yr(e){let{presence:n}=e,r=(0,oN.useMemo)(()=>Array.from(new Set(n.map(e=>e.user.id))).map(e=>n.find(n=>n.user.id===e)).filter(dd),[n]),i=(0,oN.useMemo)(()=>yn(r),[r]);return(0,oZ.jsx)(lr.u,{content:i,...ye,children:(0,oZ.jsx)(yt,{children:(0,oZ.jsx)(oK.Jh,{maxLength:2,"aria-label":yn(r),size:0,children:r.map(e=>(0,oZ.jsx)(yl,{size:0,user:e.user},e.user.id))})})})}let yi=/[^\p{Alpha}\p{White_Space}]/gu,ya=RegExp("\\p{White_Space}+","u"),yo={small:0,medium:1,large:2};function yl(e){let{user:n,...r}=e;return dj(n)?r.withTooltip?(0,oZ.jsx)(ys,{...r,user:n}):(0,oZ.jsx)(yc,{...r,user:n}):(0,oZ.jsx)(yd,{...e,user:n})}function ys(e){let{user:{displayName:n}}=e;return(0,oZ.jsx)(lr.u,{content:n,placement:"top",portal:!0,children:(0,oZ.jsx)("div",{style:{display:"inline-block"},children:(0,oZ.jsx)(yc,{...e})})})}let yc=(0,oN.forwardRef)(function(e,n){let{user:r,animateArrowFrom:i,position:a,size:o,status:l,tone:s,...c}=e,[d,u]=(0,oN.useState)(null),p=function(e){let n=pt();return(0,oR.m2)(e?n.listen(e):(0,ov.c)(),[e],n.get(null))}
1(r.id),h=d?void 0:null==r?void 0:r.imageUrl;return(0,oZ.jsx)(oK.qE,{__unstable_hideInnerStroke:!0,animateArrowFrom:i,arrowPosition:a,color:p.name,"data-legacy-tone":s,initials:(null==r?void 0:r.displayName)&&function(e){let n=e.replace(yi,"").split(ya);return 1===n.length?"".concat(n[0].charAt(0)).toUpperCase():"".concat(n[0].charAt(0)).concat(n[n.length-1].charAt(0))}(r.displayName),src:h,onImageLoadError:u,ref:n,size:"string"==typeof o?yo[o]:o,status:l,title:null==r?void 0:r.displayName,...c})});function yd(e){let{user:n,...r}=e,[i]=hV(n);return i?(0,oZ.jsx)(yl,{...r,user:i}):null}let yu=[0,.25,.75,1],yp=(e,n)=>{let r=e.length>n?n-1:n,i=Math.max(0,e.length-r);return[e.slice(0,i),e.slice(i)]};var yh=Object.freeze,yf=Object.defineProperty,ym=(e,n)=>yh(yf(e,"raw",{value:yh(n||e.slice())}));let yg=(0,oV.ZP)(oK.kC)(tF||(tF=ym(["\n  & > div:first-child {\n    flex: 1;\n    min-width: 0;\n  }\n"]))),yx=(0,oV.ZP)(oK.kC)(tD||(tD=ym(["\n  height: ","px;\n  min-width: 23px;\n  vertical-align: top;\n"])),25),yv=oN.createContext([]);function yy(e){let{children:n,items:r}=e,i=(0,oN.useMemo)(()=>(0,oZ.jsx)(oK.Kq,{sizing:"border",children:r.map(e=>(0,oZ.jsxs)(oK.kC,{align:"center",gap:2,children:[(0,oZ.jsx)("div",{children:(0,oZ.jsx)(yl,{user:e.user,status:"online"})}),(0,oZ.jsx)(oK.xv,{size:1,children:e.user.displayName})]},e.user.id))}),[r]);return(0,oZ.jsx)(lr.u,{content:i,placement:"top",portal:"documentScrollElement",children:n})}let{Tracker:yb,useReporter:yj,useReportedValues:yw}=de(),yk=(0,oN.memo)(function(e){let{presence:n,position:r="inside",animateArrowFrom:i="inside",maxAvatars:a=3,stack:o=!0}=e,l=lM()(n||[],e=>e.user.id),s=lo()(l,e=>e.lastActiveAt),[c,d]=o?yp(s,a):[[],s],u=[...d.reverse().map(e=>({key:e.user.id,element:(0,oZ.jsx)(yl,{animateArrowFrom:i,position:r,status:"online",user:e.user})})),c.length>=2?{key:"counter",element:(0,oZ.jsx)(oK.p2,{count:c.length})}:null].filter(Boolean);return(0,oZ.jsxs)(yg,{children:[(0,oZ.jsx)("div",{}),(0,oZ.jsx)(yx,{direction:"row-reverse",children:u.map((e,n)=>e&&(0,oZ.jsx)("div",{style:{position:"absolute",transform:"translate3d(".concat(-(21*n),"px, 0px, 0px)"),transitionProperty:"transform",transitionDuration:"200ms",transitionTimingFunction:"cubic-bezier(0.85, 0, 0.15, 1)",zIndex:100-n},children:e.element},e.key))})]})}),yC=function(e){let n=(0,oN.useContext)(yv),{presence:r=n,maxAvatars:i=3}=e,a=(0,oN.useRef)(null);yj((0,oN.useId)(),()=>({presence:r,element:a.current,maxAvatars:i}));let o=(0,oN.useMemo)(()=>lM()(r||[],e=>e.user.id),[r]);return(0,oZ.jsx)(yy,{items:o,children:(0,oZ.jsx)(yg,{ref:a,style:{minHeight:25,minWidth:25}})})},y_=e=>{let n=new oC.x,r=new IntersectionObserver(e=>{e.forEach(e=>{n.next(e)})},e);return{observe:e=>new oy.y(i=>{let a=n.pipe((0,a2.h)(n=>n.target===e)).subscribe(i);return r.observe(e),()=>{a.unsubscribe(),r.unobserve(e)}})}},yT=e=>{let{onIntersection:n,io:r,id:i,...a}=e,o=oN.useRef(null);return oN.useEffect(()=>{let e=o.current;if(!e)return;
1let a=r.observe(e).pipe((0,a4.b)(e=>n(i,e))).subscribe();return()=>a.unsubscribe()},[r,i,n]),(0,oZ.jsx)("div",{ref:o,...a})};var yS=Object.freeze,yE=Object.defineProperty,yP=(e,n)=>yS(yE(e,"raw",{value:yS(n||e.slice())}));let yO=oV.ZP.div(tq||(tq=yP(["\n  position: relative;\n"]))),yA=oV.ZP.div(tZ||(tZ=yP(["\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  pointer-events: none;\n  z-index: 13;\n"]))),yI=(0,oV.iv)(tN||(tN=yP(["\n  overflow: hidden;\n  overflow: clip;\n  pointer-events: none;\n  position: absolute;\n"]))),yz=(0,oV.ZP)(yT)(e=>{let{$debug:n,margins:r}=e;return(0,oV.iv)(tL||(tL=yP(["\n    ","\n\n    z-index: 100;\n    position: sticky;\n    height: 1px;\n    top: ",";\n    background-color: ",";\n  "])),yI,r?"".concat(r[0]-1,"px"):void 0,n?"red":"none")}),yM=(0,oV.ZP)(yT)(e=>{let{$debug:n}=e;return(0,oV.iv)(tK||(tK=yP(["\n    ","\n\n    visibility: none;\n\n    ","\n  "])),yI,n&&(0,oV.iv)(tV||(tV=yP(["\n      background: rgba(255, 0, 0, 0.25);\n      outline: 1px solid #00b;\n      visibility: visible;\n    "]))))}),yR=(0,oV.ZP)(yT)(e=>{let{$debug:n}=e;return(0,oV.iv)(tB||(tB=yP(["\n    ","\n\n    position: sticky;\n    bottom: -1px;\n    height: 1px;\n    background-color: ",";\n  "])),yI,n?"blue":"transparent")}),yF=e=>"".concat(e,"px"),yD=e=>0-e,yq=(0,oN.forwardRef)(function(e,n){let{regions:r,render:i,children:a,margins:o}=e,l=(0,oN.useRef)(null),s=(0,oN.useMemo)(()=>o,[JSON.stringify(o)]),c=(0,oN.useMemo)(()=>y_({rootMargin:s.map(yD).map(yF).join(" "),threshold:yu}),[s]),[d,u]=(0,oN.useState)({}),p=(0,oN.useCallback)((e,n)=>{u(r=>({...r,[e]:n}))},[]),h=d["::top"],f=d["::bottom"],m=(0,oN.useMemo)(()=>h&&f?r.filter(e=>{var n;return(null==(n=e.presence)?void 0:n.length)>0}).map(e=>{let n=d[e.id];if(!n)return null;let{bottom:r,top:i}=n.boundingClientRect,a=n.boundingClientRect.top<h.boundingClientRect.bottom,o=n.boundingClientRect.top<f.boundingClientRect.top,l=n.isIntersecting?i-(n.intersectionRect.top-23):a?-h.boundingClientRect.bottom:f.boundingClientRect.top,s=n.isIntersecting?-(r-(n.intersectionRect.bottom+23)):o?f.boundingClientRect.top:-
1h.boundingClientRect.bottom;return{distanceTop:l,distanceBottom:s,region:e,position:l<=8?"top":s<=8?"bottom":"inside"}}).filter(Boolean):[],[f,d,r,h]);return(0,oZ.jsxs)(yO,{ref:n,children:[(0,oZ.jsx)(yz,{$debug:!1,io:c,id:"::top",onIntersection:p,margins:s}),(0,oZ.jsx)("div",{children:a}),(0,oZ.jsx)(yA,{ref:l,children:l.current&&i(m,l.current.offsetWidth)}),r.map(e=>{let n=0===e.rect.width;return(0,oZ.jsx)(yM,{$debug:!1,io:c,onIntersection:p,id:e.id,style:{width:n?1:e.rect.width,left:e.rect.left-(n?1:0),top:e.rect.top-23,height:e.rect.height+46}},e.id)}),(0,oZ.jsx)(yR,{$debug:!1,id:"::bottom",io:c,onIntersection:p})]})}),yZ={transitionProperty:"transform",transitionDuration:"200ms",transitionTimingFunction:"cubic-bezier(0.85, 0, 0.15, 1)"},yN=e=>e.top+e.height,yL=e=>sW()(e,e=>e.region.rect.top),yV=(e,n)=>e+n,yK=e=>e.reduce(yV,0),yB=e=>{let{height:n,...r}=e;return(0,oZ.jsx)("div",{style:{height:Math.max(0,n),...null==r?void 0:r.style}})},yU=[0,0,0,0],yH=(e,n)=>{let r=e,i=-r.scrollTop,a=0;for(;r&&r!==n;)i+=r.offsetTop-r.scrollTop,a+=r.offsetLeft,r=r.offsetParent instanceof HTMLElement?r.offsetParent:null;return{top:i,left:a}};function y$(e){let{children:n,margins:r=yU}=e,i=yw(),a=oN.useRef(null),o=oN.useMemo(()=>{var e;return a.current?(e=a.current,i.map(n=>{var r;let[i,a]=n;return{...a,id:i,rect:{...yH(r=a.element,e),width:r.offsetWidth,height:r.offsetHeight}}})):yW},[i]),l=oN.useCallback((e,n)=>{let i=function(e){let n=yL(e).map((e,n,r)=>{var i;let a=null==(i=r[n-1])?void 0:i.region.rect,o=a?yN(a):0;return{...e,spacerHeight:e.region.rect.top-o}}),r={top:[],inside:[],bottom:[],...s1()(n,e=>e.position)};return{top:yL(r.top).map((e,n,r)=>({...e,indent:r.slice(n+1).reduce((e,n)=>e+n.region.rect.width,0)})),inside:yL(r.inside).map(e=>({...e,indent:0})),bottom:yL(r.bottom).map((e,n,r)=>({...e,indent:r.slice(0,n).reduce((e,n)=>e+n.region.rect.width,0)}))}}(e.filter(e=>e.region.presence.length>0)),a=yK(i.top.map(e=>e.region.rect.height+e.spacerHeight)),o=yK([...i.inside,...i.bottom].map(e=>e.region.rect.height+e.spacerHeight)),l=i.inside.reduce((e,n)=>{let{distanceTop:r,distanceBottom:i}=n;return{nearTop:e.nearTop+(r<=20?n.region.presence.length:0),nearBottom:e.nearBottom+(i<=20?n.region.presence.length:0)}},{nearTop:0,nearBottom:0});return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(yY,{closeCount:l.nearTop,margins:r,position:"top",regionsWithIntersectionDetails:i.top}),(0,oZ.jsx)(yB,{height:a}),(0,oZ.jsx)(yX,{containerWidth:n,regionsWithIntersectionDetails:i.inside}),(0,oZ.jsx)(yB,{height:o}),(0,oZ.jsx)(yY,{closeCount:l.nearBottom,margins:r,position:"bottom",regionsWithIntersectionDetails:i.bottom})]})},[r]);return(0,oZ.jsx)(yq,{ref:a,margins:r,regions:o,render:l,children:n})}let yW=[],yY=(0,oN.memo)(function(e){let{closeCount:n,margins:r,position:i,regionsWithIntersectionDetails:a}=e,o="top"===i?1:-1,l=(0,oN.useMemo)(()=>a.length?lI()(lo()(a,e=>e.region.rect.top*o).map(e=>e.region.presence||yW)):yW,[o,a]),[s,c,d,u]=r,p=(u||0)+(l.length>0?-(21*n):0)-c,h="top"===i?s:d,f=(0,oN.useMemo)(()=>({zIndex:2,position:"sticky",display:"flex",flexDirection:"column",alignItems:"flex-end",...yZ,transform:"translate3d(".concat(p,"px, 0px, 0px)"),top:5+h,bottom:5+h}),[p,h]);return(0,oZ.jsx)("div",{"data-dock":i,style:f,children:(0,oZ.jsx)(yk,{position:i,maxAvatars:3,presence:l})},"sticky-".concat(i))});function yX(e){let{regionsWithIntersectionDetails:n,containerWidth:r}=e;return(0,oZ.jsx)(oZ.Fragment,{children:n.map(e=>{let n=e.region.rect.left,{distanceTop:i,distanceBottom:a}=e,o=i<=20,l=a<=20,s=r-n-e.region.rect.width,{presence:c,maxAvatars:d}=e.region;return(0,oZ.jsx)(oN.Fragment,{children:(0,oZ.jsx)("div",{style:{zIndex:2,position:"absolute",...yZ,left:n,transform:"translate3d(".concat(o||l?s:0,"px, 0px, 0px)"),height:e.region.rect.height,top:e.region.rect.top},children:(0,oZ.jsx)(yG,{value:()=>"⤒".concat(i," | ").concat(a,"⤓"),children:(0,oZ.jsx)(yk,{stack:!o&&!l,position:o?"top":l?"bottom":"inside",maxAvatars:d,presence:c})})})},e.region.id)})})}let yG=e=>e.children,yJ=[0,0,0,0],yQ=function(e){let{children:n,margins:r}=e;return(0,oZ.jsx)(yb,{children:(0,oZ.jsx)(y$,{margins:r||yJ,children:n})})};var y0=Object.freeze,y1=Object.defineProperty,y2=(e,n)=>y0(y1(e,"raw",{value:y0(n||e.slice())}));let y3=(0,oV.ZP)(oK.kC)(e=>{let{theme:n,$floatingCardWidth:r,$slotWidth:i,$floatingCardVisible:a}=e,{space:o}=n.sanity;return(0,oV.iv)(tU||(tU=y2(["\n    /* Prevent buttons from taking up extra vertical space */\n    line-height: 1;\n    width: 100%;\n    /* For floating actions menu */\n    position: relative;\n\n    [data-ui='PresenceBox'] {\n      position: absolute;\n      bottom: 0;\n      right: ","px;\n    }\n    @media (hover: hover) {\n      // If hover is supported, we hide the floating card by default, so only add space for it when it's visible.\n      [data-ui='PresenceBox'] {\n        position: absolute;\n        bottom: 0;\n        right: ","px;\n      }\n    }\n  "])),i+r+o[1],i+(a?r:0)+o[1])}),y4=(0,oV.ZP)(oK.xu)(e=>{let{theme:n,$presenceMaxWidth:r}=e,{space:i}=n.sanity;return(0,oV.iv)(tH||(tH=y2(["\n    max-width: calc(100% - ","px);\n    min-width: 75%;\n  "])),r+i[1])}),y5=(0,oV.ZP)(oK.xu)(e=>{let{theme:n,$right:r,$fieldActionsVisible:i}=e,{space:a}=n.sanity,o=i?r+a[1]:r;return(0,oV.iv)(t$||(t$=y2(["\n    position: absolute;\n    bottom: 0;\n    right: ","px;\n  "])),o)}),y8=(0,oV.ZP)(oK.Zb)(tW||(tW=y2(["\n  align-items: center;\n  bottom: 0;\n  position: absolute;\n  right: 0;\n  transition: opacity 150ms ease;\n  line-height: 1;\n\n  @media (hover: hover) {\n    // If hover is supported, we hide the floating card by default\n    // and only show it when it has focus within or when the field is hovered or focused.\n    opacity: 0;\n    pointer-events: none;\n\n    [data-ui='FieldActionsFlex'] {\n      opacity: 0;\n    }\n\n    &[data-actions-visible='false']:not(:focus-within) {\n      // Remove the shadow when the field actions are not visible\n      box-shadow: none;\n\n      // Since the field actions always will be present in the DOM (to make them focusable) –\n      // they will always affect the width of the floating card, even when they are not visible.\n      // Therefore, we remove the background of the floating card when the field actions are not visible.\n      background: transparent;\n    }\n\n    // Remove the shadow when the field has comments but no actions\n    &[data-has-comments='true']:not([data-has-actions='true']) {\n      box-shadow: none;\n    }\n\n    // Show the floating card when it has focus within (ie when field actions are focused).\n    &:focus-within {\n      opacity: 1;\n      pointer-events: auto;\n      width: max-content;\n\n      [data-ui='FieldActionsFlex'] {\n        opacity: 1;\n        pointer-events: auto;\n        width: max-content;\n      }\n    }\n  }\n\n  &[data-visible='true'] {\n    opacity: 1;\n    pointer-events: auto;\n    width: max-content;\n  }\n\n  &[data-actions-visible='true'] {\n    [data-ui='FieldActionsFlex'] {\n      opacity: 1;\n      pointer-events: auto;\n      width: max-content;\n    }\n  }\n"]))),y6=(0,oV.ZP)(oK.kC)(tY||(tY=y2(["\n  gap: inherit;\n  transition: opacity 150ms ease;
1\n"])));function y9(e){let{__internal_comments:n,__internal_slot:r,actions:i,content:a,fieldFocused:o,fieldHovered:l,presence:s}=e,[c,d]=(0,oN.useState)(!1),[u,p]=(0,oN.useState)(!1),[h,f]=(0,oN.useState)(null),[m,g]=(0,oN.useState)(0),[x,v]=(0,oN.useState)(null),[y,b]=(0,oN.useState)(0),{hasComments:j=!1,button:w=null,isAddingComment:k=!1}=n||{},C=i&&i.length>0,_=o||l||u||k,T=(null==n?void 0:n.button)||C,S=c||_||j,E=(0,oN.useCallback)(()=>{if(h){let{width:e}=h.getBoundingClientRect();g(e||0)}},[h]),P=(0,oN.useCallback)(()=>{E(),d(!0)},[E]),O=(0,oN.useCallback)(()=>{E(),d(!1)},[E]);(0,oN.useEffect)(()=>{E()},[E,_]),(0,oN.useEffect)(()=>{if(x){let{width:e}=x.getBoundingClientRect();b(e||0)}},[x]);let A=(0,oN.useMemo)(()=>r?(0,oZ.jsx)(y5,{$fieldActionsVisible:!!_,$right:m,ref:v,children:r}):null,[m,_,r]);return(0,oZ.jsxs)(y3,{align:"flex-end",justify:"space-between",$floatingCardVisible:S,$floatingCardWidth:m,$slotWidth:y,children:[(0,oZ.jsx)(y4,{flex:1,paddingY:2,$presenceMaxWidth:88,children:a}),s&&s.length>0&&(0,oZ.jsx)(oK.xu,{"data-ui":"PresenceBox",flex:"none",children:(0,oZ.jsx)(yC,{maxAvatars:4,presence:s})}),A,(T||j)&&(0,oZ.jsx)(lr.uE,{children:(0,oZ.jsxs)(y8,{"data-actions-visible":_?"true":"false","data-has-actions":C?"true":"false","data-has-comments":j?"true":"false","data-visible":S?"true":"false",display:"flex",onBlurCapture:O,onFocusCapture:P,ref:f,sizing:"border",children:[C&&(0,oZ.jsx)(y6,{align:"center","data-ui":"FieldActionsFlex",children:(0,oZ.jsx)(vq,{nodes:i,onMenuOpenChange:p})}),w]})})]})}function y7(e,n){if(n&&e)return"desc_".concat(e)}var be=Object.freeze,bt=Object.defineProperty;let bn=[],br={error:function(){let{t:e}=dV();return(0,oZ.jsx)(lp.uIy,{"data-testid":"input-validation-icon-error","aria-label":e("form.validation.has-error-aria-label"),"aria-hidden":!0,role:"presentation"})},warning:function(){let{t:e}=dV();return(0,oZ.jsx)(lp.foC,{"data-testid":"input-validation-icon-warning","aria-label":e("form.validation.has-warning-aria-label"),"aria-hidden":!0,role:"presentation"})},info:function(){let{t:e}=dV();return(0,oZ.jsx)(lp.hQ6,{"data-testid":"input-validation-icon-info","aria-label":e("form.validation.has-info-aria-label"),"aria-hidden":!0,role:"presentation"})}},bi=(0,oV.ZP)(oK.Kq)(tX||(tX=be(bt(T=["\n  max-width: 200px;\n"],"raw",{value:be(T.slice())})))),ba=(0,oV.ZP)(oK.xv)(e=>{let{$status:n}=e;return"error"===n?{"--card-icon-color":"var(--card-badge-critical-icon-color)"}:"warning"===n?{"--card-icon-color":"var(--card-badge-caution-icon-color)"}:"info"===n?{"--card-icon-color":"var(--card-badge-primary-icon-color)"}:{}});function bo(e){let{validation:n=bn,__unstable_showSummary:r,fontSize:i,placement:a}=e,o=n.some(e=>"error"===e.level),l=n.some(e=>"warning"===e.level),s=o?"error":l?"warning":"info",c=br[s];return(0,oZ.jsx)(lr.u,{content:(0,oZ.jsxs)(bi,{space:3,children:[r&&(0,oZ.jsx)(bs,{validation:n}),!r&&(0,oZ.jsx)(oZ.Fragment,{children:n.map((e,n)=>(0,oZ.jsx)(bl,{validation:e},n))})]}),portal:!0,placement:a,fallbackPlacements:["bottom","right","left"],children:(0,oZ.jsx)("div",{children:(0,oZ.jsx)(ba,{$status:s,size:i,weight:"medium",children:c&&(0,oZ.jsx)(c,{})})})})}function bl(e){let{validation:n}=e,r=br[n.level];return(0,oZ.jsxs)(oK.kC,{children:[(0,oZ.jsx)(oK.xu,{marginRight:2,children:(0,oZ.jsx)(ba,{$status:n.level,size:1,children:r&&(0,oZ.jsx)(r,{})})}),(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.xv,{size:1,children:n.message})})]})}function bs(e){let{validation:n}=e,{t:r}=dV(),i=u_(),a=n.reduce((e,n)=>"error"===n.level?e+1:e,0),o=n.reduce((e,n)=>"warning"===n.level?e+1:e,0),l=a>0,s=o>0;if(!l&&!s)return null;let c=l&&r("form.validation.summary.errors-count",{count:a}),d=s&&r("form.validation.summary.warnings-count",{count:o});return c&&d?(0,oZ.jsx)(oK.xv,{size:1,children:i.format([c,d])}):(0,oZ.jsx)(oK.xv,{size:1,children:c||d})}let bc=[],bd=(0,oN.memo)(function(e){let{description:n,inputId:r,title:i,deprecated:a,validation:o=bc}=e,{t:l}=dV(),s=o.length>0;return(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(oK.xv,{as:"label",htmlFor:r,weight:"medium",size:1,children:i||(0,oZ.jsx)("span",{style:{color:"var(--card-muted-fg-color)"},children:l("form.field.untitled-field-label")})}),a&&(0,oZ.jsx)(oK.xu,{marginLeft:2,children:(0,oZ.jsx)(oK.Ct,{"data-testid":"deprecated-badge-".concat(i),tone:"caution",children:l("form.field.deprecated-label")})}),s&&(0,oZ.jsx)(oK.xu,{marginLeft:2,children:(0,oZ.jsx)(bo,{fontSize:1,placement:"top",validation:o})})]}),a&&(0,oZ.jsx)(LT,{"data-testid":"deprecated-message-".concat(i),tone:"caution",
1size:1,children:a.reason}),n&&(0,oZ.jsx)(oK.xv,{muted:!0,size:1,id:y7(r,n),children:n})]})}),bu=[],bp=(0,oN.memo)(function(e){let{__unstable_headerActions:n=bu,__unstable_presence:r=bu,__internal_slot:i=null,__internal_comments:a,children:o,description:l,inputId:s,level:c,title:d,validation:u,deprecated:p,...h}=e,{focused:f,hovered:m,onMouseEnter:g,onMouseLeave:x}=vW();return(0,oZ.jsxs)(oK.Kq,{...h,"data-level":c,onMouseEnter:g,onMouseLeave:x,space:2,children:[d&&(0,oZ.jsx)(y9,{__internal_comments:a,__internal_slot:i,actions:n,fieldFocused:!!f,fieldHovered:m,presence:r,content:(0,oZ.jsx)(bd,{description:l,inputId:s,title:d,validation:u,deprecated:p})}),(0,oZ.jsx)("div",{children:o})]})});var bh=Object.freeze,bf=Object.defineProperty,bm=(e,n)=>bh(bf(e,"raw",{value:bh(n||e.slice())}));let bg=oV.ZP.legend(tG||(tG=bm(["\n  /* See: https://thatemil.com/blog/2015/01/03/reset-your-fieldset/ */\n  padding: 0;\n  display: table;\n"]))),bx=(0,oV.ZP)(oK.kC).attrs({forwardedAs:"button"})(e=>{let{theme:n}=e,{focusRing:r,radius:i}=n.sanity,{base:a}=n.sanity.color;return(0,oV.iv)(tJ||(tJ=bm(["\n    appearance: none;\n    border: 0;\n    background: none;\n    color: inherit;\n    -webkit-font-smoothing: inherit;\n    font: inherit;\n    outline: none;\n    border-radius: ",";\n    position: relative;\n\n    &:not([hidden]) {\n      display: flex;\n    }\n\n    &:focus {\n      box-shadow: ",";\n    }\n\n    &:focus:not(:focus-visible) {\n      box-shadow: none;\n    }\n\n    /* Added to increase the hit area of the collapsible fieldset */\n    &::after {\n      content: '';\n      position: absolute;\n      top: -10px;\n      right: -10px;\n      bottom: -10px;\n      left: -10px;\n    }\n  "])),(0,oK.hO)(i[2]),us({base:a,focusRing:r}))}),bv=(0,oV.ZP)(oK.xu)(tQ||(tQ=bm(["\n  width: 9px;\n  height: 9px;\n  margin-right: 3px;\n\n  & svg {\n    transition: transform 100ms;\n  }\n"]))),by=(0,oN.memo)(function(e){let{collapsed:n,collapsible:r,onClick:i,title:a}=e,{t:o}=dV(),l=(0,oZ.jsx)(oK.xv,{weight:"medium",size:1,children:a||(0,oZ.jsx)("span",{style:{color:"var(--card-muted-fg-color)"},children:o("form.field.untitled-fieldset-label")})});return r?(0,oZ.jsx)(bg,{children:(0,oZ.jsxs)(bx,{type:"button",onClick:i,children:[(0,oZ.jsx)(bv,{children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:(0,oZ.jsx)(lp.tgp,{style:{transform:"rotate(".concat(n?"0":"90deg",") translate3d(0, 0, 0)")}})})}),l]})}):(0,oZ.jsx)(bg,{children:l})});var bb=Object.freeze,bj=Object.defineProperty,bw=(e,n)=>bb(bj(e,"raw",{value:bb(n||e.slice())}));let bk=(0,oV.ZP)(oK.Kq).attrs({forwardedAs:"fieldset"})(t0||(t0=bw(["\n  border: none;\n\n  /* See: https://thatemil.com/blog/2015/01/03/reset-your-fieldset/ */\n  body:not(:-moz-handler-blocked) & {\n    display: table-cell;\n  }\n"]))),bC=(0,oV.ZP)(oK.xu)(e=>{let{$borderLeft:n,theme:r}=e,{focusRing:i}=r.sanity,{base:a}=r.sanity.color;return(0,oV.iv)(t1||(t1=bw(["\n    outline: none;\n    border-left: ",";\n\n    &:focus {\n      box-shadow: ",";\n    }\n\n    &:focus:not(:focus-visible) {\n      box-shadow: none;\n    }\n  "])),n?"1px solid var(--card-border-color)":void 0,us({base:a,focusRing:{...i,offset:2}}))}),b_=[],bT=(0,oN.forwardRef)(function(e,n){let{__internal_comments:r,__internal_slot:i=null,__unstable_headerActions:a=b_,__unstable_presence:o=b_,children:l,collapsed:s,collapsible:c,columns:d,description:u,level:p=0,onCollapse:h,onExpand:f,onFocus:m,tabIndex:g,title:x,validation:v=b_,inputId:y,deprecated:b,...j}=e,{focused:w,hovered:k,onMouseEnter:C,onMouseLeave:_}=vW(),T=v.length>0,S=(0,oK.ts)(n),{t:E}=dV(),P=(0,oN.useCallback)(e=>{S.current===e.target&&m&&m(e)},[S,m]),O=(0,oN.useCallback)(()=>s?null==f?void 0:f():null==h?void 0:h(),[s,h,f]),A=(0,oN.useMemo)(()=>s?null:(0,oZ.jsx)(oK.rj,{columns:d,gapX:4,gapY:5,children:"function"==typeof l?l():l}),[l,s,d]);return(0,oZ.jsxs)(bk,{"data-level":p,...j,onMouseEnter:C,onMouseLeave:_,space:2,children:[(0,oZ.jsx)(y9,{__internal_comments:r,__internal_slot:i,actions:a,fieldFocused:!!w,fieldHovered:k,presence:o,content:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(by,{collapsed:!!s,collapsible:c,onClick:c?O:void 0,title:x}),b&&(0,oZ.jsx)(oK.xu,{marginLeft:2,children:(0,oZ.jsx)(oK.Ct,{"data-testid":"deprecated-badge-".concat(x),tone:"caution",children:E("form.field.deprecated-label")})}),T&&(0,oZ.jsx)(oK.xu,{marginLeft:2,children:(0,oZ.jsx)(bo,{fontSize:1,placement:"top",validation:v})})]}),b&&(0,oZ.jsx)(LT,{"data-testid":"deprecated-message-".concat(x),tone:"caution",
1size:1,children:b.reason}),u&&(0,oZ.jsx)(oK.xv,{muted:!0,size:1,id:y7(y,u),children:u})]})}),(0,oZ.jsx)(bC,{$borderLeft:p>0,hidden:s,paddingLeft:0===p?0:3,onFocus:"number"==typeof g&&g>-1?P:void 0,ref:S,tabIndex:g,children:!s&&A})]})});var bS=Object.freeze,bE=Object.defineProperty;let bP=oV.ZP.div(t2||(t2=bS(bE(S=["\n  display: flex;\n  justify-content: flex-end;\n  box-sizing: border-box;\n  min-height: var(--avatar-height);\n  width: 77px;\n  margin-left: var(--small-padding);\n\n  &[data-max-avatars='1'] {\n    max-width: 23px;\n  }\n\n  &[data-position='top'] {\n    align-self: flex-start;\n  }\n\n  &[data-position='bottom'] {\n    align-self: flex-end;\n  }\n"],"raw",{value:bS(S.slice())}))));function bO(e){let{children:n,maxAvatars:r,position:i="bottom"}=e;return(0,oZ.jsx)(bP,{"data-max-avatars":r,"data-position":i,children:n})}let bA=(0,oN.forwardRef)(function(e,n){let{mode:r="bleed",tooltipProps:i,tone:a,...o}=e,{t:l}=dV();return(0,oZ.jsx)(lr.zx,{...o,icon:lp.xXb,mode:r,ref:n,tone:a,tooltipProps:{...i,content:(null==i?void 0:i.content)||l("common.context-menu-button.tooltip")}})});var bI=Object.freeze,bz=Object.defineProperty;let bM=(0,oV.ZP)(lr.zx)(t3||(t3=bI(bz(E=["\n  cursor: ",";\n"],"raw",{value:bI(E.slice())}))),e=>e.$grid?"move":"ns-resize"),bR=oN.createContext(null),bF=function(e){let n=(0,oN.useContext)(bR),{listeners:r,attributes:i}=(0,s5.nB)({id:n}),{t:a}=dV(),{mode:o="bleed",...l}=e;return(0,oZ.jsx)(bM,{icon:lp.VVU,tooltipProps:{content:a("inputs.array.action.drag.tooltip"),delay:{open:1e3}},mode:o,"data-ui":"DragHandleButton",...i,...l,...r})},bD=e=>n=>{let{containerNodeRect:r,draggingNodeRect:i,transform:a}=n;return i&&r?function(e,n,r,i){let a={...e},o=i.y||0,l=i.x||0;return n.top+a.y<=r.top+o?a.y=r.top-n.top+o:n.bottom+a.y>=r.top+r.height-o&&(a.y=r.top+r.height-n.bottom-o),n.left+a.x<=r.left-l?a.x=r.left-n.left+l:n.r
1ight+a.x>=r.left+r.width+l&&(a.x=r.left+r.width-n.right+l),a}(a,i,r,e):a};var bq=Object.freeze,bZ=Object.defineProperty,bN=(e,n)=>bq(bZ(e,"raw",{value:bq(n||e.slice())}));let bL="moving",bV=(0,oV.ZP)(oK.xu)(t5||(t5=bN(["\n  ","\n"])),e=>e.$moving&&(0,oV.iv)(t4||(t4=bN(["\n      z-index: 10000;\n      /* prevents hover-effects etc on the dragged element  */\n      pointer-events: none;\n    "])))),bK={threshold:{x:0,y:.02}},bB={coordinateGetter:s5.is},bU={duration:200,easing:"ease"},bH=(0,oN.memo)(function(e){let{items:n,axis:r,onItemMove:i,onItemMoveStart:a,onItemMoveEnd:o,children:l,...s}=e,c=(0,cn.Dy)((0,cn.VT)(cn.we),(0,cn.VT)(cn.Lg,bB)),d=(0,oN.useCallback)(e=>{var n,r,a,l;let{active:s,over:c}=e;s.id!==(null==c?void 0:c.id)&&(null==i||i({fromIndex:null==(r=null==(n=s.data.current)?void 0:n.sortable)?void 0:r.index,toIndex:null==(l=null==(a=null==c?void 0:c.data.current)?void 0:a.sortable)?void 0:l.index})),null==o||o()},[i,o]),u=(0,oN.useMemo)(()=>[bD({y:4}),...r?["x"===r?ci.K7:ci.DL]:[]],[r]);return(0,oZ.jsx)(cn.LB,{sensors:c,autoScroll:bK,modifiers:u,collisionDetection:cn.pE,onDragEnd:d,onDragStart:a,children:(0,oZ.jsx)(s5.Fo,{items:n,strategy:r?"x"===r?s5.PG:s5.qw:void 0,children:(0,oZ.jsx)(oK.rj,{...s,children:l})})})}),b$=(0,oN.forwardRef)(function(e,n){let{id:r,children:i,disableTransition:a}=e,{setNodeRef:o,transform:l,transition:s,active:c}=(0,s5.nB)({id:r,transition:a?null:bU}),d=r===(null==c?void 0:c.id),u=(0,oN.useMemo)(()=>({transform:cr.ux.Translate.toString(l),transition:s,pointerEvents:c?"none":void 0}),[l,s,c]),p=(0,oN.useCallback)(e=>{o(e),"function"==typeof n?n(e):n&&(n.current=e)},[n,o]);return(0,oZ.jsx)(bV,{ref:p,style:u,$moving:d,className:d?bL:"","data-index":e["data-index"],children:i})});function bW(e){let{onItemMove:n,onItemMoveEnd:r,onItemMoveStart:i,sortable:a,...o}=e,l=(0,oN.useCallback)(e=>{null==n||n(e)},[n]);return a?(0,oZ.jsx)(bH,{onItemMove:l,onItemMoveStart:i,onItemMoveEnd:r,...o}):(0,oZ.jsx)(oK.rj,{...o})}let bY=(0,oN.forwardRef)(function(e,n){let{sortable:r,...i}=e;return(0,oZ.jsx)(bR.Provider,{value:e.id,children:r?(0,oZ.jsx)(b$,{ref:n,...i}):(0,oZ.jsx)(bV,{ref:n,...i})})});var bX=Object.freeze,bG=Object.defineProperty;let bJ=(0,oV.ZP)(oK.Zb)(t8||(t8=bX(bG(P=["\n  position: relative;\n  border: 1px solid transparent;\n  transition: border-color 250ms;\n\n  ."," & {\n    border-color: var(--card-shadow-umbra-color);\n    box-shadow:\n      0 0 0 0,\n      0 8px 17px 2px var(--card-shadow-umbra-color),\n      0 3px 14px 2px var(--card-shadow-penumbra-color),\n      0 5px 5px -3px var(--card-shadow-ambient-color);\n  }\n\n  &:hover {\n    border-color: var(--card-shadow-umbra-color);\n  }\n\n  &[aria-selected='true'] {\n    border-color: var(--card-focus-ring-color);\n  }\n"],"raw",{value:bX(P.slice())}))),bL);function bQ(e){let{validation:n,selected:r,tone:i,presence:a,focused:o,children:l,dragHandle:s,menu:c,footer:d}=e,u=(0,oN.useRef)(null);return fV(o,(e,n)=>{var r;!e&&n&&(null==(r=u.current)||r.focus())}),(0,oZ.jsx)(bJ,{ref:u,selected:r,"aria-selected":r,radius:1,padding:1,tone:i,children:(0,oZ.jsxs)(oK.Kq,{space:1,children:[(0,oZ.jsxs)(oK.kC,{align:"center",gap:1,children:[s&&(0,oZ.jsx)(bF,{paddingY:3}),(0,oZ.jsx)(oK.xu,{flex:1,children:l}),(a||n||c)&&(0,oZ.jsxs)(oK.kC,{align:"center",flex:"none",gap:2,style:{lineHeight:0},children:[a&&(0,oZ.jsx)(oK.xu,{flex:"none",children:a}),n&&(0,oZ.jsx)(oK.xu,{flex:"none",children:n}),c]})]}),d]})})}function b0(e){return(0,ll.m$)(e)?"object"===e.name?{}:{_type:e.name}:(0,ll.jB)(e)?[]:"string"===e.jsonType?"":"number"===e.jsonType?0:"boolean"!==e.jsonType&&void 0}function b1(e){if(!(0,ll.m$)(e))throw Error('Invalid item type: "'.concat(e.type,'". Default array input can only contain objects (for now)'));return{...b0(e),_key:(0,sL.E2)(12)}}let b2={portal:!0,tone:"default",placement:"left",constrainSize:!0},b3=(0,oN.memo)(function(e){let{types:n,onInsert:r}=e,{t:i}=dV();return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(b4,{pos:"before",types:n,onInsert:r,text:i("inputs.array.action.add-before"),icon:lp.ySV}),(0,oZ.jsx)(b4,{pos:"after",types:n,onInsert:r,text:i("inputs.array.action.add-after"),icon:lp.oty})]})});function b4(e){let{types:n,onInsert:r,pos:i,text:a,icon:o}=e;return(null==n?void 0:n.length)===1?(0,oZ.jsx)(lr.sN,{text:a,icon:o,onClick:()=>r(i,n[0])},i):(0,oZ.jsx)(lr.kS,{text:a,popover:b2,children:null==n?void 0:n.map(e=>(0,oZ.jsx)(lr.sN,{icon:e.icon,text:e.title,onClick:()=>r(i,e)},e.name))},i)}let b5=()=>void 0,b8={isLoading:!0,result:void 0,error:void 0,retry:b5},b6={isLoading:!1,result:void 0,error:void 0,retry:b5};function b9(e,n){let r=(0,oN.useMemo)(()=>new oC.x,[]),i=(0,oN.useMemo)(()=>r.asObservable(),[r]),a=(0,oN.useCallback)(()=>{r.next({type:"retry"})},[r]),o=(0,oR.m2)(()=>(0,ox.z)((0,og.of)(null),i).pipe((0,aW.U)(()=>e),(0,a7.b)(e=>e?n(e).pipe((0,aW.U)(e=>({isLoading:!1,result:e,error:void 0,retry:a})),(0,a3.O)(b8),(0,aG.K)(e=>(console.error(e),(0,og.of)({isLoading:!1,result:void 0,error:e,retry:a}
1)))):(0,og.of)(b6))),[n,e,i,a],b8),l=fL(e,e);return e&&l!==e?b8:o}var b7=Object.freeze,je=Object.defineProperty;let jt=(0,oV.ZP)(oK.xv)(t6||(t6=b7(je(O=["\n  white-space: nowrap;\n"],"raw",{value:b7(O.slice())}))));function jn(e){let{absoluteDate:n,draft:r,published:i,singleLine:a}=e,{t:o}=dV(),l=r&&"_updatedAt"in r?r._updatedAt:"",s=i&&"_updatedAt"in i?i._updatedAt:"",c=hU({dateStyle:"medium",timeStyle:"short"}),d=l&&c.format(new Date(l)),u=s&&c.format(new Date(s)),p=h0(l||"",{minimal:!0,useTemporalPhrase:!0}),h=h0(s||"",{minimal:!0,useTemporalPhrase:!0}),f=n?u:h,m=n?d:p;return(0,oZ.jsxs)(oK.kC,{align:a?"center":"flex-start",direction:a?"row":"column",gap:2,wrap:"nowrap",children:[!f&&(0,oZ.jsx)(jt,{size:1,weight:"medium",children:o("document-status.not-published")}),f&&(0,oZ.jsx)(jt,{size:1,weight:"medium",children:o("document-status.published",{date:f})}),m&&(0,oZ.jsx)(jt,{muted:!0,size:1,wrap:"nowrap",children:o("document-status.edited",{date:m})})]})}var jr=Object.freeze,ji=Object.defineProperty;let ja=(0,oV.ZP)(oK.xv)(t9||(t9=jr(ji(A=["\n  &[data-status='edited'] {\n    --card-icon-color: var(--card-badge-caution-dot-color);\n  }\n  &[data-status='unpublished'] {\n    --card-icon-color: var(--card-badge-default-dot-color);\n    opacity: 0.5 !important;\n  }\n"],"raw",{value:jr(A.slice())}))));function jo(e){let{draft:n,published:r}=e,i=!!n,a=!!r,o=(0,oN.useMemo)(()=>i&&!a?"unpublished":"edited",[i,a]);return(i||a)&&(i||!a)?(0,oZ.jsx)(ja,{"data-status":o,size:1,children:(0,oZ.jsx)(lp.ZNd,{})}):null}function jl(e){var n,r;let{id:i,layout:a,preview:o,refType:l,renderPreview:s,showTypeLabel:c}=e,d=Mt(i),u=(null==(n=o.draft)?void 0:n._id)||(null==(r=o.published)?void 0:r._id)||i,p=(0,oN.useMemo)(()=>({_id:u,_type:l.name}),[u,l.name]),{draft:h,published:f}=o;return s((0,oN.useMemo)(()=>({children:(0,oZ.jsx)(oK.xu,{paddingLeft:3,children:(0,oZ.jsxs)(oK.gF,{space:3,children:[c&&(0,oZ.jsx)(oK.Ct,{mode:"outline",children:l.title}),d&&d.length>0&&(0,oZ.jsx)(yr,{presence:d}),(0,oZ.jsx)(jo,{draft:o.draft,published:o.published})]})}),layout:a,schemaType:l,tooltip:(0,oZ.jsx)(jn,{draft:h,published:f}),value:p}),[d,h,a,o.draft,o.published,p,f,l,c]))}function js(e){var n,r,i,a,o,l;let{layout:s="default",referenceInfo:c,renderPreview:d,type:u,value:p,showTypeLabel:h}=e,{t:f}=dV();if(c.isLoading||c.error)return(0,oZ.jsx)(h8,{isPlaceholder:!0,layout:s});if((null==(n=c.result)?void 0:n.availability.reason)==="NOT_FOUND"&&p._strengthenOnPublish){let e=u.to.find(e=>{var n;return e.name===(null==(n=null==p?void 0:p._strengthenOnPublish)?void 0:n.type)});if(!e)return(0,oZ.jsx)(jd,{documentId:p._ref,actualType:null==(r=p._strengthenOnPublish)?void 0:r.type,declaredTypes:u.to.map(e=>e.name)});let n=(null==(i=p._strengthenOnPublish)?void 0:i.type)?{_id:p._ref,_type:null==(a=p._strengthenOnPublish)?void 0:a.type}:p;return(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(oK.xu,{flex:1,children:d({layout:s,schemaType:e,value:n,skipVisibilityCheck:!0})}),(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.gF,{space:4,children:h&&(0,oZ.jsx)(oK.Ct,{mode:"outline",children:e.title})})})]})}let m=c.result.availability,g="NOT_FOUND"===m.reason,x="PERMISSION_DENIED"===m.reason;if(x||g)return(0,oZ.jsxs)(oK.gF,{space:2,children:[(0,oZ.jsx)(oK.xu,{padding:1,children:(0,oZ.jsx)(oK.kC,{align:"center",children:(0,oZ.jsx)(oK.xu,{flex:1,paddingY:2,children:(0,oZ.jsx)(oK.xv,{muted:!0,children:f("inputs.reference.error.document-unavailable-title")})})})}),x||g?(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(lr.u,{portal:!0,content:g?(0,oZ.jsx)(jc,{title:f("inputs.reference.error.nonexistent-document-title"),icon:lp.BHU,children:(0,oZ.jsx)(uz,{i18nKey:"inputs.reference.error.nonexistent-document-description",t:f,values:{documentId:p._ref}})}):(0,oZ.jsx)(jc,{title:f("inputs.reference.error.missing-read-permissions-title"),icon:lp.vaB,children:f("inputs.reference.error.missing-read-permissions-description")}),children:(0,oZ.jsx)(LT,{tone:"default",children:(0,oZ.jsx)(lp.BHU,{})})})}):null]});let v=null==(o=c.result)?void 0:o.type,y=u.to.find(e=>e.name===v);return y?(0,oZ.jsx)(jl,{id:p._ref,layout:s,preview:null==(l=c.result)?void 0:l.preview,refType:y,renderPreview:d,showTypeLabel:h}):(0,oZ.jsx)(jd,{documentId:p._ref,actualType:v||"<unknown>",declaredTypes:u.to.map(e=>e.name)}
1)}function jc(e){let n=e.icon;return(0,oZ.jsxs)(oK.kC,{children:[(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(n,{})}),(0,oZ.jsxs)(oK.xu,{flex:1,marginLeft:3,children:[(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:e.title}),(0,oZ.jsx)(oK.xu,{marginTop:3,children:(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:e.children})})]})]})}function jd(e){let{declaredTypes:n,documentId:r,actualType:i}=e,{t:a}=dV();return(0,oZ.jsxs)(oK.kC,{align:"center",justify:"flex-start",children:[(0,oZ.jsx)(oK.xu,{padding:1,children:(0,oZ.jsx)(oK.kC,{align:"center",children:(0,oZ.jsx)(oK.xu,{flex:1,paddingY:2,children:(0,oZ.jsx)(oK.xv,{muted:!0,children:a("inputs.reference.error.invalid-type-title")})})})}),(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(lr.u,{portal:!0,content:(0,oZ.jsx)(oK.Kq,{space:3,children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(uz,{t:a,i18nKey:"inputs.reference.error.invalid-type-description",values:{documentId:r,actualType:i},components:{AllowedTypes:()=>(0,oZ.jsx)(ju,{values:n})}})})}),children:(0,oZ.jsx)(oK.xu,{padding:2,children:(0,oZ.jsx)(LT,{tone:"default",children:(0,oZ.jsx)(lp.BHU,{})})})})})]})}function ju(e){let n=u_({type:"disjunction"}).formatToParts(e.values);return(0,oZ.jsx)(oN.Fragment,{children:n.map(e=>"element"===e.type?(0,oZ.jsx)("code",{children:e.value},e.value):e.value)})}var jp=Object.freeze,jh=Object.defineProperty;let jf=(0,oV.ZP)(oK.Zb)(t7||(t7=jp(jh(I=["\n  /* this is a hack to avoid layout jumps while previews are loading\n     there's probably better ways of solving this */\n  min-height: 33px;\n  position: relative;\n\n  /* TextWithTone uses its own logic to set color, and we therefore need */\n  /* to override this logic in order to set the correct color in different states */\n  &[data-selected],\n  &[data-pressed],\n  &:active {\n    [data-ui='TextWithTone'] {\n      color: inherit;\n    }\n  }\n"],"raw",{value:jp(I.slice())})))),jm=(0,oN.forwardRef)(function(e,n){let{as:r,documentId:i,documentType:a,...o}=e;return(0,oZ.jsx)(jf,{...o,...i&&a&&{"data-as":"a",forwardedAs:r,documentId:i,documentType:a},"data-ui":"ReferenceLinkCard",ref:n})}),jg=(0,oN.createContext)(null);function jx(e){let{menuRef:n,containerRef:r}=e;return(0,oZ.jsx)(jg.Provider,{value:{menuRef:n,containerRef:r},children:e.children})}var jv=Object.freeze,jy=Object.defineProperty,jb=(e,n)=>jv(jy(e,"raw",{value:jv(n||e.slice())}));let jj=oV.ZP.button(ne||(ne=jb(["\n  display: block;\n  -webkit-font-smoothing: inherit;\n  appearance: none;\n  font: inherit;\n  background: none;\n  width: 100%;\n  text-align: left;\n  border: 0;\n  margin: 0;\n  padding: 0;\n  outline: none;\n"]))),jw=(0,oV.ZP)(lp.tgp)(nt||(nt=jb(["\n  transform: ",";\n"])),e=>e.open?"rotate(90deg)":""),jk=(0,oV.ZP)(oK.kC)(nn||(nn=jb(["\n  cursor: default;\n"]))),jC=(0,oV.ZP)(oK.xu)(nr||(nr=jb(["\n  & > div > svg {\n    transform: rotate(0);\n    transition: transform 100ms;\n  }\n\n  &[data-open] > div > svg {\n    transform: rotate(90deg);\n  }\n"])));function j_(e){let{children:n,open:r,icon:i,title:a="Details",...o}=e,[l,s]=(0,oN.useState)(r||!1),c=(0,oN.useCallback)(()=>s(e=>!e),[]);return(0,oN.useEffect)(()=>s(r||!1),[r]),(0,oZ.jsxs)(oK.xu,{...o,children:[(0,oZ.jsx)(jj,{type:"button",onClick:c,children:(0,oZ.jsx)(jk,{align:"center",children:(0,oZ.jsxs)(oK.gF,{children:[(0,oZ.jsx)(jC,{"data-open":l?"":void 0,children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(jw,{open:l})})}),i&&(0,oZ.jsx)(oK.xu,{marginLeft:1,children:i}),(0,oZ.jsx)(oK.xu,{flex:1,marginLeft:1,children:(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:a})})]})})}),(0,oZ.jsx)(oK.xu,{hidden:!l,marginTop:3,children:n})]})}let jT={warning:"caution",error:"critical",info:"positive"},jS={warning:(0,oZ.jsx)(lp.foC,{}),error:(0,oZ.jsx)(lp.uIy,{}),info:(0,oZ.jsx)(lp.hQ6,{})};function jE(e){let{children:n,status:r="warning",title:i,...a}=e;return(0,oZ.jsx)(oK.Zb,{radius:2,tone:jT[r],...a,"data-ui":"Alert",children:(0,oZ.jsx)(oK.kC,{padding:1,children:n&&(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(j_,{icon:jS[r],title:i,children:(0,oZ.jsx)(oK.xu,{marginLeft:3,marginTop:3,children:n})})})})})}function jP(e){let{schemaType:n,handleRemoveStrengthenOnPublish:r}=e,{t:i}=dV();return(0,oZ.jsx)(jE,{padding:1,title:i(n.weak?"inputs.reference.incomplete-reference.finalize-action-title":"inputs.reference.incomplete-reference.strengthen-action-title"),status:"info","data-testid":"alert-reference-published",children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:i,i18nKey:n.weak?"inputs.reference.incomplete-reference.finalize-action-description":"inputs.reference.incomplete-reference.strengthen-action-description"})}),(0,oZ.jsx)(lr.zx,{mode:"ghost",onClick:r,size:"large",text:i("inputs.reference.incomplete-reference.strengthen-button-label"),tone:"positive"})]})})}function jO(e){let{actualStrength:n,handleFixStrengthMismatch:r}=e,i="weak"===n?"strong":"weak",{t:a}=dV();return(0,oZ.jsx)(jE,{padding:1,title:a("inputs.reference.strength-mismatch.title"),status:"warning","data-testid":"alert-reference-strength-mismatch",children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:a,i18nKey:"weak"===n?"inputs.reference.strength-mismatch.is-weak-description":"inputs.reference.strength-mismatch.is-strong-description"})}),(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:a("weak"===i?"inputs.reference.strength-mismatch.is-strong-consquences":"inputs.reference.strength-mismatch.is-weak-consquences")}),(0,oZ.jsx)(lr.zx,{mode:"ghost",onClick:r,size:"large",text:a("weak"===i?"inputs.reference.strength-mismatch.weaken-button-label":"inputs.reference.strength-mismatch.strengthen-button-label"),tone:"caution"})]})})}function jA(e){let{errorMessage:n,onHandleRetry:r}=e,{t:i}=dV();return(0,oZ.jsx)(jE,{padding:1,title:i("inputs.reference.metadata-error.title"),status:"warning","data-testid":"alert-reference-info-failed",children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:n}),(0,oZ.jsx)(lr.zx,{mode:"ghost",onClick:r,size:"large",text:i("inputs.reference.metadata-error.retry-button-label"),tone:"primary"})]})})}let jI={portal:!0,tone:"default"};function jz(e){var n,r,i,a,o,l,s;let{schemaType:c,parentSchemaType:d,path:u,readOnly:p,onRemove:h,value:f,open:m,onInsert:g,presence:x,validation:v,inputId:y,changed:b,focused:j,children:w,inputProps:{onCh
1ange:k,focusPath:C,onPathFocus:_,renderPreview:T,elementProps:S}}=e,E=!p&&(null==(n=d.options)?void 0:n.sortable)!==!1,P=d.of,O=(0,oN.useRef)(null),A=(0,oN.useRef)(null),I=(0,oN.useRef)(null),{EditReferenceLink:z,getReferenceInfo:M,selectedState:R,isCurrentDocumentLiveEdit:F}=Sl({path:u,schemaType:c,value:f});v4(O,m),fV(j,(e,n)=>{var r;!e&&n&&O.current&&(null==(r=O.current)||r.focus())});let D=e.validation.some(e=>"error"===e.level),q=e.validation.some(e=>"warning"===e.level),Z=f._resolvingInitialValue,N=(0,oN.useCallback)(()=>{g({items:[{...f,_key:v8()}],position:"after"})},[g,f]),L=(0,oN.useCallback)((e,n)=>{g({items:[{...b1(n),_key:v8()}],position:e})},[g]),V=b9(null==f?void 0:f._ref,M),K=f._ref,B=(null==(r=V.result)?void 0:r.type)||(null==(i=null==f?void 0:f._strengthenOnPublish)?void 0:i.type),U=K&&(null==(l=null==(o=null==(a=V.result)?void 0:a.preview)?void 0:o.published)?void 0:l._id),H=(0,oN.useCallback)(()=>{k([!0===c.weak?fz(!0,["_weak"]):fM(["_weak"]),fM(["_strengthenOnPublish"])])},[k,c.weak]),$=B?c.to.find(e=>e.name===B):void 0,W="pressed"===R,Y="selected"===R,X=function(e){let{readOnly:n,hasErrors:r,hasWarnings:i}=e;return n?"transparent":r?"critical":i?"caution":"default"}({readOnly:p,hasErrors:D,hasWarnings:q}),G=!K||"_ref"===C[0],{t:J}=dV(),Q=(0,oN.useMemo)(()=>(0,oN.forwardRef)(function(e,n){return(0,oZ.jsx)(lm.nR,{...e,intent:"edit",params:{id:null==f?void 0:f._ref,type:null==$?void 0:$.name},target:"_blank",rel:"noopener noreferrer",ref:n})}),[null==$?void 0:$.name,null==f?void 0:f._ref]),ee=(0,oN.useCallback)(()=>{K&&G?_([]):_(["_ref"])},[K,G,_]),et=(0,oN.useMemo)(()=>p?null:(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(bA,{paddingY:3}),id:"".concat(y,"-menuButton"),menu:(0,oZ.jsxs)(oK.v2,{ref:A,children:[!p&&(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(lr.sN,{text:J("inputs.reference.action.remove"),tone:"critical",icon:lp.XHJ,onClick:h}),(0,oZ.jsx)(lr.sN,{text:J(K&&G?"inputs.reference.action.replace-cancel":"inputs.reference.action.replace"),icon:K&&G?lp.Two:lp.bnu,onClick:ee}),(0,oZ.jsx)(lr.sN,{text:J("inputs.reference.action.duplicate"),icon:lp.TIy,onClick:N}),(0,oZ.jsx)(b3,{onInsert:L,types:P})]}),!p&&!G&&K&&(0,oZ.jsx)(oK.R,{}),!G&&K&&(0,oZ.jsx)(lr.sN,{as:Q,"data-as":"a",text:J("inputs.reference.action.open-in-new-tab"),icon:lp.buG})]}),popover:jI}),[N,L,ee,K,y,P,G,h,Q,p,J]),en=(0,oN.useCallback)(()=>{k(!0===c.weak?fz(!0,["_weak"]):fM(["_weak"]))},[k,c]),er=(null==f?void 0:f._weak)?"weak":"strong",ei=!0===c.weak?"weak":"strong",ea=K&&!V.isLoading&&(null==f?void 0:f._strengthenOnPublish),eo=!V.isLoading&&(null==(s=V.result)?void 0:s.availability.available)&&K&&er!==ei&&!ea,el=(0,oZ.jsxs)(oZ.Fragment,{children:[F&&U&&f._strengthenOnPublish&&(0,oZ.jsx)(jP,{schemaType:c,handleRemoveStrengthenOnPublish:H}),eo&&(0,oZ.jsx)(jO,{actualStrength:er,handleFixStrengthMismatch:en}),V.error&&(0,oZ.jsx)(jA,{errorMessage:V.error.message,onHandleRetry:V.retry})]}),es=(0,oZ.jsx)(jx,{menuRef:A,containerRef:I,children:(0,oZ.jsx)(bQ,{dragHandle:E,presence:!G&&x.length>0&&(0,oZ.jsx)(yC,{presence:x,maxAvatars:1}),validation:!G&&v.length>0&&(0,oZ.jsx)(bo,{validation:v}),menu:et,footer:G?void 0:el,tone:G?void 0:X,focused:j,children:G?(0,oZ.jsx)(oK.xu,{padding:1,ref:I,children:(0,oZ.jsx)(bT,{title:c.title,description:c.description,__unstable_presence:x,validation:v,inputId:y,deprecated:c.deprecated,children:w})}):(0,oZ.jsxs)(jm,{as:z,tone:"inherit",radius:2,documentId:null==f?void 0:f._ref,documentType:null==$?void 0:$.name,disabled:Z,__unstable_focusRing:!0,selected:Y,pressed:W,"data-selected":!!Y||void 0,"data-pressed":!!W||void 0,...S,children:[(0,oZ.jsx)(js,{value:f,referenceInfo:V,renderPreview:T,type:c}),Z&&(0,oZ.jsx)(u4,{fill:!0})]})})});return(0,oZ.jsx)(dQ,{path:u,isChanged:b,hasFocus:!!j,children:(0,oZ.jsx)(oK.xu,{paddingX:1,children:es})})}function jM(e){return(0,ll.m$)(e.schemaType)}function jR(e){return(0,ll.jB)(e.schemaType)}function jF(e){return void 0!==e._key?e:{...e,_key:v8(12)}}function jD(e,n){let r=e.indexOf(n);return r>-1&&e.splice(r,1),e}let jq=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4,n=[],r=[],i=new oC.x;return function a(o){return new oy.y(l=>{if(n.length>=e)return(r.push(o),i.asObservable().pipe((0,oe.P)(e=>e===o))).pipe((0,aQ.z)(a)).subscribe(l);let s=o.subscribe(l);return n.push(s),()=>{jD(n,s),jD(r,o),s.unsubscribe(),function(){for(;r.length>0&&n.length<e;)i.next(r.shift())}()}})}}(n);return function(){return(0,ob.D)(r(e(...arguments)))}}(function(e,n,r){var i;let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=a.metadata,l=a.storeOriginalFilename,{label:s,title:c,description:d,creditLine:u,source:p}=a;return(i=r,window.crypto&&window.crypto.subtle&&window.FileReader?new oy.y(e=>{let n=new FileReader;return n.onload=()=>
1{e.next(n.result),e.complete()},n.onerror=n=>{e.error(n)},n.readAsArrayBuffer(i),()=>{n.abort()}}).pipe((0,aQ.z)(e=>crypto.subtle.digest("SHA-1",e)),(0,aW.U)(jV)):(0,og.of)(null)).pipe((0,aG.K)(()=>(0,og.of)(null)),(0,aQ.z)(r=>r?e.observable.fetch("*[_type == $documentType && sha1hash == $hash][0]",{documentType:"sanity.".concat(n,"Asset"),hash:r},{tag:"asset.find-duplicate"}):(0,og.of)(null)),(0,aQ.z)(i=>i?(0,og.of)({type:"complete",id:i._id,asset:i}):e.observable.assets.upload(n,r,{tag:"asset.upload",extract:o,preserveFilename:l,label:s,title:c,description:d,creditLine:u,source:p}).pipe((0,aW.U)(e=>"response"===e.type?{type:"complete",id:e.body.document._id,asset:e.body.document}:e))))},4),jZ=(e,n,r)=>jq(e,"image",n,r),jN=(e,n,r)=>jq(e,"file",n,r);function jL(e,n){return e.observePaths({_type:"reference",_ref:n},["originalFilename","url","metadata","label","title","description","creditLine","source","size"])}function jV(e){return Array.prototype.map.call(new Uint8Array(e),e=>"00".concat(e.toString(16)).slice(-2)).join("")}let jK=/(invalid image format)|(No exif data)/i;function jB(e){return[5,6,7,8].indexOf(e)>-1}function jU(e,n,r){let i=e.getContext("2d");null==i||i.translate(n?e.width:0,r?e.height:0),null==i||i.scale(n?-1:1,r?-1:1)}let jH=[{op:"none",degrees:0},{op:"flip-x",degrees:0},{op:"none",degrees:180},{op:"flip-y",degrees:0},{op:"flip-x",degrees:90},{op:"none",degrees:90},{op:"flip-x",degrees:-90},{op:"none",degrees:-90}],j$=["top-left","top-right","bottom-right","bottom-left","left-top","right-top","right-bottom","left-bottom"],jW="_upload";function jY(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{type:"uploadProgress",patches:e}}let jX=jY([fM([jW])]);function jG(e){let n=new Date().toISOString();return jY([fz({progress:2,createdAt:n,updatedAt:n,file:{name:e.name,type:e.type}},[jW])])}function jJ(e,n,r){let i=jN(e,n,r).pipe((0,aW.U)(e=>"complete"===e.type?jY([fz({_type:"reference",_ref:e.asset._id},["asset"]),fz(100,[jW,"progress"]),fz(new Date().toISOString(),[jW,"updated"])]):jY([fz(e.percent,[jW,"progress"]),fz(new Date().toISOString(),[jW,"updated"])])));return(0,ox.z)((0,og.of)(jG(n)),i,(0,og.of)(jX))}let jQ=[{type:"image",accepts:"image/*",upload:(e,n,r,i)=>(function(e,n,r){let i=jZ(e,n,r).pipe((0,a2.h)(e=>"download"!==e.stage),(0,aW.U)(e=>({...e,progress:2+e.percent/100*98})),(0,aW.U)(e=>"complete"===e.type?jY([fz({_type:"reference",_ref:e.asset._id},["asset"]),fz(100,[jW,"progress"]),fz(new Date().toISOString(),[jW,"updatedAt"])]):jY([fz(e.percent,[jW,"progress"]),fz(new Date().toISOString(),[jW,"updatedAt"])]))),a=(0,ob.D)(new oy.y(e=>{let r=new window.FileReader;return r.onerror=n=>e.error(n),r.onload=()=>{e.next(r.result),e.complete()},r.readAsArrayBuffer(n.slice(0,128e3)),()=>r.abort()})).pipe((0,aW.U)(e=>s7()(e)),(0,aG.K)(e=>(jK.test(e.message)||console.warn("Exif read failed, continuing anyway: ".concat(e.message)),(0,og.of)({})))).pipe((0,aQ.z)(e=>{var r,i;return r=e.orientation||"top-left",(i=window.URL.createObjectURL(n),new oy.y(e=>{let n=new window.Image;return n.onerror=()=>{e.error(Error('Could not load image from url "'.concat(i,'". Image may be of an unsupported format')))},n.onload=()=>{e.next(n),e.complete()},n.src=i,()=>{}})).pipe((0,aQ.z)(e=>new oy.y(n=>{let i=function(e,n){let r=jH[n-1],i=e.height/e.width;e.width=120/i,e.height=e.width*i;let a=document.createElement("canvas"),o=a.getContext("2d");if(jB(n)?(a.height=e.width,a.width=e.height):(a.width=e.width,a.height=e.height),"flip-x"===r.op&&jU(a,!0,!1),"flip-y"===r.op&&jU(a,!1,!0),r.degrees&&(function(e,n){let r=n.x,i=n.y,a=(n.degrees||0)*(Math.PI/180);null==e||e.translate(r,i),null==e||e.rotate(a),null==e||e.translate(-r,-i)}(o,{degrees:r.degrees,x:a.width/2,y:a.height/2}),jB(n))){let e=a.width-a.height;null==o||o.translate(e/2,-e/2)}return null==o||o.drawImage(e,0,0,e.width,e.height),a}(e,j$.indexOf(r)+1);n.next(i.toDataURL("image/jpeg",.1)),n.complete()})))}),(0,aG.K)(e=>(console.warn('Image preprocessing failed for "%s" with the error: %s',n.name,e.message),(0,og.of)(null))),(0,a2.h)(Boolean),(0,aW.U)(e=>jY([fz(e,[jW,"previewImage"])])));return(0,ox.z)((0,og.of)(jG(n)),(0,ow.T)(i,a),(0,og.of)(jX))})(e,n,i)},{type:"string",accepts:"text/*",upload:(e,n,r,i)=>jJ(e,n,i).pipe((0,aW.U)(e=>({type:"uploadProgress",patches:[fz(e)]})))},{type:"file",accepts:"",upload:(e,n,r,i)=>jJ(e,n,i)}].map((e,n)=>({...e,priority:n}));function j0(e,n){if(!e||!n)return!0;let r=Array.isArray(n)?n:n.split(","),i=e.name||"",a=(e.type||"").toLowerCase(),o=a.replace(/\/.*$/,"");return r.some(e=>{let n=e.trim().toLowerCase();return"."===n.charAt(0)?i.toLowerCase().endsWith(n):n.endsWith("/*")?o===n.replace(/\/.*$/,""):a===n})}function j1(e,n){return jQ.find(r=>{var i;return fc(r.type,e)&&j0(n,r.accepts)&&j0(n,(null==(i=e.options)?void 0:i.accept)||"")})||null}let j2=["_key","_type","_weak"];function j3(e){return Object.keys(e).every(e=>j2.includes(e))}
1let j4=(e,n)=>{let r=(0,sL.wq)(n);return e.of.find(e=>e.name===r)};function j5(e,n,r){return(0,ob.D)(e).pipe((0,aQ.z)(e=>{let i={_key:e._key};return(0,og.of)(j4(n,e)).pipe((0,aQ.z)(e=>e?(0,og.of)(e):ov.E),(0,aQ.z)(n=>j3(e)&&r?(0,ox.z)((0,og.of)({type:"patch",patches:[fz(!0,[i,"_resolvingInitialValue"])]}),(0,oj.P)(()=>r(n,e)).pipe((0,a2.h)(dd),(0,aW.U)(e=>{var n;return{type:"patch",patches:(n=[i],Object.entries(e).map(e=>{let[r,i]=e;return fz(i,[...n,r])}))}}),(0,aG.K)(r=>(0,og.of)({type:"error",error:r,item:e,schemaType:n}))),(0,og.of)({type:"patch",patches:[fM([i,"_resolvingInitialValue"])]})):ov.E))}))}let j8="before",j6="after";function j9(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.reduce((e,n)=>e.concat(n),[])}let j7=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),we={replace:(e,n)=>n,set:(e,n)=>n,setIfMissing:(e,n)=>void 0===e?n:e,unset(e,n){},inc:(e,n)=>e+n,dec:(e,n)=>e-n},wt=Object.keys(we),wn={replace:(e,n)=>n,set:(e,n)=>n,setIfMissing:(e,n)=>void 0===e?n:e,unset(e,n){},diffMatchPatch(e,n){let[r]=(0,sY.QE)((0,sY.G8)(n),e,{allowExceedingIndices:!0});return r}},wr=Object.keys(wn);function wi(e,n){return n.reduce(function e(n,r){return Array.isArray(n)?function(n,r){let i=n.slice();if(0===r.path.length){if("setIfMissing"===r.type){if(!Array.isArray(r.value))throw Error("Cannot set value of an array to a non-array");return void 0===n?r.value:n}if("set"===r.type){if(!Array.isArray(r.value))throw Error("Cannot set value of an array to a non-array");return r.value}if("unset"===r.type)return;if("move"===r.type){if(!r.value||!j7(r.value,"from")||!j7(r.value,"to"))throw Error('Invalid value of \'move\' patch. Expected a value with "from" and "to" indexes, instead got: '.concat(JSON.stringify(r.value)));return function(e,n,r){let i=e.slice(),a=i[n];return i.splice(n,1),i.splice(r,0,a),i}(i,r.value.from,r.value.to)}throw Error("Invalid array operation: ".concat(r.type))}let[a,...o]=r.path,l=function(e,n){if("number"==typeof n)return n;let r=cU()(e,n);return -1!==r&&r}(n,a);if(!1===l)return i;if(0===o.length){if("insert"===r.type){let{position:e,items:i}=r;return function(e,n,r){if(n!==j8&&n!==j6)throw Error('Invalid position "'.concat(n,'", must be either ').concat(j8," or ").concat(j6));for(var i=arguments.length,a=Array(i>3?i-3:0),o=3;o<i;o++)a[o-3]=arguments[o];let l=j9(...a);if(0===e.length)return l;let s=e.length,c=Math.abs((s+r)%s)%s,d=e.slice();return d.splice("after"===n?c+1:c,0,...j9(l)),d}(n,e,l,i)}if("unset"===r.type){if("number"!=typeof l)throw Error('Expected array index to be a number, instead got "'.concat(l,'"'));return i.splice(l,1),i}}return i[l]=e(i[l],{...r,path:o}),i}(n,r):ly()(n)?function(e,n){if(!wr.includes(n.type))throw Error('Received patch of unsupported type: "'.concat(JSON.stringify(n.type),'" for string. This is most likely a bug.'));if(n.path.length>0)throw Error('Cannot apply deep operations on string values. Received patch with type "'.concat(n.type,'" and path "').concat(n.path.join("."),' that targeted the value "').concat(JSON.stringify(e),'"'));return wn[n.type](e,n.value)}(n,r):cK()(n)?function(n,r){let i=c$()(n);if(0===r.path.length){if("set"===r.type){if(!cK()(r.value))throw Error("Cannot set value of an object to a non-object");return r.value}if("unset"===r.type)return;if("setIfMissing"===r.type)return void 0===n?r.value:n;throw Error("Invalid object operation: ".concat(r.type))}let[a,...o]=r.path;if("string"!=typeof a)throw Error("Expected field name to be a string, instad got: ".concat(a));return 0===o.length&&"unset"===r.type?sH()(i,a):(i[a]=e(i[a],{...r,path:o}),i)}(n,r):function(e,n){if(!wt.includes(n.type))throw Error('Received patch of unsupported type "'.concat(n.type,'" for primitives. This is most likely a bug.'));if(n.path.length>0)throw Error('Cannot apply deep operations on primitive values. Received patch with type "'.concat(n.type,'" and path "').concat(n.path.map(e=>JSON.stringify(e)).join("."),' that targeted the value "').concat(JSON.stringify(e),'"'));return we[n.type](e,n.value)}(n,r)},e)}
1function wa(e){let{onPathBlur:n,onPathFocus:r,onChange:i,onSetPathCollapsed:a,onSetFieldSetCollapsed:o,onPathOpen:l,onFieldGroupSelect:s}=vC(),{member:c,renderAnnotation:d,renderBlock:u,renderField:p,renderInlineBlock:h,renderInput:f,renderItem:m,renderPreview:g}=e,x=v0(),v=(0,oN.useRef)(),y=(0,oN.useRef)({});fV(c.field.focused,(e,n)=>{var r;!e&&n&&(null==(r=v.current)||r.focus())});let b=(0,oN.useCallback)(e=>{e.currentTarget===e.target&&e.currentTarget===v.current&&r(c.field.path)},[c.field.path,r]),j=(0,oN.useCallback)(e=>{e.currentTarget===e.target&&e.currentTarget===v.current&&n(c.field.path)},[c.field.path,n]),w=(0,oN.useRef)(c.field.value);(0,oN.useEffect)(()=>{w.current=c.field.value},[c.field.value]);let k=(0,oN.useCallback)(e=>{let n=fR.from(e).patches;if(n.some(e=>"unset"===e.type&&1===e.path.length)&&(w.current=wi(w.current||[],n),Array.isArray(w.current)&&!w.current.length)){i(fR.from(fM([c.name])));return}i(fR.from(e).prepend(fA([])).prefixAll(c.name))},[i,c.name,w]),C=I8(),_=(0,oK.pm)(),T=(0,oN.useCallback)(()=>{a(c.field.path,!0)},[a,c.field.path]),S=(0,oN.useCallback)(()=>{a(c.field.path,!1)},[a,c.field.path]),E=(0,oN.useCallback)(e=>{a(c.field.path.concat({_key:e}),!0)},[a,c.field.path]),P=(0,oN.useCallback)(e=>{a(c.field.path.concat({_key:e}),!1)},[a,c.field.path]),O=(0,oN.useCallback)(e=>{l(e),a(e,!1)},[l,a]),A=(0,oN.useCallback)(()=>{l(c.field.path),a(c.field.path,!0)},[l,c.field.path,a]),I=(0,oN.useCallback)(e=>{if(0===e.items.length)throw Error("Insert event should include at least one item");let n=e.items.map(e=>jF(e));k(fR.from([fI(n,e.position,[e.referenceItem])]));let i=n[0]._key,a=[...c.field.path,{_key:i}];r(a);let o=!1!==e.open;e.skipInitialValue?o&&O(a):j5(n,c.field.schemaType,C).pipe((0,a4.b)(e=>{"patch"===e.type?k(e.patches):_.push({title:"Could not resolve initial value",description:"Unable to resolve initial value for type: ".concat(e.schemaType.title,": ").concat(e.error.message,"."),status:"error"})})).subscribe({complete:()=>{o&&O(a)}})},[k,O,c.field.path,c.field.schemaType,r,C,_]),z=(0,oN.useCallback)(e=>{let n=c.field.value,r=null==n?void 0:n[e.fromIndex],i=null==n?void 0:n[e.toIndex];if(e.fromIndex!==e.toIndex){if(!(null==r?void 0:r._key)||!(null==i?void 0:i._key)){console.error("Neither the item you are moving nor the item you are moving to have a key. Cannot continue.");return}k([fM([{_key:r._key}]),fI([r],e.fromIndex>e.toIndex?"before":"after",[{_key:i._key}])])}},[k,c.field.value]),M=(0,oN.useCallback)(e=>{k([fA([]),fI([jF(e)],"before",[0])])},[k]),R=(0,oN.useCallback)(e=>{k([fA([]),fI([jF(e)],"after",[-1])])},[k]),F=(0,oN.useCallback)(e=>{y.current[e]&&(y.current[e].unsubscribe(),delete y.current[e]),k([fM([{_key:e}])])},[k]),D=(0,oN.useCallback)(e=>{r(c.field.path.concat(e))},[c.field.path,r]),q=(0,oN.useMemo)(()=>({onBlur:j,onFocus:b,id:c.field.id,ref:v,"aria-describedby":y7(c.field.id,c.field.schemaType.description)}),[j,b,c.field.id,c.field.schemaType.description]),Z=hN(h$),N=vm(),L=N.__internal.image.directUploads,V=N.__internal.file.directUploads,K=(0,oN.useCallback)((e,n)=>fc("image",e)&&!L||fc("file",e)&&!V?null:j1(e,n),[V,L]),B=(0,oN.useCallback)(e=>{let{file:n,schemaType:r,uploader:i}=e,a=b1(r),o=a._key;I({items:[a],position:"after",referenceItem:-1,open:!1});let l=i.upload(Z,n,r).pipe((0,aW.U)(e=>fR.from(e.patches||[]).prefixAll({_key:o})),(0,a4.b)(e=>k(e.patches)));y.current={...y.current,[o]:l.subscribe()}},[Z,k,I]),U=(0,oN.useMemo)(()=>({level:c.field.level,members:c.field.members,value:c.field.value,readOnly:c.field.readOnly,schemaType:c.field.schemaType,changed:c.field.changed,id:c.field.id,onItemExpand:P,onItemCollapse:E,onItemClose:A,onItemOpen:O,focusPath:c.field.focusPath,focused:c.field.focused,path:c.field.path,onChange:k,onInsert:I,onItemMove:z,onItemRemove:F,onItemAppend:R,onItemPrepend:M,onPathFocus:D,resolveInitialValue:C,onUpload:B,resolveUploader:K,validation:c.field.validation,presence:c.field.presence,renderAnnotation:d,renderBlock:u,renderInlineBlock:h,renderInput:f,renderField:p,renderItem:m,renderPreview:g,elementProps:q}),[c.field.level,c.field.members,c.field.value,c.field.readOnly,c.field.schemaType,c.field.changed,c.field.id,c.field.focusPath,c.field.focused,c.field.path,c.field.validation,c.field.presence,P,E,A,O,k,I,z,F,R,M,D,C,B,K,d,u,h,f,p,m,g,q]),H=(0,oN.useMemo)(()=>f(U),[U,f]),$=(0,oN.useMemo)(()=>({actions:x,name:c.name,index:c.index,level:c.field.level,value:c.field.value,title:c.field.schemaType.title,de
1scription:c.field.schemaType.description,collapsible:c.collapsible,collapsed:c.collapsed,changed:c.field.changed,onCollapse:T,onExpand:S,schemaType:c.field.schemaType,inputId:c.field.id,path:c.field.path,presence:c.field.presence,validation:c.field.validation,children:H,inputProps:U}),[x,c.name,c.index,c.field.level,c.field.value,c.field.schemaType,c.field.changed,c.field.id,c.field.path,c.field.presence,c.field.validation,c.collapsible,c.collapsed,T,S,H,U]);return(0,oZ.jsx)(vk,{onFieldGroupSelect:s,onChange:k,onSetFieldSetCollapsed:o,onSetPathCollapsed:a,onPathOpen:l,onPathBlur:n,onPathFocus:r,children:(0,oN.useMemo)(()=>p($),[$,p])})}function wo(e,n,r){return(0,ll.J1)(e)&&"string"==typeof r&&Number(r)===n?r:String(null!=n?n:"")}function wl(e){let{member:n,renderInput:r,renderField:i}=e,a=v0(),o=(0,oN.useRef)(),[l,s]=(0,oN.useState)(),{onPathBlur:c,onPathFocus:d,onChange:u}=vC();(0,oN.useEffect)(()=>{var e;n.field.focused&&(null==(e=o.current)||e.focus())},[n.field.focused]);let p=(0,oN.useCallback)(()=>{c(n.field.path)},[n.field.path,c]),h=(0,oN.useCallback)(()=>{d(n.field.path)},[n.field.path,d]),f=(0,oN.useCallback)(e=>{u(fR.from(e).prefixAll(n.name))},[u,n.name]),m=(0,oN.useCallback)(e=>{let r=e.currentTarget.value;if((0,ll.J1)(n.field.schemaType)){if((r=e.currentTarget.valueAsNumber)>Number.MAX_SAFE_INTEGER||r<Number.MIN_SAFE_INTEGER)return}else(0,ll.EG)(n.field.schemaType)&&(r=e.currentTarget.checked);let i=""===r||"number"==typeof r&&isNaN(r);(0,ll.J1)(n.field.schemaType)&&s(i?void 0:e.currentTarget.value),u(fR.from(i?fM():fz(r)).prefixAll(n.name))},[n.name,n.field.schemaType,u]),g=(0,oN.useMemo)(()=>n.field.validation.filter(e=>"error"===e.level).map(e=>e.message).join("\n"),[n.field.validation])||void 0,x=(0,oN.useMemo)(()=>({onBlur:p,onFocus:h,id:n.field.id,ref:o,onChange:m,value:wo(n.field.schemaType,n.field.value,l),readOnly:!!n.field.readOnly,placeholder:n.field.schemaType.placeholder,"aria-describedby":y7(n.field.id,n.field.schemaType.description)}),[p,h,m,n.field.id,n.field.readOnly,n.field.schemaType,n.field.value,l]),v=(0,oN.useMemo)(()=>({value:n.field.value,readOnly:n.field.readOnly,schemaType:n.field.schemaType,changed:n.field.changed,id:n.field.id,path:n.field.path,focused:n.field.focused,level:n.field.level,onChange:f,validation:n.field.validation,presence:n.field.presence,validationError:g,elementProps:x}),[n.field.value,n.field.readOnly,n.field.schemaType,n.field.changed,n.field.id,n.field.path,n.field.focused,n.field.level,n.field.validation,n.field.presence,f,g,x]),y=(0,oN.useMemo)(()=>r(v),[v,r]),b=(0,oN.useMemo)(()=>({actions:a,changed:n.field.changed,children:y,description:n.field.schemaType.description,index:n.index,inputId:n.field.id,inputProps:v,level:n.field.level,name:n.name,path:n.field.path,presence:n.field.presence,schemaType:n.field.schemaType,title:n.field.schemaType.title,validation:n.field.validation,value:n.field.value}),[a,n.field.level,n.field.value,n.field.schemaType,n.field.id,n.field.path,n.field.validation,n.field.presence,n.field.changed,n.name,n.index,y,v]);return(0,oZ.jsx)(oZ.Fragment,{children:i(b)})}let ws=function(e){let{onPathBlur:n,onPathFocus:r,onChange:i,onPathOpen:a,onSetPathCollapsed:o,onSetFieldSetCollapsed:l,onFieldGroupSelect:s}=vC(),{member:c,renderAnnotation:d,renderBlock:u,renderField:p,renderInlineBlock:h,renderInput:f,renderItem:m,renderPreview:g}=e,x=v0(),v=(0,oN.useRef)(),y=(0,oN.useRef)(c.field.value);(0,oN.useEffect)(()=>{y.current=c.field.value},[c.field.value]),fV(c.field.focused,(e,n)=>{var r;!e&&n&&(null==(r=v.current)||r.focus())});let b=(0,oN.useCallback)(()=>{n(c.field.path)},[c.field.path,n]),j=(0,oN.useCallback)(()=>{r(c.field.path)},[c.field.path,r]),w=(0,oN.useCallback)(e=>{r(c.field.path.concat(e))},[c.field.path,r]),k=(0,oN.useCallback)(e=>{if(0!==c.field.path.length){let n=fR.from(e).patches;if(y.current=wi(y.current||{},n),y.current&&(0,sL.Sm)(y.current)){i(fR.from(fM([c.name])));return}}i(fR.from(e).prepend(fA(b0(c.field.schemaType))).prefixAll(c.name))},[i,c,y]),C=(0,oN.useCallback)(()=>{o(c.field.path,!0)},[o,c.field.path]),_=(0,oN.useCallback)(()=>{o(c.field.path,!1)},[o,c.field.path]),T=(0,oN.useCallback)(e=>{o(c.field.path.concat(e),!0)},[o,c.field.path]),S=(0,oN.useCallback)(e=>{o(c.field.path.concat(e),!1)},[o,c.field.path]),E=(0,oN.useCallback)(e=>{a(c.field.path.concat(e))},[a,c.field.path]),P=(0,oN.useCallback)(()=>{a(c.field.path)},[a,c.field.path]),O=(0,oN.useCallback)(e=>{l(c.field.path.concat(e),!1)},[l,c.field.path]),A=(0,oN.useCallback)(e=>{l(c.field.path.concat(e),!0)},[l,c.field.path]),I=(0,oN.useCallback)(()=>{a(c.field.path)},[a,c.field.path]),z=(0,oN.useCallback)(()=>{a(c.field.path.slice(0,-1))},[a,c.field.path]),M=(0,oN.useCallback)(e=>{s(c.field.path,e)},[s,c.field.path]),R=(0,oN.useMemo)(()=>
1({onBlur:b,onFocus:j,id:c.field.id,ref:v,"aria-describedby":y7(c.field.id,c.field.schemaType.description)}),[b,j,c.field.id,c.field.schemaType.description]),F=(0,oN.useMemo)(()=>({elementProps:R,level:c.field.level,members:c.field.members,value:c.field.value,readOnly:c.field.readOnly,validation:c.field.validation,presence:c.field.presence,schemaType:c.field.schemaType,changed:c.field.changed,id:c.field.id,onFieldGroupSelect:M,onFieldOpen:E,onFieldClose:P,onFieldCollapse:T,onFieldExpand:S,onFieldSetExpand:O,onFieldSetCollapse:A,onPathFocus:w,path:c.field.path,focusPath:c.field.focusPath,focused:c.field.focused,groups:c.field.groups,onChange:k,renderAnnotation:d,renderBlock:u,renderField:p,renderInlineBlock:h,renderInput:f,renderItem:m,renderPreview:g}),[R,c.field.level,c.field.members,c.field.value,c.field.readOnly,c.field.validation,c.field.presence,c.field.schemaType,c.field.changed,c.field.id,c.field.path,c.field.focusPath,c.field.focused,c.field.groups,M,E,P,T,S,O,A,w,k,d,u,p,h,f,m,g]),D=(0,oN.useMemo)(()=>f(F),[F,f]),q=(0,oN.useMemo)(()=>({actions:x,name:c.name,index:c.index,level:c.field.level,value:c.field.value,validation:c.field.validation,presence:c.field.presence,title:c.field.schemaType.title,description:c.field.schemaType.description,collapsible:c.collapsible,collapsed:c.collapsed,onCollapse:C,onExpand:_,open:c.open,changed:c.field.changed,onOpen:I,onClose:z,schemaType:c.field.schemaType,inputId:c.field.id,path:c.field.path,children:D,inputProps:F}),[x,c.name,c.index,c.field.level,c.field.value,c.field.validation,c.field.presence,c.field.schemaType,c.field.changed,c.field.id,c.field.path,c.collapsible,c.collapsed,c.open,C,_,I,z,D,F]);return(0,oZ.jsx)(vk,{onFieldGroupSelect:s,onChange:k,onSetFieldSetCollapsed:l,onPathOpen:a,onSetPathCollapsed:o,onPathBlur:n,onPathFocus:r,children:(0,oN.useMemo)(()=>p(q),[q,p])})};function wc(e){let{onPathBlur:n,onPathFocus:r,onChange:i,onPathOpen:a,onSetPathCollapsed:o,onSetFieldSetCollapsed:l,onFieldGroupSelect:s}=vC(),{member:c,renderAnnotation:d,renderBlock:u,renderField:p,renderInlineBlock:h,renderInput:f,renderItem:m,renderPreview:g}=e,x=v0(),v=(0,oN.useRef)(),y=(0,oN.useRef)(),b=hN(h$);fV(c.field.focused,(e,n)=>{var r;!e&&n&&(null==(r=v.current)||r.focus())});let j=(0,oN.useCallback)(e=>{e.currentTarget===e.target&&e.currentTarget===v.current&&r(c.field.path)},[c.field.path,r]),w=(0,oN.useCallback)(e=>{e.currentTarget===e.target&&e.currentTarget===v.current&&n(c.field.path)},[c.field.path,n]),k=(0,oN.useCallback)(e=>{let n=fR.from(e).patches;if(n.some(e=>"unset"===e.type&&1===e.path.length)){let e=wi(c.field.value||[],n);if(Array.isArray(e)&&!e.length){i(fR.from(fM([c.name])));return}}i(fR.from(e).prepend(fA([])).prefixAll(c.name))},[i,c.name,c.field.value]),C=(0,oN.useCallback)(e=>{o(c.field.path,e)},[o,c.field.path]),_=(0,oN.useCallback)(()=>{o(c.field.path,!0)},[o,c.field.path]),T=(0,oN.useCallback)(()=>{o(c.field.path,!1)},[o,c.field.path]),S=(0,oN.useCallback)(e=>{k(0===e.length?fM():fz(e))},[k]),E=(0,oN.useCallback)(e=>{let{value:n=[]}=c.field;e.fromIndex!==e.toIndex&&S(function(e,n,r){let i=e.slice(),a=i[n];return i.splice(n,1),i.splice(r,0,a),i}(n,e.fromIndex,e.toIndex))},[c.field,S]),P=(0,oN.useCallback)(e=>{let{value:n=[]}=c.field;S(n.concat(e))},[c.field,S]),O=(0,oN.useCallback)(e=>{let{value:n=[]}=c.field;S([e].concat(n||[]))},[c.field,S]),A=(0,oN.useCallback)(e=>{let{value:n=[]}=c.field;S(function(e,n,r){let i=n.slice();return i.splice(e+1,0,...r),i}(e.referenceIndex+("before"===e.position?-1:0),n,e.items))},[c.field,S]),I=(0,oN.useCallback)(e=>{k(fM([e]))},[k]),z=(0,oN.useCallback)(e=>{r(c.field.path.concat([e]))},[c.field.path,r]),M=(0,oN.useMemo)(()=>({onBlur:w,onFocus:j,id:c.field.id,ref:v,"aria-describedby":y7(c.field.id,c.field.schemaType.description)}),[w,j,c.field.id,c.field.schemaType.description]),R=(0,oN.useMemo)(()=>{var e;return e=c.field.schemaType.of,{priority:0,accepts:"text/*",type:"string",upload:(n,r)=>new oy.y(e=>{let n=new FileReader;return n.onerror=n=>e.error(n),n.onload=()=>{e.next(n.result),e.complete()},n.readAsText(r,"utf-8"),()=>{n.abort()}}).pipe((0,aW.U)(n=>null==n?void 0:n.split(/[\n\r]/).map(n=>{var r;let i,a,o;
1return r=n,i=!1,a=!1,o=!1,(e.forEach(e=>{(0,ll.EG)(e)&&(i=!0),(0,ll.aj)(e)&&(o=!0),(0,ll.J1)(e)&&(a=!0)}),i&&("true"===r||"false"===r))?"true"===r:a&&/^\d+$/.test(r)?Number(r):o?r:void 0}).filter(e=>void 0!==e)),(0,a2.h)(e=>Array.isArray(e)),(0,aW.U)(e=>({type:"uploadProgress",patches:[fI(e,"after",[-1])]})))}},[c.field.schemaType.of]),F=(0,oN.useCallback)((e,n)=>j0(n,"text/*")?R:null,[R]),D=(0,oN.useCallback)(e=>{let{file:n,schemaType:r,uploader:i}=e,a=i.upload(b,n,r).pipe((0,aW.U)(e=>fR.from(e.patches||[])),(0,a4.b)(e=>k(e.patches)));y.current&&y.current.unsubscribe(),y.current=a.subscribe()},[b,k]),q=(0,oN.useMemo)(()=>({level:c.field.level,members:c.field.members,value:c.field.value,readOnly:c.field.readOnly,onSetCollapsed:C,schemaType:c.field.schemaType,changed:c.field.changed,id:c.field.id,elementProps:M,path:c.field.path,focusPath:c.field.focusPath,focused:c.field.focused,onChange:k,onInsert:A,onMoveItem:E,onItemRemove:I,onItemAppend:P,onItemPrepend:O,validation:c.field.validation,presence:c.field.presence,resolveUploader:F,onUpload:D,renderAnnotation:d,renderBlock:u,renderInlineBlock:h,renderInput:f,renderItem:m,onIndexFocus:z,renderPreview:g}),[c.field.level,c.field.members,c.field.value,c.field.readOnly,c.field.schemaType,c.field.changed,c.field.id,c.field.path,c.field.focusPath,c.field.focused,c.field.validation,c.field.presence,C,M,k,A,E,I,P,O,F,D,d,u,h,f,m,z,g]),Z=(0,oN.useMemo)(()=>f(q),[q,f]),N=(0,oN.useMemo)(()=>({actions:x,name:c.name,index:c.index,level:c.field.level,value:c.field.value,title:c.field.schemaType.title,description:c.field.schemaType.description,collapsible:c.collapsible,collapsed:c.collapsed,onExpand:T,changed:c.field.changed,onCollapse:_,schemaType:c.field.schemaType,inputId:c.field.id,path:c.field.path,presence:c.field.presence,validation:c.field.validation,children:Z,inputProps:q}),[x,c.name,c.index,c.field.level,c.field.value,c.field.schemaType,c.field.changed,c.field.id,c.field.path,c.field.presence,c.field.validation,c.collapsible,c.collapsed,T,_,Z,q]);return(0,oZ.jsx)(vk,{onFieldGroupSelect:s,onChange:k,onPathOpen:a,onSetFieldSetCollapsed:l,onSetPathCollapsed:o,onPathBlur:n,onPathFocus:r,children:(0,oN.useMemo)(()=>p(N),[N,p])})}function wd(e){return(0,ll.m$)(e.field.schemaType)}function wu(e){return(0,ll.jB)(e.field.schemaType)&&e.field.schemaType.of.every(e=>(0,ll.m$)(e))}let wp=(0,oN.memo)(function(e){let{member:n,renderAnnotation:r,renderBlock:i,renderField:a,renderInlineBlock:o,renderInput:l,renderItem:s,renderPreview:c}=e;return wd(n)?(0,oZ.jsx)(ws,{member:n,renderAnnotation:r,renderBlock:i,renderField:a,renderInlineBlock:o,renderInput:l,renderItem:s,renderPreview:c}):(0,ll.jB)(n.field.schemaType)&&n.field.schemaType.of.every(e=>(0,ll.jp)(e))?(0,oZ.jsx)(wc,{member:n,renderAnnotation:r,renderBlock:i,renderField:a,renderInput:l,renderInlineBlock:o,renderItem:s,renderPreview:c}):wu(n)?(0,oZ.jsx)(wa,{member:n,renderAnnotation:r,renderBlock:i,renderField:a,renderInlineBlock:o,renderInput:l,renderItem:s,renderPreview:c}):(0,oZ.jsx)(wl,{member:n,renderField:a,renderInput:l})}),wh=["yes","true","1"],wf=["false","no","false","0","null"],wm=wh.concat(wf),wg=()=>!0,wx={string:{number:{test:Number,convert:Number},boolean:{test:e=>wm.includes(e.toLowerCase()),convert:e=>wh.includes(e.toLowerCase())||!wf.includes(e.toLowerCase())},richDate:{test:e=>(0,st.Z)(e),convert:e=>({_type:"richDate",local:(function(e){let n=new Date(e.getTime()+6e4*e.getTimezoneOffset()),r=e.getTimezoneOffset()/60,i=e.getHours();return n.setHours(i-r),n})(new Date(e)).toJSON(),utc:new Date(e).toJSON(),timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){}return null}(),offset:new Date().getTimezoneOffset()})}},date:{richDate:{test:e=>"date"===(e&&e._type),convert:e=>Object.assign({},e,{_type:"richDate"})}},richDate:{datetime:{test:e=>e&&e.utc,convert:e=>e.utc}},number:{string:{test:wg,convert:String},boolean:{test:wg,convert:Number}},boolean:{string:{test:wg,convert:e=>e?"Yes":"No"},number:{test:wg,convert:Number}}};function wv(e){let{value:n,targetType:r,onChange:i}=e,a=(0,oN.useMemo)(()=>({...n,_type:r}),[r,n]),o=(0,oN.useCallback)(()=>i(fR.from(fA(r,["_type"])),a),[a,i,r]),{t:l}=dV();return(0,oZ.jsx)(lr.zx,{onClick:o,text:l("inputs.untyped-value.convert-button.text",{targetType:r})})}function wy(e){let{value:n,onChange:r,validTypes:i}=e,a=(0,oN.useMemo)(()=>({...n,_type:i[0]}),[i,n]),o=(0,oN.useCallback)(()=>r(fR.from(fM()),a),[a,r]),{t:l}=dV();return(0,oZ.jsx)(lr.zx,{onClick:o,tone:"critical",text:l("inputs.untyped-value.unset-item-button.text")})}function wb(e){let{validTypes:n,value:r,onChange:i}=e,a=h1(),o=1===n.length,l=a.has(n[0]),{t:s}=dV();return(0,oZ.jsx)(fN,{status:"warning",title:(0,oZ.jsx)(oZ.Fragment,{children:(0,oZ.jsx)(uz,{t:s,i18nKey:"inputs.untyped-value.title"})}),children:(0,oZ.jsx)(j_,{open:xh,title:s("inputs.untyped-value.details.title"),children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:s,i18nKey:"inputs.untyped-value.description"})}),o&&!l&&(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:s,i18nKey:"inputs.untyped-value.details.description"})}),!o&&(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:s("inputs.untyped-value.details.multi-type-description")}),!o&&(0,oZ.jsx)(oK.Kq,{as:"ul",space:2,children:n.map(e=>(0,oZ.jsx)(oK.xv,{as:"li",muted:!0,size:1,children:(0,oZ.jsx)("code",{children:e})},e))}),(0,oZ.jsxs)(oK.Kq,{space:2,children:[(0,oZ.jsx)(oK.xv,{as:"h4",weight:"medium",size:1,children:s("inputs.untyped-value.details.json-dump-prefix")}),(0,oZ.jsx)(oK.Zb,{border:!0,overflow:"auto",padding:2,radius:2,tone:"inherit",children:(0,oZ.jsx)(oK.EK,{language:"json",children:JSON.stringify(r,null,2)})})]}),(0,oZ.jsxs)(oK.rj,{columns:[1,2,2],gap:1,children:[o&&(0,oZ.jsx)(wv,{onChange:i,targetType:n[0],value:r}),(0,oZ.jsx)(wy,{onChange:i,validTypes:n,value:r})]})]})})})}let wj=(0,oN.forwardRef)((e,n)=>{let{value:r,actualType:i,validTypes:a,onChange:o}=e;(0,oN.useImperativeHandle)(n,()=>({focus:()=>void 0}));let l=(0,oN.useCallback)(()=>{o(fR.from(fM()))},[o]),s=(0,oN.useCallback)(e=>{o(fR.from(fz(e)))},[o]),c=(0,oN.useMemo)(()=>i in wx?Object.keys(wx[i]).filter(e=>a.includes(e)).map(e=>({from:i,to:e,...wx[i][e]})).filter(e=>e.test(r)):[],[r,i,a]),{t:d}=dV();if(lP()(r)&&!("_type"in r))return(0,oZ.jsx)(wb,{value:r,validTypes:a,onChange:o});let u=(0,oZ.jsx)(oK.Kq,{padding:2,children:(0,oZ.jsx)(lr.zx,{onClick:l,tone
1:"critical",text:d("inputs.invalid-value.reset-button.text")})});return(0,oZ.jsxs)(fN,{status:"error",suffix:u,title:d("inputs.invalid-value.title"),children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:d("inputs.invalid-value.description")}),(0,oZ.jsx)(j_,{marginTop:4,open:xh,title:d("inputs.invalid-value.details.title"),children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[1===a.length&&(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:d,i18nKey:"inputs.invalid-value.details.description",values:{validType:a[0]}})}),1===a.length&&(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:d("inputs.invalid-value.details.possible-reason")}),1!==a.length&&(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:d("inputs.invalid-value.details.multi-type-description")}),1!==a.length&&(0,oZ.jsx)(oK.Kq,{as:"ul",space:2,children:a.map(e=>(0,oZ.jsx)(oK.xv,{as:"li",children:(0,oZ.jsx)("code",{children:e})},e))}),(0,oZ.jsxs)(oK.Kq,{marginTop:2,space:2,children:[(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:(0,oZ.jsx)(uz,{t:d,i18nKey:"inputs.invalid-value.current-type",values:{actualType:i}})}),(0,oZ.jsx)(oK.Zb,{border:!0,padding:2,radius:2,tone:"inherit",children:(0,oZ.jsx)(oK.EK,{language:"json",size:1,children:JSON.stringify(r,null,2)})})]}),c.length>0&&(0,oZ.jsx)(oK.Kq,{space:1,children:c.map(e=>(0,oZ.jsx)(ww,{converter:e,onConvert:s,value:r},"".concat(e.from,"-").concat(e.to)))})]})})]})});function ww(e){let{converter:n,onConvert:r,value:i}=e,a=(0,oN.useCallback)(()=>r(n.convert(i)),[n,r,i]),{t:o}=dV();return(0,oZ.jsx)(lr.zx,{onClick:a,text:o("inputs.invalid-value.convert-button.text",{targetType:n.to})})}function wk(e){let{error:n,onChange:r}=e,i=(0,oN.useCallback)(()=>{r(fR.from((n.value||[]).map((e,n)=>fA((0,sL.E2)(),[n,"_key"]))))},[n.value,r]),{t:a}=dV();return(0,oZ.jsx)(bp,{title:n.schemaType.title,description:n.schemaType.description,children:(0,oZ.jsxs)(fN,{status:"warning",suffix:(0,oZ.jsx)(oK.Kq,{padding:2,children:(0,oZ.jsx)(lr.zx,{onClick:i,text:a("form.error.missing-keys-alert.add-button.text"),tone:"caution"})}),title:a("form.error.missing-keys-alert.title"),children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:a("form.error.missing-keys-alert.summary")}),(0,oZ.jsx)(j_,{marginTop:4,open:xh,title:a("form.error.missing-keys-alert.details.title"),children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:a,i18nKey:"form.error.missing-keys-alert.details.description"})}),(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:a,i18nKey:"form.error.missing-keys-alert.details.additional-description"})})]})})]})})}function wC(e){let{error:n,onChange:r}=e,i=(0,oN.useCallback)(()=>{r(fR.from((n.duplicates||[]).map(e=>{let[n,r]=e;return fz("".concat(r,"_deduped_").concat(n),[n,"_key"])})))},[n.duplicates,r]),{t:a}=dV();return(0,oZ.jsx)(bp,{title:n.schemaType.title,description:n.schemaType.description,children:(0,oZ.jsxs)(fN,{status:"warning",suffix:(0,oZ.jsx)(oK.Kq,{padding:2,children:(0,oZ.jsx)(lr.zx,{onClick:i,text:a("form.error.duplicate-keys-alert.generate-button.text"),tone:"caution"})}),title:a("form.error.duplicate-keys-alert.title"),children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:a("form.error.duplicate-keys-alert.summary")}),(0,oZ.jsx)(j_,{marginTop:4,open:xh,title:a("form.error.duplicate-keys-alert.details.title"),children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:a,i18nKey:"form.error.duplicate-keys-alert.details.description"})}),(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:a,i18nKey:"form.error.duplicate-keys-alert.details.additional-description"})})]})})]})})}function w_(e){let{error:n,onChange:r}=e,{t:i}=dV();return(0,oZ.jsx)(bp,{title:n.schemaType.title,description:n.schemaType.description,children:(0,oZ.jsxs)(fN,{status:"error",suffix:(0,oZ.jsx)(oK.Kq,{padding:2,children:(0,oZ.jsx)(lr.zx,{onClick:()=>{let e=(n.value||[]).flatMap((e,n)=>lP()(e)?[]:[n]).reverse().map(e=>fM([e]));r(fR.from(e))},text:i("form.error.mixed-array-alert.remove-button.text"),tone:"critical"})}),title:i("form.error.mixed-array-alert.title"),children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:i("form.error.mixed-array-alert.summary")}
1),(0,oZ.jsx)(j_,{marginTop:4,open:xh,title:i("form.error.mixed-array-alert.details.title"),children:(0,oZ.jsx)(oK.Kq,{space:3,children:(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:i("form.error.mixed-array-alert.details.description")})})})]})})}function wT(e){let{member:n}=e,{onChange:r}=vC(),i=(0,oN.useCallback)(e=>{r(fR.from(e).prefixAll(n.fieldName))},[r,n.fieldName]),{t:a}=dV();return"INCOMPATIBLE_TYPE"===n.error.type?(0,oZ.jsx)(wj,{value:n.error.value,onChange:i,actualType:n.error.resolvedValueType,validTypes:[n.error.expectedSchemaType.name]}):"MISSING_KEYS"===n.error.type?(0,oZ.jsx)(wk,{error:n.error,onChange:i}):"DUPLICATE_KEYS"===n.error.type?(0,oZ.jsx)(wC,{error:n.error,onChange:i}):"MIXED_ARRAY"===n.error.type?(0,oZ.jsx)(w_,{onChange:i,error:n.error}):(0,oZ.jsx)(oK.xu,{children:a("member-field-error.unexpected-error",{error:e.member.error.type})})}wj.displayName="InvalidValueInput";let wS=(0,oN.memo)(function(e){var n;let{member:r,renderAnnotation:i,renderBlock:a,renderField:o,renderInlineBlock:l,renderInput:s,renderItem:c,renderPreview:d}=e,{onSetFieldSetCollapsed:u}=vC(),p=(0,oN.useCallback)(()=>{u(r.fieldSet.path,!0)},[r.fieldSet.path,u]),h=(0,oN.useCallback)(()=>{u(r.fieldSet.path,!1)},[r.fieldSet.path,u]);return(0,oZ.jsx)(bT,{title:r.fieldSet.title||s6()(r.fieldSet.name),description:r.fieldSet.description,level:r.fieldSet.level,collapsible:r.fieldSet.collapsible,collapsed:r.fieldSet.collapsed,onCollapse:p,onExpand:h,columns:null==(n=null==r?void 0:r.fieldSet)?void 0:n.columns,"data-testid":"fieldset-".concat(r.fieldSet.name),inputId:r.fieldSet.name,children:r.fieldSet.members.map(e=>"error"===e.kind?(0,oZ.jsx)(wT,{member:e},r.key):(0,oZ.jsx)(wp,{member:e,renderAnnotation:i,renderBlock:a,renderField:o,renderInlineBlock:l,renderInput:s,renderItem:c,renderPreview:d},e.key))})});function wE(e){let n=(0,oN.useRef)(),{member:r,renderAnnotation:i,renderBlock:a,renderField:o,renderInlineBlock:l,renderInput:s,renderItem:c,renderPreview:d}=e,{t:u}=dV(),{onPathBlur:p,onPathFocus:h,onChange:f,onPathOpen:m,onSetPathCollapsed:g,onSetFieldSetCollapsed:x,onFieldGroupSelect:v}=vC(),y=I8();fV(r.item.focused,(e,r)=>{var i;!e&&r&&(null==(i=n.current)||i.focus())});let b=(0,oN.useCallback)(()=>{f(fR.from([fM([{_key:r.key}])]))},[r.key,f]),j=(0,oN.useCallback)(e=>{m(e),g(e,!1)},[m,g]),w=(0,oK.pm)(),k=(0,oN.useCallback)(e=>{if(0===e.items.length)throw Error("Insert event should include at least one item");let n=e.items.map(e=>jF(e));f(fR.from([fI(n,e.position,[{_key:r.key}])]));let i=n[0]._key,a=[...r.item.path.slice(0,-1),{_key:i}];h(a);let o=!1!==e.open;e.skipInitialValue?o&&j(a):j5(n,r.parentSchemaType,y).pipe((0,a4.b)(e=>{"patch"===e.type?f(fR.from(e.patches)):w.push({title:u("inputs.array.error.cannot-resolve-initial-value-title"),description:u("inputs.array.error.cannot-resolve-initial-value-description",{schemaTypeTitle:e.schemaType.title,errorMessage:e.error.message}),status:"error"})})).subscribe({complete:()=>{o&&j(a)}})},[j,r.item.path,r.key,r.parentSchemaType,f,h,y,w,u]),C=(0,oN.useCallback)(()=>{p(r.item.path)},[r.item.path,p]),_=(0,oN.useCallback)(()=>{h(r.item.path)},[r.item.path,h]),T=(0,oN.useCallback)(e=>{h(r.item.path.concat(e))},[r.item.path,h]),S=(0,oN.useCallback)(e=>{f(fR.from(e).prepend(fA(b0(r.item.schemaType))).prefixAll({_key:r.key}))},[f,r.item.schemaType,r.key]),E=(0,oN.useCallback)(()=>{g(r.item.path,!0)},[g,r.item.path]),P=(0,oN.useCallback)(()=>{g(r.item.path,!1)},[g,r.item.path]),O=(0,oN.useCallback)(e=>{g(r.item.path.concat(e),!0)},[g,r.item.path]),A=(0,oN.useCallback)(e=>{g(r.item.path.concat(e),!1)},[g,r.item.path]),I=(0,oN.useCallback)(()=>{m(r.item.path)},[m,r.item.path]),z=(0,oN.useCallback)(e=>{m(r.item.path.concat(e))},[m,r.item.path]),M=(0,oN.useCallback)(e=>{x(r.item.path.concat(e),!1)},[x,r.item.path]),R=(0,oN.useCallback)(e=>{x(r.item.path.concat(e),!0)},[x,r.item.path]),F=(0,oN.useCallback)(()=>{m(r.item.path)},[m,r.item.path]),D=!r.item.value||j3(r.item.value),q=(0,oN.useCallback)(()=>{D&&b();let e=r.item.path.slice(0,-1);m(e),h(e)},[D,m,r.item.path,h,b]),Z=(0,oN.useCallback)(e=>{v(r.item.path,e)},[v,r.item.path]),N=(0,oN.useMemo)(()=>({onBlur:C,onFocus:_,id:r.item.id,ref:n,"aria-describedby":y7(r.item.id,r.item.schemaType.description)}),[C,_,r.item.id,r.item.schemaType.description]),L=(0,oN.useMemo)(()=>({changed:r.item.changed,focusPath:r.item.focusPath,focused:r.item.focused,groups:r.item.groups,id:r.item.id,level:r.item.level,members:r.item.members,onChange:S,onFieldClose:I,onFieldCollapse:O,onFieldSetCollapse:R,onFieldExpand:A,onFieldSetExpand:M,onFieldGroupSelect:Z,onPathF
1ocus:T,onFieldOpen:z,path:r.item.path,presence:r.item.presence,readOnly:r.item.readOnly,renderAnnotation:i,renderBlock:a,renderField:o,renderInlineBlock:l,renderInput:s,renderItem:c,renderPreview:d,schemaType:r.item.schemaType,validation:r.item.validation,value:r.item.value,elementProps:N}),[N,S,I,O,R,A,M,T,z,Z,r.item.changed,r.item.focusPath,r.item.focused,r.item.groups,r.item.id,r.item.level,r.item.members,r.item.path,r.item.presence,r.item.readOnly,r.item.schemaType,r.item.validation,r.item.value,i,a,o,l,s,c,d]),V=(0,oN.useMemo)(()=>s(L),[L,s]),K=(0,oN.useMemo)(()=>({key:r.key,index:r.index,level:r.item.level,value:r.item.value,title:r.item.schemaType.title,description:r.item.schemaType.description,collapsible:r.collapsible,collapsed:r.collapsed,schemaType:r.item.schemaType,parentSchemaType:r.parentSchemaType,onInsert:k,onRemove:b,presence:r.item.presence,validation:r.item.validation,open:r.open,onOpen:F,onClose:q,onExpand:P,onCollapse:E,readOnly:r.item.readOnly,focused:r.item.focused,onFocus:_,onBlur:C,inputId:r.item.id,path:r.item.path,children:V,changed:r.item.changed,inputProps:L}),[r.key,r.index,r.item.level,r.item.value,r.item.schemaType,r.parentSchemaType,r.item.presence,r.item.validation,r.item.readOnly,r.item.focused,r.item.id,r.item.path,r.item.changed,r.collapsible,r.collapsed,r.open,k,b,F,q,P,E,_,C,V,L]);return(0,oZ.jsx)(vk,{onFieldGroupSelect:v,onChange:S,onPathOpen:m,onSetFieldSetCollapsed:x,onSetPathCollapsed:g,onPathBlur:p,onPathFocus:h,children:(0,oN.useMemo)(()=>c(K),[K,c])})}function wP(e){switch(e.jsonType){case"string":return"";case"number":return -0;case"boolean":return!1;default:throw Error('Unable to create value from type "'.concat(e.jsonType,'"'))}}function wO(e){let n=(0,oN.useRef)(),{member:r,renderItem:i,renderInput:a}=e,[o,l]=(0,oN.useState)(),{onPathBlur:s,onPathFocus:c,onChange:d}=vC();fV(r.item.focused,(e,r)=>{var i;!e&&r&&(null==(i=n.current)||i.focus())});let u=(0,oN.useCallback)(e=>{s(r.item.path)},[r.item.path,s]),p=(0,oN.useCallback)(e=>{c(r.item.path)},[r.item.path,c]),h=(0,oN.useCallback)(e=>{d(fR.from(e).prefixAll(r.index))},[d,r.index]),f=(0,oN.useCallback)(e=>{let n=e.currentTarget.value;if((0,ll.J1)(r.item.schemaType)){if((n=e.currentTarget.valueAsNumber)>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER)return}else(0,ll.EG)(r.item.schemaType)&&(n=e.currentTarget.checked);let i=""===n||"number"==typeof n&&isNaN(n);(0,ll.J1)(r.item.schemaType)&&l(i?void 0:e.currentTarget.value),h(fz(i?wP(r.item.schemaType):n))},[h,r.item.schemaType]),m=(0,oN.useMemo)(()=>{var e,i;return{onBlur:u,onFocus:p,id:r.item.id,ref:n,onChange:f,value:(e=r.item.schemaType,Object.is(i=r.item.value,-0)?"":wo(e,i,o)),readOnly:!!r.item.readOnly,placeholder:r.item.schemaType.placeholder,"aria-describedby":y7(r.item.id,r.item.schemaType.description)}},[u,p,f,r.item.id,r.item.readOnly,r.item.schemaType,r.item.value,o]),g=(0,oN.useMemo)(()=>({changed:r.item.changed,level:r.item.level,value:r.item.value,readOnly:r.item.readOnly,schemaType:r.item.schemaType,id:r.item.id,path:r.item.path,focused:r.item.focused,onChange:h,validation:r.item.validation,presence:r.item.presence,elementProps:m}),[r.item.changed,r.item.level,r.item.value,r.item.readOnly,r.item.schemaType,r.item.id,r.item.path,r.item.focused,r.item.validation,r.item.presence,h,m]),x=(0,oN.useMemo)(()=>a(g),[g,a]),v=(0,oN.useCallback)(()=>{d(fR.from([fM([r.index])]))},[r.index,d]),y=(0,oN.useCallback)(e=>{d(fR.from([fI(e.items,e.position,[r.index])]))},[r.index,d]),b=(0,oN.useMemo)(()=>({key:r.key,index:r.index,level:r.item.level,value:r.item.value,title:r.item.schemaType.title,description:r.item.schemaType.description,schemaType:r.item.schemaType,parentSchemaType:r.parentSchemaType,onInsert:y,onRemove:v,presence:r.item.presence,validation:r.item.validation,readOnly:r.item.readOnly,focused:r.item.focused,onFocus:p,onBlur:u,inputId:r.item.id,path:r.item.path,children:x}),[r.key,r.index,r.item.level,r.item.value,r.item.schemaType,r.item.presence,r.item.validation,r.item.readOnly,r.item.focused,r.item.id,r.item.path,r.parentSchemaType,y,v,p,u,x]);return(0,oZ.jsx)(oZ.Fragment,{children:(0,oN.useMemo)(()=>i(b),[b,i])})}var wA=Object.freeze,wI=Object.defineProperty;let wz=(0,oV.ZP)(oK.Zb)(ni||(ni=wA(wI(z=["\n  max-width: ","px;\n"],"raw",{value:wA(z.slice())}))),e=>{let{theme:n}=e;return n.sanity.container[1]});function wM(e){let{value:n,onFocus:r,vertical:i,...a}=e,[o,l]=oN.useState(!1),[s,c]=oN.useState(null),{t:d}=dV();(0,oK.O8)(()=>l(!1),[s]);let u=oN.useCallback(e=>{("Escape"===e.key||"Tab"===e.key)&&l(!1)},[]),p=(0,oN.useCallback)(()=>{l(e=>!e)},[]),h=(0,sL.wq)(n);return(0,oZ.jsx)(lr.J2,{open:o,ref:c,onKeyDown:u,portal:!0,constrainSize:!0,tone:"default",content:(0,oZ.jsx)(wz,{margin:1,padding:3,onKeyDown:u,tabIndex:0,overflow:"auto",children:(0,oZ.jsxs)(oK.Kq,{space:4,children:[(0,oZ.jsx)(oK.xv,{weight:"medium",children:(0,oZ.jsx)(uz,{t:d,i18nKey:"inputs.array.error.type-is-incompatible-prompt",values:{typeName:h}})}),(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:d("inputs.array.error.type-is-incompatible-title")}),(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(uz,{t:d,i18nKey:"inputs.array.error.current-schema-not-declare-description",values:{typeName:h}})}),(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsxs)(oK.xv,{size:1,children:[(0,oZ.jsx)(lp.sLo,{})," ",d("inputs.array.error.can-delete-but-no-edit-description")]})}),(0,oZ.jsxs)(oK.Kq,{space:2,children:[(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:d("inputs.array.error.json-representation-description")}),(0,oZ.jsx)(oK.Zb,{padding:2,overflow:"auto",border:!0,children:(0,oZ.jsx)(oK.EK,{size:1,as:"pre",language:"json",children:JSON.stringify(n,null,2)})})]})]})}),children:(0,oZ.jsx)(oK.Zb,{as:"button",type:"button",radius:2,tone:"inherit",paddingX:2,paddingY:3,flex:1,onFocus:r,onClick:p,onKeyDown:u,__unstable_focusRing:!0,...a,children:(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(oK.xu,{marginRight:3,children:(0,oZ.jsx)(oK.xv,{children:(0,oZ.jsx)(lp.Tzq,{})})}),(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.xv,{size:1,textOverflow:"ellipsis",children:(0,oZ.jsx)(uz,{t:d,i18nKey:"inputs.array.error.type-is-incompatible-prompt",values:{typeName:h}})})})]})})})}function wR(e){let{member:n}=e,{t:r}=dV();return"INVALID_ITEM_TYPE"===n.error.type?(0,oZ.jsx)(wM,{value:n.error.value}):(0,oZ.jsx)("div",{children:r("inputs.array.error.unexpected-error",{error:n.error.type})})}let wF=(0,oN.memo)(function(e){let{member:n,renderAnnotation:r,renderBlock:i,renderInput:a,renderInlineBlock:o,renderField:l,renderItem:s,renderPreview:c}=e;return"field"===n.kind?(0,oZ.jsx)(wp,{member:n,renderAnnotation:r,renderBlock:i,renderInlineBlock:o,renderInput:a,renderField:l,renderItem:s,renderPreview:c},n.key):"error"===n.kind?(0,oZ.jsx)(wT,{member:n},n.key):"fieldSet"===n.kind?(0,oZ.jsx)(wS,{member:n,renderAnnotation:r,renderBlock:i,renderInlineBlock:o,renderInput:a,renderField:l,renderItem:s,renderPreview:c},n.key):(console.warn(Error("Unhandled member kind ".concat(n.kind))),null)});function wD(e){let{members:n,renderAnnotation:r,renderBlock:i,renderInput:a,renderInlineBlock:o,renderField:l,renderItem:s,renderPreview:c}=e,d=(0,oN.useMemo)(()=>n.map(e=>(0,oZ.jsx)(wF,{member:e,renderAnnotation:r,renderBlock:i,renderField:l,renderInlineBlock:o,renderInput:a,renderItem:s,renderPreview:c},e.key)),[n,r,i,l,o,a,s,c]);return(0,oZ.jsx)(oZ.Fragment,{children:d})}let wq=e=>{let{children:n}=e;return n},wZ=(0,oN.memo)(function(e){let n=(0,oN.useMemo)(()=>"absolutePath"in e?e.absolutePath:e.path.concat(e.relativePath),[e]),r=(0,oN.useCallback)(()=>(0,oZ.jsx)(oZ.Fragment,{children:"Missing destination render function"}),[]);return(0,oZ.jsx)(wN,{...e,absolutePath:n,destinationRenderAnnotation:e.renderAnnotation||r,destinationRenderBlock:e.renderBlock||r,destinationRenderField:e.renderField,destinationRenderInlineBlock:e.renderInlineBlock||r,destinationRenderInput:e.renderInput,destinationRenderItem:e.renderItem,destinationRenderPreview:e.renderPreview})}),wN=(0,oN.memo)(function e(n){let{absolutePath:r,destinationRenderAnnotation:i,destinationRenderBlock:a,destinationRenderField:o,destinationRenderInlineBlock:l,destinationRenderInput:s,destinationRenderItem:c,destinationRenderPreview:d}=n,{t:u}=dV(),p=(0,oN.useCallback)(n=>{if((0,o2.Xy)(n.path,r)||(0,o2.Ny)(r,n.path))return s(n);if(!jM(n)&&!jR(n))throw Error("Expected either object input props or array input props for: ".concat(JSON.stringify(n.path)));return(0,oZ.jsx)(e,{...n,absolutePath:r,destinationRenderAnnotation:i,destinationRenderBlock:a,destinationRenderInput:s,destinationRenderItem:c,destinationRenderField:o,destinationRenderInlineBlock:l,destinationRenderPreview:d})}
1,[r,i,a,o,l,s,c,d]),h=(0,oN.useCallback)(e=>(0,o2.Ny)(r,e.path)&&(n.includeField||!(0,o2.Xy)(r,e.path))?o(e):wq(e),[r,o,n.includeField]),f=(0,oN.useCallback)(e=>(0,o2.Ny)(r,e.path)&&(n.includeItem||!(0,o2.Xy)(r,e.path))?c(e):wq(e),[r,c,n.includeItem]),m=(0,oN.useCallback)(e=>(0,o2.Ny)(r,e.path)&&(n.includeItem||!(0,o2.Xy)(r,e.path))?a(e):wq(e),[r,a,n.includeItem]),g=(0,oN.useCallback)(e=>(0,o2.Ny)(r,e.path)&&(n.includeItem||!(0,o2.Xy)(r,e.path))?l(e):wq(e),[r,l,n.includeItem]),x=(0,oN.useCallback)(e=>(0,o2.Ny)(r,e.path)&&(n.includeItem||!(0,o2.Xy)(r,e.path))?i(e):wq(e),[r,i,n.includeItem]);if(jR(n)){let e=(0,o2.fi)(n.path,r),i=n.members.find(n=>"item"==n.kind&&(0,ll.Fd)(e[0])&&n.key===e[0]._key);if(!i){let e=fH(n.path),i=(0,o2.fi)(n.path,r);if((0,ll.Fd)(i[0])){let n=i[0]._key;return(0,oZ.jsx)("div",{children:(0,oZ.jsx)(uz,{t:u,i18nKey:"form.error.no-array-item-at-key",values:{key:n,path:e}})})}let a=(0,ll.dw)(i[0])?i[0]:i[0][0];return(0,oZ.jsx)("div",{children:(0,oZ.jsx)(uz,{t:u,i18nKey:"form.error.no-array-item-at-index",values:{index:a,path:e}})})}return"error"===i.kind?(0,oZ.jsx)(wR,{member:i}):(0,oZ.jsx)(wE,{member:i,renderAnnotation:x,renderBlock:m,renderInput:p,renderField:h,renderInlineBlock:g,renderItem:f,renderPreview:d})}if(jM(n)){let e=(0,o2.fi)(n.path,r),i=n.members.find(n=>"field"==n.kind&&e[0]===n.name);if(!i){let n="string"==typeof e[0]?e[0]:JSON.stringify(e[0]);return(0,oZ.jsx)("div",{children:u("form.error.field-not-found",{fieldName:n})})}return(0,oZ.jsx)(wp,{member:i,renderAnnotation:x,renderBlock:m,renderInput:p,renderInlineBlock:g,renderField:h,renderItem:f,renderPreview:d})}throw Error("FormInput can only be used with arrays or objects")}),wL=(0,oN.createContext)(null);function wV(e){let{scrollElement:n,containerElement:r}=e;return(0,oZ.jsx)(wL.Provider,{value:{scrollElement:n,containerElement:r},children:e.children})}let wK=[0,0,1,0];function wB(e){return e.stopPropagation()}function wU(e){let{children:n,header:r,id:i,legacy_referenceElement:a,onClose:o,type:l,width:s,autofocus:c}=e,[d,u]=(0,oN.useState)(null),p=(0,oN.useRef)(null),h=(0,oZ.jsx)(yQ,{margins:wK,children:(0,oZ.jsx)(oK.xu,{ref:p,children:n})});return"dialog"===l?(0,oZ.jsx)(wV,{scrollElement:d,containerElement:p,children:(0,oZ.jsx)(lr.Vq,{header:r,id:i||"",onClickOutside:o,onClose:o,onDragEnter:wB,width:s,contentRef:u,__unstable_autoFocus:c,children:h})}):(0,oZ.jsx)(uK,{header:r,onClose:o,referenceElement:a,width:s,containerRef:u,children:(0,oZ.jsx)(wV,{scrollElement:d,containerElement:p,children:h})})}let wH={portal:!0,tone:"default"},w$={position:"relative"};function wW(e){var n,r,i,a,o,l;let{schemaType:s,parentSchemaType:c,path:d,readOnly:u,onRemove:p,value:h,open:f,onInsert:m,onFocus:g,onOpen:x,onClose:v,changed:y,focused:b,children:j,inputProps:{renderPreview:w}}=e,{t:k}=dV(),C=!u&&(null==(n=c.options)?void 0:n.sortable)!==!1,_=c.of,T=(0,oN.useRef)(null);v4(T,f),fV(b,(e,n)=>{var r;!e&&n&&T.current&&(null==(r=T.current)||r.focus())});let S=h._resolvingInitialValue,E=(0,oN.useCallback)(()=>{m({items:[{...h,_key:v8()}],position:"after"})},[m,h]),P=(0,oN.useCallback)((e,n)=>{m({items:[b1(n)],position:e})},[m]),O=vE(d,!0),A=(0,oN.useMemo)(()=>0===O.length?null:(0,oZ.jsx)(yC,{presence:O,maxAvatars:1}),[O]),I=vA(d,!0),z=(0,oN.useMemo)(()=>0===I.length?null:(0,oZ.jsx)(oK.xu,{paddingX:1,paddingY:3,children:(0,oZ.jsx)(bo,{validation:I,__unstable_showSummary:!0})}),[I]),M=I.some(e=>"error"===e.level),R=I.some(e=>"warning"===e.level),F=(0,oN.useMemo)(()=>u?null:(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(bA,{paddingY:3}),id:"".concat(e.inputId,"-menuButton"),menu:(0,oZ.jsxs)(oK.v2,{children:[(0,oZ.jsx)(lr.sN,{text:k("inputs.array.action.remove"),tone:"critical",icon:lp.XHJ,onClick:p}),(0,oZ.jsx)(lr.sN,{text:k("inputs.array.action.duplicate"),icon:lp.TIy,onClick:E}),(0,oZ.jsx)(b3,{types:_,onInsert:P})]}),popover:wH}),[E,P,p,_,e.inputId,u,k]),D=function(e){let{readOnly:n,hasErrors:r,hasWarnings:i}=e;return n?"transparent":r?"critical":i?"caution":"default"}({readOnly:u,hasErrors:M,hasWarnings:R}),q=(0,oZ.jsx)(bQ,{menu:F,presence:A,validation:z,tone:D,focused:b,dragHandle:C,selected:f,children:(0,oZ.jsxs)(oK.Zb,{as:"button",type:"button",tone:"inherit",radius:1,disabled:S,onClick:x,ref:T,onFocus:g,__unstable_focusRing:!0,style:w$,children:[w({schemaType:e.schemaType,value:e.value,layout:"default",skipVisibilityCheck:!0}),S&&(0,oZ.jsx)(u4,{fill:!0})]})}),Z=ha(s);return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(dQ,{path:d,isChanged:y,hasFocus:!!b,children:(0,oZ.jsx)(oK.xu,{paddingX:1,children:q})}),f&&(0,oZ.jsx)(wU,{header:u?k("inputs.array.action.view",{itemTypeTitle:Z}):k("inputs.array.action.edit",{itemTypeTitle:Z}),type:(null==(i=null==(r=null==c?void 0:c.options)?void 0:r.modal)?void 0:i.type)||"dialog",width:null!=(l=null==(o=null==(a=null==c?void 0:c.options)?void 0:a.modal)?void 0:o.width)?l:1,id:h._key,onClose:v,autofocus:b,legacy_referenceElement:T.current,children:j})]})}function wY(e){var n;return(null==(n=e.components)?void 0:n.item)?e.components.item:(0,ll.dD)(e)?jz:wW}let wX={portal:!0,tone:"default"};function wG(e){var n,r,i,a,o,l;let s=(0,oN.useRef)(null),{schemaType:c,path:d,open:u,inputId:p,children:h,inputProps:f}
1=e,{readOnly:m,focused:g,renderPreview:x,onChange:v}=e.inputProps,[y,b]=(0,oN.useState)([]),j=vG(),w=(0,oN.useCallback)(()=>f.onChange(fM()),[f]),k=e.value,{EditReferenceLink:C,getReferenceInfo:_,selectedState:T,isCurrentDocumentLiveEdit:S}=Sl({path:d,schemaType:c,value:k});v4(s,u),fV(g,(e,n)=>{!e&&n&&s.current&&s.current.focus()});let E=e.validation.some(e=>"error"===e.level),P=e.validation.some(e=>"warning"===e.level),O=b9(null==k?void 0:k._ref,_),A=(null==(n=O.result)?void 0:n.type)||(null==(r=null==k?void 0:k._strengthenOnPublish)?void 0:r.type),I=A?c.to.find(e=>e.name===A):void 0,z="pressed"===T,M="selected"===T,R=null==k?void 0:k._ref,F=R&&(null==(o=null==(a=null==(i=O.result)?void 0:i.preview)?void 0:a.published)?void 0:o._id),D=(0,oN.useCallback)(()=>{v([!0===c.weak?fz(!0,["_weak"]):fM(["_weak"]),fM(["_strengthenOnPublish"])])},[v,c.weak]),q=(0,oN.useCallback)(()=>{v(!0===c.weak?fz(!0,["_weak"]):fM(["_weak"]))},[v,c]),Z=(0,oN.useCallback)(()=>{f.onPathFocus(["_ref"])},[f]),N=(null==k?void 0:k._weak)?"weak":"strong",L=!0===c.weak?"weak":"strong",V=R&&!O.isLoading&&(null==k?void 0:k._strengthenOnPublish),K=!O.isLoading&&(null==(l=O.result)?void 0:l.availability.available)&&R&&N!==L&&!V,B=function(e){let{readOnly:n,hasErrors:r,hasWarnings:i}=e;return n?"transparent":r?"critical":i?"caution":"default"}({readOnly:m,hasErrors:E,hasWarnings:P}),U=!(null==k?void 0:k._ref)||"_ref"===f.focusPath[0],{t:H}=dV(),$=(0,oZ.jsxs)(oZ.Fragment,{children:[S&&F&&k._strengthenOnPublish&&(0,oZ.jsx)(jP,{schemaType:c,handleRemoveStrengthenOnPublish:D}),K&&(0,oZ.jsx)(jO,{actualStrength:N,handleFixStrengthMismatch:q}),O.error&&(0,oZ.jsx)(jA,{errorMessage:O.error.message,onHandleRetry:O.retry})]}),W=(0,oN.useMemo)(()=>(0,oN.forwardRef)(function(e,n){return(0,oZ.jsx)(lm.nR,{...e,intent:"edit",params:{id:null==k?void 0:k._ref,type:null==I?void 0:I.name},target:"_blank",rel:"noopener noreferrer",ref:n})}),[null==I?void 0:I.name,null==k?void 0:k._ref]),Y=(0,oN.useMemo)(()=>m?null:(0,oZ.jsx)(oK.xu,{flex:"none",children:(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(bA,{paddingY:3}),id:"".concat(p,"-menuButton"),menu:(0,oZ.jsxs)(oK.v2,{children:[!m&&(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(lr.sN,{text:H("inputs.reference.action.clear"),tone:"critical",icon:lp.XHJ,onClick:w}),(0,oZ.jsx)(lr.sN,{text:H("inputs.reference.action.replace"),icon:lp.bnu,onClick:Z})]}),!m&&(null==k?void 0:k._ref)&&(0,oZ.jsx)(oK.R,{}),(null==k?void 0:k._ref)&&(0,oZ.jsx)(lr.sN,{as:W,"data-as":"a",text:H("inputs.reference.action.open-in-new-tab"),icon:lp.buG})]}),popover:wX})}),[w,Z,p,W,m,H,null==k?void 0:k._ref]);return(0,oZ.jsxs)(oZ.Fragment,{children:[j&&e.actions&&e.actions.length>0&&(0,oZ.jsx)(vV,{actions:e.actions,documentId:j,documentType:c.name,onActions:b,path:d,schemaType:c}),(0,oZ.jsx)(v$,{actions:y,focused:!!e.inputProps.focused,path:d,children:(0,oZ.jsx)(bp,{__internal_comments:e.__internal_comments,__internal_slot:e.__internal_slot,__unstable_headerActions:y,__unstable_presence:e.presence,description:e.description,level:e.level,title:e.title,validation:e.validation,deprecated:e.schemaType.deprecated,children:U?(0,oZ.jsx)(oK.xu,{children:h}):(0,oZ.jsx)(oK.Zb,{border:!0,radius:2,padding:1,tone:B,children:(0,oZ.jsxs)(oK.Kq,{space:1,children:[(0,oZ.jsx)(oK.kC,{gap:1,align:"center",style:{lineHeight:0},children:(0,oZ.jsxs)(lr.uE,{children:[(0,oZ.jsx)(jm,{__unstable_focusRing:!0,as:C,"data-pressed":!!z||void 0,"data-selected":!!M||void 0,documentId:null==k?void 0:k._ref,documentType:null==I?void 0:I.name,flex:1,pressed:z,radius:2,ref:s,selected:M,tone:"inherit",children:(0,oZ.jsx)(js,{value:k,referenceInfo:O,renderPreview:x,type:c})}),(0,oZ.jsx)(oK.xu,{children:Y})]})}),$]})})})})]})}function wJ(e,n){return lS()(e.options,n)}let wQ=["array","file","image","reference","slug"],w0=["asset","crop","hotspot","_ref","_weak"],w1=["tags"],w2=["slug"];function w3(e,n){if(!e||n.has(e))return[];n.add(e);let r=e.type?w3(e.type,n):[];return[e,...r]}function w4(e,n){return(0,ll.jB)(e)?function(e,n){var r;let{options:i}=e,a=(null==(r=(null==i?void 0:i.list)||[])?void 0:r.length)>0,o=w1.includes((null==i?void 0:i.layout)||"");return a&&!o?n:0}(e,n):function(e,n){var r,i,a;let{type:o,options:l}=e,s=function e(n,r){return(null==n?void 0:n.name)&&r.includes(null==n?void 0:n.name)?n:n?e(n.type,r):void 0}(o,wQ),c=(null==e?void 0:e.jsonType)==="object"?e.fields:void 0,d=(null==s?void 0:s.name)||"";if(w2.includes(d))return 0;let u=wQ.includes(d),p=(null!=(r=null==c?void 0:c.filter(e=>!w0.includes(e.name)).length)?r:0)>0,h=(null!=(a=null==(i=null==l?void 0:l.list)?void 0:i.length)?a:0)>0;return p||h||!u?n:0}(e,n)}let w5=[];function w8(e){return(0,oZ.jsx)(dQ,{hasFocus:!!e.inputProps.focused,isChanged:e.inputProps.changed,path:e.path,children:e.children})}function w6(e){let[n,r]=(0,oN.useState)(w5),i=vG(),a=!!e.inputProps.focused;return(0,oZ.jsxs)(oZ.Fragment,{children:[i&&e.actions&&e.actions.length>0&&(0,oZ.jsx)(vV,{actions:e.actions,documentId:i,documentType:e.schemaType.n
1ame,onActions:r,path:e.path,schemaType:e.schemaType}),(0,oZ.jsx)(v$,{actions:n,focused:a,path:e.path,children:(0,oZ.jsx)(bp,{__internal_slot:e.__internal_slot,__internal_comments:e.__internal_comments,__unstable_headerActions:n,__unstable_presence:e.presence,"data-testid":"field-".concat(e.inputId),description:e.description,inputId:e.inputId,level:e.level,title:e.title,validation:e.validation,deprecated:e.schemaType.deprecated,children:(0,oZ.jsx)(dQ,{hasFocus:a,isChanged:e.inputProps.changed,path:e.path,children:e.children})})})]})}function w9(e){let[n,r]=(0,oN.useState)(w5),i=vG(),a=!!e.inputProps.focused;return(0,oZ.jsxs)(oZ.Fragment,{children:[i&&e.actions&&e.actions.length>0&&(0,oZ.jsx)(vV,{actions:e.actions,documentId:i,documentType:e.schemaType.name,onActions:r,path:e.path,schemaType:e.schemaType}),(0,oZ.jsx)(v$,{actions:n,focused:a,path:e.path,children:(0,oZ.jsx)(bT,{__internal_comments:e.__internal_comments,__internal_slot:e.__internal_slot,__unstable_headerActions:n,__unstable_presence:e.presence,collapsed:e.collapsed,collapsible:e.collapsible,"data-testid":"field-".concat(e.inputId),description:e.description,level:e.level,onCollapse:e.onCollapse,onExpand:e.onExpand,title:e.title,validation:e.validation,inputId:e.inputId,deprecated:e.schemaType.deprecated,children:e.children})})]})}function w7(e){let[n,r]=(0,oN.useState)(w5),i=vG(),a=!!e.inputProps.focused,o=e.inputProps.members.find(e=>"field"===e.kind&&"hotspot"===e.name),l=(null==o?void 0:o.open)?e.presence:e.presence.concat((null==o?void 0:o.field.presence)||w5);return(0,oZ.jsxs)(oZ.Fragment,{children:[i&&e.actions&&e.actions.length>0&&(0,oZ.jsx)(vV,{actions:e.actions,documentId:i,documentType:e.schemaType.name,onActions:r,path:e.path,schemaType:e.schemaType}),(0,oZ.jsx)(v$,{actions:n,focused:a,path:e.path,children:(0,oZ.jsx)(bT,{__internal_comments:e.__internal_comments,__internal_slot:e.__internal_slot,__unstable_headerActions:n,__unstable_presence:l,collapsed:e.collapsed,collapsible:e.collapsible,description:e.description,level:e.level,onCollapse:e.onCollapse,onExpand:e.onExpand,title:e.title,validation:e.validation,inputId:e.inputId,deprecated:e.schemaType.deprecated,children:e.children})})]})}function ke(e){var n;if(null==(n=e.components)?void 0:n.field)return e.components.field;if((0,ll.EG)(e))return w8;let r=w3(e,new Set);return r.some(e=>"image"===e.name||"file"===e.name)?w7:r.some(e=>(0,ll.mz)(e))||r.some(e=>"slug"===e.name)?w6:r.some(e=>(0,ll.dD)(e))?wG:"object"!==e.jsonType&&"array"!==e.jsonType?w6:w9}var kt=Object.freeze,kn=Object.defineProperty;let kr=oV.ZP.div(na||(na=kt(kn(M=["\n  display: flex;\n  pointer-events: all;\n"],"raw",{value:kt(M.slice())}))));function ki(e){let n=(0,sV._F)(),{block:r,onChange:i,renderBlockActions:a}=e,o=(0,oN.useMemo)(()=>n.schemaTypes.decorators.map(e=>e.value),[n]),l=(0,oN.useMemo)(()=>{if(a)return a({block:r,value:sV.q$.getValue(n),set:function(e){let{allowedDecorators:n,block:r,onChange:i}=e;return e=>{let a=[fz((0,s2.nX)(e,{allowedDecorators:n}
1),[{_key:r._key}])];return i(fR.from(a))}}({allowedDecorators:o,block:r,onChange:i}),unset:function(e){let{block:n,onChange:r}=e;return()=>{let e=[fM([{_key:n._key}])];return r(fR.from(e))}}({block:r,onChange:i}),insert:function(e){let{allowedDecorators:n,block:r,onChange:i}=e;return e=>{let a=[fI((Array.isArray(e)?e:[e]).map(e=>(0,s2.nX)(e,{allowedDecorators:n})),"after",[{_key:r._key}])];return i(fR.from(a))}}({allowedDecorators:o,block:r,onChange:i})})},[a,r,n,i,o]);return l?(0,oZ.jsx)(kr,{contentEditable:!1,children:l}):null}var ka=Object.freeze,ko=Object.defineProperty,kl=(e,n)=>ka(ko(e,"raw",{value:ka(n||e.slice())}));let ks=oV.ZP.div(e=>{let{theme:n}=e,{radius:r,space:i,color:a}=n.sanity,o=(0,oK.m4)(a.spot.yellow,.2);return(0,oV.iv)(no||(no=kl(["\n    position: absolute;\n    border-radius: ","px;\n    top: -","px;\n    bottom: -","px;\n    left: ","px;\n    right: 0;\n    background-color: ",";\n  "])),r[3],i[2],i[1]+i[1],i[4]+i[1],o)});var kc=Object.freeze,kd=Object.defineProperty,ku=(e,n)=>kc(kd(e,"raw",{value:kc(n||e.slice())}));let kp=(0,oV.ZP)(dQ)(()=>(0,oV.iv)(nl||(nl=ku(["\n    width: 1px;\n    height: 100%;\n\n    & > div {\n      height: 100%;\n    }\n  "]))));function kh(e){return e.type?kh(e.type):"block"===e.name}function kf(e){return"field"===e.kind&&"array"===e.field.schemaType.jsonType}let km=["@@_NONEXISTENT_PATH_@@"];function kg(e){let n=(0,oN.useRef)(null),r=(null==e?void 0:e.validation)&&e.validation.length>0?e.validation:dy,i=vA((null==e?void 0:e.path)||km),a=(0,oN.useMemo)(()=>(null==e?void 0:e.schemaType)&&kh(null==e?void 0:e.schemaType)?r:r.concat(i),[i,e,r]),[o,l,s]=(0,oN.useMemo)(()=>[a.filter(e=>"error"===e.level).length>0,a.filter(e=>"warning"===e.level).length>0,a.filter(e=>"info"===e.level).length>0],[a]),c=v_(n.current,a);return n.current=c,(0,oN.useMemo)(()=>({validation:c,hasError:o,hasWarning:l,hasInfo:s}),[c,o,l,s])}let kx=(0,oN.createContext)([]);function kv(e){return(0,oZ.jsx)(kx.Provider,{value:e.markers,children:e.children})}function ky(e){let n=(0,oN.useContext)(kx);if(!n)throw Error("Form context not provided");return(0,oN.useMemo)(()=>n.filter(n=>(0,o2.Xy)(n.path,e)),[n,e])}let kb=(0,oN.createContext)([]);function kj(e){return(0,oZ.jsx)(kb.Provider,{value:e.memberItems,children:e.children})}function kw(e){let n=(0,oN.useContext)(kb);if(!n)throw Error("Form context not provided");return n.find(n=>n.key===e)}let kk=e=>{var n;let{props:r,ref:i}=e,a=[],{members:o,path:l,schemaType:s,renderAnnotation:c,renderField:d,renderBlock:u,renderInput:p,renderItem:h,renderInlineBlock:f,renderPreview:m}=r;for(let e of o)if("item"===e.kind){if(kh(e.item.schemaType)){(e.item.validation.length>0||e.item.changed||(null==(n=e.item.presence)?void 0:n.length)||e.item.focusPath.length>0)&&a.push({kind:"textBlock",member:e,node:e.item});let r=e.item.members.find(e=>"field"===e.kind&&"children"===e.name);if(r&&"field"===r.kind&&wu(r))for(let e of r.field.members)"item"===e.kind&&"span"!==e.item.schemaType.name&&a.push({kind:"inlineObject",member:e,node:e.item});let i=e.item.members.filter(kf).find(e=>"markDefs"===e.name);if(i)for(let e of i.field.members)"item"===e.kind&&"object"===e.item.schemaType.jsonType&&a.push({kind:"annotation",member:e,node:e.item})}else a.push({kind:"objectBlock",member:e,node:e.item})}let g=a.map(e=>{let n=fH(e.node.path),r=i.current.find(e=>e.key===n),a="textBlock"!==e.kind,g=null;if(a&&e.member!==(null==r?void 0:r.member)||e.node!==(null==r?void 0:r.node)){let n={absolutePath:(0,o2.s6)(e.node.path),includeField:!1,members:o,path:(0,o2.s6)(l),renderAnnotation:c,renderBlock:u,renderField:d,renderInlineBlock:f,renderInput:p,renderItem:h,renderPreview:m,schemaType:s};g=(0,oZ.jsx)(wZ,{...n})}return r?(r.member=e.member,r.node=e.node,r.input=g||r.input,r):{kind:e.kind,key:n,member:e.member,node:e.node,elementRef:(0,oN.createRef)(),input:g}});return i.current=g,g};function kC(e){}var k_=Object.freeze,kT=Object.defineProperty,kS=(e,n)=>k_(kT(e,"raw",{value:k_(n||e.slice())}));let kE=(0,oV.ZP)(oK.Zb)(e=>{let{color:n,radius:r,space:i}=e.theme.sanity,a=(0,oV.iv)(ns||(ns=kS(["\n    pointer-events: none;\n    content: '';\n    position: absolute;\n    top: -","px;\n    bottom: -","px;\n    left: -","px;\n    right: -","px;\n    border-radius: ","px;\n    mix-blend-mode: ",";\n  "])),i[1],i[1],i[1],i[1],r[2],n.dark?"screen":"multiply");return(0,oV.iv)(nc||(nc=kS(["\n    box-shadow: 0 0 0 1px var(--card-border-color);\n    border-radius: ","px;\n    pointer-events: all;\n    position: relative;\n\n    &[data-focused] {\n      --card-border-color: var(--card-focus-ring-color);\n    }
1\n\n    &:not([data-focused]):not([data-selected]) {\n      @media (hover: hover) {\n        &:hover {\n          --card-border-color: ",";\n        }\n      }\n    }\n\n    &[data-markers] {\n      &:after {\n        ","\n        background-color: ",";\n      }\n    }\n\n    &[data-warning] {\n      &:after {\n        ","\n        background-color: ",";\n      }\n\n      @media (hover: hover) {\n        &:hover {\n          --card-border-color: ",";\n        }\n      }\n    }\n\n    &[data-invalid] {\n      &:after {\n        ","\n        background-color: ",";\n      }\n\n      @media (hover: hover) {\n        &:hover {\n          --card-border-color: ",";\n        }\n      }\n    }\n  "])),r[1],n.input.default.hovered.border,a,n.dark?sx.VG.purple[950].hex:sx.VG.purple[50].hex,a,n.muted.caution.hovered.bg,n.muted.caution.hovered.border,a,n.input.invalid.enabled.bg,n.input.invalid.hovered.border)}),kP=(0,oV.ZP)(oK.xu)(nd||(nd=kS(["\n  display: block;\n  width: 100%;\n  user-select: none;\n  pointer-events: all;\n"]))),kO=oV.ZP.div(e=>{let{theme:n,$hasChanges:r}=e,{space:i}=n.sanity;return(0,oV.iv)(np||(np=kS(["\n      position: absolute;\n      width: ","px;\n      right: 0;\n      top: 0;\n      bottom: 0;\n      padding-left: ","px;\n      user-select: none;\n\n      ","\n\n      [data-dragged] & {\n        visibility: hidden;\n      }\n    "])),i[2],i[1],!r&&(0,oV.iv)(nu||(nu=kS(["\n        display: none;\n      "]))))}),kA=(0,oV.ZP)(oK.kC)(nh||(nh=kS(["\n  position: relative;\n\n  [data-dragged] > & {\n    opacity: 0.5;\n  }\n"]))),kI=(0,oV.ZP)(oK.xu)(nf||(nf=kS(["\n  width: 25px;\n  position: relative;\n\n  [data-dragged] & {\n    visibility: hidden;\n  }\n"]))),kz=(0,oV.ZP)(oK.kC)(nm||(nm=kS(["\n  position: absolute;\n  right: 0;\n  [data-dragged] & {\n    visibility: hidden;\n  }\n"]))),kM=(0,oV.ZP)(oK.xu)(ng||(ng=kS(["\n  max-width: 250px;\n"]))),kR={constrainSize:!0,placement:"bottom",portal:"default",tone:"default"};function kF(e){let{children:n,focused:r,isOpen:i,onOpen:a,onRemove:o,readOnly:l,value:s}=e,{t:c}=dV(),d=(0,oN.useId)(),u=(0,oN.useRef)(null),p=(0,oN.useRef)(!1),h=(0,oN.useMemo)(()=>(0,ll.Yk)(s)?(0,oN.forwardRef)(function(e,n){return(0,oZ.jsx)(lm.nR,{...e,intent:"edit",params:{id:s._ref},ref:n})}):void 0,[s]);(0,oN.useEffect)(()=>{i&&(p.current=!1)},[i]),(0,oK.qh)((0,oN.useCallback)(e=>{r&&("Tab"!==e.key||!u.current||p.current||i||(e.preventDefault(),e.stopPropagation(),u.current.focus(),p.current=!0))},[r,i]));let f=(0,oN.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),o()},[o]);return(0,oZ.jsxs)(oK.kC,{children:[(0,oZ.jsx)(oK.xu,{flex:1,children:n}),(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(lr.zx,{"aria-label":c("inputs.portable-text.block.open-menu-aria-label"),icon:lp.xXb,mode:"bleed",paddingY:3,tabIndex:r?0:1,tooltipProps:{content:"Open menu"}}),ref:u,id:d,menu:(0,oZ.jsx)(oK.v2,{children:(0,oZ.jsxs)(oZ.Fragment,{children:["_ref"in s&&s._ref&&(0,oZ.jsx)(lr.sN,{as:h,"data-as":"a",icon:lp.xPt,text:c("inputs.portable-text.block.open-reference")}),l&&(0,oZ.jsx)(lr.sN,{icon:lp.hsE,onClick:a,text:c("inputs.portable-text.block.view")}),!l&&(0,oZ.jsx)(lr.sN,{icon:lp.dY8,onClick:a,text:c("inputs.portable-text.block.edit")}),!l&&(0,oZ.jsx)(lr.sN,{icon:lp.XHJ,onClick:f,text:c("inputs.portable-text.block.remove"),tone:"critical"})]})}),popover:kR})})]})}let kD=e=>Array.isArray(e)?e.flatMap(kD):"number"==typeof e?[e]:"auto"===e?["auto"]:[],kq=e=>"dialog"===e||"popover"===e?e:void 0;function kZ(e){let{onClose:n,children:r,title:i,width:a=1,autoFocus:o}=e,l=(0,oN.useId)(),[s,c]=(0,oN.useState)(null),d=(0,oN.useRef)(null);return(0,oZ.jsx)(lr.Vq,{header:i,id:l,onClickOutside:n,onClose:n,portal:"default",width:a,contentRef:c,"data-testid":"default-edit-object-dialog",__unstable_autoFocus:o,children:(0,oZ.jsx)(yQ,{margins:[0,0,1,0],children:(0,oZ.jsx)(wV,{scrollElement:s,containerElement:d,children:(0,oZ.jsx)(oK.xu,{ref:d,children:r})})})})}var kN=Object.freeze,kL=Object.defineProperty,kV=(e,n)=>kN(kL(e,"raw",{value:kN(n||e.slice())}));let kK=(0,oV.ZP)(lr.J2)(nx||(nx=kV(["\n  & > div {\n    overflow: hidden;\n    overflow: clip;\n  }\n"]))),kB=(0,oV.ZP)(oK.xu)(nv||(nv=kV(["\n  /* Prevent overflow caused by change indicator */\n  overflow-x: hidden;\n  overflow-y: auto;\n"]))),kU=(0,oV.ZP)(oK.xu)(ny||(ny=kV(["\n  box-shadow: 0 1px 0 var(--card-shadow-outline-color);\n  position: relative;\n  z-index: 10;\n  min-height: auto;\n"]))),kH=["top","bottom"];function k$(e){let{floatingBoundary:n,referenceBoundary:r,referenceElement:i,width:a=0}=e,[o,l]=(0,oN.useState)(!1);return(0,oN.useEffect)(()=>
1{l(!0)},[]),(0,oZ.jsx)(kK,{content:(0,oZ.jsx)(kW,{...e}),constrainSize:!0,"data-ui":"PopoverEditDialog",fallbackPlacements:kH,floatingBoundary:n,open:o,overflow:"auto",placement:"bottom",portal:"default",preventOverflow:!0,referenceBoundary:r,referenceElement:i,width:a})}function kW(e){let{onClose:n,referenceBoundary:r,referenceElement:i,title:a,autoFocus:o}=e;(0,oK.qh)((0,oN.useCallback)(e=>{"Escape"===e.key&&n()},[n])),(0,oK.O8)(n,i?[i]:[],r);let[l,s]=(0,oN.useState)(null),c=(0,oN.useRef)(null);return(0,oZ.jsx)(wV,{scrollElement:l,containerElement:c,children:(0,oZ.jsxs)(oK.kC,{ref:c,direction:"column",height:"fill",children:[(0,oZ.jsx)(kU,{flex:"none",padding:1,children:(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(oK.xu,{flex:1,padding:2,children:(0,oZ.jsx)(oK.xv,{weight:"medium",children:a})}),(0,oZ.jsx)(lr.zx,{autoFocus:!!o,icon:lp.Two,mode:"bleed",onClick:n,tooltipProps:{content:"Close"}})]})}),(0,oZ.jsx)(kB,{flex:1,children:(0,oZ.jsx)(yQ,{margins:[0,0,1,0],children:(0,oZ.jsx)(oK.xu,{padding:3,ref:s,children:e.children})})})]})})}function kY(e){let{autoFocus:n,defaultType:r,floatingBoundary:i,onClose:a,referenceBoundary:o,referenceElement:l,schemaType:s}=e,{t:c}=dV(),d=(0,oN.useMemo)(()=>(function(e){var n;let r=null==(n=e.options)?void 0:n.modal;return"object"==typeof r&&null!==r?{type:kq(r.type),width:kD(r.width)}:void 0})(s),[s]),u=(null==d?void 0:d.type)||r,p=s.i18nTitleKey?c(s.i18nTitleKey):s.title||s.name,h=c("inputs.portable-text.annotation-editor.title",{schemaType:p}),f=(0,oN.useCallback)(()=>{a()},[a]),m=null==d?void 0:d.width;return"popover"===u?(0,oZ.jsx)(k$,{autoFocus:n,floatingBoundary:i,onClose:f,referenceBoundary:o,referenceElement:l,title:(0,oZ.jsx)(oZ.Fragment,{children:h}),width:m,children:e.children}):(0,oZ.jsx)(kZ,{onClose:f,title:h,width:m,autoFocus:n,children:e.children})}function kX(e){var n;let{floatingBoundary:r,focused:i,isFullscreen:a,onItemClose:o,onItemOpen:l,onPathFocus:s,path:c,readOnly:d,referenceBoundary:u,relativePath:p,renderAnnotation:h,renderBlock:f,renderBlockActions:m,renderCustomMarkers:g,renderField:x,renderInlineBlock:v,renderInput:y,renderItem:b,renderPreview:j,schemaType:w,selected:k,value:C}=e,{onChange:_}=vC(),{Markers:T}=vm().__internal.components,[S,E]=(0,oN.useState)(!1),P=ky(c),O=(0,sV._F)(),A=kw(fH(c)),I=(0,oN.useRef)(!1),z=(0,oN.useMemo)(()=>({anchor:{path:p,offset:0},focus:{path:p,offset:0}}),[p]),M=(0,oN.useCallback)(()=>E(!0),[]),R=(0,oN.useCallback)(()=>E(!1),[]),F=(0,oN.useCallback)(()=>{A&&(sV.q$.blur(O),l(A.node.path))},[O,A,l]),D=(0,oN.useCallback)(()=>{o(),sV.q$.select(O,z),sV.q$.focus(O)},[o,O,z]),q=(0,oN.useCallback)(()=>{if(!I.current)try{sV.q$.delete(O,z,{mode:"blocks"})}catch(e){console.error(e)}finally{I.current=!0}},[O,z]);(0,oN.useEffect)(()=>()=>{I.current&&sV.q$.focus(O)},[O]);let Z=(0,oN.useMemo)(()=>a&&!m?{paddingX:5}:a&&m?{paddingLeft:5,paddingRight:2}:m?{paddingLeft:3,paddingRight:2}:{paddingX:3},[a,m]),{validation:N,hasError:L,hasWarning:V,hasInfo:K}=kg(null==A?void 0:A.node),B=O.schemaTypes.portableText,U=P.length>0,H=vE(c,!0),$=(0,oN.useMemo)(()=>H.filter(e=>(0,o2.Xy)(e.path,c)),[c,H]),W=L||V||K||U,Y=(0,oN.useMemo)(()=>W&&(0,oZ.jsx)(kM,{children:(0,oZ.jsx)(T,{markers:P,validation:N,renderCustomMarkers:g})})||null,[T,P,g,W,N]),X=!!(null==A?void 0:A.member.open),G=null==A?void 0:A.input,J=(null==A?void 0:A.node.path)||dy,Q=null==(n=null==A?void 0:A.elementRef)?void 0:n.current,ee=(0,oN.useMemo)(()=>({__unstable_floatingBoundary:r,__unstable_referenceBoundary:u,__unstable_referenceElement:Q||null,children:G,focused:i,markers:P,onClose:D,onOpen:F,onPathFocus:s,onRemove:q,open:X,parentSchemaType:B,path:J,presence:$,readOnly:!!d,renderAnnotation:h,renderBlock:f,renderDefault:kG,renderField:x,renderInlineBlock:v,renderInput:y,renderItem:b,renderPreview:j,schemaType:w,selected:k,validation:N,value:C}),[r,Q,G,i,P,D,F,s,q,X,B,J,$,d,u,h,f,x,v,y,b,j,w,k,N,C]);return(0,oN.useMemo)(()=>(0,oZ.jsx)(oK.xu,{ref:null==A?void 0:A.elementRef,contentEditable:!1,children:(0,oZ.jsx)(oK.kC,{paddingBottom:1,marginY:3,style:kC(),children:(0,oZ.jsxs)(kA,{flex:1,children:[(0,oZ.jsx)(lr.u,{placement:"top",portal:"editor",disabled:!W,content:Y,children:(0,oZ.jsx)(kP,{...Z,children:f&&f(ee)})}),(0,oZ.jsx)(kI,{marginRight:1,children:(0,oZ.jsx)(kz,{children:m&&C&&i&&!d&&(0,oZ.jsx)(ki,{block:C,onChange:_,renderBlockActions:m})})}),a&&A&&(0,oZ.jsx)(kO,{$hasChanges:A.member.item.changed,onMouseOut:R,onMouseOver:M,children:(0,oZ.jsx)(kp,{hasFocus:i,isChanged:A.member.item.changed,path:A.member.item.path,withHoverEffect:!1})}),S&&(0,oZ.jsx)(ks,{})]})})}),[ee,i,R,M,Z,a,A,_,d,f,m,S,Y,W,C])}let kG=e=>{let{__unstable_floatingBoundary:n,__unstable_referenceBoundary:r,__unstable_referenceElement:i,
1children:a,focused:o,markers:l,onClose:s,onOpen:c,onRemove:d,open:u,readOnly:p,renderPreview:h,schemaType:f,selected:m,value:g,validation:x}=e,v=(0,ll.Or)(g),y=x.filter(e=>"error"===e.level).length>0,b=x.filter(e=>"warning"===e.level).length>0,j=l.length>0,w=m||o?"primary":"default",k=(0,oN.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),c()},[c]);return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(kE,{"data-focused":o?"":void 0,"data-image-preview":v?"":void 0,"data-invalid":y?"":void 0,"data-markers":j?"":void 0,"data-read-only":p?"":void 0,"data-selected":m?"":void 0,"data-testid":"pte-block-object","data-warning":b?"":void 0,flex:1,onDoubleClick:k,padding:v?0:1,tone:w,children:h({actions:(0,oZ.jsx)(kF,{isOpen:u,focused:o,onOpen:c,onRemove:d,readOnly:p,value:g}),layout:v?"blockImage":"block",schemaType:f,skipVisibilityCheck:!0,value:g})}),u&&(0,oZ.jsx)(kY,{floatingBoundary:n,defaultType:"dialog",onClose:s,autoFocus:o,schemaType:f,referenceBoundary:r,referenceElement:i,children:a})]})},kJ=[1,2,3,4,5,6,7,8,9],kQ=["●","○","■"],k0=["number","lower-alpha","lower-roman"],k1={em:"em","strike-through":"s",underline:"u",strong:"strong",code:"code"},k2={h1:{paddingTop:5,paddingBottom:4},h2:{paddingTop:4,paddingBottom:4},h3:{paddingTop:4,paddingBottom:3},h4:{paddingTop:4,paddingBottom:3},h5:{paddingTop:4,paddingBottom:3},h6:{paddingTop:4,paddingBottom:2},normal:{paddingTop:2,paddingBottom:3},blockquote:{paddingTop:2,paddingBottom:3}};function k3(e){return"list-level-".concat(e)}var k4=Object.freeze,k5=Object.defineProperty,k8=(e,n)=>k4(k5(e,"raw",{value:k4(n||e.slice())}));let k6=oV.ZP.div(function(e){let{$level:n}=e,{color:r,font:i,radius:a,space:o}=(0,oL.aQ)(e.theme),l=k0[(n-1)%k0.length],s=kQ[(n-1)%kQ.length];return(0,oV.iv)(nb||(nb=k8(["\n    --marker-bg-color: transparent;\n\n    mix-blend-mode: ",";\n    position: relative;\n\n    & > [data-ui='TextBlock_inner'] {\n      position: relative;\n      flex: 1;\n    }\n\n    & > div:before {\n      content: '';\n      position: absolute;\n      top: -","px;\n      bottom: -","px;\n      left: -","px;\n      right: -","px;\n      border-radius: ","px;\n      background-color: var(--marker-bg-color);\n      // This is to make sure the marker is always behind the text\n      z-index: -1;\n    }\n\n    &[data-markers] {\n      --marker-bg-color: ",";\n    }\n\n    &[data-warning] {\n      --card-border-color: ",";\n      --marker-bg-color: ",";\n    }\n\n    &[data-error] {\n      --card-border-color: ",";\n      --marker-bg-color: ",";\n    }\n\n    & [data-list-prefix] {\n      position: absolute;\n      margin-left: -4.5rem;\n      width: 3.75rem;\n      text-align: right;\n      box-sizing: border-box;\n    }\n\n    &[data-list-item='number'] [data-list-prefix] {\n      font-variant-numeric: tabular-nums;\n\n      & > span:before {\n        content: counter(",") '.';\n        content: counter(",", ",") '.';\n      }\n    }\n\n    &[data-list-item='bullet'] [data-list-prefix] {\n      & > span {\n        position: relative;\n        top: -0.1875em;\n\n        &:before {\n          content: '","';\n          font-size: 0.46666em;\n        }\n      }\n    }\n\n    & [data-text] {\n      overflow-wrap: anywhere;\n      text-transform: none;\n      white-space: pre-wrap;\n      font-family: ",";\n      flex: 1;\n\n      *::selection {\n        background-color: ",";\n      }\n    }\n  "])),r._dark?"screen":"multiply",o[1],o[1],o[1],o[1],a[2],r._dark?sx.VG.purple[950].hex:sx.VG.purple[50].hex,r.button.ghost.caution.enabled.border,r.button.ghost.caution.hovered.bg,r.button.ghost.critical.enabled.border,r.button.ghost.critical.hovered.bg,k3(n),k3(n),l,s,i.text.family,(0,oL.m4)(r.focusRing,.3))}),k9=(0,oV.ZP)(oK.xu)(nj||(nj=k8(["\n  position: relative;\n  display: flex;\n"]))),k7=oV.ZP.div(nw||(nw=k8(["\n  user-select: none;\n  white-space: nowrap;\n"]))),Ce=(0,oV.ZP)(oK.xu)(nk||(nk=k8(["\n  user-select: none;\n"]))),Ct=(0,oV.ZP)(oK.xu)(nC||(nC=k8(["\n  line-height: 0;\n  width: 25px;\n  position: relative;\n"]))),Cn=(0,oV.ZP)(oK.kC)(e=>{let{theme:n}=e,{fonts:r,space:i}=n.sanity,a=r.text.sizes[1],o=r.text.sizes[2],l=a.lineHeight-a.ascenderHeight-a.descenderHeight,s=o.lineHeight-o.ascenderHeight-o.descenderHeight,c=l+i[2]+i[2];return(0,oV.iv)(n_||(n_=k8(["\n    user-select: none;\n    position: absolute;\n    right: 0;\n    top: ","px;\n  "])),0-(c-s)/2)}),Cr=(0,oV.ZP)(oK.xu)(nT||(nT=k8(["\n  max-width: 250px;\n"]))),Ci=(0,oV.ZP)(oK.kC)(nS||(nS=k8(["\n  position: relative;\n  padding-left: ","px;\n"])),e=>{let{$level:n}=e;return n?32*n:0}),Ca=oV.ZP.div(e=>{let{theme:n,$hasChanges:r}=e,{space:i}=n.sanity;return(0,oV.iv)(nP||(nP=k8(["\n      position: absolute;\n      width: ","px;\n      right: 0;\n      top: 0;\n      bottom: 0;\n      padding-left: ","px;\n      user-select: none;\n\n      ","\n    "])),i[2],i[1],!r&&(0,oV.iv)(nE||(nE=k8(["\n        display: none;\n      "]))))});var Co=Object.freeze,Cl=Object.defineProperty,Cs=(e,n)=>Co(Cl(e,"raw",{value:Co(n||e.slice())}));let Cc=oV.ZP.div(nO||(nO=Cs(["\n  display: block;\n"]))),Cd=e=>{let{children:n,...r}=e;return(0,oZ.jsx)(oK.xv,{"data-testid":"text-style--normal",...r,children:(0,oZ.jsx)(Cc,{children:n})})},Cu=e=>{let{children:n,...r}=e;return(0,oZ.jsx)(oK.X6,{as:"h1","data-testid":"text-style--h1",size:5,...r,children:(0,oZ.jsx)(Cc,{children:n})})},Cp=e=>{let{children:n,...r}=e;return(0,oZ.jsx)(oK.X6,{as:"h2","data-testid":"text-style--h2",size:4,...r,children:(0,oZ.jsx)(Cc,{children:n})})},Ch=e=>{let{children:n,...r}=e;return(0,oZ.jsx)(oK.X6,{as:"h3","data-testid":"text-style--h3",size:3,...r,children:(0,oZ.jsx)(Cc,{children:n})})},Cf=e=>{let{children:n,...r}=e;return(0,oZ.jsx)(oK.X6,{as:"h4","data-testid":"text-style--h4",size:2,...r,children:(0,oZ.jsx)(Cc,{children:n})})},Cm=e=>{let{children:n,...r}=e;return(0,oZ.jsx)(oK.X6,{as:"h5","data-testid":"text-style--h5",size:1,...r,children:(0,oZ.jsx)(Cc,{children:n})})},Cg=e=>{let{children:n,...r}=e;return(0,oZ.jsx)(oK.X6,{as:"h6","data-testid":"text-style--h6",size:0,...r,children:(0,oZ.jsx)(Cc,{children:n})})},Cx=oV.ZP.blockquote(nA||(nA=Cs(["\n  position: relative;\n  display: block;\n  margin: 0;\n  padding-left: ","px;\n\n  &::before {\n    content: '';\n    position: absolute;\n    left: 0;\n    top: -4px;\n    bottom: -4px;\n    width: 3px;\n    background: var(--card-border-color);\n  }\n"])),e=>{let{theme:n}=e;return n.sanity.space[3]}),Cv=e=>{let{children:n,...r}=e;return(0,oZ.jsx)(Cx,{"data-testid":"text-style--blockquote",...r,children:(0,oZ.jsx)(oK.xv,{as:"p",children:n})})},Cy={normal:Cd,h1:Cu,h2:Cp,h3:Ch,h4:Cf,h5:Cm,h6:Cg,blockquote:Cv};function Cb(e){let{children:n,floatingBoundary:r,focused:i,isFullscreen:a,onItemClose:o,onItemOpen:l,onPathFocus:s,path:c,readOnly:d,referenceBoundary:u,renderBlock:p,renderAnnotation:h,renderBlockActions:f,renderCustomMarkers:m,renderField:g,renderInlineBlock:x,renderInput:v,renderItem:y,renderPreview:b,
1schemaType:j,selected:w,spellCheck:k,value:C}=e,{Markers:_}=vm().__internal.components,[T,S]=(0,oN.useState)(!1),E=ky(c),P=kw(fH(c)),O=(0,sV._F)(),{onChange:A}=vC(),I=vE(c,!0),z=(0,oN.useMemo)(()=>I.filter(e=>(0,o2.Xy)(e.path,c)||"children"===e.path.slice(-3)[1]&&e.path.length-c.length==2),[c,I]),M=(0,oN.useCallback)(()=>S(!0),[]),R=(0,oN.useCallback)(()=>S(!1),[]),{validation:F,hasError:D,hasWarning:q,hasInfo:Z}=kg(null==P?void 0:P.node),N=!!m&&E.length>0,L=D||q||N||Z,V=(0,oN.useCallback)(()=>{P&&l(P.node.path)},[l,P]),K=(0,oN.useCallback)(()=>{let e={path:c.slice(-1),offset:0};sV.q$.delete(O,{focus:e,anchor:e},{mode:"blocks"}),sV.q$.focus(O)},[c,O]),B=(0,oN.useMemo)(()=>(0,oZ.jsxs)(Ci,{align:"flex-start",$level:null==C?void 0:C.level,children:[C.listItem&&(0,oZ.jsx)(k7,{contentEditable:!1,children:(0,oZ.jsx)(oK.xv,{"data-list-prefix":"",children:(0,oZ.jsx)(Cc,{})})}),(0,oZ.jsx)("div",{"data-text":"",style:kC(),children:n})]}),[C.listItem,C.level,n]),U=(0,oN.useMemo)(()=>a&&!f?{paddingX:5}:a&&f?{paddingLeft:5,paddingRight:2}:f?{paddingLeft:3,paddingRight:2}:{paddingX:3},[a,f]),H=(0,oN.useMemo)(()=>C.listItem?{paddingY:2}:k2[C.style||"normal"]||{paddingY:2},[C]),$=!!(null==P?void 0:P.member.open),W=O.schemaTypes.portableText,Y=(0,oN.useMemo)(()=>{var e;return{__unstable_floatingBoundary:r,__unstable_referenceBoundary:u,__unstable_referenceElement:(null==(e=null==P?void 0:P.elementRef)?void 0:e.current)||null,children:B,focused:i,markers:E,onClose:o,onOpen:V,onPathFocus:s,onRemove:K,open:$,parentSchemaType:W,path:(null==P?void 0:P.node.path)||dy,presence:z,readOnly:!!d,renderAnnotation:h,renderBlock:p,renderDefault:Cj,renderField:g,renderInput:v,renderInlineBlock:x,renderItem:y,renderPreview:b,schemaType:j,selected:w,validation:F,value:C}},[r,i,$,E,null==P?void 0:P.elementRef,null==P?void 0:P.node.path,o,V,s,K,W,d,u,h,p,g,x,v,y,b,j,w,B,z,F,C]),X=(0,oN.useMemo)(()=>L&&(0,oZ.jsx)(Cr,{children:(0,oZ.jsx)(_,{markers:E,renderCustomMarkers:m,validation:F})})||null,[_,E,m,L,F]);return(0,oN.useMemo)(()=>(0,oZ.jsx)(oK.xu,{"data-testid":"text-block",...H,style:kC(),ref:null==P?void 0:P.elementRef,children:(0,oZ.jsx)(k9,{"data-testid":"text-block__wrapper",children:(0,oZ.jsxs)(oK.kC,{flex:1,...U,children:[(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(lr.u,{content:X,disabled:!L,placement:"top",portal:"editor",children:(0,oZ.jsx)(k6,{$level:C.level||1,"data-error":D?"":void 0,"data-list-item":C.listItem,"data-markers":N?"":void 0,"data-read-only":d,"data-testid":"text-block__text","data-warning":q?"":void 0,spellCheck:k,children:p&&p(Y)})})}),(0,oZ.jsxs)(Ce,{contentEditable:!1,children:[(0,oZ.jsx)(Ct,{marginRight:1,children:(0,oZ.jsx)(Cn,{children:f&&i&&!d&&(0,oZ.jsx)(ki,{onChange:A,block:C,renderBlockActions:f})})}),a&&P&&(0,oZ.jsx)(Ca,{$hasChanges:P.member.item.changed,onMouseEnter:M,onMouseLeave:R,children:(0,oZ.jsx)(kp,{hasFocus:i,isChanged:P.member.item.changed,path:P.member.item.path,withHoverEffect:!1})})]}),T&&(0,oZ.jsx)(ks,{})]})})}),[Y,i,M,R,D,N,q,U,a,P,A,H,d,p,f,T,k,X,L,C])}let Cj=e=>(0,oZ.jsx)(oZ.Fragment,{children:e.children}),Cw=["top","bottom"];function Ck(e){let{floatingBoundary:n,onClosePopover:r,onEdit:i,onDelete:a,referenceBoundary:o,referenceElement:l,title:s,open:c}=e,{sanity:d}=(0,oK.Fg)(),{t:u}=dV(),p=(0,oN.useRef)(null),h=(0,oN.useRef)(null),f=d.color.dark?"light":"dark";(0,oK.qh)((0,oN.useCallback)(e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),r())},[r]));let m=(0,oN.useCallback)(e=>{var n;if(null==(n=h.current)||!n.disabled){e.preventDefault(),e.stopPropagation();try{a(e)}catch(e){console.error(e)}finally{h.current&&(h.current.disabled=!0)}}},[a]),g=(0,oN.useMemo)(()=>(0,oZ.jsx)(oK.xu,{padding:1,children:(0,oZ.jsxs)(oK.gF,{space:1,children:[(0,oZ.jsx)(oK.xu,{padding:2,children:(0,oZ.jsx)(oK.xv,{weight:"medium",size:1,children:s})}),(0,oZ.jsx)(lr.zx,{icon:lp.dY8,mode:"bleed",onClick:i,ref:p,tooltipProps:{content:u("inputs.portable-text.inline-object.edit")}}),(0,oZ.jsx)(lr.zx,{ref:h,icon:lp.XHJ,mode:"bleed",onClick:m,tone:"critical",tooltipProps:{content:u("inputs.portable-text.inline-object.remove")}})]})}
1),[m,i,s,u]);return(0,oZ.jsx)(lr.J2,{constrainSize:!0,content:g,fallbackPlacements:Cw,floatingBoundary:n,open:c,placement:"top",portal:!0,referenceBoundary:o,referenceElement:l,scheme:f})}var CC=Object.freeze,C_=Object.defineProperty,CT=(e,n)=>CC(C_(e,"raw",{value:CC(n||e.slice())}));let CS=(0,oV.ZP)(oK.Zb)(function(e){var n,r,i;let{theme:a}=e,{color:o,radius:l}=a.sanity;return(0,oV.iv)(nM||(nM=CT(["\n    line-height: 0;\n    border-radius: ","px;\n    padding: 2px;\n    box-shadow: inset 0 0 0 1px var(--card-border-color);\n    height: calc(1em - 1px);\n    margin-top: 0.0625em;\n    cursor: default;\n\n    &:not([hidden]) {\n      display: inline-flex;\n      align-items: center;\n      vertical-align: top;\n    }\n\n    &[data-ready-only] {\n      cursor: default;\n    }\n\n    &[data-focused] {\n      box-shadow: inset 0 0 0 1px ",";\n      color: ",";\n    }\n\n    &[data-selected] {\n      background-color: ",";\n    }\n\n    &:not([data-focused]):not([data-selected]) {\n      @media (hover: hover) {\n        &:hover {\n          --card-border-color: ",";\n        }\n      }\n    }\n\n    &[data-markers] {\n      --card-bg-color: ",";\n    }\n\n    &[data-warning] {\n      --card-bg-color: ",";\n\n      @media (hover: hover) {\n        &:hover {\n          --card-border-color: ",";\n        }\n      }\n    }\n\n    &[data-invalid] {\n      --card-bg-color: ",";\n      --card-border-color: ",";\n\n      @media (hover: hover) {\n        &:hover {\n          --card-border-color: ",";\n        }\n      }\n    }\n  "])),l[2],null==(n=o.selectable)?void 0:n.primary.selected.border,null==(r=o.selectable)?void 0:r.primary.pressed.fg,null==(i=o.selectable)?void 0:i.primary.pressed.bg,o.input.default.hovered.border,o.dark?sx.VG.purple[950].hex:sx.VG.purple[50].hex,o.muted.caution.hovered.bg,o.muted.caution.hovered.border,o.input.invalid.enabled.bg,o.input.invalid.enabled.border,o.input.invalid.hovered.border)}),CE=oV.ZP.span(nI||(nI=CT(["\n  display: block;\n  max-width: calc(5em + 80px);\n  position: relative;\n"]))),CP=(0,oV.ZP)(oK.xu)(nz||(nz=CT(["\n  max-width: 250px;\n"]))),CO=e=>{var n;let{floatingBoundary:r,focused:i,onItemClose:a,onItemOpen:o,onPathFocus:l,path:s,readOnly:c,referenceBoundary:d,relativePath:u,renderAnnotation:p,renderBlock:h,renderCustomMarkers:f,renderField:m,renderItem:g,renderInlineBlock:x,renderInput:v,renderPreview:y,schemaType:b,selected:j,value:w}=e,{Markers:k}=vm().__internal.components,C=(0,sV._F)(),_=ky(s),T=kw(fH(s)),{validation:S,hasError:E,hasInfo:P,hasWarning:O}=kg(null==T?void 0:T.node),A=C.schemaTypes.block,I=_.length>0,z=(0,oN.useMemo)(()=>({anchor:{path:u,offset:0},focus:{path:u,offset:0}}),[u]),M=(0,oN.useCallback)(()=>{sV.q$.delete(C,z,{mode:"children"}),sV.q$.focus(C)},[z,C]),R=(0,oN.useCallback)(()=>{T&&(sV.q$.blur(C),o(T.node.path))},[C,o,T]),F=(0,oN.useCallback)(()=>{a(),sV.q$.select(C,z),sV.q$.focus(C)},[a,C,z]),D=!!(null==T?void 0:T.member.open),q=null==T?void 0:T.input,Z=(null==T?void 0:T.node.path)||dy,N=null==(n=null==T?void 0:T.elementRef)?void 0:n.current,L=vE(s,!0),V=(0,oN.useMemo)(()=>L.filter(e=>(0,o2.Xy)(e.path,s)),[s,L]),K=(0,oN.useMemo)(()=>({__unstable_floatingBoundary:r,__unstable_referenceBoundary:d,__unstable_referenceElement:N,children:q,focused:i,onClose:F,onOpen:R,onPathFocus:l,onRemove:M,open:D,markers:_,member:null==T?void 0:T.member,parentSchemaType:A,path:Z,presence:V,readOnly:!!c,renderAnnotation:p,renderBlock:h,renderDefault:CA,renderField:m,renderInlineBlock:x,renderInput:v,renderItem:g,renderPreview:y,schemaType:b,selected:j,value:w,validation:S}),[r,i,q,D,_,null==T?void 0:T.member,Z,F,R,l,M,A,c,d,N,p,h,m,x,v,g,y,V,b,j,S,w]),B=E||O||P||I,U=(0,oN.useMemo)(()=>B&&(0,oZ.jsx)(CP,{children:(0,oZ.jsx)(k,{markers:_,validation:S,renderCustomMarkers:f})})||null,[k,_,f,B,S]);return(0,oN.useMemo)(()=>(0,oZ.jsx)("span",{ref:null==T?void 0:T.elementRef,contentEditable:!1,children:(0,oZ.jsx)(lr.u,{placement:"bottom",portal:"editor",disabled:!B,content:U,children:x&&(0,oZ.jsx)("span",{style:{position:"relative"},children:x(K)})})}),[K,null==T?void 0:T.elementRef,x,U,B])},CA=e=>{let{__unstable_floatingBoundary:n,__unstable_referenceBoundary:r,__unstable_referenceElement:i,
1children:a,focused:o,markers:l,onClose:s,onOpen:c,onRemove:d,open:u,readOnly:p,renderPreview:h,schemaType:f,selected:m,validation:g,value:x}=e,v=l.length>0,[y,b]=(0,oN.useState)(!1),j=(null==f?void 0:f.title)||f.name,w=g.filter(e=>"error"===e.level).length>0,k=g.filter(e=>"warning"===e.level).length>0,C=(0,oN.useCallback)(()=>{b(!1),c()},[c]);(0,oN.useEffect)(()=>{u?b(!1):o?b(!0):b(!1)},[o,u]);let _=(0,oN.useMemo)(()=>w?"critical":k?"caution":m||o?"primary":void 0,[o,w,k,m]),T=(0,oN.useCallback)(()=>{b(!1)},[]);return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(CS,{"data-focused":o||void 0,"data-invalid":w||void 0,"data-markers":v||void 0,"data-read-only":p||void 0,"data-selected":m||void 0,"data-warning":k||void 0,forwardedAs:"span",onClick:p?C:void 0,onDoubleClick:C,tone:_,children:(0,oZ.jsx)(CE,{children:h({layout:"inline",schemaType:f,skipVisibilityCheck:!0,value:x,fallbackTitle:"Click to edit"})})}),i&&(0,oZ.jsx)(Ck,{floatingBoundary:n,onClosePopover:T,onDelete:d,onEdit:C,open:y,referenceBoundary:r,referenceElement:i,title:j}),u&&(0,oZ.jsx)(kY,{defaultType:"popover",onClose:s,autoFocus:o,floatingBoundary:n,referenceBoundary:r,referenceElement:i,schemaType:f,children:a})]})},CI=["top","bottom"];function Cz(e){let{annotationOpen:n,floatingBoundary:r,onOpen:i,onRemove:a,referenceBoundary:o,referenceElement:l,selected:s,title:c}=e,[d,u]=(0,oN.useState)(!1),[p,h]=(0,oN.useState)(!1),[f,m]=(0,oN.useState)(null),g=(0,oN.useRef)(null),{sanity:x}=(0,oK.Fg)(),{t:v}=dV(),y=(0,oN.useRef)(null),b=x.color.dark?"light":"dark",j=(0,oN.useCallback)(e=>{u(e),e?(0,oN.startTransition)(()=>{h(e)}):h(e)},[]),w=(0,oN.useMemo)(()=>f?{getBoundingClientRect:()=>f}:null,[f]);(0,oK.qh)((0,oN.useCallback)(e=>{p&&"Escape"===e.key&&j(!1)},[j,p]));let k=(0,oN.useCallback)(()=>{if(n){j(!1),m(null);return}let e=window.getSelection();if(!e||0===e.rangeCount)return;let r=e.getRangeAt(0);if(!(null==l?void 0:l.contains(r.commonAncestorContainer))){j(!1),m(null);return}let i=null==r?void 0:r.getBoundingClientRect();i&&(m(i),j(!0))},[n,l,j]);(0,oN.useEffect)(()=>(document.addEventListener("selectionchange",k,{passive:!0}),()=>{document.removeEventListener("selectionchange",k)}),[k]);let C=(0,oN.useCallback)(()=>{j(!1),i()},[i,j]);(0,oN.useEffect)(()=>{!n&&s&&f&&j(!0),n&&j(!1)},[n,s,f,j]);let _=(0,oN.useCallback)(()=>{j(!1),a()},[a,j]),T=(0,oN.useCallback)(()=>{g.current&&m(g.current.getBoundingClientRect())},[]);return((0,oN.useEffect)(()=>{let e=window.getSelection();e&&e.rangeCount>0&&(g.current=e.getRangeAt(0))},[p]),(0,oN.useEffect)(()=>p&&o?(o.addEventListener("scroll",T),()=>o.removeEventListener("scroll",T)):p?(null==o||o.addEventListener("scroll",T),()=>{null==o||o.removeEventListener("scroll",T)}):void 0,[p,o,T]),d)?(0,oZ.jsx)(lr.J2,{open:p,floatingBoundary:r,constrainSize:!0,content:(0,oZ.jsx)(oK.xu,{padding:1,"data-testid":"annotation-toolbar-popover",children:(0,oZ.jsxs)(oK.kC,{gap:1,children:[(0,oZ.jsx)(oK.xu,{padding:2,children:(0,oZ.jsx)(oK.xv,{weight:"medium",size:1,children:c})}),(0,oZ.jsx)(lr.zx,{"aria-label":v("inputs.portable-text.action.edit-annotation"),icon:lp.dY8,mode:"bleed",onClick:C,tabIndex:0,tooltipProps:null}),(0,oZ.jsx)(lr.zx,{"aria-label":v("inputs.portable-text.action.remove-annotation"),icon:lp.XHJ,mode:"bleed",onClick:_,tabIndex:0,tone:"critical",tooltipProps:null})]})}),fallbackPlacements:CI,placement:"top",portal:!0,preventOverflow:!0,ref:y,referenceBoundary:o,referenceElement:w,scheme:b}):null}var CM=Object.freeze,CR=Object.defineProperty,CF=(e,n)=>CM(CR(e,"raw",{value:CM(n||e.slice())}));let CD=oV.ZP.span(e=>{var n,r,i,a;let{$toneKey:o="default",theme:l}=e;return(0,oV.iv)(nR||(nR=CF(["\n      text-decoration: none;\n      display: inline;\n      background-color: ",";\n      border-bottom: 1px dashed ",";\n      color: ",";\n\n      &[data-link] {\n        border-bottom: 1px solid ",";\n      }\n\n      &[data-custom-markers] {\n        background-color: ",";\n      }\n\n      &[data-warning] {\n        background-color: ",";\n      }\n\n      &[data-error] {\n        background-color: ",";\n      }\n    "])),null==(n=l.sanity.color.selectable)?void 0:n[o].enabled.bg,null==(r=l.sanity.color.selectable)?void 0:r[o].enabled.fg,null==(i=l.sanity.color.selectable)?void 0:i[o].enabled.fg,null==(a=l.sanity.color.selectable)?void 0:a[o].enabled.fg,l.sanity.color.dark?sx.VG.purple[950].hex:sx.VG.purple[50].hex,l.sanity.color.muted.caution.hovered.bg,l.sanity.color.muted.critical.hovered.bg)}),Cq=(0,oV.ZP)(oK.xu).attrs({forwardedAs:"span"}
1)(nF||(nF=CF(["\n  max-width: 250px;\n"])));function CZ(e){var n;let{children:r,editorNodeFocused:i,floatingBoundary:a,focused:o,onItemClose:l,onItemOpen:s,onPathFocus:c,path:d,readOnly:u,referenceBoundary:p,renderAnnotation:h,renderBlock:f,renderCustomMarkers:m,renderField:g,renderInlineBlock:x,renderInput:v,renderItem:y,renderPreview:b,schemaType:j,selected:w,value:k}=e,{Markers:C=vj}=vm().__internal.components,_=(0,sV._F)(),T=(0,oN.useMemo)(()=>d.slice(0,d.length-2).concat(["markDefs",{_key:k._key}]),[d,k._key]),[S,E]=(0,oN.useState)(null),P=(0,oN.useMemo)(()=>d.slice(d.length-3,d.length),[d]),O=kw(fH(T)),{validation:A}=kg(null==O?void 0:O.node),I=ky(d),z=(0,oN.useMemo)(()=>(0,oZ.jsx)("span",{"data-annotation":"",children:r}),[r]),M=(0,oN.useCallback)(()=>{O&&(sV.q$.blur(_),c(O.node.focusPath),s(O.node.path))},[_,O,s,c]),R=(0,oN.useCallback)(()=>{l();let e=sV.q$.getSelection(_),n=(null==e?void 0:e.focus.path)&&(0,o2.Xy)(e.focus.path,P)&&e.focus.offset,r=(null==e?void 0:e.anchor.path)&&(0,o2.Xy)(e.anchor.path,P)&&e.anchor.offset;sV.q$.select(_,{anchor:{path:P,offset:r||0},focus:{path:P,offset:n||0}}),sV.q$.focus(_)},[_,P,l]),F=(0,oN.useCallback)(()=>{sV.q$.removeAnnotation(_,j),sV.q$.focus(_)},[_,j]),D=(0,oN.useMemo)(()=>A.length>0||I.length>0?(0,oZ.jsx)(lr.u,{placement:"bottom",portal:"default",content:(0,oZ.jsx)(Cq,{children:(0,oZ.jsx)(C,{markers:I,renderCustomMarkers:m,validation:A})}),children:z}):void 0,[C,I,m,z,A]),q=vE(d,!0),Z=(0,oN.useMemo)(()=>q.filter(e=>(0,o2.Xy)(e.path,d)),[d,q]),N=!!(null==O?void 0:O.member.open),L=null==O?void 0:O.input,V=(null==O?void 0:O.node.path)||dy,K=(0,oN.useMemo)(()=>({__unstable_floatingBoundary:a,__unstable_referenceBoundary:p,__unstable_referenceElement:S,__unstable_textElementFocus:i,children:L,focused:o,markers:I,onClose:R,onOpen:M,onPathFocus:c,onRemove:F,open:N,parentSchemaType:_.schemaTypes.block,path:V,presence:Z,readOnly:!!u,renderAnnotation:h,renderBlock:f,renderField:g,renderInlineBlock:x,renderInput:v,renderPreview:b,renderItem:y,renderDefault:CN,schemaType:j,selected:w,textElement:D||z,validation:A,value:k}),[_.schemaTypes.block,i,a,o,L,N,I,D,V,R,M,c,F,u,p,S,h,f,g,x,v,y,b,Z,j,w,z,A,k]),B=null==(n=j.components)?void 0:n.annotation,U=(0,oN.useCallback)(e=>{(null==O?void 0:O.elementRef)&&(O.elementRef.current=e),E(e)},[O]);return(0,oN.useMemo)(()=>(0,oZ.jsx)("span",{ref:U,style:kC(),children:B?(0,oZ.jsx)(B,{...K}):(0,oZ.jsx)(CN,{...K})}),[B,K,U])}let CN=e=>{let{__unstable_floatingBoundary:n,__unstable_referenceBoundary:r,__unstable_referenceElement:i,children:a,focused:o,markers:l,onClose:s,onOpen:c,onRemove:d,open:u,readOnly:p,selected:h,schemaType:f,textElement:m,validation:g}=e,x="link"===f.name,v=g.some(e=>"error"===e.level),y=g.some(e=>"warning"===e.level),b=l.length>0,{t:j}=dV(),w=(0,oN.useMemo)(()=>v?"critical":y?"caution":x?"primary":"default",[x,v,y]);return(0,oZ.jsxs)(CD,{$toneKey:w,"data-link":x?"":void 0,"data-error":v?"":void 0,"data-warning":y?"":void 0,"data-markers":b||void 0,onClick:p?c:void 0,children:[m,(0,oZ.jsx)(Cz,{annotationOpen:u,floatingBoundary:n,onOpen:c,onRemove:d,referenceBoundary:r,referenceElement:i,selected:h,title:f.i18nTitleKey?j(f.i18nTitleKey):f.title||f.name}),u&&(0,oZ.jsx)(kY,{defaultType:"popover",floatingBoundary:n,onClose:s,autoFocus:o,referenceBoundary:r,referenceElement:i,schemaType:f,children:a})]})};function CL(e){var n;return(null==(n=e.components)?void 0:n.block)?e.components.block:kh(e)?Cj:kG}function CV(e){var n;return(null==(n=e.components)?void 0:n.inlineBlock)?e.components.inlineBlock:CA}function CK(e){var n;return(null==(n=e.components)?void 0:n.annotation)?e.components.annotation:CN}function CB(e){let{reference:n,children:r,observeAsset:i,waitPlaceholder:a}=e,o=null==n?void 0:n._ref,l=(0,oR.m2)(()=>i(o),[o,i]);return(0,oZ.jsx)(oZ.Fragment,{children:o&&l?r(l):a})}function CU(e){return null===e?[]:[e]}function CH(e){return Promise.all(e.map(e=>{if("file"===e.kind&&e.webkitGetAsEntry){let n;try{n=e.webkitGetAsEntry()}catch(n){return CU(e.getAsFile())}return n?n.isDirectory?function e(n){if(n.isFile)return new Promise((e,r)=>n.file(e,r)).then(e=>[e]);if(n.isDirectory){let r=n.createReader();
1return new Promise((e,n)=>r.readEntries(e,n)).then(e=>e.filter(e=>!e.name.startsWith("."))).then(n=>Promise.all(n.map(e)).then(lI()))}return Promise.resolve([])}(n):CU(e.getAsFile()):[]}if("file"===e.kind){let n=e.getAsFile();return Promise.resolve(n?[n]:[])}return"string"===e.kind?console.warn('DataTransfer with kind="string" is currently not supported'):console.warn("Unknown DataTransferItem.kind: %s",e.kind),Promise.resolve([])}))}let C$={opacity:0,position:"absolute"};function CW(e){return oN.forwardRef(function(n,r){let{onFiles:i,onFilesOver:a,onFilesOut:o,disabled:l,...s}=n,[c,d]=oN.useState(!1),u=oN.useRef(null),p=(0,oK.ts)(r),h=oN.useRef([]),f=(0,oN.useCallback)(e=>{null==i||i(e)},[i]),m=(0,oN.useCallback)(e=>{e.target===p.current&&(e.ctrlKey||e.metaKey)&&"v"===e.key&&d(!0)},[p]),g=(0,oN.useCallback)(e=>{var n;((n=e.clipboardData).files&&n.files.length>0?Promise.resolve(Array.from(n.files||[])):CH(Array.from(n.items||[])).then(lI())).then(e=>u.current?e.length>0?e:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/jpeg";return e.isContentEditable?new Promise(e=>setTimeout(e,10)).then(()=>Array.from(e.querySelectorAll("img"))).then(n=>(e.innerHTML="",n)).then(e=>Promise.all(e.map(e=>(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/jpeg",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return e.match(/^webkit-fake-url:\/\//)?Promise.reject(Error("Cannot read image contents from webkit fake url")):new Promise((i,a)=>{let o=new Image;o.crossOrigin="anonymous",o.referrerPolicy="strict-origin-when-cross-origin",o.onload=()=>{let e=document.createElement("canvas");e.width=o.width,e.height=o.height;let l=e.getContext("2d");null==l||l.drawImage(o,0,0,e.width,e.height);try{e.toBlob(i,n,r)}catch(e){a(e)}},o.src=e})})(e.src)))).then(e=>e.map(e=>new File([e],"pasted-image.jpg",{type:n}))):Promise.reject(Error('Expected element to be contentEditable="true". Instead found a non contenteditable '.concat(e.tagName)))}(u.current,"image/jpeg"):[]).then(e=>{var n;f(e),d(!1),null==(n=p.current)||n.focus()})},[f,p]),x=(0,oN.useCallback)(e=>{h.current=[],e.preventDefault(),e.stopPropagation();let n=e.nativeEvent.dataTransfer;i&&n&&(function(e){let n=Array.from(e.files||[]),r=Array.from(e.items||[]);return n&&n.length>0?Promise.resolve(n):CH(r).then(lI())})(n).then(e=>{e&&f(e)}),null==o||o()},[f,i,o]),v=(0,oN.useCallback)(e=>{i&&(e.preventDefault(),e.stopPropagation())},[i]),y=(0,oN.useCallback)(e=>{e.stopPropagation(),a&&p.current===e.currentTarget&&(h.current=[...new Set(h.current),e.currentTarget],a(Array.from(e.dataTransfer.items).map(e=>({type:e.type,kind:e.kind}))))},[a,p]),b=(0,oN.useCallback)(e=>{e.stopPropagation();let n=h.current.indexOf(e.currentTarget);n>-1&&h.current.splice(n,1),0===h.current.length&&(null==o||o())},[o]),j=oN.useRef(!1);return oN.useEffect(()=>{var e;!j.current&&c&&u.current?(u.current.focus(),function(e){let n=document.createRange();n.selectNodeContents(e);let r=window.getSelection();null==r||r.removeAllRanges(),null==r||r.addRange(n)}(u.current)):j.current&&!c&&(null==(e=u.current)||e.focus()),j.current=c},[c]),(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(e,{...s,ref:p,onKeyDown:l?void 0:m,onDragOver:l?void 0:v,onDragEnter:l?void 0:y,onDragLeave:l?void 0:b,onDrop:l?void 0:x}),!l&&c&&(0,oZ.jsx)("div",{contentEditable:!0,onPaste:g,ref:u,style:C$})]})})}function CY(e){return"inset 0 0 0 ".concat(e.width,"px ").concat(e.color)}function CX(e){let{base:n,border:r,focusRing:i}=e,a=i.offset+i.width,o=0-i.offset,l=n?n.bg:"var(--card-bg-color)";return[o>0&&"inset 0 0 0 ".concat(o,"px var(--card-focus-ring-color)"),r&&CY(r),o<0&&"0 0 0 ".concat(0-o,"px ").concat(l),a>0&&"0 0 0 ".concat(a,"px var(--card-focus-ring-color)")].filter(Boolean).join(",")}var CG=Object.freeze,CJ=Object.defineProperty,CQ=(e,n)=>CG(CJ(e,"raw",{value:CG(n||e.slice())}));function C0(e){return(0,oV.ZP)(e)(e=>{let{$border:n,$radius:r}=e,{card:i,color:a,radius:o}=(0,oL.aQ)(e.theme),l={width:n?1:0,color:"var(--card-border-color)"};
1return(0,oV.iv)(nD||(nD=CQ(["\n        --card-focus-box-shadow: ",";\n\n        border-radius: ",";\n        outline: none;\n        box-shadow: var(--card-focus-box-shadow);\n\n        &:focus {\n          --card-focus-box-shadow: ",";\n        }\n      "])),CY(l),(0,oK.hO)(o[null!=r?r:1]),CX({border:l,base:a,focusRing:{...i.focusRing,offset:0}}))})}let C1=C0(CW(oK.Zb));var C2=Object.freeze,C3=Object.defineProperty,C4=(e,n)=>C2(C3(e,"raw",{value:C2(n||e.slice())}));let C5=(0,oV.ZP)(oK.Zb)(nq||(nq=C4(["\n  min-height: 82px;\n  box-sizing: border-box;\n"]))),C8=(0,oV.ZP)(oK.kC)(nZ||(nZ=C4(["\n  text-overflow: ellipsis;\n  overflow: hidden;\n  overflow: clip;\n"]))),C6=(0,oV.ZP)(oK.Kq)(nN||(nN=C4(["\n  position: relative;\n  width: 60%;\n"]))),C9=(0,oV.ZP)(oK.EK)(nL||(nL=C4(["\n  position: relative;\n  width: 100%;\n\n  code {\n    overflow: hidden;\n    overflow: clip;\n    text-overflow: ellipsis;\n    position: relative;\n    max-width: 200px;\n  }\n"]))),C7=e=>new Date().getTime()-new Date(e).getTime();function _e(e){let{uploadState:n,onCancel:r,onStale:i,height:a}=e,o=n.file.name;(0,oN.useEffect)(()=>{C7(n.updatedAt)>12e4&&(null==i||i())},[n.updatedAt,i]);let{t:l}=dV();return(0,oZ.jsx)(C5,{tone:"primary",padding:4,border:!0,style:{height:"".concat(a,"px")},children:(0,oZ.jsxs)(C8,{align:"center",justify:"space-between",height:"fill",direction:"row",gap:2,children:[(0,oZ.jsxs)(C6,{children:[(0,oZ.jsx)(oK.kC,{justify:"center",gap:[3,3,2,2],direction:["column","column","row"],children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(oK.gF,{space:2,children:(0,oZ.jsx)(uz,{t:l,i18nKey:"input.files.common.upload-progress",components:{FileName:()=>(0,oZ.jsx)(C9,{size:1,children:o||"…"})}})})})}),(0,oZ.jsx)(oK.Zb,{border:!0,marginTop:3,radius:5,children:(0,oZ.jsx)(K_,{value:n.progress})})]}),r?(0,oZ.jsx)(lr.zx,{mode:"ghost",onClick:r,text:l("input.files.common.cancel-upload"),tone:"critical"}):null]})})}function _t(e,n){var r;let i=e.split(","),a=null==(r=i[0].match(/:(.*?);/))?void 0:r[1],o=atob(i[1]),l=o.length,s=new Uint8Array(l);for(;l--;)s[l]=o.charCodeAt(l);return new File([s],n,{type:a})}function _n(e){var n,r;let{assetFromSource:i,onChange:a,type:o,resolveUploader:l,uploadWith:s,isImage:c}=e;if(!i)throw Error("No asset given");if(!Array.isArray(i)||0===i.length)throw Error("Returned value must be an array with at least one item (asset)");let d=i[0],u=d.assetDocumentProps,p=null==u?void 0:u.originalFilename,h=null==u?void 0:u.label,f=null==u?void 0:u.title,m=null==u?void 0:u.description,g=null==u?void 0:u.creditLine,x=null==u?void 0:u.source,v=c?[fM(["hotspot"]),fM(["crop"])]:[];switch(d.kind){case"assetDocumentId":a([fA({_type:o.name}),...v,fz({_type:"reference",_ref:d.value},["asset"])]);break;case"file":{let e=l(o,d.value);e&&s(e,d.value,{label:h,title:f,description:m,creditLine:g,source:x});break}case"base64":(n=d.value,new Promise((e,r)=>{let i=n.toString(),a=i.substring(11,i.indexOf(";base64"));if(!a&&!p){r(Error("Could not find mime type for image"));return}e(_t(n,p||"".concat((0,sN.Z)(),".").concat(a)))})).then(e=>{let n=l(o,e);n&&s(n,e,{label:h,title:f,description:m,creditLine:g,source:x})});break;case"url":(r=d.value,new Promise((e,n)=>{let i=new XMLHttpRequest;i.onload=()=>{let r=new FileReader;r.onloadend=()=>{var i;let a=null==(i=r.result)?void 0:i.toString(),o=null==a?void 0:a.substring(11,a.indexOf(";base64"));if(!o&&!p){n(Error("Could not find mime type for image"));return}e(_t(r.result,p||"".concat((0,sN.Z)(),".").concat(o)))},r.readAsDataURL(i.response)},i.onerror=e=>{n(e)},i.open("GET",r),i.responseType="blob",i.send()})).then(e=>{let n=l(o,e);n&&s(n,e,{label:h,title:f,description:m,creditLine:g,source:x})});break;default:throw Error("Invalid value returned from asset source plugin")}}var _r=Object.freeze,_i=Object.defineProperty;let _a=(0,oV.ZP)(lr.sN)(nV||(nV=_r(_i(R=["\n  position: relative;\n\n  & input {\n    overflow: hidden;\n    overflow: clip;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    position: absolute;\n    min-width: 0;\n    display: block;\n    appearance: none;\n    padding: 0;\n    margin: 0;\n    border: 0;\n    opacity: 0;\n  }\n"],"raw",{value:_r(R.slice())})))),_o=oN.forwardRef(function(e,n){let{icon:r,id:i,accept:a,capture:o,multiple:l,onSelect:s,text:c,disabled:d,...u}=e,p="".concat(i||"","-").concat((0,oN.useId)()),h=oN.useCallback(e=>{s&&e.target.files&&s(Array.from(e.target.files))},[s]),f=(0,oN.useCallback)(e=>(0,oZ.jsxs)("div",{children:[e,(0,oZ.jsx)("input",{"data-testid":"file-menuitem-input",accept:a,capture:o,id:p,multiple:l,onCh
1ange:h,type:"file",value:"",disabled:d})]}),[a,o,d,h,p,l]);return(0,oZ.jsx)(_a,{...u,htmlFor:p,disabled:d,ref:n,icon:r,text:c,renderMenuItem:f})});function _l(e){let{onUpload:n,onReset:r,readOnly:i,accept:a,directUploads:o,browse:l,downloadUrl:s,copyUrl:c}=e,{push:d}=(0,oK.pm)(),{t:u}=dV(),p=(0,oN.useCallback)(()=>{navigator.clipboard.writeText(c||""),d({closable:!0,status:"success",title:u("inputs.files.common.actions-menu.notification.url-copied")})},[c,d,u]);return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(_o,{icon:lp.rG2,onSelect:n,accept:a,text:u("inputs.files.common.actions-menu.upload.label"),"data-testid":"file-input-upload-button",disabled:i||!o}),l,(s||c)&&(0,oZ.jsx)(oK.R,{}),s&&(0,oZ.jsx)(lr.sN,{as:"a",icon:lp._8t,text:u("inputs.files.common.actions-menu.download.label"),href:s}),c&&(0,oZ.jsx)(lr.sN,{icon:lp.TIy,text:u("inputs.files.common.actions-menu.copy-url.label"),onClick:p}),(0,oZ.jsx)(oK.R,{}),(0,oZ.jsx)(lr.sN,{tone:"critical",icon:lp.X5P,text:u("inputs.files.common.actions-menu.clear-field.label"),onClick:r,disabled:i,"data-testid":"file-input-clear"})]})}var _s=Object.freeze,_c=Object.defineProperty;let _d=(0,oV.ZP)(oK.kC)(nK||(nK=_s(_c(F=["\n  pointer-events: none;\n"],"raw",{value:_s(F.slice())}))));function _u(e){let{hoveringFiles:n,type:r,readOnly:i,acceptedFiles:a,rejectedFilesCount:o,directUploads:l}=e,s="file"===r,{t:c}=dV(),d=(0,oN.useMemo)(()=>i?(0,oZ.jsx)(lp.CPA,{}):n&&o>0||!l?(0,oZ.jsx)(lp.vaB,{}):s?(0,oZ.jsx)(lp.bg6,{}):(0,oZ.jsx)(lp.XBm,{}),[l,n,s,i,o]),u=(0,oN.useMemo)(()=>{if(!l)return c("inputs.files.common.placeholder.upload-not-supported");if(i)return c("inputs.files.common.placeholder.read-only");if(n&&l&&!i){if(a.length>0)return c("inputs.files.common.placeholder.drop-to-upload",{context:r});if(o>0)return c("inputs.files.common.placeholder.cannot-upload-some-files",{count:o})}return c("inputs.files.common.placeholder.drag-or-paste-to-upload",{context:r})},[a.length,l,n,i,o,c,r]);return(0,oZ.jsxs)(_d,{align:"center",gap:3,justify:"center",paddingLeft:1,children:[(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:d}),(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:u})]})}var _p=Object.freeze,_h=Object.defineProperty,_f=(e,n)=>_p(_h(e,"raw",{value:_p(n||e.slice())}));let _m=(0,oV.ZP)(lr.zx).attrs({forwardedAs:"label"})(e=>{let{theme:n}=e,{focusRing:r}=n.sanity,i=n.sanity.color.base;return(0,oV.iv)(nB||(nB=_f(["\n      &:not([data-disabled='true']) {\n        &:focus-within {\n          box-shadow: ",";\n        }\n      }\n\n      // The underlying file input is rendered as children within a Sanity UI <Button> component.\n      // The below visibly hides it by targeting the input's parent <span> element, which is\n      // added by the <Button>
1 component.\n      // TODO: refactor, avoid nth-child selector usage\n      & > span:nth-child(2) {\n        overflow: hidden;\n        overflow: clip;\n        top: 0;\n        left: 0;\n        width: 100%;\n        height: 100%;\n        position: absolute;\n        min-width: 0;\n        display: block;\n        appearance: none;\n        padding: 0;\n        margin: 0;\n        border: 0;\n        opacity: 0;\n      }\n    "])),CX({base:i,border:{width:1,color:"var(--card-border-color)"},focusRing:r}))}),_g=oN.forwardRef(function(e,n){let{icon:r,id:i,accept:a,capture:o,multiple:l,onSelect:s,text:c,disabled:d,...u}=e,p="".concat(i||"","-").concat((0,oN.useId)()),h=oN.useCallback(e=>{s&&e.target.files&&s(Array.from(e.target.files))},[s]);return(0,oZ.jsx)(_m,{...u,icon:r,text:c,htmlFor:p,disabled:d,children:(0,oZ.jsx)("input",{"data-testid":"file-button-input",accept:a,capture:o,id:p,multiple:l,onChange:h,ref:n,type:"file",value:"",disabled:d})})}),_x=oN.memo(function(e){let{accept:n,acceptedFiles:r,browse:i,directUploads:a,hoveringFiles:o,onUpload:l,readOnly:s,rejectedFilesCount:c,type:d}=e,[u,p]=(0,oN.useState)(null),h=(0,oK.h4)(u),f=(null==h?void 0:h.border)&&h.border.width<440,{t:m}=dV();return(0,oZ.jsxs)(oK.kC,{align:f?void 0:"center",direction:f?"column":"row",gap:4,justify:"space-between",paddingY:f?1:void 0,ref:p,children:[(0,oZ.jsx)(oK.kC,{flex:1,children:(0,oZ.jsx)(_u,{acceptedFiles:r,directUploads:a,hoveringFiles:o,readOnly:s,rejectedFilesCount:c,type:d})}),(0,oZ.jsxs)(oK.kC,{align:"center",gap:1,justify:"center",wrap:"wrap",children:[(0,oZ.jsx)(_g,{accept:n,"data-testid":"file-input-upload-button",disabled:s||!a,icon:lp.rG2,mode:"bleed",onSelect:l,text:m("input.files.common.upload-placeholder.file-input-button.text")}),i]})]})});function _v(e){let{onClearStale:n}=e,{t:r}=dV();return(0,oZ.jsxs)(oK.Zb,{tone:"caution",padding:4,border:!0,radius:2,children:[(0,oZ.jsxs)(oK.kC,{gap:4,marginBottom:4,children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(lp.foC,{})})}),(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:r("inputs.files.common.stale-upload-warning.title")}),(0,oZ.jsx)(oK.xv,{size:1,children:r("inputs.files.common.stale-upload-warning.description",{staleThresholdMinutes:Math.ceil(2)})})]})]}),(0,oZ.jsx)(lr.zx,{icon:lp.X5P,mode:"ghost",onClick:n,text:r("inputs.files.common.stale-upload-warning.clear"),width:"fill"})]})}var _y=Object.freeze,_b=Object.defineProperty,_j=(e,n)=>_y(_b(e,"raw",{value:_y(n||e.slice())}));let _w=(0,oV.ZP)(oK.Zb)(nU||(nU=_j(["\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n"]))),_k=(0,oV.ZP)(oK.kC)(nH||(nH=_j(["\n  height: 100%;\n"])));function _C(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(0===e)return"0 Bytes";let r=Math.floor(Math.log(e)/Math.log(1024));return"".concat(parseFloat((e/Math.pow(1024,r)).toFixed(n<0?0:n))," ").concat(["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][r])}function __(e){let{originalFilename:n,size:r,children:i,muted:a,disabled:o,onClick:l,isMenuOpen:s,onMenuOpen:c,setMenuButtonElement:d}=e,[u,p]=(0,oN.useState)(null),[h,f]=(0,oN.useState)(null),m=(0,oN.useCallback)(()=>c(!0),[c]);(0,oK.qh)((0,oN.useCallback)(e=>{s&&("Escape"===e.key||"Tab"===e.key)&&(c(!1),null==h||h.focus())},[s,c,h])),(0,oK.O8)((0,oN.useCallback)(e=>{(null==h?void 0:h.contains(e.target))||c(!1)},[h,c]),[u]);let g=(0,oN.useCallback)(e=>{d(e),f(e)},[d]);(0,oN.useEffect)(()=>{s&&(null==u||u.focus())},[s,u]);let{t:x}=dV();return(0,oZ.jsxs)(oK.kC,{wrap:"nowrap",justify:"space-between",align:"center",children:[(0,oZ.jsx)(oK.Zb,{as:a||o?void 0:"button",radius:2,padding:2,tone:"inherit",onClick:l,flex:1,children:(0,oZ.jsxs)(oK.kC,{wrap:"nowrap",align:"center",children:[(0,oZ.jsx)(oK.Zb,{padding:3,tone:"transparent",shadow:1,radius:1,children:(0,oZ.jsx)(oK.xv,{muted:a,children:(0,oZ.jsx)(lp.bg6,{})})}),(0,oZ.jsxs)(oK.Kq,{flex:1,space:2,marginLeft:3,children:[(0,oZ.jsx)(oK.xv,{size:1,textOverflow:"ellipsis",muted:a,"data-testid":"file-name",weight:"medium",children:n}),(0,oZ.jsx)(oK.xv,{size:1,muted:!0,"data-testid":"file-size",children:_C(r)})]})]})}),(0,oZ.jsx)(oK.xu,{padding:2,children:(0,oZ.jsx)(oK.kC,{justify:"center",children:(0,oZ.jsx)(lr.J2,{content:(0,oZ.jsx)(oK.v2,{ref:p,children:i}),id:"file-actions-menu",portal:!0,open:s,constrainSize:!0,children:(0,oZ.jsx)(bA,{"aria-label":x("inputs.file.actions-menu.file-options.aria-label"),"data-testid":"options-menu-button",onClick:m,paddingY:3,ref:g})})})})]})}function _T(){return(0,oZ.jsxs)(oK.kC,{align:"center",justify:"flex-start",padding:2,children:[(0,oZ.jsx)(oK.Od,{padding:3,radius:1,animated:!0}),(0,oZ.jsxs)(oK.Kq,{flex:1,space:2,marginLeft:3,children:[(0,oZ.jsx)(oK.Qr,{style:{width:"100%"},radius:1,animated:!0}),(0,oZ.jsx)(oK.Qr,{style:{width:"100%"},radius:1,animated:!0})]})]})}function _S(e){let{onClearValue:n}=e,{t:r}=dV();return(0,oZ.jsxs)(oK.Zb,{tone:"caution",padding:4,border:!0,radius:2,children:[(0,oZ.jsxs)(oK.kC,{gap:4,marginBottom:4,children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(lp.foC,{})})}),(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:r("inputs.file.invali
1d-file-warning.title")}),(0,oZ.jsx)(oK.xv,{size:1,children:r("inputs.file.invalid-file-warning.description")})]})]}),(0,oZ.jsx)(lr.zx,{icon:lp.X5P,mode:"ghost",onClick:n,text:r("inputs.file.invalid-file-warning.reset-button.text"),width:"fill"})]})}function _E(e){let{children:n}=e;return n}let _P=["asset"];class _O extends oN.PureComponent{constructor(e){var n;super(e),n=this,this.uploadSubscription=null,this.browseButtonElement=null,this.state={isUploading:!1,selectedAssetSource:null,hoveringFiles:[],isStale:!1,isMenuOpen:!1},this.toast=null,this.handleRemoveButtonClick=()=>{let{path:e,value:n}=this.props,r=e.slice(-1)[0],i=Object.keys(n||{}),a=0===i.filter(e=>!["_type","_key","_upload","asset"].includes(e)).length,o=["asset"].concat(i.filter(e=>["_upload"].includes(e))).map(e=>fM([e]));this.props.onChange(fR.from(a&&!("string"!=typeof r)?fM():o))},this.handleCancelUpload=()=>{this.cancelUpload()},this.handleClearUploadState=()=>{this.setState({isStale:!1}),this.clearUploadStatus()},this.handleStaleUpload=()=>{this.setState({isStale:!0})},this.handleClearField=()=>{this.props.onChange(fM(["asset"]))},this.handleSelectFiles=e=>{let{directUploads:n,readOnly:r}=this.props,{hoveringFiles:i}=this.state;n&&!r?this.uploadFirstAccepted(e):i.length>0&&this.handleFilesOut()},this.handleSelectFileFromAssetSource=e=>{this.setState({selectedAssetSource:e})},this.handleAssetSourceClosed=()=>{var e;this.setState({selectedAssetSource:null}),null==(e=this.browseButtonElement)||e.focus()},this.setBrowseButtonElement=e=>{this.browseButtonElement=e},this.uploadWith=function(e,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{schemaType:a,onChange:o,client:l,t:s}=n.props,{source:c}=i,d={metadata:lS()(a,"options.metadata"),storeOriginalFilename:lS()(a,"options.storeOriginalFilename"),source:c};n.cancelUpload(),n.setState({isUploading:!0}),o(fR.from([fA({_type:a.name})])),n.uploadSubscription=e.upload(l,r,a,d).subscribe({next:e=>{e.patches&&o(fR.from(e.patches))},error:e=>{var r;console.error(e),null==(r=n.toast)||r.push({status:"error",description:s("inputs.file.upload-failed.description"),title:s("inputs.file.upload-failed.title")}),n.clearUploadStatus()},complete:()=>{n.setState({isUploading:!1})}})},this.handleSelectAssetFromSource=e=>{let{onChange:n,schemaType:r,resolveUploader:i}=this.props;_n({assetFromSource:e,onChange:n,type:r,resolveUploader:i,uploadWith:this.uploadWith}),this.setState({selectedAssetSource:null})},this.handleFileTargetFocus=e=>{var n;e.currentTarget===e.target&&e.currentTarget===(null==(n=this.props.elementProps.ref)?void 0:n.current)&&this.props.elementProps.onFocus(e)},this.handleFilesOver=e=>{this.setState({hoveringFiles:e})},this.handleFilesOut=()=>{this.setState({hoveringFiles:[]})},this.handleUpload=e=>{let{file:n,uploader:r}=e;this.uploadWith(r,n)},this.setToast=e=>{this.toast=e},this._assetFieldPath=e.path.concat(_P)}clearUploadStatus(){var e;(null==(e=this.props.value)?void 0:e._upload)&&this.props.onChange(fR.from([fM(["_upload"])]))}cancelUpload(){this.uploadSubscription&&(this.uploadSubscription.unsubscribe(),this.clearUploadStatus())}uploadFirstAccepted(e){let{schemaType:n}=this.props,r=e.map(e=>{var r,i;return{file:e,uploader:null==(i=(r=this.props).resolveUploader)?void 0:i.call(r,n,e)}}).find(e=>e.uploader);r&&this.uploadWith(r.uploader,r.file),this.setState({isMenuOpen:!1})}renderUploadState(e){let{isUploading:n}=this.state;return(0,oZ.jsx)(_e,{uploadState:e,onCancel:n?this.handleCancelUpload:void 0,onStale:this.handleStaleUpload})}renderAssetSource(){let{selectedAssetSource:e}=this.state,{value:n,schemaType:r,observeAsset:i,t:a}=this.props;if(!e)return null;let o=lS()(r,"options.accept",""),l=e.component;return n&&n.asset?(0,oZ.jsx)(CB,{observeAsset:i,reference:n.asset,waitPlaceholder:(0,oZ.jsx)(_T,{}),children:e=>(0,oZ.jsx)(l,{selectedAssets:[e],selectionType:"single",assetType:"file",accept:o,dialogHeaderTitle:a("inputs.file.dialog.title"),onClose:this.handleAssetSourceClosed,onSelect:this.handleSelectAssetFromSource})}):(0,oZ.jsx)(l,{selectedAssets:[],selectionType:"single",assetType:"file",accept:o,dialogHeaderTitle:a("inputs.file.dialog.title"),onClose:this.handleAssetSourceClosed,onSelect:this.handleSelectAssetFromSource})}renderAsset(){let{value:e,changed:n,readOnly:r,elementProps:i}=this.props,{hoveringFiles:a,isStale:o}=this.state,l=!!((null==e?void 0:e._upload)||(null==e?void 0:e.asset));return!e||void 0===e.asset||(null==e?void 0:e._upload)||(0,sf.OT)(e)?s=>(0,oZ.jsxs)(oZ.Fragment,{children:[o&&(0,oZ.jsx)(oK.xu,{marginBottom:2,children:(0,oZ.jsx)(_v,{onClearStale:this.handleClearUploadState})}),(0,oZ.jsx)(dQ,{path:this._assetFieldPath,hasFocus:!!s.focused,isChanged:n,children:(null==e?void 0:e._upload)?this.renderUploadState(e._upload):(0,oZ.jsx)(C1,{...i,onFocus:this.handleFileTargetFocus,tabIndex:0,disabled:!!r,onFiles:this.handleSelectFiles,onFilesOver:this.handleFilesOver,onFilesOut:this.handleFilesOut,tone:this.getFileTone(),$border:l||a.length>0,style:{padding:1}
1,sizing:"border",radius:2,children:(0,oZ.jsxs)("div",{style:{position:"relative"},children:[!(null==e?void 0:e.asset)&&this.renderUploadPlaceholder(),(null==e?void 0:e.asset)&&a.length>0?this.renderAssetMenu(this.getFileTone()):null,!(null==e?void 0:e._upload)&&(null==e?void 0:e.asset)&&this.renderPreview()]})})})]}):()=>(0,oZ.jsx)(_S,{onClearValue:this.handleClearField})}renderPreview(){let{value:e,readOnly:n,assetSources:r,schemaType:i,directUploads:a,observeAsset:o,t:l}=this.props,{isMenuOpen:s}=this.state,c=null==e?void 0:e.asset;if(!c)return null;let d=lS()(i,"options.accept",""),u=r&&(null==r?void 0:r.length)===0?null:(0,oZ.jsx)(lr.sN,{icon:lp.W1M,text:l("inputs.file.browse-button.text"),onClick:()=>{this.setState({isMenuOpen:!1}),this.handleSelectFileFromAssetSource(r[0])},disabled:n,"data-testid":"file-input-browse-button"});return r.length>1&&(u=r.map(e=>(0,oZ.jsx)(lr.sN,{text:(e.i18nKey?l(e.i18nKey):e.title)||lf()(e.name),onClick:()=>{this.setState({isMenuOpen:!1}),this.handleSelectFileFromAssetSource(e)},icon:e.icon||lp.XBm,disabled:n,"data-testid":"file-input-browse-button-".concat(e.name)},e.name))),(0,oZ.jsx)(CB,{reference:c,observeAsset:o,waitPlaceholder:(0,oZ.jsx)(_T,{}),children:r=>{let i,o,{originalFilename:l,extension:c,url:p,size:h}=r;return(0,sf.OT)(e)&&(o="".concat(p,"?dl"),i=p),(0,oZ.jsx)(__,{size:h,originalFilename:l||"download.".concat(c),muted:!n,onMenuOpen:e=>this.setState({isMenuOpen:e}),isMenuOpen:s,setMenuButtonElement:this.setBrowseButtonElement,children:(0,oZ.jsx)(_l,{onUpload:this.handleSelectFiles,browse:u,onReset:this.handleRemoveButtonClick,downloadUrl:o,copyUrl:i,readOnly:n,accept:d,directUploads:a})})}})}renderAssetMenu(e){let{schemaType:n,readOnly:r,directUploads:i,resolveUploader:a}=this.props,{hoveringFiles:o}=this.state,l=o.filter(e=>null==a?void 0:a(n,e)),s=o.length-l.length;return(0,oZ.jsx)(_w,{radius:2,tone:e,children:(0,oZ.jsx)(_k,{align:"center",justify:"center",gap:2,flex:1,children:(0,oZ.jsx)(_u,{readOnly:r,hoveringFiles:o,acceptedFiles:l,rejectedFilesCount:s,directUploads:i,type:"file"})})})}renderBrowser(){let{assetSources:e,readOnly:n,directUploads:r,id:i,t:a}=this.props;return 0===e.length?null:e.length>1&&!n&&r?(0,oZ.jsx)(lr.j2,{id:"".concat(i,"_assetFileButton"),ref:this.setBrowseButtonElement,button:(0,oZ.jsx)(lr.zx,{mode:"bleed",text:a("inputs.file.multi-browse-button.text"),"data-testid":"file-input-multi-browse-button",icon:lp.W1M}),"data-testid":"input-select-button",menu:(0,oZ.jsx)(oK.v2,{children:e.map(e=>(0,oZ.jsx)(lr.sN,{text:e.title,onClick:()=>{this.setState({isMenuOpen:!1}),this.handleSelectFileFromAssetSource(e)},icon:e.icon||lp.XBm,disabled:n,"data-testid":"file-input-browse-button-".concat(e.name)},e.name))})}):(0,oZ.jsx)(lr.zx,{text:a("inputs.file.browse-button.text"),icon:lp.W1M,mode:"bleed",onClick:()=>{this.setState({isMenuOpen:!1}),this.handleSelectFileFromAssetSource(e[0])},"data-testid":"file-input-browse-button",disabled:n,ref:this.setBrowseButtonElement})}renderUploadPlaceholder(){let{readOnly:e,schemaType:n,directUploads:r,resolveUploader:i}=this.props,{hoveringFiles:a}=this.state,o=a.filter(e=>null==i?void 0:i(n,e)),l=a.length-o.length,s=lS()(n,"options.accept","");return(0,oZ.jsx)(oZ.Fragment,{children:(0,oZ.jsx)(oK.Zb,{tone:e?"transparent":"inherit",border:!0,paddingX:3,paddingY:2,radius:2,style:0===a.length?{borderStyle:"dashed"}:{borderStyle:"dashed",borderColor:"transparent"},children:(0,oZ.jsx)(_x,{browse:this.renderBrowser(),onUpload:this.handleSelectFiles,readOnly:e,hoveringFiles:a,acceptedFiles:o,rejectedFilesCount:l,type:"file",accept:s,directUploads:r})})})}getFileTone(){let{directUploads:e,schemaType:n,value:r,readOnly:i,resolveUploader:a}=this.props,{hoveringFiles:o}=this.state,l=o.filter(e=>null==a?void 0:a(n,e)),s=o.length-l.length;return o.length>0&&(s>0||!e)?"critical":(null==r?void 0:r._upload)||i||!(o.length>0)?(null==r?void 0:r._upload)&&(null==r?void 0:r.asset)&&i?"transparent":"default":"primary"}render(){let{members:e,renderAnnotation:n,renderBlock:r,renderInlineBlock:i,renderItem:a,renderInput:o,renderField:l,renderPreview:s,t:c}=this.props,{selectedAssetSource:d}=this.state;return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(Bt,{ref:this.setToast}),e.map(e=>"field"===e.kind&&("crop"===e.name||"hotspot"===e.name)?null:"field"===e.kind?(0,oZ.jsx)(wp,{member:e,renderAnnotation:n,renderInlineBlock:i,renderBlock:r,renderInput:"asset"===e.name?this.renderAsset():o,renderField:"asset"===e.name?_E:l,renderItem:a,renderPreview:s},e.key):"fieldSet"===e.kind?(0,oZ.jsx)(wS,{member:e,renderAnnotation:n,renderBlock:r,renderField:l,renderInlineBlock:i,renderInput:o,renderItem:a,renderPreview:s},e.key):"error"===e.kind?(0,oZ.jsx)(wT,{member:e},e.key):(0,oZ.jsx)(oZ.Fragment,{children:c("inputs.file.error.unknown-member-kind",{kind:e.kind})})),d&&this.renderAssetSource()]})}}var _A=Object.freeze,_I=Object.defineProperty;let _z=(0,oV.ZP)(oK.xu)(n$||(n$=_A(_I(D=["\n  position: relative;\n  padding-bottom: calc("," * 100%);\n\n  & > div {\n    position: absolute;\n    top: ","px;\n    left: ","px;\n    right: ","px;\n    bottom: ","px;\n  }\n"],"raw",{value:_A(D.slice())}))),e=>{let{ratio:n=1.5}=e;return 1/n},e=>{let{padding:n=0}=e;return n},e=>{let{padding:n=0}=e;return n},e=>{let{padding:n=0}=e;return n},e=>{let{padding:n=0}=e;return n});function _M(e){let{src:n,children:r}=e,[i,a]=(0,oN.useState)(!0),[o,l]=(0,oN.useState)(null),[s,c]=(0,oN.useState)(null);return(0,oN.useEffect)(()=>
1{l(null),c(null),a(!0);let e=new Image;e.onload=()=>{l(e),c(null),a(!1)},e.onerror=()=>{c(Error("Could not load image from ".concat(JSON.stringify(n)))),a(!1)},e.referrerPolicy="strict-origin-when-cross-origin",e.src=n},[n]),r({image:o,error:s,isLoading:i})}let _R=["","webkit","moz","ms","o"].map(e=>"".concat(e,"backingStoreRatio")),_F=-1;function _D(e,n){let r={x:n.center.x,y:n.center.y},i=n.width/2,a=n.height/2;if(i<=0||a<=0)return!1;let o={x:e.x-r.x,y:e.y-r.y};return Math.pow(o.x,2)/Math.pow(i,2)+Math.pow(o.y,2)/Math.pow(a,2)<=1}function _q(e,n){let{x:r,y:i}=e;return Math.pow(r-n.x,2)+Math.pow(i-n.y,2)<Math.pow(n.radius,2)}function _Z(e,n){return e.x>=n.left&&e.x<=n.left+n.width&&e.y>=n.top&&e.y<=n.top+n.height}function _N(e,n){return{x:n.center.x-n.width/2*Math.cos(e),y:n.center.y-n.height/2*Math.sin(e)}}class _L{constructor(e,n){this.x=e,this.y=n}}class _V{constructor(e,n,r){this.y=e,this._left=n,this._right=r}get right(){return new _L(this._right,this.y)}get left(){return new _L(this._left,this.y)}get length(){return this._right-this._left}}class _K{constructor(e){this.rect=e}get top(){return new _V(this.rect.top,this.rect.left,this.rect.right)}get bottom(){return new _V(this.rect.bottom,this.rect.left,this.rect.right)}}class _B{static fromEdges(e){let{left:n,right:r,top:i,bottom:a}=e;return new _B(n,i,1-n-r,1-i-a)}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.left=e,this.top=n,this.width=r,this.height=i}setTopLeft(e,n){return new _B(e,n,this.width||0,this.height||0)}setSize(e,n){return new _B(this.left||0,this.top||0,e,n)}setCenter(e,n){let r=this.width||0,i=this.height||0;return new _B(e-r/2,n-i/2,r||0,i||0)}get center(){return new _L(this.left+this.width/2,this.top+this.height/2)}get corners(){return new _K(this)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}multiply(e){return new _B((this.left||0)+this.width*e.left,(this.top||0)+this.height*e.top,this.width*e.width,this.height*e.height)}grow(e){return new _B(this.left-e,this.top-e,this.width+2*e,this.height+2*e)}shrink(e){return this.grow(-e)}cropRelative(e){let n=this.top+e.top*this.height,r=this.left+e.left*this.width,i=this.height*e.height;return new _B(r,n,this.width*e.width,i)}clamp(e){let{left:n,top:r,width:i,height:a}=this;return e.width<i&&(i=e.width,n=e.left),e.height<a&&(a=e.height,r=e.top),n+i>e.left+e.width&&(n=e.right-i),r+a>e.top+e.height&&(r=e.bottom-a),new _B(Math.max(n,e.left),Math.max(r,e.top),i,a)}}let _U=cL()("sanity-imagetool");function _H(e,n,r){return{x:e-r.left,y:n-r.top}}function _$(e){return{x:e.clientX,y:e.clientY}}var _W=Object.freeze,_Y=Object.defineProperty,_X=(e,n)=>_W(_Y(e,"raw",{value:_W(n||e.slice())}));let _G=class extends oN.PureComponent{constructor(){super(...arguments),this.domNode=null,this.currentPos=null,this.isDragging=!1,this.handleDragStart=e=>{let{onDragStart:n,readOnly:r}=this.props;if(r||!this.domNode)return;if(this.isDragging){_U("Start cancelled, already a drag in progress");return}this.isDragging=!0;let i=_$(e);_U("Drag started %o",i),n(_H(i.x,i.y,this.domNode.getBoundingClientRect())),this.currentPos=i},this.handleDrag=e=>{var n;if(!this.isDragging||this.props.readOnly||!this.currentPos)return;let{onDrag:r}=this.props,i=_$(e),a=(n=this.currentPos,{x:i.x-n.x,y:i.y-n.y});r(a),_U("moving by %o",a),this.currentPos=i},this.handleDragEnd=e=>{let{onDragEnd:n,readOnly:r}=this.props;if(!this.isDragging||r||!this.domNode)return;let i=_$(e);n(_H(i.x,i.y,this.domNode.getBoundingClientRect())),this.isDragging=!1,this.currentPos=null,_U("Done moving %o",i)},this.handleDragCancel=()=>{if(!this.isDragging||this.props.readOnly||!this.currentPos||!this.domNode)return;let{onDragEnd:e}=this.props;this.isDragging=!1,e(_H(this.currentPos.x,this.currentPos.y,this.domNode.getBoundingClientRect())),this.currentPos=null},this.setDomNode=e=>{this.domNode=e}}componentDidMount(){document.body.addEventListener("pointermove",this.handleDrag),document.body.addEventListener("pointerup",this.handleDragEnd),document.body.addEventListener("pointerleave",this.handleDragCancel),document.body.addEventListener("pointercancel",this.handleDragCancel)}componentWillUnmount(){document.body.removeEventListener("pointermove",this.handleDrag),document.body.removeEventListener("pointerup",this.handleDragEnd),document.body.removeEventListener("pointerleave",this.handleDragCancel),document.body.removeEventListener("pointercancel",this.handleDragCancel)}render(){let{readOnly:e,onDragStart:n,onDragEnd:r,onDrag:i,...a}=this.props;
1return(0,oZ.jsx)("canvas",{ref:this.setDomNode,onPointerDown:e?void 0:this.handleDragStart,onPointerMove:e?void 0:this.handleDrag,...a})}},_J=oV.ZP.div(nW||(nW=_X(["\n  width: 100%;\n  height: 100%;\n  position: relative;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n"]))),_Q=(0,oV.ZP)(_G)(nY||(nY=_X(["\n  display: block;\n  position: relative;\n  max-width: calc(100% - 0.5em); /* to prevent overlap with change bar */\n  max-height: calc(100% + 1em);\n  user-select: none;\n  // Enable only multi-finger panning and zooming within this element.\n  // This prevents single finger panning when manipulating drag handles,\n  // which can cause unwanted scrolling in the underlying document body.\n  touch-action: pinch-zoom;\n"]))),_0={x:.5,y:.5,height:1,width:1},_1={top:0,left:0,right:0,bottom:0};function _2(e,n){let{top:r,right:i,bottom:a,left:o}=e.crop||_1;return{value:{hotspot:e.hotspot,crop:{top:r+(n.top||0)>0?r:0,right:i+(n.right||0)>0?i:0,bottom:a+(n.bottom||0)>0?a:0,left:o+(n.left||0)>0?o:0}},delta:{top:r+(n.top||0)>0&&n.top||0,right:i+(n.right||0)>0&&n.right||0,bottom:a+(n.bottom||0)>0&&n.bottom||0,left:o+(n.left||0)>0&&n.left||0}}}let _3=lF()(()=>{let e=window.devicePixelRatio||1,n=document.createElement("canvas").getContext("2d");return e/(n&&(-1===_F&&(_F=_R.find(e=>e in n)),_F&&n[_F])||1)}),_4=["left","right","top","topLeft","topRight","bottom","bottomLeft","bottomRight"];class _5 extends oN.PureComponent{constructor(){super(...arguments),this.state={cropping:!1,cropMoving:!1,moving:!1,resizing:!1,pointerPosition:null},this.handleDragStart=e=>{let{x:n,y:r}=e,i={x:n*this.getScale(),y:r*this.getScale()},a=_D(i,this.getHotspotRect()),o=_q(i,this.getDragHandleCoords()),l=this.getActiveCropHandleFor(i),s=_Z(i,this.getCropRect());l?this.setState({cropping:l}):o?this.setState({resizing:!0}):a?this.setState({moving:!0}):s&&this.setState({cropMoving:!0})},this.handleDrag=e=>{this.state.cropping?this.emitCrop(this.state.cropping,e):this.state.cropMoving?this.emitCropMove(e):this.state.moving?this.emitMove(e):this.state.resizing&&this.emitResize(e)},this.handleDragEnd=()=>{let{onChange:e,onChangeEnd:n}=this.props;this.setState({moving:!1,resizing:!1,cropping:!1,cropMoving:!1});let{hotspot:r,crop:i}=this.getClampedValue(),a=function(e){let n=e.top>e.bottom,r=e.left>e.right;return{top:n?e.bottom:e.top,bottom:n?e.top:e.bottom,left:r?e.right:e.left,right:r?e.left:e.right}}(i),o={crop:{top:a.top,bottom:1-a.bottom,left:a.left,right:1-a.right},hotspot:{x:r.center.x,y:r.center.y,height:Math.abs(r.height),width:Math.abs(r.width)}};e(o),n&&n(o)},this.handlePointerOut=()=>{this.setState({pointerPosition:null})},this.handlePointerMove=e=>{let n=e.currentTarget.getBoundingClientRect();this.setState({pointerPosition:{x:(e.clientX-n.left)*this.getScale(),y:(e.clientY-n.top)*this.getScale()}})},this.setCanvas=e=>{this.canvas=e}}getHotspotRect(){let{value:e,image:n}=this.props,r=e.hotspot||_0,i=new _B().setSize(r.width,r.height).setCenter(r.x,r.y);return new _B().setSize(n.width,n.height).shrink(8*this.getScale()).multiply(i)}getCropRect(){let{value:e,image:n}=this.props;return new _B().setSize(n.width,n.height).shrink(8*this.getScale()).cropRelative(_B.fromEdges(e.crop||_1).clamp(new _B(0,0,1,1)))}getCropHandles(){let e=this.getCropRect(),n=12*this.getScale(),r=n/2,i=new _B(0,0,n,n);return{left:i.setTopLeft(e.left-r,e.center.y-r),right:i.setTopLeft(e.right-r,e.center.y-r),top:i.setTopLeft(e.center.x-r,e.top-r),topLeft:i.setTopLeft(e.left-r,e.top-r),topRight:i.setTopLeft(e.right-r,e.top-r),bottom:i.setTopLeft(e.center.x-r,e.bottom-r),bottomLeft:i.setTopLeft(e.left-r,e.bottom-r),bottomRight:i.setTopLeft(e.right-r,e.bottom-r)}}getActiveCropHandleFor(e){let{x:n,y:r}=e,i=this.getCropHandles();for(let e of _4)if(_Z({x:n,y:r},i[e]))return e;return!1}emitMove(e){let{image:n,value:r,onChange:i}=this.props,a=this.getScale();i(function(e,n){let r=e&&e.hotspot||_0;return{...e,hotspot:{...r,x:r.x+n.x,y:r.y+n.y}}}(r,{x:e.x*a/n.width,y:e.y*a/n.height}))}emitCropMove(e){let{image:n,onChange:r,value:i}=this.props,a=this.getScale(),o=e.x*a/n.width,l={left:o,right:-e.x*a/n.width,top:e.y*a/n.height,bottom:-e.y*a/n.height};!i||!i.crop||i.crop.top+l.top<0||i.crop.left+l.left<0||i.crop.right+l.right<0||i.crop.bottom+l.bottom<0||r(_8(i,l))}emitCrop(e,n){let{image:r,onChange:i,value:a}=this.props,o=this.getScale(),l=0,s=0,c=0,d=0;"left"==e||"topLeft"===e||"bottomLeft"===e?l=n.x*o/r.width:("right"==e||"topRight"===e||"bottomRight"===e)&&(s=-n.x*o/r.width),"top"==e||"topLeft"===e||"topRight"===e?c=n.y*o/r.height:("bottom"==e||"bottomLeft"===e||"bottomRight"===e)&&(d=-n.y*o/r.height);let u={left:l,right:s,top:c,bottom:d};i(_8(_2(a,u).value,_2(a,u).delta))}emitResize(e){let{image:n,onChange:r,value:i}=this.props,a=this.getScale(),o={x:e.x*a*2/n.width,y:e.y*a*2/n.height};r(function(e,n){let r=e&&e.hotspot||_0;return{...e,hotspot:{...r,height:r.height+n.height,width:r.width+n.width}}}(i,{height:o.y,width:o.x}))}
1getClampedValue(){let e=this.props.value,n=_B.fromEdges(e.crop||_1).clamp(new _B(0,0,1,1)),r=e.hotspot||_0,i=new _B(0,0,1,1).setSize(r.width,r.height).setCenter(r.x,r.y).clamp(n);return{crop:n,hotspot:i}}paintHotspot(e,n){let{image:r,readOnly:i}=this.props,a=new _B().setSize(r.width,r.height),{hotspot:o,crop:l}=this.getClampedValue(),s=this.getScale(),c=8*s;function d(n,i,a,o,l,s,c,d){e.save(),e.drawImage(r,n,i,a,o,l,s,c,d),e.restore()}e.save(),function(){let n=a.cropRelative(l),r=a.shrink(c).cropRelative(l);e.save(),d(n.left,n.top,n.width,n.height,r.left,r.top,r.width,r.height),e.globalAlpha=.5,e.fillStyle="black",e.fillRect(r.left,r.top,r.width,r.height),e.restore()}(),function(){e.save();let r=a.shrink(c).multiply(o),i=r.height/r.width;e.scale(1,i),e.beginPath(),e.globalAlpha=n,e.arc(r.center.x,r.center.y/i,Math.abs(r.width/2),0,2*Math.PI,!1),e.strokeStyle="white",e.lineWidth=1.5*s,e.stroke(),e.closePath(),e.restore()}(),e.clip(),function(){let e=a.multiply(o),n=a.shrink(c).multiply(o);d(e.left,e.top,e.width,e.height,n.left,n.top,n.width,n.height)}(),e.restore(),i||function(n){e.save();let r=10*s,i=_N(n,a.shrink(c).multiply(o));e.beginPath(),e.arc(i.x,i.y,r,0,2*Math.PI,!1),e.fillStyle="rgb(255,255,255)",e.fill(),e.closePath(),e.restore(),e.beginPath(),e.arc(i.x,i.y,r,0,2*Math.PI,!1),e.strokeStyle="rgb(0, 0, 0)",e.lineWidth=.5*s,e.stroke(),e.closePath()}(1.25*Math.PI)}getActualSize(){var e;let n=null==(e=this.canvas)?void 0:e.domNode;return n?{height:n.clientHeight,width:n.clientWidth}:{height:0,width:0}}getDragHandleCoords(){let e=_N(1.25*Math.PI,this.getHotspotRect());return{x:e.x,y:e.y,radius:8*this.getScale()}}debug(e){e.save();let{image:n}=this.props,r=this.getHotspotRect(),i=this.getScale(),a=8*i;function o(e){s(e,a,e,n.height-a)}function l(e){s(a,e,n.width-a,e)}function s(n,r,i,a){e.beginPath(),e.moveTo(n,r),e.lineTo(i,a),e.stroke(),e.closePath()}e.setLineDash&&e.setLineDash([2*i,2*i]),e.lineWidth=.5*i,e.strokeStyle="rgba(200, 200, 200, 0.5)",o(r.center.x),l(r.center.y),e.strokeStyle="rgba(150, 150, 150, 0.5)",l(r.top),l(r.bottom),o(r.left),o(r.right),e.restore()}
1paintBackground(e){let{image:n}=this.props,r=new _B().setSize(n.width,n.height).shrink(8*this.getScale());e.save(),e.fillStyle="white",e.clearRect(0,0,n.width,n.height),e.globalAlpha=.3,e.drawImage(n,r.left,r.top,r.width,r.height),e.restore()}paint(e){let{readOnly:n}=this.props;e.save();let r=_3();e.scale(r,r);let i=!n&&this.state.pointerPosition?.8:.2;this.paintBackground(e),this.paintHotspot(e,i),this.debug(e),this.paintCropBorder(e),n||this.highlightCropHandles(e,i),e.restore()}paintPointerPosition(e){if(!this.state.pointerPosition)return;let{x:n,y:r}=this.state.pointerPosition;e.beginPath(),e.arc(n,r,14*this.getScale(),0,2*Math.PI,!1),e.fillStyle="lightblue",e.fill(),e.restore()}paintCropBorder(e){let n=this.getCropRect();e.save(),e.beginPath(),e.fillStyle="rgba(66, 66, 66, 0.9)",e.lineWidth=1,e.rect(n.left,n.top,n.width,n.height),e.stroke(),e.closePath(),e.restore()}highlightCropHandles(e,n){e.save();let r=this.getCropHandles();_4.forEach(i=>{e.fillStyle=this.state.cropping===i?"rgba(202, 54, 53, ".concat(n,")"):"rgba(230, 230, 230, ".concat(n+.4,")");let{left:a,top:o,height:l,width:s}=r[i];e.fillRect(a,o,s,l),e.beginPath(),e.fillStyle="rgba(66, 66, 66, ".concat(n,")"),e.rect(a,o,s,l),e.closePath(),e.stroke()}),e.restore()}getScale(){let e=this.getActualSize();return this.props.image.width/e.width}getCursor(){let{pointerPosition:e}=this.state,{readOnly:n}=this.props;if(!e||n)return"auto";let r=this.state.cropping||this.getActiveCropHandleFor(e);if(r)return function(e){switch(e){case"left":case"right":return"col-resize";case"top":case"bottom":return"row-resize";case"topRight":case"bottomLeft":return"nesw-resize";case"topLeft":case"bottomRight":return"nwse-resize";default:return null}}(r)||"auto";let i=_q(e,this.getDragHandleCoords());if(this.state.resizing||i)return"move";
1if(this.state.moving||this.state.cropMoving)return"url(".concat("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAABdSURBVEjH7ZA7DsAwCEMN6v2vTCdESpLKQRl5gxfzMQDNRQyWlEK83QAIRh3cH/QbIhQwMDl8gORl7A16WD/xxAdq6N6SgycKUblf41+wbFBT44RiCi11NU3TLHgBxRUUD4ITqnIAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTUtMDEtMjFUMDA6MTM6NDMrMDE6MDC74T7AAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEyLTA0LTAyVDA0OjEzOjM3KzAyOjAwQJ35wQAAAABJRU5ErkJggg==","), move");let a=_D(e,this.getHotspotRect()),o=_Z(e,this.getCropRect());return a||o?"url(".concat("data:image/png;base64,AAACAAEAICACAAcABQAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAA//AAAd/wAAGf+AAAH9gAADbYAAA2yAAAZsAAAGbAAAAGAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//4AB//8AAf//AAD//5AA///gAP//4AD//8AF///AB///5A////5///8=","), move"):"auto"}componentDidMount(){this.draw()}componentDidUpdate(){this.draw()}draw(){if(!this.canvas)return;let e=this.canvas.domNode,n=e.getContext("2d");if(!n)return;this.paint(n);let r=e.style.cursor,i=this.getCursor();r!==i&&(e.style.cursor=i)}render(){let{image:e,readOnly:n}=this.props,r=_3();return(0,oZ.jsx)(_J,{children:(0,oZ.jsx)(_Q,{readOnly:n,ref:this.setCanvas,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd,onPointerMove:this.handlePointerMove,onPointerOut:this.handlePointerOut,height:e.height*r,width:e.width*r})})}}function _8(e,n){let r=e&&e.crop||_1;return{...e,crop:{left:r.left+(n.left||0),right:r.right+(n.right||0),top:r.top+(n.top||0),bottom:r.bottom+(n.bottom||0)}}}function _6(e){let{image:n,maxHeight:r,maxWidth:i,children:a}=e,[o]=(0,oN.useState)(()=>{let e=document.createElement("canvas");return e.style.display="none",e});return(0,oN.useEffect)(()=>(document.body.appendChild(o),()=>{document.body.removeChild(o)}),[o]),a((0,oN.useCallback)((e,n,r)=>{let i=e.width/e.height,a=Math.min(e.width,r),l=Math.min(e.height,n),s=e.width>e.height,c=s?a:l*i,d=s?a/i:l;o.width=c,o.height=d;let u=o.getContext("2d");return u&&u.drawImage(e,0,0,e.width,e.height,0,0,c,d),o},[o])(n,r,i))}function _9(e){return(0,oZ.jsx)(_M,{src:e.src,children:n=>{let{isLoading:r,image:i,error:a}=n;return r?(0,oZ.jsx)(u4,{showText:!0}):a?(0,oZ.jsx)("div",{children:a.message}):i?(0,oZ.jsx)(_6,{image:i,maxHeight:_9.maxHeight,maxWidth:_9.maxWidth,children:n=>(0,oZ.jsx)(_5,{image:n,...e})}):null}})}function _7(e){if(!e)return null;if("aspectRatio"in e)return e.aspectRatio;if("height"in e||"width"in e){if("number"!=typeof e.height&&"number"!=typeof e.width)throw Error("Height and width must be numbers, got ".concat(JSON.stringify(e)));return e.width/e.height}return null}function Te(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=Math.pow(10,n);return Math.round(e*r)/r}function Tt(e){return 0===e?0:"".concat(e,"%")}function Tn(e){return Tt(Te(100*e))}_9.maxHeight=500,_9.maxWidth=1e3;var Tr=Object.freeze,Ti=Object.defineProperty;let Ta=oV.ZP.div(nX||(nX=Tr(Ti(q=["\n  position: relative;\n  width: 100%;\n"],"raw",{value:Tr(q.slice())})))),To=cL()("sanity-imagetool"),Tl=(0,oN.memo)(function(e){let{alignX:n="center",alignY:r="center",alt:i,aspectRatio:a="none",className:o="",crop:l=_1,hotspot:s=_0,onError:c,onLoad:d,src:u,srcAspectRatio:p,srcSet:h,style:f}=e,[m,g]=(0,oN.useState)(null),x=(0,oN.useRef)(null),v=(0,oN.useRef)(null),y=(0,oN.useCallback)(()=>{if(x.current){if("auto"===a){let e=x.current.parentNode;(0,oN.startTransition)(()=>g(e.offsetWidth/e.offsetHeight))}else g(null)}},[a]);(0,oN.useEffect)(()=>{let e=v.current;return e&&e.src&&e.complete&&void 0!==e.naturalWidth&&(To("Image '%s' already loaded, refreshing (from cache) to trigger onLoad / onError",u),e.src=e.src),y(),window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y)}},[u,y]);let b=(0,oN.useMemo)(()=>"none"===a?l?function(e,n){let r=1/n,i=n*r;return(i-(e.left+e.right)*i)/(r-(e.top+e.bottom)*r)}(l,p):p:"auto"===a?m:a||null,[a,m,l,p]),j=(0,oN.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=_7(e.image)||1,r=e.hotspot||_0,i=e.crop||_1,a=_7(e.container)||n*function(e){let n=1-e.top-e.bottom;return(1-e.left-e.right)/n}(i),o=function(e,n,r){let i,a,o;let l=n.crop,s=r.aspect,c=r.align,d=1-l.left-l.right,u=1-l.top-l.bottom,p={top:-l.top/u,left:-l.left/d,width:1/d,height:1/u}
1,h=d/u*e,f={x:(n.hotspot.x-l.left)/d,y:(n.hotspot.y-l.top)/u,height:n.hotspot.height/u,width:n.hotspot.width/d},m=Math.min(1/f.width,1/f.height*h/s),g=h<=s;if((i=g?1:h/s)>m){let e;a="letterbox";let n=i-m;o={width:e=g?1-n:m,height:e/h*s,left:0,top:0};let r=f.x*o.width-f.width*o.width/2;switch(c.x){case"left":o.left=g?0:-r;break;case"right":o.left=g?1-o.width:r;break;case"center":o.left=g?(1-o.width)/2:-r;break;default:throw Error("Invalid x alignment: '".concat(c.x,"'. Must be either 'left', 'right' or 'center'"))}let l=f.y*o.height-f.height*o.height/2;switch(c.y){case"top":o.top=g?-l:0;break;case"bottom":o.top=l;break;case"center":o.top=g?-l:(1-o.height)/2;break;default:throw Error("Invalid y alignment: '".concat(c.y,"'. Must be either 'top', 'bottom' or 'center'"))}}else if(g){a="full_width";let e=-f.y/h*s+.5,n=i/h*s;e>0?e=0:-e>n-1&&(e=-(n-1)),o={width:i,height:n,left:0,top:e}}else{a="full_height";let e=.5-f.x*i;e>0?e=0:-e>i-1&&(e=-(i-1)),o={width:i,height:i/h*s,top:0,left:e}}return{method:a,crop:o,image:p}}(n,{hotspot:r,crop:i},{aspect:a,align:e.align||{x:"center",y:"center"}}),l=Tt(Te(100/a));return{debug:{result:o},container:{overflow:"hidden",position:"relative",width:"100%",height:l},padding:{marginTop:l},crop:{position:"absolute",overflow:"hidden",height:Tn(o.crop.height),width:Tn(o.crop.width),top:Tn(o.crop.top),left
1:Tn(o.crop.left)},image:{position:"absolute",height:Tn(o.image.height),width:Tn(o.image.width),top:Tn(o.image.top),left:Tn(o.image.left)}}})({container:{aspectRatio:b||p},image:{aspectRatio:p},hotspot:s,crop:l,align:{x:n,y:r}}),[n,r,l,s,p,b]);return(0,oZ.jsx)(Ta,{className:"".concat(o),style:f,ref:x,children:(0,oZ.jsxs)("div",{style:j.container,children:[(0,oZ.jsx)("div",{style:j.padding}),(0,oZ.jsx)("div",{style:j.crop,children:(0,oZ.jsx)("img",{ref:v,src:u,alt:i,srcSet:h,onLoad:d,onError:c,style:j.image})})]})})}),Ts={isLoading:!0};var Tc=Object.freeze,Td=Object.defineProperty;let Tu=["hotspot"],Tp=[["3:4",3/4],["Square",1],["16:9",16/9],["Panorama",4]],Th={crop:_1,hotspot:_0},Tf=oV.ZP.div(nG||(nG=Tc(Td(Z=["\n  min-height: 6em;\n"],"raw",{value:Tc(Z.slice())}))));function Tm(e){return(0,oZ.jsx)(oK.kC,{align:"center",justify:"center",padding:4,style:{overflowWrap:"break-word"},children:e.children})}function Tg(e){let{imageUrl:n,value:r,changed:i,level:a,path:o,focusPath:l=dy,presence:s,onChange:c,schemaType:d,onPathFocus:u,readOnly:p,elementProps:h}=e,[f,m]=(0,oN.useState)(r||Th),{image:g,isLoading:x,error:v}=function(e){let[n,r]=(0,oN.useState)(Ts);return(0,oN.useEffect)(()=>{r(Ts);let n=new oy.y(n=>{let r=document.createElement("img"),i=!1;return r.onload=()=>{i=!0,n.next(r),n.complete()},r.onerror=()=>{i=!0,n.error(Error("Could not load image from ".concat(e.startsWith("blob:")?"blob":e)))},r.src=e,()=>{r.onload=null,r.onerror=null,i||(r.src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=")}}).subscribe({error:e=>{r({isLoading:!1,error:e})},next:e=>{r({image:e,isLoading:!1})}});return()=>{n.unsubscribe()}},[e]),n}(n),y=(0,oN.useCallback)(()=>{u(Tu)},[u]);(0,oN.useEffect)(()=>{m(r||Th)},[r]);let b="hotspot"===l[0];fV(b,e=>{var n;!e&&b&&(null==(n=h.ref.current)||n.focus())});let j=(0,oN.useCallback)(e=>{if(p)return;let n=d.fields.find(e=>"crop"===e.name&&"object"!==e.type.name),r=d.fields.find(e=>"object"!==e.type.name&&"hotspot"===e.name),i=n?{_type:n.type.name,...e.crop||_1}:e.crop,a=r?{_type:r.type.name,...e.hotspot||_0}:e.hotspot;c([fz(i,["crop"]),fz(a,["hotspot"])])},[c,p,d.fields]),{t:w}=dV();return(0,oZ.jsx)(bp,{title:w("inputs.imagetool.title"),level:a,description:w("inputs.imagetool.description"),deprecated:d.deprecated,__unstable_presence:s,children:(0,oZ.jsxs)("div",{children:[(0,oZ.jsx)(oK.Zb,{__unstable_checkered:!0,__unstable_focusRing:!0,tabIndex:0,ref:h.ref,onFocus:y,children:(0,oZ.jsx)(dQ,{path:o.concat(Tu),hasFocus:"hotspot"===l[0],isChanged:i,children:(0,oZ.jsxs)(_z,{ratio:1.5,children:[(x||v)&&(0,oZ.jsx)(Tm,{children:v?(0,oZ.jsx)(oK.Zb,{padding:4,radius:2,tone:"critical",border:!0,children:(0,oZ.jsx)(oK.xv,{children:w("inputs.imagetool.load-error",{errorMessage:v.message})})}):(0,oZ.jsx)(u4,{showText:!0})}),!x&&g&&(0,oZ.jsx)(oK.xu,{margin:1,children:(0,oZ.jsx)(_9,{value:f,src:g.src,readOnly:!!p,onChangeEnd:j,onChange:m})})]})})}),(0,oZ.jsx)(oK.xu,{marginTop:3,children:(0,oZ.jsx)(oK.rj,{columns:Tp.length,gap:1,children:Tp.map(e=>{let[n,r]=e;return(0,oZ.jsxs)("div",{children:[(0,oZ.jsx)(oK.X6,{as:"h4",size:0,children:n}),(0,oZ.jsx)(oK.xu,{marginTop:2,children:(0,oZ.jsx)(_z,{ratio:r,children:(0,oZ.jsx)(oK.Zb,{__unstable_checkered:!0,children:!x&&g?(0,oZ.jsx)(Tl,{aspectRatio:r,src:g.src,srcAspectRatio:g.width/g.height,hotspot:f.hotspot||_0,crop:f.crop||_1}):(0,oZ.jsx)(Tf,{})})})})]},r)})})})]})})}var Tx=Object.freeze,Tv=Object.defineProperty;let Ty=(0,oV.ZP)(oK.gF)(nJ||(nJ=Tx(Tv(N=["\n  position: absolute;\n  top: 0;\n  right: 0;\n"],"raw",{value:Tx(N.slice())}))));function Tb(e){let{onEdit:n,children:r,showEdit:i,setHotspotButtonElement:a,setMenuButtonElement:o,onMenuOpen:l,isMenuOpen:s}=e,[c,d]=(0,oN.useState)(null),[u,p]=(0,oN.useState)(null),h=(0,oN.useCallback)(()=>l(!s),[l,s]);(0,oK.qh)((0,oN.useCallback)(e=>{s&&("Escape"===e.key||"Tab"===e.key)&&(l(!1),null==u||u.focus())},[s,l,u])),(0,oK.O8)((0,oN.useCallback)(e=>{(null==u?void 0:u.contains(e.target))||l(!1)},[u,l]),[c]);let f=(0,oN.useCallback)(e=>{o(e),p(e)},[o]);(0,oN.useEffect)(()=>{s&&(null==c||c.focus())},[s,c]);let{t:m}=dV();return(0,oZ.jsx)(lr.uE,{children:(0,oZ.jsxs)(Ty,{"data-buttons":!0,space:1,padding:2,children:[i&&(0,oZ.jsx)(lr.zx,{"aria-label":m("inputs.image.actions-menu.edit-details.aria-label"),"data-testid":"options-menu-edit-details",icon:lp.Rf5,mode:"ghost",onClick:n,ref:a,tooltipProps:{content:m("inputs.image.actions-menu.crop-image-tooltip")}}),(0,oZ.jsx)(lr.J2,{id:"image-actions-menu",content:(0,oZ.jsx)(oK.v2,{ref:d,children:r}),portal:!0,open:s,constrainSize:!0,children:(0,oZ.jsx)(bA,{"aria-label":m("inputs.image.actions-menu.options.aria-label"),"data-testid":"options-menu-button",mode:"ghost",onClick:h,ref:f})})]})})}var Tj=Object.freeze,Tw=Object.defineProperty,Tk=(e,n)=>Tj(Tw(e,"raw",{value:Tj(n||e.slice())}));let TC=(0,oV.ZP)(oK.Zb)(nQ||(nQ=Tk(["\n  position: relative;\n  width: 100%;\n  overflow: hidden;\n  overflow: clip;\n  min-height: 3.75rem;\n  max-height: 20rem;\n\n  & > div[data-container] {\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    display: flex !important;
1\n    align-items: center;\n    justify-content: center;\n  }\n\n  & img {\n    max-width: 100%;\n    max-height: 100%;\n  }\n"]))),T_=(0,oV.ZP)(oK.kC)(e=>{let{$drag:n,$tone:r}=e,i=oK.Lg.color.light[r].card.enabled.fg,a=(0,oK.m4)(oK.Lg.color.light[r].card.enabled.bg,.8);return(0,oV.iv)(n0||(n0=Tk(["\n    position: absolute;\n    top: 0;\n    left: 0;\n    right: 0;\n    bottom: 0;\n    backdrop-filter: ",";\n    color: ",";\n    background-color: ",";\n  "])),n?"blur(10px)":"",r?i:"",n?a:"transparent")}),TT=(0,oV.ZP)(oK.kC)(n1||(n1=Tk(["\n  position: absolute;\n  top: 0;\n  left: 0;\n  bottom: 0;\n  right: 0;\n"]))),TS=e=>{let n=new URLSearchParams(e.split("?")[1]).get("rect");return n?[n.split(",")[2],n.split(",")[3]].map(Number):e.split("-")[1].split(".")[0].split("x").map(Number)};function TE(e){let{drag:n,readOnly:r,isRejected:i,src:a,...o}=e,[l,s]=(0,oN.useState)(!1),[c,d]=(0,oN.useState)(null),u=(0,oK.XL)(c),p=(null==u?void 0:u.width)||0,h=i||r?"critical":"primary",f=n?h:"default",m=30*document.documentElement.clientHeight/100,[g,x]=TS(a);(0,oN.useEffect)(()=>{s(!1)},[a]);let v=(0,oN.useCallback)(()=>{s(!0)},[]),{t:y}=dV();return(0,oZ.jsxs)(TC,{...o,ref:d,style:{height:(g>p?p/(g/x):x)<m?null:"".concat(30,"vh")},tone:"transparent",children:[(0,oZ.jsxs)(oK.Zb,{"data-container":!0,tone:"inherit",children:[!l&&(0,oZ.jsx)(TO,{cardTone:"transparent",drag:!0,content:(0,oZ.jsx)(u4,{showText:!0})}),(0,oZ.jsx)("img",{src:a,"data-testid":"hotspot-image-input",alt:e.alt,onLoad:v,referrerPolicy:"strict-origin-when-cross-origin"})]}),n&&(0,oZ.jsx)(TO,{cardTone:f,drag:n,content:(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(oK.xu,{marginBottom:3,children:(0,oZ.jsx)(oK.X6,{children:(0,oZ.jsx)(TP,{isRejected:i,readOnly:r})})}),(0,oZ.jsx)(oK.xv,{size:1,children:y(function(e){let{isRejected:n,readOnly:r}=e;return n?"inputs.image.drag-overlay.this-field-is-read-only":r?"inputs.image.drag-overlay.cannot-upload-here":"inputs.image.drag-overlay.drop-to-upload-image"}({isRejected:i,readOnly:r}))})]})})]})}function TP(e){let{isRejected:n,readOnly:r}=e;return n?(0,oZ.jsx)(lp.vaB,{}):r?(0,oZ.jsx)(lp.CPA,{}):(0,oZ.jsx)(lp.XBm,{})}function TO(e){let{cardTone:n,drag:r,content:i}=e;return(0,oZ.jsx)(T_,{justify:"flex-end",padding:3,$drag:r,$tone:n,children:(0,oZ.jsx)(TT,{direction:"column",align:"center",justify:"center",children:i})})}function TA(e){let{onClearValue:n}=e,{t:r}=dV();return(0,oZ.jsxs)(oK.Zb,{tone:"caution",padding:4,border:!0,radius:2,children:[(0,oZ.jsxs)(oK.kC,{gap:4,marginBottom:4,children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(lp.foC,{})})}),(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:r("inputs.image.invalid-image-warning.title")}),(0,oZ.jsx)(oK.xv,{size:1,children:r("inputs.image.invalid-image-warning.description")})]})]}),(0,oZ.jsx)(lr.zx,{icon:lp.X5P,mode:"ghost",onClick:n,text:r("inputs.image.invalid-image-warning.reset-button.text"),width:"fill"})]})}let TI=()=>"undefined"!=typeof window&&window.devicePixelRatio?Math.round(Math.max(1,window.devicePixelRatio)):1;function Tz(e){let{children:n}=e;return n}let TM=["asset"],TR={portal:!0};class TF extends oN.PureComponent{constructor(e){var n;super(e),n=this,this._previewElement=null,this.uploadSubscription=null,this.state={isUploading:!1,selectedAssetSource:null,hoveringFiles:[],isStale:!1,hotspotButtonElement:null,menuButtonElement:null,isMenuOpen:!1},this.toast=null,this.setPreviewElement=e=>{this._previewElement=e},this.setHotspotButtonElement=e=>{this.setState({hotspotButtonElement:e})},this.setMenuButtonElement=e=>{this.setState({menuButtonElement:e})},this.getUploadOptions=e=>{let{schemaType:n,resolveUploader:r}=this.props,i=r&&r(n,e);return i?[{type:n,uploader:i}]:[]},this.uploadWith=function(e,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{schemaType:a,onChange:o,client:l,t:s}=n.props,{label:c,title:d,description:u,creditLine:p,source:h}=i,f={metadata:lS()(a,"options.metadata"),storeOriginalFilename:lS()(a,"options.storeOriginalFilename"),label:c,title:d,description:u,creditLine:p,source:h};n.cancelUpload(),n.setState({isUploading:!0}),o(fA({_type:a.name})),n.uploadSubscription=e.upload(l,r,a,f).subscribe({next:e=>{e.patches&&o(e.patches)},error:e=>{var r;console.error(e),null==(r=n.toast)||r.push({status:"error",description:s("inputs.image.upload-error.description"),title:s("inputs.image.upload-error.title")}),n.clearUploadStatus()},complete:()=>{o([fM(["hotspot"]),fM(["crop"])]),n.setState({isUploading:!1})}})},this.handleRemoveButtonClick=()=>{let{value:e}=this.props,n=Object.keys(e||{}),r=0===n.filter(e=>!["_type","_key","_upload","asset","crop","hotspot"].includes(e)).length,i=["asset"].concat(n.filter(e=>["crop","hotspot","_upload"].includes(e))).map(e=>fM([e]));this.props.onChange(r&&!this.valueIsArrayElement()?fM():i)},this.handleFieldChange=e=>{let{onChange:n,schemaType:r}=this.props;if(!this.valueIsArrayElement()&&this.eventIsUnsettingLastFilledField(e)){n(fM());return}n(e.prepend(fA({_type:r.name})).patches)},this.eventIsUnsettingLastFilledField=e=>{let n=e.patches[0];if(1!==e.patches.length||"unset"!==n.type)return!1;let r=Object.keys(this.props.value||{}).filter(e=>!["_type","_key","crop","hotspot"].includes(e));return 1===e.patches[0].path.length&&1===r.length&&r[0]===e.patches[0].path[0]},this.valueIsArrayElement=()=>{let{path:e}=this.props;return"string"!=typeof e.slice(-1)[0]},this.handleOpenDialog=()=>
1{this.props.onPathFocus(["hotspot"])},this.handleCloseDialog=()=>{var e;this.props.onPathFocus([]),null==(e=this.state.hotspotButtonElement)||e.focus()},this.handleSelectAssetFromSource=e=>{let{onChange:n,schemaType:r,resolveUploader:i}=this.props;_n({assetFromSource:e,onChange:n,type:r,resolveUploader:i,uploadWith:this.uploadWith,isImage:!0}),this.setState({selectedAssetSource:null})},this.handleFileTargetFocus=e=>{var n;e.currentTarget===e.target&&e.currentTarget===(null==(n=this.props.elementProps.ref)?void 0:n.current)&&this.props.elementProps.onFocus(e)},this.handleFilesOver=e=>{this.setState({hoveringFiles:e.filter(e=>"string"!==e.kind)})},this.handleFilesOut=()=>{this.setState({hoveringFiles:[]})},this.handleCancelUpload=()=>{this.cancelUpload()},this.handleClearUploadState=()=>{this.setState({isStale:!1}),this.clearUploadStatus()},this.handleStaleUpload=()=>{this.setState({isStale:!0})},this.handleClearField=()=>{this.props.onChange([fM(["asset"]),fM(["crop"]),fM(["hotspot"])])},this.handleSelectFiles=e=>{let{directUploads:n,readOnly:r}=this.props,{hoveringFiles:i}=this.state;n&&!r?this.uploadFirstAccepted(e):i.length>0&&this.handleFilesOut()},this.handleSelectImageFromAssetSource=e=>{this.setState({selectedAssetSource:e})},this.handleAssetSourceClosed=()=>{var e;this.setState({selectedAssetSource:null}),null==(e=this.state.menuButtonElement)||e.focus()},this.renderHotspotInput=e=>{let{value:n,changed:r,id:i,imageUrlBuilder:a,t:o}=this.props,l=this.isImageToolEnabled()&&n&&n.asset;return(0,oZ.jsx)(lr.Vq,{__unstable_autoFocus:!1,header:o("inputs.image.hotspot-dialog.title"),id:"".concat(i,"_dialog"),onClickOutside:this.handleCloseDialog,onClose:this.handleCloseDialog,width:1,children:(0,oZ.jsx)(yQ,{children:(0,oZ.jsx)(oK.Kq,{space:5,children:l&&(null==n?void 0:n.asset)&&(0,oZ.jsx)(Tg,{...this.props,imageUrl:a.image(n.asset).url(),value:n,presence:e.presence,changed:r})})})})},this.renderPreview=()=>{let{value:e,schemaType:n,readOnly:r,directUploads:i,imageUrlBuilder:a,t:o,resolveUploader:l}=this.props;if(!e||!(0,sf.JZ)(e))return null;let{hoveringFiles:s}=this.state,c=s.filter(e=>l(n,e)),d=s.length-c.length,u=a.width(2e3).fit("max").image(e).dpr(TI()).auto("format").url();return(0,oZ.jsx)(TE,{drag:!(null==e?void 0:e._upload)&&s.length>0,isRejected:d>0||!i,readOnly:r,src:u,alt:o("inputs.image.preview-uploaded-image")})},this.setToast=e=>{this.toast=e},this._assetPath=e.path.concat(TM)}isImageToolEnabled(){return!0===lS()(this.props.schemaType,"options.hotspot")}clearUploadStatus(){var e;(null==(e=this.props.value)?void 0:e._upload)&&this.props.onChange(fM(["_upload"]))}cancelUpload(){this.uploadSubscription&&(this.uploadSubscription.unsubscribe(),this.clearUploadStatus())}uploadFirstAccepted(e){let{schemaType:n,resolveUploader:r}=this.props,i=e.map(e=>({file:e,uploader:r(n,e)})).find(e=>e.uploader);i&&this.uploadWith(i.uploader,i.file),this.setState({isMenuOpen:!1})}renderAssetMenu(){let{value:e,assetSources:n,schemaType:r,readOnly:i,directUploads:a,imageUrlBuilder:o,observeAsset:l,t:s}=this.props,c=null==e?void 0:e.asset;if(!c)return null;let d=lS()(r,"options.accept","image/*"),u=e&&c&&this.isImageToolEnabled(),p=n&&0===n.length?null:(0,oZ.jsx)(lr.sN,{icon:lp.W1M,text:s("inputs.image.browse-menu.text"),onClick:()=>{this.setState({isMenuOpen:!1}),this.handleSelectImageFromAssetSource(n[0])},disabled:i,"data-testid":"file-input-browse-button"});return n&&n.length>1&&(p=n.map(e=>(0,oZ.jsx)(lr.sN,{text:(e.i18nKey?s(e.i18nKey):e.title)||lf()(e.name),onClick:()=>{this.setState({isMenuOpen:!1}),this.handleSelectImageFromAssetSource(e)},icon:e.icon||lp.XBm,"data-testid":"file-input-browse-button-".concat(e.name),disabled:i},e.name))),(0,oZ.jsx)(CB,{observeAsset:l,reference:c,children:n=>{let r,l,{_id:s,originalFilename:c,extension:h}=n;return(0,sf.JZ)(e)&&(l=o.image(s).forceDownload(c||"download.".concat(h)).url(),r=o.image(s).url()),(0,oZ.jsx)(Tb,{isMenuOpen:this.state.isMenuOpen,onEdit:this.handleOpenDialog,onMenuOpen:e=>this.setState({isMenuOpen:e}),setHotspotButtonElement:this.setHotspotButtonElement,setMenuButtonElement:this.setMenuButtonElement,showEdit:u,children:(0,oZ.jsx)(_l,{onUpload:this.handleSelectFiles,browse:p,onReset:this.handleRemoveButtonClick,downloadUrl:l,copyUrl:r,readOnly:i,directUploads:a,accept:d})})}})}renderBrowser(){let{assetSources:e,readOnly:n,directUploads:r,id:i,t:a}=this.props;return e&&0===e.length?null:e&&e.length>1&&!n&&r?(0,oZ.jsx)(lr.j2,{id:"".concat(i,"_assetImageButton"),ref:this.setMenuButtonElement,button:(0,oZ.jsx)(lr.zx,{"data-testid":"file-input-multi-browse-button",icon:lp.W1M,iconRight:lp.v4q,mode:"bleed",text:a("inputs.image.browse-menu.text")}),menu:(0,oZ.jsx)(oK.v2,{children:e.map(e=>(0,oZ.jsx)(lr.sN,{text:(e.i18nKey?a(e.i18nKey):e.title)||lf()(e.name),onClick:()=>{this.setState({isMenuOpen:!1}),this.handleSelectImageFromAssetSource(e)},icon:e.icon||lp.XBm,disabled:n,"data-testid":"file-input-browse-button-".concat(e.name)}
1,e.name))}),popover:TR}):(0,oZ.jsx)(lr.zx,{text:a("inputs.image.browse-menu.text"),icon:lp.W1M,mode:"bleed",onClick:()=>{this.setState({isMenuOpen:!1}),this.handleSelectImageFromAssetSource(e[0])},"data-testid":"file-input-browse-button",disabled:n})}renderUploadPlaceholder(){let{schemaType:e,readOnly:n,directUploads:r,resolveUploader:i}=this.props,{hoveringFiles:a}=this.state,o=a.filter(n=>i(e,n)),l=a.length-o.length,s=lS()(e,"options.accept","image/*");return(0,oZ.jsx)("div",{style:{padding:1},children:(0,oZ.jsx)(oK.Zb,{tone:n?"transparent":"inherit",border:!0,paddingX:3,paddingY:2,radius:2,style:0===a.length?{}:{borderColor:"transparent"},children:(0,oZ.jsx)(_x,{browse:this.renderBrowser(),onUpload:this.handleSelectFiles,readOnly:n,hoveringFiles:a,acceptedFiles:o,rejectedFilesCount:l,type:"image",accept:s,directUploads:r})})})}renderUploadState(e){var n;let{isUploading:r}=this.state,i=null==(n=this._previewElement)?void 0:n.offsetHeight;return(0,oZ.jsx)(_e,{uploadState:e,onCancel:r?this.handleCancelUpload:void 0,onStale:this.handleStaleUpload,height:i})}renderAssetSource(){let{selectedAssetSource:e}=this.state,{value:n,schemaType:r,observeAsset:i}=this.props,a=lS()(r,"options.accept","image/*");if(!e)return null;let o=e.component;return n&&n.asset?(0,oZ.jsx)(CB,{observeAsset:i,reference:n.asset,children:e=>(0,oZ.jsx)(o,{selectedAssets:[e],assetType:"image",accept:a,selectionType:"single",onClose:this.handleAssetSourceClosed,onSelect:this.handleSelectAssetFromSource})}):(0,oZ.jsx)(o,{selectedAssets:[],selectionType:"single",assetType:"image",accept:a,onClose:this.handleAssetSourceClosed,onSelect:this.handleSelectAssetFromSource})}getFileTone(){let{schemaType:e,value:n,readOnly:r,directUploads:i,resolveUploader:a}=this.props,{hoveringFiles:o}=this.state,l=o.filter(n=>a(e,n)),s=o.length-l.length;return o.length>0&&(s>0||!i)?"critical":(null==n?void 0:n._upload)||r||!(o.length>0)?r?"transparent":(null==n?void 0:n._upload)&&(null==n?void 0:n.asset)?"transparent":"default":"primary"}renderAsset(){let{value:e,readOnly:n,elementProps:r}=this.props,{hoveringFiles:i,isStale:a}=this.state,o=!!((null==e?void 0:e._upload)||(null==e?void 0:e.asset));return!e||void 0===e.asset||(null==e?void 0:e._upload)||(0,sf.JZ)(e)?l=>(0,oZ.jsxs)(oZ.Fragment,{children:[a&&(0,oZ.jsx)(oK.xu,{marginBottom:2,children:(0,oZ.jsx)(_v,{onClearStale:this.handleClearUploadState})}),(0,oZ.jsx)(dQ,{path:l.path.concat(TM),hasFocus:!!l.focused,isChanged:l.changed,children:(null==e?void 0:e._upload)?this.renderUploadState(e._upload):(0,oZ.jsxs)(C1,{...r,onFocus:this.handleFileTargetFocus,tabIndex:0,disabled:!!n,onFiles:this.handleSelectFiles,onFilesOver:this.handleFilesOver,onFilesOut:this.handleFilesOut,tone:this.getFileTone(),$border:o||i.length>0,sizing:"border",radius:2,children:[!(null==e?void 0:e.asset)&&this.renderUploadPlaceholder(),!(null==e?void 0:e._upload)&&(null==e?void 0:e.asset)&&(0,oZ.jsxs)("div",{style:{position:"relative"},ref:this.setPreviewElement,children:[this.renderPreview(),this.renderAssetMenu()]})]})})]}):()=>(0,oZ.jsx)(TA,{onClearValue:this.handleClearField})}render(){let{focusPath:e,members:n,renderAnnotation:r,renderBlock:i,renderField:a,renderInlineBlock:o,renderInput:l,renderItem:s,renderPreview:c}=this.props,{selectedAssetSource:d}=this.state,u=n.find(e=>"field"===e.kind&&"hotspot"===e.name);return(0,oZ.jsxs)(oK.Kq,{space:5,"data-testid":"image-input",children:[(0,oZ.jsx)(Bt,{ref:this.setToast}),n.map(e=>"field"===e.kind&&("crop"===e.name||"hotspot"===e.name)?null:"field"===e.kind?(0,oZ.jsx)(wp,{member:e,renderAnnotation:r,renderBlock:i,renderInlineBlock:o,renderInput:"asset"===e.name?this.renderAsset():l,renderField:"asset"===e.name?Tz:a,renderItem:s,renderPreview:c},e.key):"fieldSet"===e.kind?(0,oZ.jsx)(wS,{member:e,renderAnnotation:r,renderBlock:i,renderField:a,renderInlineBlock:o,renderInput:l,renderItem:s,renderPreview:c},e.key):"error"===e.kind?(0,oZ.jsx)(wT,{member:e},e.key):(0,oZ.jsx)(oZ.Fragment,{children:t("inputs.image.error.unknown-member-kind",{kind:e.kind})})),u&&"hotspot"===e[0]&&(0,oZ.jsx)(wZ,{...this.props,absolutePath:u.field.path,renderInput:this.renderHotspotInput}),d&&this.renderAssetSource()]})}}let TD=()=>{},Tq={isLoading:!0,result:void 0,error:void 0,retry:TD},TZ={isLoading:!1,result:void 0,error:void 0,retry:TD};
1function TN(e,n){let[r,i]=(0,oN.useState)(0),a=(0,oN.useCallback)(()=>{i(e=>e+1)},[]),o=(0,oN.useMemo)(()=>({_id:e._id,_type:e._type}),[e._id,e._type]),l=(0,oR.m2)(()=>o._id?n(o).pipe((0,aW.U)(e=>({isLoading:!1,result:e,error:void 0,retry:a,retryAttempt:r})),(0,a3.O)(Tq),(0,aG.K)(e=>(console.error(e),(0,og.of)({isLoading:!1,result:void 0,error:e,retry:a,retryAttempt:r})))):(0,og.of)(TZ),[o,n,a,r],Tq);return fL(e._id,e._id)!==e._id?Tq:l}var TL=Object.freeze,TV=Object.defineProperty;let TK=(0,oV.ZP)(oK.kC)(n2||(n2=TL(TV(L=["\n  /* this is a hack to avoid layout jumps while previews are loading\n  or the message is not tall enough to fill the card\n  there's probably better ways of solving this */\n  min-height: 36px;\n"],"raw",{value:TL(L.slice())}))));function TB(e){var n,r,i;let{refType:a,showStudioUrlIcon:o,hasStudioUrl:l,showTypeLabel:s,availability:c,preview:d,id:u,dataset:p,projectId:h}=e,f=(null==c?void 0:c.reason)==="NOT_FOUND",m=(null==c?void 0:c.reason)==="PERMISSION_DENIED",g=null==(n=d.published)?void 0:n.media,{t:x}=dV(),v=(0,oN.useMemo)(()=>{if(g){let e=void 0!==(null==g?void 0:g.asset)&&(0,sf.JZ)(g),n=oN.isValidElement(g);return e||n?function(e){let{dimensions:r}=e;return n?g:(0,oZ.jsx)("img",{src:sh()({dataset:p,projectId:h}).image(g).withOptions(r).url(),alt:x("inputs.reference.image-preview-alt-text"),referrerPolicy:"strict-origin-when-cross-origin"})}:null}return(null==a?void 0:a.icon)?(0,oN.createElement)(a.icon):null},[g,p,h,null==a?void 0:a.icon,x]);return(0,oZ.jsxs)(TK,{align:"center",justify:"center",flex:1,"data-testid":"preview",children:[(null==c?void 0:c.available)?(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(Kt,{title:null==(r=d.published)?void 0:r.title,subtitle:null==(i=d.published)?void 0:i.subtitle,media:v||!1})}):(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.kC,{align:"center",children:(0,oZ.jsx)(oK.xu,{flex:1,paddingY:2,children:(0,oZ.jsx)(oK.xv,{muted:!0,children:x("inputs.reference.error.document-unavailable-title")})})})}),(0,oZ.jsx)(oK.xu,{paddingLeft:3,children:(0,oZ.jsxs)(oK.gF,{space:4,children:[a&&s&&(0,oZ.jsx)(oK.Ct,{mode:"outline",children:a.title||a.type}),(m||f)&&(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(lr.u,{portal:!0,content:x(f?"inputs.reference.referenced-document-does-not-exist":"inputs.reference.referenced-document-insufficient-permissions",{documentId:u}),children:(0,oZ.jsx)(LT,{tone:"default",children:m?(0,oZ.jsx)(lp.vaB,{}):(0,oZ.jsx)(lp.BHU,{})})})}),!(f||m)&&o&&(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(lr.u,{portal:!0,content:x(l?"inputs.reference.document-opens-in-new-tab":"input.reference.document-cannot-be-opened.failed-to-resolve-url"),children:(0,oZ.jsx)(LT,{size:1,tone:"default",muted:!l,children:(0,oZ.jsx)(lp.buG,{})})})})]})})]})}function TU(){return hN(h$).config().projectId}function TH(e){var n;let{isLoading:r,result:i,error:a}=TN(e.document,e.getReferenceInfo),{t:o}=dV(),l=TU();if(r)return(0,oZ.jsxs)(oK.Kq,{space:2,padding:1,children:[(0,oZ.jsx)(oK.Qr,{style:{maxWidth:320},radius:1,animated:!0}),(0,oZ.jsx)(oK.Qr,{style:{maxWidth:200},radius:1,size:1,animated:!0})]});if(a)return(0,oZ.jsx)(oK.Kq,{space:2,padding:1,children:(0,oZ.jsx)(fN,{title:o("inputs.reference.error.failed-to-load-document-title"),children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:a.message})})});if(!i)return null;if((null==(n=i.availability)?void 0:n.reason)==="PERMISSION_DENIED")return(0,oZ.jsx)(oK.Kq,{space:2,padding:1,children:o("inputs.reference.error.missing-read-permissions-description")});let s=e.referenceType.to.find(e=>e.type===i.type);return s?i&&s&&(0,oZ.jsx)(TB,{id:i.id,availability:i.availability,preview:i.preview,refType:s,dataset:e.referenceType.dataset,projectId:l,showTypeLabel:e.referenceType.to.length>1}):(0,oZ.jsx)(oK.Kq,{space:2,padding:1,children:o("inputs.reference.error.invalid-search-result-type-title",{returnedType:i.type})})}function T$(e){var n,r;let{value:i,type:a,showStudioUrlIcon:o,hasStudioUrl:l,referenceInfo:s}=e,{t:c}=dV(),d=TU();if(s.isLoading||s.error)return(0,oZ.jsxs)(oK.Kq,{space:2,padding:1,children:[(0,oZ.jsx)(oK.Qr,{style:{maxWidth:320},radius:1,animated:!s.error}),(0,oZ.jsx)(oK.Qr,{style:{maxWidth:200},radius:1,size:1,animated:!s.error})]});let u=a.to.length>1,p=null==(n=s.result)?void 0:n.type,h=a.to.find(e=>e.type===p);return(null==(r=s.result.availability)?void 0:r.available)&&!h?(0,oZ.jsx)(oK.Kq,{space:2,padding:2,children:(0,oZ.jsx)(oK.xv,{as:"p",children:(0,oZ.jsx)(uz,{t:c,i18nKey:"inputs.reference.cross-dataset.invalid-type",values:{typeName:p||"unknown"},components:{JsonValue:()=>(0,oZ.jsx)("pre",{children:JSON.stringify(i,null,2)})}})})}):(0,oZ.jsx)(TB,{availability:s.result.availability,hasStudioUrl:l,showStudioUrlIcon:o,preview:s.result.preview,refType:h,projectId:d,dataset:a.dataset,id:i._ref,showTypeLabel:u})}var TW=Object.freeze,TY=Object.defineProperty,TX=(e,n)=>TW(TY(e,"raw",{value:TW(n||e.slice())}));let TG=(0,oV.ZP)(lr.J2)(n3||(n3=TX(["\n  & > div {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n  }\n"]))),TJ=(0,oV.ZP)(oK.xv)(n4||(n4=TX(["\n  word-break: break-word;\n"]))),TQ=["top-start","bottom-start"],T0=(0,oN.forwardRef)(function(e,n){let{searchString:r,loading:i,portalRef:a,referenceElement:o,...l}=e,{t:s}=dV(),c=e.options&&e.options.length>0,d=(0,oN.useCallback)((e,n)=>{let{content:l,hidden:d,inputElement:u,onMouseEnter:p,onMouseLeave:h}=e;return(0,oZ.jsx)(TG,{"data-testid":"autocomplete-popover",placement:"bottom-start",fallbackPlacements:TQ,arrow:!1,constrainSize:!0,onMouseEnter:p,onMouseLeave:h,content:(0,oZ.jsx)("div",{ref:n,children:c?l:(0,oZ.jsx)(oK.xu,{padding:4,children:(0,oZ.jsx)(oK.kC,{align:"center",height:"fill",justify:"center",children:(0,oZ.jsx)(TJ,{align:"center",muted:!0,children:(0,oZ.jsx)(uz,{t:s,i18nKey:"inputs.reference.n
1o-results-for-query",values:{searchTerm:r||""}})})})})}),open:!i&&!d,ref:a,portal:!0,referenceElement:o||u,matchReferenceWidth:!0})},[c,s,r,i,a,o]);return(0,oZ.jsx)(oK.F2,{...l,ref:n,renderPopover:d})});function T1(e){let{value:n,onClearValue:r}=e,i=(0,oN.useMemo)(()=>!!(null==n?void 0:n._ref),[null==n?void 0:n._ref]),{t:a}=dV(),o=(0,oZ.jsx)(uz,{t:a,i18nKey:"inputs.reference.cross-dataset.feature-disabled-description",components:{DocumentationLink:e=>{let{children:n}=e;return(0,oZ.jsx)("a",{href:"https://www.sanity.io/docs/cross-dataset-references",target:"_blank",rel:"noreferrer",children:n})}}});return(0,oZ.jsxs)(oK.Zb,{tone:"caution",padding:4,border:!0,radius:2,"data-testid":"alert-cross-dataset-reference-feature-disabled",children:[(0,oZ.jsxs)(oK.kC,{gap:4,marginBottom:i?4:void 0,children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(lp.foC,{})})}),(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{as:"h2",size:1,weight:"medium",children:a("inputs.reference.cross-dataset.feature-unavailable-title")}),i&&(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{as:"p",size:1,children:o}),(0,oZ.jsx)(oK.xv,{as:"p",size:1,children:a("inputs.reference.cross-dataset.feature-disabled-actions")})]}),!i&&(0,oZ.jsx)(oK.xv,{as:"p",size:1,children:o})]})]}),r&&i&&(0,oZ.jsx)(lr.zx,{icon:lp.X5P,mode:"ghost",onClick:r,text:a("inputs.reference.action.clear"),width:"fill"})]})}let T2={hits:[],isLoading:!1},T3=()=>!0,T4=["_ref"];function T5(e){var n,r;let{changed:i,focused:a,focusPath:o,getReferenceInfo:l,onChange:s,onPathFocus:c,onSearch:d,path:u,readOnly:p,schemaType:h,validation:f,value:m,elementProps:g}=e,{t:x}=dV(),v=TU(),[y,b]=(0,oN.useState)(T2),j=(0,oN.useCallback)(e=>{if(!e){s(fM()),c([]);return}if(!y.hits.find(n=>n.id===e))throw Error("Selected an item that wasnt part of the result set");s(fz({_type:h.name,_ref:dm(e),_projectId:v,_dataset:h.dataset,_weak:h.weak,_key:null==m?void 0:m._key})),c([])},[null==m?void 0:m._key,y.hits,h.name,h.dataset,h.weak,v,s,c]),w=(0,oN.useCallback)(()=>{s(fM())},[s]),k=(0,oN.useCallback)(e=>{"Escape"===e.key&&(null==c||c([]))},[c]),C=(0,oN.useCallback)(e=>l(e,h),[l,h]),_=TN((0,oN.useMemo)(()=>({_id:null==m?void 0:m._ref}),[null==m?void 0:m._ref]),C),T=hY("crossDatasetReferences"),S=(0,oN.useRef)(null),E=1===o.length&&"_ref"===o[0],P=g.ref;fV({hasFocusAt:E,ref:null==m?void 0:m._ref},(e,n)=>{var r;let i=(null==e?void 0:e.ref)!==n.ref;((null==e?void 0:e.hasFocusAt)!==n.hasFocusAt||i)&&n.hasFocusAt&&(null==(r=P.current)||r.focus())});let O=(null==m?void 0:m._weak)?"weak":"strong",A=!0===h.weak?"weak":"strong",I=!!(null==m?void 0:m._ref),z=(0,oN.useCallback)(()=>{s(!0===h.weak?fz(!0,["_weak"]):fM(["_weak"]))},[s,h]),{push:M}=(0,oK.pm)(),R=(0,oN.useMemo)(()=>f.filter(e=>"error"===e.level),[f]),F=(0,oN.useCallback)(e=>{e.currentTarget===g.ref.current&&(null==c||c([o2.Zg]))},[g.ref,c]),D=(0,oN.useCallback)(e=>{e.currentTarget===g.ref.current&&(null==c||c(T4))},[g.ref,c]),q=(0,oN.useCallback)(()=>{null==c||c(T4)},[c]),Z=(0,oN.useId)(),N=(0,oR.W2)(e=>e.pipe((0,a2.h)(dd),(0,aX.x)(),(0,a$.w)(e=>(0,ox.z)((0,og.of)({isLoading:!0}),d(e).pipe((0,aW.U)(n=>({hits:n,searchString:e,isLoading:!1})),(0,aG.K)(e=>(M({title:"Reference search failed",description:e.message,status:"error",id:"reference-search-fail-".concat(Z)}),console.error(e),(0,og.of)({hits:[]})))))),(0,aY.R)((e,n)=>({...e,...n}),T2),(0,a4.b)(b)),[Z,d,M]),L=(0,oN.useCallback)(()=>{N("")},[N]),V=!_.isLoading&&I&&O!==A,K=(null==m?void 0:m._ref)&&(null==(r=h.studioUrl)?void 0:r.call(h,{id:null==m?void 0:m._ref,type:null==(n=null==_?void 0:_.result)?void 0:n.type}))||null,B=(0,oN.useCallback)(e=>(0,oZ.jsx)(uY,{as:"button",type:"button",radius:2,children:(0,oZ.jsx)(oK.xu,{paddingX:3,paddingY:1,children:(0,oZ.jsx)(TH,{referenceType:h,document:e.hit.published,getReferenceInfo:C})})}),[h,C]),U=E||!(null==m?void 0:m._ref),H=(0,oN.useRef)(null),$=(0,oN.useRef)(null);return fK([H,$,(0,oN.useRef)(null)],()=>{E&&c([])}),(0,oZ.jsxs)(oZ.Fragment,{children:[!T.isLoading&&!T.enabled&&(0,oZ.jsx)(T1,{value:m,onClearValue:w}),(T.isLoading||T.enabled)&&(0,oZ.jsx)(oK.Kq,{space:1,children:U?(0,oZ.jsx)(oK.Kq,{space:2,ref:H,children:(0,oZ.jsx)(dQ,{path:u,isChanged:i,hasFocus:!!a,children:(0,oZ.jsx)("div",{ref:S,children:(0,oZ.jsx)(T0,{...g,"data-testid":"autocomplete",loading:y.isLoading,referenceElement:S.current,portalRef:$,id:Z||"",options:y.hits.map(e=>({value:e.id,hit:e})),onFocus:D,radius:2,placeholder:x("inputs.reference.search-placeholder"),onKeyDown:k,readOnly:p,disabled:_.isLoading,onQueryChange:N,searchString:y.searchString,onChange:j,filterOption:T3,renderOption:B,openButton:{onClick:L}})})})}):(0,oZ.jsx)(dQ,{path:u,isChanged:i,hasFocus:!!a,children:(0,oZ.jsxs)(oK.Zb,{padding:0,border:!0,flex:1,radius:1,tone:p?"transparent":_.error||R.length>0?"critical":"default",children:[(0,oZ.jsxs)(oK.kC,{align:"center",padding:1,children:[K?(0,oZ.jsx)(uY,{as:"a",target:"_blank",rel:"noopener noreferrer",href:K,"data-as":"a",flex:1,padding:1,paddingRight:3,radius:2,tone:"inherit",__unstable_focusRing:!0,tabIndex:0,onFocus:
1F,ref:g.ref,children:(0,oZ.jsx)(T$,{value:m,referenceInfo:_,showStudioUrlIcon:!0,hasStudioUrl:!!K,type:h})}):(0,oZ.jsx)(uY,{flex:1,padding:1,paddingRight:3,radius:2,tone:"inherit",__unstable_focusRing:!0,tabIndex:0,onFocus:F,ref:g.ref,children:(0,oZ.jsx)(T$,{value:m,referenceInfo:_,showStudioUrlIcon:!0,type:h})}),(0,oZ.jsx)(oK.gF,{paddingX:1,children:(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(bA,{"data-testid":"menu-button"}),id:"".concat(Z,"-menuButton"),menu:(0,oZ.jsx)(oK.v2,{children:!p&&(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(lr.sN,{text:x("inputs.reference.action.clear"),tone:"critical",icon:lp.X5P,"data-testid":"menu-item-clear",onClick:w}),(0,oZ.jsx)(lr.sN,{text:x("inputs.reference.action.replace"),icon:lp.bnu,"data-testid":"menu-item-replace",onClick:q})]})}),placement:"right",popover:{portal:!0,tone:"default"}})})]}),V&&(0,oZ.jsx)(jO,{actualStrength:O,handleFixStrengthMismatch:z}),_.error&&(0,oZ.jsx)(jA,{errorMessage:_.error.message,onHandleRetry:_.retry})]})})})]})}let T8={available:!0,reason:"READABLE"},T6={available:!1,reason:"PERMISSION_DENIED"},T9={available:!1,reason:"NOT_FOUND"},T7=(0,oN.createContext)(null);function Se(e){let{children:n,workspace:r}=e;return(0,oZ.jsx)(T7.Provider,{value:r,children:n})}function St(){let e=(0,oN.useContext)(T7);if(!e)throw Error("Workspace: missing context value");return e}let Sn={isLoading:!0,settings:{partialIndexSettings:{maxFieldDepth:0}}},Sr=new Map;function Si(e){var n,r,i,a;let o=null==(r=null==(n=St().search)?void 0:n.unstable_partialIndexing)?void 0:r.enabled,l=hN(h$),s=(0,oN.useMemo)(()=>e||l,[e,l]),c=(0,oN.useMemo)(()=>s.config().dataset,[s]);o||Sr.set(c,(0,og.of)(Sn.settings)),Sr.has(c)||Sr.set(c,(function(e){let{client:n}=e,{projectId:r,dataset:i}=n.config();return n.observable.request({uri:"/projects/".concat(r,"/datasets/").concat(i,"/index-settings"),tag:"search.getPartialIndexSettings"})})({client:s}).pipe((0,aJ.d)()));let d=(0,oR.m2)(()=>Sr.get(c).pipe((0,aW.U)(e=>({isLoading:!1,settings:e})),(0,a3.O)(Sn),(0,aG.K)(e=>(console.error(e),(0,og.of)({isLoading:!1,enabled:!0,settings:{partialIndexSettings:{maxFieldDepth:0}}})))),[c],Sn),u=null==(a=null==(i=null==d?void 0:d.settings)?void 0:i.partialIndexSettings)?void 0:a.maxFieldDepth;return oD()(u)?Math.min(u,oq.XV):oq.XV}async function Sa(e,n,r,i){if(!e)return{};if("function"==typeof e.filter){let a=r.slice(0,-1),o=(0,o2.U2)(n,a);return await e.filter({document:n,parentPath:a,parent:o,getClient:i})}return{filter:e.filter,params:"filterParams"in e?e.filterParams:void 0}}async function So(e,n,r,i){if(!e)return{};if("function"==typeof e.filter){let a=r.slice(0,-1),o=o2.U2(n,a);return e.filter({document:n,parentPath:a,parent:o,getClient:i})}return{filter:e.filter,params:"filterParams"in e?e.filterParams:void 0}}function Sl(e){var n,r,i,a;let{path:o,schemaType:l}=e,s=RA(),c=s.getClient(h$),d=h1(),u=z8(),p=Si(),h=(0,oN.useMemo)(()=>c.withConfig({apiVersion:"2021-03-25"}),[c]),{EditReferenceLinkComponent:f,onEditReference:m,activePath:g,initialValueTemplateItems:x}=v2(),v=function(e){let n=(0,oN.useRef)(e);return n.current=e,n}(vc([])),y=null==(n=v.current)?void 0:n._type,b=(0,oN.useMemo)(()=>{var e;return null==(e=d.get(y))?void 0:e.liveEdit},[y,d]),j=(null==(r=l.options)?void 0:r.disableNew)===!0,w=s.getClient,k=(0,oN.useCallback)(e=>(0,ob.D)(So(l.options,v.current,o,w)).pipe((0,aQ.z)(n=>{let{filter:r,params:i}=n;return fP(h,e,l,{...l.options,filter:r,params:i,tag:"search.reference",maxFieldDepth:p})}),(0,aG.K)(e=>{var n;let r=e.details&&"queryParseError"===e.details.type;return(null==(n=l.options)?void 0:n.filter)&&r&&(e.message='Invalid reference filter, please check the custom "filter" option'),(0,o_._)(e)})),[v,o,h,l,p,w]),C=null==(a=null==(i=e.value)?void 0:i._strengthenOnPublish)?void 0:a.template,_=(0,oN.useMemo)(()=>(0,oN.forwardRef)(function(e,n){return f?(0,oZ.jsx)(f,{...e,ref:n,parentRefPath:o,template:C}):null}),[f,o,C]),T=(0,oN.useCallback)(e=>{null==m||m({parentRefPath:o,id:e.id,type:e.type,template:e.template})},[m,o]);return{selectedState:o2.Ny(o,(null==g?void 0:g.path)||[])?null==g?void 0:g.state:"none",handleSearch:k,isCurrentDocumentLiveEdit:b,handleEditReference:T,EditReferenceLink:_,createOptions:(0,oN.useMemo)(()=>j?[]:(x||[]).filter(e=>l.to.some(n=>{var r;return n.name===(null==(r=e.template)?void 0:r.schemaType)})).map(e=>{var n;return(null==(n=e.template)?void 0:n.schemaType)?{id:e.id,title:e.title||"".concat(e.template.schemaType," from template ").concat(e.template.id),type:e.template.schemaType,icon:e.icon,template:{id:e.template.id,params:e.parameters},permission:{granted:e.granted,reason:e.reason}}:void 0}).filter(dd),[j,x,l.to]),getReferenceInfo:(0,oN.useCallback)(e=>fE(u,e,l),[u,l])}}function Ss(e){let{getReferenceInfo:n,id:r,renderPreview:i}=e,{isLoading:a,result:o,error:l}=b9(r,n),{t:s}=dV();if(a)return(0,oZ.jsxs)(oK.Kq,{space:2,padding:1,children:[(0,oZ.jsx)(oK.Qr,{style:{maxWidth:320},radius:1,animated:!0}),(0,oZ.jsx)(oK.Qr,{style:{maxWidth:200},radius:1,size:1,animated:!0})]});if(l)return(0,oZ.jsx)(oK.Kq,{space:2,padding:1,children:(0,oZ.jsx)(fN,{title:s("inputs.reference.error.failed-to-load-document-title"),children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:l.message})})});if(!o)return null;if("PERMISSION_DENIED"===o.availability.reason)return(0,oZ.jsx)(oK.Kq,{space:2,padding:1,children:s("inputs.reference.error.missing-read-permissions-description")});let c=e.type.to.find(e=>e.name===o.type);return c?o&&c&&(0,oZ.jsx)(jl,{id:o.id,layout:"default",preview:o.preview,refType:c,renderPreview:i,showTypeLabel:e.type.to.length>1}):(0,oZ.jsx)(oK.Kq,{space:2,padding:1,children:s("inputs.reference.error.invali
1d-search-result-type-title",{returnedType:o.type})})}let Sc={display:"inline-flex"},Sd={width:"100%"},Su={portal:!0,tone:"default",constrainSize:!0,fallbackPlacements:["bottom","left","top"],placement:"right",preventOverflow:!0};function Sp(e){let{createOptions:n,onCreate:r,id:i,menuRef:a,...o}=e,l=hK(),{t:s}=dV(),c=uG(n);return n.some(e=>e.permission.granted)?n.length>1?(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(lr.zx,{...o,disabled:e.readOnly,text:s("inputs.reference.action.create-new-document-select"),mode:"ghost",icon:lp.dtP,size:"large"}),id:i,menu:(0,oZ.jsx)(oK.v2,{ref:a,children:n.map(e=>(0,oZ.jsx)(lr.u,{disabled:e.permission.granted,content:(0,oZ.jsx)(uR,{currentUser:l,context:"create-document-type"}),portal:!0,children:(0,oZ.jsx)("div",{children:(0,oZ.jsx)(lr.sN,{disabled:!e.permission.granted,icon:e.icon,text:c(e).title,onClick:()=>r(e)})})},e.id))}),popover:Su}):(0,oZ.jsx)(lr.zx,{...o,text:s("inputs.reference.action.create-new-document-select"),mode:"ghost",disabled:!n[0].permission.granted||e.readOnly,onClick:()=>r(n[0]),icon:lp.dtP,size:"large"}):(0,oZ.jsx)(lr.u,{content:(0,oZ.jsx)(uR,{currentUser:l,context:"create-new-reference"}),children:(0,oZ.jsx)("div",{style:Sc,children:(0,oZ.jsx)(lr.zx,{text:s("inputs.reference.action.create-new-document"),mode:"ghost",disabled:!0,icon:lp.dtP,style:Sd})})})}var Sh=Object.freeze,Sf=Object.defineProperty,Sm=(e,n)=>Sh(Sf(e,"raw",{value:Sh(n||e.slice())}));let Sg=(0,oV.ZP)(lr.J2)(n5||(n5=Sm(["\n  & > div {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n  }\n"]))),Sx=(0,oV.ZP)(oK.xv)(n8||(n8=Sm(["\n  word-break: break-word;\n"]))),Sv=["top-start","bottom-start"],Sy=(0,oN.forwardRef)(function(e,n){let{searchString:r,loading:i,portalRef:a,referenceElement:o,...l}=e,{t:s}=dV(),c=e.options&&e.options.length>0,d=(0,oN.useCallback)((e,n)=>{let{content:l,hidden:d,inputElement:u,onMouseEnter:p,onMouseLeave:h}=e;return(0,oZ.jsx)(Sg,{placement:"bottom-start",fallbackPlacements:Sv,arrow:!1,constrainSize:!0,onMouseEnter:p,onMouseLeave:h,content:(0,oZ.jsx)("div",{ref:n,children:c?l:(0,oZ.jsx)(oK.xu,{padding:4,children:(0,oZ.jsx)(oK.kC,{align:"center",height:"fill",justify:"center",children:(0,oZ.jsx)(Sx,{align:"center",muted:!0,children:(0,oZ.jsx)(uz,{t:s,i18nKey:"inputs.reference.no-results-for-query",values:{searchTerm:r||""}})})})})}),open:!i&&!d,ref:a,portal:!0,referenceElement:o||u,matchReferenceWidth:!0})},[c,s,r,i,a,o]);return(0,oZ.jsx)(oK.F2,{...l,loading:i,ref:n,renderPopover:d})});var Sb=Object.freeze,Sj=Object.defineProperty,Sw=(e,n)=>Sb(Sj(e,"raw",{value:Sb(n||e.slice())}));let Sk=(0,oV.iv)(n6||(n6=Sw(["\n  grid-template-columns: minmax(0px, 1fr);\n"]))),SC=(0,oV.iv)(n9||(n9=Sw(["\n  grid-template-columns: 1fr min-content;\n"]))),S_=(0,oV.ZP)(oK.rj)(e=>e.$narrow?Sk:SC),ST=(0,oN.forwardRef)(function(e,n){let[r,i]=(0,oN.useState)(null),a=(0,oN.useCallback)(e=>{"function"==typeof n?n(e):n&&(n.current=e),i(e)},[n]),o=(0,oK.XL)(r);return(0,oZ.jsx)(S_,{ref:a,gap:1,$narrow:480>((null==o?void 0:o.width)||0),children:e.children})});var SS=Object.freeze,SE=Object.defineProperty;let SP=(0,oV.ZP)(uY)(n7||(n7=SS(SE(V=["\n  /* this is a hack to avoid layout jumps while previews are loading\n  there's probably better ways of solving this */\n  min-height: 36px;\n"],"raw",{value:SS(V.slice())})))),SO={hits:[],isLoading:!1},SA=()=>!0;function SI(e){return null!==e}function Sz(e){var n,r,i,a,o,l;let{createOptions:s,onChange:c,onEditReference:d,onSearch:u,schemaType:p,readOnly:h,id:f,onPathFocus:m,value:g,renderPreview:x,path:v,elementProps:y,focusPath:b}=e,{getReferenceInfo:j}=Sl({path:v,schemaType:p,value:g}),[w,k]=(0,oN.useState)(SO),C=(0,oN.useCallback)(e=>{let n=(0,sN.Z)();c([fA({}),fz(p.name,["_type"]),fz(n,["_ref"]),fz(!0,["_weak"]),fz({type:e.type,weak:p.weak,template:e.template},["_strengthenOnPublish"])].filter(dd)),d({id:n,type:e.type,template:e.template}),m([])},[c,d,m,p]),_=(0,oN.useCallback)(e=>{if(!e){c(fM()),m([]);return}let n=w.hits.find(n=>n.id===e);if(!n)throw Error("Selected an item that wasnt part of the result set");c([fA({}),fz(p.name,["_type"]),fz(dm(e),["_ref"]),n.published&&!p.weak?fM(["_weak"]):fz(!0,["_weak"]),n.published?fM(["_strengthenOnPublish"]):fz({type:null==n?void 0:n.type,weak:p.weak},["_strengthenOnPublish"])].filter(dd)),m([])},[c,m,p.name,p.weak,w.hits]),T=(0,oN.useCallback)(()=>{c(fM())},[c]),S=(0,oN.useCallback)(()=>{(null==g?void 0:g._ref)||T()},[T,null==g?void 0:g._ref]),E=(0,oN.useCallback)(e=>{"Escape"===e.key&&m([])},[m]),P=b9(null==g?void 0:g._ref,j),O=(0,oN.useRef)(null),{push:A}=(0,oK.pm)(),{t:I}=dV(),z=(0,oR.W2)(e=>e.pipe((0,a2.h)(SI),(0,a$.w)(e=>(0,ox.z)((0,og.of)({isLoading:!0}
1),u(e).pipe((0,aW.U)(n=>({hits:n,searchString:e,isLoading:!1})),(0,aG.K)(e=>(A({title:I("inputs.reference.error.search-failed-title"),description:e.message,status:"error",id:"reference-search-fail-".concat(f)}),console.error(e),(0,og.of)({hits:[]})))))),(0,aY.R)((e,n)=>({...e,...n}),SO),(0,a4.b)(k)),[f,u,A,I]),M=(0,oN.useCallback)(()=>{z("")},[z]),R=(0,oN.useCallback)(e=>{"Escape"===e.key&&m([])},[m]),F=(0,oN.useCallback)(e=>{var n,r;let i=(null==(n=e.hit.draft)?void 0:n._id)||(null==(r=e.hit.published)?void 0:r._id)||e.value;return(0,oZ.jsx)(SP,{forwardedAs:"button",type:"button",radius:2,tone:"inherit",children:(0,oZ.jsx)(Ss,{getReferenceInfo:j,id:i,renderPreview:x,type:p})})},[p,j,x]),D=(0,oN.useCallback)(()=>{var e,n,r,i;return(null==(n=null==(e=P.result)?void 0:e.preview.draft)?void 0:n.title)||(null==(i=null==(r=P.result)?void 0:r.preview.published)?void 0:i.title)||""},[null==(r=null==(n=P.result)?void 0:n.preview.draft)?void 0:r.title,null==(a=null==(i=P.result)?void 0:i.preview.published)?void 0:a.title]),q=(0,oN.useCallback)(()=>m(["_ref"]),[m]),Z=(0,oN.useCallback)(n=>{var r;(null==(r=O.current)?void 0:r.contains(n.relatedTarget))||e.elementProps.onBlur(n)},[e.elementProps]),N=(null==(l=null==(o=null==P?void 0:P.result)?void 0:o.availability)?void 0:l.reason)==="NOT_FOUND"&&!(null==g?void 0:g._strengthenOnPublish)&&(null==g?void 0:g._weak);fV((null==b?void 0:b[0])==="_ref",(e,n)=>{var r;!e&&n&&(null==(r=y.ref.current)||r.focus())});let L=(0,oN.useMemo)(()=>w.hits.map(e=>({value:e.id,hit:e})),[w.hits]),V=1===b.length&&"_ref"===b[0],{menuRef:K,containerRef:B}=(0,oN.useContext)(jg)||{menuRef:{current:null},containerRef:{current:null}},U=(0,oN.useRef)(null),H=(0,oN.useRef)(null),$=(0,oN.useRef)(null);return fK([B,U,H,$,K],()=>{V&&S()}),(0,oZ.jsx)(oK.Kq,{space:1,"data-testid":"reference-input",ref:U,children:(0,oZ.jsxs)(oK.Kq,{space:2,children:[N?(0,oZ.jsx)(fN,{"data-testid":"alert-nonexistent-document",title:I("inputs.reference.error.nonexistent-document-title"),suffix:(0,oZ.jsx)(oK.Kq,{padding:2,children:(0,oZ.jsx)(lr.zx,{text:I("inputs.reference.error.nonexistent-document.clear-button-label"),onClick:T})}),children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(uz,{i18nKey:"inputs.reference.error.nonexistent-document-description",t:I,values:{documentId:g._ref}})})}):null,(0,oZ.jsxs)(ST,{ref:O,children:[(0,oZ.jsx)(Sy,{...y,onFocus:q,onBlur:Z,"data-testid":"autocomplete",loading:w.isLoading,referenceElement:O.current,options:L,radius:2,placeholder:I("inputs.reference.search-placeholder"),onKeyDown:E,readOnly:P.isLoading||h,onQueryChange:z,searchString:w.searchString,onChange:_,filterOption:SA,renderOption:F,renderValue:D,openButton:{onClick:M},portalRef:H,value:null==g?void 0:g._ref}),s.length>0&&(0,oZ.jsx)(Sp,{id:"".concat(f,"-selectTypeMenuButton"),readOnly:h,createOptions:s,onCreate:C,onKeyDown:R,menuRef:$})]})]})})}async function SM(e,n,r,i){if(!e)return{};if("function"==typeof e.filter){let a=r.slice(0,-1),o=(0,o2.U2)(n,a);return await e.filter({document:n,parentPath:a,parent:o,getClient:i})}return{filter:e.filter,params:"filterParams"in e?e.filterParams:void 0}}function SR(e){var n,r,i,a;let o=RA(),l=o.getClient(h$),s=h1(),c=Si(),d=z8(),{path:u,schemaType:p}=e,{EditReferenceLinkComponent:h,onEditReference:f,activePath:m,initialValueTemplateItems:g}=v2(),x=function(e){let n=(0,oN.useRef)(e);return n.current=e,n}(vc([])),v=null==(n=x.current)?void 0:n._type,y=s.get(v),b=(0,oN.useMemo)(()=>null==y?void 0:y.liveEdit,[y]),j=(null==(r=p.options)?void 0:r.disableNew)===!0,w=o.getClient,k=(0,oN.useCallback)(e=>(0,ob.D)(SM(p.options,x.current,u,w)).pipe((0,aQ.z)(n=>{let{filter:r,params:i}=n;return fP(l,e,p,{...p.options,filter:r,params:i,tag:"search.reference",maxFieldDepth:c})}),(0,aG.K)(e=>{var n;let r=e.details&&"queryParseError"===e.details.type;return(null==(n=p.options)?void 0:n.filter)&&r&&(e.message='Invalid reference filter, please check the custom "filter" option'),(0,o_._)(e)})),[x,u,l,p,c,w]),C=null==(a=null==(i=e.value)?void 0:i._strengthenOnPublish)?void 0:a.template,_=(0,oN.useMemo)(()=>(0,oN.forwardRef)(function(e,n){return h?(0,oZ.jsx)(h,{...e,ref:n,parentRefPath:u,template:C}):null}),[h,u,C]),T=(0,oN.useCallback)(e=>{null==f||f({parentRefPath:u,id:e.id,type:e.type,template:e.template})},[f,u]),S=o2.Ny(u,(null==m?void 0:m.path)||[])?null==m?void 0:m.state:"none",E=(0,oN.useMemo)(()=>j?[]:(g||[]).filter(e=>p.to.some(n=>{var r;return n.name===(null==(r=e.template)?void 0:r.schemaType)})).map(e=>{var n,r,i;return(null==(n=e.template)?void 0:n.schemaType)?{id:e.id,title:e.title||"".concat(e.template.schemaType," from template ").concat(null==(r=e.template)?void 0:r.id),i18n:e.i18n,type:e.template.schemaType,icon:e.icon,template:{id:null==(i=e.template)?void 0:i.id,params:e.parameters},permission:{granted:e.granted,reason:e.reason}}:void 0}).filter(dd),[j,g,p.to]),P=(0,oN.useCallback)((e,n)=>fE(d,e,n),[d]);return(0,oZ.jsx)(Sz,{...e,onSearch:k,liveEdit:b,getReferenceInfo:P,
1selectedState:S,editReferenceLinkComponent:_,createOptions:E,onEditReference:T})}function SF(e){return(0,ll.m$)(e.schemaType)}function SD(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if("object"!=typeof e&&!Array.isArray(e))return e===n;if(e._key&&e._key===n._key)return!0;if(Array.isArray(e))return!e.length===n.length&&e.every((r,i)=>SD(e[i],n[i]));let r=Object.keys(e),i=Object.keys(e);return r.length===i.length&&r.every(r=>SD(e[r],n[r]))}function Sq(e,n){return!!e&&e.some(e=>SD(e,n))}let SZ=[];function SN(e){var n,r;let{renderPreview:i,schemaType:a,onChange:o,onPathFocus:l,value:s=[],readOnly:c,elementProps:d,path:u,changed:p}=e,h=(0,oN.useMemo)(()=>{var e;return((null==(e=a.options)?void 0:e.list)||SZ).map((e,n)=>(0,ll.fU)(e)?e:{...e,_key:"auto-generated-".concat(n)})},[null==(n=a.options)?void 0:n.list]),f=(0,oN.useCallback)((e,n)=>{if(!e&&(0,ll.fU)(n)){o(fM([{_key:n._key}]));return}let r=h.filter(r=>SD(n,r)?e:Sq(s,r));o(r.length>0?fz(r):fM())},[o,h,s]),m=(0,oN.useCallback)(e=>{l([e])},[l]),g=(null==(r=a.options)?void 0:r.layout)==="grid";return(0,oZ.jsx)(dQ,{path:u,isChanged:p,hasFocus:!1,children:(0,oZ.jsx)(oK.rj,{gap:2,columns:g?Math.min(h.length,4):1,tabIndex:0,...d,children:h.map((e,n)=>{let r=a.of.find(n=>n.name===(0,sL.wq)(e)),o=Sq(s,e),l=!r;return(0,oZ.jsxs)(oK.kC,{align:"center",as:"label",muted:l,children:[(0,oZ.jsx)(oK.XZ,{disabled:l,checked:o,onChange:n=>f(n.currentTarget.checked,e),onFocus:()=>m(n),readOnly:c}),(0,oZ.jsx)(oK.xu,{flex:1,marginLeft:2,children:r?i({layout:"default",schemaType:r,value:e}):(0,oZ.jsx)(oK.Zb,{tone:"caution",radius:2,children:(0,oZ.jsx)(wM,{value:e,onFocus:()=>m(n)})})})]},n)})})})}var SL=Object.freeze,SV=Object.defineProperty;let SK=(0,oV.ZP)(oK.Zb)(re||(re=SL(SV(K=["\n  max-width: ","px;\n"],"raw",{value:SL(K.slice())}))),e=>{let{theme:n}=e;return n.sanity.container[1]});function SB(e){let{value:n,onFocus:r,vertical:i,...a}=e,[o,l]=oN.useState(!1),[s,c]=oN.useState(null),{t:d}=dV();(0,oK.O8)(()=>l(!1),[s]);let u=oN.useCallback(e=>{("Escape"===e.key||"Tab"===e.key)&&l(!1)},[]),p=(0,oN.useCallback)(()=>{l(e=>!e)},[]),h=(0,sL.wq)(n);return(0,oZ.jsx)(lr.J2,{open:o,ref:c,onKeyDown:u,portal:!0,constrainSize:!0,tone:"default",content:(0,oZ.jsx)(SK,{margin:1,padding:3,onKeyDown:u,tabIndex:0,overflow:"auto",children:(0,oZ.jsxs)(oK.Kq,{space:4,children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{weight:"medium",children:d("inputs.array.error.type-is-incompatible-title")})}),(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(uz,{t:d,i18nKey:"inputs.array.error.current-schema-not-declare-description",values:{typeName:h}})}),(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsxs)(oK.xv,{size:1,children:[(0,oZ.jsx)(lp.sLo,{})," ",d("inputs.array.error.can-delete-but-no-edit-description")]})}),(0,oZ.jsxs)(oK.Kq,{space:2,children:[(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:d("inputs.array.error.json-representation-description")}),(0,oZ.jsx)(oK.Zb,{padding:2,overflow:"auto",border:!0,children:(0,oZ.jsx)(oK.EK,{size:1,as:"pre",language:"json",children:JSON.stringify(n,null,2)})})]})]})}),children:(0,oZ.jsx)(oK.Zb,{as:"button",type:"button",radius:2,tone:"inherit",paddingX:2,paddingY:3,flex:1,onFocus:r,onClick:p,onKeyDown:u,__unstable_focusRing:!0,...a,children:(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(oK.xu,{marginRight:3,children:(0,oZ.jsx)(oK.xv,{children:(0,oZ.jsx)(lp.Tzq,{})})}),(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.xv,{size:1,textOverflow:"ellipsis",children:(0,oZ.jsx)(uz,{t:d,i18nKey:"inputs.array.error.type-is-incompatible-prompt",values:{typeName:h}})})})]})})})}function SU(e){var n,r;let{schemaType:i,onChange:a,value:o=[],readOnly:l,path:s,changed:c,onIndexFocus:d,elementProps:u}=e,p=(0,oN.useMemo)(()=>{var e;return((null==(e=i.options)?void 0:e.list)||[]).map(e=>e&&"object"==typeof e&&"title"in e&&"value"in e?{title:e.title||lf()(String(e.value)),value:e.value}:{title:lf()(String(e)),value:e})},[null==(n=i.options)?void 0:n.list]),h=(e,n)=>{let r=p.map(e=>e.value).filter(r=>r===n?e:o.includes(r));a(r.length>0?fz(r):fM())},f=(null==(r=i.options)?void 0:r.layout)==="grid";return(0,oZ.jsx)(dQ,{path:s,isChanged:c,hasFocus:!1,children:(0,oZ.jsx)(oK.rj,{gap:2,columns:f?Math.min(p.length,4):1,...u,children:p.map((e,n)=>{let r=i.of.find(n=>n.name===(0,sL.wq)(e.value)),a=o.includes(e.value),s=!r;return(0,oZ.jsxs)(oK.kC,{align:"center",as:"label",muted:s,children:[(0,oZ.jsx)(oK.XZ,{disabled:s,checked:a,onChange:n=>h(n.currentTarget.checked,e.value),onFocus:()=>d(n),readOnly:l}),(0,oZ.jsx)(oK.xu,{padding:2,children:(0,oZ.jsx)(oK.xv,{children:e.title})}),!r&&(0,oZ.jsx)(SB,{value:e,onFocus:()=>d(n)})]},n)})})})}function SH(e){return(0,ll.M1)(e.schemaType)?(0,oZ.jsx)(SN,{...e}):(0,oZ.jsx)(SU,{...e})}let S$=(0,sB.dS)({version:1,name:"Portable Text Editor expanded",de
1scription:"The portable text editor was expanded"}),SW=(0,sB.dS)({version:1,name:"Portable Text Editor collapsed",description:"The portable text editor was collapsed"});var SY=Object.freeze,SX=Object.defineProperty,SG=(e,n)=>SY(SX(e,"raw",{value:SY(n||e.slice())}));let SJ=oV.ZP.div(rt||(rt=SG(["\n  position: relative;\n"]))),SQ=oV.ZP.div(rn||(rn=SG(["\n  z-index: 13;\n  opacity: 0;\n  transition: opacity 300ms linear;\n"]))),S0=(0,oV.ZP)(oK.Zb)(rr||(rr=SG(["\n  border: 1px solid var(--card-border-color);\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  z-index: 12;\n  transition: opacity 150ms ease-in-out;\n  opacity: 0;\n  box-sizing: border-box;\n"]))),S1=(0,oV.ZP)(oK.kC)(ri||(ri=SG(["\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n\n  &:hover,\n  &:focus {\n    & "," {\n      opacity: 0.9;\n    }\n\n    & "," {\n      opacity: 1;\n    }\n  }\n"])),S0,SQ),S2=()=>"undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&navigator.maxTouchPoints>0;function S3(e){let{children:n,message:r,onActivate:i,isOverlayActive:a}=e,[o,l]=(0,oN.useState)(!1),{t:s}=dV(),c=(0,oN.useCallback)(()=>{i&&i()},[i]),d=(0,oN.useCallback)(e=>{a&&"Space"===e.code&&i&&(e.preventDefault(),i())},[a,i]),u=(0,oN.useCallback)(()=>{l(!0)},[]),p=(0,oN.useCallback)(()=>{l(!1)},[]),h=(0,oN.useMemo)(()=>{let e;e=S2()?"tap":o?"click-focused":"click";let n=r||s("inputs.portable-text.activate-on-focus-message",{context:e});return(0,oZ.jsx)(oK.xv,{weight:"medium",children:n})},[o,r,s]);return(0,oZ.jsxs)(SJ,{onBlur:p,onClick:c,onFocus:u,onKeyDown:d,children:[a&&(0,oZ.jsxs)(S1,{"data-testid":"activate-overlay",tabIndex:0,align:"center",justify:"center",children:[(0,oZ.jsx)(S0,{radius:2}),(0,oZ.jsx)(SQ,{children:h})]}),n]})}var S4=Object.freeze,S5=Object.defineProperty;let S8=oV.ZP.span(ra||(ra=S4(S5(B=["\n  /* Make sure the annotation styling is visible */\n  &[data-mark='code'] {\n    mix-blend-mode: multiply;\n    color: inherit;\n  }\n"],"raw",{value:S4(B.slice())}))));function S6(e){let{value:n,focused:r,selected:i,children:a,schemaType:o}=e,l=k1[n],s=o.component,c=(0,oN.useCallback)(e=>(0,oZ.jsx)(S8,{as:l,"data-mark":n,children:e.children}),[l,n]);return(0,oN.useMemo)(()=>{let e={focused:r,renderDefault:c,schemaType:o,selected:i,title:o.title,value:n};return s?(0,oZ.jsx)(s,{...e,children:a}):(0,oZ.jsx)(c,{...e,children:a})},[s,c,a,r,o,i,n])}let S9={portal:!0,constrainSize:!0},S7=(0,oN.forwardRef)(function(e,n){let{disableRestoreFocusOnClose:r,menuButton:i,menuButtonProps:a,menuOptions:o,onMenuClose:l}=e;return(0,oZ.jsx)(lr.j2,{__unstable_disableRestoreFocusOnClose:r,id:"menu-button",ref:n,onClose:l,popover:S9,...a,button:i,menu:(0,oZ.jsx)(oK.v2,{children:o.map((e,n)=>{let{collapsedProps:r={},expandedProps:i={},tooltipProps:a={},tooltipText:o,dividerBefore:l,fontSize:s,padding:c,text:d,icon:u,selected:p,...h}=e.props;return(0,oZ.jsxs)(oN.Fragment,{children:[l&&0!==n&&(0,oZ.jsx)(oK.R,{}),(0,oZ.jsx)(lr.sN,{text:d,icon:u,pressed:p,...h})]},e.key)})})})});function Ee(e){let{onIntersectionChange:n,children:r,options:i,...a}=e,[o,l]=(0,oN.useState)(null);return(0,oN.useEffect)(()=>{if(!o)return;let e=new IntersectionObserver(n,i);return e.observe(o),()=>{e.unobserve(o),e.disconnect()}},[o,n,i]),(0,oZ.jsx)(oK.kC,{ref:l,...a,children:r})}var Et=Object.freeze,En=Object.defineProperty;let Er=oV.ZP.div(ro||(ro=Et(En(U=["\n  border-right: 1px solid var(--card-border-color);\n  height: auto;\n\n  &[data-hidden] {\n    opacity: 0;\n  }\n"],"raw",{value:Et(U.slice())}))));function Ei(e){let{hidden:n,...r}=e;return(0,oZ.jsx)(Er,{"data-ui":"CollapseMenuDivider","data-hidden":n?"":void 0,...r})}var Ea=Object.freeze,Eo=Object.defineProperty,El=(e,n)=>Ea(Eo(e,"raw",{value:Ea(n||e.slice())}));let Es=(0,oV.iv)(rl||(rl=El(["\n  list-style: none;\n  display: flex;\n  white-space: nowrap;\n\n  &[data-hidden='true'] {\n    opacity: 0;\n    visibility: hidden;\n  }\n"]))),Ec=(0,oV.ZP)(oK.kC)(rs||(rs=El(["\n  padding: ","px;\n  margin: -","px;\n  box-sizing: border-box;\n"])),3,3),Ed=(0,oV.ZP)(oK.kC)(rc||(rc=El(["\n  border-radius: inherit;\n  position: relative;\n"]))),Eu=(0,oV.ZP)(oK.kC)(rd||(rd=El(["\n  width: max-content;\n  &[data-hidden='true'] {\n    visibility: hidden;\n    position: relative;
1\n    margin-top: -1px;\n    height: 1px;\n  }\n"]))),Ep=(0,oV.ZP)(Ee)(ru||(ru=El(["\n  ","\n"])),Es);function Eh(e){return!!e}let Ef=(0,oN.forwardRef)(function(e,n){let{children:r,collapsed:i,disableRestoreFocusOnClose:a,onMenuClose:o,menuButtonProps:l,...s}=e,c=(0,oN.useMemo)(()=>oN.Children.toArray(r).filter(Eh),[r]),d=(0,oN.useMemo)(()=>(null==l?void 0:l.button)||(0,oZ.jsx)(bA,{}),[l]);return i?(0,oZ.jsx)(S7,{ref:n,disableRestoreFocusOnClose:a,menuButton:d,menuButtonProps:l,menuOptions:c,onMenuClose:o}):(0,oZ.jsx)(Em,{...s,ref:n,disableRestoreFocusOnClose:a,menuButtonProps:l,menuOptions:c,onMenuClose:o})}),Em=(0,oN.forwardRef)(function(e,n){let{collapseText:r=!0,disableRestoreFocusOnClose:i,gap:a,menuOptions:o,menuButtonProps:l,onMenuClose:s,...c}=e,[d,u]=(0,oN.useState)(null),[p,h]=(0,oN.useState)({}),[f,m]=(0,oN.useState)({}),g=(0,oN.useMemo)(()=>({root:d,threshold:.99,rootMargin:"2px"}),[d]),x=(0,oN.useMemo)(()=>o.map(e=>e.key),[o]),v=(0,oN.useMemo)(()=>[...cd()(x,Object.keys(p)),...cd()(x,Object.keys(f))],[x,p,f]),y=(0,oN.useMemo)(()=>o.filter(e=>{let n=p[e.key];return n&&!n.intersects}),[p,o]),b=(0,oN.useCallback)((e,n)=>{h(r=>{let i=n.key;if(null===i)throw Error("Expected element to have a non-null key");let a={intersects:e.isIntersecting,element:n},o=r[i];return o&&o.intersects===a.intersects?r:{...r,[i]:a}})},[]),j=(0,oN.useCallback)((e,n)=>{m(r=>{let i=n.key;if(null===i)throw Error("Expected child element to have a non-null key");let a=r[i],o={intersects:e.isIntersecting,element:n};return(null==a?void 0:a.intersects)===o.intersects?r:{...r,[i]:o}})},[]),w=(0,oN.useMemo)(()=>o.map(e=>{let{collapsedProps:n}=e.props,i=r?void 0:e.props.text;return(0,oN.cloneElement)(e,{...n,text:i})}),[o,r]),k=(0,oN.useMemo)(()=>o.filter(e=>{let n=f[e.key];return(null==n?void 0:n.intersects)===!1}),[o,f]),C=y.length>0?w.filter(e=>{let n=f[e.key];return(null==n?void 0:n.intersects)===!0}):o,_=(0,oN.useMemo)(()=>(null==l?void 0:l.button)||(0,oZ.jsx)(bA,{}),[l]);return(0,oZ.jsxs)(Ec,{align:"center","data-ui":"CollapseMenu",overflow:"hidden",sizing:"border",ref:n,...c,children:[(0,oZ.jsxs)(Ed,{direction:"column",flex:1,justify:"center",ref:u,children:[(0,oZ.jsx)(Eu,{gap:a,children:0===v.length&&C.map((e,n)=>{let{dividerBefore:r,tooltipText:i="",tooltipProps:a={}}=e.props,o=!e.key||!(e.key in p)||k.includes(e);return(0,oZ.jsxs)(oN.Fragment,{children:[r&&0!==n&&(0,oZ.jsx)(Ei,{hidden:o}),(0,oZ.jsx)(lr.u,{portal:!0,disabled:!i,content:i,...a,children:(0,oZ.jsx)(oK.kC,{children:(0,oN.cloneElement)(e,{disabled:e.props.disabled||o,"aria-hidden":o})})})]},e.key)})}),(0,oZ.jsx)(Eg,{gap:a,elements:o,intersectionOptions:g,onIntersectionChange:b}),(0,oZ.jsx)(Eg,{gap:a,elements:w,intersectionOptions:g,onIntersectionChange:j})]}),k.length>0&&(0,oZ.jsx)(oK.kC,{marginLeft:a,children:(0,oZ.jsx)(S7,{disableRestoreFocusOnClose:i,menuButton:_,menuButtonProps:l,menuOptions:k,onMenuClose:s})})]})}),Eg=(0,oN.memo)(function(e){let{elements:n,gap:r,intersectionOptions:i,onIntersectionChange:a}=e;return(0,oZ.jsx)(Eu,{"data-hidden":!0,"aria-hidden":"true",gap:r,overflow:"hidden",children:n.map((e,n)=>{let{dividerBefore:r}=e.props;return(0,oZ.jsxs)(oN.Fragment,{children:[r&&0!==n&&(0,oZ.jsx)(Ei,{hidden:!0}),(0,oZ.jsx)(Ep,{options:i,onIntersectionChange:n=>a(n[0],e),children:(0,oZ.jsx)(oK.kC,{children:(0,oN.cloneElement)(e,{disabled:!0,"aria-hidden":!0})})})]},e.key)})})}),Ex=(0,oN.forwardRef)(function(e,n){let{collapsedProps:r={},expandedProps:i={},tooltipProps:a={},tooltipText:o,dividerBefore:l,...s}=e;return(0,oZ.jsx)(lr.zx,{"data-ui":"CollapseMenuButton",...s,ref:n})});var Ev=Object.freeze,Ey=Object.defineProperty;let Eb=oV.ZP.div(rp||(rp=Ev(Ey(H=["\n  width: 1em;\n  height: 1em;\n  border-radius: inherit;\n  background-origin: content-box;\n  background-position: center;\n  background-repeat: no-repeat;\n  background-size: cover;\n  transform: scale(0.7);\n"],"raw",{value:Ev(H.slice())}))));function Ej(e){let{icon:n,active:r}=e,i=(0,oN.useMemo)(()=>({backgroundImage:"url(".concat(n,")"),filter:r?"invert(100%)":"invert(0%)"}),[r,n]);return(0,oZ.jsx)(Eb,{style:i})}function Ew(e,n){let r=lS()(e,"to[0].icon");return e.icon||e.type&&e.type.icon||r||n}let Ek={link:lp.xPt},EC={strong:lp.mY4,em:lp.h32,"strike-through":lp.dwl,underline:lp.Adg,code:lp.dNJ},E_={number:lp.NvX,bullet:lp.AEM};function ET(){let e=(0,sV._F)(),n=(0,sV.L9)();return(0,oN.useMemo)(()=>
1sV.q$.focusBlock(e),[e,n])}let ES=(0,oN.memo)(Ef),EE={constrainSize:!0,portal:!0},EP=(0,oN.memo)(function(e){let{disabled:n,groups:r,isFullscreen:i,collapsed:a}=e,o=ET(),l=(0,sV._F)(),s=(0,sV.L9)(),{t:c}=(0,li.$G)(),d=s&&(0,ll.Fd)(s.anchor.path[0])&&(0,ll.Fd)(s.focus.path[0])?s.anchor.path[0]._key!==(null==s?void 0:s.focus.path[0]._key):(null==s?void 0:s.anchor.path[0])!==(null==s?void 0:s.focus.path[0]),u=(null==o?void 0:o._type)!==l.schemaTypes.block.name,p=!u&&Array.isArray(o.children)&&1===o.children.length&&(null==o?void 0:o.children[0].text)==="",h=n||u,f=(0,oN.useMemo)(()=>r.reduce((e,n)=>e.concat(n.actions.map((e,n)=>0===n?{...e,firstInGroup:!0}:e)),[]),[r]),m=function(e){let{actions:n}=e,r=(0,sV._F)(),i=(0,sV.L9)();return ds((0,oN.useMemo)(()=>{let e=sV.q$.activeAnnotations(r).map(e=>e._type);return n.filter(n=>"annotation"===n.type?e.includes(n.key):"listStyle"===n.type?sV.q$.hasListStyle(r,n.key):sV.q$.isMarkActive(r,n.key)).map(e=>e.key)},[r,i]))}({actions:f}),g=(0,oN.useCallback)(()=>{sV.q$.focus(l)},[l]),x=i?"bottom":"top",v=(0,oN.useMemo)(()=>f.map(e=>{let n="annotation"===e.type&&(p||d),r=p?c("user-menu.action.portable-text.annotation-disabled_empty-block",{name:e.title||e.key}):c("user-menu.action.portable-text.annotation-disabled_multiple-blocks",{name:e.title||e.key}),i=m.includes(e.key);return(0,oZ.jsx)(Ex,{"data-testid":"action-button-".concat(e.key),disabled:h||n,mode:"bleed",dividerBefore:e.firstInGroup,icon:e.icon?"string"==typeof e.icon?(0,oZ.jsx)(Ej,{active:i,icon:e.icon}):e.icon:"annotation"===e.type?Ek[e.key]||lp.Tzq:"listStyle"===e.type?E_[e.key]||lp.Tzq:EC[e.key]||lp.Tzq,onClick:()=>e.handle(i),selected:i,text:e.title||e.key,tooltipText:n?r:e.title||e.key,tooltipProps:{disabled:h,placement:x,portal:"default"}},e.key)}),[f,m,h,p,d,c,x]),y=(0,oN.useMemo)(()=>({button:(0,oZ.jsx)(bA,{"data-testid":"action-menu-button",disabled:h,tooltipProps:{placement:x}}),popover:EE}),[h,x]);return(0,oZ.jsx)(ES,{collapsed:a,disableRestoreFocusOnClose:!0,gap:1,menuButtonProps:y,onMenuClose:g,children:v})});var EO=Object.freeze,EA=Object.defineProperty;let EI=(0,oN.memo)(lr.j2),Ez=(0,oV.ZP)(oK.sN)(rh||(rh=EO(EA($=["\n  // Change the border color variable used by BlockQuote\n  // to make the border visible when the MenuItem is selected\n  &[data-selected] {\n    [data-option='blockquote'] {\n      --card-border-color: var(--card-muted-fg-color);\n    }\n  }\n"],"raw",{value:EO($.slice())})))),EM={constrainSize:!0,placement:"bottom-start",portal:"default"},ER={h1:e=>(0,oZ.jsx)(Cu,{children:e}),h2:e=>(0,oZ.jsx)(Cp,{children:e}),h3:e=>(0,oZ.jsx)(Ch,{children:e}),h4:e=>(0,oZ.jsx)(Cf,{children:e}),h5:e=>(0,oZ.jsx)(Cm,{children:e}),h6:e=>(0,oZ.jsx)(Cg,{children:e}),normal:e=>(0,oZ.jsx)(Cd,{children:e}),blockquote:e=>(0,oZ.jsx)(Cv,{"data-option":"blockquote",children:e})},EF=Object.keys(ER),ED=e=>e.preventDefault(),Eq={key:"style-none",style:"",title:"No style",i18nTitleKey:"inputs.portable-text.style.none"},EZ=(0,oN.memo)(function(e){let{disabled:n,items:r}
1=e,i=(0,sV._F)(),a=ET(),{t:o}=dV(),l=n||!!a&&i.schemaTypes.block.name!==a._type,s=function(e){let{items:n}=e,r=(0,sV._F)(),i=ET(),a=(0,sV.L9)();return ds((0,oN.useMemo)(()=>n.filter(e=>sV.q$.hasBlockStyle(r,e.style)).map(e=>e.style),[i,a]))}({items:r}),{activeItems:c,items:d}=(0,oN.useMemo)(()=>{let e=r.filter(e=>s.includes(e.style)),n=r;return 0===e.length&&n.length>1&&(n=n.concat([Eq]),e.push(Eq)),{activeItems:e,items:n}},[s,r]),u=(0,oN.useMemo)(()=>c.length>1?o("inputs.portable-text.style.multiple"):1!==c.length?Eq.i18nTitleKey?o(Eq.i18nTitleKey):Eq.title:c[0].i18nTitleKey?o(c[0].i18nTitleKey):c[0].title,[c,o]),p=(0,oN.useCallback)(e=>{a&&e.style!==a.style&&(sV.q$.toggleBlockStyle(i,e.style),sV.q$.focus(i))},[i,a]),h=(0,oN.useCallback)((e,n)=>{let r=EF.includes(e),i=ER[e];return r?i(n):(0,oZ.jsx)(oK.xv,{children:n})},[]),f=(0,oN.useMemo)(()=>(0,oZ.jsx)(lr.zx,{disabled:l,iconRight:lp.v4q,justify:"space-between",mode:"bleed",onClick:ED,text:u,width:"fill"}),[l,u]),m=(0,oN.useMemo)(()=>(0,oZ.jsx)(oK.v2,{disabled:l,children:d.map(e=>(0,oZ.jsx)(Ez,{pressed:c.includes(e),onClick:l?void 0:()=>p(e),children:h(e.style,e.i18nTitleKey?o(e.i18nTitleKey):(null==e?void 0:e.title)||e.style)},e.key))}),[l,c,p,d,h,o]);return(0,oZ.jsx)(EI,{popover:EM,id:"block-style-select",button:f,menu:m})}),EN=(0,oN.memo)(Ef),EL={constrainSize:!0,portal:!0},EV=(0,oN.memo)(function(e){let{disabled:n,items:r,isFullscreen:i,collapsed:a}=e,{t:o}=dV(),l=ET(),s=(0,sV._F)(),c=l&&l._type!==s.schemaTypes.block.name,d=(0,oN.useCallback)(()=>{sV.q$.focus(s)},[s]),u=i?"bottom":"top",p=(0,oN.useMemo)(()=>r.map(e=>{let r=e.type.title||cZ()(e.type.name);return(0,oZ.jsx)(Ex,{"aria-label":o(e.inline?"inputs.portable-text.action.insert-inline-object-aria-label":"inputs.portable-text.action.insert-block-aria-label",{typeName:r}),mode:"bleed",disabled:n||c&&!0===e.inline,icon:e.icon,onClick:e.handle,text:r,tooltipText:o(e.inline?"inputs.portable-text.action.insert-inline-object":"inputs.portable-text.action.insert-block",{typeName:r}),tooltipProps:{disabled:n,placement:u,portal:"default"}},e.key)}),[n,c,r,o,u]),h=(0,oN.useMemo)(()=>({button:(0,oZ.jsx)(bA,{"data-testid":"insert-menu-button",disabled:n,tooltipProps:{placement:u}}),popover:EL}),[n,u]);return(0,oZ.jsx)(EN,{collapsed:a,collapseText:!1,disableRestoreFocusOnClose:!0,gap:1,menuButtonProps:h,onMenuClose:d,children:p})});var EK=Object.freeze,EB=Object.defineProperty,EU=(e,n)=>EK(EB(e,"raw",{value:EK(n||e.slice())}));let EH=(0,oV.ZP)(oK.kC)(rf||(rf=EU(["\n  width: 100%;\n"]))),E$=(0,oV.ZP)(oK.xu)(rm||(rm=EU(["\n  width: 8em;\n"]))),EW=(0,oV.ZP)(oK.kC)(rg||(rg=EU(["\n  border-right: 1px solid var(--card-border-color);\n"]))),EY=(0,oV.ZP)(oK.xu)(rv||(rv=EU(["\n  ","\n"])),e=>{let{$withInsertMenu:n}=e;return n&&(0,oV.iv)(rx||(rx=EU(["\n      max-width: max-content;\n      border-right: 1px solid var(--card-border-color);\n    "])))}),EX=(0,oV.ZP)(oK.xu)(ry||(ry=EU(["\n  border-left: 1px solid var(--card-border-color);\n"]))),EG="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),EJ=(0,oN.memo)(function(e){let{actionGroups:n,blockStyles:r,disabled:i,insertMenuItems:a,isFullscreen:o,onToggleFullscreen:l}=e,{t:s}=dV(),c=n.reduce((e,n)=>e+n.actions.length,0),d=a.length>0,[u,p]=(0,oN.useState)(null),h=(0,oK.XL)(u),f=!!h&&(null==h?void 0:h.width)<400,m=r.length>1;K4({rootElement:u});let g=(0,oN.useCallback)(e=>{e.preventDefault()},[]);return(0,oZ.jsxs)(EH,{align:"center",ref:p,onMouseDown:g,children:[m&&(0,oZ.jsx)(EW,{flex:f?1:void 0,children:(0,oZ.jsx)(E$,{padding:o?2:1,children:(0,oZ.jsx)(EZ,{disabled:i,items:r})})}),(0,oZ.jsxs)(oK.kC,{flex:1,children:[c>0&&(0,oZ.jsx)(EY,{flex:f?void 0:1,padding:o?2:1,$withInsertMenu:d,children:(0,oZ.jsx)(EP,{disabled:i,collapsed:f,groups:n,isFullscreen:o})}),d&&(0,oZ.jsx)(oK.xu,{flex:f?void 0:1,padding:o?2:1,children:(0,oZ.jsx)(EV,{disabled:i,collapsed:f,items:a,isFullscreen:o})})]}),(0,oZ.jsx)(EX,{padding:o?2:1,children:(0,oZ.jsx)(lr.zx,{"aria-label":s("inputs.portable-text.action.expand-editor"),icon:o?lp.W5x:lp.Qq,mode:"bleed",onClick:l,tooltipProps:{content:s(o?"inputs.portable-text.action.collapse-editor":"inputs.portable-text.action.expand-editor"),hotkeys:["".concat(EG?"Cmd":"Ctrl"),"Enter"],placement:o?"bottom":"top",portal:"default"}})})]})});function EQ(e){let{hotkeys:n,isFullscreen:r,readOnly:i,onMemberOpen:a,onToggleFullscreen:o}=e,l=(0,sV._F)(),s=(0,sV.L9)(),c=I8(),d=i||!s,{push:u}=(0,oK.pm)(),p=(0,oN.useCallback)(e=>{let n=!1,r=setTimeout(()=>{n=!0,u({id:"resolving-initial-value",status:"info",title:"Resolving initial value…"})},300);return c(e,{}).then(e=>(n&&u({id:"resolving-initial-value",status:"info",duration:500,title:"Initial value resolved"}),e)).catch(n=>{u({title:"Could not resolve initial value",id:"resolving-initial-value",description:"Unable to resolve initial value for type: ".concat(e.name,": ").concat(n.message,"."),status:"error"})}).finally(()=>clearTimeout(r))},[u,c]),h=(0,oN.useCallback)(async e=>{let n=await p(e),r=sV.q$.insertBlock(l,e,n);r&&a(r)},[l,a,p]),f=(0,oN.useCallback)(async e=>{let n=await p(e),r=sV.q$.insertChild(l,e,n);r&&a(r)},[l,a,p]),m=function(e){let{hotkeys:n,onMemberOpen:r,resolveInitialValue:i,disabled:a}=e,o=(0,sV._F)(),{t:l}=dV(),s=(0,oN.useCallback)(async e=>{let n=await i(e),a=sV.q$.addAnnotation(o,e,n);a&&a.markDefPath&&r(a.markDefPath)},[o,r,i]);return(0,oN.useMemo)(()=>o?[{name:"format",actions:o.schemaTypes.decorators.map(e=>{let r=Object.keys(n.marks||{}).find(r=>{var i;return(null==(i=n.marks)?void 0:i[r])===e.value}),i=[];
1return r&&(i=[r]),{type:"format",disabled:a,icon:null==e?void 0:e.icon,key:e.value,handle:()=>{sV.q$.toggleMark(o,e.value),sV.q$.focus(o)},hotkeys:i,title:e.i18nTitleKey&&l?l(e.i18nTitleKey):e.title}})},{name:"list",actions:o.schemaTypes.lists.map(e=>({type:"listStyle",key:e.value,disabled:a,icon:null==e?void 0:e.icon,handle:()=>{sV.q$.toggleList(o,e.value)},title:e.i18nTitleKey&&l?l(e.i18nTitleKey):e.title}))},{name:"annotation",actions:function(e,n,r,i){let a=e.schemaTypes,o=sV.q$.focusChild(e),l=o&&o.text;return a.annotations.map(a=>({type:"annotation",disabled:!l||n,icon:lS()(a,"icon")||lS()(a,"type.icon")||lS()(a,"type.to.icon")||lS()(a,"type.to[0].icon"),key:a.name,handle:n=>{n?(sV.q$.removeAnnotation(e,a),sV.q$.focus(e)):r(a)},title:a.i18nTitleKey&&i?i(a.i18nTitleKey):a.title||s6()(a.name)}))}(o,a,s,l)}]:[],[a,o,s,n,l])}({hotkeys:n,onMemberOpen:a,resolveInitialValue:p,disabled:!0}),g=(0,oN.useMemo)(()=>l.schemaTypes.styles.map(e=>({key:"style-".concat(e.value),style:e.value,styleComponent:e&&e.component,title:e.title,i18nTitleKey:e.i18nTitleKey})),[l]),x=(0,oN.useMemo)(()=>(function(e,n,r,i){let a=e.blockObjects.map((e,n)=>({handle:()=>r(e),icon:Ew(e,lp.sTT),inline:!1,key:"block-".concat(n),type:e})),o=e.inlineObjects.map((e,n)=>({handle:()=>i(e),icon:Ew(e,lp.Kz2),inline:!0,key:"inline-".concat(n),type:e}));return a.concat(o).filter(e=>{var n;return!(null==(n=e.type)?void 0:n.hidden)})})(l.schemaTypes,0,h,f),[d,l,h,f]);return(0,oZ.jsx)(EJ,{actionGroups:m,blockStyles:g,disabled:d,insertMenuItems:x,isFullscreen:r,onToggleFullscreen:o})}var E0=Object.freeze,E1=Object.defineProperty,E2=(e,n)=>E0(E1(e,"raw",{value:E0(n||e.slice())}));let E3=(0,oV.ZP)(oK.Zb)(rb||(rb=E2(["\n  height: ",";\n\n  &:not([hidden]) {\n    display: flex;\n  }\n\n  flex-direction: column;\n"])),e=>{let{$fullscreen:n}=e;return n?"100%":"15em"}),E4=(0,oV.ZP)(oK.Zb)(rj||(rj=E2(["\n  z-index: 10;\n  line-height: 0;\n"]))),E5=(0,oV.ZP)(oK.Zb)(rw||(rw=E2(["\n  position: relative;\n  overflow: hidden;\n  overflow: clip;\n\n  & > [data-portal] {\n    position: absolute;\n    top: 0;\n    left: 0;\n    right: 0;\n    bottom: 0;\n    pointer-events: none;\n\n    & > * {\n      pointer-events: initial;\n    }\n  }\n\n  &::selection,\n  *::selection {\n    background-color: transparent;\n  }\n"]))),E8=(0,oV.ZP)(d2)(rk||(rk=E2(["\n  position: relative;\n  overflow: auto;\n  height: 100%;\n  display: flex;\n  flex-direction: column;\n\n  & > * {\n    flex: 1;\n    min-height: auto;\n  }\n"]))),E6=(0,oV.ZP)(oK.W2)(rC||(rC=E2(["\n  /* @todo: calculate from theme */\n  /* max-width: 728px; */\n"]))),E9=(0,oV.ZP)(oK.Zb)(rS||(rS=E2(["\n  height: 100%;\n  width: 100%;\n  counter-reset: ",";\n  overflow: hidden;\n  overflow: clip;\n\n  & > div {\n    height: 100%;\n  }\n\n  & .pt-editable {\n    display: block;\n    width: 100%;\n    height: 100%;\n\n    ","\n\n    & > .pt-list-item-bullet + .pt-list-item-number,\n    & > .pt-list-item-number + .pt-list-item-bullet {\n      margin-top: ","px;\n      counter-reset: ",";\n    }\n\n    & > :not(.pt-list-item) + .pt-list-item {\n      margin-top: ","px;\n    }\n\n    /* Reset the list count if the element is not a numbered list item */\n    & > :not(.pt-list-item-number) {\n      counter-reset: ",";\n    }\n\n    ","\n\n    & > .pt-list-item + :not(.pt-list-item) {\n      margin-top: ","px;\n    }\n\n    & > :first-child {\n      padding-top: ","px;\n    }\n\n    & > :last-child {\n      padding-bottom: ","px;\n    }\n\n    /* & > .pt-block {\n      & .pt-inline-object {\n      }\n    } */\n\n    & .pt-drop-indicator {\n      pointer-events: none;\n      border: 1px solid var(--card-focus-ring-color) !important;\n      height: 0px !important;\n      border-radius: ","px;\n      margin-top: -3px;\n      left: calc(\n        "," - 1px\n      );\n      right: calc(\n        "," - 1px\n      );\n      width: calc(\n        100% -\n          "," + 2px\n      ) !important;\n    }\n  }\n"])),kJ.map(e=>k3(e)).join(" "),kJ.map(e=>(0,oV.iv)(r_||(r_=E2(["\n        & > .pt-list-item-number[class~='pt-list-item-level-","'] {\n          counter-increment: ",";\n        }\n      "])),e,k3(e))),e=>{let{theme:n}=e;return n.sanity.space[3]},kJ.map(e=>k3(e)).join(" "),e=>{let{theme:n}=e;return n.sanity.space[2]},kJ.map(e=>k3(e)).join(" "),kJ.slice(1).map(e=>(0,oV.iv)(rT||(rT=E2(["\n        & > .pt-list-item-level-"," + .pt-list-item-level-"," {\n          counter-reset: ",";\n        }\n      "])),e,e-1,k3(e))),e=>{let{theme:n}=e;return n.sanity.space[3]},e=>{let{$isFullscreen:n,theme:r}=e;
1return r.sanity.space[n?5:3]},e=>{let{$isFullscreen:n,theme:r}=e;return r.sanity.space[n?9:5]},e=>(0,oL.aQ)(e.theme).radius[2],e=>{let{$isFullscreen:n,theme:r}=e;return n?(0,oK.hO)(r.sanity.space[5]):(0,oK.hO)(r.sanity.space[3])},e=>{let{$isFullscreen:n,theme:r}=e;return n?(0,oK.hO)(r.sanity.space[5]):(0,oK.hO)(r.sanity.space[3])},e=>{let{$isFullscreen:n,theme:r}=e;return n?(0,oK.hO)(2*r.sanity.space[5]):(0,oK.hO)(2*r.sanity.space[3])}),E7=e=>{let{block:n,focused:r,children:i,selected:a,schemaType:o}=e,l=(0,oN.useMemo)(()=>(n.style&&Cy[n.style]?Cy[n.style]:Cy[0])||Cd,[n.style]),s=(0,oN.useCallback)(e=>(0,oZ.jsx)(l,{children:(0,oZ.jsx)(Cc,{"data-testid":"text-style--".concat(n.style),children:e.children})}),[l,n.style]);return(0,oN.useMemo)(()=>{let e=o.component,{title:l,value:c}=o,d={block:n,focused:r,renderDefault:s,schemaType:o,selected:a,title:l,value:c};return e?(0,oZ.jsx)(e,{...d,children:i}):(0,oZ.jsx)(s,{...d,children:i})},[s,n,i,r,o,a])},Pe=e=>(0,oZ.jsx)(oZ.Fragment,{children:e.children}),Pt=e=>{let{block:n,children:r,schemaType:i,selected:a,focused:o,level:l,value:s}=e,{title:c,component:d}=i;return(0,oN.useMemo)(()=>{let e={block:n,focused:o,level:l,renderDefault:Pe,schemaType:i,selected:a,title:c,value:s};return d?(0,oZ.jsx)(d,{...e,children:r}):(0,oZ.jsx)(Pe,{...e,children:r})},[d,n,r,o,l,i,a,c,s])},Pn={outline:"none"},Pr=e=>(0,oZ.jsx)(S6,{...e}),Pi=e=>(0,oZ.jsx)(E7,{...e}),Pa=e=>(0,oZ.jsx)(Pt,{...e});function Po(e){let{hotkeys:n,initialSelection:r,isActive:i,isFullscreen:a,onCopy:o,onItemOpen:l,onPaste:s,onToggleFullscreen:c,path:d,readOnly:u,renderAnnotation:p,renderBlock:h,renderChild:f,scrollElement:m,setPortalElement:g,setScrollElement:x,ariaDescribedBy:v}=e,{t:y}=dV(),{isTopLayer:b}=(0,oK.sJ)(),j=(0,oN.useRef)(null),{element:w}=(0,oK.sz)();(0,oK.qh)((0,oN.useCallback)(e=>{b&&a&&"Escape"===e.key&&c()},[c,a,b]));let k=(0,oN.useCallback)(()=>(0,oZ.jsx)("span",{"data-testid":"pt-input-placeholder",children:y("inputs.portable-text.empty-placeholder")}),[y]),C=function(){let e=(0,sV._F)();return(0,oN.useMemo)(()=>{var n;let r=null==(n=e.schemaTypes.block.options)?void 0:n.spellCheck,i="undefined"!=typeof navigator&&/Chrome\/96/.test(navigator.userAgent);return(void 0!==r||!0!==i)&&r},[e])}(),_=(0,oN.useMemo)(()=>(e,n)=>{if(sV.q$.getSelection(e)){let e=n.startContainer.parentElement;e&&(0,s3.Z)(e,{scrollMode:"if-needed",boundary:m,block:"start",inline:"nearest"})}},[m]),T=(0,oN.useMemo)(()=>(0,oZ.jsx)(sV.iV,{"aria-describedby":v,hotkeys:n,onCopy:o,onPaste:s,ref:j,renderAnnotation:p,renderBlock:h,renderChild:f,renderDecorator:Pr,renderListItem:Pa,renderPlaceholder:k,renderStyle:Pi,scrollSelectionIntoView:_,selection:r,spellCheck:C,style:Pn}),[v,n,r,o,s,p,h,f,k,_,C]),S=(0,oN.useCallback)(e=>{l(d.concat(e))},[l,d]);return(0,oZ.jsxs)(E3,{$fullscreen:a,"data-testid":"pt-editor",children:[i&&(0,oZ.jsx)(lr.uE,{children:(0,oZ.jsx)(E4,{"data-testid":"pt-editor__toolbar-card",shadow:1,children:(0,oZ.jsx)(EQ,{hotkeys:n,isFullscreen:a,onMemberOpen:S,onToggleFullscreen:c,readOnly:u})})}),(0,oZ.jsxs)(E5,{flex:1,tone:u?"transparent":"default",children:[(0,oZ.jsx)(E8,{ref:x,children:(0,oZ.jsx)(E6,{padding:a?2:0,sizing:"border",width:1,children:(0,oZ.jsx)(E9,{$isFullscreen:a,tone:u?"transparent":"default",children:(0,oZ.jsx)(oK.NM,{element:a?m:w,children:T})})})}),(0,oZ.jsx)("div",{"data-portal":"",ref:g})]})]})}var Pl=Object.freeze,Ps=Object.defineProperty,Pc=(e,n)=>Pl(Ps(e,"raw",{value:Pl(n||e.slice())}));let Pd=oV.ZP.div(e=>{let{color:n,input:r,radius:i}=(0,oL.aQ)(e.theme),a={color:n.input.default.enabled.border,width:r.border.width};return(0,oV.iv)(rE||(rE=Pc(["\n    --input-box-shadow: ",";\n\n    position: relative;\n\n    & [data-wrapper] {\n      overflow: hidden;\n      overflow: clip;\n      position: relative;\n      z-index: 1;\n      padding: ","px;\n    }\n\n    & [data-border] {\n      position: absolute;\n      top: 0;\n      left: 0;\n      right: 0;\n      bottom: 0;\n      box-shadow: var(--input-box-shadow);\n      z-index: 2;\n      border-radius: ","px;\n      pointer-events: none;\n    }\n\n    &:not([data-read-only])[data-focused] [data-border] {\n      --input-box-shadow: ",";\n    }\n  "])),CY(a),r.border.width,i[2],CX({base:n,border:a,focusRing:r.text.focusRing}))}),Pu=(0,oV.ZP)(oK.mh)(rP||(rP=Pc(["\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n"])));function Pp(e){let{changed:n,focused:r,focusPath:i=dy,hasFocusWithin:a,hotkeys:o,isActive:l,isFullscreen:s,onActivate:c,onCopy:d,onItemClose:u,onItemOpen:p,onItemRemove:h,onPaste:f,onPathFocus:m,onToggleFullscreen:g,path:x,readOnly:v,renderAnnotation:y,renderBlock:b,renderBlockActions:j,renderCustomMarkers:w,renderField:k,renderInlineBlock:C,renderInput:_,renderItem:T,renderPreview:S,value:E}=e,P=(0,sV._F)(),O=(0,oK.sz)().element,[A,I]=(0,oN.useState)(null),[z,M]=(0,oN.useState)(null),R=(0,oN.useCallback)(()=>{g()},[g]),F=function(e){let n=(0,sV._F)(),[r]=(0,oN.useState)(()=>e);return r!==e&&console.warn("Make sure that hotkeys are a stable object across renders, or there will be issues with key handling in the Portable Text Editor."),(0,oN.useMemo)(()=>{let e={marks:{}};
1return n.schemaTypes.decorators.forEach(n=>{switch(n.value){case"strong":e.marks["mod+b"]=n.value;break;case"em":e.marks["mod+i"]=n.value;break;case"underline":e.marks["mod+u"]=n.value;break;case"code":e.marks["mod+'"]=n.value}}),{marks:{...e.marks,...(r||{}).marks},custom:r.custom}},[n,r])}((0,oN.useMemo)(()=>({...o,custom:{"mod+enter":g,...(null==o?void 0:o.custom)||{}}}),[o,g])),D=E&&j?j:void 0,q=E&&w?w:void 0,[Z,N]=(0,oN.useState)(null),L=(0,oN.useCallback)(e=>{let{children:n,focused:r,path:i,selected:a,schemaType:o,value:l}=e;return(0,oZ.jsx)(Cb,{floatingBoundary:O,focused:r,isFullscreen:s,onItemClose:u,onItemOpen:p,onItemRemove:h,onPathFocus:m,path:x.concat(i),readOnly:v,referenceBoundary:z,renderAnnotation:y,renderField:k,renderInlineBlock:C,renderInput:_,renderItem:T,renderBlockActions:D,renderCustomMarkers:q,renderPreview:S,renderBlock:b,schemaType:o,selected:a,value:l,children:n})},[D,q,z,s,u,p,h,m,O,x,v,y,b,k,C,_,T,S]),V=(0,oN.useCallback)(e=>{let{focused:n,path:r,selected:i,schemaType:a,value:o}=e;return(0,oZ.jsx)(kX,{floatingBoundary:O,focused:n,isFullscreen:s,onItemClose:u,onItemOpen:p,onItemRemove:h,onPathFocus:m,path:x.concat(r),readOnly:v,referenceBoundary:z,relativePath:r,renderAnnotation:y,renderBlock:b,renderBlockActions:D,renderCustomMarkers:q,renderField:k,renderInlineBlock:C,renderInput:_,renderItem:T,renderPreview:S,schemaType:a,selected:i,value:o})},[O,z,s,u,p,h,m,x,v,y,b,D,q,k,C,_,T,S]),K=(0,oN.useCallback)(e=>{let{value:n}=e;return n._type===P.schemaTypes.block.name?L(e):V(e)},[P.schemaTypes.block.name,V,L]),B=(0,oN.useCallback)(e=>{let{children:n,focused:r,path:i,selected:a,schemaType:o,value:l}=e;return l._type===P.schemaTypes.span.name?n:(0,oZ.jsx)(CO,{floatingBoundary:O,focused:r,onItemClose:u,onItemOpen:p,onPathFocus:m,path:x.concat(i),readOnly:v,referenceBoundary:z,relativePath:i,renderAnnotation:y,renderBlock:b,renderCustomMarkers:w,renderField:k,renderInlineBlock:C,renderInput:_,renderItem:T,renderPreview:S,schemaType:o,selected:a,value:l})},[O,z,P.schemaTypes.span.name,u,p,m,x,v,y,b,w,k,C,_,T,S]),U=(0,oN.useCallback)(e=>{let{children:n,focused:i,path:a,selected:o,schemaType:l,value:s}=e;return(0,oZ.jsx)(CZ,{editorNodeFocused:i,floatingBoundary:O,focused:!!r,onItemClose:u,onItemOpen:p,onPathFocus:m,path:x.concat(a),readOnly:v,referenceBoundary:z,renderAnnotation:y,renderBlock:b,renderCustomMarkers:w,renderField:k,renderInlineBlock:C,renderInput:_,renderItem:T,renderPreview:S,schemaType:l,selected:o,value:s,children:n})},[O,z,r,u,p,m,x,v,y,b,w,k,C,_,T,S]),H=e.elementProps["aria-describedby"],$=(0,oN.useMemo)(()=>{if(a)return{anchor:{path:i,offset:0},focus:{path:i,offset:0}}},[]),W=(0,oN.useMemo)(()=>(0,oZ.jsx)(Po,{ariaDescribedBy:H,initialSelection:$,hotkeys:F,isActive:l,isFullscreen:s,onItemOpen:p,onCopy:d,onPaste:f,onToggleFullscreen:R,path:x,readOnly:v,renderAnnotation:U,renderBlock:K,renderChild:B,setPortalElement:N,scrollElement:z,setScrollElement:M}),[H,F,U,K,B,R,$,l,s,d,p,f,x,v,z]),Y=(0,oK.vI)(),X=(0,oN.useMemo)(()=>({collapsed:A,default:Y.element,editor:Z,expanded:Y.element}),[Y.element,Z,A]);!function(e){let{focusPath:n,boundaryElement:r,onItemClose:i}=e,a=function(){let e=(0,oN.useContext)(kb);if(!e)throw Error("Form context not provided");return e}(),o=(0,sV._F)(),l=(0,sV.L9)();(0,oN.useLayoutEffect)(()=>{var e,i,s,c,d;if(0===n.length)return;let u=a.find(e=>e.member.open);if(u&&(null==(e=u.elementRef)?void 0:e.current)){if(r&&((0,s3.Z)(r,{scrollMode:"if-needed",block:"start",inline:"start"}),(0,s3.Z)(u.elementRef.current,{scrollMode:"if-needed",boundary:r,block:"start",inline:"start"})),(null==l?void 0:l.focus.path)&&(0,o2.Xy)(l.focus.path,n))return;let e="textBlock"===u.kind,a=1===n.length;if(e||a){let r=e&&(0,ll.fU)(n[2])?n[2]._key:void 0,l=r&&Array.isArray(null==(i=u.node.value)?void 0:i.children)?null==(s=u.node.value)?void 0:s.children.find(e=>e._key===r):void 0,p=l&&"span"===l._type&&4===n.length&&"children"===n[1]&&"text"===n[3]||!1,h=e&&(3===n.length&&"children"===n[1]||p),f=[];h?f=n.slice(0,3):e&&a&&Array.isArray(null==(c=u.node.value)?void 0:c.children)?f=[n[0],"children",{_key:null==(d=u.node.value)?void 0:d.children[0]._key}]:a&&(f=[{_key:u.key}]),f.length&&(sV.q$.select(o,{anchor:{path:f,offset:0},focus:{path:f,offset:0}}
1),e&&sV.q$.focus(o))}}},[r,o,n,i,a,null==l?void 0:l.focus.path])}({focusPath:i,boundaryElement:z,onItemClose:u});let G=r||a;return(0,oZ.jsx)(oK.Xp,{__unstable_elements:X,element:Y.element,children:(0,oZ.jsx)(S3,{onActivate:c,isOverlayActive:!l,children:(0,oZ.jsx)(dQ,{disabled:s,hasFocus:!!r,isChanged:n,path:x,children:(0,oZ.jsxs)(Pd,{"data-focused":G?"":void 0,"data-read-only":v?"":void 0,children:[(0,oZ.jsx)(oK.xu,{"data-wrapper":"",ref:I,children:(0,oZ.jsx)(oK.h_,{__unstable_name:s?"expanded":"collapsed",children:s?(0,oZ.jsx)(Pu,{children:W}):W})}),(0,oZ.jsx)("div",{"data-border":""})]})})})})}function Ph(e){let{onChange:n,onIgnore:r,resolution:i,readOnly:a}=e,{t:o}=dV(),l=(0,oN.useCallback)(()=>{i&&n({type:"mutation",patches:i.patches})},[n,i]);return i?(0,oZ.jsx)(fN,{title:(0,oZ.jsx)(oZ.Fragment,{children:o("inputs.portable-text.invalid-value.title")}),suffix:(0,oZ.jsxs)(oK.Kq,{padding:2,children:[i.action&&(0,oZ.jsxs)(oK.rj,{columns:[1,2],gap:1,children:[(0,oZ.jsx)(oK.zx,{mode:"ghost",onClick:r,text:o("inputs.portable-text.invalid-value.ignore-button.text")}),!a&&(0,oZ.jsx)(oK.zx,{onClick:l,text:(0,oZ.jsx)(uz,{t:o,i18nKey:i.i18n.action,values:i.i18n.values}),tone:"caution"})]}),(0,oZ.jsx)(oK.xu,{padding:3,children:i.action&&(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:o("inputs.portable-text.invalid-value.action-disclaimer")})})]}),children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:o,i18nKey:i.i18n.description,values:i.i18n.values})}),(0,oZ.jsx)(oK.Zb,{border:!0,overflow:"auto",padding:2,tone:"inherit",children:(0,oZ.jsx)(oK.EK,{language:"json",children:JSON.stringify(i.item,null,2)})})]})}):null}function Pf(e,n){if(e===n)return!0;if(!Array.isArray(e)||!Array.isArray(n)||e.length<n.length)return!1;for(let r=0,i=n.length;r<i;r++)if(!function(e,n){let r=typeof e;return r===typeof n&&("object"===r?lu()(e,n):e===n)}(n[r],e[r]))return!1;return!0}function Pm(e){let{elementProps:n,hotkeys:r,markers:i=dy,onChange:a,onCopy:o,onInsert:l,onItemRemove:s,onPaste:c,onPathFocus:d,path:u,readOnly:p,renderBlockActions:h,renderCustomMarkers:f,schemaType:m,value:g}=e,{onBlur:x}=n;(0,oN.useImperativeHandle)(n.ref,()=>({focus(){y.current&&sV.q$.focus(y.current)}}));let{subscribe:v}=function(e){let{path:n}=e,{patchChannel:r}=vm().__internal;return{subscribe:(0,oN.useCallback)(e=>r.subscribe(r=>{let{snapshot:i,patches:a}=r,o=a.filter(e=>Pf(e.path,n)).map(e=>({...e,path:e.path.slice(n.length)}));o.length&&e({shouldReset:a.some(e=>{var r;return(0===(r=e.path).length||Pf(n,r)&&!Pf(r,n))&&("set"===e.type||"unset"===e.type)}),snapshot:dj(i)?n.reduce((e,n)=>
1"object"==typeof n?ct()(e,n):lS()(e,n),i):{},patches:o})}),[n,r])}}({path:u}),y=(0,oN.useRef)(null),[b,j]=(0,oN.useState)(!1),[w,k]=(0,oN.useState)(null),[C,_]=(0,oN.useState)(!1),[T,S]=(0,oN.useState)(!1),[E,P]=(0,oN.useState)(!1),[O,A]=(0,oN.useState)(!1),I=(0,sK.f1)(),z=(0,oK.pm)(),M=(0,oN.useMemo)(()=>new oC.x,[]),R=(0,oN.useMemo)(()=>M.asObservable(),[M]),F=(0,oN.useRef)(null),D=(0,oN.useCallback)(()=>{y.current&&_(e=>{let n=!e;return n?I.log(S$):I.log(SW),n})},[I]);(0,oN.useEffect)(()=>{w&&g!==w.value&&k(null)},[w,g]),(0,oN.useEffect)(()=>v(e=>{let{patches:n,snapshot:r}=e;M.next({patches:n,snapshot:r})}),[M,v]);let q=function(e){let n=(0,oN.useRef)([]);return kk({props:e,ref:n}),n.current}(e);(0,oN.useEffect)(()=>{O&&S(!0)},[O]);let Z=(0,oN.useCallback)(e=>{switch(e.type){case"mutation":case"undo":case"redo":a(e.patches.map(e=>({...e,patchType:fO})));break;case"connection":"offline"===e.value?P(!0):"online"===e.value&&P(!1);break;case"selection":(0,oN.startTransition)(()=>{e.selection&&d(e.selection.focus.path)});break;case"focus":S(!0),A(!0);break;case"blur":x(e.event),A(!1);break;case"invalidValue":k(e);break;case"error":z.push({status:e.level,description:e.description})}},[x,a,d,z]);(0,oN.useEffect)(()=>{j(!1)},[g]);let N=(0,oN.useCallback)(()=>{j(!0)},[]),L=(0,oN.useMemo)(()=>w&&w.resolution?(0,oZ.jsx)(oK.xu,{marginBottom:2,children:(0,oZ.jsx)(Ph,{onChange:Z,onIgnore:N,resolution:w.resolution,readOnly:E||p})}):null,[Z,N,w,E,p]),V=(0,oN.useCallback)(()=>{!T&&(S(!0),y.current&&sV.q$.focus(y.current))},[T]);return(0,oZ.jsxs)(oK.xu,{ref:F,children:[!b&&L,(!w||b)&&(0,oZ.jsx)(kv,{markers:i,children:(0,oZ.jsx)(kj,{memberItems:q,children:(0,oZ.jsx)(sV.q$,{ref:y,patches$:R,onChange:Z,maxBlocks:void 0,readOnly:E||p,schemaType:m,value:g,children:(0,oZ.jsx)(Pp,{...e,hasFocusWithin:O,hotkeys:r,isActive:T,isFullscreen:C,onActivate:V,onItemRemove:s,onCopy:o,onInsert:l,onPaste:c,onToggleFullscreen:D,renderBlockActions:h,renderCustomMarkers:f})})})})]})}function Pg(e){return"inset 0 0 0 ".concat(e.width,"px ").concat(e.color)}var Px=Object.freeze,Pv=Object.defineProperty,Py=(e,n)=>Px(Pv(e,"raw",{value:Px(n||e.slice())}));let Pb=(0,oV.ZP)(oK.Zb)(e=>{let{theme:n}=e,{focusRing:r,input:i,radius:a}=n.sanity,o=n.sanity.color.input,l=(0,oK.hO)(n.sanity.space[1]);return{position:"relative",borderRadius:"".concat(a[1],"px"),color:o.default.enabled.fg,boxShadow:Pg({color:o.default.enabled.border,width:i.border.width}),"& > .content":{position:"relative",lineHeight:0,margin:"-".concat(l," 0 0 -").concat(l)},"& > .content > div":{display:"inline-block",verticalAlign:"top",padding:"".concat(l," 0 0 ").concat(l)},"&:not([data-read-only])":{cursor:"text"},"@media(hover:hover):not([data-disabled]):not([data-read-only]):hover":{borderColor:o.default.hovered.border},"&:not([data-disabled]):not([data-read-only])[data-focused]":{boxShadow:function(e){let{base:n,border:r,focusRing:i}=e,a=i.offset+i.width,o=0-i.offset,l=n?n.bg:"var(--card-bg-color)";return[o>0&&"inset 0 0 0 ".concat(o,"px var(--card-focus-ring-color)"),r&&Pg(r),o<0&&"0 0 0 ".concat(0-o,"px ").concat(l),a>0&&"0 0 0 ".concat(a,"px var(--card-focus-ring-color)")].filter(Boolean).join(",")}({border:{color:o.default.enabled.border,width:i.border.width},focusRing:r})},"*:disabled + &":{color:o.default.disabled.fg,backgroundColor:o.default.disabled.bg,boxShadow:Pg({color:o.default.disabled.border,width:i.border.width})}}}),Pj=oV.ZP.input(e=>{let{theme:n}=e,r=n.sanity.fonts.text,i=n.sanity.color.input,a=n.sanity.space[2],o=n.sanity.fonts.text.sizes[2];return{appearance:"none",background:"none",border:0,borderRadius:0,outline:"none",fontSize:(0,oK.hO)(o.fontSize),lineHeight:o.lineHeight/o.fontSize,fontFamily:r.family,fontWeight:r.weights.regular,margin:0,display:"block",minWidth:"1px",maxWidth:"100%",boxSizing:"border-box",paddingTop:(0,oK.hO)(a-o.ascenderHeight),paddingRight:(0,oK.hO)(a),paddingBottom:(0,oK.hO)(a-o.descenderHeight),paddingLeft:(0,oK.hO)(a),"&:not(:invalid):not(:disabled)":{color:i.default.enabled.fg},"&:not(:invalid):disabled":{color:i.default.disabled.fg}}}),Pw=(0,oV.ZP)(oK.xu)(e=>{let{theme:n}=e,r=n.sanity.color.input;return(0,oV.iv)(rO||(rO=Py(["\n    position: absolute;\n    top: 0;\n    left: 0;\n    right: 0;\n    pointer-events: none;\n    --card-fg-color: ",";\n  "])),r.default.enabled.placeholder)}),Pk=(0,oV.ZP)(oK.xu)(rA||(rA=Py(['\n  // This is needed to make textOverflow="ellipsis" work properly for the Text primitive\n  max-width: 100%;\n']))),PC=(0,oN.forwardRef)((e,n)=>{let{disabled:r,onChange:i,onFocus:a,placeholder:o,readOnly:l,value:s=[],...c}=e,{t:d}=dV(pV),[u,p]=(0,oN.useState)(""),h=!r&&!l,[f,m]=(0,oN.useState)(!1),g=(0,oK.ts)(n),x=(0,oN.useRef)(null),v=(0,oN.useCallback)(e=>{if((0,oK.Re)(e.target)&&e.target.closest('[data-ui="Tag"]'))return;let n=g.current;n&&setTimeout(()=>
1n.focus(),0)},[g]),y=(0,oN.useCallback)(()=>{m(!1)},[]),b=(0,oN.useCallback)(e=>{p(e.currentTarget.value)},[]),j=(0,oN.useCallback)(e=>{m(!0),a&&a(e)},[a]),w=(0,oN.useCallback)(e=>{if("Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),i&&u)){let e=s.concat([{value:u}]);p(""),i&&i(e)}},[u,i,s]),k=(0,oN.useCallback)(e=>{if(!i)return;let n=s.slice(0);n.splice(e,1),i(n)},[i,s]);return(0,oN.useEffect)(()=>{let e=g.current;e&&(e.style.width="0",e.style.width="".concat(e.scrollWidth,"px"))},[g,u]),(0,oZ.jsxs)(Pb,{"data-disabled":r?"":void 0,"data-focused":f?"":void 0,"data-read-only":l?"":void 0,"data-ui":"TagInput",onPointerDown:v,overflow:"auto",padding:1,ref:x,children:[h&&(0,oZ.jsx)(Pw,{hidden:!!(u||s.length),padding:3,children:(0,oZ.jsx)(oK.xv,{textOverflow:"ellipsis",children:o||d("inputs.tags.placeholder",{context:"undefined"!=typeof window&&"ontouchstart"in window?"touch":void 0})})}),(0,oZ.jsxs)("div",{className:"content",children:[s.map((e,n)=>(0,oZ.jsx)(Pk,{children:(0,oZ.jsx)(P_,{enabled:h,index:n,muted:!h,onRemove:k,tag:e})},"tag-".concat(n))),(0,oZ.jsx)("div",{children:(0,oZ.jsx)(Pj,{...c,disabled:!h,onBlur:y,onChange:b,onFocus:j,onKeyDown:w,ref:g,type:"text",value:u})},"tag-input")]})]})});function P_(e){let{enabled:n,index:r,muted:i,onRemove:a,tag:o}=e,l=(0,oN.useCallback)(()=>{a(r)},[r,a]);return(0,oZ.jsx)(oK.Zb,{"data-ui":"Tag",radius:2,tone:"transparent",children:(0,oZ.jsxs)(oK.kC,{align:"center",gap:1,children:[(0,oZ.jsx)(oK.xu,{flex:1,paddingY:2,paddingLeft:2,children:(0,oZ.jsx)(oK.xv,{muted:i,textOverflow:"ellipsis",children:o.value})}),n&&(0,oZ.jsx)(lr.zx,{icon:lp.Two,mode:"bleed",onClick:l,tooltipProps:{content:"Remove"}})]})})}function PT(e){let{onChange:n,readOnly:r,value:i=[],elementProps:a,path:o,changed:l}=e,s=(0,oN.useMemo)(()=>null==i?void 0:i.map(e=>({value:e})),[i]),c=(0,oN.useCallback)(e=>{n(0===e.length?fM():fz(e.map(e=>e.value)))},[n]);return(0,oZ.jsx)(dQ,{path:o,isChanged:l,hasFocus:!1,children:(0,oZ.jsx)(PC,{onChange:c,readOnly:r,value:s,...a})})}PC.displayName="TagInput";let PS={portal:!0,tone:"default"};function PE(e){let{member:n,sortable:r,onRemove:i}=e,a=(0,oN.useId)(),{t:o}=dV();return(0,oZ.jsx)(oK.xu,{paddingX:1,children:(0,oZ.jsx)(bQ,{dragHandle:r,tone:"caution",menu:(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(bA,{paddingY:3}),id:"".concat(a,"-menuButton"),menu:(0,oZ.jsx)(oK.v2,{children:(0,oZ.jsx)(lr.sN,{text:o("inputs.array.action.remove-invalid-item"),tone:"critical",icon:lp.XHJ,onClick:i})}),popover:PS}),children:"INVALID_ITEM_TYPE"===n.error.type?(0,oZ.jsx)(SB,{value:n.error.value}):(0,oZ.jsx)("div",{children:o("inputs.array.error.unexpected-error",{error:n.error.type})})})})}function PP(e){let{hoveringFiles:n,types:r,resolveUploader:i}=e,a=n.filter(e=>r.some(n=>i(n,e))),o=n.length-a.length,l=r.length>1,{t:s}=dV();return(0,oZ.jsx)(oZ.Fragment,{children:a.length>0?(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsxs)(oK.gF,{space:2,children:[(0,oZ.jsx)(oK.xv,{children:(0,oZ.jsx)(lp.rG2,{})}),l?s("inputs.files.common.drop-message.drop-to-upload-multi",{count:a.length}):s("inputs.files.common.drop-message.drop-to-upload"),(0,oZ.jsx)(oK.xv,{})]}),o>0&&(0,oZ.jsx)(oK.xu,{marginTop:4,children:(0,oZ.jsxs)(oK.gF,{space:2,children:[(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:(0,oZ.jsx)(lp.vaB,{})}),(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:s("inputs.files.common.drop-message.drop-to-upload.rejected-file-message",{count:o})})]})})]}):(0,oZ.jsxs)(oK.gF,{space:2,children:[(0,oZ.jsx)(oK.xv,{children:(0,oZ.jsx)(lp.vaB,{})}),(0,oZ.jsx)(oK.xv,{children:s("inputs.files.common.drop-message.drop-to-upload.no-accepted-file-message",{count:n.length})})]})})}var PO=Object.freeze,PA=Object.defineProperty;let PI=(0,oV.ZP)(oK.mh)(rI||(rI=PO(PA(W=["\n  position: absolute;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  top: -2px;\n  left: -2px;\n  right: -2px;\n  bottom: -2px;\n  background-color: var(--card-bg-color);\n  opacity: 0.8;\n"],"raw",{value:PO(W.slice())}))));var Pz=Object.freeze,PM=Object.defineProperty;let PR=oV.ZP.div(rz||(rz=Pz(PM(Y=["\n  position: relative;\n"],"raw",{value:Pz(Y.slice())})))),PF=C0(function(e){let n=CW(e);return oN.forwardRef(function(e,r){let{children:i,resolveUploader:a,onUpload:o,types:l,...s}=e,{push:c}=(0,oK.pm)(),{t:d}=dV(),u=oN.useCallback((e,n)=>{let{type:r,uploader:i}=n;
1null==o||o({file:e,schemaType:r,uploader:i})},[o]),p=oN.useCallback(e=>{if(!a)return;let n=e.map(e=>({file:e,uploaderCandidates:l.map(n=>({type:n,uploader:a(n,e)})).filter(e=>e.uploader)})),r=n.filter(e=>e.uploaderCandidates.length>0),i=n.filter(e=>0===e.uploaderCandidates.length);i.length>0&&c({closable:!0,status:"warning",title:d("inputs.array.error.cannot-upload-unable-to-convert",{count:i.length}),description:i.map((e,n)=>(0,oZ.jsxs)(oK.kC,{gap:2,padding:2,children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{weight:"medium",children:e.file.name})}),(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsxs)(oK.xv,{size:1,children:["(",e.file.type,")"]})})]},n))}),r.forEach(e=>{u(e.file,lo()(e.uploaderCandidates,e=>e.uploader.priority)[0])})},[c,a,l,u,d]),[h,f]=oN.useState([]),m=oN.useCallback(()=>f([]),[]);return(0,oZ.jsx)(PR,{children:(0,oZ.jsxs)(n,{...s,ref:r,onFiles:p,onFilesOver:f,onFilesOut:m,children:[a&&h.length>0&&(0,oZ.jsx)(PI,{zOffset:10,children:(0,oZ.jsx)(PP,{hoveringFiles:h,types:l,resolveUploader:a})}),i]})})})}(oK.Zb)),PD={portal:!0,tone:"default"},Pq=oN.forwardRef(function(e,n){let{sortable:r,value:i,insertableTypes:a,onInsert:o,onRemove:l,readOnly:s,inputId:c,validation:d,children:u,presence:p,schemaType:h}=e,f=d.filter(e=>"error"===e.level).length>0,m=d.filter(e=>"warning"===e.level).length>0,g=(0,oN.useCallback)((e,n)=>{o({position:e,items:[wP(n)]})},[o]),x=(0,oN.useCallback)(()=>{i&&o({position:"after",items:[i]})},[o,i]),v=(0,oN.useMemo)(()=>f?"critical":m?"caution":void 0,[f,m]),{t:y}=dV(),b=(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(bA,{paddingY:3}),id:"".concat(c,"-menuButton"),popover:PD,menu:(0,oZ.jsxs)(oK.v2,{children:[(0,oZ.jsx)(lr.sN,{text:y("inputs.array.action.remove"),tone:"critical",icon:lp.XHJ,onClick:l}),(0,oZ.jsx)(lr.sN,{text:y("inputs.array.action.duplicate"),icon:lp.TIy,onClick:x}),(0,oZ.jsx)(b3,{types:a,onInsert:g})]})});return(0,oZ.jsx)(bQ,{tone:v,menu:!s&&b,dragHandle:!s&&r,presence:0===p.length?null:(0,oZ.jsx)(yC,{presence:p,maxAvatars:1}),validation:d.length>0?(0,oZ.jsx)(oK.xu,{paddingX:1,paddingY:3,children:(0,oZ.jsx)(bo,{validation:d})}):null,children:(0,oZ.jsx)(oK.kC,{align:h?"flex-end":"center",ref:n,children:(0,oZ.jsx)(oK.kC,{align:"flex-end",flex:1,children:(0,oZ.jsx)(oK.xu,{flex:1,marginRight:2,children:u})})})})});function PZ(e){let{schemaType:n,readOnly:r,children:i,onValueCreate:a,onItemAppend:o}=e,l=(0,oN.useId)(),{t:s}=dV(),c=oN.useCallback(e=>{o(a(e))},[a,o]),d=oN.useCallback(()=>{c(n.of[0])},[n,c]),u=(0,oN.useMemo)(()=>({constrainSize:!0,portal:!0}),[]),p=n.of.length>1?"inputs.array.action.add-item-select-type":"inputs.array.action.add-item";return r?(0,oZ.jsx)(lr.u,{portal:!0,content:s("inputs.array.read-only-label"),children:(0,oZ.jsx)(oK.rj,{children:(0,oZ.jsx)(lr.zx,{icon:lp.dtP,mode:"ghost",disabled:!0,size:"large",text:s(p)})})}):(0,oZ.jsxs)(oK.rj,{gap:1,style:{gridTemplateColumns:"repeat(auto-fit, minmax(100px, 1fr))"},children:[1===n.of.length?(0,oZ.jsx)(lr.zx,{icon:lp.dtP,mode:"ghost",onClick:d,size:"large",text:s(p)}):(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(lr.zx,{icon:lp.dtP,mode:"ghost",size:"large",text:s(p)}),id:l||"",menu:(0,oZ.jsx)(oK.v2,{children:n.of.map((e,n)=>{var r,i;let a=(0,ll.dD)(e)&&1===(e.to||[]).length&&e.to[0].icon,o=e.icon||(null==(r=e.type)?void 0:r.icon)||a;return(0,oZ.jsx)(lr.sN,{text:e.title||(null==(i=e.type)?void 0:i.name),onClick:()=>c(e),icon:o},n)})}),popover:u}),i]})}function PN(e){let{schemaType:n}=e,{t:r}=dV();return(0,oZ.jsx)(oK.Zb,{padding:3,border:!0,radius:2,children:(0,oZ.jsx)(oK.xv,{align:"center",muted:!0,size:1,children:n.placeholder||r("inputs.array.no-items-label")})})}class PL extends oN.PureComponent{constructor(e){super(e),this._element=null,this.handleAppend=e=>{let{value:n=[],onIndexFocus:r,onItemAppend:i}=this.props;i(e),r(n.length)},this.handlePrepend=e=>{let{onIndexFocus:n,value:r=[],onItemPrepend:i}=this.props;i(e),n(r.length)},this.handleSortEnd=e=>{let{onIndexFocus:n,onMoveItem:r,value:i}=this.props;i&&r(e),n(e.toIndex)},this.handleItemMoveStart=()=>{this.setState({disableTransition:!1})},this.handleItemMoveEnd=()=>{this.setState({disableTransition:!0})},this.renderArrayItem=e=>{var n;let{schemaType:r}=this.props,i=(null==(n=r.options)?void 0:n.sortable)!==!1;return(0,oZ.jsx)(Pq,{...e,sortable:i,insertableTypes:r.of})},this.state={disableTransition:!1}}focus(){this._element&&this._element.focus()}getSnapshotBeforeUpdate(e){var n;let{focusPath:r=[],value:i=[]}=e,{focusPath:a=[],value:o=[]}=this.props;if(r[0]===a[0]&&i.length!==o.length){let e=a[0],r=window.getSelection();if(!((null==r?void 0:r.focusNode)instanceof HTMLElement))return null;let i=null==(n=r.focusNode)?void 0:n.querySelector("input,textarea");return i instanceof HTMLInputElement?{prevFocusedIndex:e,restoreSelection:{text:r.toString(),start:i.selectionStart,end:i.selectionEnd,value:i.value}}:{}}return null}componentDidUpdate(e,n,r){var i;let{onIndexFocus:a}=this.props;if((null==r?void 0:r.restoreSelection)&&e.value){let n=e.value[r.prevFocusedIndex],o=function(e,n,r){let i=n-1,a=n,o=e.length;for(;i>-1||a<o;){let n=e[a];if(a<o&&r(n,a))return a;let l=e[i];if(i>-1&&r(l,i))return i;i--,a++}return -1}(this.props.value||[],r.prevFocusedIndex,e=>e===n);if(-1===o)return;let l=null==(i=this._element)?void 0:i.querySelector("[data-item-index='".concat(o,"'] input,textarea"));if(l instanceof HTMLInputElement){l.focus();try{l.setSelectionRange(r.restoreSelection.start,r.restoreSelection.end)}catch{}}a(o)}}render(){let{schemaType:e,members:n,readOnly:r,renderInput:i,onUpload:a,onItemRemove:o,resolveUploader:l,elementProps:s,arrayFunctions:c=PZ,changed:d}=this.props,u=!r&&!1!==lS()(e,"options.sortable"),p=n.map(e=>({id:"".concat(e.key,"-").concat("item"===e.kind?e.item.value:"error"),member:e}));return(0,oZ.jsxs)(oK.Kq,{space:2,"data-testid":"array-primitives-input",children:[(0,oZ.jsx)(PF,{types:e.of,resolveUploader:l,onUpload:a,...s,tabIndex:0,children:(0,oZ.jsx)(oK.Kq,{space:1,children:0===p.length?(0,oZ.jsx)(PN,{schemaType:e}):(0,oZ.jsx)(oK.Zb,{padding:1,border:!0,children:(0,oZ.jsx)(bW,{onItemMove:this.handleSortEnd,onItemMoveStart:this.handleItemMoveStart,onItemMoveEnd:this.handleItemMoveEnd,items:p.map(e=>e.id),sortable:u,gap:1,children:p.map((e,n)=>
1{let{member:r,id:a}=e;return(0,oZ.jsxs)(bY,{id:a,sortable:u,disableTransition:this.state.disableTransition,children:["item"===r.kind&&(0,oZ.jsx)(dQ,{path:r.item.path,isChanged:d,hasFocus:!1,children:(0,oZ.jsx)(wO,{member:r,renderItem:this.renderArrayItem,renderInput:i})}),"error"===r.kind&&(0,oZ.jsx)(PE,{sortable:u,member:r,onRemove:()=>o(n)})]},r.key)})})})})}),(0,oZ.jsx)(c,{onChange:this.props.onChange,onItemAppend:this.handleAppend,onItemPrepend:this.handlePrepend,onValueCreate:wP,readOnly:this.props.readOnly,schemaType:this.props.schemaType,value:this.props.value})]})}}var PV=Object.freeze,PK=Object.defineProperty,PB=(e,n)=>PV(PK(e,"raw",{value:PV(n||e.slice())}));let PU=(0,oV.ZP)(oK.kC)(rM||(rM=PB(["\n  min-height: 33px;\n"]))),PH=(0,oV.ZP)(oK.kC)(rR||(rR=PB(["\n  position: absolute;\n  top: 0;\n  right: 0;\n  height: 33px;\n"]))),P$=(0,oV.ZP)(oK.Zb)(rF||(rF=PB(["\n  position: absolute;\n  top: 0;\n  left: 0;\n"]))),PW=(0,oV.ZP)(oK.Zb)(rD||(rD=PB(["\n  transition: border-color 250ms;\n  box-sizing: border-box;\n  position: relative;\n\n  @media (hover: hover) {\n    "," {\n      opacity: 0;\n    }\n\n    &:hover,\n    &:focus-within {\n      "," {\n        opacity: 1;\n      }\n    }\n  }\n\n  ."," & {\n    box-shadow:\n      0 0 0 0,\n      0 8px 17px 2px var(--card-shadow-umbra-color),\n      0 3px 14px 2px var(--card-shadow-penumbra-color),\n      0 5px 5px -3px var(--card-shadow-ambient-color);\n  }\n\n  &[aria-selected='true'] {\n    box-shadow: 0 0 0 2px var(--card-focus-ring-color);\n  }\n"])),P$,P$,bL);function PY(e){let{validation:n,selected:r,tone:i,presence:a,children:o,dragHandle:l,menu:s,footer:c,...d}=e;return(0,oZ.jsxs)(PW,{forwardedAs:oK.kC,direction:"column",border:!0,selected:r,"aria-selected":r,radius:1,tone:i,...d,children:[o,l&&(0,oZ.jsx)(P$,{margin:1,radius:2,display:"flex",tone:"inherit","data-ui":"DragHandleCard",children:(0,oZ.jsx)(bF,{$grid:!0,mode:"ghost"})}),a&&(0,oZ.jsx)(PH,{align:"center",marginX:1,children:a}),(0,oZ.jsxs)(PU,{align:"center",paddingX:1,sizing:"border",justify:"space-between",children:[(0,oZ.jsx)(oK.kC,{children:n}),(0,oZ.jsx)(oK.xu,{children:c}),s]})]})}var PX=Object.freeze,PG=Object.defineProperty;let PJ=(0,oV.ZP)(oK.Zb)(rq||(rq=PX(PG(X=["\n  border-top-right-radius: inherit;\n  border-top-left-radius: inherit;\n  height: 100%;\n  position: relative;\n\n  @media (hover: hover) {\n    &:hover {\n      filter: brightness(95%);\n    }\n  }\n\n  &:focus:focus-visible {\n    box-shadow: 0 0 0 2px var(--card-focus-ring-color);\n  }\n"],"raw",{value:PX(X.slice())})))),PQ={portal:!0,tone:"default"};function P0(e){var n,r,i,a,o,l;let{schemaType:s,parentSchemaType:c,path:d,readOnly:u,onRemove:p,value:h,open:f,onInsert:m,onFocus:g,onOpen:x,onClose:v,changed:y,focused:b,children:j,inputProps:{renderPreview:w}}=e,{t:k}=dV(),C=!u&&(null==(n=c.options)?void 0:n.sortable)!==!1,_=c.of,T=(0,oN.useRef)(null);v4(T,f),fV(b,(e,n)=>{var r;!e&&n&&T.current&&(null==(r=T.current)||r.focus())});let S=h._resolvingInitialValue,E=(0,oN.useCallback)(()=>{m({items:[{...h,_key:v8()}],position:"after"})},[m,h]),P=(0,oN.useCallback)((e,n)=>{m({items:[b1(n)],position:e})},[m]),O=vE(d,!0),A=(0,oN.useMemo)(()=>0===O.length?null:(0,oZ.jsx)(yC,{presence:O,maxAvatars:1}),[O]),I=vA(d,!0),z=(0,oN.useMemo)(()=>0===I.length?null:(0,oZ.jsx)(oK.xu,{paddingX:1,paddingY:3,children:(0,oZ.jsx)(bo,{validation:I,__unstable_showSummary:!0})}),[I]),M=I.some(e=>"error"===e.level),R=I.some(e=>"warning"===e.level),F=(0,oN.useMemo)(()=>u?null:(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(bA,{paddingY:3}),id:"".concat(e.inputId,"-menuButton"),menu:(0,oZ.jsxs)(oK.v2,{children:[(0,oZ.jsx)(lr.sN,{text:k("inputs.array.action.remove"),tone:"critical",icon:lp.XHJ,onClick:p}),(0,oZ.jsx)(lr.sN,{text:k("inputs.array.action.duplicate"),icon:lp.TIy,onClick:E}),(0,oZ.jsx)(b3,{types:_,onInsert:P})]}),popover:PQ}),[E,P,p,_,e.inputId,u,k]),D=function(e){let{readOnly:n,hasErrors:r,hasWarnings:i}=e;return n?"transparent":r?"critical":i?"caution":"default"}({readOnly:u,hasErrors:M,hasWarnings:R}),q=(0,oZ.jsx)(PY,{menu:F,presence:A,validation:z,tone:D,radius:2,border:!0,dragHandle:C,selected:f,children:(0,oZ.jsxs)(PJ,{tone:"inherit",overflow:"auto",forwardedAs:"button","data-ui":"PreviewCard","data-as":"button",type:"button",flex:1,tabIndex:0,disabled:S,onClick:x,ref:T,onFocus:g,__unstable_focusRing:!0,children:[w({schemaType:s,value:h,layout:"media",withBorder:!1,withShadow:!1}),S&&(0,oZ.jsx)(u4,{fill:!0})]})}),Z=ha(s);return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(dQ,{path:d,isChanged:y,hasFocus:!!b,children:q}),f&&(0,oZ.jsx)(wU,{header:u?k("inputs.array.action.view",{itemTypeTitle:Z}):k("inputs.array.action.edit",{itemTypeTitle:Z}),type:(null==(i=null==(r=null==c?void 0:c.options)?void 0:r.modal)?void 0:i.type)||"dialog",width:null!=(l=null==(o=null==(a=null==c?void 0:c.options)?void 0:a.modal)?void 0:o.width)?l:1,id:h._key,onClose:v,autofocus:b,legacy_referenceElement:T.current,children:j})]})}var P1=Object.freeze,P2=Object.defineProperty;let P3=(0,oV.ZP)(oK.Zb)(rZ||(rZ=P1(P2(G=["\n  max-width: ","px;\n"],"raw",{value:P1(G.slice())}))),e=>{let{theme:n}=e;return n.sanity.container[1]});function P4(e){let{value:n,onFocus:r,vertical:i,...a}=e,[o,l]=oN.useState(!1),[s,c]=oN.useState(null),{t:d}=dV();(0,oK.O8)(()=>l(!1),[s]);let u=oN.useCallback(e=>{("Escape"===e.key||"Tab"===e.key)&&l(!1)},[]),p=(0,oN.useCallback)(()=>{l(e=>!e)},[]),h=(0,sL.wq)(n);return(0,oZ.jsx)(lr.J2,{open:o,ref:c,onKeyDown:u,portal:!0,constrainSize:!0,tone:"default",content:(0,oZ.jsx)(P3,{margin:1,padding:3,onKeyDown:u,tabIndex:0,overflow:"auto",children:(0,oZ.jsxs)(oK.Kq,{space:4,children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{weight:"medium",children:d("inputs.array.error.type-is-incompatible-title")})}),(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(uz,{t:d,i18nKey:"inputs.array.error.current-schema-not-declare-description",values:{typeName:h}})}),(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsxs)(oK.xv,{size:1,children:[(0,oZ.jsx)(lp.sLo,{})," ",d("inputs.array.error.can-delete-but-no-edit-description")]})}),(0,oZ.jsxs)(oK.Kq,{space:2,children:[(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:d("inputs.array.error.json-representation-description")}),(0,oZ.jsx)(oK.Zb,{padding:2,overflow:"auto",border:!0,children:(0,oZ.jsx)(oK.EK,{size:1,as:"pre",language:"json",children:JSON.stringify(n,null,2)})})]})]})}),children:(0,oZ.jsx)(oK.Zb,{as:"button",type:"button",radius:2,tone:"inherit",paddingX:2,paddingY:3,style:{height:"100%"},onFocus:r,onClick:p,onKeyDown:u,__unstable_focusRing:!0,...a,children:(0,oZ.jsxs)(oK.Kq,{space:4,marginTop:2,children:[(0,oZ.jsx)(oK.xu,{margin:1,children:(0,oZ.jsx)(oK.xv,{align:"center",size:4,children:(0,oZ.jsx)(lp.Tzq,{})})}),(0,oZ.jsx)(oK.xv,{align:"center",size:1,children:(0,oZ.jsx)(uz,{t:d,i18nKey:"inputs.array.error.type-is-incompatible-prompt",values:{typeName:h}})})]})})})}let P5={portal:!0,tone:"default"};function P8(e){let{member:n,sortable:r}=e,i=(0,oN.useId)(),{onChange:a}=vC(),{t:o}=dV(),l=(0,oN.useCallback)(()=>{a(fR.from([fM([{_key:n.key}])]))},[a,n.key]);
1return(0,oZ.jsx)(PY,{dragHandle:r,tone:"caution",style:{height:"100%"},menu:(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(bA,{paddingY:3}),id:"".concat(i,"-menuButton"),menu:(0,oZ.jsx)(oK.v2,{children:(0,oZ.jsx)(lr.sN,{text:o("inputs.array.action.remove-invalid-item"),tone:"critical",icon:lp.XHJ,onClick:l})}),popover:P5}),children:"INVALID_ITEM_TYPE"===n.error.type?(0,oZ.jsx)(P4,{value:n.error.value,vertical:!0}):(0,oZ.jsx)("div",{children:o("inputs.array.error.unexpected-error",{error:n.error.type})})})}let P6=[];function P9(e){var n;let{arrayFunctions:r=vf,elementProps:i,members:a,onChange:o,onInsert:l,onItemMove:s,onUpload:c,readOnly:d,renderAnnotation:u,renderBlock:p,renderField:h,renderInlineBlock:f,renderInput:m,renderPreview:g,resolveUploader:x,schemaType:v,value:y=P6}=e,{t:b}=dV(),j=(0,oN.useCallback)(e=>{l({items:[e],position:"before",referenceItem:0})},[l]),w=(0,oN.useCallback)(e=>{l({items:[e],position:"after",referenceItem:-1})},[l]),k=(null==(n=v.options)?void 0:n.sortable)!==!1,C=(0,oN.useCallback)(e=>(0,oZ.jsx)(P0,{...e}),[]),_=(0,oN.useMemo)(()=>a.map(e=>e.key),[a]);return(0,oZ.jsxs)(oK.Kq,{space:2,children:[(0,oZ.jsx)(PF,{types:v.of,resolveUploader:x,onUpload:c,...i,tabIndex:0,children:(0,oZ.jsxs)(oK.Kq,{"data-ui":"ArrayInput__content",space:2,children:[(null==a?void 0:a.length)===0&&(0,oZ.jsx)(oK.Zb,{padding:3,border:!0,radius:2,children:(0,oZ.jsx)(oK.xv,{align:"center",muted:!0,size:1,children:v.placeholder||(0,oZ.jsx)(oZ.Fragment,{children:b("inputs.array.no-items-label")})})}),(null==a?void 0:a.length)>0&&(0,oZ.jsx)(oK.Zb,{border:!0,radius:1,children:(0,oZ.jsx)(bW,{columns:[2,3,4],gap:3,padding:1,margin:1,items:_,onItemMove:s,sortable:k,children:a.map(e=>(0,oZ.jsxs)(bY,{sortable:k,id:e.key,flex:1,children:["item"===e.kind&&(0,oZ.jsx)(wE,{member:e,renderAnnotation:u,renderBlock:p,renderInlineBlock:f,renderItem:C,renderField:h,renderInput:m,renderPreview:g}),"error"===e.kind&&(0,oZ.jsx)(P8,{sortable:k,member:e})]},e.key))})})]})}),(0,oZ.jsx)(r,{onChange:o,onItemAppend:w,onItemPrepend:j,onValueCreate:b1,readOnly:d,schemaType:v,value:y})]})}let P7=[];function Oe(e){var n;let{arrayFunctions:r=vf,elementProps:i,members:a,onChange:o,onInsert:l,onItemMove:s,onUpload:c,focusPath:d,readOnly:u,renderAnnotation:p,renderBlock:h,renderField:f,renderInlineBlock:m,renderInput:g,renderItem:x,renderPreview:v,resolveUploader:y,schemaType:b,value:j=P7}=e,{t:w}=dV(),[k,C]=(0,oN.useState)(null),{space:_}=(0,oK.Fg)().sanity,T=(0,oN.useCallback)(e=>{l({items:[e],position:"before",referenceItem:0})},[l]),S=(0,oN.useCallback)(e=>{l({items:[e],position:"after",referenceItem:-1})},[l]),E=function(e,n){let r=(0,oN.useRef)(e),i=r.current,a=n(i,e);return(0,oN.useEffect)(()=>{a||(r.current=e)}),a?i:e}((0,oN.useMemo)(()=>a.map(e=>e.key),[a]),lu()),{scrollElement:P,containerElement:O}=function(){let e=(0,oN.useContext)(wL);if(!e)throw Error("VirtualizerScrollInstance: missing context value");return e}(),A=(0,oN.useRef)(null),I=(0,oN.useMemo)(()=>(0,ll.Fd)(d[0])?d[0]._key:d[0],[d]),z=(0,oN.useCallback)(e=>{let n={...e};if(null!==k&&(n.startIndex=Math.min(e.startIndex,k),n.endIndex=Math.max(e.endIndex,k)),I){let e=E.findIndex(e=>e===I);-1!==e&&(n.startIndex=Math.min(n.startIndex,e),n.endIndex=Math.max(n.endIndex,e))}return(0,lc.MK)(n)},[k,I,E]),M=(0,oN.useCallback)((e,n)=>{if(!e.scrollElement)return;let r=e.scrollElement,i=()=>{var e,i,a,o;let l=null!=(i=null==(e=O.current)?void 0:e.getBoundingClientRect().top)?i:0,s=null!=(o=null==(a=A.current)?void 0:a.getBoundingClientRect().top)?o:0;n(r.scrollTop-Math.floor(s-l))};return i(),e.scrollElement.addEventListener("scroll",i,{capture:!1,passive:!0}),()=>{r.removeEventListener("scroll",i)}},[O]),R=(0,oN.useCallback)(()=>53,[]),F=(0,ls.MG)({count:a.length,estimateSize:R,getScrollElement:(0,oN.useCallback)(()=>P,[P]),observeElementOffset:M,rangeExtractor:z,getItemKey:(0,oN.useCallback)(e=>E[e],[E]),scrollToFn:(e,n,r)=>{e!==r.scrollOffset&&(0,lc.sA)(e,n,r)}}),D=F.getVirtualItems(),q=(0,oN.useCallback)(e=>{var n,r;let{active:i}=e;C(null==(r=null==(n=i.data.current)?void 0:n.sortable)?void 0:r.index)},[]),Z=(0,oN.useCallback)(()=>{C(null)},[]),N=(null==(n=b.options)?void 0:n.sortable)!==!1;return(0,oZ.jsxs)(oK.Kq,{space:2,ref:A,children:[(0,oZ.jsx)(PF,{$radius:2,types:b.of,resolveUploader:y,onUpload:c,...i,tabIndex:0,children:(0,oZ.jsx)(oK.Kq,{"data-ui":"ArrayInput__c
1ontent",space:2,children:0===a.length?(0,oZ.jsx)(oK.Zb,{padding:3,border:!0,radius:2,children:(0,oZ.jsx)(oK.xv,{align:"center",muted:!0,size:1,children:b.placeholder||(0,oZ.jsx)(oZ.Fragment,{children:w("inputs.array.no-items-label")})})}):(0,oZ.jsx)(oK.Zb,{border:!0,radius:2,style:{boxSizing:"border-box",height:"".concat(F.getTotalSize()+D.length*_[1]+_[1],"px"),width:"100%",position:"relative"},children:(0,oZ.jsx)(bW,{axis:"y",gap:1,paddingY:1,items:E,onItemMove:s,onItemMoveStart:q,onItemMoveEnd:Z,sortable:N,style:{position:"absolute",top:0,left:0,width:"100%",transform:"translateY(".concat(D[0].start,"px)")},children:D.map(n=>{let r=a[n.index];return(0,oZ.jsxs)(bY,{ref:F.measureElement,sortable:N,"data-index":n.index,id:r.key,children:["item"===r.kind&&(0,oZ.jsx)(wE,{member:r,renderAnnotation:p,renderBlock:h,renderField:f,renderInlineBlock:m,renderInput:g,renderItem:x,renderPreview:v}),"error"===r.kind&&(0,oZ.jsx)(PE,{sortable:N,member:r,onRemove:()=>e.onItemRemove(r.key)})]},n.key)})})})})}),(0,oZ.jsx)(r,{onChange:o,onItemAppend:S,onItemPrepend:T,onValueCreate:b1,readOnly:u,schemaType:b,value:j})]})}function Ot(e){var n;return(null==(n=e.schemaType.options)?void 0:n.layout)==="grid"?(0,oZ.jsx)(P9,{...e}):(0,oZ.jsx)(Oe,{...e})}let On=["string","number","boolean"];function Or(e){return(0,ll.n4)(e)?e:{title:s6()("".concat(e)),value:e}}let Oi={title:"",value:void 0};function Oa(e){var n,r;let{value:i,readOnly:a,validationError:o,schemaType:l,onChange:s,path:c,changed:d,focused:u,elementProps:p}=e,h=(0,oN.useMemo)(()=>{var e;return((null==(e=l.options)?void 0:e.list)||[]).map(Or)},[null==(n=l.options)?void 0:n.list]),f=h.find(e=>e.value===i),m=l.options&&"radio"===l.options.layout,g=(0,oN.useCallback)(e=>h[Number(e)],[h]),x=(0,oN.useCallback)(e=>String(h.indexOf(e)),[h]),v=(0,oN.useId)(),y=oN.useCallback(e=>{s(fR.from(void 0===(null==e?void 0:e.value)?fM():fz(e.value)))},[s]),b=(0,oN.useCallback)(e=>{let n=g(e.currentTarget.value);if(!n){y(Oi);return}y(n)},[y,g]),j=m?(0,oZ.jsx)(Oo,{...p,value:f,inputId:v,items:h,direction:(null==(r=l.options)?void 0:r.direction)||"vertical",customValidity:o,onChange:y,readOnly:a}):(0,oZ.jsx)(oK.Ph,{...p,customValidity:o,value:x(f),readOnly:a,onChange:b,children:[Oi,...h].map((e,n)=>(0,oZ.jsx)("option",{value:n-1,children:e.title},"".concat(n-1)))});return(0,oZ.jsx)(dQ,{path:c,isChanged:d,hasFocus:!!u,children:j})}let Oo=(0,oN.forwardRef)(function(e,n){let{items:r,value:i,onChange:a,onFocus:o,readOnly:l,customValidity:s,direction:c,inputId:d}=e,u="horizontal"===c?oK.gF:oK.Kq;return(0,oZ.jsx)(oK.Zb,{border:!0,padding:3,radius:2,children:(0,oZ.jsx)(u,{space:3,role:"group",children:r.map((e,r)=>(0,oZ.jsx)(Ol,{customValidity:s,inputId:d,item:e,onChange:a,onFocus:o,readOnly:l,ref:0===r?n:null,value:i},r))})})}),Ol=(0,oN.forwardRef)(function(e,n){let{customValidity:r,inputId:i,item:a,onChange:o,onFocus:l,readOnly:s,value:c}=e,d=(0,oN.useCallback)(()=>{o(a)},[a,o]);return(0,oZ.jsxs)(oK.kC,{as:"label",align:"center",children:[(0,oZ.jsx)(oK.Y8,{ref:n,checked:c===a,onChange:d,onFocus:l,readOnly:s,customValidity:r,name:i}),(0,oZ.jsx)(oK.xu,{marginLeft:2,children:(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:a.title})})]})});function Os(e){let{validationError:n,elementProps:r}=e;return(0,oZ.jsx)(oK.oi,{...r,customValidity:n,"data-testid":"string-input"})}let Oc=(e,n)=>{if("function"==typeof e)throw Error('Schema type "'.concat((null==n?void 0:n.name)||"<not-found>","\"'s `validation` was not run though `inferFromSchema`"));return e?Array.isArray(e)?e:[e]:[]};function Od(e,n){for(let r of Oc(null==e?void 0:e.validation,e))for(let e of r._rules)if(e.flag===n)return e;return null}function Ou(e){let{schemaType:n,validationError:r,elementProps:i}=e,a=Od(n,"min"),o=Od(n,"integer"),l=Od(n,"precision"),s="number"==typeof(null==a?void 0:a.constraint)&&(null==a?void 0:a.constraint)>=0,c=o||(null==l?void 0:l.constraint)===0;return(0,oZ.jsx)(oK.oi,{...i,type:"number",step:"any",inputMode:s?c?"numeric":"decimal":"text",customValidity:r,placeholder:n.placeholder,pattern:s?"[d]*":void 0,max:Number.MAX_SAFE_INTEGER,min:Number.MIN_SAFE_INTEGER,"data-testid":"number-input"})}var Op=Object.freeze,Oh=Object.defineProperty,Of=(e,n)=>Op(Oh(e,"raw",{value:Op(n||e.slice())}));let Om=(0,oV.ZP)(oK.xu)(rN||(rN=Of(["\n  align-self: center;
1\n"]))),Og=(0,oV.ZP)(oK.xu)(rL||(rL=Of(["\n  line-height: 0;\n"])));function Ox(e){let{fieldNames:n,onChange:r,readOnly:i,value:a}=e,o=n.length,l=(0,oN.useCallback)(e=>{r(fM([e]))},[r]),{t:s}=dV();return(0,oZ.jsxs)(fN,{status:"warning",title:(0,oZ.jsx)(oZ.Fragment,{children:s("inputs.object.unknown-fields.warning.title",{count:o})}),children:[(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(oZ.Fragment,{children:s("inputs.object.unknown-fields.warning.description",{count:o})})}),(0,oZ.jsxs)(j_,{marginTop:4,open:xh,title:s("inputs.object.unknown-fields.warning.details.title"),children:[(0,oZ.jsx)(oK.xu,{marginBottom:3,children:(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(oZ.Fragment,{children:s("inputs.object.unknown-fields.warning.details.description",{count:o})})})}),(0,oZ.jsx)(oK.Kq,{as:"ul",space:3,children:n.map(e=>(0,oZ.jsx)(Ov,{fieldName:e,onUnsetClick:l,readOnly:i,value:null==a?void 0:a[e]},e))})]})]})}function Ov(e){let{fieldName:n,onUnsetClick:r,readOnly:i,value:a}=e,o=(0,oN.useCallback)(()=>{r(n)},[n,r]),{t:l}=dV();return(0,oZ.jsxs)(oK.Zb,{as:"li",overflow:"hidden",radius:2,shadow:1,tone:"caution",children:[(0,oZ.jsx)(oK.Zb,{padding:3,shadow:1,tone:"inherit",children:(0,oZ.jsx)(oK.EK,{size:1,children:n})}),(0,oZ.jsx)(oK.xu,{overflow:"auto",padding:3,children:(0,oZ.jsx)(oK.EK,{language:"json",size:1,children:JSON.stringify(a,null,2)})}),i&&(0,oZ.jsx)(oK.xu,{padding:3,children:(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:l,i18nKey:"inputs.object.unknown-fields.read-only.description"})})}),!i&&(0,oZ.jsx)(oK.Zb,{padding:3,shadow:1,tone:"inherit",children:(0,oZ.jsx)(lr.zx,{icon:lp.XHJ,mode:"ghost",onClick:o,size:"large",tone:"critical",text:l("inputs.object.unknown-fields.remove-field-button.text")})})]})}var Oy=Object.freeze,Ob=Object.defineProperty;let Oj=(0,oV.ZP)(oK.Zb)(rV||(rV=Oy(Ob(J=["\n  margin-bottom: ","px;\n  padding-bottom: ","px;\n"],"raw",{value:Oy(J.slice())}))),e=>{let{$level:n,theme:r}=e;return 0===n?0:-1*r.sanity.space[5]},e=>{let{$level:n,theme:r}=e;return r.sanity.space[4]}),Ow=(0,oN.forwardRef)(function(e,n){let{onClick:r}=e,i=oN.useCallback(()=>{null==r||r(e.name)},[e.name,r]);return(0,oZ.jsx)(lr.OK,{"data-testid":"group-tab-".concat(e.name),id:"".concat(e.name,"-tab"),label:e.title,ref:n,...e,onClick:i})}),Ok=e=>{let{name:n,title:r,...i}=e,{selected:a}=e;return(0,oZ.jsx)("option",{title:r,value:n,id:"".concat(n,"-tab"),"aria-controls":i["aria-controls"],"data-testid":"group-select-".concat(n),"aria-selected":a?"true":"false",children:r||n})};var OC=Object.freeze,O_=Object.defineProperty;let OT=(0,oV.ZP)(oK.iX)(rK||(rK=OC(O_(Q=["\n  /* Hide on small screens */\n  &[data-eq-max~='0'] [data-ui='TabList'] {\n    display: none;\n  }\n\n  /* Hide on medium to large screens */\n  [data-ui='Select'] {\n    display: none;\n  }\n\n  /* Show on small screens */\n  &[data-eq-max~='0'] [data-ui='Select'] {\n    display: block;\n  }\n"],"raw",{value:OC(Q.slice())})))),OS=e=>{let{inputId:n,groups:r,onClick:i,shouldAutoFocus:a=!0,disabled:o}=e;return(0,oZ.jsx)(oK.td,{space:2,"data-testid":"field-group-tabs",children:r.map(e=>(0,oZ.jsx)(Ow,{"aria-controls":"".concat(n,"-field-group-fields"),autoFocus:a&&e.selected,disabled:o||e.disabled,icon:null==e?void 0:e.icon,name:e.name,onClick:i,selected:!!e.selected,title:e.title||e.name},"".concat(n,"-").concat(e.name,"-tab")))})},OE=e=>{var n;let{disabled:r,groups:i,inputId:a,onSelect:o,shouldAutoFocus:l=!0}=e,s=(0,oN.useCallback)(e=>{o(e.currentTarget.value)},[o]),{t:c}=dV();return(0,oZ.jsx)(oK.Ph,{"aria-label":c("inputs.object.field-group-tabs.aria-label"),autoFocus:l,"data-testid":"field-group-select",disabled:r,fontSize:2,muted:!0,onChange:s,value:null==(n=i.find(e=>e.selected))?void 0:n.name,children:i.map(e=>(0,oZ.jsx)(Ok,{"aria-controls":"".concat(a,"-field-group-fields"),disabled:e.disabled,name:e.name,selected:!!e.selected,title:e.title||e.name},"".concat(a,"-").concat(e.name,"-tab")))})},OP=oN.memo(function(e){let{disabled:n=!1,onClick:r,...i}=e,a=(0,oN.useCallback)(e=>{null==r||r(e)},[r]);return(0,oZ.jsxs)(OT,{"data-testid":"field-group-root",children:[(0,oZ.jsx)(OS,{...i,disabled:n,onClick:a}),(0,oZ.jsx)(OE,{...i,disabled:n,onSelect:a})]})}),OO=(0,oN.memo)(function(e){let{schemaType:n,groups:r,members:i,onChange:a,renderAnnotation:o,renderBlock:l,renderInlineBlock:s,renderInput:c,renderField:d,renderItem:u,renderPreview:p,level:h,value:f,id:m,onFieldGroupSelect:g}
1=e,{columns:x}=n.options||{},v=(0,oN.useMemo)(()=>{if(!n.fields)return null;let e=n.fields.map(e=>e.name),r=Object.keys(f||{}).filter(n=>!n.startsWith("_")&&!e.includes(n));return 0===r.length?null:(0,oZ.jsx)(Ox,{fieldNames:r,value:f,onChange:a})},[a,n.fields,f]),y=(0,oN.useMemo)(()=>r.find(e=>{let{selected:n}=e;return n}),[r]),b=(0,oN.useCallback)(()=>(0,oZ.jsx)(wD,{members:i,renderAnnotation:o,renderBlock:l,renderField:d,renderInlineBlock:s,renderInput:c,renderItem:u,renderPreview:p}),[i,o,l,d,s,c,u,p]);return 0===i.length?null:(0,oZ.jsxs)(oK.Kq,{space:6,children:[r.length>0?(0,oZ.jsx)(Oj,{$level:h,"data-testid":"field-groups",children:(0,oZ.jsx)(OP,{groups:r,inputId:m,onClick:g,shouldAutoFocus:!1})}):null,(0,oZ.jsx)(oN.Fragment,{children:x?(0,oZ.jsx)(oK.rj,{columns:x,gap:4,marginTop:1,children:b()}):b()},null==y?void 0:y.name),v]})});function OA(e){let{date:n,focused:r,isCurrentMonth:i,isToday:a,onSelect:o,selected:l}=e,s=(0,oN.useCallback)(()=>{o(n)},[n,o]);return(0,oZ.jsx)("div",{"aria-selected":l,"data-ui":"CalendarDay",children:(0,oZ.jsx)(oK.Zb,{"aria-label":n.toDateString(),"aria-pressed":l,as:"button",__unstable_focusRing:!0,"data-weekday":!0,"data-focused":r?"true":"",role:"button",tabIndex:-1,onClick:s,padding:2,radius:2,selected:l,tone:a||l?"primary":"default",children:(0,oZ.jsx)(oK.xv,{muted:!l&&!i,size:1,style:{textAlign:"center"},weight:i?"medium":"regular",children:n.getDate()})})})}let OI=co()(0,24),Oz=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],OM=[1,2,3,4,5,6],OR=(e,n)=>{let r=(0,lX.Z)(e);return(0,lG.Z)({start:r,end:(0,lJ.Z)(r)},{weekStartsOn:7===n?0:n})},OF=e=>e.map(e=>[e,...OM.map(n=>(0,lQ.Z)(e,n))]),OD=e=>{let{weekInfo:n}=uk();return OF(OR(e,n.firstDay)).map(e=>({number:(0,l0.Z)(e[0]),days:e}))};function Oq(e){let{weekInfo:{firstDay:n}}=uk(),r=1===n?e.weekDayNames:[e.weekDayNames[6],...e.weekDayNames.slice(0,6)];return(0,oZ.jsx)(oK.xu,{"aria-hidden":e.hidden||!1,"data-ui":"CalendarMonth",children:(0,oZ.jsxs)(oK.rj,{gap:1,style:{gridTemplateColumns:"repeat(7, minmax(44px, 46px))"},children:[r.map(e=>(0,oZ.jsx)(oK.xu,{paddingY:2,children:(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",style:{textAlign:"center"},children:e})},e)),OD(e.date).map((n,r)=>n.days.map((n,i)=>{let a=e.focused&&(0,l1.Z)(n,e.focused),o=e.selected&&(0,l1.Z)(n,e.selected),l=(0,l1.Z)(n,new Date),s=e.focused&&(0,l2.Z)(n,e.focused);return(0,oZ.jsx)(OA,{date:n,focused:a,isCurrentMonth:s,isToday:l,onSelect:e.onSelect,selected:o},"".concat(r,"-").concat(i))}))]})})}let OZ={dayPresets:!1,timePresets:!1},ON=oN.forwardRef(function(e,n){let{onChange:r,onBlur:i,onKeyPress:a,value:o,...l}=e,[s,c]=oN.useState(),d=oN.useCallback(e=>{c(e.currentTarget.value)},[]),u=oN.useCallback(e=>{e.currentTarget.value!=="".concat(o)&&r&&r(e),c(void 0)},[r,o]),p=oN.useCallback(e=>{u(e),i&&i(e)},[u,i]),h=oN.useCallback(e=>{"Enter"===e.key&&u(e),a&&a(e)},[u,a]);return(0,oZ.jsx)(oK.oi,{...l,"data-testid":"date-input",ref:n,value:void 0===s?o:s,onChange:d,onBlur:p,onKeyPress:h})}),OL=e=>{let{onChange:n,...r}=e,i=oN.useCallback(e=>{let r=parseInt(e.currentTarget.value,10);isNaN(r)||n(r)},[n]);return(0,oZ.jsx)(ON,{...r,fontSize:1,onChange:i,inputMode:"numeric",padding:2,radius:2})},OV=(0,oZ.jsx)("span",{"data-preserve-focus":!0,style:{overflow:"hidden",position:"absolute",outline:"none"},tabIndex:-1}),OK={padding:2},OB=(0,oN.forwardRef)(function(e,n){let{selectTime:r,onFocusedDateChange:i,selectedDate:a=new Date,focusedDate:o=a,timeStep:l=1,onSelect:s,labels:c,...d}=e,u=(0,oN.useCallback)(e=>i(e),[i]),p=(0,oN.useCallback)(e=>u((0,l3.Z)((0,l4.Z)(o,e),1)),[o,u]),h=(0,oN.useCallback)(e=>p(Number(e.currentTarget.value)),[p]),f=(0,oN.useCallback)(e=>u((0,l5.Z)(o,e)),[o,u]),m=(0,oN.useCallback)(e=>u((0,l8.Z)(o,e)),[o,u]),g=(0,oN.useCallback)(e=>{s((0,l6.Z)((0,l9.Z)(e,a.getHours()),a.getMinutes()))},[s,a]),x=(0,oN.useCallback)(e=>{let n=Number(e.currentTarget.value);s((0,l6.Z)(a,n))},[s,a]),v=(0,oN.useCallback)(e=>{let n=Number(e.currentTarget.value);s((0,l9.Z)(a,n))},[s,a]);(0,oN.useCallback)((e,n)=>{s((0,l9.Z)((0,l6.Z)(a,n),e))},[s,a]);let y=(0,oK.ts)(n),b=(0,oN.useCallback)(()=>{var e,n;null==(n=null==(e=y.current)?void 0:e.querySelector('[data-focused="true"]'))||n.focus()},[y]),j=(0,oN.useCallback)(e=>{var n,r;
1if(!Oz.includes(e.key))return;let a=e.currentTarget;if(e.preventDefault(),a.hasAttribute("data-calendar-grid")){b();return}"ArrowUp"===e.key&&i((0,lQ.Z)(o,-7)),"ArrowDown"===e.key&&i((0,lQ.Z)(o,7)),"ArrowLeft"===e.key&&i((0,lQ.Z)(o,-1)),"ArrowRight"===e.key&&i((0,lQ.Z)(o,1)),null==(r=null==(n=y.current)?void 0:n.querySelector("[data-preserve-focus]"))||r.focus()},[y,b,i,o]);(0,oN.useEffect)(()=>{b()},[b]),(0,oN.useEffect)(()=>{var e;(null==(e=document.activeElement)?void 0:e.matches("[data-calendar-grid], [data-calendar-grid] [data-preserve-focus]"))&&b()},[y,b,o]),(0,oN.useCallback)(()=>g((0,lQ.Z)(new Date,-1)),[g]),(0,oN.useCallback)(()=>g(new Date),[g]),(0,oN.useCallback)(()=>g((0,lQ.Z)(new Date,1)),[g]);let w=(0,oN.useCallback)(()=>s(new Date),[s]);return(0,oZ.jsxs)(oK.xu,{"data-ui":"Calendar",...d,ref:y,children:[(0,oZ.jsxs)(oK.xu,{padding:2,children:[OZ.dayPresets,(0,oZ.jsxs)(oK.kC,{children:[(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(OU,{moveFocusedDate:f,onChange:h,labels:{goToPreviousMonth:c.goToPreviousMonth,goToNextMonth:c.goToNextMonth},monthNames:c.monthNames,value:null==o?void 0:o.getMonth()})}),(0,oZ.jsx)(oK.xu,{marginLeft:2,children:(0,oZ.jsx)(OH,{moveFocusedDate:f,labels:{goToNextYear:c.goToNextYear,goToPreviousYear:c.goToPreviousYear},onChange:m,value:o.getFullYear()})})]}),(0,oZ.jsxs)(oK.xu,{"data-calendar-grid":!0,onKeyDown:j,marginTop:2,overflow:"hidden",tabIndex:0,children:[(0,oZ.jsx)(Oq,{weekDayNames:c.weekDayNamesShort,date:o,focused:o,onSelect:g,selected:a}),OV]})]}),r&&(0,oZ.jsxs)(oK.xu,{padding:2,style:{borderTop:"1px solid var(--card-border-color)"},children:[(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsxs)(oK.kC,{align:"center",flex:1,children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.Ph,{"aria-label":c.selectHour,fontSize:1,padding:2,radius:2,value:null==a?void 0:a.getHours(),onChange:v,children:OI.map(e=>(0,oZ.jsx)("option",{value:e,children:"".concat(e).padStart(2,"0")},e))})}),(0,oZ.jsx)(oK.xu,{paddingX:1,children:(0,oZ.jsx)(oK.xv,{size:1,children:":"})}),(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.Ph,{"aria-label":c.selectMinute,fontSize:1,padding:2,radius:2,value:null==a?void 0:a.getMinutes(),onChange:x,children:co()(0,60,l).map(e=>(0,oZ.jsx)("option",{value:e,children:"".concat(e).padStart(2,"0")},e))})})]}),(0,oZ.jsx)(oK.xu,{marginLeft:2,children:(0,oZ.jsx)(lr.zx,{text:c.setToCurrentTime,mode:"bleed",onClick:w})})]}),OZ.timePresets]})]})});function OU(e){let{moveFocusedDate:n,onChange:r,value:i,labels:a,monthNames:o}=e,l=(0,oN.useCallback)(()=>n(-1),[n]),s=(0,oN.useCallback)(()=>n(1),[n]);return(0,oZ.jsxs)(oK.kC,{flex:1,gap:1,children:[(0,oZ.jsx)(lr.zx,{"aria-label":a.goToPreviousMonth,onClick:l,mode:"bleed",icon:lp.wyc,tooltipProps:{content:"Previous month"},...OK}),(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.Ph,{fontSize:1,radius:2,value:i,onChange:r,padding:2,children:o.map((e,n)=>(0,oZ.jsx)("option",{value:n,children:e},n))})}),(0,oZ.jsx)(lr.zx,{"aria-label":a.goToNextMonth,mode:"bleed",icon:lp.XCv,onClick:s,tooltipProps:{content:"Next month"},...OK})]})}function OH(e){let{moveFocusedDate:n,onChange:r,value:i,labels:a}=e,o=(0,oN.useCallback)(()=>n(-12),[n]),l=(0,oN.useCallback)(()=>n(12),[n]);return(0,oZ.jsxs)(oK.kC,{gap:1,children:[(0,oZ.jsx)(lr.zx,{"aria-label":a.goToPreviousYear,onClick:o,mode:"bleed",icon:lp.wyc,tooltipProps:{content:"Previous year"},...OK}),(0,oZ.jsx)(OL,{value:i,onChange:r,radius:0,style:{width:48}}),(0,oZ.jsx)(lr.zx,{"aria-label":a.goToNextYear,onClick:l,mode:"bleed",icon:lp.XCv,tooltipProps:{content:"Next year"},...OK})]})}let O$=oN.forwardRef(function(e,n){let{value:r=new Date,onChange:i,calendarLabels:a,...o}=e,[l,s]=oN.useState(),c=oN.useCallback(e=>{i(e),s(void 0)},[i]);return(0,oZ.jsx)(OB,{...o,labels:a,ref:n,selectedDate:r,onSelect:c,focusedDate:l||r,onFocusedDateChange:s})}),OW=(0,oN.forwardRef)(function(e,n){let{value:r,inputValue:i,onInputChange:a,onChange:o,selectTime:l,timeStep:s,calendarLabels:c,...d}=e,[u,p]=(0,oN.useState)(null),h=(0,oK.ts)(n),f=(0,oN.useRef)(null),[m,g]=(0,oN.useState)(!1);(0,oK.O8)(()=>g(!1),[u]);let x=(0,oN.useCallback)(()=>{var e,n;null==(e=h.current)||e.focus(),null==(n=h.current)||n.select()},[h]),v=(0,oN.useCallback)(e=>{"Escape"===e.key&&g(!1)},[]),y=(0,oN.useCallback)(()=>g(!0),[]),b=(0,oZ.jsx)(oK.kC,{style:{padding:"5px"},children:(0,oZ.jsx)(lr.zx,{ref:f,icon:lp.Que,mode:"bleed",onClick:y,style:{display:"block"},"data-testid":"select-date-button",tooltipProps:{content:"Select date"}})});return(0,oZ.jsx)(ON,{ref:h,...d,value:i,onChange:a,suffix:m?(0,oZ.jsx)(oK.li,{zOffset:1e3,children:(0,oZ.jsx)(lr.J2,{constrainSize:!0,"data-testid":"date-input-dialog",portal:!0,content:(0,oZ.jsx)(oK.xu,{overflow:"auto",children:(0,oZ.jsx)(lg.ZP,{onDeactivation:x,children:(0,oZ.jsx)(O$,{calendarLabels:c,selectTime:l,timeStep:s,onKeyUp:v,value:r,onChange:o})})}),open:!0,placement:"bottom",ref:p,children:b})}):b})}),OY=new Date,OX=oN.forwardRef(function(e,n){let{id:r,deserialize:i,formatInputValue:a,onChange:o,parseInputValue:l,placeholder:s,readOnly:c,selectTime:d,serialize:u,timeStep:p,value:h,...f}=e,[m,g]=oN.useState(null),{t:x}=dV();(0,oN.useEffect)(()=>{g(null)},[h]);let v=oN.useCallback(e=>{let n=e.currentTarget.value,r=""===n?null:l(n);null===r?(o(null),void 0===h&&m&&g(null)):r.isValid?o(u(r.date)):g(n)},[l,o,h,m,u]),y=oN.useCallback(e=>{o(e?u(e):null)},[u,o]),b=(0,oK.ts)(n),j=m?l(m):h?i(h):null,w=m||((null==j?void 0:j.isValid)?a(j.date):h);return c?(0,oZ.jsx)(oK.oi,{value:w,readOnly:!0}):(0,oZ.jsx)(OW,{...f,calendarLabels:e.calendarLabels,id:r,selectTime:d,timeStep:p,placeholder:s||x("inputs.datetime.placeholder",{example:a(OY)}),ref:b,value:null==j?void 0:j.date,inputValue:w||"",readOnly:!!c,onInputChange:v,onCh
1ange:y,customValidity:null==j?void 0:j.error})});function OG(e){return{goToTomorrow:e("calendar.action.go-to-tomorrow"),goToToday:e("calendar.action.go-to-today"),goToYesterday:e("calendar.action.go-to-yesterday"),goToNextMonth:e("calendar.action.go-to-next-month"),goToPreviousMonth:e("calendar.action.go-to-previous-month"),goToNextYear:e("calendar.action.go-to-next-year"),goToPreviousYear:e("calendar.action.go-to-previous-year"),setToCurrentTime:e("calendar.action.set-to-current-time"),selectHour:e("calendar.action.select-hour"),selectMinute:e("calendar.action.select-minute"),monthNames:[e("calendar.month-names.january"),e("calendar.month-names.february"),e("calendar.month-names.march"),e("calendar.month-names.april"),e("calendar.month-names.may"),e("calendar.month-names.june"),e("calendar.month-names.july"),e("calendar.month-names.august"),e("calendar.month-names.september"),e("calendar.month-names.october"),e("calendar.month-names.november"),e("calendar.month-names.december")],weekDayNamesShort:[e("calendar.weekday-names.short.monday"),e("calendar.weekday-names.short.tuesday"),e("calendar.weekday-names.short.wednesday"),e("calendar.weekday-names.short.thursday"),e("calendar.weekday-names.short.friday"),e("calendar.weekday-names.short.saturday"),e("calendar.weekday-names.short.sunday")],setToTimePreset:(n,r)=>e("calendar.action.set-to-time-preset",{time:n,date:r})}}function OJ(e){return e.toISOString()}function OQ(e){let n=new Date(e);return n instanceof Date&&!isNaN(n.valueOf())?{isValid:!0,date:n}:{isValid:!1,error:'Invalid date value: "'.concat(e,'"')}}let O0="YYYY-MM-DD",O1=e=>(0,sX.Q)(e,O0),O2=e=>(0,sX.W)(e,O0);var O3=Object.freeze,O4=Object.defineProperty;let O5=(0,oV.ZP)(oK.Kx)(rB||(rB=O3(O4(ee=["\n  &[data-as='textarea'] {\n    resize: vertical;\n  }\n"],"raw",{value:O3(ee.slice())})))),O8=(e,n)=>{var r;let i=null==(r=n.options)?void 0:r.maxLength;return e?cs()(e,{truncate:"number"==typeof i?i:200,symbols:!0}):""};async function O6(e,n,r){var i;return e?((null==(i=n.options)?void 0:i.slugify)||O8)(e,n,r):e}async function O9(e,n,r){return"function"==typeof e?e(n,r):o2.U2(n,e)}let O7={document:OO,object:OO,array:function(e){return(0,oN.useMemo)(()=>{var n;return Array.isArray(null==(n=e.schemaType.options)?void 0:n.list)},[e.schemaType])?(0,oZ.jsx)(SH,{...e}):(0,ll.d7)(e.schemaType)?(0,oZ.jsx)(PL,{...e}):(0,oZ.jsx)(Ot,{...e})},boolean:function(e){var n;let{id:r,value:i,schemaType:a,readOnly:o,elementProps:l,validation:s}=e,c="checkbox"===((null==(n=a.options)?void 0:n.layout)||"switch")?oK.XZ:oK.rs;return(0,oZ.jsx)(oK.Zb,{border:!0,"data-testid":"boolean-input",radius:2,tone:o?"transparent":void 0,children:(0,oZ.jsxs)(oK.kC,{children:[(0,oZ.jsx)(Og,{padding:3,children:(0,oZ.jsx)(c,{label:a.title,...l,checked:i||!1,disabled:o,indeterminate:"boolean"!=typeof i,style:{margin:-4}})}),(0,oZ.jsx)(oK.xu,{flex:1,paddingY:2,children:(0,oZ.jsx)(bd,{deprecated:a.deprecated,description:a.description,inputId:r,validation:s,title:a.title})}),(0,oZ.jsx)(Om,{paddingX:3,paddingY:1,children:(0,oZ.jsx)(bO,{maxAvatars:1,position:"top"})})]})})},number:Ou,text:function(e){let{schemaType:n,validationError:r,value:i,elementProps:a}=e;return(0,oZ.jsx)(O5,{customValidity:r,value:i||"",placeholder:n.placeholder,rows:"number"==typeof n.rows?n.rows:10,...a})},email:function(e){let{validationError:n,elementProps:r}=e;return(0,oZ.jsx)(oK.oi,{...r,type:"email",inputMode:"email",customValidity:n})},datetime:function(e){let{onChange:n,schemaType:r,value:i,elementProps:a}=e,{dateFormat:o,timeFormat:l,timeStep:s}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dateFormat:e.dateFormat||"YYYY-MM-DD",timeFormat:e.timeFormat||"HH:mm",timeStep:"timeStep"in e&&Number(e.timeStep)||1}}(r.options),{t:c}=dV(),d=(0,oN.useCallback)(e=>{let r=e;null!==r&&s>1&&(r=function(e,n){if(!n||1===n)return e;let r=(0,l7.Z)(e),i=(0,se.Z)(r),a=i%n;return 0!==a?OJ((0,l6.Z)(r,i-a)):OJ(r)}(r,s)),n(null===r?fM():fz(r))},[n,s]),u=oN.useCallback(e=>(0,sX.W)(e,"".concat(o," ").concat(l)),[o,l]),p=oN.useCallback(e=>(0,sX.Q)(e,"".concat(o," ").concat(l)),[o,l]),h=(0,oN.useMemo)(()=>OG(c),[c]);return(0,oZ.jsx)(OX,{...a,calendarLabels:h,onChange:d,deserialize:OQ,formatInputValue:u,parseInputValue:p,placeholder:r.placeholder,selectTime:!0,serialize:OJ,timeStep:s,value:i})},date:function(e){var n;let{readOnly:r,onChange:i,schemaType:a,elementProps:o,value:l}=e,s=(null==(n=a.options)?void 0:n.dateFormat)||O0,{t:c}=dV(),d=(0,oN.useCallback)(e=>{i(null===e?fM():fz(e))},[i]),u=(0,oN.useCallback)(e=>(0,sX.W)(e,s),[s]),p=(0,oN.useCallback)(e=>(0,sX.Q)(e,s),[s]),h=(0,oN.useMemo)(()=>OG(c),[c]);return(0,oZ.jsx)(OX,{...o,deserialize:O1,formatInputValue:u,onChange:d,parseInputValue:p,placeholder:a.placeholder,calendarLabels:h,readOnly:r,selectTime:!1,serialize:O2,value:l})},url:function(e){var n,r;let{schemaType:i,validationError:a,elementProps:o}=e,l=Od(i,"uri"),s=(null==(r=null==(n=null==l?void 0:l.constraint)?void 0:n.options)?void 0:r.allowRelative)?"text":"url";return(0,oZ.jsx)(oK.oi,{type:s,inputMode:"url",customValidity:a,...o})},image:function(e){var n;let r=null==(n=e.schemaType.options)?void 0:n.sources,{image:i}=vm().__internal,a=z8(),o=hN(h$),l=i.directUploads,s=(0,oN.useCallback)((e,n)=>l?j1(e,n):null,[l]),c=oN.useMemo(()=>r||i.assetSources,[i,r]),d=oN.useMemo(()=>sh()(o),[o]),u=(0,oN.useCallback)(e=>jL(a,e),[a]),{t:p}=dV();return(0,oZ.jsx)(TF,{...e,t:p,client:o,assetSources:c,directUploads:l,imageUrlBuilder:d,observeAsset:u,resolveUploader:s})},file:function(e){var n;let r=null==(n=e.schemaType.options)?void 0:n.sources,i=z8(),{file:a}=vm().__internal,o=hN(h$),{t:l}=dV(),s=(0,oN.useCallback)((e,n)=>a.directUploads?j1(e,n):null,[a.directUploads]),c=(0,oN.useMemo)(()=>r||a.assetSources,[a,r]),d=(0,oN.useCallback)(e=>jL(i,e),[i]);return(0,oZ.jsx)(_O,{...e,t:l,client:o,assetSources:c,directUploads:a.directUploads,observeAsset:d,resolveUploader:s})},string:Os,slug:function(e){var n;let r=function(){let e=(0,oN.useContext)(vd);if(!e)throw Error("useFormValue must be used within a FormValueProvider");return e}
1(),{path:i,value:a,schemaType:o,validation:l,onChange:s,readOnly:c,elementProps:d}=e,u=null==(n=o.options)?void 0:n.source,p=(0,oN.useMemo)(()=>l.filter(e=>"error"===e.level),[l]),h=function(){let{getClient:e}=RA(),n=h1(),r=hK(),i=hX(),a=hB();return(0,oN.useMemo)(()=>({projectId:i,dataset:a,getClient:e,schema:n,currentUser:r}),[e,n,r,i,a])}(),{t:f}=dV(),m=(0,oN.useCallback)(e=>{if(!e){s(fR.from(fM([])));return}s(fR.from([fA({_type:o.name}),fz(e,["current"])]))},[s,o.name]),[g,x]=function(e,n){let[r,i]=oN.useState(null),a=oN.useRef(0);return[r,oN.useCallback(n=>{let r=++a.current;i({status:"pending"}),Promise.resolve().then(()=>e(n)).then(e=>{r===a.current&&i({status:"complete",result:e})},e=>{r===a.current&&i({status:"error",error:e})})},[e,...n])]}(()=>{if(!u)return Promise.reject(Error(f("inputs.slug.error.missing-source",{schemaType:o.name})));let e=r([])||{_type:o.name},n=function(e,n,r){let i=e.slice(0,-1),a=o2.U2(n,i);return{parentPath:i,parent:a,...r}}(i,e,h);return O9(u,e,n).then(e=>O6(e||"",o,n)).then(e=>m(e))},[u,r,o,i,h,m,f]),v=(null==g?void 0:g.status)==="pending",y=oN.useCallback(e=>m(e.currentTarget.value),[m]);return(0,oZ.jsx)(oK.Kq,{space:3,children:(0,oZ.jsxs)(oK.kC,{gap:1,children:[(0,oZ.jsxs)(oK.xu,{flex:1,children:[(0,oZ.jsx)(oK.oi,{customValidity:p.length>0?p[0].message:"",disabled:v,onChange:y,value:(null==a?void 0:a.current)||"",readOnly:c,...d}),(null==g?void 0:g.status)==="error"&&(0,oZ.jsx)(oK.Zb,{padding:2,tone:"critical",children:g.error.message})]}),u&&(0,oZ.jsx)(lr.zx,{mode:"ghost",type:"button",disabled:c||v,onClick:x,size:"large",text:(null==g?void 0:g.status)==="pending"?f("inputs.slug.action.generating"):f("inputs.slug.action.generate")})]})})},crossDatasetReference:function(e){let{path:n,schemaType:r}=e,i=RA(),a=i.getClient(h$),o=z8(),l=i.getClient,s=(0,oN.useMemo)(()=>a.withConfig({dataset:r.dataset,apiVersion:"2023-11-13",ignoreBrowserTokenWarning:!0}).clone(),[a,r.dataset]),c=Si(s),d=function(e){let n=(0,oN.useRef)(e);return n.current=e,n}(vc([])),u=(0,oN.useCallback)(e=>(0,ob.D)(Sa(r.options,d.current,n,l)).pipe((0,aQ.z)(n=>{var i;let{filter:a,params:o}=n;return i={...r.options,filter:a,params:o,tag:"search.cross-dataset-reference",maxFieldDepth:c},fk(r.to.map(e=>({name:e.type,__experimental_search:(0,oq.DD)(e,i.maxFieldDepth)})),s,i)(e,{includeDrafts:!1}).pipe((0,aW.U)(e=>e.map(e=>e.hit)),(0,aW.U)(dg),(0,aW.U)(e=>e.map(e=>({id:e.id,type:e.type,published:e.published}))))}),(0,aG.K)(e=>{var n;let i=e.details&&"queryParseError"===e.details.type;return(null==(n=r.options)?void 0:n.filter)&&i&&(e.message='Invalid reference filter, please check the custom "filter" option'),(0,o_._)(e)})),[s,d,n,r,c,l]),p=(0,oN.useMemo)(()=>(function(e){let{client:n,documentPreviewStore:r}=e,{dataset:i,projectId:a}=n.config(),o=i&&a?{dataset:i,projectId:a}:void 0;return function(e,i){return(e._type?(0,og.of)(e):r.observeDocumentTypeFromId(e._id,o).pipe((0,aW.U)(n=>({_id:e._id,_type:n})))).pipe((0,a$.w)(a=>{if(!a._type)return(function(e,n){let r={uri:e.getDataUrl("doc",n),json:!0,query:{excludeContent:"true"},tag:"".concat("cross-dataset-refs",".availability")};return e.observable.request(r).pipe((0,aW.U)(e=>{let r=s_()(e.omitted||[],e=>e.id)[n];return r?"existence"===r.reason?T9:"permission"===r.reason?T6:null:T8}))})(n,e._id).pipe((0,aW.U)(n=>({id:e._id,type:void 0,availability:n,preview:{published:void 0}})));let l=i.to.find(e=>e.type===a._type),s=AT(null==l?void 0:l.preview)||[],c=r.observePaths(e,s,o).pipe((0,aW.U)(e=>e?AW(e,l):e));return(0,oE.a)([c]).pipe((0,aW.U)(n=>{let[r]=n;return{type:a._type,id:e._id,availability:T8,preview:{published:dj(r)?r:void 0}}}))}))}})({client:s,documentPreviewStore:o}),[s,o]);return(0,oZ.jsx)(T5,{...e,getReferenceInfo:p,onSearch:u})}};function Ae(e){var n,r,i,a;if(null==(n=e.components)?void 0:n.input)return e.components.input;let o=fc("array",e)?1===(r=e).of.length&&fc("string",r.of[0])&&(null==(i=r.options)?void 0:i.layout)==="tags"?PT:(null==(a=r.options)?void 0:a.list)?SH:r.of.every(e=>On.includes(e.jsonType))?PL:r.of.some(e=>
1fc("block",e))?Pm:Ot:fc("reference",e)?SR:fc("string",e)?wJ(e,"list")?Oa:Os:fc("number",e)?wJ(e,"list")?Oa:Ou:void 0;if(o)return o;let l=Object.values(w3(e,new Set).reduce((e,n)=>(e[n.name]=n,e),{})).find(e=>O7[e.name]);if(l)return O7[l.name];throw Error("Could not find input component for schema type `".concat(e.name,"`"))}function At(e){var n;return(null==(n=e.components)?void 0:n.preview)?e.components.preview:h8}function An(e){let{componentResolver:n,componentProps:r}=e;if(!r.schemaType)throw Error("the `schemaType` property must be defined");let i=n(r.schemaType),a=(0,oN.useCallback)(e=>{var r;if(!(null==(r=e.schemaType)?void 0:r.type))throw Error("Attempted to render form component of non-existent parent type");let{components:i,...a}=e.schemaType,o=n(a);return(0,oN.createElement)(o,e)},[n]);return(0,oN.createElement)(i,{...r,renderDefault:a})}function Ar(e){return An({componentProps:e,componentResolver:Ae})}function Ai(e){return An({componentProps:e,componentResolver:ke})}function Aa(e){return An({componentProps:e,componentResolver:wY})}function Ao(e){return An({componentProps:e,componentResolver:At})}function Al(e){return An({componentProps:e,componentResolver:CL})}function As(e){return An({componentProps:e,componentResolver:CV})}function Ac(e){return An({componentProps:e,componentResolver:CK})}function Ad(e){var n,r;return null==(r=null==(n=e.form)?void 0:n.components)?void 0:r.input}function Au(e){var n,r;return null==(r=null==(n=e.form)?void 0:n.components)?void 0:r.field}function Ap(e){var n,r;return null==(r=null==(n=e.form)?void 0:n.components)?void 0:r.preview}function Ah(e){var n,r;return null==(r=null==(n=e.form)?void 0:n.components)?void 0:r.item}function Af(e){var n,r;return null==(r=null==(n=e.form)?void 0:n.components)?void 0:r.block}function Am(e){var n,r;return null==(r=null==(n=e.form)?void 0:n.components)?void 0:r.inlineBlock}function Ag(e){var n,r;return null==(r=null==(n=e.form)?void 0:n.components)?void 0:r.annotation}function Ax(){return fs({defaultComponent:Ar,pick:Ad})}function Av(){return fs({defaultComponent:Ai,pick:Au})}function Ay(){return fs({defaultComponent:Ao,pick:Ap})}function Ab(){return fs({defaultComponent:Aa,pick:Ah})}function Aj(){return fs({defaultComponent:Al,pick:Af})}function Aw(){return fs({defaultComponent:As,pick:Am})}function Ak(){return fs({defaultComponent:Ac,pick:Ag})}function AC(e){let n=Ay();return(0,oZ.jsx)(fo,{...e,component:n})}let A_=[["_createdAt"],["_updatedAt"]];function AT(e){let n=null==e?void 0:e.select;if(n)return(Object.values(n).map(e=>String(e).split("."))||[]).concat(A_)}let AS=e=>!0===e.liveEdit;function AE(e,n,r,i){let a=AS(n)?(0,og.of)({snapshot:null}):e.observeForPreview({_type:"reference",_ref:df(r)},n),o=e.observeForPreview({_type:"reference",_ref:dm(r)},n);return(0,oE.a)([a,o]).pipe((0,aW.U)(e=>{let[n,r]=e;return{draft:n.snapshot?{title:i,...n.snapshot||{}}:null,isLoading:!1,published:r.snapshot?{title:i,...r.snapshot||{}}:null}}),(0,a3.O)({draft:null,isLoading:!0,published:null}))}let AP=e=>({title:(0,oZ.jsx)("em",{children:e.title?String(e.title):"Missing document"}),subtitle:(0,oZ.jsx)("em",{children:e.title?"Missing document ID: ".concat(e._id):"Document ID: ".concat(e._id)}),media:()=>(0,oZ.jsx)(lp.foC,{})}),AO=e=>{let{value:n,draft:r,published:i}=e,a=r||i;return a?cm()({},a,n,(e,n)=>void 0===n?e:n):AP(n)},AA=["_id","_rev","_type"],AI=[...AA,"_key"],Az={available:!0,reason:"READABLE"},AM={available:!1,reason:"PERMISSION_DENIED"},AR={available:!1,reason:"NOT_FOUND"},AF={title:"Invalid preview config",subtitle:"Check the error log in the console",media:(0,oZ.jsx)(lp.foC,{})};function AD(e){return Object.keys(e)}let Aq=["_id","_type","_upload","_createdAt","_updatedAt"],AZ=[],AN=(o={},{add:(e,n,r)=>{o[e.name]||(o[e.name]=[]),o[e.name].push({error:r,type:e,value:n})},getAll:()=>o,clear(){o={}}}),AL=o8()(()=>{let e=AN.getAll(),n=lI()(Object.keys(e).map(n=>{let r=e[n];return lM()(r,e=>e.error.message)})).length;0!==n&&(console.groupCollapsed("%cHeads up! Got ".concat(1===n?"error":"".concat(n," errors")," while preparing data for preview. Click for details."),"color: #ff7e7c"),Object.keys(e).forEach(n=>{let r=e[n],i=r[0];console.group('Check the preview config for schema type "'.concat(n,'": %o'),i.type.preview),lM()(r,e=>
1e.error.message).forEach(e=>{var n;if("returnValueError"===e.error.type){let r="function"==typeof(null==(n=e.type.preview)?void 0:n.prepare),{value:i,error:a}=e;console.log("Encountered an invalid ".concat(r?"return value when calling prepare(%o)":"value targeted by preview.select",":"),i),console.error(a)}if("prepareError"===e.error.type){let{value:n,error:r}=e;console.log("Encountered an error when calling prepare(%o):",n),console.error(r)}}),console.groupEnd()}),console.groupEnd(),AN.clear())},1e3),AV=e=>n=>{let r=typeof n;return null===n||"undefined"===r||"string"===r||"number"===r||"boolean"===r?AZ:[AU("returnValueError",Error('The "'.concat(e,'" field should be a string, number, boolean, undefined or null, instead saw ').concat(AB(n))))]},AK={media:()=>AZ,title:AV("title"),subtitle:AV("subtitle"),description:AV("description"),imageUrl:AV("imageUrl"),date:AV("date")};function AB(e){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(dj(e)){let r=Object.keys(e),i=r.length>3?"...":"";return"".concat(n?"object with keys ":"","{").concat(r.slice(0,3).join(", ")).concat(i,"}")}if(Array.isArray(e)){let r=e.length>3?"...":"";return"".concat(n?"array with ":"","[").concat(e.map(e=>AB(e,!1))).concat(r,"]")}return"the ".concat(typeof e," ").concat(e)}function AU(e,n){return Object.assign(n,{type:e})}function AH(e,n){var r;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=null==(r=e.preview)?void 0:r.prepare;try{return{returnValue:a?a(n,i):AD(n).reduce((e,r)=>{let i=n[r];return{...e,[r]:Array.isArray(i)&&(0===i.length||i.some(ll.DG))?function(e){let n=Array.isArray(e)&&e.find(ll.DG);return n&&n.children?n.children.filter(ll.NG).map(e=>e.text).join(""):""}(i):i}},{}),errors:AZ}}catch(e){return{returnValue:null,errors:[AU("prepareError",e)]}}}function A$(e,n,r){return e.errors.forEach(e=>AN.add(n,r,e)),AL(),AF}function AW(e,n){var r,i,a,o;let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s="function"==typeof(null==(r=n.preview)?void 0:r.prepare),c=(null==(i=n.preview)?void 0:i.select)||{},d=Object.keys(c).reduce((r,i)=>{var a;let o="fields"in n?n:null,l=c[i],d=null==(a=null==o?void 0:o.fields)?void 0:a.find(e=>e.name===l),u=d&&function(e){if(function(e){let n=!!e.options&&"object"==typeof e.options&&e.options;return!!n&&"list"in n&&Array.isArray(n.list)}(e))return e.options.list.map(e=>(0,ll.n4)(e)?e:{title:e,value:e})}(d.type);if(!s&&u){let n=u&&u.find(n=>n.value===lS()(e,c[i]));r[i]=n?n.value:lS()(e,c[i])}else r[i]=lS()(e,c[i]);return r},{}),u=AH(n,d,l);if(u.errors.length>0)return A$(u,n,d);let p={...a=AH(n,d,l),errors:[...a.errors||[],...(o=a.returnValue,lP()(o)&&null!==o?Object.entries(o).reduce((e,n)=>{let[r,i]=n;return[...e,...function(e,n){if(void 0===n)return AZ;let r=AK[e];return r&&r(n)||AZ}(r,i)]},AZ):[AU("returnValueError",Error("Invalid return value. Expected a plain object with at least a 'title' field, instead saw ".concat(AB(o))))])]};return p.errors.length>0?A$(p,n,d):{...cp()(e,Aq),...u.returnValue}}function AY(e,n){let r;let i={},a=0;return function(){for(var e=arguments.length,l=Array(e),s=0;s<e;s++)l[s]=arguments[s];return new oy.y(e=>{clearTimeout(r),r=setTimeout(o,n);let s={args:l,observer:e,completed:!1};return i[a++]=s,()=>{s.completed=!0}})};function o(){let n=i;i={};let r=Object.keys(n).filter(e=>{let r=n[e];return r&&!r.completed});0!==r.length&&e(r.map(e=>{let r=n[e];return r&&r.args}).filter(dd)).subscribe({next(e){e.forEach((i,a)=>{let o=n[r[a]];o&&!o.completed&&o.observer.next(e[a])})},complete(){r.forEach(e=>{let r=n[e];r&&!r.completed&&r.observer.complete()})},error(e){r.forEach(r=>{let i=n[r];i&&!i.completed&&i.observer.error(e)})}})}}function AX(e,n){return e.push(...n),e}function AG(e,n){function r(e){return n({_ref:e}
1,[["_rev"]]).pipe((0,aW.U)(e=>dj(e)&&!!("_rev"in e&&(null==e?void 0:e._rev))),(0,aX.x)(),(0,a$.w)(n=>n?(0,og.of)(Az):i(e)))}let i=AY(function(e){let n=[...new Set(lI()(e))];return(0,ob.D)(function(e){let n=[],r=0,i=[];for(let a of e)r+a.length+1>=11164&&(i.push(n),n=[],r=0),r+=a.length+1,n.push(a);return i.includes(n)||i.push(n),i}(n)).pipe((0,aQ.z)(a,10),(0,ot.u)(AX,[]),(0,aW.U)(r=>e.map(e=>{let[i]=e;return r[n.indexOf(i)]})))},1);function a(n){return(0,oj.P)(()=>{let r={uri:e.getDataUrl("doc",n.join(",")),json:!0,query:{excludeContent:"true"},tag:"preview.documents-availability"};return e.observable.request(r).pipe((0,aW.U)(e=>{let r=s_()(e.omitted||[],e=>e.id);return n.map(e=>{let n=r[e];if(!n)return Az;if("existence"===n.reason)return AR;if("permission"===n.reason)return AM;throw Error('Unexpected reason for omission: "'.concat(n.reason,'"'))})}))})}return{observeDocumentPairAvailability:function(e){let n=df(e),i=dm(e);return(0,oE.a)([r(n),r(i)]).pipe((0,aX.x)(lu()),(0,aW.U)(e=>{let[n,r]=e;return{draft:n,published:r}}))}}}function AJ(e){return JSON.stringify(e)}let AQ=e=>dS(e)?'"'.concat(e,'": @').concat(dE(e)):e;function A0(e){let{ids:n,fields:r}=e,i=[...AA,...r];return"*[_id in [".concat(n.map(AJ).join(","),"]][0...").concat(n.length,"]{").concat(i.map(AQ).join(","),"}")}let A1=e=>e,A2=e=>{let n=e.LOCAL,r=e.document.HEAD;return n?{...n,_type:(r||n)._type,_rev:(r||n)._rev,_updatedAt:new Date().toISOString()}:n},A3=e=>({type:"snapshot",document:e}),A4=e=>e.document,A5=e=>{let n=new oC.x,r=new oO.X(!0),i=new oC.x,a=new oC.x,o=new oC.x,l=new oC.x,s=e=>{let n=new ch.W6(e);return n.onMutation=e=>{let{mutation:r,remote:a}=e;i.next({type:"mutation",document:A2(n),mutations:r.mutations,origin:a?"remote":"local"})},n.onRemoteMutation=e=>{o.next({type:"remoteMutation",head:n.document.HEAD,transactionId:e.transactionId,timestamp:e.timestamp,author:e.identity,effects:e.effects})},n.onRebase=(e,n,r)=>{a.next({type:"rebase",document:e,remoteMutations:n,localMutations:r})},n.onConsistencyChanged=e=>{r.next(e)},n.commitHandler=e=>l.next(e),n},c=e.pipe((0,aY.R)((e,n)=>"snapshot"===n.type?(e&&e.commit(),s(n.document||null)):null===e?(console.warn('Ignoring event of type "%s" since buffered document has not yet been set up with snapshot',n.type),null):e,null),(0,a2.h)(e=>null!==e),(0,aX.x)(),(0,or._)(1),(0,oi.x)()),d=e.pipe((0,a2.h)(e=>"mutation"===e.type),(0,oa.M)(c),(0,aW.U)(e=>{let[n,r]=e;return r.arrive(new ch.mm(n)),A2(r)})),u=n.pipe((0,oa.M)(c),(0,a4.b)(e=>{let[n,r]=e;"mutation"===n.type&&r.add(new ch.mm({mutations:n.mutations})),"commit"===n.type&&r.commit()}),(0,a5.j)(ov.E),(0,on.B)()),p=e=>n.next(e),h=e=>p({type:"mutation",mutations:e}),f=(0,ow.T)(c.pipe((0,aW.U)(e=>e.LOCAL)),i.pipe((0,aW.U)(A4)),a.pipe((0,aW.U)(A4)),d).pipe((0,aW.U)(A3),(0,or._)(1),(0,oi.x)()),m=(0,ow.T)(c.pipe((0,aW.U)(e=>e.document.HEAD),(0,aW.U)(A3)),o).pipe((0,or._)(1),(0,oi.x)());return{updates$:(0,ow.T)(f,u,i,a),consistency$:r.pipe((0,aX.x)(),(0,or._)(1),(0,oi.x)()),remoteSnapshot$:m,commitRequest$:l,addMutation:e=>h([e]),addMutations:h,commit:()=>{c.pipe((0,a6.q)(1),(0,a4.b)(e=>e.commit())).subscribe()}}},A8=e=>n=>{let{_id:r,_rev:i,_updatedAt:a,...o}=n;return{_id:e,...o}},A6=(e,n)=>{let r=A5(n),i=A8(e),a={delete:{id:e}};return{events:r.updates$,consistency$:r.consistency$,remoteSnapshot$:r.remoteSnapshot$,commitRequest$:r.commitRequest$,patch:n=>n.map(n=>({patch:{...n,id:e}})),create:e=>({create:i(e)}),createIfNotExists:e=>({createIfNotExists:i(e)}),createOrReplace:e=>({createOrReplace:i(e)}),delete:()=>a,mutate:e=>r.addMutations(e),commit:()=>r.commit()}},A9={type:"pending",phase:"begin"},A7={type:"pending",phase:"end"};function Ie(e,n){return{type:"snapshot",documentId:e,document:n}}let It=e=>n=>"reconnect"!==n.type&&"pending"!==n.type&&n.documentId===e;function In(e){return n=>({...n,version:e})}function Ir(e,n){let{publishedId:r,draftId:i}=n,a=(function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{publishedId:i,draftId:a}=n;return(0,oj.P)(()=>e.observable.listen("*[_id == $publishedId || _id == $draftId]",{publishedId:i,draftId:a},{includeResult:!1,events:["welcome","mutation","reconnect"],effectFormat:"mendoza",tag:r.tag||"document.pair-listener"})).pipe((0,a7.b)(n=>"welcome"===n.type?e.observable.getDocuments([a,i],{tag:"document.snapshots"}).pipe((0,aW.U)(e=>{let[n,r]=e;return{draft:n,published:r}})).pipe((0,a7.b)(e=>[Ie(a,e.draft),Ie(i,e.published)])):(0,og.of)(n)),(0,aY.R)((e,n)=>{if("mutation"!==n.type)return{next:[n],buffer:[]};let r=e.buffer.length>0,i=n.transactionTotalEvents>1;if(!i&&!r)return{next:[n],buffer:[]};if(!i)return{next:[],buffer:e.buffer.concat(n)};let a=e.buffer.concat(n);return Object.values(s1()(a.filter(e=>"mutation"===e.type),e=>e.transactionId)).every(e=>e.length===e[0].transactionTotalEvents)?{next:a.concat(A7),buffer:[]}:{next:1===a.length?[A9]:[],buffer:a}},{next:[],buffer:[]}),(0,aQ.z)(e=>e.next))})(e,n).pipe((0,on.B)()),o=a.pipe((0,a2.h)(e=>"reconnect"===e.type)),l=A6(i,a.pipe((0,a2.h)(It(i)))),s=A6(r,a.pipe((0,a2.h)(It(r)))),c=a.pipe((0,a2.h)(e=>"pending"===e.type)),d=(0,ow.T)(l.commitRequest$,s.commitRequest$).pipe((0,aQ.z)(n=>(0,ob.D)(function(e,n){let{resultRev:r,...i}=n;return e.dataRequest("mutate",i,{visibility:"async",returnDocuments:!1,tag:"document.commit",skipCrossDatasetReferenceValidation:!0}
1)}(e,n.mutation.params)).pipe((0,a4.b)({error:e=>{"statusCode"in e&&"number"==typeof e.statusCode&&e.statusCode>=400&&e.statusCode<=500?n.cancel(e):n.failure(e)},next:()=>n.success()}))),(0,a5.j)(ov.E),(0,on.B)());return{transactionsPendingEvents$:c,draft:{...l,events:(0,ow.T)(d,o,l.events).pipe((0,aW.U)(In("draft"))),consistency$:l.consistency$,remoteSnapshot$:l.remoteSnapshot$.pipe((0,aW.U)(In("draft")))},published:{...s,events:(0,ow.T)(d,o,s.events).pipe((0,aW.U)(In("published"))),consistency$:s.consistency$,remoteSnapshot$:s.remoteSnapshot$.pipe((0,aW.U)(In("published")))}}}function Ii(e,n){let r=Object.create(null);return function(){let i=n(...arguments);return i in r||(r[i]=e(...arguments)),r[i]}}let Ia=(e,n)=>{var r;return(null==(r=e.get(n))?void 0:r.liveEdit)===!0};function Io(e,n,r){var i,a;let o=e.config();return"".concat(null!=(i=o.dataset)?i:"","-").concat(null!=(a=o.projectId)?a:"","-").concat(n.publishedId,"-").concat(r)}let Il=Ii((e,n,r)=>new oy.y(r=>{r.next(Ir(e,n))}).pipe((0,or._)(1),(0,oi.x)()),Io);function Is(e){return"snapshot"===e.type}function Ic(e){return{snapshots$:e.events.pipe((0,a2.h)(Is),(0,aW.U)(e=>e.document),(0,or._)(1),(0,oi.x)()),patch:e.patch,create:e.create,createIfNotExists:e.createIfNotExists,createOrReplace:e.createOrReplace,delete:e.delete,mutate:e.mutate,commit:e.commit}}let Id=Ii((e,n,r)=>Il(e,n,r).pipe((0,aW.U)(e=>{let{published:n,draft:r,transactionsPendingEvents$:i}=e;return{transactionsPendingEvents$:i,published:Ic(n),draft:Ic(r)}}),(0,or._)(1),(0,oi.x)()),(e,n,r)=>{var i,a;let o=e.config();return"".concat(null!=(i=o.dataset)?i:"","-").concat(null!=(a=o.projectId)?a:"","-").concat(n.publishedId,"-").concat(r)}),Iu={enabled:!0},Ip={enabled:!1},Ih=Ii((e,n,r)=>{let i=Ia(e.schema,r);return Id(e.client,n,r).pipe((0,a$.w)(e=>(0,oE.a)([e.draft.snapshots$,e.published.snapshots$,e.transactionsPendingEvents$.pipe((0,aW.U)(e=>"begin"===e.phase?Iu:Ip),(0,a3.O)(Ip))])),(0,aW.U)(e=>{let[a,o,l]=e;return{id:n.publishedId,type:r,draft:a,published:o,liveEdit:i,ready:!0,transactionSyncLock:l}}),(0,a3.O)({id:n.publishedId,type:r,draft:null,published:null,liveEdit:i,ready:!1,transactionSyncLock:null}),(0,or._)(1),(0,oi.x)())},(e,n,r)=>Io(e.client,n,r)),If=Ii((e,n,r)=>Id(e.client,n,r).pipe((0,a$.w)(i=>(0,oE.a)([i.draft.snapshots$,i.published.snapshots$]).pipe((0,aW.U)(a=>{let[o,l]=a;return{...e,idPair:n,typeName:r,snapshots:{draft:o,published:l},draft:i.draft,published:i.published}}))),(0,or._)(1),(0,oi.x)()),(e,n,r)=>{var i,a;let o=e.client.config();return"".concat(null!=(i=o.dataset)?i:"","-").concat(null!=(a=o.projectId)?a:"","-").concat(n.publishedId,"-").concat(r)}),Im={disabled:e=>{let{snapshots:n}=e;return!n.draft&&!n.published&&"NOTHING_TO_DELETE"},execute:e=>{let{client:n,schema:r,idPair:i,typeName:a}=e,o=n.observable.transaction().delete(i.publishedId);return Ia(r,a)?o.commit({tag:"document.delete"}):o.delete(i.draftId).commit({tag:"document.delete",skipCrossDatasetReferenceValidation:!0})}},Ig={disabled:e=>{let{schema:n,typeName:r,snapshots:i}=e;return Ia(n,r)?"LIVE_EDIT_ENABLED":!i.draft&&(i.published?"ALREADY_PUBLISHED":"NO_CHANGES")},execute:e=>{let{client:n,idPair:r,snapshots:i}=e;if(!i.draft)throw Error('cannot execute "publish" when draft is missing');let a=function e(n){return(0,ll.Yk)(n)?n._strengthenOnPublish?sH()(n,["_strengthenOnPublish"].concat(n._strengthenOnPublish.weak?[]:["_weak"])):n:"object"==typeof n&&n?Array.isArray(n)?n.map(e):Object.fromEntries(Object.entries(n).map(n=>{let[r,i]=n;return[r,e(i)]})):n}(sH()(i.draft,"_updatedAt")),o=n.observable.transaction();if(!i.draft)throw Error('cannot execute "publish" when draft is missing');return i.published?(o.patch(r.publishedId,{unset:["_revision_lock_pseudo_field_"],ifRevisionID:i.published._rev}),o.createOrReplace({...a,_id:r.publishedId,_type:i.draft._type})):o.create({...a,_id:r.publishedId,_type:i.draft._type}),o.delete(r.draftId),o.commit({tag:"document.publish",visibility:"async"})}},Ix={disabled:()=>!1,execute:function(e){let{schema:n,snapshots:r,idPair:i,draft:a,published:o,typeName:l}=e,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],c=arguments.length>2?arguments[2]:void 0;Ia(n,l)?o.mutate([o.createIfNotExists({_type:l,...c}),...o.patch(s)]):a.mutate([a.createIfNotExists({...c,...r.published,_id:i.draftId,_type:l}),...a.patch(s)])}},Iv={disabled:()=>!1,execute:e=>{let{draft:n,published:r}=e;return n.commit(),r.commit(),ov.E}},Iy={disabled:e=>{let{snapshots:n}=e;return n.draft?!n.published&&"NOT_PUBLISHED":"NO_CHANGES"},execute:e=>{let{client:n,idPair:r}=e;return n.observable.transaction().delete(r.draftId).commit({tag:"document.discard-changes"})}},Ib={disabled:e=>{let{schema:n,snapshots:r,typeName:i}=e;return Ia(n,i)?"LIVE_EDIT_ENABLED":!r.published&&"NOT_PUBLISHED"},execute:e=>{let{client:n,idPair:r,snapshots:i}=e,a=n.observable.transaction().delete(r.publishedId);return i.published&&(a=a.createIfNotExists({...sH()(i.published,"_updatedAt"),_id:r.draftId,_type:i.published._type})),a.commit({tag:"document.unpublish",visibility:"async",skipCrossDatasetReferenceValidation:!0}
1)}},Ij=["_createdAt","_updatedAt"],Iw={disabled:e=>{let{snapshots:n}=e;return!n.published&&!n.draft&&"NOTHING_TO_DUPLICATE"},execute:(e,n)=>{let{schema:r,client:i,snapshots:a,typeName:o}=e,l=a.draft||a.published;if(!l)throw Error("cannot execute on empty document");return i.observable.create({...sH()(l,Ij),_id:Ia(r,o)?n:df(n),_type:l._type},{tag:"document.duplicate"})}},Ik={disabled:()=>!1,execute:(e,n)=>{let{historyStore:r,schema:i,idPair:a,typeName:o}=e,l=Ia(i,o)?a.publishedId:a.draftId;return r.restore(a.publishedId,l,n)}},IC=Ii((e,n,r)=>Il(e,n,r).pipe((0,a$.w)(e=>{let{draft:n,published:r}=e;return(0,oE.a)([n.consistency$,r.consistency$])}),(0,aW.U)(e=>{let[n,r]=e;return n&&r}),(0,aX.x)(),(0,or._)(1),(0,oi.x)()),(e,n,r)=>{var i,a;let o=e.config();return"".concat(null!=(i=o.dataset)?i:"","-").concat(null!=(a=o.projectId)?a:"","-").concat(n.publishedId,"-").concat(r)}),I_={del:Im,delete:Im,publish:Ig,patch:Ix,commit:Iv,discardChanges:Iy,unpublish:Ib,duplicate:Iw,restore:Ik},IT=(e,n,r)=>{let i=I_[e];return(0,oj.P)(()=>{var e;return(0,ow.T)((0,og.of)(null),void 0===(e=i.execute(n,...r))?(0,og.of)(null):e)}).pipe((0,oo.Z)())},IS=new oC.x;function IE(e,n,r,i){IS.next({operationName:e,idPair:n,typeName:r,extraArgs:i})}let IP=["publish","unpublish","discardChanges","delete"],IO=Ii(e=>{let n=IS.pipe((0,ol.v)(e=>e.idPair.publishedId),(0,aQ.z)(n=>n.pipe((0,a$.w)(n=>If(e,n.idPair,n.typeName).pipe((0,a6.q)(1),(0,a$.w)(r=>{let i=IP.includes(n.operationName);i&&(r.published.commit(),r.draft.commit());let a=IC(e.client,n.idPair,n.typeName).pipe((0,a2.h)(Boolean));return(i?a.pipe((0,a6.q)(1)):(0,og.of)(!0)).pipe((0,a$.w)(()=>IT(n.operationName,r,n.extraArgs)))}),(0,aW.U)(()=>({type:"success",args:n})),(0,aG.K)(e=>(0,og.of)({type:"error",args:n,error:e})))))),(0,on.B)()),r=n.pipe((0,a2.h)(e=>"success"===e.type&&"patch"===e.args.operationName),(0,os.p)(1e3,oA.z,{leading:!0,trailing:!0}),(0,a4.b)(e=>{IE("commit",e.args.idPair,e.args.typeName,[])}));return(0,ow.T)(n,r.pipe((0,a5.j)(ov.E)))},e=>{var n,r;let i=e.client.config();return"".concat(null!=(n=i.dataset)?n:"","-").concat(null!=(r=i.projectId)?r:"")}),IA={isValidating:!0,validation:[]},II=[],Iz=(e,n)=>e(n).pipe((0,aW.U)(e=>{let{published:n}=e;return n.available}));function IM(){return(0,aJ.d)({bufferSize:1,refCount:!0})}let IR=Ii((e,n,r)=>{let{draftId:i,publishedId:a}=n,o=Ih(e,{draftId:i,publishedId:a},r).pipe((0,aW.U)(e=>{let{draft:n,published:r}=e;return n||r}),(0,os.p)(200,oA.z,{trailing:!0}),(0,aX.x)((e,n)=>(null==e?void 0:e._rev)===(null==n?void 0:n._rev)||lu()(sH()(e,"_rev","_updatedAt"),sH()(n,"_rev","_updatedAt"))),IM()),l=o.pipe((0,aW.U)(e=>(0,cb.u4)(e,(e,n)=>((0,ll.Yk)(n)&&e.add(n._ref),e),new Set)),(0,aQ.z)(e=>(0,ob.D)(e))).pipe((0,ol.v)(e=>e,{duration:()=>(0,oT.H)(18e5)}),(0,aQ.z)(n=>n.pipe((0,oc.E)(),(0,aQ.z)(n=>Iz(e.observeDocumentPairAvailability,n).pipe((0,aW.U)(e=>[n,e]))))),(0,aY.R)((e,n)=>{let[r,i]=n;return e[r]===i?e:{...e,[r]:i}},{}),(0,aX.x)(lu()),IM()),s=e=>{let{id:n}=e;return(0,oI.n)(l.pipe((0,oe.P)(e=>n in e),(0,aW.U)(e=>e[n])))},c=l.pipe((0,od.T)(1),(0,os.p)(1e3,oA.z,{leading:!0,trailing:!0}));return(0,oE.a)([o,(0,ox.z)((0,og.of)(null),c)]).pipe((0,aW.U)(e=>{let[n]=e;return n}),(0,cj.q)(n=>(0,oj.P)(()=>(null==n?void 0:n._type)?(0,ox.z)((0,og.of)({isValidating:!0,revision:n._rev}),(function(e){let{document:n,getClient:r,i18n:i=pY(),schema:a,getDocumentExists:o,environment:l,maxCustomValidationConcurrency:s}=e;if("string"!=typeof(null==n?void 0:n._type))throw Error("Tried to validated a value without a '_type'");let c=a.get(n._type);if(!c)return"studio"===l?(console.warn('Schema type for object type "%s" not found, skipping validation',n._type),(0,og.of)([])):(0,og.of)([{level:"warning",message:"Could not find schema type for type '".concat(n._type,"', skipping validation"),path:[]}]);let d=hn.get(a);!d&&s&&(d=new p9(s),hn.set(a,d));let u={getClient:r,schema:a,parent:void 0,value:n,path:[],document:n,type:c,i18n:i,getDocumentExists:o,environment:l,customValidationConcurrencyLimiter:d};return(0,ob.D)(i.loadNamespaces(["validation"])).pipe((0,a$.w)(()=>(function e(n){let{value:r,type:i,path:a=[],parent:o,customValidationConcurrencyLimiter:l,environment:s,...c}=n,d=e=>(null==i?void 0:i.jsonType)==="object"&&p5(i).find(e=>["object","document","file","image"].includes(e.name))&&"studio"!==s?e.custom(p7(i),{bypassConcurrencyLimit:!0}).warning():e,u=p6(i),p=u.map(d).map(e=>(0,oj.P)(()=>e.validate(r,{...c,environment:s,parent:o,path:a,type:i,__internal:{customValidationConcurrencyLimiter:l}}))),h=[],f=u.some(e=>e.isRequired());if((null==i?void 0:i.jsonType)==="object"&&(r||null==r&&f)){let n=i.fields.reduce((e,n)=>(e[n.name]=n.type,e),{});h=(h=h.concat(u.map(e=>e._fieldRules).filter(ht).flatMap(e=>Object.entries(e)).flatMap(e=>{let[i,o]=e,u=n[i];return p6({...u,validation:o}).map(d).map(e=>{let n=he(r)?r[i]:void 0;return(0,oj.P)(()=>e.validate(n,{...c,parent:r,path:a.concat(i),type:u,environment:s,__internal:{customValidationConcurrencyLimiter:l}}))})}))).concat(i.fields.map(n=>e({...c,parent:r,value:he(r)?r[n.name]:void 0,path:a.concat(n.name),type:n.type,environment:s,customValidationConcurrencyLimiter:l})))}return(null==i?void 0:i.jsonType)==="array"&&Array.isArray(r)&&(h=h.concat(r.map((n,o)=>e({...c,parent:r,value:n,path:a.concat((0,ll.fU)(n)?{_key:n._key}:o),type:function(e,n){if(1===n.length)return n[0];let r=(0,ll.ay)(e)&&e._type,i=null==e||!r&&px(e).toLowerCase();return i&&"object"!==i?n.find(e=>e.jsonType===i):n.find(e=>{var n;return(null==(n=e.type)?void 0:n.name)===r})||n.find(e=>e.name===r)||n.find(e=>"object"===e.name&&"object"===i)}(n,i.of),environment:s,customValidationConcurrencyLimiter:l})))),(0,oj.P)(()=>(0,ow.T)([...p,...h])).pipe((0,aQ.z)(e=>{var n;return(0,ox.z)(new oy.y(e=>{let r=pG(()=>{e.complete()},n?{timeout:n}:void 0);return()=>pJ(r)}),e)},40),(0,a0.J)(),(0,a1.q)(),(0,aW.U)(lI()),(0,aW.U)(e=>u.some(e=>e._fieldRules)?lM()(e,e=>JSON.stringify(e)):e))})(u)),(0,aG.K)(e=>{console.error(e);let n=(null==e?void 0:e.message)||"Unknown error";return(0,og.of)([{level:"error",message:n,item:{message:n},path:[]}])}))})({document:n,getClient:e.getClient,getDocumentExists:s,i18n:e.i18n,schema:e.schema,environment:"studio"}).pipe((0,aW.U)(e=>({validation:e,isValidating:!1})))):(0,og.of)({validation:II,isValidating:!1}))),(0,aY.R)((e,n)=>({...e,...n}),IA),IM())},(e,n,r)=>{var i,a;let o=e.client.config();return"".concat(null!=(i=o.dataset)?i:"","-").concat(null!=(a=o.projectId)?a:"","-").concat(n.publishedId,"-").concat(r)}),IF=Ii((e,n,r)=>Il(e,n,r).pipe((0,a$.w)(e=>{let{draft:n,published:r}=e;return(0,ow.T)(n.events,r.events)})),Io);function ID(e){return{disabled:"NOT_READY",execute:()=>{throw Error("Called ".concat(e," before it was ready."))}}}let Iq={commit:ID("commit"),delete:ID("delete"),del:ID("del"),publish:ID("publish"),patch:ID("patch"),discardChanges:ID("discardChanges"),unpublish:ID("unpublish"),duplicate:ID("duplicate"),restore:ID("restore")},IZ=(e,n,r)=>function(){for(var i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];return IE(e,n,r,a)};function IN(e,n,r){return{disabled:n.disabled(r),execute:IZ(e,r.idPair,r.typeName)}}function IL(e){return{commit:IN("commit",Iv,e),delete:IN("delete",Im,e),del:IN("delete",Im,e),publish:IN("publish",Ig,e),patch:IN("patch",Ix,e),discardChanges:IN("discardChanges",Iy,e),unpublish:IN("unpublish",Ib,e),duplicate:IN("duplicate",Iw,e),restore:IN("restore",Ik,e)}}let IV=Ii((e,n,r)=>{let i=IO(e),a=If(e,n,r).pipe((0,aW.U)(IL));return(0,ox.z)((0,og.of)(Iq),(0,ow.T)(i.pipe((0,aQ.z)(()=>ov.E)),a)).pipe((0,aJ.d)({refCount:!0,bufferSize:1}))},(e,n,r)=>Io(e.client,n,r)),IK=(e,n,r,i)=>(0,oj.P)(()=>e.observable.fetch(n,r,{tag:i.tag,filterResponse:!0,perspective:i.perspective})),IB=(e,n,r,i)=>(0,oj.P)(()=>e.listen(n,r,{events:["welcome","mutation","reconnect"],includeResult:!1,visibility:"query",tag:i.tag}));function IU(e){return"welcome"===e.type}let IH=["_key","_ref","_weak","_type"];function I$(e){return e&&e.length>0?'"'.concat(e,'"'):e}function IW(e,n){let r=e=>'Template "'.concat(n.id,'" initial value: ').concat(e);
1if(!lP()(e))throw Error(r("resolved to a non-object"));if(e._type&&n.schemaType!==e._type)throw Error(r('includes "_type"-property ('.concat(e._type,") that does not match template (").concat(n.schemaType,")")));try{return function e(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(n))return n.map((n,i)=>{if(Array.isArray(n))throw Error('multidimensional arrays are not supported (at path "'.concat((0,o2.BB)(r),'")'));return e(n,r.concat(i),!0)});if(!lP()(n))return n;let a=i&&!n._key?{_key:(0,sL.E2)()}:{};return r.length>0&&!n._type&&n._ref&&(a._type="reference"),n._ref&&function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!e._type&&e.type)throw Error('Reference is missing "_type", but has a "type" property at path "'.concat((0,o2.BB)(n),'"'));let r=Object.keys(e).filter(e=>!IH.includes(e));if(r.length>0){let e=r.length>1?"properties":"property";throw Error("Disallowed ".concat(e," found in reference: ").concat(r.map(I$).join(", "),' at path "').concat((0,o2.BB)(n),'"'))}}(n,r),Object.keys(n).reduce((i,a)=>(i[a]=e(n[a],r.concat([a])),i),a)}(e)}catch(e){throw e.message=r(e.message),e}}function IY(e,n){let r={...e,...n};return Object.keys(r).forEach(i=>{let a=n[i],o=e[i];lP()(a)&&lP()(o)&&(r[i]=IY(o,a))}),r}async function IX(e,n,r){return"function"==typeof e?e(n,r):e}async function IG(e,n){var r,i;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(lP()(n)&&"function"==typeof n.serialize)return IG(e,n.serialize(),a,o);let{id:l,schemaType:s,value:c}=n;if(!c)throw Error('Template "'.concat(l,'" has invalid "value" property'));let d=await IX(c,a,o);if(r=d,!lP()(r))throw Error('Template "'.concat(l,'" has invalid "value" property - must be a plain object or a resolver function returning a plain object'));i=d,lP()(i)&&!Object.keys(d).length&&(d={_type:s}),d=IW(d,n);let u=e.get(s);if(!u)throw Error('Could not find schema type with name "'.concat(s,'".'));return IW(IY(await IQ(u,a,IJ,o)||{},d),n)}let IJ=10;function IQ(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:IJ,i=arguments.length>3?arguments[3]:void 0;return r<=0?Promise.resolve(void 0):(0,ll.m$)(e)?I1(e,n,r,i):(0,ll.jB)(e)?I0(e,n,r,i):IX(e.initialValue,n,i)}async function I0(e,n,r,i){let a=await IX(e.initialValue,void 0,i);if(Array.isArray(a))return Promise.all(a.map(async a=>{let o=function(e,n){let r=(0,sL.wq)(n);return"object"===r&&1===e.of.length?e.of[0]:e.of.find(e=>e.name===r)}(e,a);return(0,ll.m$)(o)?{...a,...await IQ(o,n,r-1,i),_key:(0,sL.E2)()}:a}))}async function I1(e,n,r,i){let a={...await IX(e.initialValue,n,i)||{}},o={};await Promise.all(e.fields.map(async e=>{let a=await IQ(e.type,n,r-1,i);null!=a&&(o[e.name]=a)}));let l=IY(o,a);if(!(0,sL.Ru)(l))return"object"!==e.name&&(l._type=e.name),l}let I2={type:"loading"};function I3(e){if(dp(e))throw Error("editOpsOf does not expect a draft id.");return{publishedId:e,draftId:df(e)}}function I4(e){let{documentId:n,documentType:r,templateName:i,templateParams:a}=e,o=ds(a),l=z6(),s=I5(),c=(0,oN.useMemo)(()=>({_id:n,_type:r}),[n,r]),[d,u]=(0,oN.useState)({loading:!1,error:null,value:c});return(0,oN.useEffect)(()=>{if(!i){u({loading:!0,error:null,value:c});return}let e=l.initialValue({documentId:n,documentType:r,templateName:i,templateParams:o},s).subscribe(e=>{"loading"===e.type&&u({loading:!0,error:null,value:c}),"success"===e.type&&u({loading:!1,error:null,value:e.value?{...c,...e.value}:c}),"error"===e.type&&u({loading:!1,error:e.error,value:c})});return u({loading:!0,error:null,value:c}),()=>e.unsubscribe()},[c,n,l,r,i,o,s]),d}function I5(){let e=RA(),n=h1(),r=hK(),i=hX(),a=hB(),o=e.getClient;return(0,oN.useMemo)(()=>({projectId:i,dataset:a,getClient:o,schema:n,currentUser:r}),[o,n,r,i,a])}function I8(){let e=I5();return(0,oN.useCallback)((n,r)=>IQ(n,r,IJ,e),[e])}let I6=dc(function(e){let{client:n,grantsStore:r,schema:i,id:a,permission:o,type:l}=e;if("*"===l)return(0,og.of)({granted:!1,reason:"Type specified was `*`"});let s=!!function(e,n){let r=e.get(n);if(!r)throw Error("No such schema type: ".concat(n));return r}(i,l).liveEdit;return Id(n,{draftId:df(a),publishedId:dm(a)},l).pipe((0,a$.w)(e=>(0,oE.a)([e.draft.snapshots$,e.published.snapshots$]).pipe((0,aW.U)(e=>{let[n,r]=e;return{draft:n,published:r}}))),(0,a$.w)(e=>{let{draft:n,published:i}=e,a=(function(e){let{grantsStore:n,permission:r,draft:i,published:a,liveEdit:o}=e,l=i||a,s=l===i?"draft":"published",{checkDocumentPermission:c}=n;switch(r){case"delete":if(o)return[["delete published document (live-edit)",c("update",a)]];return[["delete draft document",c("update",i)],["delete published document",c("update",a)]];case"discardDraft":if(o)return[];return[["delete draft document",c("update",i)]];case"publish":if(o)return[];return[["update published document at its current state",c("update",a)],["delete draft document",c("update",i)],["create published document from draft",c("create",i&&{...i,_id:dm(i._id)})]];case"unpublish":if(o)return[];return[["update draft document at its current state",c("create",i)],["delete published document",c("update",a)],["create draft document from published version",c("create",a&&{...a,_id:df(a._id)})]];case"update":if(o)return[["update published document (live-edit)",c("update",a)]];return[["update ".concat(s," document"),c("update",l)]];case"duplicate":if(o)return[["create new published document from existing document (live-edit)",c("create",{...a,_id:"dummy-id"})]];return[["create new draft document from existing ".concat(s," document"),c("create",{...l,_id:df("dummy-id")})]];default:throw Error("Could not match permission: ".concat(r))}})({grantsStore:r,permission:o,draft:n,published:i,liveEdit:s}).map(e=>{let[n,r]=e;return r.pipe((0,aW.U)(e=>{let{granted:r,reason:i}=e;return{granted:r,reason:r?"":"not allowed to ".concat(n,": ").concat(i),label:n,permission:o}}))});return a.length?(0,oE.a)(a).pipe((0,aW.U)(e=>{let n=e.every(e=>e.granted),r=n?"":"Unable to ".concat(o,":\n	").concat(e.filter(e=>!e.granted).map(e=>e.reason).join("\n	"));return{granted:n,reason:r}})):(0,og.of)({granted:!0,reason:""})}))});function I9(e){let{id:n,type:r,permission:i,client:a,schema:o,grantsStore:l}=e,s=hN(h$),c=h1(),d=z4(),u=(0,oN.useMemo)(()=>a||s,[s,a]),p=(0,oN.useMemo)(()=>o||c,[c,o]),h=(0,oN.useMemo)(()=>l||d,[d,l]);return I6((0,oN.useMemo)(()=>({client:u,schema:p,grantsStore:h,id:n,permission:i,type:r}),[u,h,n,i,p,r]))}function I7(e){let{grantsStore:n,document:r,permission:i}=e,{checkDocumentPermission:a}=n;return a(i,r)}let ze=dc(I7);function zt(e){let{document:n,permission:r,...i}=e,a=z4();return ze({grantsStore:i.grantsStore||a,document:n,permission:r})}let zn=dc(function(e){let{grantsStore:n,templateItems:r,templates:i,schema:a,context:o}=e;return(null==r?void 0:r.length)?(0,oE.a)(r.map(function e(n){return"object"==typeof n&&null!==n&&"serialize"in n?e(n.seri
1alize()):n}).map(async e=>{let n=i.find(n=>n.id===e.templateId);if(!n)throw Error('template not found: "'.concat(e.templateId,'"'));let r=await IG(a,n,e.parameters,o);return{template:n,item:e,resolvedInitialValue:r}}).map(e=>(0,ob.D)(e).pipe((0,a$.w)(e=>{let{item:r,resolvedInitialValue:i,template:o}=e,l=a.get(o.schemaType);if(!l)throw Error('schema type not found: "'.concat(o.schemaType,'"'));let s=null==l?void 0:l.liveEdit,{initialDocumentId:c="dummy-id"}=r;return I7({grantsStore:n,permission:"create",document:{_id:s?dm(c):df(c),...i}}).pipe((0,aW.U)(e=>{let{granted:n,reason:a}=e,s=r.title||o.title;return{...r,i18n:r.i18n||o.i18n,granted:n,reason:a,resolvedInitialValue:i,template:o,title:s,subtitle:l.title===s?void 0:l.title,description:r.description||o.description,icon:r.icon||o.icon}}))})))):(0,og.of)([])});function zr(e){let{templateItems:n,...r}=e,i=h1(),a=h2(),o=z4(),l=I5();return zn({templateItems:n,grantsStore:r.grantsStore||o,schema:r.schema||i,templates:r.templates||a,context:l})}let zi="_debug_",za="undefined"==typeof window?(0,og.of)({}):(0,ok.R)(window,"hashchange"),zo=(0,ox.z)((0,og.of)(0),za).pipe((0,aW.U)(()=>"undefined"==typeof document?"#":document.location.hash),(0,aX.x)(),(0,aW.U)(e=>e.substring(1).split(";").filter(e=>e.toLowerCase().startsWith(zi)).map(e=>e.substring(zi.length)))),zl=zo.pipe((0,aW.U)(e=>e.find(e=>e.startsWith("roles="))),(0,aW.U)(e=>(null==e?void 0:e.split("roles=")[1].split(",").map(e=>e.trim()))||[])),zs=[{filter:'_id in path("**")',permissions:["read","create","history","update"]}],zc=[{filter:'_id in path("**")',permissions:["read","history"]}],zd={administrator:[{filter:'_id in path("**")',permissions:["read","create","history","update"]}],editor:zs,developer:[{filter:'_id in path("**")',permissions:["read","create","history","update"]}],contributor:[{filter:'_id in path("**")',permissions:["read"]},{filter:'_id in path("drafts.**")',permissions:["create","history","update"]}],viewer:zc,restricted:[{filter:'_id in path("drafts.**") && _type in ["stringsTest", "book", "author", "referenceTest"]',permissions:["read","create","history","update"]},{filter:'_id in path("**")',permissions:["read"]}],requiresApproval:[{filter:"!locked",permissions:["read","create","update"]}],read:zc,write:zs},zu=zl.pipe((0,aW.U)(e=>e.length?e.filter(e=>!!e&&e in zd).flatMap(e=>zd[e]||[]):null));async function zp(e,n,r){return await e.request({uri:"/projects/".concat(n,"/datasets/").concat(r,"/acl"),tag:"acl.get",withCredentials:!0})}let zh=new Map;async function zf(e,n,r){zh.has(n)||zh.set(n,(0,cw.Qc)("*[".concat(n,"]")));let i=zh.get(n),a=function(e){let n={};return null!==e&&(n.identity=e),n}(e),{identity:o}=a,l={...a},s=await (await (0,cw.ku)(i,{dataset:[r],identity:o,params:l})).get();return(null==s?void 0:s.length)===1}async function zm(e,n,r,i){if(!i)return{granted:!0,reason:"Null document, nothing to check"};if(!n.length)return{granted:!1,reason:"No document grants"};let a=[];for(let r of n)await zf(e,r.filter,i)&&a.push(r);let o=a.some(e=>e.permissions.some(e=>e===r));return{granted:o,reason:o?"Matching grant":"No matching grants found"}}async function zg(e,n){return function(e){let n;let r=e.body;if(!r)throw Error("Failed to read body from response");let i=!1;return new ReadableStream({start(e){n=r.getReader();let a=new TextDecoder,o="";n.read().then(function r(l){if(l.done){if(i)return;if(0===(o=o.trim()).length){e.close();return}e.enqueue(JSON.parse(o)),e.close();return}let s=(o+=a.decode(l.value,{stream:!0})).split("\n");for(let r=0;r<s.length-1;++r){let a=s[r].trim();if(0!==a.length)try{e.enqueue(JSON.parse(a))}catch(r){e.error(r),i=!0,n.cancel();return}}return o=s[s.length-1],n.read().then(r).catch(n=>e.error(n))}).catch(n=>e.error(n))},cancel(){i=!0,n.cancel()}})}(await fetch(e,n?{headers:{Authorization:"Bearer ".concat(n)}}:{credentials:"include"}))}function zx(e){return{id:e,hasAttrs:!1,attrs:null,rev:null,events:[],aligned:!1}}function zv(e,n){if(e.hasAttrs=!0,n){if(e.attrs={...n},"string"!=typeof e.attrs._rev)throw Error("snapshot has no _rev");e.rev=e.attrs._rev,delete e.attrs._rev}else e.attrs=null,e.rev=null;e.events=[]}class zy{constructor(e){this.earliestTransactionId=null,this.timeline=e,this._states={draft:zx(e.draftId),published:zx(e.publishedId)}}appendRemoteSnapshotEvent(e){let n=this._states[e.version];if("snapshot"===e.type){this._maybeInvalidateHistory(),zv(n,e.document);return}"remoteMutation"===e.type&&(n.aligned?(this._apply(n,e),this.timeline.addRemoteMutation(e)):n.hasAttrs?n.events.push(e):zv(n,e.head))}prependHistoryEvent(e){if(!this.acceptsHistory)throw Error("cannot prepend history at this point");for(let n of Object.values(this._states))if(!n.aligned){let r=function(e,n){let r=n.events.findIndex(n=>e.id===n.transactionId);return r>=0?r+1:n.rev?n.rev===e.id?0:-1:0}(e,n);r>=0&&this._alignAtIndex(n,r)}this.timeline.addTranslogEntry(e),this.earliestTransactionId=e.id}didReachEarliestEntry(){for(let e of Object.values(this._states))if(!e.aligned){if(null!==e.attrs)throw Error("unable to find translog entry to align to");this._alignAtIndex(e,0)}this.timeline.didReachEarliestEntry()}get isAligned(){return Object.values(this._states).every(e=>e.aligned)}get acceptsHistory(){return this._isComplete}get currentDocument(){return{draft:this._states.draft.attrs,published:this._states.published.attrs}}_alignAtIndex(e,n){for(let r of e.events.slice(0,n))this._apply(e,r);for(let r of e.events.slice(n))this._apply(e,r),this.timeline.addRemoteMutation(r);e.events=[],e.aligned=!0}get _isComplete(){return Object.values(this._states).every(e=>e.hasAttrs)}_apply(e,n){e.attrs=(0,cC.a)(e.attrs,n.effects.apply),e.rev=n.transactionId}_maybeInvalidateHistory(){if(this._isComplete){for(let e of Object.values(this._states))e.aligned=!1;this.earliestTransactionId=null,this.timeline.reset()}}}class zb{constructor(e,n,r,i){this.timeline=e,this.start=r,this.end=i,this.doc=n}same(e,n){return this.start===e&&this.end===n}endAttributes(){return zj(this.endDocument())}endDocument(){return this._endDocument||(this._endDocument=this.timeline.replayBackwardsUntil(this.end.end,this.doc)),this._endDocument}startAttributes(){return zj(this.startDocument())}startDocument(){if(!this.start)throw Error("start required");return this._startDocument||(this._startDocument=this.timeline.replayBackwardsBetween(this.start.end,this.end.end-1,this.endDocument())),this._startDocument}
1diff(){if(!this._diff){if(!this.start)throw Error("start required");this._diff=this.timeline.calculateDiff(this.startDocument(),this.endDocument(),this.start.index+1,this.end.index)}return this._diff}}function zj(e){return e.draft||e.published}class zw{constructor(e){this.version=0,this.selectionState="inactive",this._fetchMore=!1,this._fetchAtLeast=0,this._isRunning=!1,this._isSuspended=!1,this._didErr=!1,this._since=null,this._sinceTime=null,this._rev=null,this._revTime=null,this.timeline=e.timeline,this.client=e.client,this.handler=e.handler,this._aligner=new zy(this.timeline),this.markChange()}clearRange(){this.setRange(null,null)}setRange(e,n){n!==this._rev&&this.setRevTime(n),e!==this._since&&this.setSinceTime(e);let r=10;if("loading"!==this._sinceTime&&"loading"!==this._revTime&&this._aligner.isAligned){if("invalid"===this._sinceTime||"invalid"===this._revTime)this.selectionState="invalid";else if(this._sinceTime){this.selectionState="range";let e=this._revTime||this.timeline.lastChunk();this._sinceTime.index>e.index?(this._revTime="invalid",this.selectionState="invalid"):this.setReconstruction(this._sinceTime,e)}else this._revTime?(this.selectionState="rev",this.setReconstruction(null,this._revTime)):(this.selectionState="inactive",r=0)}else this.selectionState="loading";this._fetchAtLeast=r,this.start()}setLoadMore(e){this._fetchMore=e,this.start()}get sinceTime(){return this._sinceTime&&"object"==typeof this._sinceTime?this._sinceTime:null}get revTime(){return this._revTime&&"object"==typeof this._revTime?this._revTime:null}get realRevChunk(){return this.revTime||this.timeline.lastChunk()}onOlderRevision(){return!!this._rev&&("range"===this.selectionState||"rev"===this.selectionState)}findRangeForNewRev(e){let n=this.timeline.isLatestChunk(e)?null:this.timeline.createTimeId(e);if(!this._since)return[null,n];let r=this.sinceTime;return r&&r.index<e.index?[this._since,n]:["@lastPublished",n]}findRangeForNewSince(e){let n=this.revTime;return n&&e.index<n.index?[this.timeline.createTimeId(e),this._rev]:[this.timeline.createTimeId(e),null]}setRevTime(e){this._rev=e,this._revTime=e?this.timeline.parseTimeId(e):null,"@lastPublished"===this._since&&(this._since=null,this._sinceTime=null)}setSinceTime(e){"@lastPublished"===e?"string"==typeof this._revTime?this._sinceTime=this._revTime:this._sinceTime=this.timeline.findLastPublishedBefore(this._revTime):this._sinceTime=e?this.timeline.parseTimeId(e):null,this._since=e}sinceAttributes(){return this._sinceTime&&this._reconstruction?this._reconstruction.startAttributes():null}displayed(){return this._revTime&&this._reconstruction?this._reconstruction.endAttributes():null}setReconstruction(e,n){this._reconstruction&&this._reconstruction.same(e,n)||(this._reconstruction=new zb(this.timeline,this._aligner.currentDocument,e,n))}currentDiff(){return this._reconstruction?this._reconstruction.diff():null}currentObjectDiff(){let e=this.currentDiff();if(e){if("null"===e.type)return null;if("object"!==e.type)throw Error("ObjectDiff expected, got ".concat(e.type))}return e}handleRemoteMutation(e){this._aligner.appendRemoteSnapshotEvent(e),this.markChange(),this._aligner.acceptsHistory&&this.start()}start(){this._didErr||this._isRunning||(this._isRunning=!0,this.tick().then(()=>{this._isRunning=!1}))}resume(){this._isSuspended=!1}suspend(){this._isSuspended=!0}async tick(){var e;if(this._aligner.acceptsHistory&&!this.timeline.reachedEarliestEntry&&("loading"===this.selectionState||this._fetchMore||this.timeline.chunkCount<=this._fetchAtLeast)&&!this._isSuspended){try{await this.fetchMoreTransactions()}catch(n){this._didErr=!0,null==(e=this.handler)||e.call(this,n,this);return}await this.tick()}}async fetchMoreTransactions(){let e=this.timeline.publishedId,n=this.timeline.draftId,r=this.client.config(),i="tag=sanity.studio.structure.history&effectFormat=mendoza&excludeContent=true&excludeMutations=true&includeIdentifiedDocumentsOnly=true&reverse=true&limit=".concat(50),a=this._aligner.earliestTransactionId;a&&(i+="&toTransaction=".concat(a));let o=this.client.getUrl("/data/history/".concat(r.dataset,"/transactions/").concat(e,",").concat(n,"?").concat(i)),l=(await zg(o,r.token)).getReader(),s=0;for(;;){let e=await l.read();if(e.done)break;if("error"in e.value)throw Error(e.value.error.description||e.value.error.type);if(s++,e.value.id!==a){if(this._aligner.earliestTransactionId!==a||!this._aligner.acceptsHistory)return;this._aligner.prependHistoryEvent(e.value),a=this._aligner.earliestTransactionId}}this._aligner.earliestTransactionId===a&&this._aligner.acceptsHistory&&(s<50&&this._aligner.didReachEarliestEntry(),this.markChange())}markChange(){var e;this.timeline.updateChunks(),this.setRevTime(this._rev),this.setSinceTime(this._rev),this.version++,null==(e=this.handler)||e.call(this,null,this)}}function zk(e){return e.draft||e.published}class zC{constructor(e,n,r,i){this.type="array",this.elements=[],this.content=e,this.value=n,this.annotation=r,this.extractor=i,this.length=e.elements.length}at(e){if(e>=this.length)throw Error("out of bounds");return this.elements[e]||(this.elements[e]=zS(this.content.elements[e],this.value[e],this.extractor))}annotationAt(e){let n=this.content.metas[e];return this.extractor.fromMeta(n)}}class z_{constructor(e,n,r,i){this.type="object",this.fields={},this.content=e,this.value=n,this.annotation=r,this.extractor=i,this.keys=Object.keys(e.fields)}get(e){let n=this.fields[e];if(n)return n;let r=this.content.fields[e];if(r)return this.fields[e]=zS(r,this.value[e],this.extractor)}}class zT{constructor(e,n,r,i){this.type="string",this.content=e,this.value=n,this.annotation=r,this.extractor=i}sliceAnnotation(e,n){let r=[],i=0;for(let a of this.content.parts){let o=a.value.length,l=Math.max(0,e-i);if(l<o){let e=Math.min(o,n-i);if(e<=0)break;!function(e,n){if(r.length>0){var i;let a=r[r.length-1];if((i=a.annotation)&&n?i.author===n.author&&i.chunk===n.chunk:!i&&!n){a.text+=e;return}}r.push({text:e,annotation:n})}(a.value.slice(l,e),this.extractor.fromValue(a))}i+=o}return r}}function zS(e,n,r){let i=r.fromValue(e);if(e.content)switch(e.content.type){case"array":return new zC(e.content,n,i,r);case"object":return new z_(e.content,n,i,r);case"string":return new zT(e.content,n,i,r)}return(0,c_.r)(n,i)}function zE(e,n,r){return r?zO(e,r.transactionIndex+1,r.chunk.index):n?zO(e,n.start,n.index):null}function zP(e,n){return n?zO(e,n.transactionIndex,n.chunk.index):null}function zO(e,n,r){let i=e.transactionByIndex(n);if(!i)return null;let a=e.chunkByTransactionIndex(n,r);return a?{chunk:a,timestamp:i.timestamp,author:i.author}:null}class zA{constructor(){this._postive=[],this._negative=[]}addToEnd(e){e.index=this._postive.length,this._postive.push(e)}addToBeginning(e){if(0==this.length){this.addToEnd(e);return}e.index=-(this._negative.length+1),this._negative.push(e)}mergeAtEnd(e,n){if(0===this.length){this.addToEnd(e);return}let r=this.lastIdx,i=n(this.get(r),e);Array.isArray(i)?(this.set(r,i[0]),this.addToEnd(i[1])):this.set(r,i)}mergeAtBeginning(e,n){if(0===this.length){this.addToEnd(e);return}let r=this.firstIdx,i=n(e,this.get(r));Array.isArray(i)?(this.set(r,i[1]),this.addToBeginning(i[0])):this.set(r,i)}removeFromEnd(){0===this._postive.length?this._negative.shift():this._postive.pop()}has(e){return e>=0?e<this._postive.length:-(e+1)<this._negative.length}get(e){return e>=0?this._postive[e]:this._negative[-(e+1)]}set(e,n){e>=0?(n.index=e,this._postive[e]=n):(n.index=e,this._negative[-(e+1)]=n)}get lastIdx(){return this._postive.length-1}get last(){return this.get(this.lastIdx)}get firstIdx(){return-this._negative.length}get first(){return this.get(this.firstIdx)}get length(){return this._postive.length+this._negative.length}}function zI(e,n){var r,i;if(e.end!==n.start)throw Error("chunks are not next to each other");let a=zR(e.draftState,n.draftState),o=zR(e.publishedState,n.publishedState);if("delete"===e.type&&"editDraft"===n.type)return[e,{...n,type:"create",draftState:a,publishedState:o}];if("delete"===n.type){if("missing"===a&&"present"===o)return[e,{...n,type:"discardDraft",draftState:a,publishedState:o}];if("present"===a&&"missing"===o)return[e,{...n,type:"unpublish",draftState:a,publishedState:o}]}if(("create"===(r=e.type)||"editDraft"===r)&&"editDraft"===n.type&&(i=e.endTimestamp,Date.parse(n.startTimestamp)-Date.parse(i)<3e5)){let r=new Set;for(let n of e.authors)r.add(n);for(let e of n.authors)r.add(e);return{index:0,id:n.id,type:e.type,start:e.start,end:n.end,startTimestamp:e.startTimestamp,endTimestamp:n.endTimestamp,authors:r,draftState:a,publishedState:o}}return[e,{...n,draftState:a,publishedState:o}]}function zz(e){return e&&zF(null==e?void 0:e.apply)?"deleted":e?"upsert":"unedited"}function zM(e){let n=!!e.draftEffect,r=!!e.publishedEffect,i=e.draftEffect&&zF(e.draftEffect.apply),a=e.publishedEffect&&zF(e.publishedEffect.apply),o=function(e){let n=zz(e.draftEffect),r=zz(e.publishedEffect);if("unedited"===r){if("deleted"===n)return"delete";if("upsert"===n)return"editDraft"}if("deleted"===r)return"delete";if("upsert"===r){if("unedited"===n)return"editLive";if("deleted"===n)return"publish"}return"editLive"}(e);return{index:0,id:e.id,type:o,start:e.index,end:e.index+1,startTimestamp:e.timestamp,endTimestamp:e.timestamp,authors:new Set([e.author]),draftState:n?
1i?"missing":"present":"unknown",publishedState:r?a?"missing":"present":"unknown"}}function zR(e,n){return"unknown"===n?e:n}function zF(e){return 0===e[0]&&null===e[1]}class zD{constructor(e){this.reachedEarliestEntry=!1,this._transactions=new zA,this._chunks=new zA,this._possiblePendingTransactions=new Map,this.publishedId=e.publishedId,this.draftId="drafts.".concat(e.publishedId),e.enableTrace&&(this._trace=[],this._trace.push({type:"initial",publishedId:e.publishedId}),window.__sanityTimelineTrace=this._trace)}get chunkCount(){return this._chunks.length}mapChunks(e){let n=[],r=this._chunks.firstIdx,i=this._chunks.lastIdx;for(let a=i;a>=r;a--)n.push(e(this._chunks.get(a),a));return n}reset(){this._transactions=new zA,this._chunks=new zA,this._possiblePendingTransactions=new Map,this._recreateTransactionsFrom=void 0,this.reachedEarliestEntry=!1}addRemoteMutation(e){this._trace&&this._trace.push({type:"addRemoteMutation",event:e});let n=this._possiblePendingTransactions.get(e.transactionId),r=n?n.transaction:{index:0,id:e.transactionId,timestamp:e.timestamp.toISOString(),author:e.author};"draft"===e.version?r.draftEffect=e.effects:r.publishedEffect=e.effects,n?(this._possiblePendingTransactions.delete(e.transactionId),this._invalidateTransactionFrom(n.idx)):(this._transactions.addToEnd(r),this._possiblePendingTransactions.set(e.transactionId,{transaction:r,idx:this._transactions.lastIdx}
1))}addTranslogEntry(e){this._trace&&this._trace.push({type:"addTranslogEntry",event:e}),this._transactions.addToBeginning({index:0,id:e.id,author:e.author,timestamp:e.timestamp,draftEffect:e.effects[this.draftId],publishedEffect:e.effects[this.publishedId]})}didReachEarliestEntry(){this._trace&&this._trace.push({type:"didReachEarliestEntry"}),this.reachedEarliestEntry=!0}updateChunks(){this._trace&&this._trace.push({type:"updateChunks"}),this._removeInvalidatedChunks(),this._addChunksFromTransactions(),this._createInitialChunk()}_removeInvalidatedChunks(){if(this._recreateTransactionsFrom){for(;this._chunks.length>0;){let e=this._chunks.last;if(this._recreateTransactionsFrom<e.end)this._chunks.removeFromEnd();else break}this._recreateTransactionsFrom=void 0}}_addChunksFromTransactions(){let e=this._transactions.firstIdx,n=this._transactions.lastIdx,r=this._chunks.length>0?this._chunks.last.end:e;for(let e=r;e<=n;e++){let n=this._transactions.get(e);this._chunks.mergeAtEnd(zM(n),zI)}if(0==this._chunks.length)return;let i=this._chunks.first.start;for(let n=i-1;n>=e;n--){let e=this._transactions.get(n);this._chunks.mergeAtBeginning(zM(e),zI)}}_invalidateTransactionFrom(e){(void 0===this._recreateTransactionsFrom||e<this._recreateTransactionsFrom)&&(this._recreateTransactionsFrom=e)}_createInitialChunk(){var e;if(this.reachedEarliestEntry){if((null==(e=this._chunks.first)?void 0:e.type)==="initial")return;let n=this._transactions.first;if(!n)return;let r=zM(n);r.type="initial",r.id="@initial",r.end=r.start,this._chunks.addToBeginning(r)}}parseTimeId(e){if(0===this._chunks.length)return this.reachedEarliestEntry?"invalid":"loading";let n=e.split("/",3),r=n.shift(),i=n.shift(),a=Number(r);for(let e=this._chunks.lastIdx;e>=this._chunks.firstIdx;e--){let n=this._chunks.get(e);if(n.id===i)return n;if(Date.parse(n.endTimestamp)+36e5<a)return"invalid"}return this.reachedEarliestEntry?"invalid":"loading"}findLastPublishedBefore(e){for(let n=e?e.index-1:this._chunks.lastIdx;n>=this._chunks.firstIdx;n--){let e=this._chunks.get(n);if("publish"===e.type||"initial"===e.type)return e}return this.reachedEarliestEntry?this._chunks.first:"loading"}isLatestChunk(e){return e===this._chunks.last}createTimeId(e){return"".concat(e.endTimestamp.valueOf(),"/").concat(e.id)}lastChunk(){return this._chunks.last}transactionByIndex(e){return this._transactions.has(e)?this._transactions.get(e):null}chunkByTransactionIndex(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=n;for(;;){let n=this._chunks.get(r);if(!n)throw Error("transaction does not belong in any chunk");if(e>=n.end)r++;else{if(!(e<n.start))return n;r--}}}replayBackwardsBetween(e,n,r){let i=r.draft,a=r.published;for(let r=n;r>=e;r--){let e=this._transactions.get(r);e.draftEffect&&(i=(0,cC.a)(i,e.draftEffect.revert)),e.publishedEffect&&(a=(0,cC.a)(a,e.publishedEffect.revert))}return{draft:i,published:a}}replayBackwardsUntil(e,n){return this.replayBackwardsBetween(e,this._transactions.lastIdx,n)}calculateDiff(e,n,r,i){var a,o;let l=cC.v.wrap(e.draft,null),s=cC.v.wrap(e.published,null),c=(a=l,o=s,"null"===cC.v.getType(a)?o:a),d=zk(e),u=null;for(let e=r;e<=i;e++){let n=this._chunks.get(e);u||(u=n);for(let e=n.start;e<n.end;e++){let r=this._transactions.get(e),i={chunk:n,transactionIndex:e},a=l,o=s;r.draftEffect&&(l=cC.v.applyPatch(l,r.draftEffect.apply,i)),r.publishedEffect&&(s=cC.v.applyPatch(s,r.publishedEffect.apply,i));let c="null"!==cC.v.getType(a),d="null"!==cC.v.getType(l);"null"===cC.v.getType(s)||d||(s=cC.v.rebaseValue(a,s)),d&&!c&&(l=cC.v.rebaseValue(o,l))}}return function(e,n,r,i,a,o){let l=zS(r,i,{fromValue:r=>zE(e,n,r.endMeta),fromMeta:r=>zE(e,n,r)}),s=zS(a,o,{fromValue:n=>zP(e,n.startMeta),fromMeta:n=>zP(e,n)});return(0,c_.t)(l,s)}(this,u,c,d,"null"===cC.v.getType(l)?s:l,zk(n))}}let zq=Object.create(null),zZ=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=Array.isArray(n)?n:[n],{time:a,revision:o}=r;if(a&&o)throw Error("getHistory can't handle both time and revision parameters");let l=e.config().dataset,s="/data/history/".concat(l,"/documents/").concat(i.join(","));if(o)s="".concat(s,"?revision=").concat(o);else{let e=a||new Date().toISOString();s="".concat(s,"?time=").concat(e)}return e.request({url:s})},zN=(e,n,r)=>{let i=dm(n),a=df(n),o="".concat(i,"@").concat(r),l=zq[o];if(l)return l;let s=e.config().dataset,c="/data/history/".concat(s,"/documents/").concat(i,",").concat(a,"?revision=").concat(r),d=e.request({url:c}).then(e=>{let n=e.documents||[],r=n.find(e=>e._id===i);return n.find(e=>e._id===a)||r});return zq[o]=d,d},zL=e=>{let{client:n,documentId:r,documentType:i}=e,a=new zD({enableTrace:xh,publishedId:r});return new zw({client:n,documentId:r,documentType:i,timeline:a})},zV=async(e,n)=>{let r=Array.isArray(n)?n:[n],i=e.config().dataset,a="/data/history/".concat(i,"/transactions/").concat(r.join(","));return(await e.request({url:a,query:{excludeContent:"true",includeIdentifiedDocumentsOnly:"true"}}
1)).toString("utf8").split("\n").filter(Boolean).map(e=>JSON.parse(e))},zK=e=>(0,cb.u4)(e,(e,n)=>(0,ll.Yk)(n)&&!e.includes(n._ref)?[...e,n._ref]:e,[]),zB=(e,n)=>(function e(n,r){return Array.isArray(n)?r(n.map(n=>e(n,r)).filter(e=>void 0!==e)):dj(n)?r(Object.keys(n).reduce((i,a)=>{let o=e(n[a],r);return void 0!==o&&(i[a]=o),i},{})):r(n)})(e,e=>(0,ll.Yk)(e)?n(e):e),zU=(e,n)=>zB(e,e=>n[e._ref]?e:void 0),zH=(e,n)=>{try{return JSON.parse(e)}catch(e){return console.warn("Failed to parse settings: ".concat(e.message)),n}},z$={get:(e,n)=>{let r=localStorage.getItem(e);return(0,og.of)(null===r?n:zH(r,n))},set:(e,n)=>(null==n?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(n)),(0,og.of)(n))},zW=Object.create(null),zY={get:(e,n)=>(0,og.of)(e in zW?zW[e]:n),set:(e,n)=>(null==n?delete zW[e]:zW[e]=n,(0,og.of)(n))},zX=[{id:"<system>",displayName:"Sanity",imageUrl:"https://public.sanity.io/logos/favicon-192.png"}],zG=[["nested","first"],["nested","second"],["nestedArray",{_key:"565c867c8dac"},"arrayNo1",{_key:"a645548a8f01"},"arrayNo1",{_key:"1685e372c40f"},"fieldNo0"],["nestedArray",{_key:"565c867c8dac"},"fieldNo0"],["nestedArray",{_key:"565c867c8dac"},"arrayNo19",{_key:"a02e7a93e2a2"},"fieldNo0"],["nestedArray",{_key:"565c867c8dac"},"arrayNo19",{_key:"a02e7a93e2a2"},"fieldNo19"],["address","country"],["address","street"],["customInputWithDefaultPresence","row3","cell3"]],zJ=(0,oj.P)(()=>(0,oT.H)(0,1e4)).pipe((0,a5.j)(["pqSMwf6hH","pnLYqNfv5","priDVVmy8","p0NFOU0j8","pTDl2jw8d","pHMeQnTse","pDQYzJbyS","pZyoPHKUs","p4Tyi2Be5","pb9vii060","pE8yhOisw","p7Fd2C6Cj","p3exSgYCx","pbIQRYViC","p8GJaTEhN","p27ewL8aM","pYg97z75S","pdLr4quHv","pkJXiDgg6","pkl4UAKcA","pNoExists"]),(0,aW.U)((e,n)=>({type:"state",userId:e,sessionId:e+n,timestamp:new Date().toISOString(),locations:[{type:"document",documentId:"presence-debug",lastActiveAt:new Date().toISOString(),path:cI()(zG)}]})),(0,aJ.d)()),zQ=e=>{if("rollCall"===e.type)return{type:"rollCall",userId:e.i,sessionId:e.session};if("state"===e.type){let{sessionId:n,locations:r}=e.m;return{type:"state",userId:e.i,sessionId:n,timestamp:new Date().toISOString(),locations:r}}if("disconnect"===e.type)return{type:"disconnect",userId:e.i,sessionId:e.m.session,timestamp:new Date().toISOString()};throw Error("Got unknown presence event: ".concat(JSON.stringify(e)))},z0=(e,n)=>[e.request("presence").pipe((0,aW.U)(zQ)).pipe((0,on.B)()),r=>"rollCall"===r.type?e.request("presence_rollcall",{session:n}):"state"===r.type?e.request("presence_announce",{data:{locations:r.locations,sessionId:n}}):"disconnect"===r.type?e.request("presence_disconnect",{session:n}):ov.E],z1="presence_session_id",z2=function(){try{return window.sessionStorage.getItem(z1)}catch(e){}return null}()||function(e){try{window.sessionStorage.setItem(z1,e)}catch(e){}return e}((0,cO.x0)(16));function z3(){let{getClient:e,currentUser:n}=RA(),r=hs(),i=e(h$);return(0,oN.useMemo)(()=>{let e=r.get({namespace:"userStore",dependencies:[i,n]})||function(e){let{client:n,currentUser:r}=e,i=n.withConfig({apiVersion:"2021-06-07"}),a=new(cS())(async e=>{let n=await i.request({uri:"/users/".concat(e.join(",")),withCredentials:!0,tag:"users.get"}),r=(Array.isArray(n)?n:[n]).reduce((e,n)=>((null==n?void 0:n.id)&&(e[n.id]=n),e),{});return e.map(e=>r[e]||null)},{batchScheduleFn:e=>cP()(e)}),o=r&&{id:r.id,displayName:r.name,imageUrl:r.profileImage};return a.prime("me",o),(null==o?void 0:o.id)&&a.prime(o.id,o),zX.forEach(e=>a.prime(e.id,e)),{getUser:async e=>{try{return await a.load(e)}catch(e){if(403===e.statusCode)return Promise.resolve(null);throw e}},getUsers:async e=>(await a.loadMany(e)).filter(e=>dj(e)&&"string"==typeof e.id)}}({client:i,currentUser:n});return r.set({namespace:"userStore",dependencies:[i,n],value:e}),e},[i,n,r])}function z4(){let{getClient:e}=RA(),n=e(h$),r=hK(),i=hs();return(0,oN.useMemo)(()=>{let e=i.get({namespace:"grantsStore",dependencies:[n,r]})||function(e){var n;let{client:r}=e,i=r.withConfig({apiVersion:"2021-06-07"}),a="userId"in e?e.userId:(null==(n=null==e?void 0:e.currentUser)?void 0:n.id)||null,o=(0,oj.P)(()=>(0,og.of)(i.config())).pipe((0,a$.w)(e=>{let{projectId:n,dataset:r}=e;if(!n||!r)throw Error("Missing projectId or dataset");return zp(i,n,r)})),l=zu.pipe((0,a$.w)(e=>e?(0,og.of)(e):o),(0,or._)(1),(0,ck.f)(1e3));return{checkDocumentPermission:(e,n)=>l.pipe((0,a$.w)(r=>zm(a,r,e,n)),(0,aX.x)(lu()))}}({client:n,userId:(null==r?void 0:r.id)||null});return i.set({namespace:"grantsStore",dependencies:[n,r],value:e}),e},[n,r,i])}function z5(){let e=hN(h$),n=hs();return(0,oN.useMemo)(()=>{let r=n.get({namespace:"historyStore",dependencies:[e]})||function(e){let{client:n}=e;return{getDocumentAtRevision:(e,r)=>zN(n,e,r),getHistory:(e,r)=>zZ(n,e,r),getTransactions:e=>zV(n,e),restore:(e,r,i)=>(0,ob.D)(zN(n,e,i)).pipe((0,aQ.z)(r=>{if(!r)throw Error("Unable to find document with ID ".concat(e," at revision ").concat(i));let a=zK(r).map(e=>'"'.concat(e,'": defined(*[_id=="').concat(e,'"]._id)')).join(",");return n.observable.fetch("{".concat(a,"}")).pipe((0,aW.U)(e=>zU(r,e)))}),(0,aW.U)(e=>{let{_updatedAt:n,...i}=e;return{...i,_id:r}}),(0,aQ.z)(e=>n.observable.createOrReplace(e,{visibility:"async"}))),getTimelineController:zL}}({client:e});return n.set({namespace:"historyStore",dependencies:[e],value:r}),r},[e,n])}function z8(){let e=hN(h$),n=hs();return(0,oN.useMemo)(()=>{let r=n.get({namespace:"documentPreviewStore",dependencies:[e]})||function(e){let{client:n}=e,r=n.withConfig({apiVersion:"1"}),{observeFields:i}=function(e){let n;
1let{observePaths:r,versionedClient:i}=e,a=()=>{if(!n){let e=(0,ob.D)(i.listen('*[!(_id in path("_.**"))]',{},{events:["welcome","mutation"],includeResult:!1,visibility:"query",tag:"preview.global"})).pipe((0,on.B)()),r=e.pipe((0,a2.h)(e=>"welcome"===e.type),(0,aJ.d)({refCount:!0,bufferSize:1}));r.subscribe(),n={welcome$:r,mutations$:e.pipe((0,a2.h)(e=>"mutation"===e.type))}}return n};function o(e){return function(n){let r=cy()(n.reduce((e,n,r)=>{let[i,a]=n,o=lo()(a.join(","),cx()).join(".");e[o]||(e[o]={fields:a,ids:[],map:[]});let l=e[o].ids.length;return e[o].ids[l]=i,e[o].map[l]=r,e},{}));return e.observable.fetch("[".concat(r.map(A0).join(","),"][0...").concat(r.length,"]"),{},{tag:"preview.document-paths"}).pipe((0,aW.U)(e=>e.reduce((e,n,i)=>(r[i].map.forEach((a,o)=>{let l=r[i].ids[o],s=n.find(e=>e._id===l);e[a]=s||null}),e),[])))}}let l=AY(o(i),100),s=AY(o(i),1e3),c={},d=lF()(function(e){return AY(o(i.withConfig(e)),10)},e=>e.dataset+e.projectId),u=(0,ok.R)(document,"visibilitychange").pipe((0,a3.O)(0),(0,aW.U)(()=>"visible"===document.visibilityState),(0,a$.w)(e=>e?(0,oT.H)(0,1e4):ov.E),(0,on.B)());return{observeFields:function(e,n,r){let i=r?"".concat(r.projectId,":").concat(r.dataset,":").concat(e):"$current$-".concat(e);i in c||(c[i]=[]);let o=c[i];cd()(n,lI()(o.map(e=>e.fields))).length>0&&o.push(function(e,n,r){let i=null,o=(0,ow.T)((0,oj.P)(()=>null===i?ov.E:(0,og.of)(i)),r?u.pipe((0,a3.O)(0)).pipe((0,a$.w)(()=>d(r)(e,n))):(function(e){let n=a();return(0,ow.T)(n.welcome$,n.mutations$.pipe((0,a2.h)(n=>n.documentId===e)))})(e).pipe((0,a$.w)(r=>"welcome"===r.type||"query"===r.visibility?l(e,n).pipe((0,aQ.z)(r=>(0,ox.z)((0,og.of)(r),void 0===r?s(e,n):[]))):s(e,n)))).pipe((0,a4.b)(e=>i=e),(0,aJ.d)({refCount:!0,bufferSize:1}));return{id:e,fields:n,changes$:o}}(e,n,r));let p=o.filter(e=>e.fields.some(e=>n.includes(e))).map(e=>e.changes$);return(0,oE.a)(p).pipe((0,aW.U)(e=>e.filter(Boolean)),(0,a2.h)(e=>(function(e){let n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A1;for(let a=0;a<e.length;a++){if(0===a){n=i(e[a]);continue}if(n!==(r=i(e[a])))return!1;n=r}return!0})(e,e=>e._rev)),(0,aW.U)(e=>0===e.length?null:[...AI,...n].reduce((n,r)=>{let i;let a=(e.some(e=>r in e&&(i=e[r],!0)),i);return void 0!==a&&(n[r]=a),n},{})),(0,aX.x)((e,r)=>e===r||!!e&&!!r&&"object"==typeof e&&"object"==typeof r&&n.every(n=>e[n]===r[n])))}}}({observePaths:(e,n,r)=>a(e,n,r),versionedClient:r}),{observePaths:a}=function(e){let{observeFields:n}=e;return{observePaths:(e,r,i)=>(function e(n,r,i,a){if(!n||"object"!=typeof n)return(0,og.of)(n);let o=(0,ll.Yk)(n)?n._ref:"_id"in n?n._id:void 0,l=o?{...n,_id:o}:{...n};"reference"===l._type&&(delete l._type,delete l._ref,delete l._weak,delete l._dataset,delete l._projectId,delete l._strengthenOnPublish);let s=r.filter(e=>!(e[0]in l));if(o&&s.length>0){let l=sz()(s.map(e=>e[0])),c=(0,ll.Yz)(n)?{projectId:n._projectId,dataset:n._dataset}:a;return i(o,l,c).pipe((0,a$.w)(a=>null===a?(0,og.of)(null):e({...l.reduce((e,n)=>(e[n]=void 0,e),{}),...(0,ll.Yk)(n)?{...n,...c}:n,...a},r,i,c)))}let c={};r.forEach(e=>{let[n,...r]=e;c[n]||(c[n]=[]),c[n].push(r)});let d=Object.keys(c).reduce((r,o)=>{let l=c[o].filter(e=>e.length>0);return 0===l.length?r[o]=dj(n)?n[o]:void 0:r[o]=e(n[o],l,i,a),r},l);return(0,og.of)(d).pipe(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n=>new oy.y(e=>n.subscribe(e)).pipe((0,a$.w)(n=>{let r=AD(n).map(e=>{let r=n[e];return(0,oP.b)(r)?(0,ob.D)(r).pipe((0,aW.U)(n=>[e,n])):(0,og.of)([e,r])});return e.wait?(0,oE.a)(r).pipe((0,aW.U)(e=>e.reduce((e,n)=>{let[r,i]=n;return{...e,[r]:i}},{}))):(0,ob.D)(r).pipe((0,a0.J)(),(0,aY.R)((e,n)=>{let[r,i]=n;return{...e,[r]:i}},{}))}))}({wait:!0}))})(e,r.map(e=>"string"==typeof e?e.split("."):e),n,i)}}({observeFields:i});function o(e,n){return a({_type:"reference",_ref:e},["_type"],n).pipe((0,aW.U)(e=>dj(e)&&"string"==typeof e._type?e._type:void 0),(0,aX.x)())}let l=function(e){let{observeDocumentTypeFromId:n,observePaths:r}=e;return function e(i,a,o,l){if((0,ll.mz)(a)){if(!(0,ll.Yz)(i))return(0,og.of)({snapshot:void 0});let r={projectId:i._projectId,dataset:i._dataset};return n(i._ref,r).pipe((0,a$.w)(n=>n?e(i,a.to.find(e=>e.type===n),{},r):(0,og.of)({snapshot:void 0})))}if((0,ll.dD)(a))return lP()(i)?n(i._ref).pipe((0,a$.w)(n=>n?e(i,a.to.find(e=>e.name===n)):(0,og.of)({snapshot:void 0}))):(0,og.of)({snapshot:void 0});let s=AT(a.preview);return s?r(i,s,l).pipe((0,aW.U)(e=>({type:a,snapshot:e&&AW(e,a,o)}))):(0,og.of)({type:a,snapshot:i&&lP()(i)?AH(a,i,o).returnValue:null})}}({observeDocumentTypeFromId:o,observePaths:a}),{observeDocumentPairAvailability:s}=AG(r,a),{observePathsDocumentPair:c}=function(e,n){let{observeDocumentPairAvailability:r}=AG(e,n),i=[["_updatedAt"],["_createdAt"],["_type"]];return{observePathsDocumentPair:function(e,a){let{draftId:o,publishedId:l}=dh(e);return r(o).pipe((0,a$.w)(e=>{if(!e.draft.available&&!e.published.available)return(0,og.of)({id:l,type:null,draft:{availability:e.draft,snapshot:void 0},published:{availability:e.published,snapshot:void 0}});let r=[...a,...i];return(0,oE.a)([n({_type:"reference",_ref:o}
1,r),n({_type:"reference",_ref:l},r)]).pipe((0,aW.U)(n=>{let[r,i]=n,a=dj(r)&&"_type"in r&&r._type||dj(i)&&"_type"in i&&i._type||null;return{id:l,type:"string"==typeof a?a:null,draft:{availability:e.draft,snapshot:r},published:{availability:e.published,snapshot:i}}}))}))}}}(r,a);return{observePaths:a,observeForPreview:l,observeDocumentTypeFromId:o,unstable_observeDocumentPairAvailability:s,unstable_observePathsDocumentPair:c}}({client:e});return n.set({namespace:"documentPreviewStore",dependencies:[e],value:r}),r},[e,n])}function z6(){let{getClient:e,i18n:n}=RA(),r=h1(),i=h2(),a=hs(),o=z5(),l=z8();return(0,oN.useMemo)(()=>{let s=a.get({namespace:"documentStore",dependencies:[e,l,o,r,n]})||function(e){let{getClient:n,documentPreviewStore:r,historyStore:i,initialValueTemplates:a,schema:o,i18n:l}=e,s=r.unstable_observeDocumentPairAvailability,c=n(h$),d={client:c,getClient:n,observeDocumentPairAvailability:s,historyStore:i,schema:o,i18n:l};return{checkoutPair:e=>Ir(c,e),initialValue:(e,n)=>(function(e,n,r,i,a){let o=r.observePaths({_type:"reference",_ref:df(i.documentId)},["_type"]),l=r.observePaths({_type:"reference",_ref:dm(i.documentId)},["_type"]);return(0,ow.T)(o.pipe((0,aW.U)(e=>({draft:e}))),l.pipe((0,aW.U)(e=>({published:e})))).pipe((0,aY.R)((e,n)=>({...e,...n}),{}),(0,a2.h)(e=>"draft"in e&&"published"in e),(0,aW.U)(e=>e.draft||e.published),(0,aX.x)((e,n)=>!!e!=!!n),(0,ou.b)(25)).pipe((0,a$.w)(r=>{if(r)return(0,og.of)({type:"success",value:null});if(!i.templateName)return(0,og.of)({isResolving:!1,initialValue:void 0});let o=n.find(e=>e.id===i.templateName);if(!o)return console.warn('Template "%s" not defined, using empty initial value',i.templateName),(0,og.of)({isResolving:!1,initialValue:void 0});let l=(0,ob.D)(IG(e,o,i.templateParams,a)).pipe((0,aW.U)(e=>({isResolving:!1,initialValue:e}))).pipe((0,aG.K)(e=>(console.group("Failed to resolve initial value"),console.error(e),console.error("Template ID: %s",i.templateName),console.error("Parameters: %o",i.templateParams),console.groupEnd(),(0,og.of)({type:"error",error:e}))));return(0,ow.T)((0,og.of)({isResolving:!0}),l).pipe((0,a$.w)(e=>{let{isResolving:n,initialValue:r,resolveError:i}=e;return i?(0,og.of)({type:"error",message:"Failed to resolve initial value"}):n?(0,og.of)(I2):(0,og.of)({type:"success",value:r})}))}),(0,a3.O)(I2),(0,aX.x)())})(o,a,r,e,n),listenQuery:(e,n,r)=>(function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a="string"==typeof n?n:n.fetch,o=IB(e,"string"==typeof n?n:n.listen,r,i).pipe((0,aQ.z)((e,n)=>0!==n||IU(e)?(0,og.of)(e):(0,o_._)(()=>Error("reconnect"===e.type?"Could not establish EventSource connection":'Received unexpected type of first event "'.concat(e.type,'"')))),(0,on.B)()),[l,s]=(0,oz.u)(o,IU),c=()=>IK(e,a,r,i);return(0,ow.T)(l.pipe((0,a6.q)(1)),s.pipe((0,a2.h)(e=>!i.transitions||"mutation"!==e.type||i.transitions.includes(e.transition)),(0,os.p)(i.throttleTime||1e3,oA.z,{leading:!0,trailing:!0}))).pipe((0,cj.q)(e=>"mutation"===e.type&&"query"!==e.visibility?(0,oT.H)(1200).pipe((0,aQ.z)(c)):c()))})(c,e,n,r),resolveTypeForDocument:(e,n)=>(function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"*";if(r&&"*"!==r)return(0,og.of)(r);let i=dm(n),a=df(i);return e.observable.fetch("*[_id in [$documentId, $draftId]]._type",{documentId:i,draftId:a}).pipe((0,aW.U)(e=>e[0]))})(c,e,n),pair:{consistencyStatus:(e,n)=>IC(d.client,I3(e),n),documentEvents:(e,n)=>IF(d.client,I3(e),n),editOperations:(e,n)=>IV(d,I3(e),n),editState:(e,n)=>Ih(d,I3(e),n),operationEvents:(e,n)=>IO({client:c,historyStore:i,schema:o}).pipe((0,a2.h)(r=>r.args.idPair.publishedId===e&&r.args.typeName===n),(0,aW.U)(e=>{let{operationName:n,idPair:r}=e.args;return"success"===e.type?{type:"success",op:n,id:r.publishedId}:{type:"error",op:n,id:r.publishedId,error:e.error}})),validation:(e,n)=>IR(d,I3(e),n)}}}({getClient:e,documentPreviewStore:l,historyStore:o,initialValueTemplates:i,schema:r,i18n:n});return a.set({namespace:"documentStore",dependencies:[e,l,o,r,n],value:s}),s},[e,l,o,a,r,i,n])}function z9(){let{__internal:{bifur:e}}=RA(),n=hs(),r=z3(),i=function(){let{bifur:e}=RA().__internal,n=hs();return(0,oN.useMemo)(()=>{let r=n.get({namespace:"connectionStatusStore",dependencies:[e]})||function(e){var n;let{bifur:r}=e;return{connectionStatus$:(0,ow.T)(r.heartbeats,hM.pipe((0,a5.j)((0,o_._)(Error("The browser went offline"))))).pipe((0,aW.U)(e=>({type:"connected",lastHeartbeat:e})),(n=(e,n,r)=>{let i=Math.min(24e4,hR(n)),a=new Date(new Date().getTime()+i),o=(0,oT.H)(a),l=!navigator.onLine,s=hZ({error:e,retryAt:a,isOffline:l,attemptNo:n}),c=oS.C.pipe((0,a8.R)(l?hz:(0,ow.T)(o,hz,hq)));return(0,ox.z)((0,og.of)(s),c.pipe((0,a6.q)(1)),r)},e=>{let r=[],i=(0,aG.K)((e,a)=>(r.push(e),n(e,r.length,a).pipe(i)));return e.pipe((0,a4.b)(()=>{r=[]}),i)}),(0,a3.O)(hF))}}({bifur:e});return n.set({namespace:"connectionStatusStore",dependencies:[e],value:r}),r},[e,n])}();return(0,oN.useMemo)(()=>{let a=n.get({namespace:"presenceStore",dependencies:[e,i,r]})||function(e){let{bifur:n,connectionStatusStore:r,userStore:i}=e,[a,o]=z0(n,z2),l=new oO.X([]),s=l.pipe((0,aX.x)()),c=e=>o({type:"state",locations:e}),d=()=>o({type:"rollCall"}),u=a.pipe((0,a2.h)(e=>"rollCall"===e.type),(0,a2.h)(e=>e.sessionId!==z2)),p=(0,oT.H)(0,3e4),h=(0,oj.P)(()=>(0,ow.T)(s,u)).pipe((0,a$.w)(()=>p),(0,oa.M)(l),(0,aW.U)(e=>{let[,n]=e;return n}),(0,op.e)(200),(0,a$.w)(e=>c(e)),(0,a5.j)(ov.E),(0,on.B)()),f=(0,oj.P)(()=>d()).pipe((0,a5.j)(ov.E)),m=r.connectionStatus$.pipe((0,aW.U)(e=>e.type),(0,a2.h)(e=>"connected"===e||"error"===e),(0,aX.x)()),g=zo.pipe((0,aW.U)(e=>e.find(e=>e.startsWith("presence="))),(0,aW.U)(e=>(null==e?void 0:e.split("presence=")[1].split(",").map(e=>e.trim()))||[])),x=g.pipe((0,a2.h)(e=>e.includes("fake_others")),(0,a4.b)(()=>{console.log('Faking other users present in the studio. They will hang out in the document with _type: "presence" and _id: "presence-debug"')}),(0,oh.c)(zJ)),v=g.pipe((0,aW.U)(e=>e.includes("show_own"))),y=(0,ow.T)(f,a).pipe((0,a2.h)(e=>"state"===e.type||"disconnect"===e.type)),b=e=>({lastActiveAt:e.timestamp,locations:e.locations,sessionId:e.sessionId,userId:e.userId}),j=(0,ow.T)(y,x).pipe((0,aY.R)((e,n)=>"disconnect"===n.type?sH()(e,n.sessionId):{...e,[n.sessionId]:b(n)},{})),w=m.pipe((0,a$.w)(e=>"connected"===e?(0,ow.T)(j,h):oS.C),(0,aW.U)(e=>Object.values(e)),(0,a$.w)(e=>{let n=sz()(e.map(e=>
1e.userId));return(0,ob.D)(i.getUsers(n)).pipe((0,aW.U)(n=>e.map(e=>({user:n.find(n=>n.id===e.userId),session:e})).filter(k)))}),(0,a8.R)((0,ok.R)(window,"beforeunload").pipe((0,a$.w)(()=>o({type:"disconnect"})))),(0,aJ.d)({refCount:!0,bufferSize:1}));function k(e){return!!(e.user&&e.session)}return{setLocation:e=>{l.next(e)},reportLocations:c,debugPresenceParam$:g,globalPresence$:w.pipe((0,aW.U)(e=>{let n=s1()(e.map(e=>e.session),e=>e.userId);return Object.keys(n).map(r=>{var i;return{user:null==(i=e.find(e=>e.user.id===r))?void 0:i.user,sessions:n[r]}})}),(0,oa.M)(v),(0,aW.U)(e=>{let[n,r]=e;return n.filter(e=>!!r||!e.sessions.some(e=>e.sessionId===z2))}),(0,aW.U)(e=>e.map(e=>{var n;return{user:e.user,status:"online",lastActiveAt:null==(n=e.sessions.sort()[0])?void 0:n.lastActiveAt,locations:lI()((e.sessions||[]).map(e=>e.locations||[])).map(e=>({type:e.type,documentId:e.documentId,path:e.path,lastActiveAt:e.lastActiveAt})).reduce((e,n)=>e.concat(n),[])}}))),documentPresence:e=>w.pipe((0,oa.M)(v),(0,a$.w)(n=>{let[r,i]=n;return(0,ob.D)(r).pipe((0,a2.h)(e=>i||e.session.sessionId!==z2),(0,of.V)(n=>(n.session.locations||[]).filter(n=>n.documentId===e).map(e=>({user:n.user,lastActiveAt:n.session.lastActiveAt,path:e.path||[],sessionId:n.session.sessionId}))),(0,a1.q)())}))}}({bifur:e,connectionStatusStore:i,userStore:r});return n.set({namespace:"presenceStore",dependencies:[e,i,r],value:a}),a},[e,i,n,r])}function z7(){let e=hN(h$),n=hs();return(0,oN.useMemo)(()=>{let r=n.get({namespace:"projectStore",dependencies:[e]})||function(e){let{client:n}=e,r=n.config().projectId,i=n.withConfig({apiVersion:"2021-12-15"});return{get:function(){return i.observable.request({url:"/projects/".concat(r)})},getDatasets:function(){return i.observable.request({url:"/projects/".concat(r,"/datasets")})}}}({client:e});return n.set({namespace:"projectStore",dependencies:[e],value:r}),r},[e,n])}function Me(){let e=hs(),n=St();return(0,oN.useMemo)(()=>{let r=e.get({dependencies:[n],namespace:"settingsStore"})||function(){let e=hd?z$:zY,n=new oC.x,r=(e,n)=>"".concat(e,"::").concat(n),i=n.pipe((0,a$.w)(n=>e.set(n.key,n.value).pipe((0,aW.U)(e=>({key:n.key,value:e}))))),a=(n,r)=>(0,ow.T)(e.get(n,r),i.pipe((0,a2.h)(e=>e.key===n),(0,aW.U)(e=>e.value))),o=(e,r)=>{n.next({key:e,value:r})},l=e=>({forKey:n=>{let i=r(e,n);return{listen:e=>a(i,e),set:e=>o(i,e),del:()=>o(i,void 0)}},listen:(n,i)=>
1a(r(e,n),i),set:(n,i)=>o(r(e,n),i),del:n=>o(r(e,n),void 0),forNamespace:n=>l(r(e,n))});return{forNamespace:l}}();return e.set({dependencies:[n],namespace:"settingsStore",value:r}),r},[e,n])}function Mt(e){let n=z9(),[r,i]=(0,oN.useState)([]);return(0,oN.useEffect)(()=>{let r=n.documentPresence(e).subscribe(i);return()=>{r.unsubscribe()}},[e,n]),r}let Mn={referringDocuments:[],isLoading:!0};function Mr(e){let n=z6();return(0,oR.m2)(()=>n.listenQuery("*[references($docId)] [0...101]",{docId:e},{tag:"use-referring-documents"}).pipe((0,aW.U)(e=>({referringDocuments:e,isLoading:!1})),(0,a3.O)(Mn)),[n,e],Mn)}let Mi=e=>{let{asset:n,assetType:r,referringDocuments:i}=e,{t:a}=dV(),o=i.length;return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(oK.Zb,{borderBottom:o>0,marginTop:2,paddingBottom:2,marginBottom:1,children:(0,oZ.jsx)(oK.xv,{size:1,as:"h2",weight:"medium",children:(0,oZ.jsx)(uz,{t:a,i18nKey:"asset-source.usage-list.documents-using-".concat(r),context:n.originalFilename?"named":"unnamed",values:{filename:n.originalFilename,count:o}})})}),i.map(e=>(0,oZ.jsx)(Ma,{document:e},e._id))]})},Ma=e=>{let{document:n}=e,r=h1(),i=(0,oN.useCallback)(e=>(0,oZ.jsx)(lm.nR,{...e,params:{id:n._id,type:n._type},intent:"edit"}),[n]);return(0,oZ.jsx)(oK.Zb,{as:i,radius:2,"data-as":"a",tabIndex:0,children:(0,oZ.jsx)(oK.kC,{align:"center",gap:2,children:(0,oZ.jsx)(AC,{layout:"default",value:{_type:"reference",_ref:n._id},schemaType:r.get(n._type)})})},n._id)},Mo={maxWidth:"100%",height:"120px",objectFit:"contain",objectPosition:"center"},Ml={gridColumn:"span 1",overflow:"hidden",display:"flex",alignSelf:"center",justifyContent:"center"},Ms={height:"100%"},Mc=e=>{let{asset:n,assetType:r,hasResults:i=!1}=e,a="image"===r,{t:o}=dV();return i?(0,oZ.jsx)(oK.Zb,{tone:"caution",padding:[3,3,4],border:!0,radius:2,marginBottom:3,children:(0,oZ.jsxs)(oK.rj,{columns:3,gap:[2,3,4],children:[(0,oZ.jsxs)(oK.kC,{gap:[3,4],align:"center",style:{gridColumn:a?"span 2":"span 3"},children:[(0,oZ.jsx)(oK.xv,{children:(0,oZ.jsx)(lp.foC,{})}),(0,oZ.jsx)(oK.xv,{size:1,children:o("asset-source.delete-dialog.usage-list.warning-".concat(r,"-is-in-use"),{context:n.originalFilename?"named":"unnamed",filename:n.originalFilename})})]}),a&&(0,oZ.jsx)(oK.Zb,{__unstable_checkered:!0,border:!0,radius:1,style:Ml,children:(0,oZ.jsx)(oK.kC,{align:"center",justify:"center",style:Ms,children:(0,oZ.jsx)("img",{src:"".concat(n.url,"?w=200"),style:Mo,alt:o("asset-source.usage-list.image-alt"),referrerPolicy:"strict-origin-when-cross-origin"})})})]})}):(0,oZ.jsx)(oK.Zb,{paddingX:[2,3,4],paddingY:[3,3,3,4],children:(0,oZ.jsxs)(oK.rj,{columns:3,gap:3,children:[(0,oZ.jsx)(oK.kC,{style:{gridColumn:a?"span 2":"span 3"},align:"center",children:(0,oZ.jsx)(oK.xv,{children:(0,oZ.jsx)(uz,{t:o,i18nKey:"asset-source.delete-dialog.usage-list.confirm-delete-".concat(r),context:n.originalFilename?"named":"unnamed",values:{filename:n.originalFilename}})})}),a&&(0,oZ.jsx)(oK.Zb,{__unstable_checkered:!0,border:!0,radius:1,style:Ml,children:(0,oZ.jsx)(oK.kC,{align:"center",justify:"center",style:Ms,children:(0,oZ.jsx)("img",{src:"".concat(n.url,"?w=200"),style:Mo,alt:o("asset-source.asset-list.table.preview-alt"),referrerPolicy:"strict-origin-when-cross-origin"})})})]})})};function Md(e){let{asset:n,assetType:r,isDeleting:i=!1,onClose:a,onDelete:o}=e,{isLoading:l,referringDocuments:s}=Mr(n._id),c=(0,oN.useMemo)(()=>{let e=s.reduce((e,n)=>n._id.startsWith("drafts.")?e.concat(n._id.slice(7)):e,[]);return s.filter(n=>!e.includes(n._id))},[s]),d=c.length>0,{t:u}=dV();return(0,oZ.jsx)(lr.Vq,{__unstable_autoFocus:l,footer:{cancelButton:{onClick:a,text:u("asset-source.delete-dialog.action.cancel")},confirmButton:{disabled:d,icon:lp.XHJ,loading:i,onClick:o,text:u("asset-source.delete-dialog.action.delete")}},header:u("asset-source.delete-dialog.header",{context:r}),id:"asset-dialog",onClickOutside:a,onClose:a,width:1,children:l?(0,oZ.jsx)(oK.xu,{padding:4,children:(0,oZ.jsx)(u4,{showText:!0})}):(0,oZ.jsxs)(oK.Kq,{paddingX:d?[2,3,4]:0,paddingY:d?[3,3,3,4]:0,space:1,children:[(0,oZ.jsx)(Mc,{asset:n,assetType:r,hasResults:d}),d&&(0,oZ.jsx)(Mi,{asset:n,referringDocuments:c,assetType:r})]})})}let Mu={portal:!0,placement:"right"};function Mp(e){let{isSelected:n,border:r=!0,onAction:i}=e,{t:a}=dV();return(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(bA,{mode:r?"ghost":n?"default":"bleed",tone:r?"default":n?"primary":"default"}),id:"asset-menu",menu:(0,oZ.jsxs)(oK.v2,{children:[(0,oZ.jsx)(lr.sN,{text:a("asset-source.asset-list.menu.show-usage"),icon:lp.xPt,onClick:()=>{i({type:"showUsage"})}}),(0,oZ.jsx)(lr.sN,{text:a("asset-source.asset-list.menu.delete"),icon:lp.XHJ,tone:"critical",onClick:()=>{i({type:"delete"})}})]}),popover:Mu})}
1let Mh={"image/bmp":{title:"Bitmap Image"},"image/jpeg":{title:"JPEG Image"},"image/gif":{title:"GIF Image"},"image/vnd.microsoft.icon":{title:"Icon"},"image/png":{title:"PNG Image"},"image/svg+xml":{title:"SVG Image"},"image/webp":{title:"WebP Image"},"image/tiff":{title:"TIFF Image"},"image/heic":{title:"HEIC Image"},"audio/midi":{title:"MIDI Audio"},"audio/midi-x":{title:"MIDI Audio"},"audio/mpeg":{title:"MP3 Audio"},"audio/ogg":{title:"OGG Audio"},"audio/wav":{title:"WAV Audio"},"audio/webm":{title:"WebM Audio"},"audio/aac":{title:"AAC Audio"},"video/x-msvideo":{title:"AVI Video"},"video/mp4":{title:"MP4 Video"},"video/mpeg":{title:"MPEG Video"},"video/ogg":{title:"OGG Video"},"video/webm":{title:"WebM Video"},"video/quicktime":{title:"QuickTime Video"},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{title:"Excel Spreadsheet"},"application/vnd.ms-excel":{title:"Excel Spreadsheet"},"text/plain":{title:"Text"},"text/javascript":{title:"JavaScript"},"text/markdown":{title:"Markdown"},"text/csv":{title:"CSV"},"text/css":{title:"CSS"},"application/pdf":{title:"PDF Document"},"application/xml":{title:"XML Document"},"text/xml":{title:"XML Document"},"application/zip":{title:"ZIP Archive"},"application/vnd.rar":{title:"RAR Archive"},"application/x-7z-compressed":{title:"7-zip Archive"},"application/octet-stream":{title:"Binary"}};function Mf(e){let{asset:n,assetType:r,onClose:i}=e,{isLoading:a,referringDocuments:o}=Mr(n._id),l=(0,oN.useMemo)(()=>{let e=o.reduce((e,n)=>n._id.startsWith("drafts.")?e.concat(n._id.slice(7)):e,[]);return o.filter(n=>!e.includes(n._id))},[o]),{t:s}=dV();return(0,oZ.jsx)(lr.Vq,{__unstable_autoFocus:!0,header:s("asset-source.asset-usage-dialog.header",{context:r}),id:"asset-dialog",onClickOutside:i,onClose:i,width:1,children:a?(0,oZ.jsx)(u4,{showText:!0}):(0,oZ.jsx)(Mi,{asset:n,referringDocuments:l,assetType:r})})}var Mm=Object.freeze,Mg=Object.defineProperty,Mx=(e,n)=>Mm(Mg(e,"raw",{value:Mm(n||e.slice())}));let Mv=oV.ZP.span(rU||(rU=Mx(["\n  background-color: transparent;\n  flex-shrink: 0;\n"]))),My=(0,oV.ZP)(oK.kC)(rH||(rH=Mx([""]))),Mb=(0,oV.ZP)(oK.Zb)(rW||(rW=Mx(["\n  ","\n"])),e=>e.isSelected&&(0,oV.iv)(r$||(r$=Mx(["\n      --card-muted-fg-color: var(--card-bg-color);\n      --card-fg-color: var(--card-bg-color);\n    "])))),Mj=(0,oV.ZP)(oK.zx)(rG||(rG=Mx(["\n  box-shadow: none;\n  min-width: 0;\n  cursor: pointer;\n  position: initial;\n\n  &:before,\n  &:after {\n    content: '';\n    position: absolute;\n    left: 0;\n    top: 0;\n    width: 100%;\n    height: 100%;\n    z-index: 2;\n  }\n\n  &:before {\n    z-index: 0;\n    pointer-events: none;\n    border-radius: inherit;\n  }\n\n  ","\n\n  ","\n"])),e=>e.isSelected&&(0,oV.iv)(rY||(rY=Mx(["\n      --card-muted-fg-color: var(--card-bg-color);\n      --card-fg-color: var(--card-bg-color);\n\n      &:before {\n        background-color: var(--card-focus-ring-color);\n      }\n\n      "," {\n        --card-muted-fg-color: var(--card-bg-color);\n      }\n\n      "," {\n        --card-muted-fg-color: var(--card-bg-color);\n        --card-fg-color: var(--card-bg-color);\n      }\n    "])),Mv,My),e=>!e.isSelected&&(0,oV.iv)(rX||(rX=Mx(["\n      &:hover:before {\n        background-color: var(--card-bg-color);\n      }\n\n      &:focus:before {\n        background-color: var(--card-code-bg-color);\n      }\n\n      &:focus-within:before {\n        background-color: var(--card-bg-color);\n      }\n    "])))),Mw=(0,oV.ZP)(oK.xv)(rJ||(rJ=Mx(["\n  overflow-wrap: anywhere;\n"]))),Mk={position:"relative"},MC={flexShrink:0},M_={minWidth:0},MT={zIndex:3,marginTop:"-0.5rem",marginBottom:"-0.5rem"},MS=e=>{let n=hN(h$),r=(0,oK.pm)(),i=(0,oN.useRef)(),[a,o]=(0,oN.useState)(!1),[l,s]=(0,oN.useState)(!1),[c,d]=(0,oN.useState)(!1),[u,p]=(0,oN.useState)(!1),{asset:h,onClick:f,onKeyPress:m,onDeleteFinished:g,isSelected:x,isMobile:v}=e,{originalFilename:y,_id:b,mimeType:j,size:w,_createdAt:k}=h,C=h0(k,{useTemporalPhrase:!0}),_=(null==Mh?void 0:Mh[j])?Mh[j].title:function(e){let n=e.replace("x-","").split("/")[1];return n.charAt(0).toUpperCase()+n.slice(1)}(j),T=mK(w,h3({unitDisplay:"short",maximumFractionDigits:2})),S=(y||"").length>37,{t:E}
1=dV(),P=(0,oN.useCallback)(()=>{s(!0)},[]),O=(0,oN.useCallback)(e=>{r.push({closable:!0,status:"error",title:E("asset-source.file.asset-list.delete-failed"),description:e.message})},[E,r]),A=(0,oN.useCallback)(()=>{r.push({status:"success",title:E("asset-source.file.asset-list.delete-successful")})},[E,r]),I=(0,oN.useCallback)(()=>{d(!0),i.current=n.observable.delete(h._id).subscribe({next:()=>{d(!1),null==g||g(h._id),s(!1),A()},error:e=>{d(!1),O(e),console.error("Could not delete asset",e)}})},[h._id,O,A,g,n.observable]),z=()=>{o(!1),s(!1)},M=()=>{o(!0)},R=(0,oN.useMemo)(()=>a&&(0,oZ.jsx)(Mf,{assetType:"file",asset:h,onClose:z}),[h,a]),F=(0,oN.useMemo)(()=>l&&(0,oZ.jsx)(Md,{assetType:"file",asset:h,onClose:z,onDelete:I,isDeleting:c}),[h,I,c,l]);return v?(0,oZ.jsxs)(oK.Zb,{paddingBottom:2,style:Mk,children:[(0,oZ.jsxs)(oK.rj,{columns:4,gap:1,style:{position:"relative",gridTemplateColumns:"1fr 30px",opacity:c?.5:1},children:[(0,oZ.jsx)(Mj,{asset:h,mode:"bleed",padding:0,"data-id":b,onClick:f,paddingY:1,radius:2,children:(0,oZ.jsxs)(oK.kC,{gap:2,flex:2,align:"center",children:[(0,oZ.jsx)(oK.Zb,{as:Mv,padding:2,tone:"transparent",radius:2,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:2,style:MC,children:(0,oZ.jsx)(lp.$lS,{})})}),(0,oZ.jsx)(oK.xv,{size:1,align:"left",textOverflow:"ellipsis",style:M_,children:y})]})}),(0,oZ.jsx)(oK.kC,{justify:"flex-end",align:"center",paddingRight:1,style:MT,children:(0,oZ.jsx)(oK.zx,{mode:"bleed",fontSize:1,padding:2,onClick:()=>{p(!u)},icon:u?lp.g8U:lp.v4q})})]}),u&&(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsxs)(oK.rj,{marginTop:3,columns:3,gap:1,children:[(0,oZ.jsxs)(oK.Kq,{space:2,children:[(0,oZ.jsx)(oK.xv,{size:1,muted:!0,weight:"medium",children:E("asset-source.file.asset-list.header.size")}),(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:T})]}),(0,oZ.jsxs)(oK.Kq,{space:2,children:[(0,oZ.jsx)(oK.xv,{size:1,muted:!0,weight:"medium",children:E("asset-source.file.asset-list.header.type")}),(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:_})]}),(0,oZ.jsxs)(oK.Kq,{space:2,children:[(0,oZ.jsx)(oK.xv,{size:1,muted:!0,weight:"medium",children:E("asset-source.file.asset-list.header.date-added")}),(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:C})]})]}),(0,oZ.jsxs)(oK.Kq,{space:2,marginTop:3,children:[(0,oZ.jsx)(oK.zx,{fontSize:1,tone:"default",mode:"ghost",text:E("asset-source.file.asset-list.action.show-usage.title"),onClick:M,icon:lp.xPt}),(0,oZ.jsx)(oK.zx,{fontSize:1,tone:"critical",mode:"ghost",text:E("asset-source.file.asset-list.action.delete.title"),icon:lp.XHJ,disabled:x,title:E(x?"asset-source.file.asset-list.action.delete.disabled-cannot-delete-current-file":"asset-source.file.asset-list.action.delete.title"),onClick:P})]})]}),R||F]}):(0,oZ.jsxs)(Mb,{asset:h,paddingBottom:1,style:Mk,radius:0,overflow:"hidden",isSelected:x,"aria-selected":"true",children:[(0,oZ.jsxs)(oK.rj,{columns:4,gap:1,"data-id":b,paddingY:1,style:{position:"relative",gridTemplateColumns:"3fr 1fr 1fr 2fr 30px",opacity:c?.5:1},children:[(0,oZ.jsx)(Mj,{asset:h,mode:"bleed","data-id":b,onClick:f,padding:0,onKeyPress:m,title:E("asset-source.file.asset-list.item.select-file-tooltip",{filename:y}),isSelected:x,radius:2,children:(0,oZ.jsxs)(My,{gap:2,flex:2,paddingRight:1,align:"center",onClick:f,onKeyPress:m,"data-id":b,children:[(0,oZ.jsx)(oK.Zb,{as:Mv,padding:2,tone:"transparent",radius:2,style:MC,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:2,children:(0,oZ.jsx)(lp.$lS,{})})}),S&&(0,oZ.jsx)(lr.u,{content:y,children:(0,oZ.jsx)(oK.xv,{size:1,align:"left",textOverflow:"ellipsis",style:M_,children:y})}),!S&&(0,oZ.jsx)(oK.xv,{size:1,align:"left",textOverflow:"ellipsis",style:M_,children:y})]})}),(0,oZ.jsx)(My,{align:"center",children:(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:T})}),(0,oZ.jsx)(My,{align:"center",children:(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(Mw,{size:1,muted:!0,textOverflow:"ellipsis",children:_})})}),(0,oZ.jsx)(My,{align:"center",children:(0,oZ.jsx)(oK.xv,{as:"time",size:1,muted:!0,dateTime:k,children:C})}),(0,oZ.jsx)(My,{justify:"flex-end",align:"center",paddingX:1,paddingY:1,style:MT,children:(0,oZ.jsx)(Mp,{border:!1,isSelected:!1,onAction:e=>{"delete"===e.type&&P(),"showUsage"===e.type&&M()}})})]}),R||F]})},ME={paddingLeft:"2.2rem"},MP={gridTemplateColumns:"3fr 1fr 1fr 2fr 30px"};function MO(e){let n=2>(0,oK.d2)(),{assets:r,onClick:i,onKeyPress:a,onDeleteFinished:o,selectedAssets:l,isLoading:s}=e,{t:c}=dV();return(0,oZ.jsxs)(oK.xu,{children:[(0,oZ.jsx)(oK.Zb,{borderBottom:!0,paddingBottom:2,marginBottom:1,children:n?(0,oZ.jsx)(oK.rj,{style:MP,children:(0,oZ.jsx)(oK.xu,{flex:2,paddingLeft:5,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:c("asset-source.file.asset-list.header.filename")}
1)})}):(0,oZ.jsxs)(oK.rj,{gap:1,style:MP,children:[(0,oZ.jsx)(oK.xu,{flex:2,style:ME,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:c("asset-source.file.asset-list.header.filename")})}),(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:c("asset-source.file.asset-list.header.size")})}),(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:c("asset-source.file.asset-list.header.type")})}),(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:c("asset-source.file.asset-list.header.date-added")})})]})}),(0,oZ.jsxs)(oK.Kq,{children:[s&&0===r.length&&(0,oZ.jsx)(oK.xu,{paddingTop:4,paddingBottom:2,children:(0,oZ.jsx)(oK.kC,{justify:"center",children:(0,oZ.jsx)(oK.$j,{muted:!0})})}),r.map(e=>(0,oZ.jsx)(MS,{asset:e,isMobile:n,isSelected:l.some(n=>n._id===e._id),onClick:i,onKeyPress:a,onDeleteFinished:o},e._id))]})]})}var MA=Object.freeze,MI=Object.defineProperty,Mz=(e,n)=>MA(MI(e,"raw",{value:MA(n||e.slice())}));let MM="undefined"!=typeof window&&window.devicePixelRatio?Math.round(window.devicePixelRatio):1,MR=oV.ZP.img(rQ||(rQ=Mz(["\n  position: absolute;\n  z-index: 1;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  display: block;\n  object-fit: contain;\n"]))),MF=(0,oV.ZP)(oK.Zb)(r0||(r0=Mz(["\n  position: relative;\n  z-index: 1;\n  padding-bottom: 100%;\n"]))),MD=oV.ZP.div(r1||(r1=Mz(["\n  position: relative;\n  display: inherit;\n"]))),Mq=oV.ZP.div(r2||(r2=Mz(["\n  box-sizing: border-box;\n  position: absolute;\n  z-index: 2;\n  top: 3px;\n  right: 3px;\n\n  & button[data-selected] {\n    display: block;\n  }\n\n  @media (hover: hover) {\n    // If hover is supported, hide the buttons until the user hovers or focuses the asset\n    // Use opacity to enable the buttons to still be focusable\n    & button {\n      opacity: 0;\n    }\n\n    ",":hover & {\n      button {\n        opacity: 1;\n      }\n    }\n\n    ",":focus-within & {\n      button {\n        opacity: 1;\n      }\n    }\n  }\n"])),MD,MD),MZ=oN.memo(function(e){let n=hN(h$),r=(0,oK.pm)(),i=(0,oN.useRef)(),{asset:a,onClick:o,onKeyPress:l,onDeleteFinished:s,isSelected:c}=e,[d,u]=(0,oN.useState)(!1),[p,h]=(0,oN.useState)(!1),[f,m]=(0,oN.useState)(!1),{t:g}=dV();(0,oN.useEffect)(()=>()=>{i.current&&i.current.unsubscribe()},[]);let x=(0,oN.useCallback)(()=>{h(!0)},[h]),v=(0,oN.useCallback)(()=>{u(!1),h(!1)},[u,h]),y=(0,oN.useCallback)(()=>{u(!0)},[u]),b=(0,oN.useCallback)(e=>{r.push({closable:!0,status:"error",title:g("asset-source.image.asset-list.delete-failed"),description:e.message})},[g,r]),j=(0,oN.useCallback)(()=>{r.push({status:"success",title:g("asset-source.image.asset-list.delete-successful")})},[g,r]),w=(0,oN.useCallback)(()=>{m(!0),i.current=n.observable.delete(a._id).subscribe({next:()=>{m(!1),s(a._id),h(!1),j()},error:e=>{m(!1),b(e),console.error("Could not delete asset",e)}})},[a._id,b,j,s,n.observable]),k=(0,oN.useCallback)(e=>{"delete"===e.type&&x(),"showUsage"===e.type&&y()},[x,y]),C=(0,oN.useMemo)(()=>d&&(0,oZ.jsx)(Mf,{assetType:"file",asset:a,onClose:v}),[a,v,d]),_=(0,oN.useMemo)(()=>p&&(0,oZ.jsx)(Md,{assetType:"file",asset:a,onClose:v,onDelete:w,isDeleting:f}),[a,w,v,f,p]),{originalFilename:T,_id:S,url:E}=a,P=200*Math.max(1,MM),O=E.includes(".gif")?"".concat(E,"?h=").concat(P,"&fit=max&fm=jpg"):"".concat(E,"?h=").concat(P,"&fit=max");return(0,oZ.jsxs)(MD,{children:[(0,oZ.jsx)(oK.zx,{selected:c,tabIndex:0,"data-id":S,mode:"ghost",onKeyPress:l,padding:0,style:{padding:2},children:(0,oZ.jsxs)(MF,{__unstable_checkered:!0,children:[(0,oZ.jsx)(MR,{alt:T,src:O,onClick:o,"data-id":S}),f&&(0,oZ.jsx)(u4,{})]})}),(0,oZ.jsx)(Mq,{children:(0,oZ.jsx)(Mp,{isSelected:c,onAction:k})}),C||_]})});var MN=Object.freeze,ML=Object.defineProperty;let MV=(0,oV.ZP)(oK.rj)(r3||(r3=MN(ML(et=["\n  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));\n"],"raw",{value:MN(et.slice())}))));function MK(e){let{isLoading:n,assets:r,selectedAssets:i,onItemClick:a,onItemKeyPress:o,onDeleteFinished:l}=e;return(0,oZ.jsxs)(oK.xu,{padding:4,children:[(0,oZ.jsx)(MV,{gap:2,children:r.map(e=>(0,oZ.jsx)(MZ,{asset:e,isSelected:i.some(n=>n._id===e._id),onClick:a,onKeyPress:o,onDeleteFinished:l},e._id))}),n&&0===r.length&&(0,oZ.jsx)(oK.kC,{justify:"center",children:(0,oZ.jsx)(oK.$j,{muted:!0}
1)}),!n&&0===r.length&&(0,oZ.jsx)(oK.xv,{align:"center",muted:!0})]})}var MB=Object.freeze,MU=Object.defineProperty;let MH="sanity.imageAsset",M$=e=>{let n=["image/*","audio/*","video/*"],r=e.split(",").map(e=>e.trim()).reduce((e,r)=>n.includes(r)?{...e,wildcards:"mimeType match '".concat(r,"' || ").concat(e.wildcards)}:0===r.indexOf(".")?{...e,extensions:"'".concat(r.replace(".",""),"', ").concat(e.extensions)}:{...e,mimes:"'".concat(r,"', ").concat(e.mimes)},{mimes:"",extensions:"",wildcards:""});return"&&\n  (\n    ".concat(r.wildcards,"\n    extension in [").concat(r.extensions,"] ||\n    mimeType in [").concat(r.mimes,"]\n  )")},MW=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:MH,i=arguments.length>3?arguments[3]:void 0,a=i.length>0?M$(i):"";return'\n  *[_type == "'.concat(r,'" ').concat(a,"] | order(_updatedAt desc) [").concat(e,"...").concat(n,"] {\n    _id,\n    _updatedAt,\n    _createdAt,\n    url,\n    originalFilename,\n    mimeType,\n    extension,\n    size,\n    metadata {dimensions}\n  }\n")},MY=(0,oV.ZP)(oK.Zb)(r4||(r4=MB(MU(en=["\n  border-top: 1px solid var(--card-border-color);\n  position: sticky;\n  bottom: 0;\n  z-index: 200;\n"],"raw",{value:MB(en.slice())})))),MX=oN.memo(oN.forwardRef(function(e,n){let r=hN(h$),i=(0,oN.useMemo)(()=>r.withConfig({apiVersion:"2023-02-14"}),[r]),a=(0,oN.useRef)("default-asset-source-".concat(sy()())),o=(0,oN.useRef)(0),{t:l}=dV(),s=(0,oN.useRef)(),[c,d]=(0,oN.useState)([]),[u,p]=(0,oN.useState)(!1),[h,f]=(0,oN.useState)(!1),[m,g]=(0,oN.useState)(!0),{selectedAssets:x,assetType:v="image",dialogHeaderTitle:y,onClose:b,onSelect:j,accept:w}=e,k=w&&"image/*"===w&&"image"===v,C=(0,oN.useCallback)(e=>{let n=200*e,r="image"===v,a=r?MH:"sanity.fileAsset";g(!0),void 0!==w&&(s.current=i.observable.fetch(MW(n,n+200,a,w),{},{tag:r?"asset.image-list":"asset.file-list"}).subscribe(e=>{p(e.length<200),d(n=>n.concat(e)),g(!1)}))},[v,w,i]),_=(0,oN.useCallback)(e=>{d(n=>n.filter(n=>n._id!==e))},[d]),T=(0,oN.useCallback)(e=>{c.find(n=>n._id===e)&&j([{kind:"assetDocumentId",value:e}])},[c,j]),S=(0,oN.useCallback)(e=>{e.preventDefault();let n=e.currentTarget.getAttribute("data-id");if(!n)throw Error("Missing data-id attribute on item");T(n)},[T]),E=(0,oN.useCallback)(e=>{if("Enter"===e.key){e.preventDefault();let n=e.currentTarget.getAttribute("data-id");if(!n)throw Error("Missing data-id attribute on item");T(n)}},[T]),P=(0,oN.useCallback)(()=>{b&&b()},[b]),O=(0,oN.useCallback)(e=>{e.preventDefault(),C(++o.current)},[C]);(0,oN.useEffect)(()=>(C(o.current),()=>{s.current&&s.current.unsubscribe()}),[C]),(0,oN.useEffect)(()=>{m||o.current&&0!==o.current||f(!0)},[m]);let A=u_({style:"narrow"});return(0,oZ.jsx)(lr.Vq,{__unstable_autoFocus:h,header:y||l("asset-source.dialog.default-title",{context:v}),id:a.current,onClickOutside:P,onClose:P,ref:n,width:2,children:(0,oZ.jsxs)(oK.Kq,{space:5,children:[!k&&!m&&(null==w?void 0:w.length)>0&&(0,oZ.jsx)(oK.Zb,{tone:"primary",padding:3,border:!0,radius:2,children:(0,oZ.jsxs)(oK.kC,{gap:3,align:"center",children:[(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(lp.hQ6,{})}),(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(uz,{t:l,i18nKey:"asset-source.dialog.accept-message",values:{acceptTypes:A.format(w.split(",").map(e=>e.trim()))}})})]})}),"file"===v&&(0,oZ.jsx)(MO,{assets:c,onDeleteFinished:_,onClick:S,onKeyPress:E,isLoading:m,selectedAssets:x}),"image"===v&&(0,oZ.jsx)(MK,{assets:c,onDeleteFinished:_,onItemClick:S,onItemKeyPress:E,isLoading:m,selectedAssets:x}),c.length>0&&!u&&(0,oZ.jsx)(MY,{tone:"default",padding:4,children:(0,oZ.jsx)(oK.kC,{direction:"column",children:(0,oZ.jsx)(lr.zx,{type:"button",icon:lp._8t,loading:m,onClick:O,size:"large",text:l("asset-source.dialog.load-more"),tone:"primary"})})})]})})})),MG={name:"sanity-default",title:"Uploaded files",i18nKey:"asset-source.file.title",component:MX,icon:lp.TAM},MJ={name:"sanity-default",title:"Uploaded images",i18nKey:"asset-source.image.title",component:MX,icon:lp.XBm},MQ=[{fieldPath:"_updatedAt",icon:lp.Que,operators:[{name:"dateTimeLast",type:"item"},{type:"divider"},{name:"dateTimeRange",type:"item"},{name:"dateTimeAfter",type:"item"},{name:"dateTimeBefore",type:"item"},{type:"divider"},{name:"dateTimeEqual",type:"item"},{name:"dateTimeNotEqual",type:"item"}],title:"Edited at",name:"updatedAt",type:"pinned"},{fieldPath:"_createdAt",icon:lp.Que,operators:[{name:"dateTimeLast",type:"item"},{type:"divider"},{name:"dateTimeRange",type:"item"},{name:"dateTimeAfter",type:"item"},{name:"dateTimeBefore",type:"item"},{type:"divider"},{name:"dateTimeEqual",type:"item"},{name:"dateTimeNotEqual",type:"item"}],title:"Created at",name:"createdAt",type:"pinned"},{icon:lp.xPt,operators:[{name:"referencesDocument",type:"item"},{name:"referencesAssetImage",type:"item"},{name:"referencesAssetFile",type:"item"}],title:"Contains document, image or file",name:"references",type:"pinned"},{fieldType:"array",icon:lp.AEM,name:"array",operators:[{name:"defined",type:"item"},{name:"notDefined",type:"item"},{type:"divider"},{name:"arrayCountEqual",type:"item"},{name:"arrayCountNotEqual",type:"item"},{type:"divider"},{name:"arrayCountGt",type:"item"},{name:"arrayCountGte",type:"item"},{name:"arrayCountLt",type:"item"},{name:"arrayCountLte",type:"item"},{type:"divider"},{name:"arrayCountRange",type:"item"}],type:"field"},{fieldType:"array",icon:lp.AEM,name:"arrayList",operators:[{name:"arrayListIncludes",type:"item"},{name:"arrayListNotIncludes",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"},{type:"divider"},{name:"arrayCountEqual",type:"item"},{name:"arrayCountNotEqual",type:"item"},{type:"divider"},{name:"arrayCountGt",type:"item"},{name:"arrayCountGte",type:"item"},{name:"arrayCountLt",type:"item"},{name:"arrayCountLte",type:"item"},{type:"divider"},{name:"arrayCountRange",type:"item"}],type:"field"},{fieldType:"array",icon:lp.AEM,name:"arrayReferences",operators:[{name:"arrayReferenceIncludes",type:"item"},{name:"arrayReferenceNotIncludes",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"},{type:"divider"},{name:"arrayCountEqual",type:"item"},{name:"arrayCountNotEqual",type:"item"},{type:"divider"},{name:"arrayCountGt",type:"item"},{name:"arrayCountGte",type:"item"},{name:"arrayCountLt",type:"item"},{name:"arrayCountLte",type:"item"},{type:"divider"},{name:"arrayCountRange",type:"item"}],type:"field"},{fieldType:"boolean",icon:lp.nSX,name:"boolean",operators:[{name:"booleanEqual",type:"item"},{type:"divider"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"date",icon:lp.Que,name:"date",operators:[{name:"dateLast",type:"item"},{type:"divider"},{name:"dateRange",type:"item"},{name:"dateAfter",type:"item"},{name:"dateBefore",type:"item"},{type:"divider"},{name:"dateEqual",type:"item"},{name:"dateNotEqual",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"datetime",icon:lp.Que,name:"datetime",operators:[{name:"dateTimeLast",type:"item"},{type:"divider"},{name:"dateTimeRange",type:"item"},{name:"dateTimeAfter",type:"item"},{name:"dateTimeBefore",type:"item"},{type:"divider"},{name:"dateTimeEqual",type:"item"},{name:"dateTimeNotEqual",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"email",icon:lp.Rhe,name:"email",operators:[{name:"stringMatches",type:"item"},{name:"stringNotMatches",type:"item"},{type:"divider"},{name:"stringEqual",type:"item"},{name:"stringNotEqual",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"file",icon:lp.$lS,name:"file",operators:[{name:"assetFileEqual",type:"item"},{name:"assetFileNotEqual",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"image",icon:lp.XBm,name:"image",operators:[{name:"assetImageEqual",type:"item"},{name:"assetImageNotEqual",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"number",icon:lp.yEv,name:"number",operators:[{name:"numberEqual",type:"item"},{name:"numberNotEqual",type:"item"},{type:"divider"},{name:"numberGt",type:"item"},{name:"numberGte",type:"item"},{name:"numberLt",type:"item"},{name:"numberLte",type:"item"},{type:"divider"},{name:"numberRange",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"array",icon:lp.aI,name:"portableText",operators:[{name:"portableTextMatches",type:"item"},{name:"portableTextNotMatches",type:"item"},{type:"divider"},{name:"portableTextEqual",type:"item"},{name:"portableTextNotEqual",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"reference",icon:lp.xPt,name:"reference",operators:[{name:"referenceEqual",type:"item"},{name:"referenceNotEqual",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"slug",icon:lp.Rhe,name:"slug",operators:[{name:"slugMatches",type:"item"},{name:"slugNotMatches",type:"item"},{type:"divider"},{name:"slugEqual",type:"item"},{name:"slugNotEqual",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"string",icon:lp.Rhe,name:"string",operators:[{name:"stringMatches",type:"item"},{name:"stringNotMatches",type:"item"},{type:"divider"},{name:"stringEqual",type:"item"},{name:"stringNotEqual",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"string",icon:lp.v4q,name:"stringList",operators:[{name:"stringListEqual",type:"item"},{name:"stringListNotEqual",type:"item"},{type:"divider"},{name:"stringMatches",type:"item"},{name:"stringNotMatches",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"text",icon:lp.Rhe,name:"text",operators:[{name:"stringMatches",type:"item"},{name:"stringNotMatches",type:"item"},{type:"divider"},{name:"stringEqual",type:"item"},{name:"stringNotEqual",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"},{fieldType:"url",icon:lp.Rhe,name:"url",operators:[{name:"stringMatches",type:"item"},{name:"stringNotMatches",type:"item"},{type:"divider"},{name:"stringEqual",type:"item"},{name:"stringNotEqual",type:"item"},{type:"divider"},{name:"defined",type:"item"},{name:"notDefined",type:"item"}],type:"field"}];function M0(e){let{documentId:n,schemaType:r}
1=e,i=z8(),{draft:a,published:o,isLoading:l}=(0,oR.m2)(()=>AE(i,r,n,""),[n,i,r]),s=AO({draft:a,published:o,value:(0,oN.useMemo)(()=>({_id:n,_type:r.name}),[n,r.name])});return l?(0,oZ.jsx)(oK.Od,{animated:!0,marginLeft:1,radius:2,style:{width:"10ch",height:"1em"}}):(0,oZ.jsx)(oZ.Fragment,{children:s.title||n.slice(0,8)})}function M1(e){let{value:n}=e,r=hU({dateStyle:"medium",timeStyle:n.includeTime?"short":void 0}),i=(null==n?void 0:n.date)?new Date(n.date):null;return i&&(0,st.Z)(i)?(0,oZ.jsx)(oZ.Fragment,{children:r.format(i)}):null}function M2(e){let{value:n}=e,r=hU({dateStyle:"medium",timeStyle:n.includeTime?"short":void 0}),i=(null==n?void 0:n.from)?new Date(n.from):null,a=(null==n?void 0:n.to)?new Date(n.to):null;if(!a||!i||!(0,st.Z)(a)||!(0,st.Z)(i))return null;let o=r.format(i),l=r.format(a);return(0,oZ.jsx)(oZ.Fragment,{children:"".concat(o," → ").concat(l)})}function M3(e){let{value:n}=e,r=h1(),i=n._ref,a=r.get(n._type);return a?(0,oZ.jsx)(M0,{documentId:i,schemaType:a}):null}let M4=(0,oN.createContext)(void 0);function M5(){let e=(0,oN.useContext)(M4);if(void 0===e)throw Error("useSearchState must be used within an SearchProvider");return e}function M8(e){let{value:n,onChange:r}=e,[i,a]=(0,oN.useState)(null!=n?n:""),{state:{fullscreen:o}}=M5(),{t:l}=dV(),s=(0,oN.useCallback)(e=>{a(e.currentTarget.value);let n=parseFloat(e.currentTarget.value);r(Number.isFinite(n)?n:null)},[r]);return(0,oZ.jsx)(oK.oi,{fontSize:o?2:1,onChange:s,placeholder:l("search.filter-number-value-placeholder"),radius:2,step:"any",type:"number",value:i})}function M6(e){var n,r;let{onChange:i,value:a}=e,[o,l]=(0,oN.useState)(null!=(n=null==a?void 0:a.to)?n:""),[s,c]=(0,oN.useState)(null!=(r=null==a?void 0:a.from)?r:""),{state:{fullscreen:d}}=M5(),{t:u}=dV(),p=(0,oN.useCallback)(e=>{var n;l(e.currentTarget.value);let r=parseFloat(e.currentTarget.value);i({to:Number.isFinite(r)?r:null,from:null!=(n=null==a?void 0:a.from)?n:null})},[null==a?void 0:a.from,i]),h=(0,oN.useCallback)(e=>{var n;c(e.currentTarget.value);let r=parseFloat(e.currentTarget.value);i({to:null!=(n=null==a?void 0:a.to)?n:null,from:Number.isFinite(r)?r:null})},[null==a?void 0:a.to,i]);return(0,oZ.jsxs)(oK.kC,{gap:2,children:[(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.oi,{fontSize:d?2:1,onChange:h,placeholder:u("search.filter-number-min-value-placeholder"),radius:2,step:"any",type:"number",value:s})}),(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.oi,{fontSize:d?2:1,onChange:p,placeholder:u("search.filter-number-max-value-placeholder"),radius:2,step:"any",type:"number",value:o})})]})}function M9(e,n){let r=n.split("."),i=r[0];if(i&&(0,ll.m$)(e)){let n=e.fields.find(e=>e.name===i);if(n){let e=r.slice(1).join(".");return e?M9(n.type,e):n}}}var M7=Object.freeze,Re=Object.defineProperty;let Rt=(0,oV.ZP)(oK.xu)(r5||(r5=M7(Re(er=["\n  @supports (-webkit-overflow-scrolling: touch) {\n    * [data-ui='Box'] {\n      background-attachment: scroll;\n    }\n  }\n"],"raw",{value:M7(er.slice())}))));function Rn(e){let{documentId:n,layout:r,presence:i,schemaType:a}=e,o=z8(),{draft:l,published:s,isLoading:c}=(0,oR.m2)(()=>AE(o,a,n,""),[n,o,a]),d=(0,oN.useMemo)(()=>({_id:n,_type:a.name}),[n,a.name]),u=(0,oN.useMemo)(()=>c?null:(0,oZ.jsxs)(oK.kC,{align:"center",gap:3,children:[i&&i.length>0&&(0,oZ.jsx)(yr,{presence:i}),(0,oZ.jsx)(oK.Ct,{children:a.title}),(0,oZ.jsx)(jo,{draft:l,published:s})]}),[l,c,i,s,a.title]),p=(0,oZ.jsx)(jn,{draft:l,published:s});return(0,oZ.jsx)(Rt,{children:(0,oZ.jsx)(h8,{...AO({draft:l,published:s,value:d}),isPlaceholder:null==c||c,layout:r||"default",icon:a.icon,status:u,tooltip:p})})}function Rr(e){let{disableIntentLink:n,documentId:r,documentType:i,layout:a,onClick:o,...l}=e,s=h1().get(i),c=Mt(r),d=(0,oN.useMemo)(()=>({id:r,type:null==s?void 0:s.name}),[r,null==s?void 0:s.name]),{onClick:u,href:p}=(0,lm.PM)({intent:"edit",params:d}),h=(0,oN.useCallback)(e=>{n||u(e),null==o||o()},[n,o,u]);return s?(0,oZ.jsx)(oK.xu,{...l,children:(0,oZ.jsx)(uY,{as:"a","data-as":"a",flex:1,href:n?void 0:p,onClick:h,radius:2,tabIndex:-1,children:(0,oZ.jsx)(Rn,{documentId:r,layout:a,presence:c,schemaType:s})})}):null}let Ri="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)?"Cmd":"Ctrl",Ra=oK.Lg.space[4];function Ro(e){let{allowEmptyQueries:n,terms:r}=e,i=!!n||r.query.length>0,a=!!r.filter,o=r.types.length>0;return i||a||o}function Rl(e){return fp(e).filter(e=>!1!==e.__experimental_omnisearch_visibility)}function Rs(e,n){var r,i;return(null!=(r=e.title)?r:e.name).localeCompare(null!=(i=n.title)?i:n.name)}let Rc={error:null,hits:[],loading:!1,terms:{query:"",types:[]}};function Rd(e){return null!==e}function Ru(e){var n;return{...e,terms:{...e.terms,filter:null==(n=e.terms.filter)?void 0:n.trim(),query:e.terms.query.trim()}}}function Rp(e){let{allowEmptyQueries:n,initialState:r,onComplete:i,onError:a,onStart:
1o,schema:l}=e,[s,c]=(0,oN.useState)(r),d=hN(h$),u=Si(),p=(0,oN.useMemo)(()=>fk(fC(Rl(l),u),d,{tag:"search.global",unique:!0}),[d,l,u]),h=(0,oR.W2)(e=>e.pipe((0,a2.h)(Rd),(0,aW.U)(Ru),(0,aX.x)(o7()),(0,om.D)(e=>(0,oT.H)((null==e?void 0:e.debounceTime)||300)),(0,a4.b)(o),(0,a$.w)(e=>(0,ox.z)((0,og.of)({...Rc,loading:!0,options:e.options,terms:e.terms}),(0,oM.s)(()=>Ro({allowEmptyQueries:n,terms:e.terms}),p(e.terms,e.options).pipe((0,aW.U)(e=>({hits:e})),(0,a4.b)(e=>{let{hits:n}=e;return null==i?void 0:i(n)}),(0,aG.K)(n=>(null==a||a(n),(0,og.of)({...Rc,error:n,loading:!1,options:e.options,terms:e.terms})))),(0,og.of)(ov.E).pipe((0,a4.b)(()=>null==i?void 0:i([])))),(0,og.of)({loading:!1}))),(0,aY.R)((e,n)=>({...e,...n}),Rc),(0,a4.b)(c)),[n,p]);return{handleSearch:(0,oN.useCallback)(e=>h(e),[h]),searchState:s}}function Rh(e){let n,{availableCharacters:r=40,types:i}=e;if(0===i.length)return{remainingCount:0,types:[]};let a=i.reduce((n=r,function(e,i,a){let o=Rm(i);return n-=o.length,0===a?e.push(i):r>o.length&&n>o.length&&e.push(i),e}),[]);return{remainingCount:i.length-a.length,types:a.map(Rm)}}function Rf(e){let{t:n,availableCharacters:r,types:i}=e;if(0===i.length)return n("search.document-type-list-all-types");let{remainingCount:a,types:o}=Rh({availableCharacters:r,types:i});return n(a>0?"search.document-type-list-truncated":"search.document-type-list",{count:a,types:o,formatParams:{types:{style:"short",type:"unit"}}})}function Rm(e){var n;return null!=(n=e.title)?n:e.name}var Rg=Object.freeze,Rx=Object.defineProperty;let Rv=()=>!0,Ry=(0,oV.ZP)(oK.xv)(r8||(r8=Rg(Rx(ei=["\n  word-break: break-word;\n"],"raw",{value:Rg(ei.slice())})))),Rb=(0,oN.forwardRef)(function(e,n){let{onSelect:r,types:i=[],value:a}=e,o=(0,oN.useRef)(null),l=h1(),{state:{fullscreen:s}}=M5(),{t:c}=dV(),d=(0,oN.useId)(),[u,p]=(0,oN.useState)([]),{handleSearch:h,searchState:f}=Rp({allowEmptyQueries:!0,initialState:{hits:[],loading:!1,error:null,terms:{query:"",types:i}},onComplete:e=>{p(e.map(e=>({hit:e,value:e.hit._id})))},schema:l}),m=(0,oN.useCallback)(()=>{h({debounceTime:0,options:{limit:100},terms:{query:"",types:i}})},[h,i]),g=(0,oN.useCallback)(e=>{e?h({options:{limit:100},terms:{query:e||"",types:i}}):h({debounceTime:0,options:{limit:0},terms:{query:"",types:i}})},[h,i]),x=(0,oN.useCallback)(e=>{var n;let i=null==(n=u.find(n=>n.value===e))?void 0:n.hit.hit;i&&(null==r||r({_ref:dm(i._id),_type:i._type}))},[u,r]),v=(0,oN.useMemo)(()=>{if(0===i.length)return c("search.action.search-all-types");let{remainingCount:e,types:n}=Rh({types:i});return c(e>0?"search.action.search-specific-types-truncated":"search.action.search-specific-types",{count:e,types:n,formatParams:{types:{style:"short",type:"unit"}}})},[i,c]),y=(0,oN.useCallback)(e=>{let n=e.hit.hit._type;return(0,oZ.jsx)(Rr,{disableIntentLink:!0,documentId:e.value,documentType:n,layout:"compact"})},[]),b=(0,oN.useCallback)((e,n)=>{let{content:r,hidden:i,onMouseEnter:a,onMouseLeave:l}=e,s=u&&u.length>0;return(0,oZ.jsx)(lr.J2,{constrainSize:!0,content:(0,oZ.jsx)("div",{ref:n,children:s?r:f.terms.query&&(0,oZ.jsx)(oK.xu,{padding:4,children:(0,oZ.jsx)(oK.kC,{align:"center",height:"fill",justify:"center",children:(0,oZ.jsx)(Ry,{align:"center",muted:!0,children:(0,oZ.jsx)(uz,{t:c,i18nKey:"new-document.no-results",values:{searchQuery:f.terms.query}})})})})}),fallbackPlacements:["bottom","bottom-end"],matchReferenceWidth:!0,onMouseEnter:a,onMouseLeave:l,open:!f.loading&&!i,overflow:"auto",placement:"bottom-start",radius:3,referenceElement:o.current})},[u,f.loading,f.terms.query,c]);return(0,oZ.jsx)("div",{ref:o,children:(0,oZ.jsx)(oK.F2,{"aria-label":v,filterOption:Rv,fontSize:s?2:1,id:d,loading:f.loading,openButton:{onClick:m},options:u,onQueryChange:g,onSelect:x,placeholder:v,radius:2,ref:n,renderOption:y,renderPopover:b,value:null==a?void 0:a._ref})})});function Rj(e){let{fieldDefinition:n,onChange:r,value:i}=e,{onClose:a,state:{documentTypesNarrowed:o}}=M5(),l=h1(),{t:s}=dV(),c=(0,oN.useCallback)(e=>r(e),[r]),d=(0,oN.useMemo)(()=>n?n.documentTypes.filter(e=>o.includes(e)).flatMap(e=>{let r=l.get(e);if(r){let e=M9(r,n.fieldPath);if((0,ll.jB)(null==e?void 0:e.type))return null==e?void 0:e.type.of.filter(ll.dD).flatMap(e=>e.to);if((0,ll.dD)(null==e?void 0:e.type))return null==e?void 0:e.type.to}return[]}).reduce((e,n)=>(0>e.findIndex(e=>e.name===(null==n?void 0:n.name))&&e.push(n),e),[]):[],[o,n,l]),u=(0,oN.useCallback)(()=>c(null),[c]),p=(0,oN.useCallback)(()=>{null==a||a()},[a]);return(0,oZ.jsx)(oK.xu,{style:{width:"min(calc(100vw - 40px), 420px)"},children:(null==i?void 0:i._ref)&&(null==i?void 0:i._type)?(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.Zb,{padding:1,radius:1,shadow:1,children:(0,oZ.jsx)(Rr,{documentId:i._ref,documentType:i._type,layout:"compact",onClick:p})}),(0,oZ.jsx)(lr.zx,{mode:"ghost",onClick:u,text:s("search.filter-reference-clear"),tone:"critical"})]}):(0,oZ.jsx)(Rb,{onSelect:c,types:d,value:i})})}function Rw(e){let{onClick:n,selected:r,title:i,value:a}=e,o=(0,oN.useCallback)(()=>n(a),[n,a]),l="".concat(i);return void 0!==a&&i!==a&&(l+=" (".concat(a,")")),(0,oZ.jsx)(lr.sN,{onClick:o,pressed:r,tone:"default",text:l})}function Rk(e){let{fieldDefinition:n,onChange:r,value:i}=e,a=(0,oN.useId)(),{state:{documentTypesNarrowed:o}}=M5(),{t:l}=dV(),s=h1(),c=(0,oN.useMemo)(()=>n?n.documentTypes.filter(e=>o.includes(e)).map(e=>{let r=s.get(e);if(r){let e=M9(r,n.fieldPath);return null==e?void 0:e.type.options}return null}).filter(dd).map(e=>e.list).flatMap(e=>null==e?void 0:e.map(e=>(0,ll.n4)(e)?e:{title:s6()("".concat(e)),value:e})).filter(dd).reduce((e,n)=>{let r=e.findIndex(e=>e.value===(null==n?void 0:n.value));if(r>-1){let i=e[r];e[r]={...e[r],title:sz()([...i.title,n.title]).sort()}}else e.push({...n,title:[n.title]});return e},[]):[],[o,n,s]),d=(0,oN.useCallback)(e=>{r(e)},[r]);return(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(lr.zx,{mode:"ghost",iconRight:lp.v4q,text:i?String(i):l("search.filter-string-value-select-predefined-value")}),id:a||"",menu:(0,oZ.jsx)(oK.v2,{children:c.map((e,n)=>(0,oZ.jsx)(Rw,{onClick:d,selected:e.value===i,title:e.title.join(", "),value:e.value||""},n))}),popover:{constrainSize:!0,placement:"bottom-start",portal:!1,radius:2}})}let RC=()=>(0,oZ.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,oZ.jsx)("path",{d:"M7.04 19V17.512H17.36V19H7.04ZM7.04 15.328V13.624L12.08 11.872L15.32 10.816V10.72L12.08 9.664L7.04 7.912V6.208L17.36 9.88V11.656L7.04 15.328Z",fill:"currentColor"})}),R_=()=>(0,oZ.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,oZ.jsx)("path",{d:"M7.568 18.848V16.952L14.792 12.08V11.984L7.568 7.112V5.216L16.52 11.288V12.776L7.568 18.848Z",fill:"currentColor"})}
1),RT=()=>(0,oZ.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,oZ.jsx)("path",{d:"M7.04 19V17.512H17.36V19H7.04ZM17.36 15.328L7.04 11.656V9.88L17.36 6.208V7.912L12.32 9.664L9.08 10.72V10.816L12.32 11.872L17.36 13.624V15.328Z",fill:"currentColor"})}),RS=()=>(0,oZ.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,oZ.jsx)("path",{d:"M16.952 19.632L8 13.56V12.072L16.952 6V7.896L9.728 12.768V12.864L16.952 17.736V19.632Z",fill:"currentColor"})});function RE(e){return JSON.stringify(e)}let RP=(0,oN.createContext)(null);function RO(e){let{children:n,...r}=e,i=(0,oN.useContext)(RP),{unstable_sources:a}=St();if("source"in r){let{source:e}=r;return(0,oZ.jsx)(RP.Provider,{value:e,children:n})}if("name"in r){let{name:e}=r,o=a.find(n=>n.name===e);if(!o)throw Error("Could not find source with name `".concat(e,"` in current workspace"));return i===o?(0,oZ.jsx)(oZ.Fragment,{children:n}):(0,oZ.jsx)(RP.Provider,{value:o,children:n})}throw Error("Invalid props passed into SourceProvider. A `name` or a `source` object is required.")}function RA(){let e=(0,oN.useContext)(RP);if(!e)throw Error("Could not find `source` context");return e}function RI(e){let{t:n}=dV();return(0,oZ.jsx)(oK.xu,{...e,children:(0,oZ.jsxs)(oK.kC,{align:"flex-start",gap:3,children:[(0,oZ.jsx)(LT,{tone:"caution",children:(0,oZ.jsx)(lp.foC,{})}),(0,oZ.jsxs)(oK.Kq,{space:4,children:[(0,oZ.jsx)(LT,{size:1,tone:"caution",weight:"medium",children:n("search.error.no-valid-asset-source-title")}),(0,oZ.jsx)(LT,{size:1,tone:"caution",children:n("search.error.no-valid-asset-source-only-default-description")}),(0,oZ.jsx)(LT,{size:1,tone:"caution",children:n("search.error.no-valid-asset-source-check-config-description")})]})]})})}function Rz(e){let{reference:n}=e,r=z8(),i=(0,oN.useCallback)(e=>jL(r,e),[r]);return(0,oZ.jsx)(CB,{observeAsset:i,reference:n,waitPlaceholder:(0,oZ.jsx)(RR,{}),children:e=>(0,oZ.jsx)(RM,{asset:e})})}function RM(e){let{asset:n}=e;return(0,oZ.jsx)(oK.Zb,{padding:2,shadow:1,children:(0,oZ.jsxs)(oK.kC,{align:"center",justify:"space-between",wrap:"nowrap",children:[(0,oZ.jsx)(oK.Zb,{padding:3,radius:1,shadow:1,tone:"transparent",children:(0,oZ.jsx)(oK.xv,{children:(0,oZ.jsx)(lp.bg6,{})})}),(0,oZ.jsxs)(oK.Kq,{flex:1,space:2,marginLeft:3,children:[(0,oZ.jsx)(oK.xv,{muted:!0,size:1,textOverflow:"ellipsis",weight:"medium",children:(null==n?void 0:n.originalFilename)||n._id}),(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:_C(n.size)})]})]})})}function RR(){return(0,oZ.jsx)(oK.Zb,{padding:2,shadow:1,children:(0,oZ.jsxs)(oK.kC,{align:"center",justify:"flex-start",children:[(0,oZ.jsx)(oK.Zb,{padding:3,radius:1,shadow:1,tone:"transparent",children:(0,oZ.jsx)(oK.xv,{children:(0,oZ.jsx)(lp.bg6,{})})}),(0,oZ.jsxs)(oK.Kq,{flex:1,space:2,marginLeft:3,children:[(0,oZ.jsx)(oK.Qr,{animated:!0,style:{width:"100%"},radius:1}),(0,oZ.jsx)(oK.Qr,{animated:!0,style:{width:"100%"},radius:1})]})]})})}var RF=Object.freeze,RD=Object.defineProperty,Rq=(e,n)=>RF(RD(e,"raw",{value:RF(n||e.slice())}));let RZ=(0,oV.ZP)(oK.Zb)(r6||(r6=Rq(["\n  position: relative;\n  padding-bottom: 100%;\n"]))),RN=oV.ZP.img(r9||(r9=Rq(["\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  display: block;\n  object-fit: contain;\n"])));function RL(e){let{reference:n}=e,r=z8(),i=(0,oN.useCallback)(e=>jL(r,e),[r]);return(0,oZ.jsx)(CB,{observeAsset:i,reference:n,children:e=>(0,oZ.jsx)(RV,{asset:e})})}function RV(e){let{asset:n}=e,[r,i]=(0,oN.useState)(!1),a="".concat(n.url,"?h=800&fit=max"),o=(0,oN.useCallback)(()=>i(!0),[]);return(0,oZ.jsxs)(RZ,{__unstable_checkered:!0,border:!0,children:[!r&&(0,oZ.jsx)(u4,{fill:!0,showText:!0}),(0,oZ.jsx)(RN,{onLoad:o,src:a})]})}function RK(e){let{reference:n}=e;return n?n._type.startsWith("sanity.fileAsset")?(0,oZ.jsx)(Rz,{reference:n}):n._type.startsWith("sanity.imageAsset")?(0,oZ.jsx)(RL,{reference:n}):null:null}var RB=Object.freeze,RU=Object.defineProperty;let RH={file:"sanity.fileAsset",image:"sanity.imageAsset"},R$=(0,oV.ZP)(oK.xu)(r7||(r7=RB(RU(ea=["\n  width: min(calc(100vw - 40px), 320px);\n"],"raw",{value:RB(ea.slice())}))));function RW(e){return function(n){let{onChange:r,value:i}=n,[a,o]=(0,oN.useState)(null),[l,s]=(0,oN.useState)(null);M5();let{file:c,image:d}=RA().form,{t:u}=dV(),p=(0,oN.useMemo)(()=>{switch(e){case"file":return c.assetSources.filter(e=>e.name===MG.name);case"image":return d.assetSources.filter(e=>e.name===MJ.name);default:throw Error("Unknown asset source found")}},[c.assetSources,d.assetSources]),h=(0,oN.useId)(),f=hN(h$),m=(0,oN.useCallback)(()=>{s(null),r(null)},[r]),g=(0,oN.useCallback)(()=>{o(null)},[]),x=(0,oN.useCallback)(e=>{s(e[0]),g()},[g]),v=(0,oN.useCallback)(e=>o(e),[]);(0,oN.useEffect)(()=>{(null==l?void 0:l.kind)==="assetDocumentId"&&"string"==typeof(null==l?void 0:l.value)&&e&&r({_ref:l.value,_type:RH[e]})},[f,r,l]);let y=null==a?void 0:a.component,b=u(i?"search.filter-asset-change":"search.filter-asset-select",{context:e}),j=lS()(e,"options.accept","image"===e?"image/*":"");return(0,oZ.jsx)(R$,{children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[a&&y&&(0,oZ.jsx)(oK.h_,{children:(0,oZ.jsx)(y,{assetType:e,dialogHeaderTitle:u("search.action.select-asset",{context:e}),onClose:g,onSelect:x,selectedAssets:[],selectionType:"single",accept:j})}),i&&(0,oZ.jsx)(RK,{reference:i}),(0,oZ.jsxs)(oK.kC,{gap:2,children:[0===p.length&&(0,oZ.jsx)(RI,{padding:2}),p.length>0&&(0,oZ.jsx)(oZ.Fragment,{children:p.length>1?(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(lr.zx,{icon:i?lp.UEU:lp.W1M,iconRight:lp.v4q,mode:"ghost",width:i?"fill":void 0,text:b}),id:h,menu:(0,oZ.jsx)(oK.v2,{children:p.map(e=>(0,oZ.jsx)(lr.sN,{icon:e.icon||lp.XBm,onClick:()=>v(e),text:(e.i18nKey?u(e.i18nKey):e.title)||lf()(e.name)},e.name))}),popover:{constrainSize:!0,portal:!1,radius:2}}):(0,oZ.jsx)(lr.zx,{icon:i?lp.UEU:lp.W1M,mode:"ghost",onClick:()=>v(p[0]),width:i?"fill":void 0,text:b})}),i&&(0,oZ.jsx)(lr.zx,{mode:"ghost",onClick:m,width:"fill",text:u("search.filter-asset-clear"),tone:"critical"})]})]})})}}let RY={assetFileEqual:{nameKey:"search.operator.asset-file-equal.name",descriptionKey:"search.operator.asset-file-equal.description",buttonValueComponent:M3,groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r._ref)&&n?"".concat(n,".asset._ref == ").concat(RE(r._ref)):null},initialValue:null,inputComponent:RW("file"),label:"is",type:"assetFileEqual"},assetFileNotEqual:{nameKey:"search.operator.asset-file-not-equal.name",descriptionKey:"search.operator.asset-file-not-equal.description",buttonValueComponent:M3,groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r._ref)&&n?"".concat(n,".asset._ref != ").concat(RE(r._ref)):null},initialValue:null,inputComponent:RW("file"),label:"is not",type:"assetFileNotEqual"},assetImageEqual:{nameKey:"search.operator.asset-image-equal.name",descriptionKey:"search.operator.asset-image-equal.description",buttonValueComponent:M3,groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r._ref)&&n?"".concat(n,".asset._ref == ").concat(RE(r._ref)):null},initialValue:null,inputComponent:RW("image"),label:"is",type:"assetImageEqual"},assetImageNotEqual:{nameKey:"search.operator.asset-image-not-equal.name",descriptionKey:"search.operator.asset-image-not-equal.description",buttonValueComponent:M3,groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r._ref)&&n?"".concat(n,".asset._ref != ").concat(RE(r._ref)):null},initialValue:null,inputComponent:RW("image"),label:"is not",type:"assetImageNotEqual"}};var RX=Object.freeze,RG=Object.defineProperty;let RJ=(0,oV.ZP)(oK.xv)(ie||(ie=RX(RG(eo=["\n  cursor: default;\n"],"raw",{value:RX(eo.slice())}))));function RQ(e){let{onChange:n,value:r}=e,{t:i}=dV();return(0,oZ.jsxs)(oK.kC,{align:"center",gap:2,justify:"flex-end",marginTop:1,children:[(0,oZ.jsx)(oK.Kq,{children:(0,oZ.jsx)(RJ,{muted:!0,onClick:n,size:1,weight:"medium",children:i("calendar.action.include-time-label")})}),(0,oZ.jsx)(oK.rs,{checked:r,label:i("calendar.action.include-time-label"),onChange:n})]})}let R0=(0,oN.createContext)(void 0);function R1(){let e=(0,oN.useContext)(R0);if(void 0===e)throw Error("useCalendar must be used within an CalendarContext.Provider");return e}function R2(e){let{t:n}=dV(),r=hU({month:"long",year:"numeric"}),{focusedDate:i}=R1(),{moveFocusedDate:a,onNowClick:o}=e,l=(0,oN.useCallback)(()=>a(-1),[a]),s=(0,oN.useCallback)(()=>a(1),[a]);return(0,oZ.jsxs)(oK.kC,{align:"center",flex:1,justify:"space-between",children:[(0,oZ.jsx)(oK.gF,{paddingLeft:2,space:1,children:(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:cZ()(r.format(i))})}),(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(lr.zx,{"aria-label":n("calendar.action.go-to-today-aria-label"),mode:"bleed",onClick:o,text:n("calendar.action.go-to-today")}),(0,oZ.jsx)(lr.zx,{icon:lp.wyc,mode:"bleed",onClick:l,tooltipProps:{content:n("calendar.action.go-to-previous-month")}}),(0,oZ.jsx)(lr.zx,{icon:lp.XCv,mode:"bleed",onClick:s,tooltipProps:{content:n("calendar.action.go-to-next-month")}})]})]})}var R3=Object.freeze,R4=Object.defineProperty,R5=(e,n)=>R3(R4(e,"raw",{value:R3(n||e.slice())}));let R8=oV.ZP.svg(e=>{let{theme:n}=e;return(0,oV.iv)(it||(it=R5(["\n    bottom: 0;\n    left: 0;\n    position: absolute;\n    right: 0;\n    top: 0;\n\n    circle {\n      stroke: ",";\n      stroke-width: 3;\n      fill: none;\n    }\n  "])),n.sanity.color.card.enabled.border)}),R6=(0,oV.ZP)(oK.Zb)(ir||(ir=R5(["\n  position: relative;\n\n  &[data-focused='true'] {\n    z-index: 1;\n  }\n\n  &[data-start-date='true'] {\n    border-top-right-radius: 0;\n    border-bottom-right-radius: 0;\n  }\n\n  &[data-end-date='true'] {\n    border-top-left-radius: 0;\n    border-bottom-left-radius: 0;\n  }\n\n  &[data-within-range='true'] {\n    border-radius: 0;\n  }\n"])));function R9(e){let{date:n,onSelect:r}=e,i=(0,oN.useCallback)(()=>{r(n)},[n,r]),{date:a,endDate:o,focusedDate:l,selectRange:s}=R1(),c=a&&(0,l1.Z)(n,a),d=s&&a&&(0,l1.Z)(n,a),u=s&&o&&(0,l1.Z)(n,o),p=(0,l2.Z)(n,l),h=l&&(0,l1.Z)(n,l),f=(0,l1.Z)(n,new Date),m=a&&o&&!d&&!u&&(0,sn.Z)(n,a)&&(0,sr.Z)(n,o);return(0,oZ.jsxs)(R6,{__unstable_focusRing:!0,"aria-label":n.toDateString(),"aria-pressed":c,"data-end-date":!!u||void 0,"data-focused":h?"true":"","data-ui":"CalendarDay","aria-selected":c,"data-start-date":!!d||void 0,"data-within-range":!!m||void 0,forwardedAs:"button",onClick:i,paddingX:3,paddingY:2,radius:2,role:"button",selected:c||d||u,tabIndex:-1,tone:m?"primary":"default",children:[f&&(0,oZ.jsx)(R8,{height:"100%",preserveAspectRatio:"xMidYMid meet",vectorEffect:"non-scaling-stroke",viewBox:"0 0 100 100",width:"100%",children:(0,oZ.jsx)("circle",{cx:"50",cy:"50",r:"40%"})}),(0,oZ.jsx)(oK.xv,{align:"center",muted:!c&&!p,size:1,weight:p?"medium":"regular",children:n.getDate()})]})}let R7=["calendar.weekday-names.short.monday","calendar.weekday-names.short.tuesday","calendar.weekday-names.short.wednesday","calendar.weekday-names.short.thursday","calendar.weekday-names.short.friday","calendar.weekday-names.short.saturday","calendar.weekday-names.short.sunday"];co()(0,24);let Fe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Ft=[1,2,3,4,5,6],Fn=(e,n)=>{let r=(0,lX.Z)(e);return(0,lG.Z)({start:r,end:(0,lJ.Z)(r)},{weekStartsOn:7===n?0:n})},Fr=e=>e.map(e=>[e,...Ft.map(n=>(0,lQ.Z)(e,n))]),Fi=e=>{let{weekInfo:n}=uk();return Fr(Fn(e,n.firstDay)).map(e=>({number:(0,l0.Z)(e[0]),days:e}))};var Fa=Object.freeze,Fo=Object.defineProperty;let Fl={1:R7,7:[R7[6],...R7.slice(0,6)]}
1,Fs=(0,oV.ZP)(oK.rj)(ii||(ii=Fa(Fo(el=["\n  grid-template-columns: repeat(7, minmax(44px, auto));\n"],"raw",{value:Fa(el.slice())}))));function Fc(e){let{hidden:n,onSelect:r}=e,{focusedDate:i,firstWeekDay:a}=R1(),{t:o}=dV();return(0,oZ.jsx)(oK.xu,{"aria-hidden":n||!1,"data-ui":"CalendarMonth",children:(0,oZ.jsxs)(Fs,{gapY:1,children:[Fl[a].map(e=>(0,oZ.jsx)(oK.xu,{paddingBottom:3,paddingTop:2,children:(0,oZ.jsx)(oK.xv,{align:"center",size:1,weight:"medium",children:o(e)})},e)),Fi(i).map((e,n)=>e.days.map((e,i)=>(0,oZ.jsx)(R9,{date:e,onSelect:r},"".concat(n,"-").concat(i))))]})})}let Fd=(0,oZ.jsx)("span",{"data-preserve-focus":!0,style:{overflow:"hidden",position:"absolute",outline:"none"},tabIndex:-1});function Fu(e){let{date:n,endDate:r,onSelect:i,selectRange:a,selectTime:o}=e,[l,s]=(0,oN.useState)(null),[c,d]=(0,oN.useState)(!1),[u,p]=(0,oN.useState)(n||new Date),h=(0,oN.useRef)(n||null),f=(0,oN.useRef)(r||null),{weekInfo:{firstDay:m}}=uk(),g=(0,oN.useCallback)(()=>{var e;null==(e=null==l?void 0:l.querySelector('[data-focused="true"]'))||e.focus()},[l]),x=(0,oN.useCallback)(e=>{let o=(0,si.Z)(e,{hours:e.getHours(),minutes:e.getMinutes(),seconds:0,milliseconds:0}),l=n&&(0,sr.Z)(o,n),s=r&&(0,sn.Z)(o,r);if(a){if(l||s){i({date:o,endDate:null});return}c?i({date:n||null,endDate:o}):i({date:o,endDate:n?null:r||null})}else i({date:o})},[n,r,i,c,a]),v=(0,oN.useCallback)(()=>{let e=new Date;a?p(e):i({date:e})},[i,a,p]),y=(0,oN.useCallback)(e=>{var n;if(Fe.includes(e.key)){if(e.preventDefault(),e.target.hasAttribute("data-calendar-grid")){g();return}"ArrowUp"===e.key&&p((0,lQ.Z)(u,-7)),"ArrowDown"===e.key&&p((0,lQ.Z)(u,7)),"ArrowLeft"===e.key&&p((0,lQ.Z)(u,-1)),"ArrowRight"===e.key&&p((0,lQ.Z)(u,1)),null==(n=null==l?void 0:l.querySelector("[data-preserve-focus]"))||n.focus()}},[l,g,u,p]),b=(0,oN.useCallback)(e=>p((0,l5.Z)(u,e)),[u,p]);return(0,oN.useEffect)(()=>{g()},[g]),(0,oN.useEffect)(()=>{var e;
1(null==(e=document.activeElement)?void 0:e.matches("[data-calendar-grid], [data-calendar-grid] [data-preserve-focus]"))&&g()},[g,u]),(0,oN.useEffect)(()=>{var e,a;let o=(null==n?void 0:n.getTime())!==(null==(e=h.current)?void 0:e.getTime()),l=(null==r?void 0:r.getTime())!==(null==(a=f.current)?void 0:a.getTime()),s=n&&r&&(0,sn.Z)(n,r);o&&!l&&(s&&(d(!0),i({date:n,endDate:null})),d(!!n),n&&p(n)),!o&&l&&(s&&(d(!0),i({date:r,endDate:null})),d(!!n&&!r),r&&p(r)),o&&l&&(d(!0),n&&p(n)),h.current=n||null,f.current=r||null},[n,r,i]),(0,oZ.jsx)(R0.Provider,{value:{date:n,endDate:r,focusedDate:u,selectRange:a,selectTime:o,firstWeekDay:m},children:(0,oZ.jsxs)(oK.xu,{"data-ui":"Calendar",ref:s,children:[(0,oZ.jsx)(oK.kC,{children:(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(R2,{moveFocusedDate:b,onNowClick:v})})}),(0,oZ.jsxs)(oK.xu,{"data-calendar-grid":!0,onKeyDown:y,marginTop:2,overflow:"hidden",tabIndex:0,children:[(0,oZ.jsx)(Fc,{onSelect:x}),Fd]})]})})}function Fp(e){let{date:n,endDate:r,onChange:i,selectRange:a,selectTime:o}=e,l=(0,oN.useCallback)(e=>{i(e)},[i]);return(0,oZ.jsx)(Fu,{date:n,endDate:r,onSelect:l,selectRange:a,selectTime:o})}var Fh=Object.freeze,Ff=Object.defineProperty,Fm=(e,n)=>Fh(Ff(e,"raw",{value:Fh(n||e.slice())}));let Fg=(0,oV.ZP)(oK.xu)(e=>{let{$background:n,$smallClearButton:r}=e;return(0,oV.iv)(ia||(ia=Fm(["\n    width: 100%;\n\n    input + span {\n      background: ",";\n    }\n\n    [data-qa='clear-button'] {\n      background: none;\n      box-shadow: none;\n      display: flex; /* TODO: hack, currently used to vertically center <TextInput>'s clearButton */\n      transform: ",";\n      &:hover {\n        opacity: 0.5;\n      }\n    }\n  "])),e=>{let{theme:r}=e;return n?r.sanity.color.card.disabled.bg2:"transparent"},r?"scale(0.8)":"scale(1)")}),Fx=(0,oN.forwardRef)(function(e,n){let{$background:r,$smallClearButton:i,...a}=e;return(0,oZ.jsx)(Fg,{$background:r,$smallClearButton:i,children:(0,oZ.jsx)(oK.oi,{...a,ref:n})})});function Fv(e){let n,{date:r,dateOnly:i,roundDay:a}=e;switch(a){case"end":n=(0,sa.Z)(r);break;case"start":n=(0,so.Z)(r);break;default:n=r}return i?n.toISOString().split("T")[0]:n.toISOString()}
1let Fy={date:{exampleDate:"Jan 1, 2000",pattern:"MMM d, yyyy"},datetime:{exampleDate:"Jan 1, 2000 12:00 AM",pattern:"MMM d, yyyy p"}};function Fb(e){let{isDateTime:n,onChange:r,placeholderDate:i,isDateTimeFormat:a,value:o,...l}=e,{t:s}=dV(),c=a?Fy.datetime.pattern:Fy.date.pattern,[d,u]=(0,oN.useState)(void 0),[p,h]=(0,oN.useState)(()=>{if(!o)return"";let e=new Date(o);return(0,lO.Z)(e,c)}),f=(0,oN.useMemo)(()=>{let e=i||new Date;return(0,lO.Z)(e,c)},[c,i]),m=(0,oN.useCallback)(e=>{let{dateString:i,triggerOnChange:a}=e;if(!i)return;let o=(0,sl.Z)(i,c,new Date),l=(0,st.Z)(o);l&&(a&&r(Fv({date:o,dateOnly:!n})),h((0,lO.Z)(o,c))),u(l?void 0:"Invalid ".concat(n?"datetime":"date"))},[c,n,r]),g=(0,oN.useCallback)(()=>{m({dateString:p,triggerOnChange:!0})},[p,m]),x=(0,oN.useCallback)(e=>{h(e.currentTarget.value)},[]),v=(0,oN.useCallback)(()=>{r(null),u(void 0),h("")},[r]),y=(0,oN.useCallback)(e=>{"Enter"===e.key&&m({dateString:p,triggerOnChange:!0})},[p,m]);return(0,oN.useEffect)(()=>{let e=o&&new Date(o);e&&m({dateString:(0,lO.Z)(e,c),triggerOnChange:!1})},[c,m,a,o]),(0,oZ.jsx)(lr.u,{content:s("calendar.error.must-be-in-format",{exampleDate:a?Fy.datetime.exampleDate:Fy.date.exampleDate}),disabled:!d,placement:"top",portal:!0,children:(0,oZ.jsx)(Fx,{...l,clearButton:!!p,customValidity:d,onBlur:g,onChange:x,onClear:v,onKeyDown:y,placeholder:f,value:p})})}function Fj(e){let{isDateTime:n,onChange:r,value:i}=e,{state:{fullscreen:a}}=M5(),{t:o}=dV(),l=(0,oN.useCallback)(e=>{let{date:a}=e;if(a){let e=Fv({date:a,dateOnly:!n});r({includeTime:null==i?void 0:i.includeTime,date:e})}else r(null)},[n,r,null==i?void 0:i.includeTime]),s=(0,oN.useCallback)(()=>{let e=!(null==i?void 0:i.includeTime),a=(null==i?void 0:i.date)?new Date(i.date):null,o=null;a&&(o=Fv({date:a,dateOnly:!n})),r({includeTime:e,date:o})},[n,r,i]),c=(0,oN.useCallback)(e=>{r({includeTime:null==i?void 0:i.includeTime,date:e||null})},[r,null==i?void 0:i.includeTime]);return(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(Fb,{"aria-label":o("search.filter-date-aria-label"),fontSize:a?2:1,isDateTime:n,isDateTimeFormat:n&&(null==i?void 0:i.includeTime),onChange:c,radius:2,value:null==i?void 0:i.date}),(0,oZ.jsx)(Fp,{date:(null==i?void 0:i.date)?new Date(i.date):void 0,onChange:l,selectTime:n}),n&&(0,oZ.jsx)(RQ,{onChange:s,value:!!(null==i?void 0:i.includeTime)})]})}function Fw(e){return(0,oZ.jsx)(Fj,{...e,isDateTime:!1})}function Fk(e){let{direction:n,isDateTime:r,onChange:i,value:a}=e,{state:{fullscreen:o}}=M5(),{t:l}=dV(),s=(0,oN.useMemo)(()=>{switch(n){case"after":return"end";case"before":return"start";default:return}},[n]),c=(0,oN.useCallback)(e=>{let{date:n}=e,o=null;n&&(o=Fv({date:n,dateOnly:!r,roundDay:(null==a?void 0:a.includeTime)?void 0:s})),i({includeTime:null==a?void 0:a.includeTime,date:o})},[r,i,s,null==a?void 0:a.includeTime]),d=(0,oN.useCallback)(()=>{let e=!(null==a?void 0:a.includeTime),n=(null==a?void 0:a.date)?new Date(a.date):null,o=null;n&&(o=Fv({date:n,dateOnly:!r,roundDay:e?"start":s})),i({includeTime:e,date:o})},[r,i,s,a]),u=(0,oN.useCallback)(e=>{i({includeTime:null==a?void 0:a.includeTime,date:e||null})},[i,null==a?void 0:a.includeTime]);return(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(Fb,{"aria-label":l("search.filter-date-aria-label"),fontSize:o?2:1,isDateTime:r,isDateTimeFormat:r&&(null==a?void 0:a.includeTime),onChange:u,radius:2,value:null==a?void 0:a.date}),(0,oZ.jsx)(Fp,{date:(null==a?void 0:a.date)?new Date(a.date):void 0,onChange:c,selectTime:r}),r&&(0,oZ.jsx)(RQ,{onChange:d,value:!!(null==a?void 0:a.includeTime)})]})}let FC=[{unit:"day",key:"search.filter-date-unit_days"},{unit:"month",key:"search.filter-date-unit_months"},{unit:"year",key:"search.filter-date-unit_years"}];function F_(e){let{onChange:n,value:r}=e,[i,a]=(0,oN.useState)((null==r?void 0:r.unitValue)||""),o=(0,oN.useRef)("day"),l=(0,oN.useRef)((null==r?void 0:r.unitValue)||null),{t:s}=dV(),{state:{fullscreen:c}}=M5(),d=(0,oN.useCallback)(()=>{n({unit:null==o?void 0:o.current,unitValue:null==l?void 0:l.current})},[n]),u=(0,oN.useCallback)(e=>{o.current=e.currentTarget.value,d()},[d]),p=(0,oN.useCallback)(e=>{a(e.currentTarget.value);let n=parseFloat(e.currentTarget.value);l.current=Number.isFinite(n)?n:null,d()},[d]);return(0,oZ.jsxs)(oK.kC,{gap:2,children:[(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.oi,{"aria-label":s("search.filter-date-value-aria-label"),fontSize:c?2:1,onChange:p,pattern:"\\d*",radius:2,step:"1",type:"number",value:i})}),(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.Ph,{"aria-label":s("search.filter-date-unit-aria-label"),fontSize:c?2:1,onChange:u,radius:2,value:null==r?void 0:r.unit,children:FC.map(e=>(0,oZ.jsx)("option",{value:e.unit,children:s(e.key)},e.key))})})]})}function FT(e){let{isDateTime:n,onChange:r,value:i}=e,{t:a}=dV(),{state:{fullscreen:o}}=M5(),l=(0,oN.useMemo)(()=>(0,lQ.Z)(new Date,-7),[]),s=(0,oN.useMemo)(()=>new Date,[]),c=(0,oN.useCallback)(e=>{let{date:a,endDate:o}=e;r(FS({date:a,endDate:o,includeTime:null==i?void 0:i.includeTime,isDateTime:n}))},[n,r,null==i?void 0:i.includeTime]),d=(0,oN.useCallback)(()=>{let e=!(null==i?void 0:i.includeTime);
1r(FS({date:(null==i?void 0:i.from)?new Date(i.from):null,endDate:(null==i?void 0:i.to)?new Date(i.to):null,includeTime:e,isDateTime:n}))},[n,r,i]),u=(0,oN.useCallback)(e=>{r({includeTime:null==i?void 0:i.includeTime,to:e||null,from:(null==i?void 0:i.from)||null})},[r,i]),p=(0,oN.useCallback)(e=>{r({includeTime:null==i?void 0:i.includeTime,to:(null==i?void 0:i.to)||null,from:e||null})},[r,i]);return(0,oZ.jsx)("div",{children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsxs)(oK.kC,{direction:"column",gap:3,children:[(0,oZ.jsx)(Fb,{"aria-label":a("search.filter-date-range-start-date-aria-label"),fontSize:o?2:1,isDateTime:n,isDateTimeFormat:n&&(null==i?void 0:i.includeTime),onChange:p,placeholderDate:l,radius:2,value:null==i?void 0:i.from}),(0,oZ.jsx)(Fb,{"aria-label":a("search.filter-date-range-end-date-aria-label"),fontSize:o?2:1,isDateTime:n,isDateTimeFormat:n&&(null==i?void 0:i.includeTime),onChange:u,placeholderDate:s,radius:2,value:null==i?void 0:i.to})]}),(0,oZ.jsx)(Fp,{date:(null==i?void 0:i.from)?new Date(i.from):void 0,endDate:(null==i?void 0:i.to)?new Date(i.to):void 0,onChange:c,selectRange:!0,selectTime:n}),n&&(0,oZ.jsx)(RQ,{onChange:d,value:!!(null==i?void 0:i.includeTime)})]})})}function FS(e){let{date:n,endDate:r,includeTime:i,isDateTime:a}=e;return i?{includeTime:i,to:r?Fv({date:r,dateOnly:!a,roundDay:"start"}):null,from:n?Fv({date:n,dateOnly:!a,roundDay:"start"}):null}:{includeTime:i,to:r?Fv({date:r,dateOnly:!a,roundDay:"end"}):null,from:n?Fv({date:n,dateOnly:!a,roundDay:"start"}):null}}function FE(e){return(0,oZ.jsx)(Fj,{...e,isDateTime:!0})}let FP={dateAfter:{buttonValueComponent:M1,initialValue:null},dateBefore:{buttonValueComponent:M1,initialValue:null},dateEqual:{buttonValueComponent:M1,initialValue:{date:null,includeTime:!1}},dateLast:{buttonValueComponent:function(e){var n;let{value:r}=e,i=h3();return(0,oZ.jsx)(oZ.Fragment,{children:i(Math.floor(null!=(n=null==r?void 0:r.unitValue)?n:0),r.unit)})}},dateNotEqual:{buttonValueComponent:M1,initialValue:{date:null,includeTime:!1}},dateRange:{initialValue:null}},FO={dateAfter:{...FP.dateAfter,nameKey:"search.operator.date-after.name",descriptionKey:"search.operator.date-after.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r.date)&&n?"".concat(n," > ").concat(RE(null==r?void 0:r.date)):null},inputComponent:function(e){return(0,oZ.jsx)(Fk,{...e,direction:"after",isDateTime:!1})},type:"dateAfter"},dateBefore:{...FP.dateBefore,nameKey:"search.operator.date-before.name",descriptionKey:"search.operator.date-before.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r.date)&&n?"".concat(n," < ").concat(RE(null==r?void 0:r.date)):null},inputComponent:function(e){return(0,oZ.jsx)(Fk,{...e,direction:"before",isDateTime:!1})},type:"dateBefore"},dateEqual:{...FP.dateEqual,nameKey:"search.operator.date-equal.name",descriptionKey:"search.operator.date-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r.date)&&n?"".concat(n," == ").concat(RE(r.date)):null},inputComponent:Fw,type:"dateEqual"},dateLast:{...FP.dateLast,nameKey:"search.operator.date-last.name",descriptionKey:"search.operator.date-last.description",groqFilter:e=>{let{fieldPath:n,value:r}=e,i="number"==typeof(null==r?void 0:r.unitValue)?Math.floor(r.unitValue):void 0,a=Number.isFinite(i)?(0,ss.Z)(new Date,{days:(null==r?void 0:r.unit)==="day"?i:0,months:(null==r?void 0:r.unit)==="month"?i:0,years:(null==r?void 0:r.unit)==="year"?i:0}).toISOString().split("T")[0]:null;return a&&n?"".concat(n," > ").concat(RE(a)):null},inputComponent:F_,initialValue:{unit:"day",unitValue:7},type:"dateLast"},dateNotEqual:{...FP.dateNotEqual,nameKey:"search.operator.date-not-equal.name",descriptionKey:"search.operator.date-not-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r.date)&&n?"".concat(n," != ").concat(RE(r.date)):null},inputComponent:Fw,type:"dateNotEqual"},dateRange:{...FP.dateRange,nameKey:"search.operator.date-range.name",descriptionKey:"search.operator.date-range.description",buttonValueComponent:M2,groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r.to)&&(null==r?void 0:r.from)&&n?"".concat(n," >= ").concat(RE(r.from)," && ").concat(n," <= ").concat(RE(r.to)):null},initialValue:{includeTime:!1,to:(0,sc.Z)().toISOString(),from:null},inputComponent:function(e){return(0,oZ.jsx)(FT,{...e,isDateTime:!1})},type:"dateRange"},dateTimeAfter:{...FP.dateAfter,nameKey:"search.operator.date-time-after.name",descriptionKey:"search.operator.date-time-after.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r.date)&&n?"dateTime(".concat(n,") > dateTime(").concat(RE(r.date),")"):null},inputComponent:function(e){return(0,oZ.jsx)(Fk,{...e,direction:"after",isDateTime:!0})},type:"dateTimeAfter"},dateTimeBefore:{...FP.dateBefore,nameKey:"search.operator.date-time-before.name",descriptionKey:"search.operator.date-time-before.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r.date)&&n?"dateTime(".concat(n,") < dateTime(").concat(RE(r.date),")"):null},inputComponent:function(e){return(0,oZ.jsx)(Fk,{...e,direction:"before",isDateTime:!0})},type:"dateTimeBefore"},dateTimeEqual:{...FP.dateEqual,nameKey:"search.operator.date-time-equal.name",descriptionKey:"search.operator.date-time-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e,i=(null==r?void 0:r.date)&&new Date(r.date);if(!i||!(0,st.Z)(i)||!n)return null;let a=((null==r?void 0:r.includeTime)?(0,sd.Z)(i):(0,so.Z)(i)).toISOString(),o=((null==r?void 0:r.includeTime)?(0,su.Z)(i):(0,sa.Z)(i)).toISOString();return"dateTime(".concat(n,") > dateTime(").concat(RE(a),") && dateTime(").concat(n,") < dateTime(").concat(RE(o),")")},inputComponent:FE,type:"dateTimeEqual"},dateTimeLast:{...FP.dateLast,nameKey:"search.operator.date-time-last.name",descriptionKey:"search.operator.date-time-last.description",groqFilter:e=>{let{fieldPath:n,value:r}=e,i="number"==typeof(null==r?void 0:r.unitValue)?Math.floor(r.unitValue):void 0,a=Number.isFinite(i)?(0,ss.Z)(new Date,{days:(null==r?void 0:r.unit)==="day"?i:0,months:(null==r?void 0:r.unit)==="month"?i:0,years:(null==r?void 0:r.unit)==="year"?i:0}).toISOString():null;return a&&n?"dateTime(".concat(n,") > dateTime(").concat(RE(a),")"):null},initialValue:{unit:"day",unitValue:7},inputComponent:F_,type:"dateTimeLast"},dateTimeNotEqual:{...FP.dateNotEqual,nameKey:"search.operator.date-time-not-equal.name",descriptionKey:"search.operator.date-time-not-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e,i=(null==r?void 0:r.date)&&new Date(r.date);if(!i||!(0,st.Z)(i)||!n)return null;let a=((null==r?void 0:r.includeTime)?(0,sd.Z)(i):(0,so.Z)(i)).toISOString(),o=((null==r?void 0:r.includeTime)?(0,su.Z)(i):(0,sa.Z)(i)).toISOString();return"dateTime(".concat(n,") < dateTime(").concat(RE(a),") || dateTime(").concat(n,") > dateTime(").concat(RE(o),")")},inputComponent:FE,type:"dateTimeNotEqual"},dateTimeRange:{...FP.dateRange,nameKey:"search.operator.date-time-range.name",descriptionKey:"search.operator.date-time-range.description",buttonValueComponent:M2,groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r.to)&&(null==r?void 0:r.from)&&n?"dateTime(".concat(n,") >= dateTime(").concat(RE(r.from),") && dateTime(").concat(n,") <= dateTime(").concat(RE(r.to),")"):null},initialValue:{includeTime:!1,to:(0,sc.Z)().toISOString(),from:null},inputComponent:function(e){return(0,oZ.jsx)(FT,{...e,isDateTime:!0})},type:"dateTimeRange"}};function FA(e){let{onChange:n,value:r}=e,{state:{fullscreen:i}}=M5(),{t:a}=dV(),o=(0,oN.useCallback)(e=>n(e.currentTarget.value||null),[n]);return(0,oZ.jsx)(oK.oi,{fontSize:i?2:1,onChange:o,placeholder:a("search.filter-string-value-placeholder"),radius:2,value:r||""})}let FI={referenceEqual:{nameKey:"search.operator.reference-equal.name",descriptionKey:"search.operator.reference-equal.description",buttonValueComponent:M3,groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r._ref)&&n?"".concat(n,"._ref == ").concat(RE(r._ref)):null},initialValue:null,inputComponent:Rj,type:"referenceEqual"},referenceNotEqual:{nameKey:"search.operator.reference-not-equal.name",descriptionKey:"search.operator.reference-not-equal.description",buttonValueComponent:M3,groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r._ref)&&n?"".concat(n,"._ref != ").concat(RE(r._ref)):null},initialValue:null,inputComponent:Rj,type:"referenceNotEqual"},referencesAssetFile:{nameKey:"search.operator.reference-asset-file.name",descriptionKey:"search.operator.reference-asset-file.de
1scription",buttonValueComponent:M3,groqFilter:e=>{let{value:n}=e;return(null==n?void 0:n._ref)?"references(".concat(RE(n._ref),")"):null},initialValue:null,inputComponent:RW("file"),type:"referencesAssetFile"},referencesAssetImage:{nameKey:"search.operator.reference-asset-image.name",descriptionKey:"search.operator.reference-asset-image.description",buttonValueComponent:M3,groqFilter:e=>{let{value:n}=e;return(null==n?void 0:n._ref)?"references(".concat(RE(n._ref),")"):null},initialValue:null,inputComponent:RW("image"),type:"referencesAssetImage"},referencesDocument:{nameKey:"search.operator.reference-document.name",descriptionKey:"search.operator.reference-document.description",buttonValueComponent:M3,groqFilter:e=>{let{value:n}=e;return(null==n?void 0:n._ref)?"references(".concat(RE(n._ref),")"):null},initialValue:null,inputComponent:Rj,type:"referencesDocument"}},Fz=Object.values({arrayCountEqual:{nameKey:"search.operator.array-count-equal.name",descriptionKey:"search.operator.array-count-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"count(".concat(n,") == ").concat(RE(r)):null},initialValue:null,inputComponent:M8,type:"arrayCountEqual"},arrayCountGt:{nameKey:"search.operator.array-count-gt.name",descriptionKey:"search.operator.array-count-gt.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"count(".concat(n,") > ").concat(RE(r)):null},icon:R_,initialValue:null,inputComponent:M8,type:"arrayCountGt"},arrayCountGte:{nameKey:"search.operator.array-count-gte.name",descriptionKey:"search.operator.array-count-gte.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"count(".concat(n,") >= ").concat(RE(r)):null},icon:RC,initialValue:null,inputComponent:M8,type:"arrayCountGte"},arrayCountLt:{nameKey:"search.operator.array-count-lt.name",descriptionKey:"search.operator.array-count-lt.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"count(".concat(n,") < ").concat(RE(r)):null},icon:RS,initialValue:null,inputComponent:M8,type:"arrayCountLt"},arrayCountLte:{nameKey:"search.operator.array-count-lte.name",descriptionKey:"search.operator.array-count-lte.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"count(".concat(n,") <= ").concat(RE(r)):null},icon:RT,initialValue:null,inputComponent:M8,type:"arrayCountLte"},arrayCountNotEqual:{nameKey:"search.operator.array-count-not-equal.name",descriptionKey:"search.operator.array-count-not-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"count(".concat(n,") != ").concat(RE(r)):null},initialValue:null,inputComponent:M8,type:"arrayCountNotEqual"},arrayCountRange:{nameKey:"search.operator.array-count-range.name",descriptionKey:"search.operator.array-count-range.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(null==r?void 0:r.to)&&Number.isFinite(null==r?void 0:r.from)&&n?"count(".concat(n,") > ").concat(RE(null==r?void 0:r.from)," && count(").concat(n,") < ").concat(RE(null==r?void 0:r.to)):""},initialValue:null,inputComponent:M6,type:"arrayCountRange"},arrayListIncludes:{nameKey:"search.operator.array-list-includes.name",descriptionKey:"search.operator.array-list-includes.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"".concat(RE(r)," in ").concat(n):null},initialValue:null,inputComponent:Rk,type:"arrayListIncludes"},arrayListNotIncludes:{nameKey:"search.operator.array-list-not-includes.name",descriptionKey:"search.operator.array-list-not-includes.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"!(".concat(RE(r)," in ").concat(n,")"):null},initialValue:null,inputComponent:Rk,type:"arrayListNotIncludes"},arrayReferenceIncludes:{nameKey:"search.operator.array-reference-includes.name",descriptionKey:"search.operator.array-reference-includes.description",buttonValueComponent:M3,groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r._ref)&&n?"".concat(RE(r._ref)," in ").concat(n,"[]._ref"):null},initialValue:null,inputComponent:Rj,type:"arrayReferenceIncludes"},arrayReferenceNotIncludes:{nameKey:"search.operator.array-reference-not-includes.name",descriptionKey:"search.operator.array-reference-not-includes.description",buttonValueComponent:M3,groqFilter:e=>{let{fieldPath:n,value:r}=e;return(null==r?void 0:r._ref)&&n?"!(".concat(RE(r._ref)," in ").concat(n,"[]._ref)"):null},initialValue:null,inputComponent:Rj,type:"arrayReferenceNotIncludes"},...RY,booleanEqual:{nameKey:"search.operator.boolean-equal.name",descriptionKey:"search.operator.boolean-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return void 0!==r&&n?"".concat(n," == ").concat(RE(r)):null},initialValue:!0,inputComponent:function(e){let{onChange:n,value:r}=e,{state:{fullscreen:i}}=M5(),{t:a}=dV(),o=(0,oN.useCallback)(e=>{n("true"===e.currentTarget.value)},[n]);return(0,oZ.jsxs)(oK.Ph,{fontSize:i?2:1,onChange:o,radius:2,value:String(null==r||r),children:[(0,oZ.jsx)("option",{value:"true",children:a("search.filter-boolean-true")}),(0,oZ.jsx)("option",{value:"false",children:a("search.filter-boolean-false")})]})},type:"booleanEqual"},...FO,defined:{nameKey:"search.operator.defined.name",descriptionKey:"search.operator.defined.description",groqFilter:e=>{let{fieldPath:n}=e;return n?"defined(".concat(n,")"):null},type:"defined"},notDefined:{nameKey:"search.operator.not-defined.name",descriptionKey:"search.operator.not-defined.description",i18nKey:"search.operator.not-defined",groqFilter:e=>{let{fieldPath:n}=e;return n?"!defined(".concat(n,")"):null},type:"notDefined"},numberEqual:{nameKey:"search.operator.number-equal.name",descriptionKey:"search.operator.number-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"".concat(n," == ").concat(RE(r)):null},initialValue:null,inputComponent:M8,type:"numberEqual"}
1,numberGt:{nameKey:"search.operator.number-gt.name",descriptionKey:"search.operator.number-gt.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"".concat(n," > ").concat(RE(r)):null},icon:R_,initialValue:null,inputComponent:M8,type:"numberGt"},numberGte:{nameKey:"search.operator.number-gte.name",descriptionKey:"search.operator.number-gte.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"".concat(n," >= ").concat(RE(r)):null},icon:RC,initialValue:null,inputComponent:M8,type:"numberGte"},numberLt:{nameKey:"search.operator.number-lt.name",descriptionKey:"search.operator.number-lt.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"".concat(n," < ").concat(RE(r)):null},icon:RS,initialValue:null,inputComponent:M8,type:"numberLt"},numberLte:{nameKey:"search.operator.number-lte.name",descriptionKey:"search.operator.number-lte.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"".concat(n," <= ").concat(RE(r)):null},icon:RT,initialValue:null,inputComponent:M8,type:"numberLte"},numberNotEqual:{nameKey:"search.operator.number-not-equal.name",descriptionKey:"search.operator.number-not-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(r)&&n?"".concat(n," != ").concat(RE(r)):null},initialValue:null,inputComponent:M8,type:"numberNotEqual"},numberRange:{nameKey:"search.operator.number-range.name",descriptionKey:"search.operator.number-range.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return Number.isFinite(null==r?void 0:r.to)&&Number.isFinite(null==r?void 0:r.from)&&n?"".concat(n," > ").concat(RE(null==r?void 0:r.from)," && ").concat(n," < ").concat(RE(null==r?void 0:r.to)):""},initialValue:null,inputComponent:M6,type:"numberRange"},portableTextEqual:{nameKey:"search.operator.portable-text-equal.name",descriptionKey:"search.operator.portable-text-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"pt::text(".concat(n,") == ").concat(RE(r)):null},initialValue:null,inputComponent:FA,type:"portableTextEqual"},portableTextMatches:{nameKey:"search.operator.portable-text-contains.name",descriptionKey:"search.operator.portable-text-contains.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"pt::text(".concat(n,") match ").concat(RE(r)):null},initialValue:null,inputComponent:FA,type:"portableTextMatches"},portableTextNotEqual:{nameKey:"search.operator.portable-text-not-equal.name",descriptionKey:"search.operator.portable-text-not-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"pt::text(".concat(n,") != ").concat(RE(r)):null},initialValue:null,inputComponent:FA,type:"portableTextNotEqual"},portableTextNotMatches:{nameKey:"search.operator.portable-text-not-contains.name",descriptionKey:"search.operator.portable-text-not-contains.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"!(pt::text(".concat(n,") match ").concat(RE(r),")"):null},initialValue:null,inputComponent:FA,type:"portableTextNotMatches"},...FI,slugEqual:{nameKey:"search.operator.slug-equal.name",descriptionKey:"search.operator.slug-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"".concat(n,".current == ").concat(RE(r)):null},initialValue:null,inputComponent:FA,type:"slugEqual"},slugMatches:{nameKey:"search.operator.slug-contains.name",descriptionKey:"search.operator.slug-contains.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"".concat(n,".current match ").concat(RE(r)):null},initialValue:null,inputComponent:FA,label:"contains",type:"slugMatches"},slugNotEqual:{nameKey:"search.operator.slug-not-equal.name",descriptionKey:"search.operator.slug-not-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"".concat(n,".current != ").concat(RE(r)):null},initialValue:null,inputComponent:FA,type:"slugNotEqual"},slugNotMatches:{nameKey:"search.operator.slug-not-contains.name",descriptionKey:"search.operator.slug-not-contains.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"!(".concat(n,".current match ").concat(RE(r),")"):null},initialValue:null,inputComponent:FA,type:"slugNotMatches"},stringEqual:{nameKey:"search.operator.string-equal.name",descriptionKey:"search.operator.string-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"".concat(n," == ").concat(RE(r)):null},initialValue:null,inputComponent:FA,type:"stringEqual"},stringListEqual:{nameKey:"search.operator.string-list-equal.name",descriptionKey:"search.operator.string-list-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"".concat(n," == ").concat(RE(r)):null},initialValue:null,inputComponent:Rk,type:"stringListEqual"},stringListNotEqual:{nameKey:"search.operator.string-list-not-equal.name",descriptionKey:"search.operator.string-list-not-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"".concat(n," != ").concat(RE(r)):null},initialValue:null,inputComponent:Rk,type:"stringListNotEqual"},stringMatches:{nameKey:"search.operator.string-contains.name",descriptionKey:"search.operator.string-contains.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"".concat(n," match ").concat(RE(r)):null},initialValue:null,inputComponent:FA,type:"stringMatches"},stringNotEqual:{nameKey:"search.operator.string-not-equal.name",descriptionKey:"search.operator.string-not-equal.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"".concat(n," != ").concat(RE(r)):null},initialValue:null,inputComponent:FA,type:"stringNotEqual"},stringNotMatches:{nameKey:"search.operator.string-not-contains.name",descriptionKey:"search.operator.string-not-contains.description",groqFilter:e=>{let{fieldPath:n,value:r}=e;return r&&n?"!(".concat(n," match ").concat(RE(r),")"):null},initialValue:null,inputComponent:FA,type:"stringNotMatches"}});
1class FM extends Error{constructor(e){let{propertyName:n,path:r,cause:i}=e;super("An error occurred while resolving `".concat(n,"` from ").concat(r.join(" > ")).concat(dj(i)&&"string"==typeof(null==i?void 0:i.message)?": ".concat(i.message):"")),this.propertyName=n,this.cause=i,this.path=r}}let FR=(e,n)=>{let{plugins:r=[],...i}=e,a={config:i,path:[...n,i.name]};return[...r.flatMap(e=>FR(e,[...n,i.name])),a]};function FF(e){let{config:n,context:r,initialValue:i,propertyName:a,...o}=e,l=FR(n,[]);if("reducer"in o)return l.reduce((e,n)=>{let{config:i,path:l}=n;try{return o.reducer(e,i,r)}catch(e){throw new FM({propertyName:a,path:l,cause:e})}},i);let s=o.asyncReducer;return(async()=>{let e=i;for(let{config:n,path:i}of l)try{e=await s(e,n,r)}catch(e){throw new FM({propertyName:a,path:i,cause:e})}return e})()}let FD=[],Fq=[],FZ=[],FN=(e,n,r)=>{let{schema:i}=n,a=null==i?void 0:i.types;if(!a)return e;if("function"==typeof a)return a(e,r);if(Array.isArray(a))return[...e,...a];throw Error("Expected `schema.types` to be an array or a function, but received ".concat(mu(a)))},FL=async(e,n,r)=>{let{document:i}=n,a=null==i?void 0:i.productionUrl;return a?await a(e,r):e},FV=(e,n,r)=>{let{tools:i}=n;if(!i)return e;if("function"==typeof i)return i(e,r);if(Array.isArray(i))return[...e,...i];throw Error("Expected `tools` to be an array or a function, but received ".concat(mu(i)))},FK=(e,n,r)=>{let{schema:i}=n,a=null==i?void 0:i.templates;if(!a)return e;if("function"==typeof a)return a(e,r);if(Array.isArray(a))return[...e,...a];throw Error("Expected `schema.templates` to be an array or a function, but received ".concat(mu(a)))},FB=(e,n,r)=>{let{i18n:i}=n,a=null==i?void 0:i.locales;if(!a)return e;if("function"==typeof a)return a(e,r);if(Array.isArray(a))return[...e,...a];throw Error("Expected `i18n.locales` to be an array or a function, but received ".concat(mu(a)))},FU=(e,n,r)=>{let{i18n:i}=n,a=null==i?void 0:i.bundles;if(!a)return e;if(Array.isArray(a))return[...e,...a];if("function"==typeof a)return a(e,r);throw Error("Expected `i18n.bundles` to be an array or a function, but received ".concat(typeof a))},FH=(e,n,r)=>{let{document:i}=n,a=null==i?void 0:i.badges;if(!a)return e;if("function"==typeof a)return a(e,r);if(Array.isArray(a))return[...e,...a];throw Error("Expected `document.badges` to be an array or a function, but received ".concat(mu(a)))},F$=(e,n,r)=>{let{document:i}=n,a=null==i?void 0:i.actions;if(!a)return e;if("function"==typeof a)return a(e,r);if(Array.isArray(a))return[...e,...a];throw Error("Expected `document.actions` to be an array or a function, but received ".concat(mu(a)))},FW=(e,n,r)=>{let{document:i}=n,a=null==i?void 0:i.newDocumentOptions;if(!a)return e;if("function"!=typeof a)throw Error("Expected `document.resolveNewDocumentOptions` to be a function, but received ".concat(mu(a)));return a(e,r)},FY=(e,n,r)=>{var i;let{form:a}=n,o=null==(i=null==a?void 0:a.file)?void 0:i.assetSources;if(!o)return e;if("function"==typeof o)return o(e,r);if(Array.isArray(o))return[...e,...o];throw Error("Expected `form.file.assetSources` to be an array or a function, but received ".concat(mu(o)))},FX=(e,n,r)=>{var i;let{form:a}=n,o=null==(i=null==a?void 0:a.image)?void 0:i.assetSources;if(!o)return e;if("function"==typeof o)return o(e,r);if(Array.isArray(o))return[...e,...o];throw Error("Expected `form.image.assetSources` to be an array or a function, but received ".concat(mu(o)))},FG=(e,n,r)=>{let{document:i}=n,a=null==i?void 0:i.unstable_languageFilter;if(!a)return e;if("function"==typeof a)return a(e,r);if(Array.isArray(a))return[...e,...a];throw Error("Expected `document.unstable_languageFilter` to be an array or a function, but received ".concat(mu(a)))},FJ=(e,n,r)=>{let{document:i}=n,a=null==i?void 0:i.inspectors;if(!a)return e;if("function"==typeof a)return a(e,r);if(Array.isArray(a))return[...e,...a];throw Error("Expected `document.inspectors` to be an array or a function, but received ".concat(mu(a)))},FQ=e=>{let{config:n,context:r,initialValue:i}=e;return FR(n,[]).reduce((e,n)=>{var i,a;let{config:o}=n,l=null==(a=null==(i=o.document)?void 0:i.unstable_comments)?void 0:a.enabled;if(!l&&"boolean"!=typeof l)return e;if("function"==typeof l)return l(r);if("boolean"==typeof l)return l;throw Error("Expected `document.unstable_comments.enabled` to be a boolean or a function, but received ".concat(mu(l)))},i)},F0=e=>{let{config:n,initialValue:r}=e;return FR(n,[]).reduce((e,n)=>{var r,i;let{config:a}=n,o=null==(i=null==(r=a.search)?void 0:r.unstable_partialIndexing)?void 0:i.enabled;if(!o&&"boolean"!=typeof o)return e;if("boolean"==typeof o)return o;throw Error("Expected `search.unstable_partialIndexing.enabled` to be a boolean, but received ".concat(mu(o)))},r)};async function F1(e){var n,r;let i=await Promise.all(e.map(async e=>({...e,resources:await F2(e)}))),a={};for(let e of i){let i=null==(n=e.deep)||n,o=null==(r=e.overwrite)||r;i?function e(n,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];for(let a in r){if("__proto__"===a||"constructor"===a)continue;if(!(a in n)){n[a]=r[a];continue}let o=n[a],l=r[a],s=F3(o),c=F3(l);if((s||c)&&i){n[a]=r[a];continue}
1if(s||c)continue;let d=Array.isArray(l),u=Array.isArray(o);if(d||u){i&&(n[a]=l);continue}e(o,l,i)}return n}(a,e.resources,o):o?Object.assign(a,e.resources):Object.assign({},e.resources,a)}return a}async function F2(e){var n,r;return"function"!=typeof e.resources?e.resources:"default"in(r=n=await e.resources())&&"object"==typeof r.default&&lP()(r.default)?n.default:n}function F3(e){return"string"==typeof e||e instanceof String}function F4(e,n){return["sanity-locale",e,n].join(":")}let F5={ns:[pV],defaultNS:pV,partialBundledLanguages:!0,fallbackLng:pH.id,lng:pH.id,debug:!!dq,load:"currentOnly",initImmediate:!0,interpolation:{escapeValue:!1},react:{bindI18nStore:"added"}};function F8(e){let{bundles:n,...r}=e;return r}class F6 extends Error{constructor(e){let{causes:n,name:r,type:i}=e;super("Could not resolve ".concat(i).concat(r?" `".concat(r,"`"):"",":\n").concat(n.filter(Boolean).map(e=>dj(e)&&"string"==typeof(null==e?void 0:e.message)?e.message:String(e)).map(e=>"	- ".concat(e)).join("\n"),"\n\n")),this.name=r,this.causes=n,this.type=i}}class F9 extends Error{constructor(e){super("SchemaError"),this.schema=e}}var F7=Object.freeze,De=Object.defineProperty;function Dt(e){return Math.abs(16807*e.split("").reduce((e,n)=>(e<<5)-e+n.charCodeAt(0)|0,0)%2147483647)/2147483647}let Dn=oV.ZP.text(io||(io=F7(De(es=["\n  font-family: ",";\n  font-weight: ",";\n  font-size: ","px;\n  transform: translateY(1px);\n"],"raw",{value:F7(es.slice())}))),e=>{let{theme:n}=e;return n.sanity.fonts.text.family},e=>{let{theme:n}=e;return n.sanity.fonts.text.weights.medium},e=>{let{theme:n}=e;return n.sanity.fonts.text.sizes[1].fontSize}),Dr=e=>"error"===e.severity,Di=new WeakMap,Da=db.__sanityErrorChannel;function Do(){let{push:e}=(0,oK.pm)();return(0,oN.useEffect)(()=>{if(Da)return Da.subscribe(n=>{var r;!(!n.error||(r=n.error)instanceof F9||r instanceof hc||r instanceof F6)&&(console.error(n.error),e({id:n.error.message,closable:!0,description:n.error.message,duration:5e3,title:"Uncaught error",status:"error"}))})},[e]),null}var Dl=Object.freeze,Ds=Object.defineProperty,Dc=(e,n)=>Dl(Ds(e,"raw",{value:Dl(n||e.slice())}));let Dd={error:"critical",warning:"caution"},Du=oV.ZP.code(il||(il=Dc(["\n  && {\n    background: none;\n    color: inherit;\n  }\n"]))),Dp=(0,oV.ZP)(oK.xv)(is||(is=Dc(["\n  white-space: pre-line;\n"])));function Dh(e){let{problemGroups:n}=e;dV();let r=(0,oN.useMemo)(()=>{let e=[];for(let r of n)for(let n of r.problems)e.push({group:r,problem:n});return e},[n]);return(0,oZ.jsx)(oK.Kq,{as:"ul",space:4,children:r.map((e,n)=>{let{group:r,problem:i}=e,a="error"===i.severity,o="warning"===i.severity,l=function(e){let n=e.path[0];return"type"===n.kind?{name:n.name,type:n.type}:null}(r);return(0,oZ.jsxs)(oK.Zb,{border:!0,padding:4,radius:2,tone:Dd[i.severity],children:[(0,oZ.jsxs)(oK.kC,{children:[(0,oZ.jsx)(oK.xu,{marginRight:3,children:(0,oZ.jsxs)(oK.xv,{muted:!0,size:1,children:[a&&(0,oZ.jsx)(lp.uIy,{}),o&&(0,oZ.jsx)(lp.foC,{})]})}),(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:l?(0,oZ.jsxs)(oZ.Fragment,{children:[s6()(l.type),' type "',l.name,'"']}):null})})]}),(0,oZ.jsx)(oK.xu,{marginTop:4,children:(0,oZ.jsx)(oK.Zb,{border:!0,overflow:"auto",padding:2,tone:"inherit",children:(0,oZ.jsx)(oK.Oo,{separator:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:"→"}),children:r.path.map((e,n)=>{if("type"===e.kind){let r="".concat(function(e){if(null==e?void 0:e.startsWith("<unnamed_type_@_index")){let n=e.slice(1,-1).split("_");return"[".concat(n[4],"]")}return e}(e.name),":").concat(e.type);return(0,oZ.jsx)(oK.xv,{title:r,size:1,textOverflow:"ellipsis",children:(0,oZ.jsx)(Du,{children:r})},n)}return"property"===e.kind?(0,oZ.jsx)(oK.xv,{title:e.name,size:1,textOverflow:"ellipsis",children:(0,oZ.jsx)(Du,{children:e.name})},n):null})})})}),(0,oZ.jsx)(oK.xu,{as:"ul",marginTop:4,children:(0,oZ.jsx)(oK.xu,{as:"li",children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(Dp,{muted:!0,size:1,children:i.message}),i.helpId&&(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:(0,oZ.jsx)("a",{href:(0,cJ.h)(i.helpId),target:"_blank",rel:"noopener noreferrer",children:"View documentation →"})})]})})})]},n)})})}function Df(e){var n;let{schema:r}=e,i=(null==(n=r._validation)?void 0:n.filter(e=>e.problems.some(e=>
1"error"===e.severity)))||[];return(0,oN.useEffect)(()=>(function(e){let n=e._validation,r=null==n?void 0:n.filter(e=>e.problems.some(e=>"warning"===e.severity));(null==r?void 0:r.length)!==0&&(console.groupCollapsed("⚠️ Schema has ".concat(null==r?void 0:r.length," warnings")),null==r||r.forEach(e=>{let n=e.path.map(e=>"type"===e.kind?"".concat(e.name||"<unnamed>","(").concat(e.type,")"):"property"===e.kind?e.name:null).filter(Boolean).join(" > ");console.group("%cAt ".concat(n),"color: #FF7636"),e.problems.forEach(e=>{console.log(e.message)}),console.groupEnd()}),console.groupEnd())})(r),[r]),(0,oZ.jsx)(oK.Zb,{height:"fill",overflow:"auto",paddingY:[4,5,6,7],paddingX:4,sizing:"border",children:(0,oZ.jsx)(oK.W2,{width:1,children:(0,oZ.jsxs)(oK.Kq,{space:5,children:[(0,oZ.jsx)(oK.X6,{as:"h1",children:"Schema errors"}),(0,oZ.jsx)(Dh,{problemGroups:i})]})})})}function Dm(e){return(0,oZ.jsx)(oK.Zb,{height:"fill",sizing:"border",tone:"caution",display:"flex",children:(0,oZ.jsx)(oK.kC,{direction:"row",justify:"center",flex:1,align:"center",children:(0,oZ.jsxs)(oK.Kq,{space:4,children:[(0,oZ.jsx)(oK.X6,{as:"h1",children:"Workspace not found"}),(0,oZ.jsx)(oK.gF,{children:(0,oZ.jsx)(lr.zx,{text:"Go to default workspace",onClick:e.onNavigateToDefaultWorkspace,mode:"ghost"})})]})})})}let Dg=(0,oN.createContext)(null),Dx=(0,oN.createContext)(null);function Dv(e){let{config:n,children:r,basePath:i}=e,{workspaces:a}=(0,oN.useMemo)(()=>(function(e,n){if(!Array.isArray(e)&&"missingConfigFile"in e)throw new F6({name:"",type:"configuration file",causes:["No `sanity.config.ts` file found","No `sanity.config.js` file found"]});let r=function(e){let n=e||"";if("string"!=typeof n||n.length>0&&!n.startsWith("/"))throw new F6({name:"",type:"options",causes:["basePath must be a string, and must start with a slash"]});return"/"===n?"":n}(null==n?void 0:n.basePath),i=Array.isArray(e)?e:[e];try{!function(e){let{workspaces:n}=e;if(0===n.length)throw new Dw("At least one workspace is required.");(function(e){let n=1===e.length,r=new Map;e.forEach((e,i)=>{let{name:a,title:o}=e,l=Db(o,i);if(!a&&!n)throw new Dw("All workspaces must have a `name`, unless only a single workspace is defined. "+"Workspace ".concat(l," did not define a `name`."),{workspace:e,index:i});let s=n&&void 0===a?"default":a;if("string"!=typeof s)throw new Dw("Workspace at index ".concat(i," defined an invalid `name` - must be a string."),{workspace:e,index:i});let c=s.toLowerCase(),d=r.get(c);if(d){let n=Db(d.workspace.title,d.index);throw new Dw("`name`s must be unique. Workspace ".concat(n," and ")+"workspace ".concat(l," both have the `name` `").concat(s,"`"),{workspace:e,index:i})}if(r.set(c,{index:i,workspace:e}),!/^[a-z0-9][a-z0-9_-]*$/i.test(s))throw new Dw("All workspace `name`s must consist of only a-z, 0-9, underscore and dashes, and cannot begin with an underscore or dash. "+"Workspace ".concat(l," has the invalid name `").concat(s,"`"),{workspace:e,index:i})})})(n),function(e){e.length>1&&e.every(Dk),e.every(DC);let[n,...r]=e,i=(n.basePath||"/").substring(1).split("/").filter(Boolean).length;r.forEach((e,r)=>{let a=(e.basePath||"/").substring(1).split("/").length;if(i!==a)throw new Dw("All workspace `basePath`s must have the same amount of segments. Workspace `".concat(Dy(n,r),"` had ").concat(i," segment").concat(1===i?"":"s"," `").concat(n.basePath,"` but workspace `").concat(Dy(e,r),"` had ").concat(a," segment").concat(1===a?"":"s"," `").concat(e.basePath,"`"),{workspace:e,index:r})});let a=new Map;e.forEach((e,n)=>{let r=(e.basePath||"").toLowerCase(),i=a.get(r);if(i)throw new Dw("`basePath`s must be unique. Workspaces `".concat(i,"` and ")+"`".concat(Dy(e,n),"` both have the `basePath` `").concat(r,"`"),{workspace:e,index:n});a.set(r,Dy(e,n))})}(n)}({workspaces:i})}catch(e){throw new F6({name:"",type:"workspace",causes:[e.message]})}return{type:"prepared-config",workspaces:i.map(e=>{if(Di.has(e))return Di.get(e);let{unstable_sources:n=[],...i}=e,a=[i,...n].map(e=>{let n;let{projectId:r,dataset:i}=e;try{n=FF({propertyName:"schema.types",config:e,context:{projectId:r,dataset:i},initialValue:[],reducer:FN})}catch(n){throw new F6({name:e.name,type:"source",causes:[n]})}let a=function(e){let n=(0,oq.Fv)(e.types).getTypes(),r=(0,oq._T)(n),i=r.some(e=>e.problems.some(hr)),a=lk.V.compile({name:e.name,types:i?[]:[...e.types,...hi].filter(
1Boolean)});return a._validation=r,a.getTypeNames().forEach(e=>{let n=a.get(e);n&&function e(n,r){if(!r.has(n)){if(r.add(n),n.validation=p6(n),"fields"in n)for(let i of n.fields)e(i.type,r);if("of"in n)for(let i of n.of)e(i,r);if(n.annotations)for(let i of n.annotations)e(i,r)}}(n,new Set)}),a}({name:e.name,types:n}),o=a._validation,l=null==o?void 0:o.filter(e=>e.problems.some(Dr));if(o&&(null==l?void 0:l.length))throw new F9(a);let s=function(e){var n;if(dj(n=e.auth)&&"state"in n&&dj(n.state)&&"subscribe"in n.state&&"function"==typeof n.state.subscribe)return e.auth;let r=e.unstable_clientFactory||lb.eI,{projectId:i,dataset:a,apiHost:o}=e;return hA({apiHost:o,...e.auth,clientFactory:r,dataset:a,projectId:i})}(e),c=function(e){let{projectId:n,dataset:r,name:i}=e,a={projectId:n,dataset:r},o=FF({config:e,context:a,propertyName:"i18n.locales",reducer:FB,initialValue:[pH]}),l=FF({config:e,context:a,propertyName:"i18n.bundles",reducer:FU,initialValue:function(e){let n=[];for(let r of e){if(r.bundles&&!Array.isArray(r.bundles))throw Error("Resource bundle for locale ".concat(r.id," is not an array"));if(r.bundles)for(let e of r.bundles){if("locale"in e&&e.locale!==r.id)throw Error("Resource bundle inside locale ".concat(r.id," has mismatching locale id"));if(!e.namespace)throw Error("Resource bundle for locale ".concat(r.id," is missing namespace"));n.push("locale"in e?e:{...e,locale:r.id})}}return n}(o)});return function(e){let{locales:n,bundles:r,projectId:i,sourceName:a}=e,o=function(e,n,r,i){var a,o;let l=function(e,n){if(!hd)return;let r=localStorage.getItem(F4(e,n));return null!=r?r:void 0}(e,n),s=r.find(e=>e.id===l),c=r[r.length-1],d=null!=(o=null!=(a=null==s?void 0:s.id)?a:c.id)?o:F5.lng;return{...F5,ns:Array.from(i),lng:d,supportedLngs:r.map(e=>e.id)}}(i,a,n,new Set(r.map(e=>e.namespace))),l=(0,lD.Fs)().use(function(e){let{bundles:n}=e;return{type:"backend",init:function(){},read:function(e,r,i){let a=n.filter(n=>n.locale===e&&n.namespace===r);if(0===a.length){i('No translations found for namespace "'.concat(r,'", language "').concat(e,'"'),void 0);return}F1(a).then(e=>i(null,e)).catch(e=>i(e,!0))}}}({bundles:r})).use(li.Db);l.init(o).catch(e=>{console.error("Failed to initialize i18n backend: %s",e)});let s=n.map(F8);return{source:{get currentLocale(){var c;return null!=(c=s.find(e=>e.id===l.language))?c:pH},loadNamespaces(e){let n=e.filter(e=>!l.hasLoadedNamespace(e));return 0===n.length?Promise.resolve():l.loadNamespaces(n)},locales:s,t:dN(l.t)},i18next:l}}({locales:o,bundles:l,projectId:n,sourceName:i})}(e),d=s.state.pipe((0,aW.U)(n=>{let{client:r,authenticated:i,currentUser:o}=n;return function(e){var n,r,i,a,o,l,s;let c,d,u,{config:p,client:h,currentUser:f,schema:m,authenticated:g,auth:x,i18n:v}=e,{dataset:y,projectId:b}=p,j=function(e,n){let{dataset:r,url:i,requestTagPrefix:a="sanity.studio"}=e.withConfig({apiVersion:"2022-06-30"}).config(),o="".concat(i.replace(/\/+$/,""),"/socket/").concat(r).replace(/^http/,"ws"),l="".concat(o,"?tag=").concat(a),s=n.token?{token$:n.token}:{};return(0,lj.W0)(l,s)}(h,x),w=[],k={},C=e=>{if(!e||!e.apiVersion)throw Error("Missing required `apiVersion` option");return k[e.apiVersion]||(k[e.apiVersion]=h.withConfig(e)),k[e.apiVersion]},_={client:h,getClient:C,currentUser:f,dataset:y,projectId:b,schema:m,i18n:v.source};_.client=[...Object.keys(h),...Object.keys(h.__proto__)].reduce((e,n)=>{let r=Object.hasOwnProperty.call(h,n)?h[n]:h.__proto__[n];return Object.defineProperty(e,n,{get:()=>(console.warn('`configContext.client` is deprecated and will be removed in the next release! Use `context.getClient({apiVersion: "2021-06-07"})` instead'),r)})},{});try{c=FF({config:p,context:_,propertyName:"schema.templates",reducer:FK,initialValue:m.getTypeNames().filter(e=>!/^sanity\./.test(e)).map(e=>m.get(e)).filter(dd).filter(e=>{var n;return(null==(n=e.type)?void 0:n.name)==="document"}).map(e=>({id:e.name,schemaType:e.name,title:e.title||e.name,icon:e.icon,value:e.initialValue||{_type:e.name}}))})}catch(e){throw new F6({name:p.name,type:"source",causes:[e]})}try{d=FF({config:p,context:_,initialValue:[],propertyName:"tools",reducer:FV}
1)}catch(e){throw new F6({name:p.name,type:"source",causes:[e]})}if(d.some(e=>{let{name:n}=e;return"tool"===n}))throw Error('A tool cannot have the name "tool". Please enter a different name.');let T=c.filter(e=>{var n;return!(null==(n=e.parameters)?void 0:n.length)}).map(e=>({templateId:e.id,description:e.description,icon:e.icon,title:e.title})),S=c.reduce((e,n)=>(e.set(n.id,n),e),new Map),E=e=>{let{schemaType:n}=e,r=FF({config:p,context:{..._,creationContext:e},initialValue:T,propertyName:"document.resolveNewDocumentOptions",reducer:FW}),i=[];if(i.length)throw new F6({name:p.name,type:"source",causes:i});return r.map((e,n)=>{let r=S.get(e.templateId);if(!r)throw Error("Could not find template with ID `".concat(e.templateId,"`"));let i=m.get(r.schemaType);if(!i)throw Error("Could not find matching schema type `".concat(r.schemaType,"` for template `").concat(r.id,"`"));let a=e.title||r.title,o=(null==i?void 0:i.title)===a?void 0:null==i?void 0:i.title;return{id:"".concat(e.templateId,"-").concat(n),templateId:e.templateId,type:"initialValueTemplateItem",title:a,i18n:e.i18n||r.i18n,subtitle:e.subtitle||o,description:e.description||r.description,icon:e.icon||r.icon||(null==i?void 0:i.icon),initialDocumentId:e.initialDocumentId,parameters:e.parameters,schemaType:r.schemaType}}).filter(r=>{var i;return!n||"document"===e.type||n===(null==(i=S.get(r.templateId))?void 0:i.schemaType)})};try{u=E({type:"global"})}catch(e){w.push(e)}if(w.length)throw new F6({name:p.name,type:"source",causes:w});return{type:"source",name:p.name,title:p.title||lf()(p.name),schema:m,getClient:C,dataset:y,projectId:b,tools:d,currentUser:f,authenticated:g,templates:c,auth:x,i18n:v.source,document:{actions:e=>FF({config:p,context:{..._,...e},initialValue:Fq,propertyName:"document.actions",reducer:F$}),badges:e=>FF({config:p,context:{..._,...e},initialValue:FD,propertyName:"document.badges",reducer:FH}),unstable_fieldActions:e=>FF({config:p,context:{..._,...e},initialValue:pc,propertyName:"document.unstable_fieldActions",reducer:ps}),inspectors:e=>FF({config:p,context:{..._,...e},initialValue:dy,propertyName:"document.inspectors",reducer:FJ}),resolveProductionUrl:e=>FF({config:p,context:{..._,...e},initialValue:void 0,propertyName:"resolveProductionUrl",asyncReducer:FL}),resolveNewDocumentOptions:E,unstable_languageFilter:e=>FF({config:p,context:{..._,...e},initialValue:FZ,propertyName:"document.unstable_languageFilter",reducer:FG}),unstable_comments:{enabled:e=>FQ({context:e,config:p,initialValue:!0})}},form:{file:{assetSources:FF({config:p,context:_,initialValue:[MG],propertyName:"formBuilder.file.assetSources",reducer:FY}),directUploads:(null==(r=null==(n=p.form)?void 0:n.file)?void 0:r.directUploads)===void 0||p.form.file.directUploads},image:{assetSources:FF({config:p,context:_,initialValue:[MJ],propertyName:"formBuilder.image.assetSources",reducer:FX}),directUploads:(null==(a=null==(i=p.form)?void 0:i.image)?void 0:a.directUploads)===void 0||p.form.image.directUploads}},search:{filters:MQ,operators:Fz,unstable_partialIndexing:{enabled:F0({config:p,initialValue:null!=(s=null==(l=null==(o=p.search)?void 0:o.unstable_partialIndexing)?void 0:l.enabled)&&s})}},__internal:{bifur:j,i18next:v.i18next,staticInitialValueTemplateItems:u,options:p}}}({config:e,client:r,currentUser:o,schema:a,authenticated:i,auth:s,i18n:c})}),(0,aJ.d)(1));return{name:e.name,projectId:e.projectId,dataset:e.dataset,title:e.title||lf()(e.name),auth:s,schema:a,i18n:c.source,source:d}}),o=i.title||lf()(i.name),l={type:"workspace-summary",auth:a[0].auth,basePath:function(e,n){let r=[e,n||""].map(e=>e.replace(/^\/+/g,"").replace(/\/+$/g,"")).filter(Boolean).join("/");return"/".concat(r)}(r,i.basePath),dataset:i.dataset,schema:a[0].schema,i18n:a[0].i18n,customIcon:!!i.icon,icon:function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return(0,lw.isValidElementType)(e)?(0,oN.createElement)(e):(0,oN.isValidElement)(e)?e:function(e,n){let r=Dt("".concat(e," ").concat(n)),i=sx.mE.filter(e=>"gray"!==e),a=i[Math.floor(r*i.length)],o=["300","400","500","600","700"],l=o[Math.floor(Dt(r.toString())*o.length)],s=sx.VG[a][l].hex,c=e.split(/\s/g).map(e=>
1e.replace(/\\W/g,"")).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()),d=(0,cz._j)(s,.4),u=(0,cz.$n)(s,.4),p=(0,cz.WC)(s,"readable",d)?(0,cz.WC)(s,"readable",u)?(0,cz.XV)(s):u:d;return(0,oZ.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:[(0,oZ.jsx)("rect",{width:32,height:32,rx:2,fill:s}),(0,oZ.jsx)(Dn,{x:"50%",y:"50%",textAnchor:"middle",alignmentBaseline:"middle",dominantBaseline:"middle",fill:p,children:c})]})}(n,r)}(i.icon,o,"".concat(i.projectId," ").concat(i.dataset)),name:i.name||"default",projectId:i.projectId,theme:i.theme||oK.Lg,title:o,subtitle:i.subtitle,__internal:{sources:a}};return Di.set(e,l),l})}})(n,{basePath:i}),[n,i]);return(0,oZ.jsx)(Dx.Provider,{value:a,children:r})}function Dy(e,n){let{name:r,title:i}=e;return"string"==typeof r&&r.trim().length>0?r:Db(i,n)}function Db(e,n){let r="string"==typeof e&&e.trim().length>0?' (titled "'.concat(e,'")'):"";return"at index ".concat(n).concat(r)}function Dj(){let e=(0,oN.useContext)(Dx);if(!e)throw Error("Could not find `workspaces` context");return e}class Dw extends Error{constructor(e,n){super(e),this.index=null==n?void 0:n.index,this.identifier=(null==n?void 0:n.workspace)&&Dy(n.workspace,n.index)}}function Dk(e,n){let{name:r,basePath:i}=e;if(i&&"string"==typeof i)return!0;if(void 0===i)throw new Dw("If more than one workspace is defined, every workspace must have a `basePath` defined. "+"Workspace `".concat(r,"` is missing a `basePath`"),{workspace:e,index:n});throw new Dw("If more than one workspace is defined, every workspace must have a `basePath` defined. "+"Workspace `".concat(r,"` has an invalid `basePath` (must be a non-empty string)"),{workspace:e,index:n})}function DC(e,n){let{name:r,basePath:i}=e;if(i&&"/"!==i&&!/^\/[a-z0-9/_-]*[a-z0-9_-]+$/i.test(i))throw new Dw("All workspace `basePath`s must start with a leading `/`, consist of only URL safe characters, and cannot end with a trailing `/`. "+"Workspace `".concat(r,"`'s basePath is `").concat(i,"`"),{workspace:e,index:n})}let D_=(0,oN.createContext)(null);function DT(e){let{children:n,history:r}=e;return(0,oZ.jsx)(D_.Provider,{value:r,children:n})}let DS=(0,oN.memo)(function(e){let{children:n,history:r,activeWorkspace:i,setActiveWorkspace:a}=e,o=(0,oN.useMemo)(()=>({activeWorkspace:i,setActiveWorkspace:a}),[i,a]);return(0,oZ.jsx)(Dg.Provider,{value:o,children:(0,oZ.jsx)(DT,{history:r,children:n})})}),DE=()=>"undefined"==typeof document?(0,lZ.PP)():(0,lZ.lX)();function DP(e){let{children:n,LoadingComponent:r,NotFoundComponent:i,unstable_history:a}=e,o=Dj(),l=(0,oN.useMemo)(()=>a||DE(),[a]),s=(0,oN.useCallback)(e=>{let n=o.find(n=>n.name===e);n&&l.push(n.basePath)},[l,o]),c=(0,oN.useCallback)(()=>{s(o[0].name)},[s,o]),d=function(e,n){let r=(0,oN.useMemo)(()=>n.map(e=>{let n=e.basePath||"/";return{workspace:e,name:e.name,basePath:n,basePathRegex:RegExp("^".concat(lV()(n),"(\\/|$)"),"i")}}),[n]),i=(0,oN.useMemo)(()=>(function(e){let n=e.map(e=>e.basePath.substring(1).split("/")).reduce((e,n)=>{for(let r=0;r<e.length;r++)if(e[r]!==n[r].toLowerCase())return e.slice(0,r);return e});return RegExp("^".concat(function e(n){let[r,...i]=n;return r?"(\\/".concat(lV()(r)).concat(e(i),"(\\/|$))?"):""}(n),"$"),"i")})(r),[r]),[a]=(0,oN.useState)(()=>e.location.pathname),o=(0,oN.useMemo)(()=>({subscribe:n=>e.listen(n),getSnapshot:()=>e.location.pathname,getServerSnapshot:()=>a,selector:e=>(function(e){let{pathname:n,workspaces:r,basePathRegex:i}=e,[a]=r;for(let{workspace:e,basePath:i,basePathRegex:a}of r)if(a.test(n)||"/"===i)return{type:"match",workspace:e};return"/"===n||i.test(n)?{type:"redirect",pathname:a.basePath}:{type:"not-found"}})({basePathRegex:i,pathname:e,workspaces:r}),isEqual:(e,n)=>{if(e.type!==n.type)return!1;switch(e.type){case"match":return e.workspace===n.workspace;case"redirect":return e.pathname===n.pathname;case"not-found":return!0;default:throw Error("Unknown type: ".concat(e.type))}}}),[i,e,a,r]);return(0,lN.useSyncExternalStoreWithSelector)(o.subscribe,o.getSnapshot,o.getServerSnapshot,o.selector,o.isEqual)}(l,o);switch((0,oN.useEffect)(()=>{"redirect"===d.type&&l.replace(d.pathname)},[l,d]),d.type){case"match":return(0,oZ.jsx)(DS,{activeWorkspace:d.workspace,history:l,setActiveWorkspace:s,children:n});case"redirect":return(0,oZ.jsx)(r,{});case"not-found":return(0,oZ.jsx)(i,{onNavigateToDefaultWorkspace:c});default:throw Error("Unknown type: ".concat(d.type))}}function DO(){let e=(0,oN.useContext)(Dg);if(!e)throw Error("Could not find `ActiveWorkspaceMatcher` context");return e}var DA=Object.freeze,DI=Object.defineProperty;let Dz={"logged-in":"","logged-out":"Signed out","no-access":""},DM=oV.ZP.div(ic||(ic=DA(DI(ec=["\n  width: ",";\n  height: ",";\n\n  svg {\n    width: 100%;\n    height: 100%;\n  }\n"],"raw",{value:DA(ec.slice())}))),e=>"small"===e.$size?"25px":"41px",e=>"small"===e.$size?"25px":"41px"),DR=e=>{let{icon:n,size:r="small"}=e,i=(0,oN.useMemo)(()=>DF(n),[n]);return(0,oZ.jsx)(DM,{$size:r,children:i})},DF=e=>(0,lw.isValidElementType)(e)?(0,oN.createElement)(e):(0,oN.isValidElement)(e)?e:void 0;function DD(e){let{state:n,subtitle:r,selected:i,title:a,icon:o,iconRight:l}=e,s=(0,oN.useMemo)(()=>DF(l),[l]);return(0,oZ.jsxs)(oK.kC,{align:"center",flex:"none",gap:3,children:[(0,oZ.jsx)(DR,{icon:o,size:"small"}),(0,oZ.jsxs)(oK.Kq,{flex:1,space:2,children:[(0,oZ.jsx)(oK.xv,{size:1,textOverflow:"ellipsis",weight:"medium",children:a}),r&&(0,oZ.jsx)(oK.xv,{muted:!0,size:1,textOverflow:"ellipsis",children:r})]}),n&&Dz[n]&&(0,oZ.jsx)(oK.xu,{paddingLeft:1,children:(0,oZ.jsx)(oK.xv,{size:1,muted:!0,textOverflow:"ellipsis",children:Dz[n]})}),(i||s)&&(0,oZ.jsxs)(oK.kC,{align:"center",gap:4,paddingLeft:3,paddingRight:2,children:[i&&(0,oZ.jsx)(oK.xv,{children:(0,oZ.jsx)(lp.KML,{})}),s&&(0,oZ.jsx)(oK.xv,{muted:!0,children:s})]})]})}let Dq=dc(e=>(0,oE.a)(e.map(e=>e.auth.state.pipe((0,aW.U)(n=>[e.name,n])))).pipe((0,aW.U)(e=>Object.fromEntries(e))));var DZ=Object.freeze,DN=Object.defineProperty;
1let DL=[{url:"https://slack.sanity.io/",i18nKey:"workspaces.community-title",title:"Community"},{url:"https://www.sanity.io/docs",i18nKey:"workspaces.docs-title",title:"Docs"},{url:"https://www.sanity.io/legal/privacy",i18nKey:"workspaces.privacy-title",title:"Privacy"},{url:"https://www.sanity.io",i18nKey:"workspaces.sanity-io-title",title:"sanity.io"}],DV=(0,oV.ZP)(oK.xv)(id||(id=DZ(DN(ed=["\n  a {\n    color: inherit;\n  }\n"],"raw",{value:DZ(ed.slice())}))));function DK(e){let{children:n,footer:r,header:i}=e;return dV(),(0,oZ.jsxs)(oK.Kq,{space:6,children:[(0,oZ.jsx)(oK.Zb,{border:!0,radius:3,overflow:"auto",children:(0,oZ.jsxs)(oK.Kq,{children:["object"==typeof i&&(0,oZ.jsx)(oK.xu,{children:i}),"string"==typeof i&&(0,oZ.jsx)(oK.xu,{paddingY:4,children:(0,oZ.jsx)(oK.X6,{align:"center",size:1,children:i})}),(0,oZ.jsx)(oK.xu,{paddingX:1,children:(0,oZ.jsx)(oK.Zb,{borderTop:!!i,borderBottom:!!r,children:n})}),r&&(0,oZ.jsx)(oK.xu,{children:r})]})}),(0,oZ.jsxs)(oK.kC,{direction:"column",gap:4,justify:"center",align:"center",paddingBottom:4,children:[(0,oZ.jsx)(oK.xv,{size:3,children:(0,oZ.jsx)(cW.hn,{})}),(0,oZ.jsx)(oK.kC,{align:"center",gap:2,children:DL.map((e,n)=>(0,oZ.jsxs)(oN.Fragment,{children:[(0,oZ.jsx)(DV,{muted:!0,size:1,children:(0,oZ.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:e.title})}),n<DL.length-1&&(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:"•"})]},e.title))})]})]})}function DB(){var e;let n=Dj(),{activeWorkspace:r,setActiveWorkspace:i}=DO(),[a]=Dq(n),[o,l]=(0,oN.useState)((null==r?void 0:r.name)||null),s=1===n.length?n[0]:n.find(e=>e.name===o),c=null==(e=null==s?void 0:s.auth)?void 0:e.LoginComponent,d=(0,oN.useCallback)(()=>l(null),[]),{t:u}=dV();return a?c&&s?(0,oZ.jsxs)(oK.Kq,{space:2,children:[n.length>1&&(0,oZ.jsx)(oK.kC,{children:(0,oZ.jsx)(lr.zx,{icon:lp.Y4O,mode:"bleed",onClick:d,text:u("workspaces.action.choose-another-workspace")})}),(0,oZ.jsx)(DK,{header:(0,oZ.jsx)(oK.xu,{padding:3,children:(0,oZ.jsx)(DD,{icon:s.icon,title:s.title,subtitle:null==s?void 0:s.subtitle})}),children:(0,oZ.jsx)(oK.Kq,{padding:2,paddingBottom:3,paddingTop:4,children:(0,oN.createElement)(c,{...sH()(s,["type","__internal"]),key:o})})})]}):(0,oZ.jsx)(DK,{header:u("workspaces.choose-your-workspace-label"),footer:(0,oZ.jsx)(oK.Kq,{padding:1,children:(0,oZ.jsx)(lr.zx,{as:"a",href:"https://beta.sanity.io/docs/platform/studio/config/workspaces",icon:lp.dtP,mode:"bleed",rel:"noopener noreferrer",size:"large",target:"__blank",text:u("workspaces.action.add-workspace")})}),children:(0,oZ.jsx)(oK.Kq,{space:1,paddingX:1,paddingY:2,children:n.map(e=>{let n=a[e.name].authenticated?"logged-in":e.auth.LoginComponent?"logged-out":"no-access";return(0,oZ.jsx)(oK.Zb,{as:"button",radius:2,padding:2,onClick:()=>{"logged-in"===n&&e.name!==r.name&&i(e.name),"logged-out"===n&&l(e.name)},children:(0,oZ.jsx)(DD,{icon:null==e?void 0:e.icon,iconRight:lp.XCv,state:n,subtitle:null==e?void 0:e.subtitle,title:(null==e?void 0:e.title)||e.name})},e.name)})})}):(0,oZ.jsx)(u4,{showText:!0})}var DU=Object.freeze,DH=Object.defineProperty;let D$=(0,oV.ZP)(oK.v2)(iu||(iu=DU(DH(eu=["\n  max-width: 350px;\n  min-width: 250px;\n"],"raw",{value:DU(eu.slice())})))),DW={constrainSize:!0,fallbackPlacements:["bottom-end","bottom"],placement:"bottom-end"};function DY(){let e=Dj(),{activeWorkspace:n,setActiveWorkspace:r}=DO(),[i]=Dq(e),{navigateUrl:a}=(0,lm.tv)(),{t:o}=dV();if(!(e.length>1))return null;let l=!i;return(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(oK.kC,{children:(0,oZ.jsx)(lr.u,{content:o("workspaces.select-workspace-tooltip"),disabled:l,portal:!0,children:(0,oZ.jsx)(oK.zx,{disabled:l,mode:"bleed",padding:2,width:"fill",children:(0,oZ.jsxs)(oK.kC,{align:"center",gap:2,children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{size:1,textOverflow:"ellipsis",weight:"medium",children:n.title})}),(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(lp.v4q,{})})]})})})}),id:"workspace-menu",menu:!l&&i?(0,oZ.jsx)(D$,{children:e.map(e=>{let o=i[e.name].authenticated?"logged-in":e.auth.LoginComponent?"logged-out":"no-access",l=e.name===n.name;return(0,oZ.jsx)(lr.sN,{badgeText:Dz[o],iconRight:l?lp.KML:void 0,onClick:()=>{"logged-in"===o&&e.name!==n.name&&r(e.name),"logged-out"===o&&a({path:e.basePath})},pressed:l,preview:(0,oZ.jsx)(DR,{icon:e.icon,size:"small"}),selected:l,text:(null==e?void 0:e.title)||e.name,tooltipProps:(null==e?void 0:e.subt
1itle)?{content:e.subtitle,placement:"right"}:void 0},e.name)})}):void 0,popover:DW})}function DX(){return(0,oZ.jsx)(oK.Zb,{height:"fill",overflow:"auto",paddingX:4,children:(0,oZ.jsx)(oK.kC,{height:"fill",direction:"column",align:"center",justify:"center",paddingTop:4,children:(0,oZ.jsx)(oK.W2,{width:0,children:(0,oZ.jsx)(DB,{})})})})}function DG(){return(0,oZ.jsx)(oZ.Fragment,{children:"TODO: implement config errors screen"})}function DJ(){let[e,n]=(0,oN.useState)(null),[r,i]=(0,oN.useState)(null);if(r)throw r;let{activeWorkspace:a}=DO(),o=(0,oN.useCallback)(()=>{var e,n;null==(n=(e=a.auth).logout)||n.call(e)},[a]);(0,oN.useEffect)(()=>{let e=a.auth.state.subscribe({next:e=>{let{currentUser:r}=e;n(r)},error:i});return()=>{e.unsubscribe()}},[a]);let l=hI(null==e?void 0:e.provider);return(0,oZ.jsx)(oK.Zb,{height:"fill",children:(0,oZ.jsx)(lr.Vq,{id:"not-authorized-dialog",header:"Not authorized",width:1,footer:{confirmButton:{text:"Sign out",onClick:o,tone:"default"}},children:(0,oZ.jsxs)(oK.Kq,{space:4,children:[(0,oZ.jsx)(oK.xv,{children:"You are not authorized to access this studio. Maybe you could ask someone to invite you to collaborate on this project?"}),(0,oZ.jsxs)(oK.xv,{children:["If you think this is an error, verify that you are signed in with the correct account. You are currently signed in as"," ",(0,oZ.jsxs)("strong",{children:[null==e?void 0:e.name," (",null==e?void 0:e.email,")"]}),l?" through ".concat(l):"","."]})]})})})}var DQ=Object.freeze,D0=Object.defineProperty;let D1=oV.ZP.label(ip||(ip=DQ(D0(ep=["\n  clip: rect(0 0 0 0);\n  clip-path: inset(50%);\n  height: 1px;\n  overflow: hidden;\n  overflow: clip;\n  position: absolute;\n  white-space: nowrap;\n  width: 1px;\n"],"raw",{value:DQ(ep.slice())}))));function D2(e){let{projectId:n}=e,r=window.location.origin,i=(0,oN.useMemo)(()=>{let e=new URL("https://sanity.io/manage/project/".concat(n,"/api"));return e.searchParams.set("cors","add"),e.searchParams.set("origin",r),e.searchParams.set("credentials",""),e.toString()},[r,n]);return(0,oN.useEffect)(()=>{let e=()=>{window.location.reload()};return window.addEventListener("focus",e),()=>{window.removeEventListener("focus",e)}},[]),(0,oZ.jsx)(oK.Zb,{height:"fill",children:(0,oZ.jsx)(lr.Vq,{id:"cors-error-dialog",header:"Before you continue...",width:1,footer:{confirmButton:{text:"Continue",iconRight:lp.buG,as:"a",href:i,target:"_blank",rel:"noopener noreferrer",tone:"primary"}},children:(0,oZ.jsxs)(oK.Kq,{space:4,children:[(0,oZ.jsxs)(oK.xv,{children:["To access your content, you need to ",(0,oZ.jsx)("b",{children:"add the following URL as a CORS origin"})," to your Sanity project."]}),(0,oZ.jsx)(D1,{"aria-hidden":"true",children:"CORS URL to be added"}),(0,oZ.jsx)(oK.oi,{value:r,readOnly:!0})]})})})}function D3(e){let{children:n,AuthenticateComponent:r=DX,LoadingComponent:i=u4,NotAuthenticatedComponent:a=DJ}=e,[o,l]=(0,oN.useState)(null);if(o)throw o;let[s,c]=(0,oN.useState)("loading"),{activeWorkspace:d}=DO();return((0,oN.useEffect)(()=>{var e,n;null==(n=(e=d.auth).handleCallbackUrl)||n.call(e).catch(l)},[d.auth]),(0,oN.useEffect)(()=>{let e=d.auth.state.subscribe({next:e=>{var n;let{authenticated:r,currentUser:i}=e;if((null==(n=null==i?void 0:i.roles)?void 0:n.length)===0){c("unauthorized");return}c(r?"logged-in":"logged-out")},error:l});return()=>{e.unsubscribe()}},[d]),"loading"===s)?(0,oZ.jsx)(i,{}):"unauthorized"===s?(0,oZ.jsx)(a,{}):"logged-out"===s?(0,oZ.jsx)(r,{}):(0,oZ.jsx)(oZ.Fragment,{children:n})}let D4=(0,oL.fi)(),D5=(0,oN.createContext)(null),D8=(0,oN.createContext)(null);function D6(){return(0,oK.ue)()?"dark":"light"}function D9(e){let{children:n,scheme:r}=e,i=D6();return(0,oZ.jsx)(oK.f6,{scheme:"system"===r?i:r,theme:oK.Lg,children:n})}let D7="sanityStudio:ui:colorScheme";function qe(e){let{children:n,onSchemeChange:r,scheme:i}=e;return i?(0,oZ.jsx)(qr,{scheme:i,onSchemeChange:r,children:n}):(0,oZ.jsx)(qt,{onSchemeChange:r,children:n})}function qt(e){let{children:n,onSchemeChange:r}=e,i=(0,oN.useMemo)(()=>{let e;let n=new Set;return{subscribe:r=>(e||(e=qn(localStorage.getItem(D7))||"system"),n.add(r),()=>{n.delete(r)}),getSnapshot:()=>e,setSnapshot:r=>{for(let i of(e=qn(r),n))i()},getServerSnapshot:()=>"system"}},[]),a=(0,oN.useSyncExternalStore)(i.subscribe,i.getSnapshot,i.getServerSnapshot);return(0,oN.useEffect)(()=>{"function"==typeof r&&r(a),localStorage.setItem(D7,a)},[r,a]),(0,oZ.jsx)(D8.Provider,{value:i.setSnapshot,children:(0,oZ.jsx)(D5.Provider,{value:a,children:(0,oZ.jsx)(D9,{scheme:a,children:n})})})}function qn(e){switch(e){case"dark":case"light":return e;default:return"system"}}function qr(e){let{children:n,onSchemeChange:r,scheme:i}=e;return(0,oZ.jsx)(D8.Provider,{value:"function"==typeof r&&r,children:(0,oZ.jsx)(D5.Provider,{value:i,children:(0,oZ.jsx)(D9,{scheme:i,children:n})})})}function qi(){let e=(0,oN.useContext)(D8);if(null===e)throw Error("Could not find `ColorSchemeSetValueContext` context");return e}function qa(){let e=(0,oN.useContext)(D5);if(null===e)throw Error("Could not find `ColorSchemeValueContext` context");return e}function qo(){let e=qa(),n=D6();return"system"===e?n:e}function ql(){let e=qo(),n=qi();return(0,oN.useMemo)(()=>({scheme:e,setScheme:n}),[e,n])}function qs(e,n){let r=qa();return(0,oN.useMemo)(()=>[{title:n("user-menu.color-scheme.system-title"),name:"system",label:n("user-menu.color-scheme.system-description"),selected:"system"===r,onSelect:()=>e("system"),icon:lp.ugZ}
1,{title:n("user-menu.color-scheme.dark-title"),name:"dark",label:n("user-menu.color-scheme.dark-description"),selected:"dark"===r,onSelect:()=>e("dark"),icon:lp.kLh},{title:n("user-menu.color-scheme.light-title"),name:"light",label:n("user-menu.color-scheme.light-description"),selected:"light"===r,onSelect:()=>e("light"),icon:lp.NWY}],[r,e,n])}let qc=e=>!0===e.__themer;function qd(e){var n,r;return{...D4,v2:e.v2,fonts:qc(e)?D4.fonts:null!=(n=e.fonts)?n:D4.fonts,color:null!=(r=e.color)?r:D4.color}}function qu(e){let{children:n}=e,r=DO().activeWorkspace.theme;if(r.__legacy){let e=r.__dark?"dark":"light";return(0,oZ.jsx)(D8.Provider,{value:!1,children:(0,oZ.jsx)(D5.Provider,{value:e,children:(0,oZ.jsx)(oK.f6,{scheme:e,theme:qd(r),children:(0,oZ.jsx)(oK.li,{children:n})})})})}return(0,oZ.jsx)(oK.f6,{theme:qd(r),children:(0,oZ.jsx)(oK.li,{children:n})})}function qp(e){let{children:n,heading:r="An error occured"}=e,[{error:i},a]=(0,oN.useState)({error:null}),o=dj(i)&&"string"==typeof i.message&&i.message,l=dj(i)&&"string"==typeof i.stack&&i.stack,s=(0,oN.useCallback)(()=>a({error:null}),[a]);return((0,cQ.H)(s),i instanceof hc)?(0,oZ.jsx)(D2,{projectId:null==i?void 0:i.projectId}):i instanceof F9?(0,oZ.jsx)(Df,{schema:i.schema}):i?(0,oZ.jsx)(oK.Zb,{height:"fill",overflow:"auto",paddingY:[4,5,6,7],paddingX:4,sizing:"border",tone:"critical",children:(0,oZ.jsx)(oK.W2,{width:3,children:(0,oZ.jsxs)(oK.Kq,{space:4,children:[(0,oZ.jsx)(oK.X6,{children:r}),(0,oZ.jsx)("div",{children:(0,oZ.jsx)(lr.zx,{onClick:s,text:"Retry",tone:"default"})}),(0,oZ.jsx)(oK.Zb,{border:!0,radius:2,overflow:"auto",padding:4,tone:"inherit",children:(0,oZ.jsxs)(oK.Kq,{space:4,children:[o&&(0,oZ.jsx)(oK.EK,{size:1,children:(0,oZ.jsxs)("strong",{children:["Error: ",o]})}),l&&(0,oZ.jsx)(oK.EK,{size:1,children:l})]})})]})})}):(0,oZ.jsx)(oK.SV,{onCatch:a,children:n})}let qh={toast:[100,11e3]};var qf=Object.freeze,qm=Object.defineProperty,qg=(e,n)=>qf(qm(e,"raw",{value:qf(n||e.slice())}));function qx(e){let n={}.toolSwitcher||{},r=n.order||[],i=n.hidden||[];if(!r.length&&!i.length)return e;let a=e.reduce((e,n)=>{let i=n.title||"<unknown>";if(!n.name)return console.warn('Tool "'.concat(i,'" does not have the required "name" property')),e;if(e[n.name]){let r=e[n.name].tool.title;return console.warn('Tools with duplicate name "'.concat(n.name,'" found ("').concat(i,'" and "').concat(r,'")')),e}let a=r.indexOf(n.name);return e[n.name]={tool:n,index:-1===a?1/0:a},e},{}),o=e.filter(e=>-1===i.indexOf(e.name));return o.sort((e,n)=>{let r=a[e.name],i=a[n.name],o=r?r.index:1/0,l=i?i.index:1/0;return o===l?0:o-l}),o}(0,oV.ZP)(oK.kC)(ih||(ih=qg([""]))),(0,oV.ZP)(oK.xu).attrs({padding:4})(im||(im=qg([""])));let qv=["template"],qy=["mode"];function qb(e){let{children:n,LoadingComponent:r,workspace:i}=e,{basePath:a,tools:o}=i,l=function(){let e=(0,oN.useContext)(D_);if(!e)throw Error("Could not find `RouterHistoryProvider` context");return e}(),s=(0,oN.useMemo)(()=>(function(e){let{basePath:n="/",tools:r}=e,i=lm.BC.create("/:tool",e=>{let n=r.find(n=>n.name===e.tool);return n||"desk"!==e.tool||(n=r.find(e=>"structure"===e.name)),n?lm.BC.scope(n.name,"/",n.router):lm.BC.create("/")});return lm.BC.create(n,[lm.BC.intents("/intent"),i])})({basePath:a,tools:o}),[a,o]),[c,d]=function(e,n,r){var i;let a=(0,oN.useMemo)(()=>{let r=n.getBasePath(),i=RegExp("^".concat(lV()(r),"(\\/|$)"),"i"),a=e=>"/"===r||i.test(e);return{subscribe:n=>e.listen(n),getSnapshot:()=>"".concat(e.location.pathname).concat(e.location.search||""),getServerSnapshot:()=>null,selector:e=>"string"==typeof e&&a(e)?{type:"state",state:n.decode(e)||{},isNotFound:n.isNotFound(e)}:null}},[e,n]),o=(0,lN.useSyncExternalStoreWithSelector)(a.subscribe,a.getSnapshot,a.getServerSnapshot,a.selector,o7()),l=(0,oN.useRef)(o);(0,oN.useEffect)(()=>{var i,a;if((null==o?void 0:o.type)==="state"&&!(null==(i=o.state)?void 0:i.intent)){let i=function(e,n){let r=qx(e)[0];return n&&!n.tool&&r?Object.assign({},n,{tool:r.name}):n}(r,(a=o.state)&&qx(r).find(e=>e.name===a.space)?{...a,tool:a.space,space:void 0}:a);i&&i!==o.state&&e.replace(n.encode(i))}},[null==o?void 0:o.state,null==o?void 0:o.type,e,n,r]),(0,oN.useEffect)(()=>{let i=qj(o,n,r,l);i?e.replace(i):l.current=o},[o,e,n,r]);let s=(0,oN.useMemo)(()=>i=>{let{path:o,replace:s}=i,c=qj(a.selector(o),n,r,l),d="string"==typeof c?c:o;s?e.replace(d):e.push(d)},[e,n,a,r]);
1return[null!=(i=null==o?void 0:o.state)?i:null,s]}(l,s,o);return c?(0,oZ.jsx)(lm.pG,{onNavigate:d,router:s,state:c,children:n}):(0,oZ.jsx)(r,{})}function qj(e,n,r,i){var a,o;if((null==e?void 0:e.type)==="state"&&(null==(a=e.state)?void 0:a.intent)){let a=function(e,n,r){var i;let{intent:a,params:o,payload:l}=r;if("string"!=typeof a)throw Error("intent must be a string");if(!dj(o))throw Error("intent params must be a string");let s=qx(e),c=(null==n?void 0:n.tool)?s.find(e=>e.name===n.tool):null,d=c?s.filter(e=>e!==c):s,u=[];"create"===a?u=qv:"edit"===a&&(u=qy);let{tool:p}=(c?[c,...d]:s).reduce((e,r)=>{if(!r||"function"!=typeof r.canHandleIntent)return e;let i=r.canHandleIntent(a,o,n&&n[r.name]);if("boolean"==typeof i)return i&&e.score<0?{score:0,tool:r}:e;if(!dj(i))return e;let l=u.reduce((e,n)=>n in o&&!0===i[n]?e+1:e,0);return l>e.score?{score:l,tool:r}:e},{score:-1,tool:null});if(null==p?void 0:p.getIntentState){let{_searchParams:e,...r}=p.getIntentState(a,o,n&&n[p.name],l),s={...n,tool:p.name,[p.name]:r};return(null==(i=p.router)?void 0:i.__unsafe_disableScopedSearchParams)?s._searchParams=e:r._searchParams=e,{type:"state",isNotFound:!1,state:s}}return{type:"intent",isNotFound:!0,intent:{name:a,params:o}}}(r,(null==(o=i.current)?void 0:o.type)==="state"?i.current.state:{},e.state);if((null==a?void 0:a.type)==="state")return n.encode(a.state)}return null}function qw(e){let{children:n,LoadingComponent:r}=e,[i,a]=(0,oN.useState)(null);if(i)throw i;let{activeWorkspace:o}=DO(),[l,s]=(0,oN.useState)(null);return((0,oN.useEffect)(()=>{let e=(0,oE.a)(o.__internal.sources.map(e=>{let{source:n}=e;return n.pipe((0,aG.K)(e=>{if(e instanceof F6)return(0,og.of)(e);throw e}))})).pipe((0,aW.U)(e=>{let n=e.filter(e=>e instanceof F6);if(n.length)throw new F6({name:o.name,causes:n,type:"workspace"});return e}),(0,aW.U)(e=>{let[n,...r]=e;return{...o,...n,unstable_sources:[n,...r],type:"workspace"}})).subscribe({next:s,error:a});return()=>e.unsubscribe()},[o]),l)?(0,oZ.jsx)(Se,{workspace:l,children:(0,oZ.jsx)(RO,{source:l.unstable_sources[0],children:(0,oZ.jsx)(qb,{LoadingComponent:r,workspace:l,children:n})})}):(0,oZ.jsx)(r,{})}function qk(e){let{ConfigErrorsComponent:n,...r}=e,[{error:i},a]=(0,oN.useState)({error:null});if(i)throw i;return(0,oZ.jsx)(oK.SV,{onCatch:a,children:(0,oZ.jsx)(qw,{...r})})}let qC="3.26.1",q_=(0,sB.ql)();function qT(e){let n=hN({apiVersion:"v2023-12-18"}),r=n.config().projectId,i=(0,oN.useMemo)(()=>(0,sB._o)(q_,{flushInterval:3e4,resolveConsent:()=>n.request({uri:"/intake/telemetry-status"}),sendEvents:e=>n.request({uri:"/intake/batch",method:"POST",json:!0,body:{projectId:r,batch:e}}),sendBeacon:e=>navigator.sendBeacon(n.getUrl("/intake/batch"),JSON.stringify({projectId:r,batch:e}))}),[n,r]);return(0,oN.useEffect)(()=>{i.logger.updateUserProperties({studioVersion:qC,plugins:c1()(e.config).flatMap(e=>{var n;return(null==(n=e.plugins)?void 0:n.flatMap(e=>({name:e.name})))||[]})})},[e.config,i.logger]),(0,oZ.jsx)(sK.Yi,{store:i,children:e.children})}function qS(e){let{children:n,config:r,basePath:i,onSchemeChange:a,scheme:o,unstable_history:l,unstable_noAuthBoundary:s}=e,c=(0,oZ.jsx)(qk,{LoadingComponent:u4,ConfigErrorsComponent:DG,children:(0,oZ.jsx)(qT,{config:r,children:(0,oZ.jsx)(VK,{children:(0,oZ.jsx)(hl,{children:n})})})});return(0,oZ.jsx)(qe,{onSchemeChange:a,scheme:o,children:(0,oZ.jsxs)(oK.VW,{paddingY:7,zOffset:qh.toast,children:[(0,oZ.jsx)(Do,{}),(0,oZ.jsx)(qp,{children:(0,oZ.jsx)(Dv,{config:r,basePath:i,children:(0,oZ.jsx)(DP,{unstable_history:l,NotFoundComponent:Dm,LoadingComponent:u4,children:(0,oZ.jsx)(qu,{children:(0,oZ.jsx)(pl,{children:s?c:(0,oZ.jsx)(D3,{LoadingComponent:u4,AuthenticateComponent:DX,NotAuthenticatedComponent:DJ,children:c})})})})})})]})})}function qE(){return(0,oZ.jsx)(oK.Zb,{height:"fill",children:(0,oZ.jsx)(oK.kC,{align:"center",height:"fill",justify:"center",padding:4,sizing:"border",children:(0,oZ.jsx)(oK.W2,{width:0,children:(0,oZ.jsx)(oK.Zb,{padding:4,radius:2,shadow:1,tone:"caution",children:(0,oZ.jsxs)(oK.kC,{children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(lp.foC,{})})}),(0,oZ.jsxs)(oK.Kq,{flex:1,marginLeft:3,space:3,children:[(0,oZ.jsx)(oK.xv,{as:"h1",size:1,weight:"medium",children:"No configured tools"}),(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:"Please configure a tool in your Studio configuration."}),(0,oZ.jsx)(oK.xv,{as:"p",muted:!0,size:1,children:(0,oZ.jsx)("a",{href:"https://www.sanity.io/docs/studio-tools",rel:"noreferrer",target:"_blank",children:"Learn how to add a tool →"})})]})]})})})})})}function qP(e){let{reason:n="Redirecting…"}=e;return(0,oZ.jsx)(oK.Zb,{height:"fill",children:(0,oZ.jsx)(oK.kC,{align:"center",height:"fill",justify:"center",padding:4,sizing:"border",children:(0,oZ.jsx)(oK.W2,{width:0,children:(0,oZ.jsx)(oK.Zb,{padding:4,radius:2,shadow:1,tone:"primary",children:(0,oZ.jsxs)(oK.kC,{children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(lp.hZl,{})})}),(0,oZ.jsx)(oK.Kq,{flex:1,marginLeft:3,space:3,children:(0,oZ.jsx)(oK.xv,{as:"h1",size:1,weight:"bold",children:n})})]})})})})})}function qO(e){let{toolName:n}=e;return(0,oZ.jsx)(oK.Zb,{height:"fill",children:(0,oZ.jsx)(oK.kC,{align:"center",height:"fill",justify:"center",padding:4,sizing:"border",children:(0,oZ.jsx)(oK.W2,{width:0,children:(0,oZ.jsx)(oK.Zb,{padding:4,radius:2,shadow:1,tone:"caution",children:(0,oZ.jsxs)(oK.kC,{children:[(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(lp.foC,{})})}),(0,oZ.jsx)(oK.Kq,{flex:1,marginLeft:3,space:3,children:(0,oZ.jsxs)(oK.xv,{as:"h1",size:1,weight:"medium",children:["Tool not found: ",(0,oZ.jsx)("code",{children:n})]})})]})})})})})}oU().registerLanguage(o$()),oU().registerLanguage(oY()),oU().registerLanguage(oG()),oU().registerLanguage(oQ()),oU().registerLanguage(o1());var qA=Object.freeze,qI=Object.defineProperty;let qz=oV.ZP.div(ig||(ig=qA(qI(eh=["\n  position: absolute;\n  width: 18px;\n  height: 18px;\n  background: var(--card-bg-color);\n  bottom: -4px;\n  right: -4px;\n  border-radius: 50%;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  border: 1px solid var(--card-bg-color);\n  box-sizing: content-box;\n\n  svg {\n    box-sizing: content-box;\n    border: 1px solid var(--card-hairline-soft-color);\n    border-radius: 50%;\n    padding: 2px;\n    width: 12px;\n    height: 12px;\n  }\n\n  &[data-logo='github'] {\n    svg {\n      path {\n        fill: var(--card-fg-color);\n      }\n    }\n  }\n\n  &[data-logo='saml'] {\n    svg {\n      path {\n        fill: var(--card-fg-color);\n      }\n    }\n  }\n"],"raw",{value:qA(eh.slice())})))),qM=(0,oZ.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,oZ.jsxs)("g",{clipPath:"url(#clip0)",children:[(0,oZ.jsx)("path",{d:"M12 6.13764C12 5.72977 11.9663 5.31971 11.8943 4.91846H6.12036V7.22895H9.42684C9.28963 7.97412 8.84876 8.63332 8.20322 9.05221V10.5514H10.1759C11.3342 9.50637 12 7.9631 12 6.13764Z",fill:"#4285F4"}),(0,oZ.jsx)("path",{d:"M6.12019 12.0002C7.77118 12.0002 9.16349 11.4688 10.1779 10.5517L8.20529 9.05253C7.65646 9.41851 6.94793 9.62574 6.12244 9.62574C4.52544 9.62574 3.17136 8.56971 2.68552 7.1499H0.649902V8.69537C1.68908 10.7215 3.80567 12.0002 6.12019 12.0002V12.0002Z",fill:"#34A853"}),(0,oZ.jsx)("path",{d:"M2.68332 7.14986C2.4269 6.40469 2.4269 5.59778 2.68332 4.8526V3.30713H0.649951C-0.218278 5.00252 -0.218278 6.99995 0.649951 8.69533L2.68332 7.14986V7.14986Z",fill:"#FBBC04"}),(0,oZ.jsx)("path",{d:"M6.12019 2.37483C6.99291 2.3616 7.8364 2.68348 8.46845 3.27433L10.2161 1.56131C9.1095 0.542752 7.64071 -0.017233 6.12019 0.000404333C3.80566 0.000404333 1.68908 1.27911 0.649902 3.3074L2.68326 4.85288C3.16686 3.43087 4.52319 2.37483 6.12019 2.37483V2.37483Z",fill:"#EA4335"})]}),(0,oZ.jsx)("defs",{children:(0,oZ.jsx)("clipPath",{id:"clip0",children:(0,oZ.jsx)("rect",{width:"12",height:"12",fill:"white"})})})]}),qR=(0,oZ.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,oZ.jsx)("g",{clipPath:"url(#clip0)",children:(0,oZ.jsx)("path",{d:"M11.195 3.13503C10.6711 2.22838 9.91808 1.47537 9.01144 0.951471C8.09222 0.414976 7.08837 0.146729 5.99987 0.146729C4.91137 0.146729 3.90752 0.414976 2.98831 0.951471C2.08163 1.47534 
11.32862 2.22836 0.804744 3.13503C0.268248 4.05497 0 5.05883 0 6.14659C0 7.45399 0.381531 8.62978 1.14459 9.67394C1.90765 10.7181 2.89327 11.4408 4.10143 11.8419C4.24208 11.868 4.34624 11.8497 4.41392 11.7872C4.44666 11.7577 4.47263 11.7215 4.49006 11.681C4.50749 11.6405 4.51595 11.5967 4.51488 11.5527C4.51488 11.537 4.51361 11.3963 4.51105 11.1307C4.5085 10.8651 4.50722 10.6334 4.50722 10.4355L4.32745 10.4666C4.18407 10.4895 4.03885 10.4986 3.89375 10.494C3.71159 10.4908 3.53001 10.4725 3.35087 10.4393C3.16049 10.4045 2.98119 10.3246 2.82796 10.2064C2.66705 10.0846 2.54715 9.91661 2.48428 9.72484L2.40602 9.54506C2.34022 9.40286 2.25754 9.2691 2.15976 9.14666C2.04775 9.00072 1.93447 8.90176 1.81991 8.84977L1.76518 8.81064C1.72769 8.78356 1.6936 8.75205 1.66367 8.71679C1.63479 8.6841 1.61108 8.64719 1.59334 8.60734C1.57766 8.57085 1.5907 8.54085 1.63247 8.51731C1.67461 8.49405 1.75123 8.48256 1.86068 8.48256L2.01692 8.50582C2.12108 8.52662 2.24996 8.5891 2.40356 8.69326C2.5585 8.79876 2.68797 8.93748 2.78254 9.09932C2.90239 9.31294 3.04695 9.47575 3.21624 9.58775C3.38552 9.69976 3.55609 9.75576 3.72793 9.75576C3.87725 9.7578 4.02641 9.74479 4.17312 9.7169C4.29459 9.69195 4.41264 9.65254 4.52473 9.59952C4.57162 9.25037 4.69931 8.98212 4.90782 8.79477C4.63684 8.76849 4.36827 8.72157 4.10444 8.6544C3.84797 8.58382 3.60133 8.48141 3.37029 8.34958C3.12825 8.218 2.91442 8.04015 2.74095 7.82613C2.57421 7.6178 2.4374 7.34417 2.3305 7.00524C2.2236 6.6663 2.1707 6.27584 2.1718 5.83383C2.1718 5.20357 2.37757 4.66708 2.7891 4.22435C2.59629 3.75006 2.61453 3.21885 2.84383 2.63073C2.99487 2.58385 3.21879 2.61897 3.51559 2.73608C3.81239 2.85319 4.02983 2.95352 4.16792 3.03707C4.30601 3.12025 4.41665 3.19058 4.49983 3.24804C5.48153 2.9773 6.51821 2.9773 7.49991 3.24804L7.79679 3.0606C8.0249 2.92356 8.26549 2.80849 8.51535 2.71693C8.79135 2.61276 9.00231 2.58412 9.14825 2.63101C9.38248 3.21949 9.40327 3.7507 9.21064 4.22462C9.62199 4.66735 9.82776 5.20385 9.82795 5.83411C9.82795 6.27684 9.77459 6.66904 9.66787 7.01071C9.56116 7.35238 9.42325 7.62601 9.25415 7.8316C9.07785 8.04326 8.86311 8.21966 8.62124 8.35149C8.39008 8.48329 8.14337 8.5857 7.88682 8.65632C7.62412 8.72277 7.35674 8.76915 7.087 8.79505C7.35698 9.02927 7.49206 9.3994 7.49225 9.90543V11.5527C7.49115 11.5964 7.49929 11.6398 7.51612 11.6802C7.53295 11.7206 7.5581 11.7569 7.58993 11.7869C7.65505 11.8493 7.75794 11.8675 7.89858 11.8416C9.10693 11.4403 10.0926 10.7177 10.8557 9.67367C11.6188 8.62968 12.0003 7.4539 12.0003 6.14632C11.9997 5.05873 11.7313 4.05497 11.195 3.13503V3.13503Z",fill:"black"})}),(0,oZ.jsx)("defs",{children:(0,oZ.jsx)("clipPath",{id:"clip0",children:(0,oZ.jsx)("rect",{width:"12",height:"12",fill:"white"})})})]}),qF=(0,oZ.jsxs)("svg",{width:"17",height:"9",viewBox:"0 0 17 9",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,oZ.jsx)("path",{d:"M0.0691681 5.98162C0.115833 7.24157 1.07247 8.00221 2.59841 8.00221C4.17102 8.00221 5.12299 7.19957 5.12299 5.86962C5.12299 4.83832 4.55367 4.25501 3.25172 3.96569L2.56108 3.80703C1.8331 3.64837 1.53445 3.38704 1.53445 2.91106C1.53445 2.40708 1.94977 2.09442 2.61708 2.09442C3.27505 2.09442 3.6997 2.43508 3.75103 2.99039H5.00166C4.95966 1.78643 4.01236 0.997795 2.60308 0.997795C1.14713 0.997795 0.218496 1.79577 0.218496 3.05105C0.218496 4.04968 0.815808 4.69366 2.03376 4.96898L2.73374 5.13231C3.51304 5.30497 3.8117 5.54763 3.8117 6.00495C3.8117 6.55093 3.34972 6.90092 2.62174 6.90092C1.85644 6.90092 1.38045 6.56493 1.31979 5.98162H0.0691681Z"}),(0,oZ.jsx)("path",{d:"M5.97695 5.98162C6.02362 7.24157 6.98025 8.00221 8.5062 8.00221C10.0788 8.00221 11.0308 7.19957 11.0308 5.86962C11.0308 4.83832 10.4615 4.25501 9.15951 3.96569L8.46886 3.80703C7.74089 3.64837 7.44223 3.38704 7.44223 2.91106C7.44223 2.40708 7.85755 2.09442 8.52486 2.09442C9.18284 2.09442 9.60749 2.43508 9.65882 2.99039H10.9094C10.8674 1.78643 9.92015 0.997795 8.51086 0.997795C7.05492 0.997795 6.12628 1.79577 6.12628 3.05105C6.12628 4.04968 6.72359 4.69366 7.94155 4.96898L8.64153 5.13231C9.42083 5.30497 9.71949 5.54763 9.71949 6.00495C9.71949 6.55093 9.2575 6.90092 8.52953 6.90092C7.76422 6.90092 7.28824 6.56493 7.22758 5.98162H5.97695Z"}),(0,oZ.jsx)("path",{d:"M16.9852 5.01565V3.98435C16.9852 2.11309 16.0099 0.997795 14.3953 0.997795C12.7807 0.997795 11.8054 2.11309 11.8054 3.98435V5.01565C11.8054 6.88692 12.7807 8.00221 14.3953 8.00221C16.0099 8.00221 16.9852 6.88692 16.9852 5.01565ZM14.3953 6.82625C13.5833 6.82625 13.154 6.21494 13.154 5.00165V3.99835C13.154 2.78506 13.5833 2.17375 14.3953 2.17375C15.2073 2.17375 15.6366 2.78506 15.6366 3.99835V5.00165C15.6366 6.21494 15.2073 6.82625 14.3953 6.82625Z"})]}),qD=e=>{let{provider:n}=e,r=null==n?void 0:n.startsWith("saml-");return(0,oZ.jsxs)(qz,{"data-logo":r?"saml":n,children:["google"===n&&qM,"github"===n&&qR,"sanity"===n&&(0,oZ.jsx)(cW.xN,{}),r&&qF]})};function qq(){return uC(),null}function qZ(e){let{setScheme:n}=e,{t:r}=dV(),i=qs(n,r);return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(oK.R,{}),i.map(e=>{let{icon:n,label:r,name:i,onSelect:a,selected:o,title:l}=e;return(0,oZ.jsx)(lr.sN,{"aria-label":r,icon:n,onClick:a,pressed:o,text:l,iconRight:o&&(0,oZ.jsx)(lp.KML,{})},i)})]})}function qN(){let{currentUser:e,projectId:n}=St(),r=!!(e&&dD(e,"administrator")),{t:i}=dV();return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(oK.R,{}),(0,oZ.jsx)(lr.sN,{as:"a","aria-label":i("user-menu.action.manage-project-aria-label"),href:"https://sanity.io/manage/project/".concat(n),target:"_blank",text:i("user-menu.action.manage-project"),icon:lp.IEm}),r&&(0,oZ.jsx)(lr.sN,{as:"a","aria-label":i("user-menu.action.invite-members-aria-label"),href:"https://sanity.io/manage/project/".concat(n,"/members"),target:"_blank",text:i("user-menu.action.invite-members"),icon:lp.oyc})]})}var qL=Object.freeze,qV=Object.defineProperty,qK=(e,n)=>qL(qV(e,"raw",{value:qL(n||e.slice())}));let qB=(0,oV.ZP)(oK.v2)(ix||(ix=qK(["\n  min-width: 200px;\n  max-width: 300px;\n"]))),qU=(0,oV.ZP)(oK.xu)(iv||(iv=qK(["\n  position: relative;\n  min-width: ","px;\n  min-height: ","px;\n"])),e=>{let{theme:n}=e;return n.sanity.avatar.sizes[2].size},e=>{let{theme:n}=e;return n.sanity.avatar.sizes[2].size});function qH(){let{currentUser:e,auth:n}=St(),r=qo(),i=qi(),a=hI(null==e?void 0:e.provider),{t:o}=dV(),l=(0,oN.useMemo)(()=>({placement:"bottom",portal:!0,preventOverflow:!0,scheme:r,constrainSize:!0}),[r]);return(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(oK.zx,{mode:"bleed",padding:0,radius:"full",children:(0,oZ.jsx)(yl,{size:1,user:"me"})}),id:"user-menu",menu:(0,oZ.jsxs)(qB,{children:[(0,oZ.jsx)(oK.Zb,{padding:2,children:(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(lr.u,{disabled:!a,portal:!0,content:o("user-menu.login-provider",{providerTitle:a}),children:(0,oZ.jsxs)(qU,{marginRight:3,children:[(0,oZ.jsx)(yl,{size:2,user:"me"}),(null==e?void 0:e.provider)&&(0,oZ.jsx)(qD,{provider:e.provider})]})}),(0,oZ.jsxs)(oK.Kq,{space:2,flex:1,children:[(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",textOverflow:"ellipsis",children:null==e?void 0:e.name}),(0,oZ.jsx)(oK.xv,{size:1,muted:!0,textOverflow:"ellipsis",children:null==e?void 0:e.email})]})]})}),i&&(0,oZ.jsx)(qZ,{setScheme:i}),(0,oZ.jsx)(qq,{}),(0,oZ.jsx)(qN,{}),n.logout&&(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(oK.R,{}),(0,oZ.jsx)(lr.sN,{iconRight:lp.Ow9,text:o("user-menu.action.sign-out"),disabled:!n.logout,...n.logout&&{onClick:n.logout}})]})]}),popover:l})}function q$(e){let{option:n,currentUser:r,onClick:i,preview:a}=e,o=(0,oN.useMemo)(()=>({template:n.templateId,type:n.schemaType}),[n.schemaType,n.templateId]),{onClick:l,href:s}=(0,lm.PM)({intent:"create",params:o}),c=(0,oN.useCallback)(e=>{l(e),i(n)},[l,i,n]),{title:d}=uX(n);return(0,oZ.jsx)(lr.u,{disabled:n.hasPermission,portal:!0,content:(0,oZ.jsx)(uR,{currentUser:r,context:"create-document"}),children:(0,oZ.jsx)("div",{children:(0,oZ.jsx)(oK.Zb,{as:n.hasPermission?"a":"button","data-testid":"create-new-".concat(n.templateId),disabled:!n.hasPermission,href:s,marginBottom:1,onClick:c,padding:"inline"===a?3:4,radius:2,children:(0,oZ.jsx)(oK.xv,{size:"inline"===a?1:void 0,children:d})})})},n.id)}var qW=Object.freeze,qY=Object.defineProperty;let qX=(0,oV.ZP)(oK.kC)(iy||(iy=qW(qY(ef=["\n  min-height: 100px;\n"],"raw",{value:qW(ef.slice())}))));function qG(e){let{currentUser:n,loading:r,onDocumentClick:i,options:a,preview:o,searchQuery:l,textInputElement:s}=e,{t:c}=dV(),d=a.length>0&&!r,u=(0,oN.useCallback)(()=>{i()},[i]),p=(0,oN.useCallback)(e=>{var n;return(null==(n=a[e])?void 0:n.hasPermission)===!1},[a]),h=(0,oN.useCallback)(e=>(0,oZ.jsx)(q$,{currentUser:n,onClick:u,option:e,preview:o},e.id),[n,u,o]);return r?(0,oZ.jsx)(u4,{showText:!0}):!d&&l?(0,oZ.jsx)(qX,{align:"center",flex:1,height:"fill",justify:"center",padding:4,sizing:"border",children:(0,oZ.jsx)(oK.xv,{align:"center",muted:!0,size:1,children:(0,oZ.jsx)(uz,{t:c,i18nKey:"new-document.no-results",values:{searchQuery:l}})})}):d?(0,oZ.jsx)(ux,{activeItemDataAttr:"data-hovered",ariaLabel:c("new-document.new-document"),autoFocus:dI?void 0:"input",getItemDisabled:p,inputElement:s,itemHeight:33,items:a,overscan:5,padding:"inline"===o?1:2,paddingBottom:0,renderItem:h}):(0,oZ.jsx)(qX,{align:"center",flex:1,height:"fill",justify:"center",padding:4,sizing:"border",children:(0,oZ.jsx)(oK.xv,{align:"center",muted:!0,size:1,children:c("new-document.no-document-types-found")})})}var qJ=Object.freeze,qQ=Object.defineProperty,q0=(e,n)=>qJ(qQ(e,"raw",{value:qJ(n||e.slice())}));let q1=(0,oV.ZP)(lr.J2)(()=>(0,oV.iv)(ib||(ib=q0(["\n    [data-ui='Popover__wrapper'] {\n      width: 320px;\n      display: flex;\n      flex-direction: column;\n      border-radius: ","px;\n      position: relative;\n      overflow: hidden;\n      overflow: clip;\n    }\n  "])),e=>{let{theme:n}=e;return n.sanity.radius[3]})),q2=(0,oV.ZP)(lr.Vq)(()=>(0,oV.iv)(ij||(ij=q0(["\n    [data-ui='DialogCard'] {\n      justify-content: flex-start;\n    }\n  "])))),q3=(0,oV.ZP)(oK.kC)(iw||(iw=q0([""]))),q4=(0,oV.ZP)(oK.Zb)(ik||(ik=q0(["\n  min-height: max-content;\n"]))),q5=(0,oV.ZP)(oK.Zb)(iC||(iC=q0(["\n  min-height: max-content;\n"]))),q8=(0,oV.ZP)(oK.kC)(e=>{let{$maxDisplayedItems:n,$itemHeight:r}=e;return(0,oV.iv)(i_||(i_=q0(["\n    --item-height: ","px;\n    --max-items: ",";\n    --list-padding: 0.5rem;\n\n    position: relative;\n    max-height: calc(var(--item-height) * var(--max-items) + var(--list-padding));\n    min-height: calc((var(--item-height) * 1));\n  "])),r,n)});function q6(e){let{canCreateDocument:n,modal:r="popover",loading:i,options:a}=e,[o,l]=(0,oN.useState)(!1),[s,c]=(0,oN.useState)(""),[d,u]=(0,oN.useState)(null),[p,h]=(0,oN.useState)(null),[f,m]=(0,oN.useState)(null),[g,x]=(0,oN.useState)(null),{t:v}=dV(),y=uG(a),{scheme:b}=ql(),j=hK(),w=h1(),k=a.length>0,C=!n||!k,_=v("new-document.filter-placeholder"),T=v("new-document.title"),S=v("new-document.open-dialog-aria-label"),E=(0,oN.useMemo)(()=>a.filter(e=>{let n=w.get(e.schemaType);return n&&!(0,ll.Ax)(n)}),[a,w]),P=(0,oN.useMemo)(()=>E.map(e=>({...e,title:y({...e,title:(null==e?void 0:e.title)||e.id}).title})).sort((e,n)=>e.title.localeCompare(n.title)).filter(e=>(function(e,n){let r=n.title.toLowerCase();return e.trim().toLowerCase().split(/[\s\-_]+/).every(e=>r.includes(e))})(s,e)).sort((e,n)=>(function(e,n,r){let i=n.title.toLowerCase(),a=r.title.toLowerCase(),o=e.trim().toLowerCase();return i.startsWith(o)&&!a.startsWith(o)?-1:a.startsWith(o)&&!i.startsWith(o)?1:i.includes(o)&&!a.includes(o)?-1:a.includes(o)&&!i.includes(o)?1:0})(s,e,n)),[E,s,y]),O=(0,oN.useCallback)(e=>{c(e.currentTarget.value)},[]),A=(0,oN.useCallback)(()=>l(e=>!e),[]),I=(0,oN.useCallback)(()=>
1{l(!1),c(""),null==f||f.focus()},[f]),z=(0,oN.useCallback)(e=>{"ArrowDown"!==e.key||o||l(!0)},[o]),M=(0,oN.useCallback)(e=>{("Escape"===e.key||"Tab"===e.key)&&o&&I()},[I,o]);(0,oK.O8)(()=>{o&&I()},[f,p,d]);let R=(0,oN.useMemo)(()=>({currentUser:j,loading:i,onDocumentClick:A,options:P,searchQuery:s,preview:"popover"===r?"inline":"default",textInputElement:g}),[j,P,A,i,r,g,s]),F=(0,oN.useMemo)(()=>({__unstable_disableFocusRing:!0,border:!1,"data-testid":"new-document-button-search-input",defaultValue:s,disabled:i,icon:lp.W1M,onChange:O,placeholder:_,ref:x}),[O,i,_,s]),D=(0,oN.useMemo)(()=>({"aria-label":S,"data-testid":"new-document-button",disabled:C||i,icon:lp.dtP,text:v("new-document.button"),mode:"ghost",onClick:A,ref:m,selected:o}),[C,A,i,o,S,v]),q=(0,oN.useMemo)(()=>k?n?(0,oZ.jsx)(oK.xv,{size:1,children:v("new-document.create-new-document-label")}):(0,oZ.jsx)(uR,{currentUser:j,context:"create-any-document"}):(0,oZ.jsx)(oK.xv,{size:1,children:v("new-document.no-document-types-label")}),[n,j,k,v]),Z=(0,oN.useMemo)(()=>({content:q,disabled:i||o,scheme:b}),[i,o,b,q]);return"dialog"===r?(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(lr.u,{...Z,children:(0,oZ.jsx)("div",{children:(0,oZ.jsx)(lr.zx,{...D})})}),o&&(0,oZ.jsx)(q2,{header:T,id:"create-new-document-dialog",onClickOutside:I,onClose:I,ref:h,scheme:b,width:1,children:(0,oZ.jsxs)(q3,{direction:"column",flex:1,height:"fill",children:[(0,oZ.jsx)(q5,{padding:2,borderBottom:!0,children:(0,oZ.jsx)(oK.oi,{"data-testid":"new-document-button-search-input",...F})}),(0,oZ.jsx)(oK.kC,{direction:"column",overflow:"hidden",children:(0,oZ.jsx)(qG,{...R})})]})})]}):(0,oZ.jsx)(q1,{constrainSize:!0,onKeyDown:M,open:o,portal:!0,radius:3,ref:u,scheme:b,content:(0,oZ.jsxs)(q3,{direction:"column",flex:1,forwardedAs:lg.ZP,height:"fill",returnFocus:!0,children:[(0,oZ.jsx)(q4,{sizing:"border",children:(0,oZ.jsx)(oK.Kq,{children:(0,oZ.jsx)(oK.Zb,{borderBottom:!0,padding:1,children:(0,oZ.jsx)(oK.oi,{...F,fontSize:1,radius:1})})})}),(0,oZ.jsx)(q8,{$itemHeight:33,$maxDisplayedItems:10,direction:"column",overflow:"hidden",children:(0,oZ.jsx)(qG,{...R})})]}),children:(0,oZ.jsx)("div",{children:(0,oZ.jsx)(lr.u,{...Z,children:(0,oZ.jsx)("div",{children:(0,oZ.jsx)(lr.zx,{...D,"aria-expanded":o,"aria-haspopup":"true",onKeyDown:z})})})})})}let q9=(0,oN.memo)(function(e){let{presence:n,focused:r,onFocus:i}=e,[a,o]=(0,oN.useState)(null),{t:l}=dV(),s=sW()(n.locations||[],["lastActiveAt"],["desc"]).find(e=>e.documentId),c=!!(null==s?void 0:s.documentId);(0,oN.useEffect)(()=>{r&&a&&(a.focus(),a.setAttribute("data-selected","")),r||null==a||a.removeAttribute("data-selected")},[a,r]);let d=(0,oN.useCallback)(()=>{i(n.user.id)},[i,n.user.id]),u=(0,oN.useMemo)(()=>(0,oN.forwardRef)(function(e,n){return(null==s?void 0:s.path)?(0,oZ.jsx)(lm.nR,{...e,intent:"edit",params:{id:null==s?void 0:s.documentId,path:o2.BB(null==s?void 0:s.path)},ref:n}):null}),[s]);return(0,oZ.jsx)(lr.sN,{as:s?u:"div","data-as":"a",disabled:!c,onFocus:d,preview:(0,oZ.jsx)(yl,{size:1,user:n.user},n.user.id),ref:o,text:n.user.displayName,tooltipProps:c?void 0:{content:l("presence.not-in-a-document"),placement:"left"}})});var q7=Object.freeze,Ze=Object.defineProperty,Zt=(e,n)=>q7(Ze(e,"raw",{value:q7(n||e.slice())}));let Zn=(0,oV.ZP)(oK.v2)(iT||(iT=Zt(["\n  max-width: 260px;\n"]))),Zr=(0,oV.ZP)(oK.Kq)(iS||(iS=Zt(["\n  position: sticky;\n  bottom: 0;\n  background-color: var(--card-bg-color);\n"])));function Zi(){let e=function(){let[e,n]=(0,oN.useState)([]),r=z9();return(0,oN.useEffect)(()=>{let e=r.globalPresence$.subscribe(n);return()=>{e.unsubscribe()}},[r]),e}(),{projectId:n}=St(),{scheme:r}=ql(),{t:i}=dV(),a=e.length>0,[o,l]=(0,oN.useState)(),s=(0,oN.useCallback)(e=>{l(e)},[]),c=(0,oN.useCallback)(()=>{l("")},[]),d=(0,oN.useCallback)(()=>{l("")},[]),u=(0,oN.useMemo)(()=>(0,oZ.jsx)(K7,{icon:lp.oyc,mode:"bleed",tone:a?"positive":void 0,tooltipProps:{content:i("presence.aria-label")}}),[a,i]),p=(0,oN.useMemo)(()=>({constrainSize:!0,fallbackPlacements:["bottom"],placement:"bottom",portal:!0,scheme:r}),[r]);return(0,oZ.jsx)(lr.j2,{button:u,id:"global-presence-menu",menu:(0,oZ.jsxs)(Zn,{children:[a&&e.map(e=>(0,oZ.jsx)(q9,{focused:o===e.user.id,onFocus:s,presence:e},e.user.id)),!a&&(0,oZ.jsx)(oK.xu,{padding:3,children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{weight:"medium",size:1,children:i("presence.no-one-else-title")}),(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:i("presence.no-one-else-description")})]})}),(0,oZ.jsxs)(Zr,{space:1,children:[(0,oZ.jsx)(oK.R,{}),(0,oZ.jsx)(lr.sN,{as:"a",href:"https://sanity.io/manage/project/".concat(n),iconRight:lp.IEm,onFocus:c,rel:"noopener noreferrer",target:"_blank",text:i("presence.action.manage-members")})]})]}),onClose:d,popover:p})}function Za(){return(0,oZ.jsxs)("svg",{width:"100%",height:"100%",viewBox:"0 0 33 33",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,oZ.jsx)("rect",{width:"100%",height:"100%",fill:"#EC5446"}),(0,oZ.jsx)("path",{d:"M10.1637 8.5498C10.1637 11.3854 11.9461 13.0725 15.5143 13.9622L19.2955 14.8235C22.6725 15.5855 24.729 17.4783 24.729 20.5619C24.7
1553 21.9053 24.3107 23.2168 23.4698 24.2765C23.4698 21.1999 21.8499 19.5376 17.9425 18.538L14.2299 17.7086C11.257 17.0423 8.9623 15.4863 8.9623 12.1368C8.94666 10.8433 9.36932 9.58143 10.1637 8.5498Z",fill:"white"}),(0,oZ.jsx)("path",{d:"M21.1463 19.8069C22.7591 20.8206 23.4662 22.2384 23.4662 24.2729C22.1313 25.953 19.7861 26.8958 17.0297 26.8958C12.3899 26.8958 9.1427 24.6521 8.42111 20.7533H12.8769C13.4506 22.5432 14.9695 23.3726 16.9972 23.3726C19.4722 23.3726 21.1175 22.0753 21.1499 19.7998",fill:"#F8B1AA"}),(0,oZ.jsx)("path",{d:"M12.4801 12.7536C11.7436 12.3236 11.1394 11.7057 10.7316 10.9656C10.3238 10.2255 10.1276 9.3907 10.1638 8.54984C11.4518 6.88396 13.6923 5.8667 16.4235 5.8667C21.1499 5.8667 23.8848 8.31945 24.5595 11.7717H20.2732C19.8006 10.4107 18.6172 9.35089 16.4596 9.35089C14.1541 9.35089 12.5811 10.6694 12.4909 12.7536",fill:"#F8B1AA"})]})}var Zo=Object.freeze,Zl=Object.defineProperty,Zs=(e,n)=>Zo(Zl(e,"raw",{value:Zo(n||e.slice())}));let Zc=(0,oV.ZP)(oK.Zb).attrs({overflow:"hidden",radius:2})(iE||(iE=Zs(["\n  height: ","px;\n  width: ","px;\n"])),25,25),Zd=(0,oV.ZP)(oK.Zb)(e=>{let{theme:n}=e,{focusRing:r}=n.sanity,{base:i}=n.sanity.color;return(0,oV.iv)(iP||(iP=Zs(["\n    border-radius: ",";\n    display: flex;\n    outline: none;\n    text-decoration: none;\n    &:focus-visible {\n      box-shadow: ",";\n    }\n  "])),(0,oK.hO)(n.sanity.radius[2]),CX({base:i,focusRing:{...r,offset:1}}))});function Zu(){let e=Dj(),{activeWorkspace:n}=DO(),{href:r,onClick:i}=(0,lm.rJ)({state:{}}),a=e.length>1;return(0,oZ.jsx)(Zd,{__unstable_focusRing:!0,as:"a",href:r,onClick:i,children:(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(Zc,{children:(0,oZ.jsx)(oK.kC,{align:"center",height:"fill",justify:"center",children:a||n.customIcon?(0,oZ.jsx)(DR,{icon:n.icon,size:"small"}):(0,oZ.jsx)(Za,{})})}),!a&&(0,oZ.jsx)(oK.xu,{paddingX:2,children:(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:n.title})})]})})}function Zp(e){let{setScheme:n}=e,{t:r}=dV(),i=qs(n,r);return(0,oZ.jsx)(oK.Zb,{borderTop:!0,flex:"none",padding:2,overflow:"auto",children:(0,oZ.jsx)(oK.Kq,{as:"ul",space:1,children:i.map(e=>{let{icon:n,label:r,name:i,onSelect:a,selected:o,title:l}=e;return(0,oZ.jsx)(oK.Kq,{as:"li",children:(0,oZ.jsx)(lr.zx,{"aria-label":r,icon:n,iconRight:o&&(0,oZ.jsx)(lp.KML,{}),justify:"flex-start",mode:"bleed",onClick:a,selected:o,size:"large",text:l})},i)})})})}function Zh(){return uC(),null}var Zf=Object.freeze,Zm=Object.defineProperty,Zg=(e,n)=>Zf(Zm(e,"raw",{value:Zf(n||e.slice())}));let Zx=(0,oV.ZP)(oK.xu)(iO||(iO=Zg(["\n  height: 1px;\n  background: var(--card-border-color);\n  width: 100%;\n"]))),Zv=oV.ZP.div(iA||(iA=Zg(["\n  // Remove margin bottom to last box.\n  > [data-ui='Box']:last-child {\n    margin-bottom: 0;\n  }\n"]))),Zy=oV.ZP.a(iI||(iI=Zg(["\n  font-weight: 600;\n  color: ",";\n"])),e=>e.useTextColor?"var(--card-muted-fg-color) !important":""),Zb=oV.ZP.span(iz||(iz=Zg(["\n  > svg {\n    display: inline;\n    font-size: calc(21 / 16 * 1rem) !important;\n    margin: -0.375rem 0 !important;\n    *[stroke] {\n      stroke: currentColor;\n    }\n  }\n"]))),Zj=e=>{let[n,r]=(0,oN.useState)(null);return(0,oN.useEffect)(()=>{if(!n)return;let r=new AbortController,i=r.signal;return fetch(e.icon.url,{signal:i}).then(e=>{if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return e.text()}).then(e=>{n&&(n.innerHTML=e)}).catch(e=>{"AbortError"!==e.name&&console.error(e)}),()=>{r.abort()}},[n,e.icon.url]),(0,oZ.jsx)(Zb,{ref:r})};function Zw(e){let{children:n}=e;return(0,oZ.jsx)(oK.xu,{paddingX:2,marginBottom:4,children:(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:n})})}let Zk={block:{normal:e=>{let{children:n}=e;return(0,oZ.jsx)(Zw,{children:n})}},list:{bullet:e=>{let{children:n}=e;return n},number:e=>{let{children:n}=e;return(0,oZ.jsx)(oZ.Fragment,{children:n})},checkmarks:e=>{let{children:n}=e;return(0,oZ.jsx)(oZ.Fragment,{children:n})}},listItem:{bullet:e=>{let{children:n}=e;return(0,oZ.jsx)(Zw,{children:n})},number:e=>{let{children:n}=e;return(0,oZ.jsx)(Zw,{children:n})},checkmarks:e=>{let{children:n}=e;return(0,oZ.jsx)(Zw,{children:n})}},marks:{strong:e=>{let{children:n}=e;return(0,oZ.jsx)("strong",{children:n})},link:e=>(0,oZ.jsxs)(Zy,{href:e.value.href,rel:"noopener noreferrer",target:"_blank",useTextColor:e.value.useTextColor,children:[e.children,e.value.showIcon&&(0,oZ.jsx)(lp.xPt,{style:{marginLeft:"2px"}})]})},types:{inlineIcon:e=>(0,oZ.jsx)(Zj,{icon:e.value.icon}),divider:()=>(0,oZ.jsx)(oK.xu,{marginY:3,children:(0,oZ.jsx)(oK.xu,{paddingY:3,children:(0,oZ.jsx)(Zx,{})})}),iconAndText:e=>(0,oZ.jsxs)(oK.kC,{align:"flex-start",paddingX:2,paddingTop:1,paddingBottom:2,marginTop:2,gap:2,children:[(0,oZ.jsxs)(oK.kC,{gap:2,style:{flexShrink:0},children:[(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(Zj,{icon:e.value.icon})}),(0,oZ.jsx)(oK.xv,{size:1,weight:"semibold",children:e.value.title})]}),(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:e.value.text})]})}};function ZC(e){return(0,oZ.jsx)(oK.Zb,{tone:"default",children:(0,oZ.jsx)(Zv,{children:(0,oZ.jsx)(cG.YI,{value:e.blocks,components:Zk,onMissingComponent:!1})})})}var Z_=Object.freeze,ZT=Object.defineProperty;let ZS=oV.ZP.img(iM||(iM=Z_(ZT(em=["\n  object-fit: cover;\n  width: 100%;\n  height: 100%;\n  height: 180px;\n"],"raw",{value:Z_(em.slice())}))));function ZE(e){var n,r,i,a,o;let{content:l,handleClose:s,handleOpenNext:c}=e;
1return(0,oZ.jsx)(oK.Zb,{radius:3,overflow:"hidden",width:0,children:(0,oZ.jsxs)(oK.W2,{width:0,children:[l.image&&(0,oZ.jsx)(ZS,{src:l.image.asset.url,alt:null!=(n=l.image.asset.altText)?n:""}),(0,oZ.jsxs)(oK.kC,{padding:3,direction:"column",children:[(0,oZ.jsx)(oK.xu,{paddingX:2,marginTop:3,children:(0,oZ.jsx)(oK.X6,{size:1,children:l.headingText})}),(0,oZ.jsx)(oK.xu,{marginTop:4,children:(0,oZ.jsx)(ZC,{blocks:l.descriptionText})})]}),(0,oZ.jsxs)(oK.kC,{width:"full",gap:3,justify:"flex-end",padding:3,children:[(null==(r=l.secondaryButton)?void 0:r.text)&&(0,oZ.jsx)(lr.zx,{mode:"bleed",text:l.secondaryButton.text,tone:"default",onClick:s}),(0,oZ.jsx)(lr.zx,{mode:"default",tooltipProps:null,text:null==(i=l.ctaButton)?void 0:i.text,autoFocus:!0,tone:"primary",...(null==(a=l.ctaButton)?void 0:a.action)==="openUrl"?{href:l.ctaButton.url,target:"_blank",rel:"noopener noreferrer",as:"a"}:{onClick:(null==(o=l.ctaButton)?void 0:o.action)==="openNext"?c:s}})]})]})})}var ZP=Object.freeze,ZO=Object.defineProperty,ZA=(e,n)=>ZP(ZO(e,"raw",{value:ZP(n||e.slice())}));let ZI=(0,oV.ZP)(lr.zx)(iR||(iR=ZA(["\n  position: absolute;\n  top: 12px;\n  right: 12px;\n  z-index: 20;\n  background: transparent;\n  border-radius: 9999px;\n  box-shadow: none;\n  color: white;\n  --card-fg-color: white;\n  :hover {\n    --card-fg-color: white;\n  }\n"]))),Zz=oV.ZP.img(iF||(iF=ZA(["\n  object-fit: cover;\n  width: 100%;\n  height: 100%;\n  height: 196px;\n"]))),ZM=(0,oV.ZP)(lr.Vq)(iD||(iD=ZA(["\n  > [data-ui='DialogCard'] {\n    max-width: 22.5rem;\n  }\n"])));function ZR(e){var n,r,i,a,o;let{handleClose:l,handleOpenNext:s,content:c,open:d}=e,u=qo();return d?(0,oZ.jsxs)(ZM,{id:"free-trial-modal",onClose:l,onClickOutside:l,padding:!1,__unstable_hideCloseButton:!0,scheme:u,footer:{cancelButton:(null==(n=c.secondaryButton)?void 0:n.text)?{text:c.secondaryButton.text,mode:"bleed",tone:"default",onClick:l}:void 0,confirmButton:{text:null==(r=c.ctaButton)?void 0:r.text,mode:"default",tone:"primary",...(null==(i=c.ctaButton)?void 0:i.action)==="openUrl"?{href:c.ctaButton.url,target:"_blank",rel:"noopener noreferrer",as:"a"}:{onClick:(null==(a=c.ctaButton)?void 0:a.action)==="openNext"?s:l}}},children:[(0,oZ.jsx)(ZI,{icon:lp.Two,mode:"bleed",tone:"default",onClick:l,tabIndex:-1,tooltipProps:null}),c.image&&(0,oZ.jsx)(Zz,{src:c.image.asset.url,alt:null!=(o=c.image.asset.altText)?o:""}),(0,oZ.jsxs)(oK.kC,{padding:3,direction:"column",children:[(0,oZ.jsx)(oK.xu,{paddingX:2,marginTop:3,children:(0,oZ.jsx)(oK.X6,{size:2,children:c.headingText})}),(0,oZ.jsx)(oK.xu,{marginTop:4,paddingBottom:3,children:(0,oZ.jsx)(ZC,{blocks:c.descriptionText})})]})]}):null}var ZF=Object.freeze,ZD=Object.defineProperty;let Zq=oV.ZP.div(iq||(iq=ZF(ZD(eg=["\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n"],"raw",{value:ZF(eg.slice())})))),ZZ=e=>{let{daysLeft:n,totalDays:r}=e,i=Math.round((r-n)/r*100),a=2*Math.PI*10;return(0,oZ.jsx)(oK.Zb,{children:(0,oZ.jsx)(Zq,{children:(0,oZ.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:21.2,height:21.2,viewBox:"0 0 ".concat(21.2," ").concat(21.2),style:{transform:"rotate(-90deg)"},children:[(0,oZ.jsx)("circle",{r:10,cx:10.6,cy:10.6,fill:"transparent",strokeWidth:1.2,stroke:i>75?sx.er["600"].hex:sx.jk["400"].hex}),(0,oZ.jsx)("circle",{r:10,cx:10.6,cy:10.6,fill:"transparent",strokeWidth:1.2,stroke:"var(--card-border-color)",strokeDasharray:a,strokeDashoffset:(100-i)/100*a})]})})})},ZN=(0,oN.forwardRef)(function(e,n){let{toggleShowContent:r,daysLeft:i,totalDays:a}=e,{t:o}=(0,li.$G)();return(0,oZ.jsxs)(lr.zx,{mode:"bleed",onClick:r,ref:n,tooltipProps:{content:i?o("free-trial.tooltip.days-count",{count:i}):o("free-trial.tooltip.trial-finished")},children:[(0,oZ.jsx)(oK.xv,{size:0,children:(0,oZ.jsx)(lp.jrq,{})}),i>0&&(0,oZ.jsx)(ZZ,{daysLeft:i,totalDays:a})]})}),ZL=(0,oN.forwardRef)(function(e,n){let{toggleShowContent:r,daysLeft:i}=e,{t:a}=(0,li.$G)();return(0,oZ.jsx)(lr.zx,{ref:n,icon:lp.jrq,justify:"flex-start",mode:"bleed",size:"large",onClick:r,text:i?a("user-menu.action.free-trial",{count:i}):a("user-menu.action.free-trial-finished")})}),ZV=(0,oN.createContext)(void 0),ZK=()=>{let e=(0,oN.useContext)(ZV);if(!e)throw Error("useFreeTrial must be used within a FreeTrialProvider");return e};function ZB(e){let{type:n}=e,{data:r,showDialog:i,showOnLoad:a,toggleShowContent:o}=ZK(),l=qo(),[s,c]=(0,oN.useState)(null),[d,u]=(0,oN.useState)(!1);(0,oN.useEffect)(()=>{s&&u(!0)},[s]);let p=(0,oN.useCallback)(()=>o(!0),[o]),h=(0,oN.useCallback)(()=>{null==s||s.focus(),o(!1)},[o,s]);if(!(null==r?void 0:r.id))return null;let f=a?r.showOnLoad:r.showOnClick;if(!f)return null;let m="sidebar"===n?(0,oZ.jsx)(ZL,{toggleShowContent:p,daysLeft:r.daysLeft,ref:c}):(0,oZ.jsx)(ZN,{toggleShowContent:p,daysLeft:r.daysLeft,totalDays:r.totalDays,ref:c});return(null==f?void 0:f.dialogType)==="popover"?(0,oZ.jsx)(lr.J2,{open:i&&d,size:0,scheme:l,radius:3,portal:!0,placement:"sidebar"===n?"top":"bottom-end",content:(0,oZ.jsx)(ZE,{content:f,handleClose:h,handleOpenNext:p}),children:m}):(0,oZ.jsxs)(oZ.Fragment,{children:[m,(0,oZ.jsx)(ZR,{content:f,handleClose:h,handleOpenNext:p,open:i})]})}function ZU(){let{currentUser:e,projectId:n}=St(),r=!!(e&&dD(e,"administrator")),{t:i}=dV();return(0,oZ.jsx)(oK.Zb,{borderTop:!0,flex:"none",padding:2,children:(0,oZ.jsxs)(oK.Kq,{as:"ul",space:1,children:[(0,oZ.jsx)(oK.Kq,{as:"li",children:(0,oZ.jsx)(ZB,{type:"sidebar"})}),(0,oZ.jsx)(oK.Kq,{as:"li",children:(0,oZ.jsx)(lr.zx,{"aria-label":i("user-menu.action.manage-project-aria-label"),as:"a",href:"https://sanity.io/manage/project/".concat(n),icon:lp.IEm,justify:"flex-start",mode:"bleed",size:"large",target:"_blank",text:i("user-menu.action.manage-project")})}),r&&(0,oZ.jsx)(oK.Kq,{as:"li",children:(0,oZ.jsx)(lr.zx,{"aria-label":i("user-menu.action.invite-members-aria-label"),as:"a",href:"https://sanity.io/manage/project/".concat(n,"/members"),icon:lp.oyc,justify:"flex-start",mode:"bleed",size:"large",target:"_blank",text:i("user-menu.action.invite-members")})})]})})}var ZH=Object.freeze,Z$=Object.defineProperty,ZW=(e,n)=>ZH(Z$(e,"raw",{value:ZH(n||e.slice())}));let ZY={bounce:0,damping:20,mass:.5,stiffness:200,type:"spring"},ZX={open:{opacity:1},closed:{opacity:0}
1},ZG={open:{x:"0%"},closed:{x:"-100%"}},ZJ=(0,oV.ZP)(oK.mh)(iZ||(iZ=ZW(["\n  position: fixed;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n"]))),ZQ=(0,oV.ZP)((0,cY.E)(oK.Zb))(iN||(iN=ZW(["\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  background: var(--card-shadow-penumbra-color);\n"]))),Z0=(0,oV.ZP)((0,cY.E)(oK.Zb))(iL||(iL=ZW(["\n  position: relative;\n  pointer-events: all;\n  flex-direction: column;\n  height: 100%;\n  min-width: 200px;\n  max-width: 280px;\n  overflow: auto;\n"]))),Z1=(0,oN.memo)(function(e){let{activeToolName:n,isOpen:r,onClose:i,tools:a}=e,o=qi(),{auth:l,currentUser:s}=St(),c=Dj(),d=VF(),{t:u}=dV(),p=(0,oN.useCallback)(e=>{"Escape"===e.key&&i()},[i]);return(0,oZ.jsx)(cX.M,{children:r&&(0,oZ.jsx)(lg.ZP,{returnFocus:!0,children:(0,oZ.jsxs)(ZJ,{onKeyDown:p,children:[(0,oZ.jsx)(ZQ,{animate:"open","data-open":r,exit:"closed",initial:"closed",onClick:i,transition:ZY,variants:ZX}),(0,oZ.jsxs)(Z0,{animate:"open","data-open":r,display:"flex",exit:"closed",height:"fill",initial:"closed",shadow:1,transition:ZY,variants:ZG,children:[(0,oZ.jsx)(oK.Zb,{borderBottom:!0,children:(0,oZ.jsxs)(oK.Kq,{space:3,padding:3,children:[(0,oZ.jsxs)(oK.kC,{align:"center",children:[(0,oZ.jsx)(oK.kC,{flex:1,align:"center",paddingRight:2,children:(0,oZ.jsxs)(oK.kC,{flex:1,align:"center",children:[(0,oZ.jsx)(yl,{size:1,user:"me"}),(0,oZ.jsx)(oK.xu,{flex:1,marginLeft:3,title:(null==s?void 0:s.name)||(null==s?void 0:s.email),children:(0,oZ.jsx)(oK.xv,{size:1,textOverflow:"ellipsis",weight:"medium",children:(null==s?void 0:s.name)||(null==s?void 0:s.email)})})]})}),(0,oZ.jsx)(lr.zx,{icon:lp.Two,mode:"bleed",onClick:i,tooltipProps:{content:u("user-menu.close-menu")}})]}),c.length>1&&(0,oZ.jsxs)(oK.kC,{flex:1,gap:1,children:[(0,oZ.jsx)(Zu,{}),(0,oZ.jsx)(DY,{})]})]})}),(0,oZ.jsxs)(oK.kC,{direction:"column",flex:1,justify:"space-between",overflow:"auto",children:[(0,oZ.jsx)(oK.Zb,{flex:"none",padding:2,children:(0,oZ.jsx)(d,{activeToolName:n,closeSidebar:i,context:"sidebar",isSidebarOpen:r,tools:a})}),(0,oZ.jsxs)(oK.kC,{direction:"column",children:[o&&(0,oZ.jsx)(Zp,{setScheme:o}),(0,oZ.jsx)(Zh,{}),(0,oZ.jsx)(ZU,{})]})]}),l.logout&&(0,oZ.jsx)(oK.Zb,{flex:"none",padding:2,borderTop:!0,children:(0,oZ.jsx)(oK.Kq,{children:(0,oZ.jsx)(lr.zx,{iconRight:lp.Ow9,justify:"flex-start",mode:"bleed",onClick:l.logout,size:"large",text:u("user-menu.action.sign-out")})})})]})]})})})});function Z2(){var e;let n=(null==(e=h1()._validation)?void 0:e.filter(e=>e.problems.some(e=>"warning"===e.severity)))||[],{scheme:r}=ql(),{t:i}=dV(),a=(0,oN.useId)(),[o,l]=(0,oN.useState)(!1),[s,c]=(0,oN.useState)(null),d=(0,oN.useCallback)(()=>l(!0),[]),u=(0,oN.useCallback)(()=>{l(!1),s&&s.focus()},[s]);return 0===n.length?null:(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(K7,{icon:lp.foC,mode:"bleed",onClick:d,ref:c,selected:o,tone:"caution",tooltipProps:{scheme:r,content:i("configuration-issues.button.tooltip")}}),o&&(0,oZ.jsx)(lr.Vq,{header:"Configuration issues",width:2,onClickOutside:u,onClose:u,scheme:r,id:a,children:(0,oZ.jsxs)(oK.Kq,{space:4,children:[(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsxs)(oK.xv,{as:"h2",size:1,weight:"medium",children:["Found ",n.length," schema warnings"]})," ",(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:"Configuration checks are only performed during development and will not be visible in production builds"})]}),(0,oZ.jsx)(Dh,{problemGroups:n})]})})]})}let Z3=(0,oN.forwardRef)(function(e,n){let{onClick:r}=e,{t:i}=(0,li.$G)();return(0,oZ.jsx)(lr.zx,{"aria-label":i("search.action-open-aria-label"),"data-testid":"studio-search",icon:lp.W1M,tooltipProps:{content:i("search.button.tooltip"),hotkeys:[Ri,"K"],portal:!0},onClick:r,mode:"bleed",ref:n})}),Z4=(0,cM.ZP)("mod+".concat("k")),Z5=(0,cM.ZP)("escape");function Z8(e){let{children:n,hasValidTerms:r,onClose:i,onOpen:a,open:o}=e,l=(0,oN.useRef)(!1),{dispatch:s,searchCommandList:c,setOnClose:d,state:{result:u}}=M5(),p=(0,oN.useCallback)(()=>{var e;s({index:null!=(e=null==c?void 0:c.getTopIndex())?e:-1,type:"LAST_ACTIVE_INDEX_SET"}),i()},[s,i,c]);return!function(e){let{open:n,onClose:r,onOpen:i}=e,{isTopLayer:a}=(0,oK.sJ)(),o=(0,oN.useCallback)(()=>{null==r||r()},[r]),l=(0,oN.useCallback)(e=>{Z4(e)&&(e.preventDefault(),n?o():null==i||i()),Z5(e)&&n&&a&&o()},[o,a,n,i]);(0,oK.qh)(l)}({onClose:p,onOpen:a,open:o}),(0,oN.useEffect)(()=>{d(p)},[p,d]),(0,oN.useEffect)(()=>{(!r||u.loaded)&&l.current&&s({index:0,type:"LAST_ACTIVE_INDEX_SET"})},[s,r,u.loaded]),(0,oN.useEffect)(()=>{r||!l.current||o||s({type:"ORDERING_RESET"})},[s,r,o]),(0,oN.useEffect)(()=>{(null==l?void 0:l.current)||(l.current=!0)},[]),n}function Z6(e,n){return n?e[n]:void 0}function Z9(e,n){var r;return{fieldId:n,filterName:e.name,operatorType:(null==(r=null==e?void 0:e.operators.find(e=>"item"===e.type))?void 0:r.name)||""}}function Z7(e){let{fieldDefinitions:n,filterDefinitions:r,filters:i,operatorDefinitions:a}=e;return i.filter(e=>Nr({filter:e,filterDefinitions:r,fieldDefinitions:n,operatorDefinitions:a})).map(e=>{var i;
1return null==(i=Z6(a,e.operatorType))?void 0:i.groqFilter({fieldPath:function(e){let{filter:n,fieldDefinitions:r,filterDefinitions:i}=e,a=Ne(r,n),o=i[n.filterName];if(o)switch(o.type){case"field":return null==a?void 0:a.fieldPath;case"pinned":return null==o?void 0:o.fieldPath;default:return}}({filter:e,fieldDefinitions:n,filterDefinitions:r}),value:null==e?void 0:e.value})}).filter(e=>!cF()(e)).filter(dd).join(" && ")}function Ne(e,n){return(null==n?void 0:n.fieldId)?e[n.fieldId]:void 0}function Nt(e){return[e.filterName,...e.fieldId?[e.fieldId]:[]].join("-")}function Nn(e){let{fieldDefinitions:n,filters:r,types:i}=e,a=i.map(e=>e.name),o=Object.values(n).filter(e=>r.map(e=>null==e?void 0:e.fieldId).includes(e.id)).filter(e=>e.documentTypes.length>0).map(e=>e.documentTypes),l=sk()(...o),s=[];return a.length>0&&s.push(a),l.length>0&&s.push(l),sk()(...s).sort()}function Nr(e){let{filter:n,filterDefinitions:r,fieldDefinitions:i,operatorDefinitions:a}=e,o=r[n.filterName],l=Z6(a,n.operatorType),s=Ne(i,n);return!!(o&&l&&(!n.fieldId||s)&&("field"!==o.type||(null==s?void 0:s.fieldPath)&&n.fieldId&&l.groqFilter({fieldPath:s.fieldPath,value:n.value}))&&("pinned"!==o.type||l.groqFilter({fieldPath:o.fieldPath,value:n.value})))}var Ni=Object.freeze,Na=Object.defineProperty;let No=(0,cM.ZP)("escape"),Nl=oV.ZP.div(iV||(iV=Ni(Na(ex=["\n  background: transparent;\n  height: 100%;\n  left: 0;\n  position: fixed;\n  top: 0;\n  width: 100%;\n  z-index: -1;\n"],"raw",{value:Ni(ex.slice())}))));function Ns(e){let{anchorElement:n,children:r,onClose:i}=e,{isTopLayer:a}=(0,oK.sJ)(),o=(0,oN.useCallback)(e=>{No(e)&&a&&i()},[a,i]);(0,oK.qh)(o);let l=function(e){let[n,r]=(0,oN.useState)(e&&Nc(e)),i=(0,oN.useCallback)(()=>{e&&r(Nc(e))},[e]);return(0,oN.useEffect)(()=>{e&&r(Nc(e))},[e]),(0,oN.useEffect)(()=>(window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)),[i]),n}(n||null);return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(Nl,{onClick:i}),(0,oZ.jsx)(lg.ZP,{autoFocus:!1,returnFocus:!0,children:(0,oZ.jsx)(oK.Zb,{display:"flex",overflow:"hidden",radius:3,style:{maxHeight:"min(calc(100vh - ".concat(l,"px - ").concat(5,"px - ").concat(Ra,"px), ").concat(500,"px"),zIndex:1},children:(0,oZ.jsx)(oK.kC,{children:r})})})]})}function Nc(e){let n=e.getBoundingClientRect();return n.y+n.height+5}var Nd=Object.freeze,Nu=Object.defineProperty,Np=(e,n)=>Nd(Nu(e,"raw",{value:Nd(n||e.slice())}));let Nh=(0,oV.ZP)(oK.xu)(iK||(iK=Np(["\n  border-bottom: 1px solid ",";\n  flex-shrink: 0;\n"])),e=>{let{theme:n}=e;return n.sanity.color.base.border}),Nf=(0,oV.ZP)(oK.kC)(iB||(iB=Np(["\n  box-sizing: border-box;\n"]))),Nm=(0,oN.forwardRef)(function(e,n){let{ariaInputLabel:r,onChange:i,onClear:a,typeFilter:o}=e,{state:{fullscreen:l}}=M5(),{t:s}=dV();return(0,oZ.jsx)(Nh,{children:(0,oZ.jsx)(Nf,{align:"center",flex:1,padding:1,children:(0,oZ.jsx)(Fx,{__unstable_disableFocusRing:!0,$smallClearButton:!0,"aria-label":r,autoComplete:"off",border:!1,clearButton:!!o,fontSize:l?2:1,icon:lp.W1M,muted:!0,onChange:i,onClear:a,placeholder:s("search.filter-placeholder"),ref:n,spellCheck:!1,radius:2,value:o})})})});function Ng(e){let{fieldDefinitions:n,filterDefinitions:r,filters:i,id:a,headerTitle:o,tone:l}=e,s=i.map(e=>({fieldDefinition:Ne(n,e),filterDefinition:r[e.filterName],filter:e,group:a,tone:l||"default",type:"filter"}));return s.length>0?[...o?[{title:o||"",tone:l||"default",type:"header"}]:[],...s]:[]}function Nx(e,n){return e.title.toLowerCase().includes(n.toLowerCase())}function Nv(e){return"pinned"===e.type&&void 0!==(null==e?void 0:e.group)}function Ny(e){return"pinned"===e.type&&void 0===(null==e?void 0:e.group)}function Nb(e){let{filter:n,maxLength:r}=e,{state:{definitions:i}}=M5(),a=(0,oN.useMemo)(()=>{let e=i.filters[n.filterName];switch(null==e?void 0:e.type){case"field":{let e=Ne(i.fields,n);if(null==e?void 0:e.titlePath)return e.titlePath[e.titlePath.length-1];return null}case"pinned":return e.title;default:return null}},[i,n]);return a?r&&a.length>r?(0,oZ.jsxs)("span",{children:[a.slice(0,r),"…"]}):(0,oZ.jsx)("span",{children:a}):null}function Nj(e){var n;let{filter:r}=e,{state:{definitions:i}}=M5(),a=null==(n=i.filters[r.filterName])?void 0:n.icon;return a?(0,oN.createElement)(a):(0,oZ.jsx)(lp.Tzq,{})}function Nw(e){var n;let{filter:r}=e,{state:{definitions:i}}=M5(),a=Ne(i.fields,r);return(0,oZ.jsxs)(oK.Kq,{space:2,children:[(null==a?void 0:a.titlePath)&&(null==(n=a.titlePath)?void 0:n.length)>1&&(0,oZ.jsx)(oK.xu,{marginLeft:4,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:0,children:a.titlePath.slice(0,-1).map((e,n)=>(0,oZ.jsxs)(oN.Fragment,{children:[(0,oZ.jsx)("span",{children:e}),n!==a.titlePath.length-2&&(0,oZ.jsx)("span",{style:{opacity:.75,paddingLeft:"0.25em",paddingRight:"0.25em"},children:(0,oZ.jsx)(lp.XCv,{})})]},n))})}
1),(0,oZ.jsxs)(oK.kC,{align:"flex-start",gap:3,children:[(0,oZ.jsx)(oK.xu,{style:{flexShrink:0},children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(Nj,{filter:r})})}),(0,oZ.jsx)(oK.xv,{size:1,weight:"medium",children:(0,oZ.jsx)(Nb,{filter:r})})]})]})}function Nk(e){var n,r;return(0,oN.isValidElement)(e)?(n=(0,cD.Dq)(e),(null==(r=new DOMParser().parseFromString(n,"text/html"))?void 0:r.body.textContent)||""):"string"==typeof e?e:""}function NC(e){let{children:n,fieldDefinition:r,filterDefinition:i,visible:a}=e,{state:{documentTypesNarrowed:o}}=M5(),{t:l}=dV(),s=h1(),c=(0,oN.useMemo)(()=>(null==r?void 0:r.documentTypes)?r.documentTypes.map(e=>{let n=s.get(e);return(null==n?void 0:n.title)||lf()(null==n?void 0:n.name)}).filter(dd).sort():[],[null==r?void 0:r.documentTypes,s]),d=(0,oN.useMemo)(()=>{if(null==r?void 0:r.documentTypes){let e=r.documentTypes.map(e=>{let n=s.get(e);if(n){let e=M9(n,r.fieldPath);return(null==e?void 0:e.type.description)&&Nk(null==e?void 0:e.type.description)}return null}).filter(dd).sort(),n=sz()(e);if(1===n.length)return n[0]}},[null==r?void 0:r.documentTypes,null==r?void 0:r.fieldPath,s]);return(0,oZ.jsx)(lr.u,{content:(0,oZ.jsx)(oK.Zb,{tone:"default",radius:2,style:{maxWidth:"250px"},children:(0,oZ.jsxs)(oK.Kq,{space:4,children:[r&&(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:l("search.filter-field-tooltip-name")}),(0,oZ.jsx)(LT,{size:1,style:{fontFamily:"monospace"},tone:"primary",textOverflow:"ellipsis",children:null==r?void 0:r.name})]}),d&&(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:l("search.filter-field-tooltip-description")}),(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:dM(d,256)})]}),(null==i?void 0:i.description)&&(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:dM(i.description,256)}),!o.length&&c.length>0&&(0,oZ.jsxs)(oK.Kq,{space:2,children:[(0,oZ.jsxs)(oK.kC,{align:"center",gap:1,children:[(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:l("search.filter-field-tooltip-used-in-document-types")}),(0,oZ.jsx)(oK.Zb,{padding:1,radius:2,tone:"transparent",children:(0,oZ.jsx)(oK.xv,{size:1,muted:!0,children:c.length})})]}),(0,oZ.jsxs)(oK.xv,{size:1,weight:"regular",muted:!0,children:[c.slice(0,10).join(", "),(null==c?void 0:c.length)>10?" +".concat(c.length-10," more"):""]})]})]})}),disabled:!a,fallbackPlacements:["left"],placement:"right",portal:!0,children:n})}let N_=oN.memo(function(e){let{item:n,onClose:r,...i}=e,{dispatch:a,state:{filters:o}}=M5(),l=(0,oN.useCallback)(()=>{a({filter:n.filter,type:"TERMS_FILTERS_ADD"}),null==r||r()},[a,n.filter,r]),s=!!o.find(e=>Nt(e)===Nt(n.filter)),c=!!(n.fieldDefinition||n.filterDefinition.description);return(0,oZ.jsx)(oK.xu,{...i,children:(0,oZ.jsx)(oK.zx,{disabled:s,fontSize:1,justify:"flex-start",mode:"bleed",onClick:s?void 0:l,padding:0,style:{position:"relative",whiteSpace:"normal",width:"100%"},tabIndex:-1,tone:null==n?void 0:n.tone,children:(0,oZ.jsx)(NC,{fieldDefinition:n.fieldDefinition,filterDefinition:n.filterDefinition,visible:c,children:(0,oZ.jsx)(oK.xu,{padding:3,children:(0,oZ.jsx)(Nw,{filter:n.filter})})})})})}),NT=oN.memo(function(e){let{item:n}=e;return(0,oZ.jsx)(oK.xu,{paddingTop:1,children:(0,oZ.jsx)(oK.Zb,{borderBottom:!0,paddingX:2,paddingY:3,tone:null==n?void 0:n.tone,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,textOverflow:"ellipsis",weight:"medium",children:n.title})})})}),NS={width:"300px"};function NE(e){let{onClose:n}=e,[r,i]=(0,oN.useState)(null),[a,o]=(0,oN.useState)(""),{t:l}=dV(),s=(0,oN.useCallback)(e=>o(e.currentTarget.value),[o]),c=(0,oN.useCallback)(()=>o(""),[]),d=h1(),{state:{documentTypesNarrowed:u,definitions:p,filters:h,terms:{types:f}}}=M5(),m=(0,oN.useMemo)(()=>(function(e){let{documentTypesNarrowed:n,fieldDefinitions:r,filterDefinitions:i,schema:a,titleFilter:o,types:l,t:s}=e,c=Object.values(r).filter(e=>e.titlePath.join("/").toLowerCase().includes(o.toLowerCase())).map(e=>{let n=i[e.filterName];return n?Z9(n,e.id):null}).filter(dd),d=function(e){let{fieldDefinitions:n,filterDefinitions:r,titleFilter:i}=e,a=Object.values(r).filter(Ny).filter(e=>Nx(e,i)).map(e=>Z9(e)),o=Object.values(r).filter(Nv).filter(e=>Nx(e,i)).reduce((e,n)=>(e[n.group]=e[n.group]||[],e[n.group].push(Z9(n)),e),{});return[...Ng({fieldDefinitions:n,filterDefinitions:r,filters:a,id:"pinned-ungrouped",tone:"primary"}),...Object.entries(o).flatMap(e=>{let[i,a]=e;return Ng({fieldDefinitions:n,filterDefinitions:r,filters:a,headerTitle:i,id:i,tone:"primary"})})]}({fieldDefinitions:r,filterDefinitions:i,titleFilter:o});return 0===n.length?[...d,...Ng({fieldDefinitions:r,filterDefinitions:i,filters:c,headerTitle:s("search.filter-all-fields-header"),id:"field"})]:[...d,...function(e){let{documentTypesNarrowed:n,fieldDefinitions:r,filterDefinitions:i,filters:a,schema:o,types:l,t:s}=e,c=a.filter(e=>{var i;return i=Ne(r,e),0===cd()(n,(null==i?void 0:i.documentTypes)||[]).length});return[...n.length>1&&l.length>1?Ng({fieldDefinitions:r,filterDefinitions:i,filters:c,headerTitle:s("search.filter-shared-fields-header"),id:"shared",tone:"primary"}):[],...n.map(e=>{let n=o.get(e);return{title:(null==n?void 0:n.title)||lf()(null==n?void 0:n.name)||"(Unknown type)",documentType:e}}).sort((e,n)=>e.title.localeCompare(n.title)).map(e=>{let{documentType:n,title:o}=e,l=a.filter(e=>{var i,a;return i=[n],null==(a=Ne(r,e))?void 0:a.documentTypes.some(e=>i.includes(e))});return Ng({fieldDefinitions:r,filterDefinitions:i,filters:l,id:o,headerTitle:o})}).flat()]}({documentTypesNarrowed:n,fieldDefinitions:r,filterDefinitions:i,filters:c,schema:a,types:l,t:s})]})({documentTypesNarrowed:u,fieldDefinitions:p.fields,filterDefinitions:p.filters,schema:d,titleFilter:a,types:f,t:l}),[u,p.fields,p.filters,d,a,f,l]),g=(0,oN.useCallback)(e=>"filter"===e.type?(0,oZ.jsx)(N_,{item:e,onClose:n,paddingBottom:1}):"header"===e.type?(0,oZ.jsx)(NT,{item:e}):null,[n]),x=(0,oN.useCallback)(e=>{let n=m[e];return"filter"!==n.type||!!h.find(e=>Nt(e)===Nt(n.filter))},[m,h]),v=(0,oN.useCallback)(e=>{let n=m[e];switch(n.type){case"filter":return[...n.group?[n.group]:[],Nt(n.filter)].join("-");case"header":return"".concat(n.type,"-").concat(n.title);default:return e}},[m]);return(0,oZ.jsxs)(oK.kC,{direction:"column",style:NS,children:[(0,oZ.jsx)(Nm,{ariaInputLabel:l("search.filter-by-title-aria-label"),onChange:s,onClear:c,ref:i,typeFilter:a}),(0,oZ.jsxs)(oK.kC,{children:[m.length>0&&(0,oZ.jsx)(ux,{activeItemDataAttr:"data-hovered",ariaLabel:l("search.filters-aria-label",{count:m.length}),autoFocus:"input",getItemDisabled:x,getItemKey:v,inputElement:r,itemHeight:45,items:m,overscan:20,padding:1,paddingBottom:0,renderItem:g}),0==m.length&&(0,oZ.jsx)(oK.xu,{padding:3,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,textOverflow:"ellipsis",children:l("search.filter-no-matches-found",{filter:a})})})]})]})}function NP(){let[e,n]=(0,oN.useState)(!1),[r,i]=(0,oN.useState)(null),[a,o]=(0,oN.useState)(null),{t:l}=dV(),{state:{fullscreen:s}}=M5(),c=(0,oN.useCallback)(()=>n(!1),[]),d=(0,oN.useCallback)(()=>n(!0),[]);return(0,oK.O8)(c,[r,a]),(0,oZ.jsx)(lr.J2,{__unstable_margins:[5,0,0,0],content:(0,oZ.jsx)(Ns,{anchorElement:r,onClose:c,children:(0,oZ.jsx)(NE,{onClose:c})}
1),open:e,placement:"bottom-start",radius:3,ref:o,portal:!0,children:(0,oZ.jsx)(lr.zx,{icon:lp.dtP,mode:"bleed",onClick:d,size:s?"large":"default",ref:i,selected:e,text:l("search.action.add-filter")})})}let NO=oN.memo(function(e){var n,r;let{selected:i,type:a,...o}=e,{dispatch:l}=M5(),s=(0,oN.useCallback)(()=>{l({type:"TERMS_TYPE_ADD",schemaType:a})},[l,a]),c=(0,oN.useCallback)(()=>{l({type:"TERMS_TYPE_REMOVE",schemaType:a})},[l,a]),d=(0,oN.useCallback)(()=>{i?c():s()},[s,c,i]);return(0,oZ.jsx)(oK.xu,{...o,children:(0,oZ.jsx)(lr.zx,{iconRight:i&&lp.KML,justify:"flex-start",mode:"bleed",onClick:d,width:"fill",size:"large",tabIndex:-1,text:null!=(r=a.title)?r:a.name,tone:i?"primary":"default"},null!=(n=a.title)?n:a.name)})});var NA=Object.freeze,NI=Object.defineProperty;let Nz=(0,oV.ZP)(oK.xu)(iU||(iU=NA(NI(ev=["\n  border-top: 1px solid ",";\n  flex-shrink: 0;\n"],"raw",{value:NA(ev.slice())}))),e=>{let{theme:n}=e;return n.sanity.color.base.border}),NM={width:"250px"};function NR(){let[e,n]=(0,oN.useState)(null),[r,i]=(0,oN.useState)(""),a=(0,oN.useRef)(null),{t:o}=dV(),l=h1(),{dispatch:s,state:{terms:{types:c}}}=M5(),[d,u]=(0,oN.useState)(c),p=(0,oN.useMemo)(()=>{let[e,n]=sS()(Rl(l).filter(e=>{var n;return!r||(null!=(n=e.title)?n:e.name).toLowerCase().includes(null==r?void 0:r.toLowerCase())}).sort(Rs),e=>d.includes(e)),i=e.length>0,a=e.length>0,o=[];return i&&o.push({title:"Selected",type:"header"}),e.forEach(e=>o.push({item:e,selected:c.includes(e),type:"item"})),i&&a&&o.push({type:"divider"}),n.forEach(e=>o.push({item:e,selected:c.includes(e),type:"item"})),o},[l,c,d,r]),h=(0,oN.useCallback)(e=>i(e.currentTarget.value),[i]),f=(0,oN.useCallback)(()=>i(""),[]),m=(0,oN.useCallback)(()=>{var e,n;u([]),s({type:"TERMS_TYPES_CLEAR"}),null==(e=null==a?void 0:a.current)||e.focusInputElement(),null==(n=null==a?void 0:a.current)||n.scrollToIndex(0)},[s]),g=(0,oN.useCallback)(e=>{let n=p[e];switch(n.type){case"divider":return"".concat(n.type,"-").concat(e);case"header":return"".concat(n.type,"-").concat(n.title);case"item":return"".concat(n.type,"-").concat(n.item.name);default:return e}},[p]),x=(0,oN.useCallback)(e=>"divider"===e.type?(0,oZ.jsx)(oK.xu,{paddingY:1,children:(0,oZ.jsx)(oK.R,{})}):"header"===e.type?(0,oZ.jsx)(oK.xu,{margin:2,padding:1,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:e.title})}):"item"===e.type?(0,oZ.jsx)(NO,{paddingBottom:1,selected:e.selected,type:e.item}):null,[]),v=(0,oN.useCallback)(e=>"item"!==p[e].type,[p]),y=(0,oN.useCallback)(e=>{let n=p[e];return"item"===n.type&&n.selected},[p]);return(0,oZ.jsxs)(oK.kC,{direction:"column",style:NM,children:[(0,oZ.jsx)(Nm,{ariaInputLabel:o("search.action.filter-by-document-type-aria-label"),onChange:h,onClear:f,ref:n,typeFilter:r}),(0,oZ.jsxs)(oK.kC,{children:[p.length>0&&(0,oZ.jsx)(ux,{activeItemDataAttr:"data-hovered",ariaLabel:o("search.document-types-aria-label"),ariaMultiselectable:!0,autoFocus:"input",getItemDisabled:v,getItemSelected:y,getItemKey:g,inputElement:e,itemHeight:37,items:p,overscan:20,padding:1,paddingBottom:0,ref:a,renderItem:x}),!p.length&&(0,oZ.jsx)(oK.xu,{padding:3,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,textOverflow:"ellipsis",children:o("search.document-types-no-matches-found",{filter:r})})})]}),!r&&c.length>0&&(0,oZ.jsx)(NF,{onClick:m,selectedTypes:c})]})}function NF(e){let{onClick:n,selectedTypes:r}=e,{t:i}=dV();return(0,oZ.jsx)(Nz,{padding:1,children:(0,oZ.jsx)(oK.Kq,{children:(0,oZ.jsx)(lr.zx,{"aria-label":i("search.action.clear-type-filters-aria-label"),"data-name":"type-filter-button",disabled:0===r.length,mode:"bleed",onClick:n,text:i("search.action.clear-type-filters-label"),tone:"primary"})})})}let ND=["top-start","bottom-start"];function Nq(){let[e,n]=(0,oN.useState)(!1),[r,i]=(0,oN.useState)(null),[a,o]=(0,oN.useState)(null),{state:{fullscreen:l,terms:{types:s}}}=M5(),{t:c}=dV(),d=(0,oN.useCallback)(()=>n(!1),[]),u=(0,oN.useCallback)(()=>n(!0),[]);(0,oK.O8)(d,[r,a]);let p=(0,oN.useMemo)(()=>Rf({types:s,t:c}),[s,c]);return(0,oZ.jsx)(lr.J2,{__unstable_margins:[5,0,0,0],content:(0,oZ.jsx)(Ns,{anchorElement:r,onClose:d,children:(0,oZ.jsx)(NR,{})}),open:e,placement:"bottom-start",fallbackPlacements:ND,portal:!0,radius:3,ref:o,children:(0,oZ.jsx)(lr.zx,{iconRight:lp.v4q,mode:"ghost",onClick:u,size:l?"large":"default",ref:i,selected:e,text:p,tone:"default"})})}var NZ=Object.freeze,NN=Object.defineProperty;let NL=(0,oV.ZP)(oK.xu)(iH||(iH=NZ(NN(ey=["\n  flex-shrink: ",";\n"],"raw",{value:NZ(ey.slice())}))),e=>{let{$flexShrink:n=0}=e;return n});function NV(e){let{filter:n,fontSize:r=1,showContent:i=!0}=e,{t:a}=dV(),{state:{definitions:o,fullscreen:l}}=M5(),s=Z6(o.operators,n.operatorType),c=null==s?void 0:s.buttonValueComponent,d=n.value,u=(0,oN.useMemo)(()=>({Field:()=>(0,oZ.jsx)(NL,{$flexShrink:l?1:0,children:(0,oZ.jsx)(LT,{tone:"default",size:r,textOverflow:"ellipsis",weight:"medium",children:(0,oZ.jsx)(Nb,{filter:n,maxLength:l?25:40})})}),Operator:e=>{let{children:n}=e;return i?(0,oZ.jsx)(NL,{$flexShrink:0,children:(0,oZ.jsx)(LT,{tone:"default",size:r,textOverflow:"ellipsis",weight:"regular",children:n})}):null},Value:e=>{let{children:n}=e;return i?(0,oZ.jsx)(NL,{$flexShrink:1,children:(0,oZ.jsx)(LT,{tone:"default",size:r,textOverflow:"ellipsis",weight:"medium",children:c?(0,oZ.jsx)(c,{value:d}):n})}):null}}
1),[n,r,l,i,c,d]);if((null==s?void 0:s.descriptionKey)||console.warn("Missing `descriptionKey` for operator `%s`",n.operatorType),!i||!(null==s?void 0:s.descriptionKey)){let e=u.Field;return(0,oZ.jsx)(oK.kC,{align:"center",gap:1,children:(0,oZ.jsx)(e,{})})}return(0,oZ.jsx)(oK.kC,{align:"center",gap:1,children:(0,oZ.jsx)(uz,{t:a,i18nKey:null==s?void 0:s.descriptionKey,components:u,values:function(e){let n={};return"number"==typeof e.value&&(n.count=e.value),NK(e.value)&&(n.value=e.value),dj(e.value)&&"from"in e.value&&NK(e.value.from)&&(n.from=e.value.from),dj(e.value)&&"to"in e.value&&NK(e.value.to)&&(n.to=e.value.to),n}(n)})})}function NK(e){return"string"==typeof e||"number"==typeof e}function NB(e){let{t:n}=dV();return(0,oZ.jsx)(oK.xu,{...e,children:(0,oZ.jsxs)(oK.kC,{align:"flex-start",gap:3,children:[(0,oZ.jsx)(LT,{tone:"critical",children:(0,oZ.jsx)(lp.uIy,{})}),(0,oZ.jsxs)(oK.Kq,{space:4,children:[(0,oZ.jsx)(LT,{size:1,tone:"critical",weight:"medium",children:n("search.error.display-filter-title")}),(0,oZ.jsx)(LT,{size:1,tone:"critical",children:n("search.error.display-filter-description")})]})]})})}function NU(e){let{onClick:n,operator:r,selected:i}=e,a=(0,oN.useCallback)(()=>n(r.type),[n,r.type]),{t:o}=dV();return(0,oZ.jsx)(lr.sN,{onClick:a,pressed:i,tone:"default",text:o(r.nameKey),iconRight:null==r?void 0:r.icon})}function NH(e){var n;let{filter:r,operator:i}=e,a=(0,oN.useId)(),{t:o}=dV(),{dispatch:l,state:s}=M5(),c=null==(n=s.definitions.filters[r.filterName])?void 0:n.operators,d=(0,oN.useCallback)(e=>{l({filterKey:Nt(r),operatorType:e,type:"TERMS_FILTERS_SET_OPERATOR"})},[l,r]);return i&&c&&!(c.length<=1)?(0,oZ.jsx)(oK.gF,{children:(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(lr.zx,{mode:"ghost",iconRight:lp.v4q,text:o(i.nameKey)}),id:a||"",menu:(0,oZ.jsx)(oK.v2,{children:c.map((e,n)=>{if("item"===e.type){let r=Z6(s.definitions.operators,e.name);return r?(0,oZ.jsx)(NU,{onClick:d,operator:r,selected:i.type===e.name},n):null}return"divider"===e.type?(0,oZ.jsx)(oK.R,{},n):null})}),placement:"bottom-start",popover:{constrainSize:!0,portal:!1,radius:2}})}):null}function N$(e){let{filter:n}=e,[r,i]=(0,oN.useState)(null),{dispatch:a,state:{definitions:o,fullscreen:l}}=M5(),s=o.filters[n.filterName],c=Z6(o.operators,n.operatorType),d=Ne(o.fields,n),u=Nt(n),p=(0,oN.useCallback)(()=>{a({filterKey:Nt(n),type:"TERMS_FILTERS_REMOVE"})},[a,n]),h=(0,oN.useCallback)(e=>{a({filterKey:u,type:"TERMS_FILTERS_SET_VALUE",value:e})},[a,u]),f=(0,oN.useCallback)(e=>{i(e)},[]),m=null==c?void 0:c.inputComponent;return r?(0,oZ.jsx)(NB,{padding:4}):(0,oZ.jsx)(oK.SV,{onCatch:f,children:(0,oZ.jsx)(lg.ZP,{autoFocus:!dI,returnFocus:!0,children:(0,oZ.jsxs)(oK.kC,{direction:"column-reverse",children:[m&&(0,oZ.jsx)(oK.Zb,{borderTop:!0,padding:3,children:(0,oZ.jsx)(m,{fieldDefinition:d,onChange:h,value:n.value},n.operatorType)}),(0,oZ.jsx)(oK.Zb,{padding:3,children:(0,oZ.jsxs)(oK.Kq,{space:3,children:[(0,oZ.jsxs)(oK.kC,{align:"flex-start",gap:3,justify:"space-between",children:[(0,oZ.jsx)(oK.xu,{paddingLeft:1,paddingRight:2,paddingY:1,children:(0,oZ.jsx)(Nw,{filter:n})}),l&&(0,oZ.jsx)(lr.zx,{icon:lp.XHJ,mode:"bleed",onClick:p,tone:"critical",tooltipProps:{content:"Remove filter"}})]}),(null==s?void 0:s.description)&&(0,oZ.jsx)(oK.Zb,{border:!0,padding:3,radius:2,tone:"transparent",children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:s.description})}),(0,oZ.jsx)(NH,{filter:n,operator:c})]})})]})})})}var NW=Object.freeze,NY=Object.defineProperty;let NX=(0,oV.ZP)(oK.kC)(i$||(i$=NW(NY(eb=["\n  max-width: 480px;\n  min-width: 150px;\n  overflow: hidden;\n  overflow: clip;\n  width: 100%;\n"],"raw",{value:NW(eb.slice())}))));function NG(e){let{filter:n}=e;return(0,oZ.jsxs)(NX,{direction:"column",children:[(0,oZ.jsx)(N$,{filter:n}),!1]})}var NJ=Object.freeze,NQ=Object.defineProperty,N0=(e,n)=>NJ(NQ(e,"raw",{value:NJ(n||e.slice())}));let N1=(0,oV.ZP)(oK.zx)(iW||(iW=N0(["\n  border-radius: ",";\n"])),e=>{let{theme:n}=e;return"0 ".concat((0,oK.hO)(n.sanity.radius[2])," ").concat((0,oK.hO)(n.sanity.radius[2])," 0")}),N2=(0,oV.ZP)(oK.Zb)(iY||(iY=N0(["\n  position: absolute;\n  right: 0;\n"]))),N3=oV.ZP.div(iX||(iX=N0(["\n  align-items: center;\n  display: inline-flex;\n  max-width: 100%;\n  position: relative;\n"]))),N4=(0,oV.ZP)(oK.zx)(iG||(iG=N0(["\n  border: none;\n  width: 100%;\n"])));function N5(e){let{filter:n,initialOpen:r}=e,[i,a]=(0,oN.useState)(r),[o,l]=(0,oN.useState)(null),[s,c]=(0,oN.useState)(null),{dispatch:d,state:{definitions:u,fullscreen:p}}=M5(),{t:h}=dV(),f=(0,oN.useCallback)(()=>a(!1),[]),m=(0,oN.useCallback)(()=>a(!0),[]),g=(0,oN.useCallback)(()=>d({filterKey:Nt(n),type:"TERMS_FILTERS_REMOVE"}),[d,n]),x=(0,oN.useCallback)(e=>
1{["Backspace","Delete"].includes(e.key)&&g()},[g]);(0,oK.O8)(f,[o,s]);let v=Nr({fieldDefinitions:u.fields,filter:n,filterDefinitions:u.filters,operatorDefinitions:u.operators});return(0,oZ.jsx)(lr.J2,{__unstable_margins:[5,0,0,0],content:(0,oZ.jsx)(Ns,{anchorElement:o,onClose:f,children:(0,oZ.jsx)(NG,{filter:n})}),constrainSize:!0,open:i,overflow:"auto",placement:"bottom-start",portal:!0,radius:3,ref:c,children:(0,oZ.jsxs)(N3,{children:[(0,oZ.jsx)(oK.Zb,{__unstable_focusRing:!0,display:"flex",radius:2,tone:v?"primary":"transparent",children:(0,oZ.jsx)(N4,{mode:"bleed",onClick:m,onKeyDown:x,paddingLeft:p?3:2,paddingRight:p?3:5,paddingY:p?3:2,ref:l,children:(0,oZ.jsx)(NV,{filter:n,showContent:v})})}),!p&&(0,oZ.jsx)(N2,{__unstable_focusRing:!0,display:"flex",radius:2,tone:v?"primary":"transparent",children:(0,oZ.jsx)(N1,{"aria-label":h("search.action.remove-filter-aria-label"),fontSize:1,icon:lp.Two,mode:"bleed",onClick:g,onKeyDown:x,padding:2,radius:2})})]})})}function N8(){let{dispatch:e,state:{filters:n,fullscreen:r,lastAddedFilter:i,terms:{types:a}}}=M5(),{t:o}=dV(),l=(0,oN.useRef)(!1),s=(0,oN.useCallback)(()=>{e({type:"TERMS_FILTERS_CLEAR"}),e({type:"TERMS_TYPES_CLEAR"})},[e]),c=n.length>0||a.length>0;(0,oN.useEffect)(()=>{l.current=!0},[]);let d=i&&Nt(i),u=()=>(0,oZ.jsx)(lr.zx,{mode:"bleed",onClick:s,size:r?"large":"default",text:o("search.action.clear-filters"),tone:"critical"});return(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsxs)(oK.kC,{align:"flex-start",gap:3,justify:"space-between",padding:2,children:[(0,oZ.jsxs)(oK.kC,{flex:1,gap:2,wrap:"wrap",children:[(0,oZ.jsx)(Nq,{}),null==n?void 0:n.map(e=>{let n=Nt(e);return(0,oZ.jsx)(N5,{filter:e,initialOpen:l.current&&d===n},n)}),!r&&(0,oZ.jsx)(NP,{})]}),c&&!r&&(0,oZ.jsx)(u,{})]}),r&&(0,oZ.jsxs)(oK.kC,{justify:"space-between",paddingBottom:2,paddingX:2,children:[(0,oZ.jsx)(NP,{}),c&&(0,oZ.jsx)(u,{})]}),!1]})}function N6(){let{t:e}=dV();return(0,oZ.jsx)(oK.kC,{align:"center",direction:"column",gap:4,paddingX:4,paddingY:5,children:(0,oZ.jsx)(oK.gF,{space:3,children:(0,oZ.jsx)(oK.xv,{muted:!0,children:(0,oZ.jsx)(uz,{t:e,i18nKey:"search.instructions",components:{ControlsIcon:()=>(0,oZ.jsx)(lp.d$S,{style:{padding:"0 0.25rem"}},0)}})})})})}function N9(e){let{availableCharacters:n,types:r}=e,{t:i}=dV(),a=(0,oN.useMemo)(()=>Rf({availableCharacters:n,types:r,t:i}),[n,r,i]);return(0,oZ.jsx)(oK.Zb,{border:!0,padding:2,radius:2,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:a})})}var N7=Object.freeze,Le=Object.defineProperty;let Lt=(0,oV.ZP)(oK.Zb)(iJ||(iJ=N7(Le(ej=["\n  cursor: default;\n"],"raw",{value:N7(ej.slice())}))));function Ln(e){let{filter:n}=e;return(0,oZ.jsx)(Lt,{border:!0,padding:2,radius:2,tone:"primary",children:(0,oZ.jsx)(NV,{filter:n})})}var Lr=Object.freeze,Li=Object.defineProperty,La=(e,n)=>Lr(Li(e,"raw",{value:Lr(n||e.slice())}));let Lo=(0,oV.ZP)(oK.zx)(iQ||(iQ=La(["\n  border-radius: ",";\n  cursor: default;\n  width: 100%;\n"])),e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.radius[2])}),Ll=(0,oV.ZP)(oK.xu)(i0||(i0=La(["\n  flex-shrink: 3;\n"]))),Ls=(0,oV.ZP)(oK.kC)(i1||(i1=La(["\n  flex-shrink: 2;\n"]))),Lc=oV.ZP.div(i2||(i2=La(["\n  opacity: 0.8;\n  visibility: hidden;\n\n  @media (hover: hover) {\n    ",":hover & {\n      visibility: visible;\n    }\n    &:hover {\n      opacity: 0.4;\n    }\n  }\n"])),Lo);function Ld(e){var n;let{index:r,maxVisibleTypePillChars:i=40,value:a,...o}=e,{dispatch:l,recentSearchesStore:s}=M5(),c=i-a.query.length,d=(0,oN.useCallback)(()=>{l({type:"TERMS_SET",filters:null==a?void 0:a.filters,terms:a}),s&&l({recentSearches:null==s?void 0:s.addSearch(a,null==a?void 0:a.filters),type:"RECENT_SEARCHES_SET"})},[l,s,a]),u=(0,oN.useCallback)(e=>{e.stopPropagation(),s&&l({recentSearches:null==s?void 0:s.removeSearchAtIndex(r),type:"RECENT_SEARCHES_SET"})},[l,r,s]);return(0,oZ.jsx)(oK.xu,{...o,children:(0,oZ.jsx)(Lo,{mode:"bleed",onClick:d,paddingLeft:3,paddingRight:1,paddingY:1,tabIndex:-1,children:(0,oZ.jsxs)(oK.kC,{align:"stretch",children:[(0,oZ.jsxs)(oK.gF,{paddingY:2,children:[(0,oZ.jsx)(oK.xv,{muted:!0,size:1,children:(0,oZ.jsx)(lp.T39,{})}),(0,oZ.jsx)(oK.xv,{children:"​"})]}),(0,oZ.jsxs)(oK.kC,{align:"stretch",flex:1,gap:2,justify:"flex-start",marginLeft:3,wrap:"wrap",children:[a.query&&(0,oZ.jsx)(Ls,{align:"center",paddingY:2,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,textOverflow:"ellipsis",weight:"medium",children:a.query})}),a.types.length>0&&(0,oZ.jsx)(Ll,{children:(0,oZ.jsx)(N9,{availableCharacters:c,types:a.types})}),null==(n=null==a?void 0:a.filters)?void 0:n.map((e,n)=>(0,oZ.jsx)(Ln,{filter:e},n))]}),(0,oZ.jsx)(oK.kC,{align:"center",children:(0,oZ.jsx)(Lc,{onClick:u,children:(0,oZ.jsx)(oK.kC,{padding:2,children:(0,oZ.jsx)(oK.xv,{size:1,children:(0,oZ.jsx)(lp.Two,{})})})})})]})})})}var Lu=Object.freeze,Lp=Object.defineProperty;let Lh=(0,oV.ZP)(oK.Zb)(i3||(i3=Lu(Lp(ew=["\n  overflow-x: hidden;\n  overflow-y: auto;\n  position: relative;\n"],"raw",{value:Lu(ew.slice())}))));function Lf(e){let{inputElement:n}=e,{dispatch:r,recentSearchesStore:i,state:{filtersVisible:a,fullscreen:o,recentSearches:l}}=M5(),s=(0,oN.useRef)(null),{t:c}=dV(),d=(0,oN.useCallback)(()=>{var e;i&&r({recentSearches:i.removeSearch(),type:"RECENT_SEARCHES_SET"}),null==(e=null==s?void 0:s.current)||e.focusInputElement()},[r,i]),u=(0,oK.d2)(),p=(0,oN.useMemo)(()=>u<2?20:40,[u]),h=(0,oN.useCallback)((e,n)=>{let{virtualIndex:r}=n;return(0,oZ.jsx)(Ld,{index:r,maxVisibleTypePillChars:p,paddingBottom:1,value:e})},[p]),f=!!l.length;return(0,oZ.jsx)(Lh,{borderTop:f||!f&&!a&&o,flex:1,children:l.length>0?(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(oK.xu,{paddingBottom:2,paddingTop:4,paddingX:3,children:(0,oZ.jsx)(oK.xv,{muted:!0,size:1,weight:"medium",children:c("search.recent-searches-label")})}),(0,oZ.jsx)(oK.xu,{children:(0,oZ.jsx)(ux,{activeItemDataAttr:"data-hovered",ariaLabel:c("search.recent-searches-aria-label"),inputElement:n,initialIndex:0,itemHeight:36,items:l,paddingX:2,paddingY:1,renderItem:h})}),(0,oZ.jsx)(oK.xu,{paddingBottom:2,paddingTop:1,paddingX:2,children:(0,oZ.jsx)(lr.zx,{mode:"bleed",onClick:d,tone:"default",text:c("search.action.clear-recent-searches"),muted:!0}
1)})]}):!a&&o&&(0,oZ.jsx)(N6,{})})}var Lm=Object.freeze,Lg=Object.defineProperty,Lx=(e,n)=>Lm(Lg(e,"raw",{value:Lm(n||e.slice())}));let Lv=(0,oV.F4)(i4||(i4=Lx(["\n  from {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(360deg);\n  }\n"]))),Ly=(0,oV.ZP)(lp.L4p)(i5||(i5=Lx(["\n  animation: "," 500ms linear infinite;\n"])),Lv),Lb=oV.ZP.div(i8||(i8=Lx(["\n  line-height: 0;\n  position: relative;\n"]))),Lj=(0,oN.forwardRef)(function(e,n){let{ariaInputLabel:r,onClose:i}=e,a=(0,oN.useRef)(!1),{dispatch:o,state:{filters:l,filtersVisible:s,fullscreen:c,result:{loading:d},terms:{types:u,query:p}}}=M5(),{t:h}=dV(),f=(0,oN.useCallback)(()=>o({type:"FILTERS_VISIBLE_SET",visible:!s}),[o,s]),m=(0,oN.useCallback)(e=>o({type:"TERMS_QUERY_SET",query:e.currentTarget.value}),[o]),g=(0,oN.useCallback)(()=>{o({type:"TERMS_QUERY_SET",query:""})},[o]);(0,oN.useEffect)(()=>{c||o({type:"FILTERS_VISIBLE_SET",visible:!0})},[o,c]),(0,oN.useEffect)(()=>{a.current=!0},[]);let x=l.length>0||u.length>0;return(0,oZ.jsx)(oK.Zb,{flex:"none",children:(0,oZ.jsxs)(oK.kC,{align:"center",flex:1,gap:c?2:1,padding:c?2:1,children:[c&&(0,oZ.jsx)(lr.zx,{"aria-label":h("search.action.close-search-aria-label"),icon:lp.Y4O,mode:"bleed",onClick:i,size:"large",tooltipProps:{content:h("search.action.close-search-aria-label")}}),(0,oZ.jsx)(oK.xu,{flex:1,children:(0,oZ.jsx)(Fx,{__unstable_disableFocusRing:!0,$background:c,$smallClearButton:c,"aria-label":r,autoComplete:"off",border:!1,clearButton:!!p,fontSize:[2,2,1],icon:d?Ly:lp.W1M,onChange:m,onClear:g,placeholder:h("search.placeholder"),radius:2,ref:n,spellCheck:!1,value:p})}),c&&(0,oZ.jsx)(Lb,{children:(0,oZ.jsx)(K7,{"aria-expanded":s,"aria-label":h("search.action.toggle-filters-aria-label",{context:s?"hide":"show"}),icon:lp.d$S,mode:"bleed",onClick:f,selected:s,size:"large",tone:x?"primary":void 0,tooltipProps:{content:h("search.action.toggle-filters-label",{context:s?"hide":"show"})}})})]})})});function Lw(){let{t:e}=dV();return(0,oZ.jsx)(oK.W2,{width:0,children:(0,oZ.jsxs)(oK.Kq,{"aria-live":"assertive",space:4,paddingX:4,paddingY:5,children:[(0,oZ.jsx)(oK.xv,{align:"center",muted:!0,size:1,weight:"medium",children:e("search.no-results-title")}),(0,oZ.jsx)(oK.xv,{align:"center",muted:!0,size:1,children:e("search.no-results-help-description")})]})})}var Lk=Object.freeze,LC=Object.defineProperty;let L_=(0,oV.ZP)(oK.xv)(i6||(i6=Lk(LC(ek=["\n  &:not([data-muted]) {\n    &[data-tone='default'] {\n      --card-fg-color: var(--card-badge-default-fg-color);\n    }\n    &[data-tone='primary'] {\n      --card-fg-color: var(--card-badge-primary-fg-color);\n    }\n    &[data-tone='positive'] {\n      --card-fg-color: var(--card-badge-positive-fg-color);\n    }\n    &[data-tone='caution'] {\n      --card-fg-color: var(--card-badge-caution-fg-color);\n    }\n    &[data-tone='critical'] {\n      --card-fg-color: var(--card-badge-critical-fg-color);\n    }\n  }\n\n  &[data-dimmed] {\n    opacity: 0.3;\n  }\n"],"raw",{value:Lk(ek.slice())})))),LT=oN.forwardRef(function(e,n){let{tone:r,dimmed:i,muted:a,...o}=e;return(0,oZ.jsx)(L_,{"data-ui":"TextWithTone","data-dimmed":i?"":void 0,"data-muted":a?"":void 0,"data-tone":r,muted:a,ref:n,...o})});function LS(){let{t:e}=dV();return(0,oZ.jsxs)(oK.kC,{align:"center","aria-live":"assertive",direction:"column",flex:1,gap:3,marginY:2,padding:4,children:[(0,oZ.jsx)(oK.xu,{marginBottom:1,children:(0,oZ.jsx)(LT,{tone:"critical",children:(0,oZ.jsx)(lp.foC,{})})}),(0,oZ.jsx)(LT,{size:2,tone:"critical",weight:"medium",children:e("search.error.unspecified-error-title")}),(0,oZ.jsx)(LT,{size:1,tone:"critical",children:e("search.error.unspecified-error-help-description")})]})}let LE={createdAsc:{ignoreScore:!0,sort:{direction:"asc",field:"_createdAt"},titleKey:"search.ordering.created-ascending-label"},createdDesc:{ignoreScore:!0,sort:{direction:"desc",field:"_createdAt"},titleKey:"search.ordering.created-descending-label"},relevance:{customMeasurementLabel:"relevance",sort:{direction:"desc",field:"_updatedAt"},titleKey:"search.ordering.best-match-label"},updatedAsc:{ignoreScore:!0,sort:{direction:"asc",field:"_updatedAt"},titleKey:"search.ordering.updated-ascending-label"},updatedDesc:{ignoreScore:!0,sort:{direction:"desc",field:"_updatedAt"},titleKey:"search.ordering.updated-descending-label"}};var LP=Object.freeze,LO=Object.defineProperty;let LA=[LE.relevance,{type:"divider"},LE.createdAsc,LE.createdDesc,{type:"divider"},LE.updatedAsc,LE.updatedDesc],LI=(0,oV.ZP)(oK.kC)(i9||(i9=LP(LO(eC=["\n  box-sizing: border-box;\n"],"raw",{value:LP(eC.slice())}))));function Lz(e){return"divider"===e.type}function LM(e){let{ordering:n}=e,{t:r}=dV(),{dispatch:i,state:{ordering:a}}=M5(),o=(0,oN.useCallback)(()=>{i({ordering:n,type:"ORDERING_SET"})},[i,n]),l=(0,oN.useMemo)(()=>o7()(a,n),[a,n]);
1return(0,oZ.jsx)(lr.sN,{onClick:o,pressed:l,tone:"default",text:r(n.titleKey)})}function LR(){let{t:e}=dV(),{state:{ordering:n}}=M5(),r=(0,oN.useId)(),i=LA.find(e=>o7()(n,e)&&!Lz(e));return i?(0,oZ.jsx)(oK.Zb,{borderBottom:!0,children:(0,oZ.jsx)(LI,{align:"center",flex:1,padding:2,children:(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(lr.zx,{mode:"bleed",icon:lp.fzI,text:e(i.titleKey)}),id:r||"",menu:(0,oZ.jsx)(oK.v2,{children:LA.map((e,n)=>Lz(e)?(0,oZ.jsx)(oK.R,{},n):(0,oZ.jsx)(LM,{ordering:e},n))}),placement:"bottom-start",popover:{portal:!0,radius:2}})})}):null}var LF=Object.freeze,LD=Object.defineProperty;let Lq=(0,oV.ZP)(oK.Zb)(i7||(i7=LF(LD(e_=["\n  cursor: help;\n  left: 0;\n  position: absolute;\n  top: 0;\n"],"raw",{value:LF(e_.slice())}))));function LZ(e){let{data:n}=e,{score:r}=n,i="default";r<=.1?i="critical":r>=.5&&(i="primary");let a=n.stories.filter(e=>e.score>0);return(0,oZ.jsx)(oZ.Fragment,{children:(0,oZ.jsx)(lr.u,{content:(0,oZ.jsx)(oK.Kq,{space:2,children:a.length?(0,oZ.jsx)(oZ.Fragment,{children:a.map(e=>(0,oZ.jsxs)(oK.gF,{space:3,children:[(0,oZ.jsx)(oK.EK,{size:0,weight:"medium",children:e.path}),(0,oZ.jsx)(oK.EK,{size:0,children:e.why})]},e.path))}):(0,oZ.jsx)(oK.EK,{size:0,children:"No matches"})}),placement:"bottom-start",portal:!0,children:(0,oZ.jsx)(Lq,{padding:1,shadow:1,tone:i,children:(0,oZ.jsxs)(oK.EK,{size:0,children:["score: ",r]})})})})}var LN=Object.freeze,LL=Object.defineProperty;let LV=(0,oV.ZP)(oK.kC)(ae||(ae=LN(LL(eT=["\n  opacity: ",";\n  overflow-x: hidden;\n  overflow-y: auto;\n  position: relative;\n  transition: 300ms opacity;\n  width: 100%;\n"],"raw",{value:LN(eT.slice())}))),e=>{let{$loading:n}=e;return n?.5:1});function LK(e){let{inputElement:n}=e,{dispatch:r,onClose:i,recentSearchesStore:a,setSearchCommandList:o,state:{debug:l,filters:s,fullscreen:c,lastActiveIndex:d,result:u,terms:p}}=M5(),{t:h}=dV(),f=!!u.hits.length,m=!u.hits.length&&u.loaded,g=u.error,x=(0,oN.useCallback)(()=>{a&&r({recentSearches:a.addSearch(p,s),type:"RECENT_SEARCHES_SET"}),null==i||i()},[r,s,i,a,p]),v=(0,oN.useCallback)(e=>(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(Rr,{documentId:dm(e.hit._id)||"",documentType:e.hit._type,onClick:x,paddingY:1}),l&&(0,oZ.jsx)(LZ,{data:e})]}),[l,x]);return(0,oZ.jsx)(oK.kC,{children:(0,oZ.jsx)(oK.Zb,{borderTop:c||!!(g||f||m),flex:1,children:(0,oZ.jsxs)(oK.kC,{direction:"column",height:"fill",children:[f&&(0,oZ.jsx)(LR,{}),(0,oZ.jsx)(LV,{$loading:u.loading,"aria-busy":u.loading,flex:1,children:g?(0,oZ.jsx)(LS,{}):(0,oZ.jsxs)(oZ.Fragment,{children:[f&&(0,oZ.jsx)(ux,{activeItemDataAttr:"data-hovered",ariaLabel:h("search.search-results-label"),fixedHeight:!0,initialIndex:d,inputElement:n,itemHeight:57,items:u.hits,overscan:4,paddingX:2,paddingY:1,ref:o,renderItem:v}),m&&(0,oZ.jsx)(Lw,{})]})})]})})})}var LB=Object.freeze,LU=Object.defineProperty,LH=(e,n)=>LB(LU(e,"raw",{value:LB(n||e.slice())}));let L$=(0,oV.ZP)(oK.Zb)(at||(at=LH(["\n  flex-direction: column;\n  overflow: hidden;\n  overflow: clip;\n  pointer-events: all;\n  position: relative;\n"]))),LW=(0,oV.ZP)(oK.xu)(an||(an=LH(["\n  height: 100%;\n  left: 0;\n  overflow: hidden;\n  overflow: clip;\n  pointer-events: none;\n  position: fixed;\n  top: 0;\n  width: 100%;\n  z-index: 1;\n"])));function LY(e){let{onClose:n,onOpen:r,open:i}=e,[a,o]=(0,oN.useState)(null),{scheme:l}=ql(),{t:s}=dV(),{state:{filtersVisible:c,terms:d}}=M5(),u=Ro({terms:d});return(0,oZ.jsx)(Z8,{hasValidTerms:u,onClose:n,onOpen:r,open:i,children:i&&(0,oZ.jsx)(oK.h_,{children:(0,oZ.jsx)(lg.ZP,{autoFocus:!dI,returnFocus:!0,children:(0,oZ.jsx)(LW,{children:(0,oZ.jsxs)(L$,{display:"flex",height:"fill",scheme:l,tone:"default",children:[(0,oZ.jsx)(Lj,{ariaInputLabel:s(u?"search.search-results-aria-label":"search.recent-searches-aria-label"),onClose:n,ref:o}),c&&(0,oZ.jsx)(oK.Zb,{borderTop:!0,flex:"none",children:(0,oZ.jsx)(N8,{})}),u?(0,oZ.jsx)(LK,{inputElement:a}):(0,oZ.jsx)(Lf,{inputElement:a})]})})})})})}function LX(e,n){let r=hd?window.localStorage.getItem(e):void 0;return r?JSON.parse(r):{version:n,recentSearches:[]}}function LG(e){let{lsKey:n,schema:r,fieldDefinitions:i,filterDefinitions:a,operatorDefinitions:o,version:l}=e;return(function(e){let{fieldDefinitions:n,filterDefinitions:r,lsKey:i,operatorDefinitions:a,storedSearch:o,studioSchema:l,version:s}=e,c=Rl(l).map(e=>e.name),d={version:2,recentSearches:o.recentSearches.filter(e=>e.terms.typeNames.every(e=>c.includes(e))&&e.filters.every(e=>Nr({fieldDefinitions:n,filter:e,filterDefinitions:r,operatorDefinitions:a})))};return d.recentSearches.length<o.recentSearches.length&&window.localStorage.setItem(i,JSON.stringify(d)),LX(i,s)})({studioSchema:r,storedSearch:function(e){let{lsKey:n,storedSearch:r}=e;if(2!==r.version){let e={version:2,recentSearches:[]};return window.localStorage.setItem(n,JSON.stringify(e)),e}return r}({lsKey:n,storedSearch:LX(n,l)}),lsKey:n,filterDefinitions:a,fieldDefinitions:i,operatorDefinitions:o,version:l}).recentSearches.filter(e=>!!e.terms).map((e,n)=>({__recent:{index:n,timestamp:new Date(e.created).getTime()},filters:e.filters,query:e.terms.query,types:e.terms.typeNames.map(e=>r.get(e)).filter(e=>!!(e&&"object"===e.jsonType))}))}function LJ(e){return{...e,id:[e.type,e.fieldPath,e.filterName,e.documentTypes.join(",")].join("-")}}function LQ(e){return"array"===e.type}function L0(e){return"document"===e.type}function L1(e){return"object"===e.type}function L2(e,n){let r=e.titlePath.slice(0,-1).join("/"),i=n.titlePath.slice(0,-1).join("/");return e.title.localeCompare(n.title)||r.localeCompare(i)||e.fieldPath.localeCompare(n.fieldPath)}function L3(e){return void 0!==e.__recent}let L4="core:studio:navbar:search:";cL()(L4);let L5=function(e){let n="".concat(L4).concat(e);return cL()&&cL().enabled(n)?cL()(n):cL()(L4)}("reducer");function L8(e,n){let r="\uD83D\uDD0D";switch(n.type.startsWith("SEARCH_REQUEST")&&(r="\uD83D\uDEA8"),n.type.startsWith("RECENT_SEARCHES")&&(r="\uD83D\uDCBE"),L5(r,n),n.type){case"FILTERS_VISIBLE_SET":return{...e,filtersVisible:n.visible};case"LAST_ACTIVE_INDEX_SET":return{...e,lastActiveIndex:n.index};case"ORDERING_RESET":return{...e,ordering:LE.relevance,terms:L6(e.terms)};case"ORDERING_SET":return{...e,ordering:n.ordering,terms:L6(e.terms)};case"PAGE_INCREMENT":return{...e,pageIndex:e.pageIndex+1,terms:L6(e.terms)};case"RECENT_SEARCHES_SET":return{...e,recentSearches:n.recentSearches};case"SEARCH_CLEAR":return{...e,pageIndex:0,result:{...e.result,hasMore:null,hits:[]}};case"SEARCH_REQUEST_COMPLETE":return{...e,result:{...e.result,error:null,hasMore:n.hits.length>0,hits:e.pageIndex>0?[...e.result.hits,...n.hits]:n.hits,loaded:!0,loading:!1}};case"SEARCH_REQUEST_ERROR":return{...e,result:{...e.result,error:n.error,loaded:!1,loading:!1}};case"SEARCH_REQUEST_START":return{...e,result:{...e.result,loaded:!1,loading:!0}};case"TERMS_FILTERS_ADD":{var i;let r={...n.filter,value:null==(i=Z6(e.definitions.operators,n.filter.operatorType))?void 0:i.initialValue},a=[...e.filters,r];return{...e,documentTypesNarrowed:Nn({fieldDefinitions:e.definitions.fields,filters:a,types:e.terms.types}),filters:a,lastAddedFilter:r,terms:{...e.terms,filter:Z7({fieldDefinitions:e.definitions.fields,filterDefinitions:e.definitions.filters,filters:a,operatorDefinitions:e.definitions.operators})}}}case"TERMS_FILTERS_CLEAR":{let n=[];return{...e,documentTypesNarrowed:Nn({fieldDefinitions:e.definitions.fields,filters:n,types:e.terms.types}),filters:n,terms:{...e.terms,filter:Z7({fieldDefinitions:e.definitions.fields,filterDefinitions:e.definitions.filters,filters:n,operatorDefinitions:e.definitions.operators})}}}case"TERMS_FILTERS_REMOVE":{let r=e.filters.findIndex(e=>Nt(e)===n.filterKey),i=[...e.filters.slice(0,r),...e.filters.slice(r+1)];return{...e,documentTypesNarrowed:Nn({fieldDefinitions:e.definitions.fields,filters:i,types:e.terms.types}),filters:i,terms:{...e.terms,filter:Z7({fieldDefinitions:e.definitions.fields,filterDefinitions:e.definitions.filters,filters:i,operatorDefinitions:e.definitions.operators})}}}case"TERMS_FILTERS_SET_OPERATOR":{let r=e.filters.find(e=>Nt(e)===n.filterKey),i=Z6(e.definitions.operators,null==r?void 0:r.operatorType),a=Z6(e.definitions.operators,n.operatorType),o=null==a?void 0:a.initialValue,l=(null==i?void 0:i.inputComponent)!=(null==a?void 0:a.inputComponent),s=e.filters.map(e=>Nt(e)===n.filterKey?{...e,operatorType:n.operatorType,...l?{value:o}:{}}:e);return{...e,filters:s,terms:{...e.terms,filter:Z7({fieldDefinitions:e.definitions.fields,filterDefinitions:e.definitions.filters,filters:s,operatorDefinitions:e.definitions.operators})}}}case"TERMS_FILTERS_SET_VALUE":{let r=e.filters.map(e=>Nt(e)===n.filterKey?{...e,value:n.value}:e);return{...e,filters:r,terms:{...e.terms,filter:Z7({fieldDefinitions:e.definitions.fields,filterDefinitions:e.definitions.filters,filters:r,operatorDefinitions:e.definitions.operators})}}}case"TERMS_QUERY_SET":return{...e,pageIndex:0,result:{...e.result,loaded:!1},terms:L6({...e.terms,query:n.query})};case"TERMS_SET":{let r=n.filters||[],i=[...e.terms.types||[],...n.terms.types].sort(Rs);return{...e,documentTypesNarrowed:Nn({fieldDefinitions:e.definitions.fields,filters:r,types:i}),filters:r,lastAddedFilter:null,pageIndex:0,result:{...e.result,loaded:!1},terms:{...n.terms,filter:Z7({fieldDefinitions:e.definitions.fields,filterDefinitions:e.definitions.filters,filters:r,operatorDefinitions:e.definitions.operators})}}}case"TERMS_TYPE_ADD":{let r=[...e.terms.types||[],n.schemaType].sort(Rs),i=Nn({fieldDefinitions:e.definitions.fields,filters:[],types:r}),a=e.filters.filter(n=>{let r=Ne(e.definitions.fields,n);return!r||0===r.documentTypes.length||i.every(e=>r.documentTypes.findIndex(n=>n===e)>-1)});return{...e,documentTypesNarrowed:i,filters:a,pageIndex:0,result:{...e.result,loaded:!1},terms:L6({...e.terms,filter:Z7({fieldDefinitions:e.definitions.fields,filterDefinitions:e.definitions.filters,operatorDefinitions:e.definitions.operators,filters:a}),types:r})}}case"TERMS_TYPE_REMOVE":{let r=(e.terms.types||[]).filter(e=>e!==n.schemaType);return{...e,documentTypesNarrowed:Nn({fieldDefinitions:e.definitions.fields,filters:e.filters,types:r}),pageIndex:0,result:{...e.result,loaded:!1},terms:L6({...e.terms,types:r})}}case"TERMS_TYPES_CLEAR":return{...e,documentTypesNarrowed:Nn({fieldDefinitions:e.definitions.fields,filters:e.filters,types:[]}),pageIndex:0,result:{...e.result,loaded:!1},terms:L6({...e.terms,types:[]})};default:return e}}function L6(e){if(L3(e)){let{__recent:n,...r}=e;return r}return e}function L9(e){let{children:n,fullscreen:r}=e,i=(0,oN.useRef)(null),[a,o]=(0,oN.useState)(null),l=hN(h$),s=h1(),c=hK(),{search:{operators:d,filters:u}}=RA(),{dataset:p,projectId:h}=l.config(),{fieldDefinitions:f,filterDefinitions:m,operatorDefinitions:g}=(0,oN.useMemo)(()=>({fieldDefinitions:(function(e,n){var r,i;let a=Rl(e).map(e=>e.name),{documentTypes:o,objectTypes:l}=((null==(r=e._original)?void 0:r.types)||[]).filter(e=>!L0(e)||a.includes(e.name)).filter(e=>"slug"!==e.name).filter(e=>!e.name.startsWith("sanity.")).reduce((e,n)=>(L0(n)&&(e.documentTypes[n.name]=n),L1(n)&&(e.objectTypes[n.name]=n),e),{documentTypes:{},objectTypes:{}})||{documentTypes:{},objectTypes:{}};return i=n.reduce((e,n)=>("field"===n.type&&e.push(n.fieldType),e),[]),Object.values(o).reduce((e,n)=>{let r=n.fields.reduce((e,r)=>((function e(n){var r;let{acc:a,defType:s,depth:c=0,documentType:d,prevFieldPath:u,prevTitlePath:p}=n,h=s.name.startsWith("_"),f=(null==s?void 0:s.title)?Nk(s.title):lf()(s.name),m=u?"".concat(u,".").concat(s.name):s.name,g=p?[...p,f]:[f];if(!(c<=3))return;let x=l[s.type],v=o[s.type],y=L1(s)?s:null,b=v||x||y;if(b){null==(r=null==b?void 0:b.fields)||r.forEach(n=>e({acc:a,defType:n,depth:c+1,documentType:d,prevFieldPath:m,prevTitlePath:g}));return}i.includes(s.type)&&a.push({documentTypes:d&&!h?[d]:[],fieldPath:m,filterName:function(e){var n,r;if("string"===e.type&&null!=(n=e.options)&&n.list&&e.options.list.length>0)return"stringList";if(LQ(e)){if(e.of.some(e=>"reference"===e.type))return"arrayReferences";if(e.of.find(e=>"block"===e.type))return"portableText";if(LQ(e)&&e.of.every(e=>["boolean","number","string"].includes(e.type))&&null!=(r=e.options)&&r.list&&e.options.list.length>0)return"arrayList"}return e.type}(s),id:"",name:s.name,titlePath:g,title:f,type:s.type})})({acc:e,defType:r,documentType:n.name}),e),[]);return e.push(...r),e},[]).reduce((e,n)=>{let r=e.findIndex(e=>e.fieldPath===n.fieldPath&&e.title===n.title&&e.type===n.type);return r>-1?e[r]={...e[r],documentTypes:[...e[r].documentTypes,...n.documentTypes]}:e.push(n),e},[]).map(LJ).sort(L2)})(s,u).reduce((e,n)=>(e[n.id]=n,e),{}),filterDefinitions:u.reduce((e,n)=>(e[n.name]=n,e),{}),operatorDefinitions:d.reduce((e,n)=>(e[n.type]=n,e),{})}),[u,d,s]),x=(0,oN.useMemo)(()=>(function(e){let{dataset:n,fieldDefinitions:r,filterDefinitions:i,operatorDefinitions:a,projectId:o,schema:l,user:s,version:c=2}=e;if(!n||!o||!hd||!s)return;let d="".concat("search::recent","__").concat(o,":").concat(n,":").concat(s.id);return{addSearch:(e,n)=>{let o=(n||[]).map(e=>({fieldId:e.fieldId,filterName:e.filterName,operatorType:e.operatorType,value:e.value})).filter(e=>Nr({fieldDefinitions:r,filter:e,filterDefinitions:i,operatorDefinitions:a})),s={created:new Date().toISOString(),filters:o,terms:{query:e.query.trim(),typeNames:e.types.map(e=>e.name)}
1},u=JSON.stringify(sH()(s,"created")),p={version:c,recentSearches:[s,...LX(d,c).recentSearches.filter(e=>JSON.stringify(sH()(e,"created"))!==u)].slice(0,5)};return window.localStorage.setItem(d,JSON.stringify(p)),LG({fieldDefinitions:r,filterDefinitions:i,lsKey:d,operatorDefinitions:a,schema:l,version:c})},getRecentSearches:()=>LG({fieldDefinitions:r,filterDefinitions:i,lsKey:d,operatorDefinitions:a,schema:l,version:c}),removeSearch:()=>{let e={...LX(d,c),recentSearches:[]};return window.localStorage.setItem(d,JSON.stringify(e)),LG({fieldDefinitions:r,filterDefinitions:i,lsKey:d,operatorDefinitions:a,schema:l,version:c})},removeSearchAtIndex:e=>{let n=LX(d,c);if(e<0||e>n.recentSearches.length)return LG({fieldDefinitions:r,filterDefinitions:i,lsKey:d,operatorDefinitions:a,schema:l,version:c});let o={...n,recentSearches:[...n.recentSearches.slice(0,e),...n.recentSearches.slice(e+1)]};return window.localStorage.setItem(d,JSON.stringify(o)),LG({fieldDefinitions:r,filterDefinitions:i,lsKey:d,operatorDefinitions:a,schema:l,version:c})}}})({dataset:p,fieldDefinitions:f,filterDefinitions:m,operatorDefinitions:g,projectId:h,schema:s,user:c,version:2}),[c,p,f,m,g,h,s]),v=(0,oN.useMemo)(()=>null==x?void 0:x.getRecentSearches(),[x]),y=(0,oN.useMemo)(()=>(function(e){let{currentUser:n,fullscreen:r,recentSearches:i=[],definitions:a}=e;return{currentUser:n,debug:"undefined"!=typeof window&&window.location.hash.slice(1).split(";").includes("_debug_search_score"),documentTypesNarrowed:[],filters:[],filtersVisible:!0,fullscreen:r,lastActiveIndex:-1,ordering:LE.relevance,pageIndex:0,recentSearches:i,result:{error:null,hasMore:null,hits:[],loaded:!1,loading:!1},terms:{query:"",types:[]},definitions:a}})({currentUser:c,fullscreen:r,recentSearches:v,definitions:{fields:f,operators:g,filters:m}}),[c,f,m,r,g,v]),[b,j]=(0,oN.useReducer)(L8,y),{documentTypesNarrowed:w,filters:k,ordering:C,pageIndex:_,result:T,terms:S}=b,E=(0,oN.useRef)(!1),P=(0,oN.useRef)(y.ordering),O=(0,oN.useRef)(y.pageIndex),A=(0,oN.useRef)(y.terms),{handleSearch:I,searchState:z}=Rp({initialState:{...T,terms:S},onComplete:e=>j({hits:e,type:"SEARCH_REQUEST_COMPLETE"}),onError:e=>j({error:e,type:"SEARCH_REQUEST_ERROR"}),onStart:()=>j({type:"SEARCH_REQUEST_START"}),schema:s}),M=Ro({terms:S}),R=w.map(e=>s.get(e)),F=k.filter(e=>Nr({fieldDefinitions:f,filter:e,filterDefinitions:m,operatorDefinitions:g})),D=(0,oN.useCallback)(e=>{i.current=e},[]);return(0,oN.useEffect)(()=>{let e=!o7()(C,P.current),n=_!==O.current,r=!o7()(S,A.current);if(e||n||r){let e=(null==C?void 0:C.customMeasurementLabel)||"".concat(C.sort.field," ").concat(C.sort.direction);I({options:{comments:[...L3(S)?["findability-recent-search:".concat(S.__recent.index)]:[],"findability-selected-types:".concat(S.types.length),"findability-sort:".concat(e),"findability-source: global","findability-filter-count:".concat(F.length)],limit:1e3,offset:1e3*_,skipSortByScore:C.ignoreScore,sort:[C.sort]},terms:{...S,...R?{types:R}:{}}}),O.current=_}P.current=C,A.current=S},[F.length,k,R,I,M,C,_,z.terms,S]),(0,oN.useEffect)(()=>{!M&&(null==E?void 0:E.current)&&T.hits.length>0&&j({type:"SEARCH_CLEAR"}),E.current=!0},[j,M,T.hits,S.query,S.types]),(0,oZ.jsx)(M4.Provider,{value:{dispatch:j,onClose:null==i?void 0:i.current,recentSearchesStore:x,searchCommandList:a,setSearchCommandList:o,setOnClose:D,state:{...b,fullscreen:r}},children:n})}function L7(e){var n;let{error:r,isLoading:i,value:a}=e,o=null==(n=null==a?void 0:a.resources)?void 0:n.sectionArray,l=null==a?void 0:a.latestVersion,{t:s}=dV();if(i)return(0,oZ.jsx)(u4,{showText:!0});let c=(0,oZ.jsxs)(oZ.Fragment,{children:[(0,oZ.jsx)(lr.sN,{as:"a",text:s("help-resources.action.join-our-community"),href:"https://www.sanity.io/exchange/community",target:"_blank"}),(0,oZ.jsx)(lr.sN,{as:"a",text:s("help-resources.action.help-and-support"),href:"https://www.sanity.io/contact/support",target:"_blank"}),(0,oZ.jsx)(lr.sN,{as:"a",text:s("help-resources.action.contact-sales"),href:"https://www.sanity.io/contact/sales?ref=studio",target:"_blank"}),(0,oZ.jsx)(oK.R,{})]});return(0,oZ.jsxs)(oZ.Fragment,{children:[(void 0===a||r)&&(0,oZ.jsx)("div",{children:c}),!r&&(null==o?void 0:o.map(e=>e?(0,oZ.jsx)(Ve,{subSection:e},e._key):null)),(0,oZ.jsxs)(oK.xu,{padding:3,children:[(0,oZ.jsx)(oK.xv,{size:1,muted:!0,weight:"medium",textOverflow:"ellipsis",children:s("help-resources.studio-version",{studioVersion:qC})}),!r&&l&&(0,oZ.jsx)(oK.xu,{paddingTop:2,children:(0,oZ.jsx)(oK.xv,{size:1,muted:!0,textOverflow:"ellipsis",children:s("help-resources.latest-sanity-version",{latestVersion:l})})})]})]})}function Ve(e){var n;let{subSection:r}=e;return(0,oZ.jsxs)(oZ.Fragment,{children:[null==(n=null==r?void 0:r.items)?void 0:n.map(e=>{if(!e||!e.title)return null;switch(e._type){case"externalLink":if(!e.url)return null;return(0,oZ.jsx)(lr.sN,{as:"a",tone:"default",text:e.title,href:e.url,target:"_blank"},e._key);case"internalAction":if(!e.type)return null;return"show-welcome-modal"===e.type&&(0,oZ.jsx)(lr.sN,{text:e.title},e._key);default:return null}}),(0,oZ.jsx)(oK.R,{})]})}var Vt=Object.freeze,Vn=Object.defineProperty;let Vr=(0,oV.ZP)(oK.v2)(ar||(ar=Vt(Vn(eS=["\n  max-width: 300px;\n  min-width: 200px;\n"],"raw",{value:Vt(eS.slice())}))));function Vi(){let{t:e}=dV(),{value:n,error:r,isLoading:i}=function(){let e=hN({apiVersion:"1"}),n=uk().id;return dF((0,oN.useMemo)(()=>e.withConfig({apiVersion:"1"}).observable.request({url:"/help",query:{m:["sanity@".concat(qC)],locale:n},tag:"module.version-check",json:!0}),[e,n]))}();return(0,oZ.jsx)(lr.j2,{button:(0,oZ.jsx)(lr.zx,{"aria-label":e("help-resources.title"),icon:lp.BHU,mode:"bleed",tooltipProps:{content:e("help-resources.title")}}),id:"menu-button-resources",menu:(0,oZ.jsx)(Vr,{children:(0,oZ.jsx)(L7,{error:r,isLoading:i,value:n})}),popover:{constrainSize:!0}})}let Va=e=>{var n;let{children:r}=e,[i,a]=(0,oN.useState)(null),[o,l]=(0,oN.useState)(!1),[s,c]=(0,oN.useState)(!1),d=hN({apiVersion:"2023-12-11"});(0,oN.useEffect)(()=>{let e=d.observable.request({url:"/journey/trial?studioVersion=".concat(qC)}).subscribe(e=>{a(e),(null==e?void 0:e.showOnLoad)&&(c(!0),l(!0))},()=>{});return()=>{e.unsubscribe()}},[d]);let u=(0,oN.useCallback)(function(){var e;let n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];s?(c(!1),l(n),(null==(e=null==i?void 0:i.showOnLoad)?void 0:e.id)&&d.request({url:"/journey/trial/".concat(null==i?void 0:i.showOnLoad.id),method:"POST"})):l(e=>!e)},[d,s,null==(n=null==i?void 0:i.showOnLoad)?void 0:n.id]);return(0,oZ.jsx)(ZV.Provider,{value:{data:i,showDialog:o,toggleShowContent:u,showOnLoad:s},children:r})};var Vo=Object.freeze,Vl=Object.defineProperty,Vs=(e,n)=>Vo(Vl(e,"raw",{value:Vo(n||e.slice())}));let Vc={duration:.4,type:"spring"},Vd={open:{opacity:1,scale:1,x:"-50%"},closed:{opacity:0,scale:.99,x:"-50%"}},Vu={open:{opacity:1},closed:{opacity:0}
1},Vp=(0,oV.ZP)((0,cY.E)(oK.Zb))(ai||(ai=Vs(["\n  background-color: var(--card-backdrop-color);\n  bottom: 0;\n  left: 0;\n  position: absolute;\n  right: 0;\n  top: 0;\n"]))),Vh=(0,oV.ZP)((0,cY.E)(oK.Zb))(aa||(aa=Vs(["\n  display: flex !important;\n  flex-direction: column;\n  left: 50%;\n  max-height: min(\n    calc(100vh - ","vh - ","px),\n    ","px\n  );\n  position: absolute;\n  top: ","vh;\n  width: min(calc(100vw - ","px), ","px);\n"])),12,Ra,735,12,2*Ra,800);function Vf(e){let{disableFocusLock:n,onClose:r,onOpen:i,open:a}=e,[o,l]=(0,oN.useState)(null),s=(0,oN.useRef)(null),{isTopLayer:c,zIndex:d}=(0,oK.sJ)(),{t:u}=dV(),{onClose:p,state:{filtersVisible:h,terms:f}}=M5(),m=Ro({terms:f}),g=(0,oN.useCallback)(()=>{c&&p&&a&&p()},[c,p,a]);return(0,oK.O8)(g,[s.current]),(0,oZ.jsx)(Z8,{hasValidTerms:m,onClose:r,onOpen:i,open:a,children:(0,oZ.jsx)(cX.M,{children:a&&(0,oZ.jsx)(oK.h_,{children:(0,oZ.jsxs)(lg.ZP,{autoFocus:!dI,disabled:n,returnFocus:!0,children:[(0,oZ.jsx)(Vp,{animate:"open",exit:"closed",initial:"closed",style:{zIndex:d},transition:Vc,variants:Vu}),(0,oZ.jsxs)(Vh,{animate:"open",exit:"closed",initial:"closed",overflow:"hidden",radius:3,ref:s,shadow:2,style:{zIndex:d},transition:Vc,variants:Vd,children:[(0,oZ.jsx)(Lj,{ariaInputLabel:u(m?"search.search-results-aria-label":"search.recent-searches-aria-label"),onClose:r,ref:l}),h&&(0,oZ.jsx)(oK.Zb,{borderTop:!0,flex:"none",children:(0,oZ.jsx)(N8,{})}),m?(0,oZ.jsx)(LK,{inputElement:o}):(0,oZ.jsx)(Lf,{inputElement:o})]})]})})})})}var Vm=Object.freeze,Vg=Object.defineProperty,Vx=(e,n)=>Vm(Vg(e,"raw",{value:Vm(n||e.slice())}));let Vv=(0,oV.ZP)(oK.mh)(ao||(ao=Vx(["\n  min-height: auto;\n  position: relative;\n\n  &[data-search-open='true'] {\n    top: 0;\n    position: sticky;\n  }\n"]))),Vy=(0,oV.ZP)(oK.Zb)(al||(al=Vx(["\n  line-height: 0;\n"]))),Vb=(0,oV.ZP)(oK.rj)(as||(as=Vx(["\n  grid-template-columns: auto auto auto;\n"])));function Vj(){let{name:e,tools:n}=St(),r=(0,lm.z)(),i=(0,oK.d2)(),a="string"==typeof r.tool?r.tool:void 0,o=function(){let{__internal:{staticInitialValueTemplateItems:e}}=RA(),[n,r]=zr({templateItems:e});return{canCreateDocument:(null==n?void 0:n.some(n=>e.some(e=>e.id===n.id)))||!1,loading:r,options:(0,oN.useMemo)(()=>e.map(e=>{var r;return{...e,title:(null==e?void 0:e.title)||e.id,hasPermission:(null==(r=null==n?void 0:n.find(n=>n.id===e.id))?void 0:r.granted)||!1}}),[n,e])}}(),{t:l}=dV(),{onSearchFullscreenOpenChange:s,onSearchOpenChange:c,searchFullscreenOpen:d,searchFullscreenPortalEl:u,searchOpen:p}=(0,oN.useContext)(VN),h=VF(),[f,m]=(0,oN.useState)(!1),g=(0,oN.useRef)(r),x=(0,oN.useRef)(e);(0,oN.useEffect)(()=>{(g.current.tool!==r.tool||e!==x.current)&&m(!1),g.current=r,x.current=e},[e,r]);let[v,y]=(0,oN.useState)(null),[b,j]=(0,oN.useState)(null),w=(0,oN.useMemo)(()=>({resources:i>1,collapsedPresenceMenu:i<=1,loginStatus:i>1,searchFullscreen:i<=1,configIssues:i>1&&xh,newDocumentFullscreen:i<=1,tools:i>=3}),[i]);(0,oN.useEffect)(()=>{s(d)},[d,s]),(0,oN.useEffect)(()=>{w.searchFullscreen?c(!1):s(!1)},[s,c,w.searchFullscreen]);let k=(0,oN.useCallback)(()=>{c(!0)},[c]),C=(0,oN.useCallback)(()=>{s(!0)},[s]),_=(0,oN.useCallback)(()=>{c(!1)},[c]),T=(0,oN.useCallback)(()=>{s(!1),null==b||b.focus()},[s,b]),S=(0,oN.useCallback)(()=>{m(!1),null==v||v.focus()},[v]),E=(0,oN.useCallback)(()=>{m(!0)},[]);return(0,oZ.jsx)(Va,{children:(0,oZ.jsxs)(Vv,{zOffset:100,"data-search-open":d,children:[(0,oZ.jsx)(Vy,{borderBottom:!0,"data-testid":"studio-navbar","data-ui":"Navbar",padding:3,sizing:"border",children:(0,oZ.jsxs)(Vb,{gap:1,children:[(0,oZ.jsx)(lr.uE,{children:(0,oZ.jsxs)(oK.kC,{align:"center",gap:2,justify:"flex-start",children:[(0,oZ.jsxs)(oK.kC,{align:"center",gap:2,children:[!w.tools&&(0,oZ.jsx)(lr.zx,{mode:"bleed",icon:lp.Oqj,onClick:E,ref:y,tooltipProps:{content:l("user-menu.open-menu"),placement:"bottom"}}),(0,oZ.jsxs)(oK.kC,{gap:1,children:[(0,oZ.jsx)(Zu,{}),(0,oZ.jsx)(DY,{})]})]}),(0,oZ.jsx)(q6,{...o,modal:w.newDocumentFullscreen?"dialog":"popover"}),!w.searchFullscreen&&(0,oZ.jsx)(Z3,{onClick:k,ref:j})]})}),(0,oZ.jsx)(oK.kC,{align:"center",justify:"center",children:w.tools&&(0,oZ.jsx)(h,{activeToolName:a,closeSidebar:S,context:"topbar",isSidebarOpen:!1,tools:n})}),(0,oZ.jsx)(lr.uE,{children:(0,oZ.jsxs)(oK.kC,{align:"center",gap:1,justify:"flex-end",children:[(0,oZ.jsxs)(oK.kC,{gap:1,children:[(0,oZ.jsx)(oK.li,{children:(0,oZ.jsx)(L9,{fullscreen:w.searchFullscreen,children:(0,oZ.jsx)(oK.NM,{element:document.body,children:w.searchFullscreen?(0,oZ.jsx)(oK.Xp,{element:u,children:(0,oZ.jsx)(LY,{onClose:T,onOpen:C,open:d})}):(0,oZ.jsx)(Vf,{onClose:_,onOpen:k,open:p})})})}),w.tools&&(0,oZ.jsx)(ZB,{type:"topbar"}),w.configIssues&&(0,oZ.jsx)(Z2,{}),w.resources&&(0,oZ.jsx)(Vi,{}),(0,oZ.jsx)(Zi,{}),w.searchFullscreen&&(0,oZ.jsx)(Z3,{onClick:C,ref:j})]}),w.tools&&(0,oZ.jsx)(oK.xu,{flex:"none",marginLeft:1,children:(0,oZ.jsx)(qH,{})})]})})]})}),!w.tools&&(0,oZ.jsx)(Z1,{activeToolName:a,isOpen:f,onClose:S,tools:n})]})})}var Vw=Object.freeze,Vk=Object.defineProperty,VC=(e,n)=>Vw(Vk(e,"raw",{value:Vw(n||e.slice())}));function V_(e){return!!e}let VT=(0,oV.ZP)(Ee)(ac||(ac=VC(["\n  list-style: none;\n  white-space: nowrap;\n  flex-shrink: 0;\n  opacity: 0;\n  visibility: hidden;
1\n"]))),VS=(0,oV.ZP)(oK.kC)(ad||(ad=VC(["\n  opacity: 0;\n  height: 0.1px;\n  overflow: hidden;\n"]))),VE=(0,oN.forwardRef)(function(e,n){let{children:r,gap:i,menuButtonProps:a,disableRestoreFocusOnClose:o,onMenuClose:l,collapsed:s,...c}=e,[d,u]=(0,oN.useState)(null),[p,h]=(0,oN.useState)([]),[f,m]=(0,oN.useState)(!1),g=(0,oN.useMemo)(()=>oN.Children.toArray(r).filter(V_),[r]),x=(0,oN.useMemo)(()=>s||!f?null:g.filter(e=>!p.some(n=>n.key===e.key)),[g,s,p,f]),v=(0,oN.useMemo)(()=>({root:d,threshold:1,rootMargin:"1px"}),[d]),y=(0,oN.useMemo)(()=>(null==a?void 0:a.button)||(0,oZ.jsx)(bA,{}),[a]),b=(0,oN.useMemo)(()=>s?g:g.filter(e=>{let{key:n}=e;return p.find(e=>e.key===n)}),[g,p,s]),j=(0,oN.useCallback)((e,n)=>{let r=p.some(e=>e.key===n.key);f||m(!0);let i=e.isIntersecting;r||i||h(e=>[...e,n]),r&&i&&h(e=>e.filter(e=>e.key!==n.key))},[p,f,m,h]);return(0,oZ.jsxs)(oK.kC,{direction:"column",ref:n,sizing:"border",style:{position:"relative"},...c,children:[(0,oZ.jsxs)(oK.kC,{justify:"center",gap:i,flex:1,children:[x,(p.length>0||s)&&(0,oZ.jsx)(S7,{disableRestoreFocusOnClose:o,menuButton:y,menuButtonProps:a,menuOptions:b,onMenuClose:l})]}),(0,oZ.jsxs)(VS,{justify:"flex-start",gap:i,ref:u,"data-hidden":!0,"aria-hidden":"true",children:[(0,oN.cloneElement)(y,{disabled:!0,"aria-hidden":!0}),null==g?void 0:g.map(e=>(0,oZ.jsx)(VT,{options:v,onIntersectionChange:n=>j(n[0],e),children:(0,oN.cloneElement)(e,{disabled:!0,"aria-hidden":!0,tabIndex:-1})},"".concat(e.key,"_observer")))]})]})}),VP=(0,oN.forwardRef)(function(e,n){let{name:r,...i}=e,a=(0,lm.z)((0,oN.useCallback)(()=>({tool:r,[r]:void 0}),[r]));return(0,oZ.jsx)(lm.Px,{state:a,...i,ref:n})});function VO(e){let{activeToolName:n,tools:r}=e,{scheme:i}=ql(),[a,o]=(0,oN.useState)(null);K4({rootElement:a,navigation:["arrows"]});let l=(0,oN.useMemo)(()=>({popover:{constrainSize:!0,portal:!0,scheme:i}}),[i]),s=(0,oN.useMemo)(()=>r.map((e,r)=>{let i=(null==e?void 0:e.title)||lf()(e.name),a=(0,oN.forwardRef)(function(n,r){return(0,oZ.jsx)(VP,{...n,ref:r,name:e.name,children:n.children})});return(0,oZ.jsx)(lr.zx,{as:a,"data-as":"a",mode:"bleed",selected:n===e.name,text:i},"".concat(e.name,"-").concat(r))}),[n,r]);return(0,oZ.jsx)(oK.kC,{justify:"center",marginX:4,children:(0,oZ.jsx)(VE,{"data-testid":"tool-collapse-menu",gap:1,menuButtonProps:l,ref:o,children:s})})}function VA(e){let{activeToolName:n,isVisible:r,tools:i}=e;return(0,oN.useMemo)(()=>(0,oZ.jsx)(oK.Kq,{as:"ul",space:1,children:i.map(e=>{let i=(null==e?void 0:e.title)||lf()(e.name),a=(0,oN.forwardRef)(function(n,r){return(0,oZ.jsx)(VP,{...n,ref:r,name:e.name,children:n.children})});return(0,oZ.jsx)(oK.Kq,{as:"li",children:(0,oZ.jsx)(lr.zx,{as:a,justify:"flex-start",mode:"bleed",selected:n===e.name,size:"large",tabIndex:r?0:-1,text:i})},e.name)})}),[n,r,i])}function VI(e){let{context:n,isSidebarOpen:r,tools:i,...a}=e;return i.length<=1?null:"sidebar"===n?(0,oZ.jsx)(VA,{isVisible:r,tools:i,...a}):(0,oZ.jsx)(VO,{tools:i,...a})}function Vz(e){var n,r;return null==(r=null==(n=e.studio)?void 0:n.components)?void 0:r.toolMenu}function VM(e){var n,r;return null==(r=null==(n=e.studio)?void 0:n.components)?void 0:r.navbar}function VR(e){var n,r;return null==(r=null==(n=e.studio)?void 0:n.components)?void 0:r.layout}function VF(){return fs({defaultComponent:VI,pick:Vz})}var VD=Object.freeze,Vq=Object.defineProperty;let VZ=(0,oV.ZP)(oK.Zb)(au||(au=VD(Vq(eE=["\n  height: 100%;\n  left: 0;\n  overflow: hidden;\n  overflow: clip;\n  position: fixed;\n  top: 0;\n  width: 100%;\n  z-index: 200;\n"],"raw",{value:VD(eE.slice())})))),VN=(0,oN.createContext)({onSearchFullscreenOpenChange:()=>"",onSearchOpenChange:()=>"",searchFullscreenOpen:!1,searchFullscreenPortalEl:null,searchOpen:!1});function VL(){let e=fs({defaultComponent:VV,pick:VR});return(0,oZ.jsx)(e,{})}function VV(){var e;let{name:n,title:r,tools:i}=St(),a=(0,lm.tv)(),o=(0,lm.z)((0,oN.useCallback)(e=>"string"==typeof e.tool?e.tool:void 0,[])),l=(0,oN.useMemo)(()=>i.find(e=>e.name===o),[o,i]),[s,c]=(0,oN.useState)(!1),[d,u]=(0,oN.useState)(null),[p,h]=(0,oN.useState)(!1),f=(0,oN.useMemo)(()=>{let e=r||lf()(n);return o?"".concat(lf()(o)," | ").concat(e):e},[o,n,r]),m=!!(null==l?void 0:l.controlsDocumentTitle);(0,oN.useEffect)(()=>{m||(document.title=f)},[f,m]);let g=(0,oN.useCallback)(e=>{c(e)},[]),x=(0,oN.useCallback)(e=>{h(e)},[]),v=(0,oN.useMemo)(()=>({searchFullscreenOpen:s,searchFullscreenPortalEl:d,searchOpen:p,onSearchFullscreenOpenChange:g,onSearchOpenChange:x}),[s,d,p,g,x]),y=fs({defaultComponent:Vj,pick:VM}),b=!l&&("desk"===o||!o)&&"undefined"!=typeof window&&/\/desk(\/|$)/.test(window.location.pathname)&&i.some(e=>"structure"===e.name);return(0,oN.useEffect)(()=>{b&&a.navigateUrl({path:window.location.pathname.replace(/\/desk/,"/structure"),replace:!0})}
1,[b,a]),(0,oZ.jsxs)(oK.kC,{"data-ui":"ToolScreen",direction:"column",height:"fill","data-testid":"studio-layout",children:[(0,oZ.jsx)(VN.Provider,{value:v,children:(0,oZ.jsx)(y,{})}),b&&(0,oZ.jsx)(qP,{}),0===i.length&&(0,oZ.jsx)(qE,{}),i.length>0&&!l&&o&&!b&&(0,oZ.jsx)(qO,{toolName:o}),s&&(0,oZ.jsx)(VZ,{ref:u,overflow:"auto"}),(0,oZ.jsx)(qp,{heading:"The ".concat(null==l?void 0:l.name," tool crashed"),children:(0,oZ.jsx)(oK.Zb,{flex:1,hidden:s,children:l&&o&&(0,oZ.jsx)(lm.NZ,{scope:o,__unsafe_disableScopedSearchParams:null==(e=l.router)?void 0:e.__unsafe_disableScopedSearchParams,children:(0,oZ.jsx)(oN.Suspense,{fallback:(0,oZ.jsx)(u4,{showText:!0}),children:(0,oN.createElement)(l.component,{tool:l})})})})},null==l?void 0:l.name)]})}function VK(e){let{projectId:n,name:r,i18n:{locales:i},__internal:{i18next:a}}=RA();return(0,oZ.jsx)(VB,{...e,projectId:n,sourceId:r,locales:i,i18next:a})}function VB(e){let{projectId:n,sourceId:r,locales:i,i18next:a,children:o}=e,l=(0,oN.useCallback)(e=>(a.on("languageChanged",e),()=>a.off("languageChanged",e)),[a]),s=(0,oN.useSyncExternalStore)(l,()=>i.find(e=>a.language===e.id)||pH),c=(0,oN.useMemo)(()=>({locales:i,currentLocale:s,__internal:{i18next:a},changeLocale:async e=>{hd&&localStorage.setItem(F4(n,r),e),await a.changeLanguage(e)}}),[s,a,i,n,r]);return(0,oZ.jsx)(oN.Suspense,{fallback:(0,oZ.jsx)(u4,{}),children:(0,oZ.jsx)(li.a3,{i18n:a,children:(0,oZ.jsx)(uw.Provider,{value:c,children:o},s.id)})})}let VU={block:{icon:25,media:{width:33,height:33}},blockImage:{icon:25,media:{width:600,height:400}},compact:{icon:21,media:{width:25,height:25}},default:{icon:21,media:{width:33,height:33}},detail:{icon:25,media:{width:73,height:73}},inline:{icon:15,media:{width:15,height:15}},media:{icon:25,media:{width:160,height:160}}};function VH(e,n,r){return"string"==typeof e?e:(0,lw.isValidElementType)(e)?(0,oN.createElement)(e,{layout:n}):e||r}var V$=Object.freeze,VW=Object.defineProperty,VY=(e,n)=>V$(VW(e,"raw",{value:V$(n||e.slice())}));let VX=oV.ZP.span(e=>{let{$dimensions:n,$layout:r,$radius:i,$responsive:a}=e,o=n.width||0,l=n.width||0,s=VU[r].icon;return(0,oV.iv)(ap||(ap=VY(["\n    position: relative;\n    width: ",";\n    height: ",";\n    min-width: ",";\n    border-radius: ",";\n    display: flex;\n    overflow: hidden;\n    overflow: clip;\n    align-items: center;\n    justify-content: center;\n\n    & img {\n      position: absolute;\n      left: 0;\n      top: 0;\n      width: 100%;\n      height: 100%;\n      object-fit: contain;\n      border-radius: inherit;\n    }\n\n    & svg {\n      // Shared styles for SVG icons\n      color: var(--card-icon-color);\n      display: block;\n      flex: 1;\n\n      // Specific styles for non Sanity icons\n      &:not([data-sanity-icon]) {\n        height: 1em;\n        width: 1em;\n        max-width: 1em;\n        max-height: 1em;\n      }\n\n      // Specific styles for Sanity icons\n      &[data-sanity-icon] {\n        display: block;\n        font-size: calc("," / 16 * 1em);\n      }\n    }\n\n    & > span[data-border] {\n      display: block;\n      position: absolute;\n      left: 0;\n      top: 0;\n      right: 0;\n      bottom: 0;\n      box-shadow: inset 0 0 0 1px var(--card-fg-color);\n      opacity: 0.1;\n      border-radius: inherit;\n      pointer-events: none;\n    }\n  "])),a?"100%":(0,oK.hO)(o),a?"100%":(0,oK.hO)(l),a?void 0:(0,oK.hO)(o),e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.radius[i])},s)});function VG(e){let{border:n=!0,dimensions:r,layout:i,media:a,radius:o=1,responsive:l=!1,styles:s}=e;return(0,oZ.jsxs)(VX,{$dimensions:r,$layout:i,$radius:o,$responsive:l,className:null==s?void 0:s.media,"data-testid":"Media",children:[function(e){let{dimensions:n,layout:r,media:i,styles:a}=e;return(0,lw.isValidElementType)(i)?(0,oN.createElement)(i,{dimensions:n,layout:r}):"string"==typeof i?(0,oZ.jsx)(oK.xv,{as:"span",className:null==a?void 0:a.mediaString,size:1,children:i}):(0,oN.isValidElement)(i)?i:null}({dimensions:r,layout:i,media:a}),n&&(0,oZ.jsx)("span",{"data-border":!0})]})}VX.displayName="MediaWrapper";var VJ=Object.freeze,VQ=Object.defineProperty,V0=(e,n)=>VJ(VQ(e,"raw",{value:VJ(n||e.slice())}));let V1={...VU.compact.media,aspect:1,fit:"crop",dpr:(0,lx.x)()},V2=(0,oV.ZP)(oK.kC)(ah||(ah=V0(["\n  height: ",";\n  box-sizing: content-box;\n"])),(0,oK.hO)(VU.compact.media.height)),V3=(0,oV.ZP)(oK.Qr).attrs({animated:!0,radius:1,size:1})(af||(af=V0(["\n  max-width: ",";\n  width: 80%;\n"])),(0,oK.hO)(160));var V4=Object.freeze,V5=Object.defineProperty,V8=(e,n)=>V4(V5(e,"raw",{value:V4(n||e.slice())}));let V6={...VU.default.media,aspect:1,fit:"crop",dpr:(0,lx.x)()},V9=(0,oV.ZP)(oK.kC)(am||(am=V8(["\n  height: ",";\n  box-sizing: content-box;\n"])),(0,oK.hO)(VU.default.media.height)),V7=(0,oV.ZP)(oK.Qr).attrs({animated:!0,radius:1,size:1})(ag||(ag=V8(["\n  max-width: ",";\n  width: 80%;\n"])),(0,oK.hO)(160)),Ke=(0,oV.ZP)(oK.Qr).attrs({animated:!0,radius:1,size:1})(ax||(ax=V8(["\n  max-width: ",";\n  width: 60%;\n"])),(0,oK.hO)(120));function Kt(e){let{title:n,subtitle:r,media:i,status:a,isPlaceholder:o,children:l,styles:s}=e,{t:c}=dV(),d=sg()(null==s?void 0:s.root,!!r&&(null==s?void 0:s.hasSubtitle)),u=a&&(0,oZ.jsx)(oK.xu,{className:null==s?void 0:s.status,"data-testid":"default-preview__status",children:VH(a,"default")});return o?(0,oZ.jsx)(V9,{align:"center",className:null==s?void 0:s.placeholder,"data-testid":"default-preview",padding:2,paddingLeft:i?2:3,children:(0,oZ.jsxs)(oK.kC,{align:"center",flex:1,gap:2,children:[i&&(0,oZ.jsx)(oK.xu,{flex:"none",children:(0,oZ.jsx)(oK.Od,{animated:!0,radius:1,style:VU.default.media})}),(0,oZ.jsxs)(oK.Kq,{"data-testid":"default-preview__heading",flex:1,space:2,children:[(0,oZ.jsx)(V7,{}),(0,oZ.jsx)(Ke,{})]}),(0,oZ.jsx)(oK.xu,{flex:"none",padding:1,children:u})]})}):(0,oZ.jsx)(V9,{align:"center",className:d,"data-testid":"default-preview",padding:2,paddingLeft:i?2:3,children:(0,oZ.jsxs)(oK.kC,{align:"center",flex:1,gap:2,children:[i&&(0,oZ.jsx)(oK.xu,{flex:"none",children:(0,oZ.jsx)(VG,{dimensions:V6,layout:"default",media:i,styles:s})}),(0,oZ.jsxs)(oK.Kq,{className:null==s?void 0:s.heading,"data-testid":"default-preview__header",flex:1,space:2,children:[(0,oZ.jsxs)(oK.xv,{className:null==s?void 0:s.title,size:1,style:{color:"inherit"},textOverflow:"ellipsis",weight:"medium",children:[n&&VH(n,"default"),!n&&(0,oZ.jsx)("span",{style:{color:"var(--card-muted-fg-color)"},children:c("preview.default.title-fallback")})]}),r&&(0,oZ.jsx)(oK.xv,{muted:!0,size:1,textOverflow:"ellipsis",className:null==s?void 0:s.subtitle,children:VH(r,"default")})]}),(0,oZ.jsx)(oK.xu,{flex:"none",padding:1,children:u}),l&&(0,oZ.jsx)("div",{className:null==s?void 0:s.children,children:l})]})})}var Kn=Object.freeze,Kr=Object.defineProperty,Ki=(e,n)=>Kn(Kr(e,"raw",{value:Kn(n||e.slice())}));let Ka=(0,oV.ZP)(oK.kC).attrs({align:"center"})(av||(av=Ki(["\n  height: ",";\n"])),(0,oK.hO)(VU.detail.media.height)),Ko=(0,oV.ZP)(oK.xu)(ay||(ay=Ki(["\n  white-space: nowrap;\n"]))),Kl=(0,oV.ZP)(oK.Od).attrs({animated:!0,radius:2})(ab||(ab=Ki(["\n  width: ",";\n  height: ",";\n"])),(0,oK.hO)(VU.detail.media.width),(0,oK.hO)(VU.detail.media.height)),Ks=(0,oV.ZP)(oK.Qr).attrs({animated:!0,radius:1,size:1})(aj||(aj=Ki(["\n  max-width: ","; /* 80% of 200px */\n  width: 80%;\n"])),(0,oK.hO)(160)),Kc=(0,oV.ZP)(oK.Qr).attrs({animated:!0,radius:1,size:1})(aw||(aw=Ki(["\n  max-width: ","; /* 60% of 200px */\n  width: 60%;\n"])),(0,oK.hO)(120)),Kd=(0,oV.ZP)(oK.Qr).attrs({animated:!0,radius:1,size:1})(ak||(ak=Ki(["\n  max-width: ","; /* 90% of 200px */\n  width: 90%;\n"])),(0,oK.hO)(180)),Ku=(0,oV.ZP)(oK.xv)(e=>{let{theme:n}=e,{fonts:r}=n.sanity,i=2*r.text.sizes[1].lineHeight;return(0,oV.iv)(aC||(aC=Ki(["\n    & > span {\n      max-height: ",";\n\n      /* Multi-line text overflow */\n      display: -webkit-box;\n      overflow: hidden;\n      overflow: clip;\n      text-overflow: ellipsis;\n      -webkit-line-clamp: ",";\n      -webkit-box-orient: vertical;\n    }\n  "])),(0,oK.hO)(i),2)}
1),Kp={...VU.detail.media,fit:"crop",aspect:1,dpr:(0,lx.x)()};var Kh=Object.freeze,Kf=Object.defineProperty,Km=(e,n)=>Kh(Kf(e,"raw",{value:Kh(n||e.slice())}));let Kg=oV.ZP.svg(a_||(a_=Km(["\n  width: ","px;\n  height: ","px;\n  transform: rotate(-90deg);\n"])),43,43),Kx=oV.ZP.circle(e=>{let{theme:n}=e,{color:r}=n.sanity;return(0,oV.iv)(aT||(aT=Km(["\n    fill: none;\n    stroke: ",";\n    stroke-width: ","px;\n  "])),sx.VG.gray[r.dark?900:100].hex,3)}),Kv=oV.ZP.circle(e=>{let{theme:n}=e,{color:r}=n.sanity;return(0,oV.iv)(aS||(aS=Km(["\n    fill: none;\n    stroke: ",";\n    stroke-width: ","px;\n    transition: stroke-dashoffset 75ms;\n  "])),sx.VG.blue[r.dark?400:500].hex,3)});function Ky(e){let{value:n}=e,r=2*Math.PI*20,i=(100-Math.min(Math.max(n,0),100))/100*r,a="".concat(21.5," ").concat(21.5," ").concat(43," ").concat(43);return(0,oZ.jsxs)(Kg,{viewBox:a,children:[(0,oZ.jsx)(Kx,{cx:43,cy:43,r:20}),(0,oZ.jsx)(Kv,{cx:43,cy:43,r:20,style:{strokeDasharray:r,strokeDashoffset:"".concat(i,"px")}})]})}var Kb=Object.freeze,Kj=Object.defineProperty,Kw=(e,n)=>Kb(Kj(e,"raw",{value:Kb(n||e.slice())}));let Kk=(0,oV.ZP)(oK.Zb)(aE||(aE=Kw(["\n  overflow: hidden;\n  overflow: clip;\n"]))),KC=(0,oV.ZP)(oK.Zb)(e=>{let{theme:n}=e,{color:r}=n.sanity;return(0,oV.iv)(aP||(aP=Kw(["\n    height: ","rem;\n    background: ",";\n    transition: transform 75ms;\n  "])),.5,sx.VG.blue[r.dark?400:500].hex)});function K_(e){let{value:n}=e;return(0,oZ.jsx)(Kk,{radius:5,children:(0,oZ.jsx)(KC,{radius:5,style:{transform:"translate3d(".concat(n-100,"%, 0, 0)")}})})}var KT=Object.freeze,KS=Object.defineProperty,KE=(e,n)=>KT(KS(e,"raw",{value:KT(n||e.slice())}));let KP=(0,oV.ZP)(oK.xu)(aO||(aO=KE(["\n  position: relative;\n"]))),KO=(0,oV.ZP)(oK.kC).attrs({align:"center",justify:"center"})(aA||(aA=KE(["\n  position: absolute;\n  left: 0;\n  top: 0;\n  right: 0;\n  bottom: 0;\n"]))),KA=(0,oV.ZP)(oK.Od).attrs({animated:!0,radius:2})(aI||(aI=KE(["\n  width: 100%;\n  height: 100%;\n"]))),KI=(0,oV.ZP)(oK.kC).attrs({align:"center",justify:"center"})(az||(az=KE(["\n  position: absolute;\n  left: 0;\n  top: 0;\n  right: 0;\n  bottom: 0;\n\n  &:before {\n    background-color: var(--card-bg-color);\n    opacity: 0.75;\n    content: '';\n    display: block;\n    position: absolute;\n    left: 0;\n    top: 0;\n    right: 0;\n    bottom: 0;\n  }\n\n  > svg {\n    position: relative;\n    z-index: 2;\n  }\n"]))),Kz=(0,oV.ZP)(oK.Kq).attrs({space:2})(aM||(aM=KE(["\n  max-width: ",";\n"])),(0,oK.hO)(200)),KM={...VU.media.media,aspect:1,fit:"crop",dpr:(0,lx.x)()};var KR=Object.freeze,KF=Object.defineProperty,KD=(e,n)=>KR(KF(e,"raw",{value:KR(n||e.slice())}));let Kq=(0,oV.ZP)(oK.kC).attrs({align:"center"})(aR||(aR=KD(["\n  height: ",";\n  white-space: nowrap;\n  position: relative;\n  z-index: 1;\n"])),(0,oK.hO)(VU.block.media.height)),KZ=(0,oV.ZP)(oK.Zb)(aF||(aF=KD(["\n  overflow: hidden;\n  position: relative;\n  padding-bottom: ","%;\n\n  & > span {\n    position: absolute;\n    top: 0;\n    left: 0;\n    right: 0;\n    bottom: 0;\n  }\n"])),e=>{let{$ratio:n}=e;return n}),KN=(0,oV.ZP)(oK.xu).attrs({overflow:"hidden"})(aD||(aD=KD(["\n  border-radius: ","px;\n"])),e=>{let{theme:n}=e;return n.sanity.radius[1]}),KL={...VU.blockImage.media,fit:"fillmax",dpr:(0,lx.x)()},KV=e=>{let{height:n,width:r}=e;return n&&r?n/r*100:1};var KK=Object.freeze,KB=Object.defineProperty;let KU={...VU.block.media,aspect:1,fit:"crop",dpr:(0,lx.x)()},KH=(0,oV.ZP)(oK.kC).attrs({align:"center"})(aq||(aq=KK(KB(eP=["\n  min-height: ",";\n"],"raw",{value:KK(eP.slice())}))),(0,oK.hO)(VU.block.media.height));var K$=Object.freeze,KW=Object.defineProperty,KY=(e,n)=>K$(KW(e,"raw",{value:K$(n||e.slice())}));let KX=oV.ZP.span(aZ||(aZ=KY(["\n  display: inline-flex;\n  align-items: center;\n  vertical-align: top;\n  height: calc(1em - 1px);\n  max-width: 100%;\n"]))),KG=oV.ZP.span(aN||(aN=KY(["\n  position: relative;\n  display: inline-block;\n  width: calc(1em - 1px);\n  height: calc(1em - 1px);\n  min-width: calc(1em - 1px);\n\n  & img {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    object-fit: cover;\n    border-radius: ",";\n  }\n\n  & img + span {\n    position: absolute;\n    left: 0;\n    top: 0;\n    right: 0;\n    bottom: 0;\n    box-shadow: inset 0 0 0 1px var(--card-fg-color);\n    opacity: 0.2;\n    border-radius: ",";\n  }\n\n  & svg {\n    display: block;\n    font-size: calc(14 / 16 * 1em);\n    margin: 1px 0;\n\n    &[data-sanity-icon] {\n      font-size: calc(18 / 16 * 1em);\n      margin: calc(1px + (2 / 18 * -1em)) 0;\n    }\n  }\n"])),e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.radius[1])},e=>{let{theme:n}=e;return(0,oK.hO)(n.sanity.radius[1])}),KJ=(0,oV.ZP)(oK.xv).attrs({forwardedAs:"span"})(e=>{let{theme:n}=e,r=n.sanity.fonts.text,i=r.sizes[1];return(0,oV.iv)(aL||(aL=KY(["\n    font-size: calc("," / 16 * 1em);\n    font-weight: ",";\n    box-sizing: border-box;\n    display: inline-block;\n    vertical-align: top;\n    line-height: ",";\n    padding-left: 0.5em;\n    padding-right: calc(0.5em - 2px);\n    min-width: 0;\n\n    & > span {\n      display: block;\n      white-space: nowrap;\n      text-overflow: ellipsis;\n      overflow: hidden;\n      overflow: clip;\n    }\n  "])),i.fontSize,r.weights.medium,i.lineHeight/i.fontSize)}
1),KQ={...VU.inline.media,fit:"crop",aspect:1,dpr:(0,lx.x)()};var K0=Object.freeze,K1=Object.defineProperty,K2=(e,n)=>K0(K1(e,"raw",{value:K0(n||e.slice())}));VU.default.media,(0,lx.x)(),(0,oV.ZP)(oK.xu)(aV||(aV=K2(["\n  height: 100%;\n\n  a {\n    color: currentColor;\n    text-decoration: none;\n  }\n\n  svg[data-sanity-icon] {\n    margin: 0;\n  }\n"]))),(0,oV.ZP)(oK.kC).attrs({align:"center"})(aK||(aK=K2(["\n  height: ",";\n"])),(0,oK.hO)(VU.default.media.height)),(0,oV.ZP)(oK.Qr).attrs({animated:!0,radius:1})(aB||(aB=K2(["\n  max-width: ",";\n  width: 80%;\n"])),(0,oK.hO)(160)),(0,oV.ZP)(oK.Qr).attrs({animated:!0,radius:1,size:1})(aU||(aU=K2(["\n  max-width: ",";\n  width: 60%;\n"])),(0,oK.hO)(120));let K3=["aria-hidden","disabled","href"];function K4(e){let{direction:n="horizontal",initialFocus:r,loop:i=!0,navigation:a=["arrows"],pause:o=!1,rootElement:l}=e,[s,c]=(0,oN.useState)(-1),[d,u]=(0,oN.useState)([]),p=d.length,h=p-1,f="horizontal"===n?"ArrowRight":"ArrowDown",m="horizontal"===n?"ArrowLeft":"ArrowUp",g=(0,oN.useCallback)(()=>{l&&u([...l.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled")&&"true"!==e.getAttribute("aria-hidden")))},[l]),x=(0,oN.useCallback)(e=>{c(e)},[]),v=(0,oN.useCallback)(e=>{if(o)return;let n=()=>{e.preventDefault(),c(e=>{let n=(e+h)%p;return i||n!==h?n:e})},r=()=>{e.preventDefault(),c(e=>{let n=(e+1)%p;return i||0!==n?n:e})};"Tab"===e.key&&a.includes("tab")&&(e.shiftKey?n():r()),a.includes("arrows")&&(e.key===m&&n(),e.key===f&&r())},[o,m,a,f,h,p,i]);(0,oN.useEffect)(()=>{g()},[g,r,n]),(0,oN.useEffect)(()=>{let e=new MutationObserver(g);return l&&e.observe(l,{childList:!0,subtree:!0,attributeFilter:K3}),()=>{e.disconnect()}},[d,g,l]),(0,oN.useEffect)(()=>{var e;d.forEach((e,n)=>{n===s?(e.setAttribute("tabIndex","0"),e.setAttribute("aria-selected","true"),e.focus(),e.onfocus=()=>x(n),e.onblur=()=>x(-1)):(e.setAttribute("tabIndex","-1"),e.setAttribute("aria-selected","false"),e.onfocus=()=>x(n))}),-1===s&&d&&(null==(e=d["last"===r?h:0])||e.setAttribute("tabIndex","0"))},[d,s,x,r,h]),(0,oN.useEffect)(()=>(null==l||l.addEventListener("keydown",v),()=>{null==l||l.removeEventListener("keydown",v)}),[v,l])}var K5=Object.freeze,K8=Object.defineProperty;let K6=(0,oV.ZP)(lr.zx)(aH||(aH=K5(K8(eO=["\n  position: relative;\n  // The children in button is rendered inside a span, we need to absolutely position it.\n  & > span:nth-child(2) {\n    position: absolute;\n    top: 6px;\n    right: 6px;\n    padding: 0;\n  }\n"],"raw",{value:K5(eO.slice())})))),K9=oV.ZP.div({width:4,height:4,borderRadius:3,boxShadow:"0 0 0 1px var(--card-bg-color)"}),K7=(0,oN.forwardRef)(function(e,n){let{disabled:r,icon:i,label:a,mode:o="bleed",text:l,tone:s,...c}=e,d=(0,oK.Fg)(),u=s&&d.sanity.color.solid[s],p=(0,oN.useMemo)(()=>({backgroundColor:null==u?void 0:u.enabled.bg}),[u]);return(0,oZ.jsx)(K6,{"data-ui":"StatusButton",...c,"aria-label":a,disabled:!!r,mode:o,ref:n,text:l,icon:i,children:s&&(0,oZ.jsx)(K9,{style:p})})}),Be=(0,oN.forwardRef)(function(e,n){let{children:r,content:i,disabled:a,...o}=e;return(0,oZ.jsx)(lr.u,{...o,content:i,disabled:a||!i,ref:n,children:(0,oZ.jsx)("div",{children:r})})}),Bt=(0,oN.forwardRef)((e,n)=>{let{push:r}=(0,oK.pm)();return(0,oN.useImperativeHandle)(n,()=>({push:r})),null});Bt.displayName="ImperativeToast";let Bn=(0,oN.createContext)({navbar:200,navbarPopover:5e5,navbarDialog:500001,pane:100,paneHeader:[110,15e3],paneFooter:[120,2e4],paneResizer:[130,25e3],popover:200,modal:200,movingItem:1e4,drawershade:1e6,drawer:1000001,fullscreen:12e5,toast:[100,11e3],portal:200,dropdown:200,navbarFixed:1010,fullscreenEdit:1050,popoverBackground:1060,tooltip:200,modalBackground:2e3,spinner:3e3});function Br(){return(0,oN.useContext)(Bn)}function Bi(e){let{children:n,zOffset:r}=e,i=Br()[r];return(0,oZ.jsx)(oK.li,{zOffset:i,children:n})}(0,oN.memo)(function(e){let{transform:n}=e,r=vC(),i=(0,oN.useCallback)(e=>{let i=n(e.patches);r.onChange(fR.from(i))},[r,n]),a=(0,oN.useMemo)(()=>({...r,onChange:i}),[r,i]);return(0,oZ.jsx)(vw.Provider,{value:a,children:e.children})})}}]);

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.