1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5939],{5939:(e,l,a)=>{a.r(l),a.d(l,{UploadComponent:()=>b});var t=a(521),o=a(93916),n=a(28951),s=a(48643),c=a(95155),i=a(94271),d=a(58647),r=a(84365),u=a(58083),m=a(92825),h=a(12705),p=a(32532),g=a(89349),_=a(12115),v={depth:0},b=e=>{var l,a,b,f;let{className:w,data:{fields:x,relationTo:j,value:N},nodeKey:D}=e;if("object"==typeof N)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:S},getEntityConfig:y}=(0,u.c)(),k=(0,_.useRef)(null),{uuid:P}=(0,s.b)(),U=(0,m.useEditDepth)(),[E]=(0,i.DF)(),{editorConfig:T,fieldProps:{schemaPath:z}}=(0,s.b)(),B=(0,d.a)(),{i18n:L,t:R}=(0,h.d)(),[F,K]=(0,_.useReducer)(e=>e+1,0),[I]=(0,_.useState)(()=>y({collectionSlug:j})),A=(0,_.useId)(),M=(0,m.formatDrawerSlug)({slug:"lexical-upload-drawer-"+P+A,depth:U}),{toggleDrawer:O}=(0,o.a)(M,!0),{closeDocumentDrawer:q,DocumentDrawer:G,DocumentDrawerToggler:H}=(0,n.a)({id:N,collectionSlug:I.slug}),[{data:J},{setParams:Q}]=(0,m.usePayloadAPI)("".concat(S).concat(C,"/").concat(I.slug,"/").concat(N),{initialParams:v}),V=(null==J?void 0:J.thumbnailURL)||(null==J?void 0:J.url),W=(0,_.useCallback)(()=>{E.update(()=>{var e;null==(e=(0,p.nsf)(D))||e.remove()})},[E,D]),X=(0,_.useCallback)(e=>{Q({...v,cacheBust:F}),K(),q()},[Q,F,q]),Y=null==T||null==(f=T.resolvedFeatureMap)||null==(b=f.get("upload"))||null==(a=b.sanitizedClientFeatureProps.collections)||null==(l=a[I.slug])?void 0:l.hasExtraFields,Z=(0,_.useCallback)((e,l)=>{E.update(()=>{let e=(0,p.nsf)(D);if(e){let a={...e.getData(),fields:l};e.setData(a)}})},[E,D]),$=V&&(null==J?void 0:J.width)&&(null==J?void 0:J.height)?J.width>J.height?"landscape":"portrait":"landscape";return(0,c.jsxs)("div",{className:"".concat(w,"__contents ").concat(w,"__contents--").concat($),"data-filename":null==J?void 0:J.filename,ref:k,children:[(0,c.jsxs)("div",{className:"".concat(w,"__card"),children:[(0,c.jsxs)("div",{className:"".concat(w,"__media"),children:[(0,c.jsx)(m.Thumbnail,{collectionSlug:j,fileSrc:(0,g.w)(null==J?void 0:J.mimeType)?V:null,height:null==J?void 0:J.height,size:"none",width:null==J?void 0:J.width}),B&&(0,c.jsx)("div",{className:"".concat(w,"__overlay ").concat(w,"__floater"),children:(0,c.jsxs)("div",{className:"".concat(w,"__actions"),role:"toolbar",children:[Y?(0,c.jsx)(m.Button,{buttonStyle:"icon-label",className:"".concat(w,"__upload-drawer-toggler"),disabled:!B,el:"button",icon:"edit",onClick:O,round:!0,size:"medium",tooltip:R("fields:editRelationship")}):null,(0,c.jsx)(m.Button,{buttonStyle:"icon-label",className:"".concat(w,"__swap-drawer-toggler"),disabled:!B,el:"button",icon:"swap",onClick:()=>{E.dispatchCommand(t.b,{replace:{nodeKey:D}})},round:!0,size:"medium",tooltip:R("fields:swapUpload")}),(0,c.jsx)(m.Button,{buttonStyle:"icon-label",className:"".concat(w,"__removeButton"),disabled:!B,icon:"x",onClick:e=>{e.preventDefault(),W()},round:!0,size:"medium",tooltip:R("fields:removeUpload")})]})})]}),(0,c.jsxs)("div",{className:"".concat(w,"__metaOverlay ").concat(w,"__floater"),children:[(0,c.jsx)(H,{className:"".concat(w,"__doc-drawer-toggler"),children:(0,c.jsx)("strong",{className:"".concat(w,"__filename"),children:(null==J?void 0:J.filename)||R("general:untitled")})}),(0,c.jsx)("div",{className:"".concat(w,"__collectionLabel"),children:(0,r.s)(I.labels.singular,L)})]})]}),N?(0,c.jsx)(G,{onSave:X}):null,Y?(0,c.jsx)(t.a,{data:x,drawerSlug:M,drawerTitle:R("general:editLabel",{label:(0,r.s)(I.labels.singular,L)}),featureKey:"upload",handleDrawerSubmit:Z,schemaPath:z,schemaPathSuffix:I.slug}):null]})}}}]);
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.