1import{a as t,u as R,o as C,j as c}from"./index-qEEmZYHn.js";function W(){const[d,b]=t.useState(null),[E,w]=t.useState(null),[i,A]=t.useState(""),[N,U]=t.useState(""),[O,T]=t.useState(null),[J,P]=t.useState({}),F=R(),f=JSON.parse(localStorage.getItem("items"));localStorage.getItem("token");const[g,z]=t.useState(!1),[h,k]=t.useState(!1),x=()=>{const e={token:localStorage.getItem("token"),timeEntryId:"your-time-entry-id"};encodeURIComponent(JSON.stringify(e)),localStorage.setItem("type","startTimer")};function L(e){return new URLSearchParams(F.search).get(e)}const j=JSON.parse(L("object"));return t.useEffect(()=>{const r=setInterval(()=>{A(localStorage.getItem("type"))},1e3);return()=>clearInterval(r)},[i]),t.useEffect(()=>{},[i,g]),t.useEffect(()=>{if(!h){const e=setTimeout(()=>{localStorage.getItem("type")==="startTimer"&&!g&&(x(),k(!0))},300);return()=>clearTimeout(e)}},[h,g]),t.useEffect(()=>{const e=j?.token,r=C(e);if(localStorage.setItem("items",JSON.stringify(r)),localStorage.setItem("token",e),i==="startTimer"){const I=()=>{d?w(v(d).then(o=>{const u=o.split(",")[1];localStorage.setItem("imgFile",u);const m=localStorage.getItem("imgFile"),l=atob(m),a=new Array(l.length);for(let n=0;n<l.length;n++)a[n]=l.charCodeAt(n);const s=new Uint8Array(a),y=new Blob([s],{type:"image/jpeg"}),p=URL.createObjectURL(y);T(p)}).catch(o=>console.error("Error capturing frame:",o))):navigator.mediaDevices.getDisplayMedia({video:!0}).then(o=>{window.open(f?.userType==="owner"?"https://www.sstrack.io/company-owner":f?.userType==="admin"?"https://www.sstrack.io/admindashboard":f?.userType==="user"?"https://www.sstrack.io/userdashboard":""),b(o),w(setInterval(()=>{v(o).then(u=>{const m=u.split(",")[1];localStorage.setItem("imgFile",m);const l=localStorage.getItem("imgFile"),a=atob(l),s=new Array(a.length);for(let S=0;S<a.length;S++)s[S]=a.charCodeAt(S);const y=new Uint8Array(s),p=new Blob([y],{type:"image/jpeg"}),n=URL.createObjectURL(p);T(n)}).catch(u=>console.error("Error capturing frame:",u))},1e4))}).catch(o=>console.error("Error capturing screen:",o))},v=(o,u)=>new Promise((m,l)=>{let a=document.createElement("video");a.srcObject=o,a.play(),a.onloadedmetadata=()=>{let s=document.createElement("canvas");s.width=a.videoWidth,s.height=a.videoHeight,s.getContext("2d").drawImage(a,0,0,s.width,s.height),s.toBlob(p=>{const n=new FileReader;n.onloadend=()=>{m(n.result)},n.onerror=l,n.readAsDataURL(p)},"image/jpeg")}});I()}else i==="stopTimer"&&(clearInterval(E),d&&(d.getTracks().forEach(o=>o.stop()),b(null)))},[i]),t.useEffect(()=>{const e=j?.token;if(e)try{const r=C(e);localStorage.setItem("items",JSON.stringify(r)),localStorage.setItem("token",e)}catch(r){console.error("Invalid JWT token",r)}if(!h){const r=setTimeout(()=>{localStorage.getItem("type")==="startTimer"&&!g&&(x(),k(!0))},300);return()=>clearTimeout(r)}},[h,g]),t.useEffect(()=>{const r=setInterval(()=>U(localStorage.getItem("totalInterval")),1e3);return()=>clearInterval(r)},[i]),c.jsx("div",{style:{height:"100vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:g?c.jsx("p",{style:{color:"white",fontSize:28},children:"Capturing screen... please keep this tab open"}):c.jsxs(c.Fragment,{children:[c.jsx("img",{src:"https://sstrack-public-assets.s3.ca-central-1.amazonaws.com/images/FooterLogo.png",alt:""}),c.jsx("p",{style:{color:"white",fontSize:"35px",fontWeight:"700",margin:0},children:"Please keep this tab open while capture screenshot"}),c.jsx("div",{children:c.jsx("p",{style:{color:"white",fontSize:"28px",fontWeight:"500",margin:0},children:"Please keep this tab open while capture screenshot"})})]})})}export{W as default};
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.