1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9295],{69295:(e,l,a)=>{a.r(l),a.d(l,{RelationshipComponent:()=>_});var o=a(46383),t=a(28951),s=a(48643),n=a(95155),i=a(94271),c=a(84365),r=a(14682),d=a(80127),u=a(92825),p=a(32532),b=a(12115),h="lexical-relationship",v={depth:0},m=e=>{var l,a,m;let{data:{relationTo:_,value:g},nodeKey:f}=e;if("object"==typeof g)throw Error("Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.");let x=(0,b.useRef)(null),[j]=(0,i.DF)(),{fieldProps:{readOnly:w}}=(0,s.b)(),{config:{routes:{api:N},serverURL:C},getEntityConfig:R}=(0,r.b)(),[k]=(0,b.useState)(()=>R({collectionSlug:_})),{i18n:y,t:D}=(0,d.d)(),[E,S]=(0,b.useReducer)(e=>e+1,0),[{data:B},{setParams:P}]=(0,u.usePayloadAPI)("".concat(C).concat(N,"/").concat(k.slug,"/").concat(g),{initialParams:v}),{closeDocumentDrawer:T,DocumentDrawer:A,DocumentDrawerToggler:K}=(0,t.a)({id:g,collectionSlug:k.slug}),L=(0,b.useCallback)(()=>{j.update(()=>{var e;null===(e=(0,p.nsf)(f))||void 0===e||e.remove()})},[j,f]),F=b.useCallback(()=>{P({...v,cacheBust:E}),T(),S()},[E,P,T]);return(0,n.jsxs)("div",{className:h,contentEditable:!1,ref:x,children:[(0,n.jsxs)("div",{className:"".concat(h,"__wrap"),children:[(0,n.jsx)("p",{className:"".concat(h,"__label"),children:D("fields:labelRelationship",{label:(null===(l=k.labels)||void 0===l?void 0:l.singular)?(0,c.s)(null===(a=k.labels)||void 0===a?void 0:a.singular,y):k.slug})}),(0,n.jsx)(K,{className:"".concat(h,"__doc-drawer-toggler"),children:(0,n.jsx)("p",{className:"".concat(h,"__title"),children:B?B[(null==k?void 0:null===(m=k.admin)||void 0===m?void 0:m.useAsTitle)||"id"]:g})})]}),j.isEditable()&&(0,n.jsxs)("div",{className:"".concat(h,"__actions"),children:[(0,n.jsx)(u.Button,{buttonStyle:"icon-label",className:"".concat(h,"__swapButton"),disabled:w,el:"button",icon:"swap",onClick:()=>{f&&j.dispatchCommand(o.a,{replace:{nodeKey:f}})},round:!0,tooltip:D("fields:swapRelationship")}),(0,n.jsx)(u.Button,{buttonStyle:"icon-label",className:"".concat(h,"__removeButton"),disabled:w,icon:"x",onClick:e=>{e.preventDefault(),L()},round:!0,tooltip:D("fields:removeRelationship")})]}),!!g&&(0,n.jsx)(A,{onSave:F})]})},_=e=>(0,n.jsx)(m,{...e})}}]);
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.