1 line
31 KiB
JavaScript
1 line
31 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5256],{5001:(e,l,a)=>{a.d(l,{A:()=>r});var t=a(4848);a(6540);var i=a(5165),o=a(1915),n=a(5737);let d=(0,n.A)("Files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),s=(0,n.A)("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);function r(e){let{user:l}=e;return(0,t.jsx)(i.Ay,{title:"choose-media-type-popoup",noContainer:!0,wrapperClasses:"items-center",wrapperStyle:{alignItems:"center"},children:(0,t.jsxs)("div",{className:"paper items-center max-w-2xl m-auto z-50 p-4 xl:p-10",children:[(0,t.jsxs)("h4",{className:"m-0 text-center text-lg leading-tight",children:["What kind of Media do you",(0,t.jsx)("br",{}),"want to upload?"]}),(0,t.jsx)("span",{children:"Please Select the media type to upload."}),(0,t.jsxs)("div",{className:"w-full grid grid-cols-1 lg:grid-cols-2 gap-6 items-stretch",children:[(0,t.jsxs)("div",{className:"card cursor-pointer",onClick:e=>{var a;if(null==l?void 0:null===(a=l.verification_status)||void 0===a?void 0:a.toString().match(/1/)){let e=document.getElementById("upload_image_input");null==e||e.click()}else alert("Please Verify to Add Media");setTimeout(()=>{(0,i.fs)()},500)},children:[(0,t.jsx)(o.A,{size:50,className:"text-primary"}),(0,t.jsxs)("div",{className:"content",children:[(0,t.jsx)("span",{className:"title",children:"Images"}),(0,t.jsx)("span",{className:"text-sm",children:"General image formats like JPEG, PNG, SVG, WEBP, etc."})]})]}),(0,t.jsxs)("div",{className:"card cursor-pointer",onClick:e=>{var a,t;(null==l?void 0:null===(a=l.verification_status)||void 0===a?void 0:a.toString().match(/1/))?null===(t=document.getElementById("upload_file_input"))||void 0===t||t.click():alert("Please Verify to Add Media"),(0,i.fs)()},children:[(0,t.jsx)(d,{size:50,className:"text-secondary"}),(0,t.jsxs)("div",{className:"content",children:[(0,t.jsx)("span",{className:"title",children:"Files"}),(0,t.jsx)("span",{className:"text-sm",children:"Other documents type. Like PDF, XLSX, CSV, etc."})]})]})]}),(0,t.jsx)("div",{className:"w-full grid grid-cols-1 lg:grid-cols-2 gap-6 items-stretch",children:(0,t.jsxs)("div",{className:"card cursor-pointer",onClick:e=>{var a,t;(null==l?void 0:null===(a=l.verification_status)||void 0===a?void 0:a.toString().match(/1/))?null===(t=document.getElementById("upload_video_input"))||void 0===t||t.click():alert("Please Verify to Add Media"),(0,i.fs)()},children:[(0,t.jsx)(s,{size:55,className:"text-slate-600"}),(0,t.jsxs)("div",{className:"content",children:[(0,t.jsx)("span",{className:"title",children:"Videos"}),(0,t.jsxs)("span",{className:"text-sm",children:["Video Files. ",(0,t.jsx)("b",{children:"MP4"})," for now. These files can be streamed. Max 200mb"]})]})]})})]})})}},7651:(e,l,a)=>{a.d(l,{A:()=>N});var t=a(4848),i=a(6540),o=a(3698),n=a(620),d=a(5737);let s=(0,d.A)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var r=a(6897);function c(e){let{folderName:l,folder:a,user:d}=e,c="".concat(a?a+"/":"").concat(l),[u,m]=i.useState(!1);return(0,t.jsxs)("a",{href:"/admin/".concat(null==d?void 0:d.id,"/media/").concat(c),className:"card col items-center justify-center",onClick:e=>{if(e.target.closest("button"))return e.preventDefault()},children:[u&&(0,t.jsx)(n.A,{}),(0,t.jsx)(s,{opacity:.5}),(0,t.jsx)("span",{className:"absolute top-4 left-4 text-xs bg-slate-200 dark:bg-slate-700 px-2 py-0.5 rounded-full",children:"Folder"}),(0,t.jsx)("span",{className:"",children:l}),(0,t.jsx)("button",{className:"plain-text absolute top-2 right-2",onClick:e=>{window.confirm("Delete this Folder and all its contents?")&&(m(!0),window.confirm("NOTE: this folder and all its contents will be permanently lost. Continue?")?(0,o.A)("/api/deleteMediaFolder",{method:"post",body:{folder:c}},!0).then(e=>{e.success&&window.location.reload()}):m(!1))},children:(0,t.jsx)(r.A,{})})]},l)}var u=a(5165),m=a(557),h=a(9084);function p(e){var l,a;let{mediaObject:n,staticHost:d}=e,s=n.media_thumbnail_path?(null==n?void 0:n.private)?n.media_thumbnail_url:"".concat(d).concat(n.media_thumbnail_path):n.media_thumbnail_url,r=n.media_path?(null==n?void 0:n.private)?n.media_url:"".concat(d).concat(n.media_path):n.media_url;return(0,t.jsx)(i.Fragment,{children:(null===(l=n.media_type)||void 0===l?void 0:l.match(/file/i))?(0,t.jsx)("div",{className:"cursor-pointer hover:opacity-80",children:(0,t.jsx)("span",{className:"info w-auto small gray absolute top-4 right-4",children:n.media_type.replace(/.*\//,"").toUpperCase()})}):(null===(a=n.media_type)||void 0===a?void 0:a.match(/video/i))?(0,t.jsx)("video",{src:r,className:"w-full h-60 object-cover",controls:!0,muted:!0,autoPlay:!0,loop:!0}):(0,t.jsx)("img",{src:s,alt:n.media_name,className:"w-full h-60 object-cover bg-slate-200 rounded",onError:e=>{null!=n&&n.private||(0,o.A)("/api/purgeDb",{method:"post",body:{paradigm:"user_media",payload:n}},!0).then(e=>{e.success?window.location.reload():(console.log(e),console.log(s),console.log(r))})}})})}var v=a(8183);function f(e){var l;let{mediaObject:a,staticHost:o}=e;return(a.media_thumbnail_path?"".concat(o,"/").concat(a.media_thumbnail_path):a.media_thumbnail_url,a.media_path?"".concat(o,"/").concat(a.media_path):a.media_url,null==a?void 0:a.private)?(0,t.jsx)(i.Fragment,{}):(0,t.jsxs)("div",{className:"dropdown-wrapper w-full xl:w-auto",children:[(0,t.jsx)("button",{className:"outlined secondary small-text w-full hidden xl:flex bg-secondary/10",children:"Copy Link"}),(0,t.jsx)("div",{className:"dropdown mobile-transform gap-2 w-full",children:(0,t.jsxs)(m.A,{column:!0,className:"w-full mb-2 xl:mb-0",children:[(0,t.jsx)("button",{className:"gray outlined normal-weight more-padding",onClick:e=>{navigator.clipboard.writeText(a.media_url||"").then(()=>{alert("Media url ".concat(a.media_url," Copied to clipboard"))})},children:"Copy Full Link"}),!(null==a?void 0:null===(l=a.media_type)||void 0===l?void 0:l.match(/file|video/i))&&(0,t.jsx)("button",{className:"gray outlined normal-weight more-padding",onClick:e=>{navigator.clipboard.writeText(a.media_thumbnail_url||"").then(()=>{alert("Media url ".concat(a.media_thumbnail_url," Copied to clipboard"))})},children:"Copy Thumbnail Link"})]})})]})}var x=a(6446);let g=(0,d.A)("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);function y(e){var l;let{mediaObject:a,setLoading:n}=e,[d,s]=i.useState(!1);return(null==a?void 0:null===(l=a.media_type)||void 0===l?void 0:l.match(/video/i))?null:(0,t.jsx)("button",{className:"light-gray p-2 w-8 h-8 rounded-full absolute top-4 left-4 bg-white"+((null==a?void 0:a.private)?" ":" text-slate-400 fill-slate-400"),style:{backgroundColor:"white"},onClick:e=>{let l=a.private?"This media is private: Make it public?":"Make this media Private?";window.confirm(l)&&(n(!0),(0,o.A)("/api/media/addPrivateMedia",{method:"post",body:{...a}},!0).then(e=>{e.success?window.location.reload():window.alert("Action Failed!"),setTimeout(()=>{n(!1)},1e3)}).catch(e=>{console.log(e)}))},children:(null==a?void 0:a.private)?(0,t.jsx)(x.A,{size:20,color:"green"}):(0,t.jsx)(g,{color:"black",size:20})})}var w=a(993);function b(e){let{mediaObject:l,setTargetMedia:a,folder:o,staticHost:d}=e,[s,r]=i.useState(null!=l&&!!l.private),[c,x]=i.useState(l);i.useEffect(()=>{var e;(null==l?void 0:l.private)&&l.media_thumbnail_url&&!(null===(e=c.media_type)||void 0===e?void 0:e.match(/file/i))?(0,w.A)({url:l.media_thumbnail_url}).then(e=>{x({...l,media_thumbnail_url:e}),r(!1)}).catch(e=>{console.log(e.message)}):s&&r(!1)},[]),c.media_thumbnail_path?"".concat(d,"/").concat(c.media_thumbnail_path):c.media_thumbnail_url;let g=c.media_path?"".concat(d,"/").concat(c.media_path):c.media_url;return(0,t.jsxs)("div",{className:"media-card card col min-h-[200px]",onClick:e=>{var l,t;if(!(e.target.closest("button")||e.target.closest(".button"))){if((null===(l=c.media_type)||void 0===l?void 0:l.match(/file/i))&&!c.private){window.open(g,"__blank");return}if((null===(t=c.media_type)||void 0===t?void 0:t.match(/file/i))&&c.private)return;a(c),(0,u.PB)("target-media-popup")}},onMouseEnter:e=>{e.target.closest(".media-card").style.zIndex="10"},onMouseLeave:e=>{e.target.closest(".media-card").style.zIndex="0"},style:(null==c?void 0:c.private)?{outline:"5px solid var(--sec-color-light)",borderColor:"var(--sec-color-lighter)"}:{},children:[s&&(0,t.jsx)(n.A,{}),(0,t.jsx)(p,{mediaObject:c,staticHost:d}),(0,t.jsxs)("div",{className:"flex-col items-center xl:items-start flex-wrap w-full mt-auto",children:[(0,t.jsx)("span",{className:"w-full",style:{wordBreak:"break-all"},children:c.media_name}),(0,t.jsx)("div",{className:"flex-wrap w-full",children:(0,t.jsxs)(m.A,{className:"flex-wrap w-full items-stretch",children:[(0,t.jsx)("button",{className:"secondary small-text relative w-full xl:w-auto mb-2 xl:mb-0",onClick:e=>{var l;(0,h.A)({mediaObject:c,fileName:(null==g?void 0:null===(l=g.match(/[^\/]+$/))||void 0===l?void 0:l[0])||"",setLoading:r})},children:(0,t.jsx)("span",{children:"Download"})}),(0,t.jsx)(f,{mediaObject:c,staticHost:d}),(0,t.jsx)(v.A,{mediaObject:c,setLoading:r})]})})]}),(0,t.jsx)(y,{mediaObject:c,setLoading:r})]})}let j=(0,d.A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function N(e){let{media:l,setTargetMedia:a,folders:o,folder:n,staticHost:d,user:s}=e;return(0,t.jsx)(i.Fragment,{children:(0,t.jsxs)("section",{className:"paper overflow-visible",children:[(0,t.jsx)("h2",{className:"text-xl m-0",children:"Media List"}),(0,t.jsxs)("div",{className:"w-full gap-4 grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 items-stretch",children:[o&&o[0]&&o.map(e=>(0,t.jsx)(c,{folder:n,folderName:e,user:s},e)),l&&l[0]&&l.map(e=>(0,t.jsx)(b,{mediaObject:e,setTargetMedia:a,folder:n,staticHost:d},e.id))]}),!(null==l?void 0:l[0])&&(0,t.jsx)(k,{})]})})}function k(){return(0,t.jsxs)("div",{className:"button outlined gray dashed w-full p-10 flex-col",onClick:e=>{(0,u.PB)("choose-media-type-popoup")},children:[(0,t.jsx)("span",{className:"text-slate-400",children:"No Media Added."}),(0,t.jsx)(j,{}),(0,t.jsx)("span",{className:"",children:"Add Media"})]})}},5531:(e,l,a)=>{let t;a.d(l,{A:()=>r});var i=a(4848),o=a(6540),n=a(3698),d=a(5165),s=a(620);function r(e){let{folder:l}=e,[a,r]=o.useState(!1),[c,u]=o.useState(!1);return(0,i.jsxs)(d.Ay,{title:"add-folder-popoup",children:[(0,i.jsx)("h4",{className:"m-0",children:"Add A New Folder"}),(0,i.jsxs)("div",{className:"flex-col w-full relative",children:[a&&(0,i.jsx)(s.A,{}),(0,i.jsxs)("form",{onSubmit:e=>{e.preventDefault(),window.clearTimeout(t),r(!0);let a=e.target;(0,n.A)("/api/addNewMediaFolder",{method:"post",body:{name:(l?"".concat(l,"/"):"")+a["new-folder-name"].value}},!0).then(e=>{e.success?window.location.reload():r(!1)})},className:"w-full flex flex-col items-stretch gap-2",children:[c&&(0,i.jsx)("span",{className:"text-xs text-orange-700 bg-orange-100 flex items-center justify-center rounded px-2 py-1",children:"Folder Already Exists. Please Change the name."}),(0,i.jsx)("input",{type:"text",name:"new-folder-name",id:"new-folder-name",placeholder:"New Folder Name",className:"w-full"+(c?" warning":""),onChange:e=>{e.target.value=e.target.value.toLocaleLowerCase().replace(/ /g,"-"),window.clearTimeout(t),t=setTimeout(()=>{(0,n.A)("/api/checkExistingFolder?name=".concat(e.target.value).concat(l?"&folder="+l:"")).then(l=>{var a;(null===(a=e.target.value)||void 0===a?void 0:a.match(/./))&&(null==l?void 0:l.success)?(u(!0),alert("Folder Already Exists")):u(!1)})},500)}}),(0,i.jsx)("button",{children:"Add New Folder"})]})]})]})}},6093:(e,l,a)=>{a.d(l,{A:()=>v});var t=a(4848),i=a(6540),o=a(3698),n=a(7531),d=a(5165),s=a(620),r=a(6446);let c=(0,a(5737).A)("LockKeyholeOpen",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}],["path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5",key:"car5b7"}]]);function u(e){let{mediaObject:l}=e,[a,o]=i.useState(!1);return i.useEffect(()=>{l.private=a},[a]),(0,t.jsx)("button",{className:"light-gray p-2 w-8 h-8 rounded-full absolute top-2 left-2 bg-white"+(a?" ":" text-slate-400 fill-slate-400"),style:{backgroundColor:"white"},onClick:e=>{o(e=>!e)},children:a?(0,t.jsx)(r.A,{}):(0,t.jsx)(c,{})})}var m=a(6897);function h(e){let{imageObject:l,newMedia:a,setNewMedia:i,video:o}=e,n=l.imageBase64Full||l.fileBase64Full,d=l.imageName||l.fileName;return(0,t.jsxs)("div",{className:"border border-slate-300 rounded max-h-44 flex-col w-full overflow-hidden h-full bg-slate-200 relative p-2",children:[o?(0,t.jsx)("video",{src:n,className:"w-full h-full object-contain",muted:!0,autoPlay:!0,controls:!0}):(0,t.jsx)("img",{src:n,alt:d,className:"w-full h-full object-contain"}),(0,t.jsx)("input",{type:"text",defaultValue:d,onInput:e=>{var a;let t=null===(a=e.target.value)||void 0===a?void 0:a.replace(/ /g,"-");l.fileName&&(l.fileName=t),l.imageName&&(l.imageName=t)},className:"absolute bottom-1 text-sm left-2 px-2 py-1",style:{width:"calc(100% - 15px)"}}),(0,t.jsx)("button",{className:"outlined bg-white absolute top-2 right-2 p-1 w-8 h-8 rounded-full",style:{backgroundColor:"white",borderColor:"var(--slate-200)"},onClick:e=>{let t=a.findIndex(e=>e.imageBase64===l.imageBase64||e.fileBase64===l.fileBase64);a.splice(t,1),i([...a])},children:(0,t.jsx)(m.A,{size:16})}),!o&&(0,t.jsx)(u,{mediaObject:l})]})}function p(e){let{fileObject:l,newFile:a,setNewFile:i}=e;return(0,t.jsxs)("div",{className:"border border-slate-300 rounded min-h-[100px] flex-col w-full overflow-hidden h-full bg-slate-200 relative p-2",children:[(0,t.jsx)("input",{type:"text",defaultValue:l.fileName,onInput:e=>{var a;l.fileName=null===(a=e.target.value)||void 0===a?void 0:a.replace(/ /g,"-")},className:"absolute bottom-1 text-sm left-2 px-2 py-1",style:{width:"calc(100% - 15px)"}}),(0,t.jsx)("button",{className:"outlined bg-white absolute top-2 right-2 p-1 w-8 h-8 rounded-full",style:{backgroundColor:"white",borderColor:"var(--slate-200)"},onClick:e=>{let t=a.findIndex(e=>e.fileBase64===l.fileBase64);a.splice(t,1),i([...a])},children:(0,t.jsx)(m.A,{size:16})}),(0,t.jsx)(u,{mediaObject:l})]})}function v(e){let{newMedia:l,setNewMedia:a,newFile:r,setNewFile:c,newVideo:u,setNewVideo:m,folder:v}=e,f=(null==l?void 0:l[0])?"images":(null==r?void 0:r[0])?"files":"videos",x=(null==f?void 0:f.match(/image/i))?l:(null==f?void 0:f.match(/file/i))?r:u,g=(null==f?void 0:f.match(/image/i))?a:(null==f?void 0:f.match(/file/i))?c:m,[y,w]=i.useState(!1);return i.useEffect(()=>{x&&x[0]&&(0,d.PB)("new-media-popup")},[l,r,u]),(0,t.jsxs)(d.Ay,{title:"new-media-popup",closePopupDispatch:()=>{a(null),c(null),m(null)},children:[y&&(0,t.jsx)(s.A,{screen:!0}),(0,t.jsx)("h4",{className:"m-0",children:"Upload New Media"}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-4 w-full",children:x&&x[0]&&x.map((e,l)=>(null==f?void 0:f.match(/image/i))?(0,t.jsx)(h,{imageObject:e,newMedia:x,setNewMedia:g},l+1):(null==f?void 0:f.match(/video/i))?(0,t.jsx)(h,{imageObject:e,newMedia:x,setNewMedia:g,video:!0},l+1):(0,t.jsx)(p,{fileObject:e,newFile:x,setNewFile:g},l+1))}),x&&x[0]&&(0,t.jsx)("button",{className:"py-3 w-full relative z-50"+(y?" pointer-events-none opacity-40":""),onClick:e=>{w(!0);let l=(null==f?void 0:f.match(/image/i))?{type:f,folder:v,media:x.map(e=>({imageBase64:e.imageBase64,imageName:e.imageName,imageSize:e.imageSize,private:e.private}))}:{type:f,folder:v,media:x.map(e=>({fileBase64:e.fileBase64,fileName:e.fileName,fileSize:e.fileSize,fileType:e.fileType,private:e.private,video:!!(null==f?void 0:f.match(/video/i))}))};(0,o.A)("/api/addUserMedia",{method:"post",body:l},!0).then(e=>{e.success?(0,n.A)().then(()=>{window.location.reload()}):(alert("Image Upload Failed"),console.log(e),setTimeout(()=>{w(!1)},1e3))})},children:"Upload Media"})]})}},4003:(e,l,a)=>{a.d(l,{A:()=>v});var t=a(4848),i=a(6540),o=a(3698),n=a(7531),d=a(5165),s=a(620),r=a(557),c=a(9084),u=a(993);let m=(0,a(5737).A)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var h=a(8453),p=a(8183);function v(e){var l,a;let{targetMedia:v,staticHost:f,setTargetMedia:x,media:g}=e;(null==v?void 0:v.media_thumbnail_path)?"".concat(f,"/").concat(null==v?void 0:v.media_thumbnail_path):null==v||v.media_thumbnail_url;let y=(null==v?void 0:v.media_path)?"".concat(f,"/").concat(null==v?void 0:v.media_path):null==v?void 0:v.media_url,w=!!(null==v?void 0:null===(l=v.media_type)||void 0===l?void 0:l.match(/video/i)),b=v?g.findIndex(e=>e.id==v.id):null,j="number"==typeof b&&b>=0,N=(()=>{var e;if(!j)return null;let l=g[b+1];return l?(null==l?void 0:null===(e=l.media_type)||void 0===e?void 0:e.match(/image/i))?l:g.slice(b+1).find(e=>{var l;return null!==(l=e.media_type)&&void 0!==l&&!!l.match(/image/i)})||null:null})(),k=(()=>{var e;if(!j)return null;let l=g[b-1];return l?(null==l?void 0:null===(e=l.media_type)||void 0===e?void 0:e.match(/image/i))?l:g.slice(0,b-1).findLast(e=>{var l;return null!==(l=e.media_type)&&void 0!==l&&!!l.match(/image/i)})||null:null})(),[A,_]=i.useState(null!=v&&!!v.private),[C,M]=i.useState(!1),[L,F]=i.useState(y),R=i.useRef();return i.useEffect(()=>{(null==v?void 0:v.private)?(0,u.A)({url:v.media_url||""}).then(e=>{e&&(F(e),_(!1))}).catch(e=>{console.log(e.message)}):F((null==v?void 0:v.media_url)||"")},[v]),(0,t.jsxs)(d.Ay,{title:"target-media-popup",noContainer:!0,fullPage:!0,closePopupDispatch:()=>{M(!1),x(null)},children:[A&&(0,t.jsx)(s.A,{}),!C&&(0,t.jsx)(s.A,{}),v&&(0,t.jsxs)(i.Fragment,{children:[(0,t.jsxs)("div",{className:"self-center h-screen py-4",children:[L?w?(0,t.jsx)("video",{src:L,className:"w-full h-full object-cover",controls:!0,muted:!0,autoPlay:!0,loop:!0,onCanPlay:()=>{M(!0)},style:C?void 0:{display:"none"}}):(0,t.jsx)("img",{src:L,alt:v.media_name,className:"bg-slate-200 rounded w-full h-full object-contain",ref:R,onLoad:e=>{M(!0)},style:C?void 0:{display:"none"}}):(0,t.jsx)(t.Fragment,{}),k&&(0,t.jsx)("div",{className:"absolute left-5 md:left-10 z-[100] cursor-pointer p-5 bg-slate-800/40 rounded-full",onClick:e=>{x(null),x(k)},children:(0,t.jsx)(m,{color:"white"})}),N&&(0,t.jsx)("div",{className:"absolute right-5 md:right-10 z-[100] cursor-pointer p-5 bg-slate-800/40 rounded-full",onClick:e=>{x(null),x(N)},children:(0,t.jsx)(h.A,{color:"white"})})]}),(0,t.jsx)("span",{className:"info gray absolute top-5 left-5 w-auto mr-5",style:{backgroundColor:"white"},children:null===(a=v.media_path)||void 0===a?void 0:a.replace(/.*\//,"")}),(0,t.jsx)("div",{className:"absolute bottom-6 left-6 p-1 bg-white dark:bg-slate-900 rounded z-20 hidden lg:flex flex-col items-stretch min-w-[200px]",children:(0,t.jsxs)(r.A,{column:!0,children:[(0,t.jsx)(p.F,{mediaObject:v,setLoading:_}),(0,t.jsx)("button",{className:"outlined secondary more-padding",onClick:e=>{var l,a;(0,c.A)({mediaObject:v,fileName:(null===(a=v.media_url)||void 0===a?void 0:null===(l=a.match(/[^\/]+$/))||void 0===l?void 0:l[0])||"",setLoading:_})},children:"Download"}),(0,t.jsx)("button",{onClick:e=>{window.confirm("Delete this media?")&&(0,o.A)("/api/deleteUserMedia",{method:"post",body:v},!0).then(e=>{e.success?(0,n.A)().then(()=>{window.location.reload()}):alert("Media deletion Failed! Please try again.")})},className:"more-padding",children:"Delete"}),!(null==v?void 0:v.private)&&(0,t.jsxs)(i.Fragment,{children:[(0,t.jsx)("button",{className:"outlined gray w-full bg-white more-padding",onClick:e=>{navigator.clipboard.writeText(v.media_url||"").then(()=>{alert("Media url ".concat(v.media_url," Copied to clipboard"))})},children:"Copy Full Image Link"}),(0,t.jsx)("button",{className:"outlined gray w-full more-padding",onClick:e=>{navigator.clipboard.writeText(v.media_thumbnail_url||"").then(()=>{alert("Media url ".concat(v.media_thumbnail_url," Copied to clipboard"))})},style:{borderTop:"1px solid #0b8862"},children:"Copy Image Thumbnail Link"})]})]})})]})]})}},8183:(e,l,a)=>{a.d(l,{A:()=>d,F:()=>s});var t=a(4848);a(6540);var i=a(3698),o=a(7531),n=a(557);function d(e){let{mediaObject:l,setLoading:a}=e;return(0,t.jsxs)("div",{className:"dropdown-wrapper w-full xl:w-auto",children:[(0,t.jsx)("button",{className:"outlined gray small-text hidden xl:flex",children:"More"}),(0,t.jsx)("div",{className:"dropdown mobile-transform gap-2 w-full",children:(0,t.jsxs)(n.A,{column:!0,className:"w-full mb-2 xl:mb-0",children:[(0,t.jsx)(s,{mediaObject:l,setLoading:a}),(0,t.jsx)("button",{className:"outlined gray normal-weight more-padding w-full xl:w-auto",onClick:e=>{window.confirm("Delete this media?")&&(0,i.A)("/api/deleteUserMedia",{method:"post",body:l},!0).then(e=>{e.success?(0,o.A)().then(()=>{window.location.reload()}):alert("Media deletion Failed! Please try again.")})},children:"Delete"})]})})]})}function s(e){let{mediaObject:l,setLoading:a}=e;return(0,t.jsx)("button",{onClick:e=>{let t=window.prompt("Rename media",l.media_name);t&&window.confirm('Rename "'.concat(l.media_name,'" to "').concat(t,'"'))&&(a(!0),(0,i.A)("/api/renameMedia",{method:"post",body:{mediaObject:l,newName:t.replace(/ /g,"-"),newThumbnailName:t.replace(/ /g,"-")+"_thumbnail"}},!0).then(e=>{e.success?window.location.reload():(window.alert(e.msg),setTimeout(()=>{a(!1)},1e3))}))},className:"outlined gray normal-weight more-padding",children:"Rename"})}},5165:(e,l,a)=>{a.d(l,{Ay:()=>n,PB:()=>d,fs:()=>s});var t=a(4848),i=a(6897),o=a(6540);function n(e){let{children:l,title:a,data:n,fullPage:d,wrapperClasses:r,closePopupDispatch:c,wrapperStyle:u,noContainer:m}=e;return d?(0,t.jsxs)("div",{className:"popup-bg overflow-hidden "+(r||""),"data-popupid":a||null,style:u,children:[m?(0,t.jsx)(o.Fragment,{children:l}):(0,t.jsx)("div",{className:"relative w-full h-full z-50","data-data":n?JSON.stringify(n):"",children:l}),(0,t.jsx)("button",{className:"popup-cancel-button fixed outlined gray",onClick:e=>{s(),c&&c()},children:(0,t.jsx)(i.A,{color:"white",size:20})}),(0,t.jsx)("div",{className:"popup-canceller",onClick:e=>{s(),c&&c()}})]}):(0,t.jsxs)("div",{className:"popup-bg","data-popupid":a||null,children:[m?(0,t.jsx)(o.Fragment,{children:l}):(0,t.jsxs)("div",{className:"popup-content-container minimal-scrollbars","data-data":n?JSON.stringify(n):"",children:[l,(0,t.jsx)("button",{className:"outlined gray popup-cancel-button",onClick:e=>{s(),c&&c()},children:(0,t.jsx)("span",{className:"font-normal",children:"✖"})})]}),m&&(0,t.jsx)("button",{className:"gray popup-cancel-button",onClick:e=>{s(),c&&c()},children:(0,t.jsx)("span",{className:"font-normal",children:"✖"})}),(0,t.jsx)("div",{className:"popup-canceller",onClick:e=>{s(),c&&c()}})]})}function d(e,l){let a=document.querySelector("[data-popupid='".concat(e,"']"));a&&(a.style.display="flex",l&&l(a))}function s(e){document.querySelectorAll("[data-popupid]").forEach(e=>{e.style.display="none"}),e&&e()}},1493:(e,l,a)=>{a.d(l,{A:()=>o});var t=a(4848);a(6540);var i=a(5896);function o(e){let{setNewFile:l,setLoading:a}=e;return(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"file",name:"upload_file_input",id:"upload_file_input",className:"hidden",accept:".xlsx,.pdf,.csv,.json",multiple:!0,onChange:async e=>{a&&a(!0);let t=[],o=e.target.files;if(null==o?void 0:o.length){for(let e=0;e<o.length;e++){var n;let l=o[e];if(null===(n=l.type)||void 0===n?void 0:n.match(/sheet/))console.log(URL.createObjectURL(l));else{let e=await (0,i.A)({inputFile:l});t.push(e)}}l(t),setTimeout(()=>{a&&a(!1)},200)}else window.alert("No Files selected")}})})}},7764:(e,l,a)=>{a.d(l,{A:()=>o});var t=a(4848);a(6540);var i=a(5113);function o(e){let{setNewMedia:l,setLoading:a}=e;return(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"file",name:"upload_image_input",id:"upload_image_input",className:"hidden",accept:"image/*",multiple:!0,onChange:async e=>{a&&a(!0);let t=[],o=e.target.files;if(null==o?void 0:o.length){for(let e=0;e<o.length;e++){var n;let l=o[e];if(null===(n=l.type)||void 0===n?void 0:n.match(/sheet/))console.log(URL.createObjectURL(l));else{let e=await (0,i.A)({imageInputFile:l,maxWidth:1800});t.push(e)}}l(t),setTimeout(()=>{a&&a(!1)},200)}else window.alert("No Files selected")}})})}},2154:(e,l,a)=>{a.d(l,{A:()=>o});var t=a(4848);a(6540);var i=a(5896);function o(e){let{setNewVideo:l,setLoading:a}=e;return(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"file",name:"upload_video_input",id:"upload_video_input",className:"hidden",accept:".mp4",multiple:!0,onChange:async e=>{a&&a(!0);let t=[],o=e.target.files;if(null==o?void 0:o.length){for(let e=0;e<o.length;e++){var n;let l=o[e];if(null===(n=l.type)||void 0===n?void 0:n.match(/sheet/))console.log(URL.createObjectURL(l));else{let e=await (0,i.A)({inputFile:l});t.push(e)}}l(t),setTimeout(()=>{a&&a(!1)},200)}else window.alert("No Videos selected")}})})}},5624:(e,l,a)=>{a.d(l,{A:()=>i});var t=a(4848);function i(e){return(0,t.jsxs)("a",{href:"/email-verification",className:"card w-full items-center justify-center py-4 gap-2",children:[(0,t.jsx)("img",{src:"/images/warning.png",alt:"Down Arrow",width:25,className:""}),(0,t.jsx)("span",{children:"Your Account is not verified. Please verify your account."})]})}a(6540)},557:(e,l,a)=>{a.d(l,{A:()=>o});var t=a(4848),i=a(6540);function o(e){let{children:l,column:a,className:o}=e,n=i.useRef();return i.useEffect(()=>{try{let e=n.current.childNodes,l=Array.from(e);if((null==l?void 0:l.length)===1)return;l.forEach((e,t)=>{let i=e;if(i.classList.contains("dropdown-wrapper")){let l=Array.from(e.childNodes).filter(e=>{var l;return(null==e?void 0:null===(l=e.nodeName)||void 0===l?void 0:l.match(/button/i))||e.classList.contains("button")});l&&l[0]&&(i=l[0])}t<l.length-1&&(i.style[a?"borderBottomRightRadius":"borderTopRightRadius"]=0,i.style[a?"borderBottomLeftRadius":"borderBottomRightRadius"]=0),t>0&&(i.style[a?"borderTop":"borderLeft"]="none",i.style[a?"borderTopRightRadius":"borderTopLeftRadius"]=0,i.style[a?"borderTopLeftRadius":"borderBottomLeftRadius"]=0)})}catch(e){console.log(e.message)}},[]),(0,t.jsx)("div",{className:"items-stretch gap-0"+(a?" flex-col":" flex-wrap xl:flex-nowrap")+(o?" "+o:""),ref:n,children:l})}},9084:(e,l,a)=>{a.d(l,{A:()=>i});var t=a(993);async function i(e){var l;let a,{mediaObject:i,fileName:o,setLoading:n}=e;n&&n(!0);let d=!!((null==i?void 0:i.private)||(null==i?void 0:null===(l=i.media_url)||void 0===l?void 0:l.match(/^\@/)));a=d?await (0,t.A)({url:i.media_url||""}):await fetch("/api/fetch-media?url="+i.media_url);let s=d?a:await a.blob(),r=d?a:URL.createObjectURL(s),c=document.createElement("a");c.href=r,c.download=o,c.style.display="none",document.body.appendChild(c),c.click(),URL.revokeObjectURL(r),document.body.removeChild(c),setTimeout(()=>{n&&n(!1)},500)}},993:(e,l,a)=>{a.d(l,{A:()=>t});async function t(e){let{url:l}=e;return new Promise((e,a)=>{fetch("/api/media/getPrivateMedia",{method:"POST",body:JSON.stringify({path:l}),headers:{"x-csrf-auth":localStorage.getItem("csrf")}}).then(e=>e.blob()).then(l=>{e(URL.createObjectURL(l))})})}},5113:(e,l,a)=>{a.d(l,{A:()=>t});async function t(e){let l,a,{imageInputFile:t,maxWidth:i}=e,o=document.querySelector("[data-imagepreview='image']"),n=t.name.replace(/\..*/,""),d=document.createElement("canvas"),s=t.type,r=i||null,c=URL.createObjectURL(t),u=new Image;return u.src=c,l=await new Promise((e,l)=>{u.onerror=function(){URL.revokeObjectURL(this.src),console.log("Cannot load image")},u.onload=function(){if(URL.revokeObjectURL(this.src),r){let e=r/u.naturalWidth;d.width=u.naturalWidth<r?u.naturalWidth:r,d.height=u.naturalWidth<r?u.naturalHeight:u.naturalHeight*e}else d.width=u.naturalWidth,d.height=u.naturalHeight;let l=d.getContext("2d");null==l||l.drawImage(u,0,0,d.width,d.height);let a=d.toDataURL(s,.95);o&&document.querySelectorAll("[data-imagepreview='image']").forEach(e=>{e.src=a}),e(a)}}),a=await new Promise((e,l)=>{d.toBlob(l=>{e(null==l?void 0:l.size)},s,.95)}),{imageBase64:l.replace(/.*?base64,/,""),imageBase64Full:l,imageName:n,imageSize:a}}},5896:(e,l,a)=>{a.d(l,{A:()=>t});async function t(e){let{inputFile:l}=e;try{let e=l.name.replace(/\..*/,""),a=await new Promise((e,a)=>{var t=new FileReader;t.readAsDataURL(l),t.onload=function(){e(t.result)},t.onerror=function(e){console.log("Error: ",e.message)}});return{fileBase64:a.replace(/.*?base64,/,""),fileBase64Full:a,fileName:e,fileSize:l.size,fileType:l.type}}catch(e){return console.log("Image Processing Error! =>",e.message),{fileBase64:null,fileBase64Full:null,fileName:l.name,fileSize:null,fileType:null}}}},7216:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},5014:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("BookText",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}],["path",{d:"M8 7h6",key:"1f0q6e"}],["path",{d:"M8 11h8",key:"vwpz6n"}]])},8453:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},9140:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},2894:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("FileKey2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v6",key:"rc0qvx"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"m10 10-4.5 4.5",key:"7fwrp6"}],["path",{d:"m9 11 1 1",key:"wa6s5q"}]])},9508:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},9753:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]])},1915:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]])},6446:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},7273:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},5922:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("ShieldEllipsis",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]])},4909:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},6897:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(5737).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])}}]); |