PageSourceSearch

https://talentjet.ai/_next/static/chunks/pages/admin/videos-68e6952a6fd8a358.js

js talentjet.ai collected 2026-10-05 13:26:59 UTC 32,850 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6135],{30387:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/videos",function(){return s(10639)}])},13979:function(e,t,s){"use strict";var a=s(85893),i=s(67294),l=s(11355),n=s(26064),r=s(31415),o=s(6244);t.Z=e=>{let{videoId:t,currentStatus:s,onStatusChange:d}=e,[c,m]=(0,i.useState)(!1),[u,x]=(0,i.useState)(!1),[h,p]=(0,i.useState)(null),updateDisplayStatus=async e=>{m(!0);try{let s=await fetch("/api/videos/".concat(t,"/display-status"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayStatus:e})});if(!s.ok)throw Error("Failed to update status");d()}catch(e){console.error("Error updating display status:",e)}finally{m(!1),x(!1)}},handleStatusChange=e=>{p(e),x(!0)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("select",{value:s,onChange:e=>handleStatusChange(e.target.value),className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6 ".concat("private"!==s?"":"bg-gray-100"),disabled:c,children:[(0,a.jsx)("option",{value:"private",children:"Private"}),(0,a.jsx)("option",{value:"unlisted",children:"Unlisted"}),(0,a.jsx)("option",{value:"public",children:"Public"})]}),(0,a.jsx)(l.u.Root,{show:u,as:i.Fragment,children:(0,a.jsxs)(n.V,{as:"div",className:"relative z-10",onClose:x,children:[(0,a.jsx)(l.u.Child,{as:i.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,a.jsx)("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"})}),(0,a.jsx)("div",{className:"fixed inset-0 z-10 w-screen overflow-y-auto",children:(0,a.jsx)("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:(0,a.jsx)(l.u.Child,{as:i.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,a.jsxs)(n.V.Panel,{className:"relative transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6",children:[(0,a.jsx)("div",{className:"absolute right-0 top-0 hidden pr-4 pt-4 sm:block",children:(0,a.jsxs)("button",{type:"button",className:"rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",onClick:()=>x(!1),children:[(0,a.jsx)("span",{className:"sr-only",children:"Close"}),(0,a.jsx)(r.Z,{className:"h-6 w-6","aria-hidden":"true"})]})}),(0,a.jsxs)("div",{className:"sm:flex sm:items-start",children:[(0,a.jsx)("div",{className:"mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-yellow-100 sm:mx-0 sm:h-10 sm:w-10",children:(0,a.jsx)(o.Z,{className:"h-6 w-6 text-yellow-600","aria-hidden":"true"})}),(0,a.jsxs)("div",{className:"mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left",children:[(0,a.jsx)(n.V.Title,{as:"h3",className:"text-base font-semibold leading-6 text-gray-900",children:"Change Video Status"}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:["Are you sure you want to change the video status to ",h,"?"]})})]})]}),(0,a.jsxs)("div",{className:"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)("button",{type:"button",className:"inline-flex w-full justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 sm:ml-3 sm:w-auto",onClick:()=>h&&updateDisplayStatus(h),children:"Confirm"}),(0,a.jsx)("button",{type:"button",className:"mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:mt-0 sm:w-auto",onClick:()=>x(!1),children:"Cancel"})]})]})})})})]})})]})}},10639:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return videos},fetchVideos:function(){return fetchVideos}});var a=s(85893),i=s(67294),l=s(11163),n=s(39332),r=s(88767),o=s(36858),d=s(41664),c=s.n(d),m=s(96207),u=s(76089),x=s(50629),h=s(31193),p=s(23),g=s(76249),f=s(95620),y=s(66955),v=s(13979),b=s(48974),w=s(31415),videos_EditVideoModal=e=>{let{video:t,isOpen:s,onClose:l,onVideoUpdated:n}=e,[r,o]=(0,i.useState)(!1),[d,c]=(0,i.useState)({title:"",description:""}),[m,u]=(0,i.useState)("");(0,i.useEffect)(()=>{t&&c({title:t.title||"",description:t.description||""})},[t]),(0,i.useEffect)(()=>(s&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow="unset"}),[s]);let handleSubmit=async e=>{if(e.preventDefault(),t){o(!0),u("");try{let e=await fetch("/api/videos/".concat(t.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!e.ok)throw Error("Failed to update video");n()}catch(e){u("Failed to update video. Please try again.")}finally{o(!1)}}};return s?(0,a.jsxs)("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:[(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity",onClick:l}),(0,a.jsx)("div",{className:"flex min-h-full items-center justify-center p-4",children:(0,a.jsxs)("div",{className:"relative w-full max-w-3xl bg-white rounded-lg shadow-xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-gray-200",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Edit Video"}),(0,a.jsx)("button",{onClick:l,className:"text-gray-400 hover:text-gray-500 transition-colors",children:(0,a.jsx)(w.Z,{className:"h-5 w-5"})})]}),(0,a.jsxs)("form",{onSubmit:handleSubmit,className:"p-4",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"title",className:"block text-sm font-medium text-gray-700 mb-1",children:"Title"}),(0,a.jsx)("input",{type:"text",id:"title",value:d.title,onChange:e=>c(t=>({...t,title:e.target.value})),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:"Enter video title"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"description",className:"block text-sm font-medium text-gray-700 mb-1",children:"Description"}),(0,a.jsx)("textarea",{id:"description",value:d.description,onChange:e=>c(t=>({...t,description:e.target.value})),rows:14,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:"Enter video description"})]}),m&&(0,a.jsx)("div",{className:"text-red-600 text-sm",children:m})]}),(0,a.jsxs)("div",{className:"mt-6 flex justify-end gap-3",children:[(0,a.jsx)("button",{type:"button",onClick:l,disabled:r,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:"Cancel"}),(0,a.jsx)("button",{type:"submit",disabled:r,className:"px-4 py-2 text-sm font-medium text-white bg-indigo-600 border border-transparent roun
1ded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed",children:r?"Saving...":"Save Changes"})]})]})]})})]}):null},j=s(15045),N=s(79111),C=s(5362);let k=(0,j.createFFmpeg)({corePath:"https://unpkg.com/@ffmpeg/[email protected]/dist/ffmpeg-core.js",log:!0});var videos_VideoUploader=e=>{let{isOpen:t,onClose:s,onSaveComplete:l,maxSizeInMB:n=100,acceptedFormats:r=["video/mp4","video/webm","video/quicktime"],uploadEndpoint:o="/api/videos/upload"}=e,[d,c]=(0,i.useState)(!1),[m,u]=(0,i.useState)(null),[x,h]=(0,i.useState)(null),[p,g]=(0,i.useState)(!1),[f,y]=(0,i.useState)(""),v=(0,i.useRef)(null);(0,i.useEffect)(()=>{let loadFFmpeg=async()=>{if(!k.isLoaded())try{await k.load()}catch(e){h("Failed to load video processing tools"),console.error("Error loading FFmpeg:",e)}};loadFFmpeg()},[]);let b=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),"dragenter"===e.type||"dragover"===e.type?c(!0):"dragleave"===e.type&&c(!1)},[]),validateVideoFile=e=>{if(!r.includes(e.type))throw Error("Please upload a valid video format (".concat(r.join(", "),")"));if(e.size>1048576*n)throw Error("File size should be less than ".concat(n,"MB"))},processVideoFile=async e=>{try{validateVideoFile(e),u({file:e})}catch(e){h(e instanceof Error?e.message:"An unknown error occurred")}},S=(0,i.useCallback)(async e=>{e.preventDefault(),e.stopPropagation(),c(!1),h(null);let t=e.dataTransfer.files[0];t&&await processVideoFile(t)},[]),F=(0,i.useCallback)(async e=>{var t;e.preventDefault(),h(null);let s=null===(t=e.target.files)||void 0===t?void 0:t[0];s&&await processVideoFile(s)},[]),handleSubmit=async()=>{if(m)try{g(!0),y("Processing video...");let e="output.mp4";k.FS("writeFile","input.webm",await (0,j.fetchFile)(m.file)),await k.run("-i","input.webm","-vf","pad=width=1920:height=1080:x=(1920-iw)/2:y=(1080-ih)/2:color=white","-c:v","libx264","-preset","medium","-crf","23","-c:a","aac","-r","30",e);let t=k.FS("readFile",e),a=new File([t.buffer],m.file.name.replace(/\.[^/.]+$/,".mp4"),{type:"video/mp4"});k.FS("unlink","input.webm"),k.FS("unlink",e),y("Uploading...");let i=new FormData;i.append("video",a),await new Promise((e,t)=>{let s=new XMLHttpRequest;s.upload.onprogress=e=>{if(e.lengthComputable){let t=Math.round(e.loaded/e.total*100);y("Uploading... ".concat(t,"%"))}},s.onload=()=>{s.status>=200&&s.status<300?e(s.response):t(Error("Upload failed"))},s.onerror=()=>t(Error("Network error")),s.open("POST",o),s.send(i)}),l(),s()}catch(e){h(e instanceof Error?e.message:"An unknown error occurred")}finally{g(!1),y("")}};return t?(0,a.jsxs)("div",{className:"relative z-10","aria-labelledby":"modal-title",role:"dialog","aria-modal":"true",children:[(0,a.jsx)("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"}),(0,a.jsx)("div",{className:"fixed inset-0 z-10 w-screen overflow-y-auto",children:(0,a.jsx)("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:(0,a.jsxs)("div",{className:"relative transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-gray-100",children:(0,a.jsx)(N.Z,{className:"h-6 w-6 text-gray-600","aria-hidden":"true"})}),(0,a.jsx)("div",{className:"mt-3 text-center sm:mt-5",children:(0,a.jsx)("h3",{className:"text-base font-semibold leading-6 text-gray-900",id:"modal-title",children:"Upload Video"})})]}),(0,a.jsxs)("div",{className:"mt-6",children:[(0,a.jsxs)("div",{className:"relative rounded-lg border-2 border-dashed p-6 ".concat(d?"border-blue-500 bg-blue-50":"border-gray-300"),onDragEnter:b,onDragLeave:b,onDragOver:b,onDrop:S,children:[(0,a.jsx)("input",{ref:v,type:"file",accept:r.join(","),onChange:F,className:"hidden"}),m?(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(N.Z,{className:"h-8 w-8 text-gray-400"}),(0,a.jsx)("span",{className:"ml-2 text-sm text-gray-600",children:m.file.name})]}),(0,a.jsx)("button",{type:"button",onClick:()=>u(null),className:"text-gray-400 hover:text-gray-500",children:(0,a.jsx)(w.Z,{className:"h-5 w-5"})})]}):(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(N.Z,{className:"mx-auto h-12 w-12 text-gray-400"}),(0,a.jsx)("div",{className:"mt-4 flex text-sm leading-6 text-gray-600 justify-center",children:(0,a.jsxs)("label",{htmlFor:"file-upload",className:"relative cursor-pointer rounded-md font-semibold text-blue-600 focus-within:outline-none focus-within:ring-2 focus-within:ring-blue-600 focus-within:ring-offset-2 hover:text-blue-500",children:[(0,a.jsx)("span",{onClick:()=>{var e;return null===(e=v.current)||void 0===e?void 0:e.click()},children:"Upload a video"}),(0,a.jsx)("span",{className:"pl-1",children:"or drag and drop"})]})}),(0,a.jsxs)("p",{className:"text-xs leading-5 text-gray-600",children:[r.join(" or ")," up to ",n,"MB"]})]})]}),f&&(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsxs)("div",{className:"text-sm text-gray-600 mb-2 flex items-center justify-center gap-2",children:[(0,a.jsxs)("svg",{className:"animate-spin h-5 w-5 text-blue-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:3}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),f]})}),x&&(0,a.jsx)("div",{className:"mt-2 rounded-md bg-red-50 p-4",children:(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)(C.Z,{className:"h-5 w-5 text-red-400","aria-hidden":"true"})}),(0,a.jsx)("div",{className:"ml-3",children:(0,a.jsx)("h3",{className:"text-sm font-medium text-red-800",children:x})})]})}),(0,a.jsxs)("div",{className:"mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense sm:grid-cols-2 sm:gap-3",children:[(0,a.jsx)("button",{type:"button",className:"inline-flex w-full justify-center rounded-md px-3 py-2 text-sm font-semibold text-white shadow-sm sm:col-start-2 ".concat(m&&!p?"bg-blue-600 hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600":"bg-gray-400 cursor-not-allowed"),onClick:handleSubmit,disabled:!m||p,children:p?"Processing...":"Upload"}),(0,a.jsx)("button",{type:"button",className:"mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:col-start-1 sm:mt-0",onClick:s,disabled:p,children:"Cancel"})]})]})]})})})]}):null},S=s(76943),F=s(10798);let escapeHtml=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),generateHtmlPreview=e=>{if(!e.video_key)return"";let t=(0,y.wq)(e.video_key),s="".concat(window.location.origin,"/videos/").concat(e.id,"/view"),a=escapeHtml(e.title||"Untitled Video"),i=e.description?escapeHtml(e.description):"",l='\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\n</head>\n<body>\n<a href="'.concat(s,'" style="text-decoration: none; color: inherit; display: inline-block;">\n  <table cellpadding="0" cellspacing="0" border="0" style="min-width: 100%; width: 100%; max-width: 600px; border: 1px solid #E5E5E5; border-radius: 4px; font-family: Arial, sans-serif;">\n      <tr>\n          <td style="padding: 0;">\n              <table cellpadding="0" cellspacing="0" border="0" style="width: 100%;">\n                  <tr>\n                      <td style="padding: 0;">\n                          <img src="').concat(t,'" \n                               alt="').concat(a,'" \n                               style="display: block; width: 100%; max-height: 300px; object-fit: cover; border-top-left-radius: 4px; border-top-right-radius: 4px;" />\n                      </td>\n                  </tr>\n                  <tr>\n                      <td style="padding: 16px;">\n                          <p style="margin: 0 0 8px 0; font-size: 16px; font-weight: bold; color: #1a1a1a; font-family: Arial, sans-serif;">\n                              ').concat(a,"\n                          </p>\n                          ").concat(i?'\n                          <p style="margin: 0 0 8px 0; font-size: 14px; color: #666666; line-height: 1.4; font-family: Arial, sans-serif;">\n                              '.concat(i,"\n                          </p>\n                          "):"",'\n                          <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; margin-top: 16px;">\n                              <tr>\n                                  <td align="center">\n                                      <table cellpadding="0" cellspacing="0" border="0" style="width: 200px;">\n                                          <tr>\n                                              <td align="center" style="background-color: #0066cc; border-radius: 4px; padding: 12px 24px; width: 200px;">
1\n                                                  <span style="color: #ffffff; font-family: Arial, sans-serif; font-size: 14px; font-weight: bold;">Watch Video ►</span>\n                                              </td>\n                                          </tr>\n                                      </table>\n                                  </td>\n                              </tr>\n                          </table>\n                      </td>\n                  </tr>\n              </table>\n          </td>\n      </tr>\n  </table>\n</a>\n</body>\n</html>').trim();return l.replace(/\s+/g," ").trim()};var videos_CopyHtmlButton=e=>{let{video:t,className:s="",showLabel:l=!1}=e,[n,r]=(0,i.useState)(!1),handleCopyHtml=async()=>{try{let e=generateHtmlPreview(t),s=new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})});await navigator.clipboard.write([s]),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){console.error("Failed to copy HTML: ",e);try{let e=generateHtmlPreview(t);await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){console.error("Fallback copy failed:",e)}}};return(0,a.jsxs)("button",{onClick:handleCopyHtml,className:"inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md text-gray-700 bg-white border border-gray-300 hover:bg-gray-50 ".concat(s),title:"Copy HTML preview",disabled:!t.video_key||"ready"!==t.status,children:[(0,a.jsx)(F.Z,{className:"h-4 w-4"}),l&&n&&(0,a.jsx)("span",{className:"ml-1.5",children:"Copied"})]})};let VideoThumbnail=e=>{var t;let{video:s}=e;if("processing"===s.status)return(0,a.jsx)("div",{className:"w-full h-full flex justify-center items-center bg-gray-50 rounded-lg",children:(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)(m.Z,{className:"animate-spin h-8 w-8 text-indigo-500"}),(0,a.jsx)("span",{className:"text-sm text-gray-500 mt-2",children:"Processing"})]})});if("created"===s.status)return(0,a.jsx)("div",{className:"w-full h-full flex justify-center items-center bg-gray-50 rounded-lg",children:(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)(u.Z,{className:"h-8 w-8 text-blue-500"}),(0,a.jsx)("span",{className:"text-sm text-gray-500 mt-2",children:"Ready to Record"})]})});if("failed"===s.status)return(0,a.jsx)("div",{className:"w-full h-full flex justify-center items-center bg-gray-50 rounded-lg",children:(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)(x.Z,{className:"h-8 w-8 text-red-500"}),(0,a.jsx)("span",{className:"text-sm text-gray-500 mt-2",children:"Failed"})]})});if(!s.video_key)return(0,a.jsx)("div",{className:"w-full h-full flex justify-center items-center bg-gray-50 rounded-lg",children:(0,a.jsx)(h.Z,{className:"h-12 w-12 text-gray-400"})});let i=(0,y.Kp)(s.video_key,y.WP.ORIGINAL);return(0,a.jsxs)("div",{className:"group relative w-full h-full",children:[i&&(0,a.jsx)("img",{src:i,alt:null!==(t=s.title)&&void 0!==t?t:"Video thumbnail",className:"object-cover rounded-lg w-full h-full",crossOrigin:"anonymous"}),(0,a.jsx)("div",{className:"absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-30 transition-opacity duration-200 rounded-lg flex items-center justify-center",children:(0,a.jsx)(h.Z,{className:"h-12 w-12 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200"})})]})};var videos_VideosTable=e=>{var t;let{videos:s,onVideoDeleted:l}=e,[n,r]=(0,i.useState)(null),[o,d]=(0,i.useState)(null),[m,x]=(0,i.useState)(null),[h,y]=(0,i.useState)({}),[w,j]=(0,i.useState)(!1),[N,C]=(0,i.useState)(null),handleCopyToClipboard=async e=>{let t="".concat(window.location.origin,"/videos/").concat(e,"/view");try{await navigator.clipboard.writeText(t),C(e),setTimeout(()=>C(null),2e3)}catch(e){console.error("Failed to copy text: ",e)}},handleDelete=async e=>{if(o!==e){d(e);return}r(e);try{let t=await fetch("/api/videos/".concat(e,"/delete"),{method:"DELETE"});if(!t.ok)throw Error("Failed to delete video");null==l||l()}catch(e){console.error("Error deleting video:",e)}finally{r(null),d(null)}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"space-y-4",children:s.map(e=>{var t,s,i,r;let d="created"===e.status?"/videos/".concat(e.id):"/videos/".concat(e.id,"/view");return(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm overflow-hidden hover:shadow-md transition-shadow duration-200",children:(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"flex gap-6",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)(c(),{href:d,children:(0,a.jsx)("div",{className:"h-32 w-56 overflow-hidden rounded-lg",children:(0,a.jsx)(VideoThumbnail,{video:e})})})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-0",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,f.o)(e)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c(),{href:d,className:"text-base font-medium text-gray-900 hover:text-indigo-600 transition-colors",children:e.title}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)(c(),{href:"/admin/roles/".concat(null===(t=e.role)||void 0===t?void 0:t.id),className:"text-base font-medium text-gray-900 hover:text-indigo-600 transition-colors truncate max-w-[400px] block",children:null!==(i=null===(s=e.role)||void 0===s?void 0:s.name)&&void 0!==i?i:"Untitled Video"})]}):(0,a.jsx)(c(),{href:d,className:"text-base font-medium text-gray-900 hover:text-indigo-600 transition-colors",children:null!==(r=e.title)&&void 0!==r?r:"Untitled Video"})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:["ready"===e.status&&"private"!==e.display_status&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(videos_CopyHtmlButton,{video:e,showLabel:!0,className:"your-custom-classes"}),(0,a.jsxs)("button",{onClick:()=>handleCopyToClipboard(e.id),className:"inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md text-gray-700 bg-white border border-gray-300 hover:bg-gray-50",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4 mr-1.5"}),N===e.id?"Copied!":"Share"]})]}),(0,a.jsx)(v.Z,{videoId:e.id,currentStatus:e.display_status,onStatusChange:l}),"created"===e.status&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c(),{href:"/videos/".concat(e.id),children:(0,a.jsxs)("button",{className:"inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md text-gray-700 bg-white border border-gray-300 hover:bg-gray-50",children:[(0,a.jsx)(u.Z,{className:"h-4 w-4 mr-1.5"}),"Record"]})}),(0,a.jsxs)("button",{onClick:()=>j(!0),className:"inline-flex items-center rounded-md px-3 py-2 text-sm font-semibold shadow-sm text-gray-700 bg-white border border-gray-300 hover:bg-gray-50",children:[(0,a.jsx)(S.Z,{className:"h-5 w-5 mr-2"}),"Upload"]})]}),(0,a.jsxs)("button",{onClick:()=>x(e),className:"inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md text-gray-700 bg-white border border-gray-300 hover:bg-gray-50",children:[(0,a.jsx)(b.Z,{className:"h-4 w-4 mr-1.5"}),"Edit"]}),(0,a.jsxs)("button",{onClick:()=>handleDelete(e.id),disabled:!!n||"private"!==e.display_status,className:"inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md\n                            ".concat(o===e.id?"bg-red-600 hover:bg-red-700 text-white":"bg-gray-600 hover:bg-gray-700 text-white"," \n                            disabled:opacity-50 disabled:cursor-not-allowed"),children:[(0,a.jsx)(g.Z,{className:"h-4 w-4 mr-1.5"}),n===e.id?"Deleting...":"private"!==e.display_status?"Delete":o===e.id?"Confirm":"Delete"]})]})]}),(e.transcript||e.description)&&(0,a.jsxs)("div",{className:"mt-0",children:[(0,a.jsxs)("div",{className:"flex gap-1 mb-2",children:[e.description&&(0,a.jsx)("button",{onClick:()=>y(t=>
1({...t,[e.id]:!1})),className:"px-3 py-1 text-xs font-medium rounded-md transition-colors\n                                ".concat(!h[e.id]&&e.description?"bg-indigo-100 text-indigo-700":"bg-gray-100 text-gray-600 hover:bg-gray-200"),children:"Description"}),e.transcript&&(0,a.jsx)("button",{onClick:()=>y(t=>({...t,[e.id]:!0})),className:"px-3 py-1 text-xs font-medium rounded-md transition-colors\n                                ".concat(h[e.id]||!e.description?"bg-indigo-100 text-indigo-700":"bg-gray-100 text-gray-600 hover:bg-gray-200"),children:"Transcript"})]}),(0,a.jsx)("p",{className:"text-sm text-gray-500 line-clamp-3",children:e.description&&!h[e.id]?e.description:e.transcript})]})]})]})})},e.id)})}),m&&(0,a.jsx)(videos_EditVideoModal,{video:m,isOpen:!!m,onClose:()=>x(null),onVideoUpdated:()=>{l(),x(null)}}),(0,a.jsx)(videos_VideoUploader,{isOpen:w,onClose:()=>j(!1),onSaveComplete:()=>{j(!1),window.location.reload()},uploadEndpoint:"/api/public/videos/".concat(null===(t=s[0])||void 0===t?void 0:t.id,"/upload")})]})},T=s(78680);let OrderSelector=e=>{let{orderBy:t,orderDirection:s,onChange:i}=e;return(0,a.jsx)("div",{className:"flex items-center space-x-2 ml-2",children:(0,a.jsx)("select",{value:"".concat(t,"-").concat(s),onChange:e=>{let[t,s]=e.target.value.split("-");i(t,s)},className:"select select-bordered select-sm text-gray-500 text-sm border-gray-300 rounded bg-white",style:{height:"38px"},children:[{value:"created_at",label:"Date Recorded"},{value:"duration_seconds",label:"Duration"}].map(e=>[(0,a.jsxs)("option",{value:"".concat(e.value,"-desc"),children:[e.label," (High to Low)"]},"".concat(e.value,"-desc")),(0,a.jsxs)("option",{value:"".concat(e.value,"-asc"),children:[e.label," (Low to High)"]},"".concat(e.value,"-asc"))]).flat()})})};async function fetchVideos(e){let{page:t=1,limit:s=10,entityType:a="",orderBy:i="created_at",orderDirection:l="desc",status:n="all"}=e,r=new URLSearchParams({page:t.toString(),limit:s.toString(),entityType:a,orderBy:i,orderDirection:l,..."all"!==n&&{status:n}}).toString(),o=await fetch("/api/videos?".concat(r));if(!o.ok)throw Error("Failed to fetch videos");return await o.json()}var videos=()=>{let e=(0,l.useRouter)(),t=(0,n.useRouter)(),[s,d]=(0,i.useState)(1),[m,u]=(0,i.useState)(""),[x,h]=(0,i.useState)("created_at"),[p,g]=(0,i.useState)("desc"),[f,y]=(0,i.useState)("all");(0,i.useEffect)(()=>{if(!e.isReady)return;let{page:t,entityType:s,orderBy:a,orderDirection:i,status:l}=e.query;d(t?parseInt(t):1),u(s||""),h(a||"created_at"),g(i||"desc"),y(l||"all")},[e.isReady,e.query]),(0,i.useEffect)(()=>{e.isReady&&e.push({pathname:e.pathname,query:{...s>1&&{page:s},...m&&{entityType:m},..."created_at"!==x&&{orderBy:x},..."desc"!==p&&{orderDirection:p},..."all"!==f&&{status:f}}},void 0,{shallow:!0})},[s,m,x,p,f,e.isReady]);let{data:v,isError:b,isLoading:w,error:j}=(0,r.useQuery)(["videos",s,m,x,p,f],()=>fetchVideos({page:s,entityType:m,orderBy:x,orderDirection:p,status:f}),{keepPreviousData:!0});return w?(0,a.jsx)("div",{className:"text-center py-4",children:"Loading..."}):b?(0,a.jsxs)("div",{className:"text-center py-4",children:["Error: ",j.message]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Z,{}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row w-full justify-between container mx-auto px-4 mt-6 md:mt-12",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)("h2",{className:"text-2xl font-bold pl-2",children:"Videos"}),(0,a.jsxs)(c(),{href:"/admin/videos/new",className:"inline-flex items-center px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium rounded-md shadow-sm transition-colors duration-150 ease-in-out",children:[(0,a.jsx)(T.Z,{className:"h-5 w-5 mr-1"}),"Add Video"]})]}),(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row items-center w-full",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row w-full mb-4 sm:mb-0 space-y-2 sm:space-y-0",children:[(0,a.jsxs)("select",{value:m,onChange:e=>{u(e.target.value),d(1)},className:"select select-bordered select-sm w-full sm:max-w-xs mr-2 border-gray-300 rounded",style:{height:"38px"},children:[(0,a.jsx)("option",{value:"",children:"All Types"}),(0,a.jsx)("option",{value:"role",children:"Role"}),(0,a.jsx)("option",{value:"application",children:"Application"}),(0,a.jsx)("option",{value:"other",children:"Other"})]}),(0,a.jsxs)("select",{value:f,onChange:e=>{y(e.target.value),d(1)},className:"select select-bordered select-sm w-full sm:max-w-xs mr-2 border-gray-300 rounded",style:{height:"38px"},children:[(0,a.jsx)("option",{value:"all",children:"All Statuses"}),(0,a.jsx)("option",{value:"ready",children:"Ready"}),(0,a.jsx)("option",{value:"processing",children:"Processing"}),(0,a.jsx)("option",{value:"created",children:"Created"}),(0,a.jsx)("option",{value:"failed",children:"Failed"})]}),(0,a.jsx)(OrderSelector,{orderBy:x,orderDirection:p,onChange:(e,t)=>
1{h(e),g(t),d(1)}})]}),(0,a.jsx)("button",{onClick:()=>{u(""),h("created_at"),g("desc"),y("all"),d(1),e.push({pathname:e.pathname,query:{}},void 0,{shallow:!0})},className:"md:ml-4 group w-full sm:w-auto rounded-lg px-4 py-2 text-sm font-semibold transition-all flex items-center justify-center bg-gray-300 text-[#1E2B3A] no-underline active:scale-95 scale-100 duration-75",style:{boxShadow:"0 1px 1px #0c192714, 0 1px 3px #0c192724"},children:"Reset"})]})})]}),(0,a.jsx)("div",{className:"container mx-auto px-4 py-4",children:v&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(videos_VideosTable,{videos:v.videos,onVideoDeleted:()=>{t.refresh()}}),(0,a.jsxs)("div",{className:"flex justify-between items-center mt-2",children:[(0,a.jsx)("button",{onClick:()=>d(e=>Math.max(e-1,1)),disabled:1===s,className:"px-4 py-2 bg-gray-200 text-gray-800 rounded hover:bg-gray-300 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out",children:"Previous"}),(0,a.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",s," of ",v.totalPages]}),(0,a.jsx)("button",{onClick:()=>d(e=>Math.min(e+1,v.totalPages)),disabled:s===v.totalPages,className:"px-4 py-2 bg-gray-200 text-gray-800 rounded hover:bg-gray-300 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out",children:"Next"})]})]})})]})}},95620:function(e,t,s){"use strict";function isVideoWithRole(e){return"Role"===e.entity_type}s.d(t,{o:function(){return isVideoWithRole}})},66955:function(e,t,s){"use strict";var a,i,l,n;s.d(t,{IX:function(){return videoKeyToStreamURL},Kp:function(){return videoKeyToThumbnailURL},WP:function(){return i},lp:function(){return a},wq:function(){return videoKeyToGifLocalURL}}),(l=a||(a={})).DASH="dash",l.HLS="hls",(n=i||(i={})).MASKED="masked",n.ORIGINAL="original";let extractVideoKey=e=>e?e.replace(/\.mp4$/,""):null,videoKeyToStreamURL=(e,t,s)=>{let a,i;if(!e)return null;let l=extractVideoKey(e);if(!l)return console.error("Could not extract video key"),null;let n="https://talentjet-ai-production.s3.amazonaws.com";if("masked"===s&&(n="https://talentjet-ai-anon.s3.amazonaws.com"),!n)return console.error("ROOT_STREAM_VIDEO_URL is not defined in the environment variables."),null;switch(t){case"dash":a="mpd",i="dash";break;case"hls":a="m3u8",i="hls";break;default:return console.error("Invalid stream type provided."),null}return"".concat(n,"/video/").concat(l,"/").concat(i,"/index.").concat(a)},videoKeyToThumbnailURL=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e)return null;let a=extractVideoKey(e);if(!a)return console.error("Could not extract video key"),null;let i=["masked"===t?"privacy=MASKED":"",s?"hd=true":""].filter(Boolean),l=i.length?"?"+i.join("&"):"";return"".concat("https://talentjet.ai","/api/public/videos/").concat(a,"/thumbnail").concat(l)},videoKeyToGifLocalURL=e=>{if(!e)return null;let t=extractVideoKey(e);return t?"".concat("https://talentjet.ai","/api/public/videos/").concat(t,"/thumbnail.gif"):(console.error("Could not extract video key"),null)}}},function(e){e.O(0,[1664,8101,5045,6064,9039,6858,9774,2888,179],function(){return e(e.s=30387)}),_N_E=e.O()}]);

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.