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