1import{cl as v,r as n,j as e}from"./vendor-BBNELK6W_bundle.js";import"./registration-8fW6h2tH_bundle.js";import"./moment-Dt2i7U-U_bundle.js";import"./index-yTdTJQbB_bundle.js";import{t as x}from"./analytics-BM8fH6TW_bundle.js";import{B as g}from"./Button-Bn0wcnb1_bundle.js";import{D as j,a as b,b as D,c as w,d as E,e as T,f as k}from"./Dialog-BIzCqd-G_bundle.js";import{T as y}from"./Text-DAosVweU_bundle.js";import{u as N}from"./useSageAttachmentsStore-8N-vMwgV_bundle.js";import{r as R}from"./speedboat-vendor-DJ0pA_pR_bundle.js";import"./sentry-Bq-jBV13_bundle.js";import"./datadog-DxmyjtSX_bundle.js";import"./slackIntegration-CyZu6SDu_bundle.js";import"./stripe-rL9tfl_U_bundle.js";import"./speedboat-sage-vendor-CFyq5UB-_bundle.js";const G=({open:l,onOpenChange:d,onCaptured:f})=>{const{t:s}=v(),p=N(t=>t.addImages),i=n.useRef(null),m=n.useRef(null),[u,o]=n.useState("starting");n.useEffect(()=>{if(!l)return;let t=!1;o("starting");const a=navigator.mediaDevices?.getUserMedia?.bind(navigator.mediaDevices);if(!a){o("error");return}return a({video:{facingMode:"environment"}}).then(r=>{if(t){r.getTracks().forEach(c=>c.stop());return}m.current=r,i.current&&(i.current.srcObject=r),o("live")}).catch(()=>{t||o("error")}),()=>{t=!0,m.current?.getTracks().forEach(r=>r.stop()),m.current=null}},[l]);const h=()=>{const t=i.current;if(!t)return;const a=document.createElement("canvas");a.width=t.videoWidth||1280,a.height=t.videoHeight||720;const r=a.getContext("2d");r&&(r.drawImage(t,0,0,a.width,a.height),a.toBlob(c=>{c&&(x("add_sage_attachment",{source:"camera",files_count:1}),p([new File([c],`camera-${Date.now()}.jpg`,{type:"image/jpeg"})]),f?.(),d(!1))},"image/jpeg",.92))};return e.jsx(j,{open:l,onOpenChange:d,children:e.jsxs(b,{className:"max-w-md",children:[e.jsxs(D,{children:[e.jsx(w,{children:s("speedboat.sage.attachments.camera.title")}),e.jsx(E,{children:s("speedboat.sage.attachments.camera.description")})]}),e.jsx(T,{children:e.jsxs("div",{className:"relative aspect-video w-full overflow-hidden rounded-xl bg-muted",children:[e.jsx("video",{ref:i,autoPlay:!0,playsInline:!0,muted:!0,className:"size-full object-cover","aria-label":s("speedboat.sage.attachments.camera.title")}),u!=="live"&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4",children:e.jsx(y,{variant:"caption",tone:"muted",align:"center",children:s(u==="error"?"speedboat.sage.attachments.camera.error":"speedboat.sage.attachments.camera.starting")})})]})}),e.jsxs(k,{children:[e.jsx(g,{variant:"ghost",onClick:()=>d(!1),children:s("speedboat.sage.attachments.camera.cancel")}),e.jsxs(g,{onClick:h,disabled:u!=="live",children:[e.jsx(R,{className:"size-4"}),s("speedboat.sage.attachments.camera.capture")]})]})]})})};export{G as SageCameraDialog}; 2//# sourceMappingURL=SageCameraDialog-DGXT3y7__bundle.js.map
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.