"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3813],{26032:function(e,t,r){var l,i=r(94746);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)({}).hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(null,arguments)}t.Z=function(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=i.createElement("rect",{width:19,height:19,x:.5,y:.5,stroke:"#fff",strokeOpacity:.1,rx:3.5})))}},30667:function(e,t,r){var l,i,s=r(94746);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)({}).hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(null,arguments)}t.Z=function(e){return s.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=s.createElement("rect",{width:20,height:20,fill:"#7B5FEB",rx:4})),i||(i=s.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3.834 12.063 8 15.5l8.167-11"})))}},53785:function(e,t,r){var l,i=r(94746);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)({}).hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(null,arguments)}t.Z=function(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=i.createElement("circle",{cx:10,cy:10,r:5,fill:"#D92F2F"})))}},86174:function(e,t,r){var l,i=r(94746);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)({}).hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(null,arguments)}t.Z=function(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20"},e),l||(l=i.createElement("path",{fill:"#FFC700",fillRule:"evenodd",d:"M17.5 14.794v-6.46c0-.921-.746-1.667-1.667-1.667h-5L9.106 4.076a1.67 1.67 0 0 0-1.387-.743H4.167C3.247 3.333 2.5 4.08 2.5 5v10c0 .92.746 1.667 1.667 1.667h11.666c.92 0 1.667-.747 1.667-1.667",clipRule:"evenodd"})))}},1380:function(e,t,r){var l,i=r(94746);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)({}).hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(null,arguments)}t.Z=function(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20"},e),l||(l=i.createElement("path",{fill:"#fff",d:"M4.234 2.5c-.22 0-.41 0-.565.013a1.3 1.3 0 0 0-.486.123 1.25 1.25 0 0 0-.547.547c-.08.157-.11.321-.123.486a8 8 0 0 0-.013.565V8.75c0 .23.187.417.417.417H8.75c.23 0 .417-.187.417-.417V2.917A.417.417 0 0 0 8.75 2.5zM16.818 2.636a1.3 1.3 0 0 0-.487-.123 8 8 0 0 0-.565-.013H11.25a.417.417 0 0 0-.417.417V8.75c0 .23.187.417.417.417h5.833c.23 0 .417-.187.417-.417V4.234c0-.22 0-.41-.013-.565a1.3 1.3 0 0 0-.123-.486 1.25 1.25 0 0 0-.547-.547M2.917 10.833a.417.417 0 0 0-.417.417v4.516c0 .22 0 .41.013.565.013.165.043.329.123.486.12.236.311.427.547.547.157.08.321.11.486.123.156.013.345.013.565.013H8.75c.23 0 .417-.186.417-.417V11.25a.417.417 0 0 0-.417-.417zM11.25 10.833a.417.417 0 0 0-.417.417v5.833c0 .23.187.417.417.417h4.516c.22 0 .41 0 .565-.013.165-.013.329-.043.486-.123a1.25 1.25 0 0 0 .547-.547c.08-.157.11-.321.123-.486.013-.156.013-.345.013-.565V11.25a.417.417 0 0 0-.417-.417z"})))}},29850:function(e,t,r){var l,i=r(94746);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)({}).hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(null,arguments)}t.Z=function(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=i.createElement("path",{d:"m8.125 4.603.806-.805a5.142 5.142 0 0 1 7.271 7.271l-.807.808M4.607 8.12l-.81.81a5.142 5.142 0 1 0 7.272 7.271l.804-.804m-3.956-3.315 4.166-4.166"})))}},97617:function(e,t,r){var l,i=r(94746);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)({}).hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(null,arguments)}t.Z=function(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20"},e),l||(l=i.createElement("path",{stroke:"#92959D",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M13.542 8.125V6.042a3.542 3.542 0 0 0-7.084 0v2.083m-.833 9.583h8.75c.92 0 1.667-.746 1.667-1.666v-6.25c0-.92-.747-1.667-1.667-1.667h-8.75c-.92 0-1.667.746-1.667 1.667v6.25c0 .92.746 1.666 1.667 1.666"})))}},17495:function(e,t,r){var l,i=r(94746);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)({}).hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(null,arguments)}t.Z=function(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20"},e),l||(l=i.createElement("path",{stroke:"#92959D",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M6.459 8.125V4.833a3.542 3.542 0 0 1 7.028-.622M5.625 17.708h8.75c.92 0 1.667-.746 1.667-1.666v-6.25c0-.92-.746-1.667-1.667-1.667h-8.75c-.92 0-1.666.746-1.666 1.667v6.25c0 .92.746 1.666 1.666 1.666"})))}},87645:function(e,t,r){var l,i=r(94746);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)({}).hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(null,arguments)}t.Z=function(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=i.createElement("path",{fill:"#fff",d:"M3.5 2.5a1 1 0 0 0-1 1v3.375h15V3.5a1 1 0 0 0-1-1zM2.5 12.292V7.708h15v4.584zM2.5 13.125V16.5a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1v-3.375z"})))}},67566:function(e,t,r){r.d(t,{Z:function(){return m}});var l=r(57437),i=r(56277),s=r(98920),n=r(5674),a=r(69064),o=r(24164),c=r(70845),d=r(2265),u=r(29850),h=r(60040);function m(e){var t,r;let{isModalOpen:m,setIsModalOpen:x,assetId:f,addType:v,createNewLink:g=!1}=e,{prepareAssetsToShare:p}=(0,o.K8)(),{t:j}=(0,c.$)("myarchive"),[w,y]=(0,d.useState)(""),N=(0,o.Nr)(w,500),[b,k]=(0,d.useState)(null),{openShareModal:_}=(0,o.K8)(),E=(0,d.useMemo)(()=>({name:N,order:"created_at",direction:"DESC",project:null}),[N]),{linksData:C,isLoadingLinks:O}=(0,s.JO)(E),{licenseData:S,isLoadingLicenses:R}=(0,s.NX)("licenses",N),M=(0,d.useMemo)(()=>"link"===v?C.filter(e=>{var t;return e.active&&(null===(t=e.name)||void 0===t?void 0:t.length)>0}):S.filter(e=>"-"===e.paymentStatus&&e.isEditable),[v,C,S]),Z=(0,d.useMemo)(()=>"link"===v?O:R,[v,O,R]),D=async e=>{let t=[];try{t=(await p(v,void 0,e)).selectedVideosIds}catch(e){throw a.toast.error(e.message),Error(e)}t.length>0&&await (0,i.Ye)(t,e,"link"===v)},P=async e=>{f&&await (0,i.Ye)([f],e,"link"===v)},F=async(e,t)=>{await a.toast.promise(f?P(e):D(e),{loading:j("file.link_add_changing")+t,success:(0,l.jsxs)("b",{children:[j("file.link_add_changed")," ",t]}),error:(0,l.jsx)("b",{children:j("file.link_add_error")})})},A=()=>{b&&F(b.id,b.name)},L=async e=>{let t=await _("link",void 0,!0);e(),t&&await F(t,j("file.new_link"))},q="link"===v?j("file.add_to_link"):j("file.add_to_license");return(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)(h.Z,{setIsModalOpen:()=>{x(!1)},mainAction:()=>{A()},mainActionText:j("file.add"),...g&&{secondaryAction:e=>{L(e)}},secondaryActionText:null!==(t=j("file.add_new_link"))&&void 0!==t?t:"",isModalOpen:m,title:q,children:[(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("input",{type:"text",placeholder:"Search...",className:"input input-sm input-bordered w-full mb-2",value:w,onChange:e=>{y(e.target.value)}}),(0,l.jsx)("div",{className:"absolute right-4 top-2.5 flex gap-2",children:w.length>0&&(0,l.jsx)(n.aHS,{title:null!==(r=j("keywords.delete"))&&void 0!==r?r:"",className:"w-3 h-3 text-textolight hover:text-texto hover:cursor-pointer",onClick:()=>{y("")}})})]}),(0,l.jsxs)("div",{className:"h-[50vh] overflow-auto",children:[0===M.length&&!Z&&(0,l.jsx)("div",{className:"text-textolight text-center",children:"No items"}),Z&&(0,l.jsx)("div",{className:"flex justify-center mt-2",children:(0,l.jsx)("div",{className:"w-5 h-5 rounded-full animate-spin border-2 border-solid border-gray-400 border-t-transparent"})}),null==M?void 0:M.map(e=>{var t;return(0,l.jsxs)("div",{className:"cursor-pointer p-1 hover:bg-texto/10 rounded-md truncate flex gap-2 ".concat(e.id===(null==b?void 0:b.id)?"bg-texto/10":""),onClick:()=>{k(e)},children:[(0,l.jsx)(u.Z,{className:"h-5.5 w-5.5 ml-2 flex-shrink-0 mysvgcustomblue hover:brightness-125"}),(0,l.jsx)("span",{children:(null===(t=e.name)||void 0===t?void 0:t.length)>0?e.name:e.id})]},e.id)})]})]})})}},80120:function(e,t,r){r.d(t,{Z:function(){return a},c:function(){return o}});var l=r(57437),i=r(2265),s=r(24164),n=r(73114);function a(e,t){e.preventDefault(),e.stopPropagation();let r=e.currentTarget.getBoundingClientRect();t({show:!0,x:e.clientX-r.left,y:e.clientY-r.top,pageX:e.pageX,pageY:e.pageY})}function o(e){let{children:t,contextMenuPositionX:r,contextMenuPositionY:a,pageX:o,pageY:c,show:d,setShow:u}=e,h=(0,i.useRef)(null);if((0,s.t$)(h,e=>{(e.pageX!==o||e.pageY!==c||2!==e.button)&&u({show:!1,x:0,y:0,pageX:0,pageY:0})}),!d)return null;let m=window.innerHeight,x=window.innerWidth,f=32*i.Children.toArray(t).length+16,v=a;c+f>=m-64&&(v-=f);let g=r;return o+210>=x&&(g-=210),(0,l.jsx)("div",{ref:h,className:"absolute z-50",style:{left:g,top:v},children:(0,l.jsx)(n.Z,{children:t})})}},67001:function(e,t,r){r.d(t,{Z:function(){return d}});var l=r(57437),i=r(98920),s=r(18409),n=r(98894),a=r(67011),o=r(33280),c=r(69064);function d(e){let{id:t,type:r,children:d}=e,u=(0,s.Bd)(e=>e.addDragged),h=(0,s.Bd)(e=>e.removeDragged),m=(0,s.Bd)(e=>e.droppedAction),x=(0,s.Bd)(e=>e.dragged),f=(0,s.Bd)(e=>e.dragPreview),v=(0,s.Bd)(e=>e.canDrag),g=(0,s.It)(e=>e.activeProject),{invalidateAllProjecFoldersQuery:p}=(0,i.Be)(),{invalidatAllFilesQuery:j}=(0,i.pX)(),[w]=(0,s.k5)(e=>[e.setShouldUpdateFileList]),y=(0,s.RF)(e=>e.setLoading),[,N,b]=(0,n.c)(()=>({type:r,item:()=>(console.log(t,"starts dragging"),v(t))?(u(t),{id:t}):null,collect:e=>({isDragging:e.isDragging()}),end:(e,r)=>{console.log(t,"stops dragging");let l=r.getDropResult();e&&l&&(y(!0),m(l,e=>{p(),w(t+Math.random().toString()),j(),y(!1),e.length>0?c.toast.error(e,{duration:1e4}):c.toast.success("Moved successfully")},g)),h()}})),[{isOver:k},_]=(0,a.L)(()=>({accept:"FOLDER"===r?["FILE","FOLDER"]:"BOX",collect:e=>({isOver:e.isOver(),canDrop:e.canDrop()}),drop:()=>({name:t,type:"FOLDER"})}));return(0,l.jsxs)("div",{ref:_,role:"Dustbin",className:k?"bg-[#303660] rounded-xl isOver":"",children:[f&&(0,l.jsx)(o.h,{connect:b,src:f}),(0,l.jsx)("div",{role:"Handle",ref:N,className:"h-full relative ".concat(x.includes(t)?"opacity-50":"opacity-100"),children:d})]})}},29762:function(e,t,r){r.d(t,{Z:function(){return n}});var l=r(57437),i=r(70845),s=r(60040),n=e=>{var t,r;let{children:n,isModalOpen:a,setIsModalOpen:o,action:c}=e,{t:d}=(0,i.$)("myarchive");return(0,l.jsx)(s.Z,{title:null!==(t=d("modal.confirm"))&&void 0!==t?t:"",isModalOpen:a,setIsModalOpen:o,mainAction:c,mainActionText:d("modal.ok").toUpperCase(),secondaryAction:()=>{o(!1)},secondaryActionText:(null!==(r=d("modal.cancel"))&&void 0!==r?r:"").toUpperCase(),children:n})}},20055:function(e,t,r){r.d(t,{V:function(){return Y},Z:function(){return K}});var l,i,s=r(57437),n=r(77208),a=r(18409),o=r(82598),c=r(65408),d=r(5674),u=r(60729),h=r(24164),m=r(67001),x=r(10796),f=r(69064),v=r(56277),g=r(98920),p=r(29762),j=r(2265),w=r(70845),y=r(33145),N=r(88306),b=r(4500),k=r(6398),_=r(35639),E=r(78140),C=r(60770),O=r(55160),S=r(30667),R=r(26032),M=r(94746);function Z(){return(Z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)({}).hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(null,arguments)}var D=function(e){return M.createElement("svg",Z({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=M.createElement("rect",{width:20,height:20,fill:"#7B5FEB",rx:4})),i||(i=M.createElement("path",{stroke:"#fff",strokeLinecap:"round",strokeWidth:1.5,d:"M4 10.25h12"})))},P=r(97617),F=r(17495),A=r(86174),L=r(53785),q=r(6913),W=r(80120);let B={},T=0,I="useScrollRestoration-windows",X=e=>{let t=Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,r?1:0]}));return 3/(3+1*t.id+1*t.owner+1*t.created+1*t.modified+1*t.copyright+.75*t.talent+.75*t.property+.75*t.trademark+.75*t.audio+.15)*100},Y=e=>{var t;let{sortKey:r,sortDirection:l,setSort:i,mykey:n,className:a="",style:o={},trans:c=""}=e,{t:d}=(0,w.$)("myarchive");return(0,s.jsxs)("div",{style:o,className:"".concat(a," flex-1 flex justify-center items-center cursor-pointer ").concat(r===n?"text-texto":"text-texto/50 hover:text-texto"),onClick:()=>{i(n)},title:null!==(t=d("row."+n))&&void 0!==t?t:"",children:[d("row."+n+c)," ",r===n&&("ASC"===l?(0,s.jsx)(O.kWQ,{className:"h-5 w-5 ml-2"}):(0,s.jsx)(O.ALZ,{className:"h-5 w-5 ml-2"}))]})},V=e=>{var t,r,l,i,c,u;let{data:f,visualization:v,isSelected:g,moveForward:p,setModalAssetOpen:b,askDelete:k,i:_,style:M,columns:Z}=e,D=f[_],{t:q}=(0,w.$)("myarchive"),{openShareModal:B}=(0,h.K8)(),{userSessionState:T}=(0,C.Ry)(),[I,Y]=(0,a.It)(e=>[e.projectData,e.activeProject]),V=null==I?void 0:I.members.some(e=>e.email===(null==T?void 0:T.email)&&"contributor"===e.role),K=(0,h.e7)(),z=(0,h.ac)(h.qL),[H]=(0,a.Bd)(e=>[e.toggleSelected]),[$,U]=(0,j.useState)({x:0,y:0,pageX:0,pageY:0,show:!1}),[Q]=(0,a.VW)(e=>[e.setModalFolderOpen]),G=(0,a.n8)(e=>e.breadcrumbs),J=G.length>0?(0,x.NV)(G[G.length-1].id):null;if(null===D)return(0,s.jsx)("div",{className:"h-[72px] w-full",children:"\xa0"});let ee=(0,o.Wv)(D)?(0,x.Y5)(D):"",et=""===ee?"":(0,x.jl)((null!==(r=null==ee?void 0:ee.duration_in_ms)&&void 0!==r?r:0)/1e3),er=""===ee?"":(0,N.DK)(null==ee?void 0:ee.s3_key),el=async e=>{await B("link",e)},ei=(e,t)=>{e?H(t,f.filter(e=>null!==e)):H(t)},es=e=>{(0,o.qR)(e)?p(e):(0,o.Wv)(e)?K("/video/info/".concat(e.origin_asset_id)):(0,o.Ey)(e)&&K("/photo/info/".concat(e.origin_asset_id))},en=(e,t)=>{switch(e.detail){case 1:ei(e.shiftKey,t);break;case 2:es(t)}};if((0,o.Y5)(D)||(0,o.f2)(D)||(0,o.Hb)(D))return null;let ea=g(D.origin_asset_id),eo=(0,s.jsxs)(s.Fragment,{children:[!V&&!(0,o.qR)(D)&&(0,s.jsx)("li",{children:(0,s.jsxs)("a",{onClick:()=>{es(D)},children:[(0,s.jsx)(d.tvD,{className:n.E}),q("file.edit_metadata")]})}),!V&&(0,s.jsx)("li",{children:(0,s.jsxs)("a",{onClick:()=>{(0,o.qR)(D)?Q(D.title,D.id,Y,J):b(D.title,Number(D.id),(0,o.Wv)(D)?"video":"photo")},children:[(0,s.jsx)(d.fmQ,{className:n.E}),q("file.rename")]})}),!(0,o.qR)(D)&&(0,s.jsx)("li",{children:(0,s.jsxs)("a",{onClick:e=>{(0,x.LR)(e,D.origin_asset_id,D.owner_email===(null==T?void 0:T.email)?"high":"proxy",q,(0,o.Wv)(D)?"video":"photo",D.full_poster)},children:[(0,s.jsx)(d.aBF,{className:n.E}),q("file.download")]})}),!V&&(0,s.jsx)("li",{children:(0,s.jsxs)("a",{onClick:()=>{k(D)},children:[(0,s.jsx)(d.Xm5,{className:n.E}),null===Y?q("file.delete"):q("file.remove")]})})]});return(0,s.jsx)(m.Z,{id:D.origin_asset_id,type:(0,o.qR)(D)?"FOLDER":"FILE",children:"LIST"===v?(0,s.jsxs)("div",{"data-testid":"file_".concat(D.id),onClick:e=>{en(e,D)},onContextMenu:e=>{(0,W.Z)(e,U)},style:M,className:"group flex items-center pl-4 pr-1 my-[1px] select-none border border-transparent myRow cursor-pointer hover:bg-texto/20 ".concat(_%2==1?"bg-texto/5":"bg-texto/[.02]"," ").concat(ea?"selectedFile":"","  "),children:[Z.title&&(0,s.jsx)("div",{className:"flex-1 grow-[3]",style:{maxWidth:"".concat(X(Z),"%")},children:(0,s.jsxs)("div",{className:"flex items-center justify-start",children:[ea?(0,s.jsx)(S.Z,{className:"mr-4 flex-shrink-0"}):(0,s.jsx)(R.Z,{className:"mr-4 flex-shrink-0"}),(0,o.qR)(D)?(0,s.jsx)(A.Z,{className:"h-[48px] w-[88px] mr-2 min-w-[1.5rem] flex-shrink-0"}):(0,o.Wv)(D)?(0,s.jsx)(E.Z,{width:88,height:48,poster:D.isProcessing?"/assets/processing.svg":D.full_poster,filePath:er,title:D.isProcessing?"Processing file":"",className:"aspect-video rounded-lg mr-2"}):(0,s.jsx)(y.default,{width:88,height:48,src:D.full_poster,className:"aspect-video object-cover rounded-lg mr-2",alt:D.title}),(0,s.jsxs)("div",{className:"truncate",children:[(0,s.jsx)("div",{className:"truncate",title:D.title,children:D.title}),((0,o.Wv)(D)||(0,o.Ey)(D))&&(null==T?void 0:T.approved_producer)&&(0,s.jsxs)("div",{className:"flex",children:["private"===D.publishStatusReal?(0,s.jsx)(P.Z,{className:"w-4.5 h-4.5 flex-shrink-0",title:null!==(l=q("videos."+D.publishStatusReal))&&void 0!==l?l:""}):(0,s.jsx)(F.Z,{className:"w-4.5 h-4.5 flex-shrink-0 ".concat(D.publishStatusReal),title:null!==(i=q("videos."+D.publishStatusReal))&&void 0!==i?i:""}),(0,s.jsx)(O.sAB,{className:"w-4.5 h-4.5 mr-2 flex-shrink-0 opacity-75 ".concat("RIGHTS_MANAGED"===D.rightsManaged?"text-[#BF40BF]":"text-[#46BAFB]"),title:null!==(c=q("videos."+D.rightsManaged))&&void 0!==c?c:""})]})]})]})}),Z.id&&(0,s.jsx)("div",{className:"flex-1 grow-[1] text-center truncate",title:D.id,children:(0,o.qR)(D)?D.id:null!==(u=D.origin_asset_id)&&void 0!==u?u:D.id}),Z.owner&&(0,s.jsx)("div",{className:"flex-1 grow-[1] text-center truncate",title:D.owner_email,children:D.owner}),Z.created&&(0,s.jsx)("div",{className:"flex-1 grow-[1] text-center truncate",title:D.created,children:D.created}),Z.modified&&(0,s.jsx)("div",{className:"flex-1 grow-[1] text-center truncate",title:D.modified,children:D.modified}),Z.copyright&&(0,s.jsx)("div",{className:"flex-1 grow-[1] text-center truncate",title:(0,o.qR)(D)?"-":D.copyrightEmail,children:(0,o.qR)(D)?"-":D.copyrightName}),Z.talent&&(0,s.jsx)("div",{className:"flex-1 grow-[0.75] text-center",title:(0,o.qR)(D)?"-":D.statusTalent,children:(0,o.qR)(D)?"-":(0,s.jsx)(L.Z,{className:"mx-auto ".concat("Cleared"===D.statusTalent?"text-green-500":"Clearance Not Needed"===D.statusTalent?"text-yellow-500":"text-red-500"," ")})}),Z.property&&(0,s.jsx)("div",{className:"flex-1 grow-[0.75] text-center",title:(0,o.qR)(D)?"-":D.statusProperty,children:(0,o.qR)(D)?"-":(0,s.jsx)(L.Z,{className:"h-5 w-5 mx-auto ".concat("Cleared"===D.statusProperty?"text-green-500":"Clearance Not Needed"===D.statusProperty?"text-yellow-500":"text-red-500"," ")})}),Z.trademark&&(0,s.jsx)("div",{className:"flex-1 grow-[0.75] text-center",title:(0,o.qR)(D)?"-":D.statusTrademark,children:(0,o.qR)(D)?"-":(0,s.jsx)(L.Z,{className:"h-5 w-5 mx-auto ".concat("Cleared"===D.statusTrademark?"text-green-500":"Clearance Not Needed"===D.statusTrademark?"text-yellow-500":"text-red-500"," ")})}),Z.audio&&(0,s.jsx)("div",{className:"flex-1 grow-[0.75] text-center",title:(0,o.qR)(D)?"-":D.statusAudio,children:(0,o.qR)(D)?"-":(0,s.jsx)(L.Z,{className:"h-5 w-5 mx-auto ".concat("Cleared"===D.statusAudio?"text-green-500":"Clearance Not Needed"===D.statusAudio?"text-yellow-500":"text-red-500"," ")})}),(0,s.jsx)("div",{className:"flex-1 grow-[0.15] text-center flex items-center justify-end",children:(0,s.jsx)(n.Z,{position:"dropdown-left opacity-0 group-hover:opacity-100",children:eo.props.children})}),(0,s.jsx)(W.c,{contextMenuPositionX:$.x,contextMenuPositionY:$.y,pageX:$.pageX,pageY:$.pageY,show:$.show,setShow:U,children:eo.props.children})]}):(0,s.jsxs)("div",{className:"text-lg card box-border hover:shadow-xl hover:linear duration-200 group cursor-pointer ".concat((0,o.qR)(D)?"h-fit flex flex-col bg-white/10 rounded-t-[9px]":"h-fit"," ").concat(ea?"border-[5px] border-solid border-[#7B5FEB]":"border-[5px] border-solid border-fondo"),onClick:e=>{en(e,D)},children:[(0,s.jsx)("div",{className:"relative flex-grow",children:(0,o.qR)(D)?(0,s.jsx)("div",{className:"w-full flex items-center justify-center h-full aspect-video",children:(0,s.jsx)(d.$nz,{className:"w-24 h-24 text-gray-400 "})}):(0,o.Wv)(D)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(E.Z,{full:!0,width:480,height:270,poster:D.isProcessing?"/assets/processing.svg":D.full_poster,filePath:er,title:D.isProcessing?"Processing file":"",className:"aspect-video rounded-t-[9px]"}),(0,s.jsx)("div",{className:"badge badge-md badge-ghost absolute bottom-1 right-1",children:et})]}):(0,s.jsx)(y.default,{width:960,height:540,src:D.full_poster,className:"aspect-video object-cover rounded-t-[9px]",alt:D.title})}),(0,s.jsxs)("div",{className:"flex items-center justify-between px-2 sm:px-5 py-3 rounded-b-[9px] bg-backlogin",children:[(0,s.jsxs)("div",{className:"flex flex-col text-sm gap-2 hover:text-texto min-w-0 min-h-0",children:[(0,s.jsxs)("div",{className:"font-bold min-w-0 min-h-0 truncate",children:[D.id," - ",(0,o.qR)(D)?D.title:D.copyrightName]}),(0,s.jsxs)("div",{className:"text-xs min-w-0 min-h-0 truncate",children:[et," ",et.length>0&&"|"," ",(0,o.qR)(D)?"":null===(t=D.status)||void 0===t?void 0:t.toUpperCase()]})]}),(0,s.jsx)("div",{className:"w-5",children:(0,s.jsxs)(n.Z,{position:"dropdown-bottom ".concat(_%2!=1&&z?"":"dropdown-end"),children:[(0,s.jsx)("li",{children:(0,s.jsx)("a",{onClick:()=>{es(D)},children:(0,o.qR)(D)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Z1Y,{className:n.E})," ",q("file.enter")]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.ffH,{className:n.E}),q("file.edit")]})})}),(0,s.jsx)("li",{children:(0,s.jsxs)("a",{onClick:()=>{el(D)},children:[(0,s.jsx)(d.Lrt,{className:n.E}),q("file.share")]})}),!V&&!(0,o.qR)(D)&&(0,s.jsx)("li",{children:(0,s.jsxs)("a",{onClick:()=>{es(D)},children:[(0,s.jsx)(d.tvD,{className:n.E}),q("file.edit_metadata")]})}),!V&&(0,s.jsx)("li",{children:(0,s.jsxs)("a",{onClick:()=>{(0,o.qR)(D)?Q(D.title,D.id,Y,J):b(D.title,Number(D.id),(0,o.Wv)(D)?"video":"photo")},children:[(0,s.jsx)(d.fmQ,{className:n.E}),q("file.rename")]})}),!(0,o.qR)(D)&&(0,s.jsx)("li",{children:(0,s.jsxs)("a",{onClick:e=>{(0,x.LR)(e,D.origin_asset_id,D.owner_email===(null==T?void 0:T.email)?"high":"proxy",q,(0,o.Wv)(D)?"video":"photo",D.full_poster)},children:[(0,s.jsx)(d.aBF,{className:n.E}),q("file.download")]})}),!V&&(0,s.jsx)("li",{children:(0,s.jsxs)("a",{onClick:()=>{k(D)},children:[(0,s.jsx)(d.Xm5,{className:n.E}),null===Y?q("file.delete"):q("file.remove")]})})]})})]})]},D.id)})};function K(e){var t;let{files:r,moveForward:l,visualization:i="LIST",columns:m}=e,[y,N,E,C]=(0,a.vc)(e=>[e.sortKey,e.setSortKey,e.sortDirection,e.setSortDirection]),{isLoadingFolders:M,invalidateProjecFoldersQuery:Z}=(0,g.Be)(),[P,F]=(0,j.useState)(!1),[A,L]=(0,j.useState)(null),K=(0,a.RF)(e=>e.setLoading),[z]=(0,a.VW)(e=>[e.setModalFolderOpen]),[H]=(0,a.U7)(e=>[e.setModalAssetOpen]),$=(0,a.It)(e=>e.activeProject),[U]=(0,a.k5)(e=>[e.isLoadingFiles]),{t:Q}=(0,w.$)("myarchive"),{invalidatAllFilesQuery:G}=(0,g.pX)(),[J]=(0,a.k5)(e=>[e.setShouldUpdateFileList]),[ee]=(0,a.RM)(e=>[e.setIsModalFileOpen]),et=(0,h.ac)(h.Am),[er,el,ei,es]=(0,a.Bd)(e=>[e.toggleSelectedAll,e.removeSelected,e.isAllSelected,e.selected]),[en,ea]=(0,j.useState)({x:0,y:0,pageX:0,pageY:0,show:!1}),eo=(0,a.n8)(e=>e.breadcrumbs),ec=eo.length>0?(0,x.NV)(eo[eo.length-1].id):null,ed=(0,j.useCallback)(e=>void 0!==es[e],[es]),eu=Object.keys(es).length>0,[eh]=(0,c.u)(),em=e=>{let{repeat:t,metaKey:r,ctrlKey:l,key:i}=e;!t&&(r||l)&&"a"===i&&(e.preventDefault(),er())};(0,j.useEffect)(()=>(document.addEventListener("keydown",em),()=>{document.removeEventListener("keydown",em)}));let ex=async()=>{if(F(!1),A){K(!0);try{await (0,v.kw)(A.id,$,(0,o.qR)(A)),Z(),J(A.id),G(),el(A.id),f.toast.success((0,o.qR)(A)?Q("file.deleted_folder"):Q("file.deleted"))}catch(e){console.log(e),f.toast.error(Q("file.error_deleting"))}K(!1)}},ef=e=>{L(e),F(!0)},ev=e=>{e===y?C("ASC"===E?"DESC":"ASC"):(N(e),C("ASC"))},eg=e=>{e.stopPropagation(),er()},ep=(0,j.useCallback)(e=>{let{data:t,index:r,style:n}=e;return(0,s.jsx)(V,{i:r,style:n,data:t,visualization:i,isSelected:ed,moveForward:l,setModalAssetOpen:H,askDelete:ef,columns:m})},[i,ed,l,H,m]),ej=et?2:4,ew=(0,j.useCallback)(e=>{let{data:t,index:r,style:n}=e;return(0,s.jsx)("div",{className:"flex gap-2",style:n,children:t[r].map((e,n)=>(0,s.jsx)("div",{className:"flex-shrink-0",style:{width:4===ej?"24%":"48%"},children:(0,s.jsx)(V,{i:n,style:{},data:t[r],visualization:i,isSelected:ed,moveForward:l,setModalAssetOpen:H,askDelete:ef,columns:m})},n))})},[i,ed,l,H,ej,m]),ey=(0,j.useRef)(null);(0,j.useEffect)(()=>{var e,t,r;let l=JSON.parse(null!==(e=sessionStorage.getItem(I))&&void 0!==e?e:"{}"),i=null!==(t=null==$?void 0:$.toString())&&void 0!==t?t:"my_archive";ey.current&&l[i]&&(null===(r=ey.current)||void 0===r||r.scrollTo(l[i].top))},[$,ey.current]);let eN=(0,j.useMemo)(()=>[...r].sort((e,t)=>{if((0,o.qR)(e)&&!(0,o.qR)(t))return -1;if(!(0,o.qR)(e)&&(0,o.qR)(t))return 1;let r="ASC"===E?1:-1;if("title"===y)return r*e.title.localeCompare(t.title);if("id"===y)return r*(Number(e.origin_asset_id)-Number(t.origin_asset_id));if("owner"===y)return r*e.owner.localeCompare(t.owner);if("modified"===y)return void 0===e.modified_raw||void 0===t.modified_raw?0:r*e.modified_raw.localeCompare(t.modified_raw);if("created"===y){var l;return r*(null===(l=e.created_raw)||void 0===l?void 0:l.localeCompare(t.created_raw))}if("talent"===y)return((0,o.Wv)(e)||(0,o.Ey)(e))&&((0,o.Wv)(t)||(0,o.Ey)(t))?r*e.statusTalent.localeCompare(t.statusTalent):0;if("property"===y)return((0,o.Wv)(e)||(0,o.Ey)(e))&&((0,o.Wv)(t)||(0,o.Ey)(t))?r*e.statusProperty.localeCompare(t.statusProperty):0;else if("trademark"===y)return((0,o.Wv)(e)||(0,o.Ey)(e))&&((0,o.Wv)(t)||(0,o.Ey)(t))?r*e.statusTrademark.localeCompare(t.statusTrademark):0;else if("audio"===y)return((0,o.Wv)(e)||(0,o.Ey)(e))&&((0,o.Wv)(t)||(0,o.Ey)(t))?r*e.statusAudio.localeCompare(t.statusAudio):0;else if("copyright"!==y)return 0;else return((0,o.Wv)(e)||(0,o.Ey)(e))&&((0,o.Wv)(t)||(0,o.Ey)(t))?r*e.copyrightName.localeCompare(t.copyrightName):0}),[r,y,E]);eN.length>0&&null!==eN[eN.length-1]&&eN.push(null);let eb=U||M,ek=0===eN.length&&!eb,e_=(0,j.useMemo)(()=>{if("LIST"===i)return[];let e=[];for(let t=0;t<eN.length;t+=ej)e.push(eN.slice(t,t+ej));return e},[eN,i,ej]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(_.E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"flex flex-col overflow-hidden h-full rounded-lg",children:[(0,s.jsxs)("div",{className:"".concat(ek?"h-full":U?"":"bg-texto/5"),children:[!ek&&!eb&&"LIST"===i&&(0,s.jsxs)("div",{className:"text-base font-normal text-center flex py-2 pl-4 pr-1",children:[m.title&&(0,s.jsxs)("div",{style:{maxWidth:"".concat(X(m),"%")},className:"grow-[3] flex-1 flex justify-start items-center cursor-pointer ".concat("title"===y?"text-texto":"text-texto/50 hover:text-texto"),onClick:()=>{ev("title")},title:null!==(t=Q("row.title"))&&void 0!==t?t:"",children:[ei?(0,s.jsx)(S.Z,{className:"mr-4 flex-shrink-0 cursor-pointer",onClick:eg}):eu?(0,s.jsx)(D,{className:"mr-4 flex-shrink-0 cursor-pointer",onClick:eg}):(0,s.jsx)(R.Z,{className:"mr-4 flex-shrink-0 cursor-pointer",onClick:eg}),Q("row.title")," ","title"===y&&("ASC"===E?(0,s.jsx)(O.kWQ,{className:"h-5 w-5 ml-2"}):(0,s.jsx)(O.ALZ,{className:"h-5 w-5 ml-2"}))]}),m.id&&(0,s.jsx)(Y,{className:"grow-[1]",sortKey:y,sortDirection:E,setSort:ev,mykey:"id"}),m.owner&&(0,s.jsx)(Y,{className:"grow-[1]",sortKey:y,sortDirection:E,setSort:ev,mykey:"owner"}),m.created&&(0,s.jsx)(Y,{className:"grow-[1]",sortKey:y,sortDirection:E,setSort:ev,mykey:"created",trans:"_uploaded"}),m.modified&&(0,s.jsx)(Y,{className:"grow-[1]",sortKey:y,sortDirection:E,setSort:ev,mykey:"modified"}),m.copyright&&(0,s.jsx)(Y,{className:"grow-[1]",sortKey:y,sortDirection:E,setSort:ev,mykey:"copyright"}),m.talent&&(0,s.jsx)(Y,{className:"grow-[0.75]",sortKey:y,sortDirection:E,setSort:ev,mykey:"talent"}),m.property&&(0,s.jsx)(Y,{className:"grow-[0.75]",sortKey:y,sortDirection:E,setSort:ev,mykey:"property"}),m.trademark&&(0,s.jsx)(Y,{className:"grow-[0.75]",sortKey:y,sortDirection:E,setSort:ev,mykey:"trademark"}),m.audio&&(0,s.jsx)(Y,{className:"grow-[0.75]",sortKey:y,sortDirection:E,setSort:ev,mykey:"audio"}),(0,s.jsx)("div",{className:"flex-1 grow-[0.15]"})]}),eb&&(0,s.jsxs)("div",{className:"flex items-center justify-center font-extralight text-xl my-12 opacity-50 gap-3",children:[(0,s.jsx)("div",{className:"w-5 h-5 rounded-full animate-spin border-2 border-solid border-gray-400 border-t-transparent"}),Q("file.loading")]}),ek&&(0,s.jsxs)("div",{className:"flex flex-col justify-center items-center h-full",children:[(0,s.jsxs)("div",{className:"flex flex-col justify-center items-center mb-8 font-light",children:[(0,s.jsx)(u.IRQ,{className:"w-10 h-10 mb-2"}),(0,s.jsx)("div",{children:Q("file.empty_in_here")}),(0,s.jsx)("div",{className:"opacity-40",children:Q("file.empty_folder")})]}),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(q.Z,{tabIndex:0,className:"w-56",onClick:()=>{ee(!0)},children:Q("file.upload_file")})})]})]}),(0,s.jsxs)("div",{ref:eh,className:"flex-1 w-full ".concat(ek?"":"h-full"," relative"),onContextMenu:e=>{(0,W.Z)(e,ea)},children:[!eb&&!ek&&("LIST"===i?(0,s.jsx)(k.ZP,{children:e=>{let{height:t,width:r}=e;return(0,s.jsx)(b.t7,{ref:ey,height:t,width:r,itemCount:eN.length,itemSize:72,itemData:eN,onScroll:e=>{var t,r,l;r=null!==(t=null==$?void 0:$.toString())&&void 0!==t?t:"my_archive",l=e.scrollOffset,B[r]={top:l},clearTimeout(T),T=setTimeout(()=>{console.log("RESTORING save",B),sessionStorage.setItem(I,JSON.stringify(B))},500)},children:ep})}}):(0,s.jsx)(k.ZP,{children:e=>{let{height:t,width:r}=e,l=Math.round(9/16*((r-7*(ej-1))/ej-10)+70+10+10);return(0,s.jsx)(b.t7,{height:t,width:r,itemCount:e_.length,itemSize:l,itemData:e_,children:e=>{let{index:t,style:r,data:l}=e;return(0,s.jsx)(ew,{index:t,style:r,data:l})}})}})),(0,s.jsxs)(W.c,{contextMenuPositionX:en.x,contextMenuPositionY:en.y,pageX:en.pageX,pageY:en.pageY,show:en.show,setShow:ea,children:[(0,s.jsx)("li",{children:(0,s.jsxs)("a",{"data-testid":"menu_new_file",onClick:()=>{ee(!0)},children:[(0,s.jsx)(d.pPO,{className:n.E}),Q("file.file_upload")]})}),(0,s.jsx)("li",{children:(0,s.jsxs)("a",{"data-testid":"menu_new_folder",onClick:()=>{z("",null,$,ec)},children:[(0,s.jsx)(d.$nz,{className:n.E}),Q("file.new_folder")," "]})})]})]})]},"key5"),(0,s.jsx)(p.Z,{isModalOpen:P,setIsModalOpen:F,action:()=>{ex()},children:(0,s.jsxs)("p",{children:[null===$?Q("file.sure_delete"):Q("file.sure_remove")," ",(0,s.jsx)("i",{children:null==A?void 0:A.title}),"?"]})})]})}}}]);