1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2487],{52487:(e,l,a)=>{a.r(l),a.d(l,{UploadComponent:()=>x});var o=a(33251),t=a(93916),s=a(28951),i=a(48643),n=a(95155),d=a(94271),c=a(66104),r=a(25866),u=a(92825),p=a(77168),h=a(32532),m=a(12115),v="lexical-upload",b={depth:0},g=e=>{var l,a,g,x;let{data:{fields:_,relationTo:f,value:j},nodeKey:w}=e;if("object"==typeof j)throw Error("Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.");let{config:{routes:{api:C},serverURL:D},getEntityConfig:N}=(0,r.b)(),S=(0,m.useRef)(null),{uuid:k}=(0,i.b)(),y=(0,u.useEditDepth)(),[P]=(0,d.DF)(),{editorConfig:R,fieldProps:{readOnly:E,schemaPath:U}}=(0,i.b)(),{i18n:B,t:F}=(0,p.d)(),[L,T]=(0,m.useReducer)(e=>e+1,0),[K]=(0,m.useState)(()=>N({collectionSlug:f})),I=(0,m.useId)(),z=(0,u.formatDrawerSlug)({slug:"lexical-upload-drawer-"+k+I,depth:y}),{toggleDrawer:A}=(0,t.a)(z,!0),{closeDocumentDrawer:M,DocumentDrawer:O,DocumentDrawerToggler:q}=(0,s.a)({id:j,collectionSlug:K.slug}),[{data:G},{setParams:H}]=(0,u.usePayloadAPI)("".concat(D).concat(C,"/").concat(K.slug,"/").concat(j),{initialParams:b}),J=(null==G?void 0:G.thumbnailURL)||(null==G?void 0:G.url),Q=(0,m.useCallback)(()=>{P.update(()=>{var e;null===(e=(0,h.nsf)(w))||void 0===e||e.remove()})},[P,w]),V=(0,m.useCallback)(e=>{H({...b,cacheBust:L}),T(),M()},[H,L,M]),W=null==R?void 0:null===(x=R.resolvedFeatureMap)||void 0===x?void 0:null===(g=x.get("upload"))||void 0===g?void 0:null===(a=g.sanitizedClientFeatureProps.collections)||void 0===a?void 0:null===(l=a[K.slug])||void 0===l?void 0:l.hasExtraFields,X=(0,m.useCallback)((e,l)=>{P.update(()=>{let e=(0,h.nsf)(w);if(e){let a={...e.getData(),fields:l};e.setData(a)}})},[P,w]);return(0,n.jsxs)("div",{className:v,contentEditable:!1,ref:S,children:[(0,n.jsxs)("div",{className:"".concat(v,"__card"),children:[(0,n.jsxs)("div",{className:"".concat(v,"__topRow"),children:[(0,n.jsx)("div",{className:"".concat(v,"__thumbnail"),children:J?(0,n.jsx)("img",{alt:null==G?void 0:G.filename,"data-lexical-upload-id":j,"data-lexical-upload-relation-to":f,src:J}):(0,n.jsx)(u.File,{})}),(0,n.jsxs)("div",{className:"".concat(v,"__topRowRightPanel"),children:[(0,n.jsx)("div",{className:"".concat(v,"__collectionLabel"),children:(0,c.sC)(K.labels.singular,B)}),P.isEditable()&&(0,n.jsxs)("div",{className:"".concat(v,"__actions"),children:[W?(0,n.jsx)(u.Button,{buttonStyle:"icon-label",className:"".concat(v,"__upload-drawer-toggler"),disabled:E,el:"button",icon:"edit",onClick:()=>{A()},round:!0,tooltip:F("fields:editRelationship")}):null,(0,n.jsx)(u.Button,{buttonStyle:"icon-label",className:"".concat(v,"__swap-drawer-toggler"),disabled:E,el:"button",icon:"swap",onClick:()=>{P.dispatchCommand(o.c,{replace:{nodeKey:w}})},round:!0,tooltip:F("fields:swapUpload")}),(0,n.jsx)(u.Button,{buttonStyle:"icon-label",className:"".concat(v,"__removeButton"),disabled:E,icon:"x",onClick:e=>{e.preventDefault(),Q()},round:!0,tooltip:F("fields:removeUpload")})]})]})]}),(0,n.jsx)("div",{className:"".concat(v,"__bottomRow"),children:(0,n.jsx)(q,{className:"".concat(v,"__doc-drawer-toggler"),children:(0,n.jsx)("strong",{children:null==G?void 0:G.filename})})})]}),j?(0,n.jsx)(O,{onSave:V}):null,W?(0,n.jsx)(o.a,{data:_,drawerSlug:z,drawerTitle:F("general:editLabel",{label:(0,c.sC)(K.labels.singular,B)}),featureKey:"upload",handleDrawerSubmit:X,schemaPath:U,schemaPathSuffix:K.slug}):null]})},x=e=>(0,n.jsx)(o.b,{...e,uploads:!0,children:(0,n.jsx)(g,{...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.