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