1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3451],{73451:(e,n,a)=>{a.r(n),a.d(n,{RelationshipComponent:()=>g});var l=a(71851),t=a(72830),o=a(35216),c=a(1092),s=a(8310),i=a(32109),u=a(10205),r=a(95482),d=a(49198),p=a(17521),_=a(27554),h=a(43453),m=a(68351),b=a(1728),f=a(41417),v={depth:0},g=function(e){var n,a,g,j=e.className,w=e.data,x=w.relationTo,N=w.value,C=e.nodeKey;if((void 0===N?"undefined":(0,c._)(N))=="object")throw Error("Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.");var R=(0,f.useRef)(null),k=(0,o._)((0,r.DF)(),1)[0],D=(0,d.a)(),y=(0,_.c)(),S=y.config,B=S.routes.api,E=S.serverURL,P=y.getEntityConfig,T=(0,o._)((0,f.useState)(function(){return P({collectionSlug:x})}),1)[0],A=(0,h.d)(),K=A.i18n,L=A.t,F=(0,o._)((0,f.useReducer)(function(e){return e+1},0),2),I=F[0],U=F[1],q=(0,o._)((0,m.usePayloadAPI)("".concat(E).concat(B,"/").concat(T.slug,"/").concat(N),{initialParams:v}),2),z=q[0].data,G=q[1].setParams,H=(0,i.a)({id:N,collectionSlug:T.slug}),J=H.closeDocumentDrawer,M=H.DocumentDrawer,O=H.DocumentDrawerToggler,Q=(0,f.useCallback)(function(){k.update(function(){var e;null==(e=(0,b.nsf)(C))||e.remove()})},[k,C]),V=f.useCallback(function(){G((0,t._)((0,l._)({},v),{cacheBust:I})),J(),U()},[I,G,J]);return(0,u.jsxs)("div",{className:"".concat(j,"__contents"),contentEditable:!1,ref:R,children:[(0,u.jsxs)("div",{className:"".concat(j,"__wrap"),children:[(0,u.jsx)("p",{className:"".concat(j,"__label"),children:L("fields:labelRelationship",{label:(null==(n=T.labels)?void 0:n.singular)?(0,p.s)(null==(a=T.labels)?void 0:a.singular,K):T.slug})}),(0,u.jsx)(O,{className:"".concat(j,"__doc-drawer-toggler"),children:(0,u.jsx)("p",{className:"".concat(j,"__title"),children:z?z[(null==T||null==(g=T.admin)?void 0:g.useAsTitle)||"id"]:N})})]}),D&&(0,u.jsxs)("div",{className:"".concat(j,"__actions"),children:[(0,u.jsx)(m.Button,{buttonStyle:"icon-label",className:"".concat(j,"__swapButton"),disabled:!D,el:"button",icon:"swap",onClick:function(){C&&k.dispatchCommand(s.a,{replace:{nodeKey:C}})},round:!0,tooltip:L("fields:swapRelationship")}),(0,u.jsx)(m.Button,{buttonStyle:"icon-label",className:"".concat(j,"__removeButton"),disabled:!D,icon:"x",onClick:function(e){e.preventDefault(),Q()},round:!0,tooltip:L("fields:removeRelationship")})]}),!!N&&(0,u.jsx)(M,{onSave:V})]})}}}]);
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.