1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-064wTBYr.js","assets/react-vendor-Do6BM2ij.js","assets/css/pdf-vendor-core-x04acLUe.css","assets/css/index-CsELiTu1.css"])))=>i.map(i=>d[i]); 2var e=Object.defineProperty,r=Object.defineProperties,t=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,l=(r,t,n)=>t in r?e(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,a=(e,r)=>{for(var t in r||(r={}))o.call(r,t)&&l(e,t,r[t]);if(n)for(var t of n(r))i.call(r,t)&&l(e,t,r[t]);return e},s=(e,n)=>r(e,t(n)),d=(e,r,t)=>new Promise((n,o)=>{var i=e=>{try{a(t.next(e))}catch(r){o(r)}},l=e=>{try{a(t.throw(e))}catch(r){o(r)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,l);a((t=t.apply(e,r)).next())});import{ah as c,ad as u,ai as p,f as m,aj as h,n as f,ak as g,al as b,am as y,an as x,W as v,P as w,u as S,d as j,B as k,j as P,T as U,e as R,ao as T,ap as E,aq as C,ar as W,as as L,X as M}from"./index-064wTBYr.js";import{r as I,g as $}from"./react-vendor-Do6BM2ij.js";import{S as O}from"./index-C-TGCETp.js";import{C as z}from"./ContentCopyRounded-DWuYr9xz.js";import{E as A}from"./EmailRounded-B7RT5qPv.js";import{_ as D}from"./pdf-vendor-lib-BZh8gbg-.js";import{copyTextToClipboard as B,uploadRecordingForShare as _}from"./recordingShareService-B465gFN2.js";import{V as F,b as N}from"./VideoRetentionAlert-CLsgN2an.js";import{T as H}from"./TextField-CS30EfJ0.js";import{L as V}from"./LinearProgress-DZuyDf3c.js";import X from"./ReturnBack-CmQN4vlg.js";import"./amcharts-vendor-BHootuuA.js";import"./doc-vendor-ppt-DPgCsEbC.js";import"./doc-vendor-excel-DttRKF0n.js";import"./html2canvas-vendor-aB19RaoZ.js";import"./phone-vendor-ByODWvOt.js";import"./pdf-vendor-core-hcP1TG0J.js";import"./popper-vendor-C5VukO4T.js";import"./objectSpread2-CRrzmkLf.js";import"./defineProperty-DEXQ6WRD.js";import"./objectWithoutProperties-D-qfjEF8.js";import"./index-BNthIJcY.js";import"./Alert-DRZGeoiI.js";import"./index-DVySXEvS.js";import"./useSlot-GO0Hinu0.js";import"./Close-B0Gb0gng.js";import"./FormControl-DjZYC5r9.js";import"./usePreviewMode-B4-hsAJB.js";import"./AccordionScrollToTop-B912giGh.js";import"./Skeleton-DdQ7MZ25.js";function Y(e){var r;return(null==(r=e.type)?void 0:r.includes("mp4"))?"mp4":"webm"}function K(e){return e===c.MP4?"video/mp4":"video/webm"}function q(e){if(!e)return!1;if("ERR_NETWORK"===e.code)return!0;const r=String(e.message||"");return/network error|failed to fetch|could not reach/i.test(r)}function Q(e,r){u.saveAs(e,r)}function G(e,r){return d(this,null,function*(){const t=function(e){return`${f.apiUrl.replace(/\/+$/,"")}/public-files/tempFiles/${encodeURIComponent(e)}`}(e),n=yield fetch(t);if(!n.ok)throw new Error("Converted file could not be downloaded.");null==r||r(.9);const o=yield n.blob();return null==r||r(1),o})}function J(e,r){return d(this,arguments,function*(e,r,{accessToken:t,onProgress:n}={}){const o=[];if(t)try{return yield function(e,r,t,n){return d(this,null,function*(){var o;if(!t)throw new Error("Sign in to convert recordings to MP4.");const i=Y(e),l=new FormData;l.append("media",p(e,`recording.${i}`,K(i))),l.append("format",r);const{data:a}=yield m.post("video-editor/media-format-converter",l,{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"},onUploadProgress:e=>{e.total&&(null==n||n(Math.min(.5,e.loaded/e.total*.5)))},timeout:0,maxBodyLength:1/0,maxContentLength:1/0}),s=null==(o=null==a?void 0:a.data)?void 0:o.fileName;if(!s)throw new Error((null==a?void 0:a.message)||"Conversion failed.");return null==n||n(.55),G(s,n)})}(e,r,t,n)}catch(i){o.push(i)}try{return yield function(e,r,t){return d(this,null,function*(){const n=Y(e),o=new FormData;o.append("file",p(e,`recording.${n}`,K(n))),o.append("format",r);const i={};i["X-API-Key"]=f.apiKey;const{data:l,headers:a}=yield h.post(`${f.toolsApiUrl}audio/media-format-converter`,o,{headers:i,responseType:"blob",timeout:0,maxBodyLength:1/0,maxContentLength:1/0,onUploadProgress:e=>{e.total&&(null==t||t(Math.min(.45,e.loaded/e.total*.45)))},onDownloadProgress:e=>{e.total&&(null==t||t(.45+e.loaded/e.total*.55))}}),s=a["content-type"]||K(r);if(s.includes("application/json")){const e=yield l.text();let r="Conversion failed.";try{const t=JSON.parse(e);r=(null==t?void 0:t.message)||(null==t?void 0:t.error)||r}catch(d){e.trim()&&(r=e.slice(0,280))}throw new Error(r)}return null==t||t(1),new Blob([l],{type:s})})}(e,r,n)}catch(i){o.push(i)}throw new Error(function(e,{accessToken:r,targetFormat:t}={}){const n=e.map(e=>
2null==e?void 0:e.message).filter(Boolean),o=e.some(q);return t===c.MP4&&!r&&o?"MP4 conversion needs sign-in (uses your LawWiz API) or a reachable tools server. Download WebM works instantly without conversion.":o?"Could not reach the conversion server. Sign in, confirm VITE_API_URL points to your running admin API, then try again.":n[0]||"Video conversion failed."}(o,{accessToken:t,targetFormat:r}))})}function Z(e){return e?`${e.size}:${e.type}:${e.lastModified||0}`:""}function ee(e,{autoUpload:r=!1,accessToken:t="",title:n="",initialShareUrl:o="",libraryId:i=""}={}){const[l,a]=I.useState(e||null),[s,u]=I.useState(0),[p,m]=I.useState(0),[h,f]=I.useState(0),[v,w]=I.useState(null),[S,j]=I.useState(!1),[k,P]=I.useState(!1),[U,R]=I.useState(!1),[T,E]=I.useState(0),[C,W]=I.useState(""),[L,M]=I.useState(o||""),[$,O]=I.useState(!1),z=I.useRef(""),A=I.useRef(""),F=x,N=I.useCallback(e=>d(null,null,function*(){if(!e||A.current===e)return!1;const r=yield B(e);return r&&(A.current=e,O(!0),setTimeout(()=>O(!1),2500)),r}),[]);I.useEffect(()=>{e&&a(e)},[e]),I.useEffect(()=>{o&&(M(o),l&&(z.current=Z(l)),N(o))},[o,l,N]),I.useEffect(()=>{if(!l)return;let e=!1;return d(null,null,function*(){try{const r=yield g(l);e||(u(r),f(r));const t=yield b(l,Math.min(.5,r/2));e||w(t)}catch(r){e||W(r.message)}}),()=>{e=!0}},[l]);const H=I.useCallback((...e)=>d(null,[...e],function*({accessToken:e=t,title:r=n,force:o=!1}={}){if(!l)return null;const a=Z(l);
2if(!o&&(L||z.current===a))return L?{shareUrl:L}:null;R(!0),E(0),W(""),O(!1);try{const t=yield _(l,{title:r,durationMs:s>0?1e3*s:void 0,thumbnail:v,accessToken:e,onProgress:E});if(z.current=a,M(t.shareUrl),i){const{updateRecordingLibraryShareUrl:e}=yield D(()=>d(null,null,function*(){const{updateRecordingLibraryShareUrl:e}=yield import("./index-064wTBYr.js").then(e=>e.eS);return{updateRecordingLibraryShareUrl:e}}),__vite__mapDeps([0,1,2,3]));yield e(i,t.shareUrl),window.dispatchEvent(new Event("vm-library-updated"))}return yield N(t.shareUrl),t}catch(c){return W(c.message),null}finally{R(!1),E(0)}}),[t,l,s,v,n,N,L,i]);I.useEffect(()=>{if(!(r&&t&&l&&v))return;if(o||L)return;const e=Z(l);if(z.current===e)return;let n=!1;return d(null,null,function*(){n||(yield H())}),()=>{n=!0}},[r,t,l,v,o,L,H,i]);const V=I.useCallback(()=>d(null,null,function*(){if(!l)return null;j(!0),E(0),W("");try{const e=yield y(l,p,h,{quality:F,format:c.WEBM,onProgress:E});z.current="",A.current="",M(""),a(e);const r=yield g(e);u(r),m(0),f(r);const t=yield b(e);return w(t),e}catch(e){return W(e.message),null}finally{j(!1),E(0)}}),[l,p,h,F]),X=I.useCallback(e=>d(null,null,function*(){if(!l)return null;P(!0),E(0),W("");try{return yield function(e,r){return d(this,arguments,function*(e,r,{onProgress:t,accessToken:n}={}){if(!e||0===e.size)throw new Error("No recording to download.");const o=r===c.MP4?c.MP4:c.WEBM,i=Y(e),l=Date.now();if(o===i)return null==t||t(1),void Q(e,`recording-${l}.${o}`);null==t||t(.05),Q(yield J(e,o,{accessToken:n,onProgress:t}),`recording-${l}.${o}`)})}(l,e,{onProgress:E,accessToken:t}),l}catch(r){return W(r.message),null}finally{P(!1),E(0)}}),[t,l]),K=I.useCallback(()=>d(null,null,function*(){if(!L)return!1;const e=yield B(L);return O(e),e&&setTimeout(()=>O(!1),2500),e}),[L]);return{blob:l,duration:s,trimStart:p,trimEnd:h,setTrimStart:m,setTrimEnd:f,thumbnail:v,processing:S,downloading:k,uploading:U,progress:T,error:C,shareUrl:L,copySuccess:$,applyTrim:V,handleDownload:X,saveAndShare:H,copyShareLink:K}}function re(e){const r=Math.floor(e/60),t=Math.floor(e%60);return`${r}:${String(t).padStart(2,"0")}`}const te={display:"block",fontSize:12,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.04em",color:"#000",mb:1},ne={mb:1.25,fontSize:13,color:"#000",lineHeight:1.45},oe={borderRadius:"12px",px:1.75,py:1.25,fontWeight:700,textTransform:"none",border:"1px solid",borderColor:"rgba(0, 0, 0, 0.1)",bgcolor:"#fff",color:"#000","&:hover":{bgcolor:"#fff",borderColor:"rgba(0, 0, 0, 0.16)"}};function ie({initialBlob:e,initialSrc:r="",initialShareUrl:t="",libraryId:n="",title:o="Your recording",variant:i="page",hideLogo:l=!1}){const u="modal"===i,p=v(),m=w(p.breakpoints.down("md")),h=p.palette.primary.main,f=p.palette.primary.light,g=p.palette.primary.contrastText,b=`linear-gradient(135deg, ${h} 0%, ${f} 100%)`,{accessToken:y,isAuthenticated:x,user:C}=S(),W=Boolean(y),L=(null==C?void 0:C.name)||"",M=ee(e,{autoUpload:W&&!t,accessToken:y,title:o,initialShareUrl:t,libraryId:n}),[$,D]=I.useState(""),B=M.blob||e,_=M.processing||M.uploading,X=M.downloading,Y=_||X;I.useEffect(()=>{if(r){if((r.startsWith("http://127.0.0.1/")||r.startsWith("http://localhost/"))&&"undefined"!=typeof window&&window.ReactNativeWebView){let e=!1;return d(null,null,function*(){try{const t=yield fetch(r);if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=yield t.blob(),o=yield new Promise((e,r)=>{const t=new FileReader;t.onload=()=>{"string"==typeof t.result?e(t.result):r(new Error("Failed to read video"))},t.onerror=()=>r(new Error("Failed to read video")),t.readAsDataURL(n)});e||D(o)}catch(t){e||D(r)}}),()=>{e=!0}}return void D(r)}if(!B)return void D("");const e=URL.createObjectURL(B);return D(e),()=>URL.revokeObjectURL(e)},[B,r]);return j(k,{sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"100%",minWidth:0,color:"#000",boxSizing:"border-box"},children:[P(k,{component:u||l?"div":"a",href:u||l?void 0:"/","aria-label":u||l?void 0:"Go to home page",sx:{display:u||l?"none":"block",width:{xs:"70%",sm:300},maxWidth:360,mx:"auto",mt:2,mb:3.5,lineHeight:0},children:P(k,{component:"img",src:"/assets/images/lawwiz-your-global-legal-partner.svg",alt:"LawWiz",sx:{dis
2play:"block",width:"100%",height:"auto"}})}),j(k,{sx:{display:"grid",gridTemplateColumns:m?"1fr":"minmax(0, 3fr) minmax(0, 1.15fr)",gap:2.5,alignItems:"stretch",width:"100%",minWidth:0},children:[P(k,{sx:{display:"flex",alignItems:"center",justifyContent:"center",minWidth:0},children:P(k,{sx:{width:"100%",aspectRatio:"16 / 9",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"16px",overflow:"hidden",bgcolor:"#000",boxShadow:"0 18px 44px rgba(0, 0, 0, 0.2)"},children:P(k,$?{component:"video",src:$,controls:!0,playsInline:!0,preload:"auto",sx:{width:"100%",height:"100%",display:"block",objectFit:"contain"}}:{sx:{width:"100%",height:"100%",minHeight:200,display:"grid",placeItems:"center",color:"rgba(255, 255, 255, 0.6)"},children:"No video loaded"})})}),P(k,{sx:{display:"flex",alignItems:m?"stretch":"center",justifyContent:"center",minWidth:0},children:j(k,{sx:{display:"flex",flexDirection:"column",width:"100%",p:2.25,borderRadius:"16px",bgcolor:"rgba(255, 255, 255, 0.96)",border:"1px solid rgba(0, 0, 0, 0.06)",boxShadow:"0 12px 32px rgba(0, 0, 0, 0.08)",height:"fit-content"},children:[P(U,{component:"h2",sx:{m:0,mb:2,fontSize:"1.2rem",fontWeight:700},children:o}),P(F,{}),M.duration>0?j(k,{sx:{mb:2.25},children:[P(U,{component:"label",sx:te,children:"Trim"}),P(O,{range:!0,min:0,max:M.duration,step:.1,value:[M.trimStart,M.trimEnd],onChange:([e,r])=>{M.setTrimStart(e),M.setTrimEnd(r)}}),j(k,{sx:{display:"flex",justifyContent:"space-between",fontSize:12,my:.75,mb:1.25,color:"#000"},children:[P("span",{children:re(M.trimStart)}),P("span",{children:re(M.trimEnd)})]}),P(R,{variant:"outlined",onClick:M.applyTrim,disabled:_,sx:oe,children:"Apply trim"})]}):null,j(k,{sx:{mb:2},children:[P(U,{component:"label",sx:te,children:"Share link"}),W?M.uploading?P(U,{sx:ne,children:"Uploading your recordingâ¦"}):M.shareUrl?P(U,{sx:ne,children:"Your recording is saved. The share link has been copied to your clipboard."}):P(U,{sx:ne,children:"Preparing your share linkâ¦"}):P(U,{sx:ne,children:x?"Finishing sign-in⦠refresh if upload does not start.":"Sign in to automatically save and get a share link."}),W&&(M.shareUrl||M.uploading)?j(k,{sx:{mt:1.25},children:[P(H,{size:"small",fullWidth:!0,value:M.uploading?"Uploadingâ¦":M.shareUrl,InputProps:{readOnly:!0},"aria-label":"Share link",sx:{"& .MuiOutlinedInput-root":{borderRadius:"10px",fontSize:13,bgcolor:"#fff"},"& .MuiInputBase-input":{color:"#000"}}}),j(k,{sx:{display:"flex",flexWrap:"wrap",gap:1,mt:1},children:[P(R,{onClick:M.copyShareLink,disabled:!M.shareUrl,startIcon:P(z,{fontSize:"small"}),sx:s(a({},oe),{bgcolor:b,color:g,border:"none","&:hover":{bgcolor:b,opacity:.92,border:"none"}}),children:M.copySuccess?"Copied!":"Copy"}),P(R,{onClick:()=>{if(!M.shareUrl)return;const{subject:e,message:r}=N({userName:L,shareUrl:M.shareUrl});E(e,r)},disabled:!M.shareUrl,"aria-label":"Email video messenger",startIcon:P(A,{fontSize:"small"}),sx:oe,children:"Email"})]})]}):null,W&&M.error&&!M.uploading?P(R,{onClick:()=>M.saveAndShare({force:!0}),disabled:_,sx:s(a({},oe),{mt:1.25}),children:"Retry upload"}):null]}),j(k,{sx:{mb:2},children:[P(U,{component:"label",sx:te,children:"Download"}),W?null:P(U,{sx:ne,children:"Sign in to convert and download MP4. WebM downloads the original file."}),j(k,{sx:{display:"flex",flexWrap:"wrap",gap:1.25,mt:1},children:[P(R,{onClick:()=>M.handleDownload(c.WEBM),disabled:X,"aria-label":"Download WebM",title:"Download WebM",startIcon:P(T,{fontSize:"small"}),sx:oe,children:"WebM"}),P(R,{onClick:()=>M.handleDownload(c.MP4),disabled:X,"aria-label":"Download MP4",title:"Download MP4",startIcon:P(T,{fontSize:"small"}),sx:oe,children:"MP4"})]})]}),Y?P(V,{variant:"determinate",value:Math.round(100*M.progress),sx:{height:6,borderRadius:999,mb:1.5,bgcolor:"rgba(0, 0, 0, 0.08)","& .MuiLinearProgress-bar":{borderRadius:999,background:b}}}):null,M.error?P(U,{sx:{color:"error.main",fontSize:13},children:M.error}):null]})})]})]})}const le="/assets/images/lawwiz-your-global-legal-partner.svg";const ae={marginTop:{xxs:"120px",xs:"120px",sm:"110px",md:"110px"},pt:{xs:2.5,sm:3.5}};function se(){const e=v(),[r]=$(),t=r.get("key"),n=r.get("library
2Id"),o="1"===r.get("direct"),i=function(e){if(!e)return"/";try{if(e.startsWith("http://")||e.startsWith("https://")){const r=new URL(e);return`${r.pathname}${r.search}${r.hash}`}return e.startsWith("/")?e:`/${e}`}catch(r){return"/"}}(r.get("returnTo")),[l,c]=I.useState(null),[u,p]=I.useState(""),[m,h]=I.useState(""),[f,g]=I.useState("loading"),b=I.useRef("");I.useEffect(()=>{if(o){let e="",t="video/mp4";try{e=sessionStorage.getItem("vm_direct_play_url")||"",t=sessionStorage.getItem("vm_direct_play_mime")||"video/mp4"}catch(r){}if(!e)return g("missing"),c(null),void p("");if(p(e),h(""),e.startsWith("data:"))try{const[r="",n=""]=e.split(","),o=r.match(/data:([^;]+)/i),i=(null==o?void 0:o[1])||t,l=window.atob(n),a=new Uint8Array(l.length);for(let e=0;e<l.length;e+=1)a[e]=l.charCodeAt(e);c(new Blob([a],{type:i}))}catch(r){c(null)}else c(null);return void g("ready")}if(!C(t))return g("missing"),c(null),void p("");let e=!1;return g("loading"),d(null,null,function*(){const[r,o]=yield Promise.all([W(t),n?L(n):Promise.resolve(null)]);if(e)return;if(!(null==r?void 0:r.blob)||0===r.blob.size)return c(null),h(""),void g("missing");b.current&&URL.revokeObjectURL(b.current);const i=r.mime||r.blob.type||"video/webm",l=r.blob.type&&"application/octet-stream"!==r.blob.type?r.blob:new Blob([r.blob],{type:i});b.current=URL.createObjectURL(l),h((null==o?void 0:o.shareUrl)||""),c(l),p(""),g("ready")}),()=>{e=!0}},[t,n,o]),I.useEffect(()=>{if(!n||"ready"!==f)return;const e=()=>d(null,null,function*(){const e=yield L(n);(null==e?void 0:e.shareUrl)&&h(e.shareUrl)});return window.addEventListener("vm-library-updated",e),()=>window.removeEventListener("vm-library-updated",e)},[n,f]),I.useEffect(()=>()=>{b.current&&(URL.revokeObjectURL(b.current),b.current="")},[t]);const y={className:"vmPlaybackShell",minHeight:"100vh",width:"100%",maxWidth:"100vw",overflowX:"hidden",boxSizing:"border-box",bgcolor:"primary.light",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-start",p:{xs:1.5,sm:2},pt:{xs:2,sm:3},gap:2,"--vm-primary":e.palette.primary.main,"--vm-primary-light":e.palette.primary.light,"--vm-primary-contrast":e.palette.primary.contrastText,"--vm-gradient":`linear-gradient(135deg, ${e.palette.primary.main} 0%, ${e.palette.primary.light} 100%)`};return"loading"===f?P(k,{sx:y,children:P(M,{color:"primary"})}):j(k,"missing"===f||!l&&!u?{sx:y,children:[P(I.Suspense,{fallback:null,children:P(X,{returnTo:i,logoSrc:le,transparentHeader:!0,topOffset:{xs:"12px",sm:"20px"}})}),P(k,{sx:s(a({},ae),{textAlign:"center"}),children:P(U,{color:"text.primary",children:"Recording not found or expired."})})]}:{sx:y,children:[P(I.Suspense,{fallback:null,children:P(X,{returnTo:i,logoSrc:le,transparentHeader:!0,topOffset:{xs:"12px",sm:"20px"}})}),P(k,{sx:a({width:"100%",maxWidth:1200,minWidth:0,boxSizing:"border-box"},ae),children:P(ie,{initialBlob:l,initialSrc:u,initialShareUrl:m,libraryId:n||"",title:"Your Recording",hideLogo:!0})})]})}export{se 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.