1var Ge=Object.defineProperty;var Xe=(e,r,o)=>r in e?Ge(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o;var Ie=(e,r,o)=>Xe(e,typeof r!="symbol"?r+"":r,o);import{j as t,r as a}from"./index-Cb0uFkxi.js";import{s as Me,F as $e}from"./client-3Rgyq3FX.js";import{S as Ne,s as Ze,a as Je,R as Qe,b as et,c as Pe,v as tt,d as Ae}from"./SpeakerIntake-usLDvEjs.js";import{R as rt}from"./ResponsiveImage-D5MpvFHD.js";import{C as nt}from"./circle-check-uJwwcGRG.js";import"./tslib.es6-CmEaCU22.js";import"./Footer-17KnCj-2.js";import"./button-BXT4L8KI.js";import"./siteNavigation-xQOaOE9I.js";import"./index-DSefd6az.js";import"./chevron-down-CNHxCdIc.js";import"./sheet-CL-fb0Ux.js";import"./index-DAxeAWUx.js";import"./input-CyLPhXcX.js";import"./SpeakerCard-DPLMpqLA.js";import"./slug-DGhkVI3i.js";import"./speakerProfile-D9KA5aXA.js";import"./user-swbnXxv0.js";import"./loader-circle-DoSMiK1s.js";import"./circle-alert-YAiWaoHE.js";const at=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 640" width="100%" height="100%" fill="none" aria-hidden="true"> 2 <title>Speaker framing guide</title> 3 <g stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.58"> 4 <!-- Head outline: the crown sits at roughly 20% of the portrait frame. --> 5 <path d="M180 128c-43 0-73 34-73 82v27c0 48 30 84 73 84s73-36 73-84v-27c0-48-30-82-73-82Z"/> 6 <!-- Neck and shoulders framing the subject without filling the face. --> 7 <path d="M150 321v30c0 12-7 22-19 27l-47 20c-32 14-53 45-53 80v34"/> 8 <path d="M210 321v30c0 12 7 22 19 27l47 20c32 14 53 45 53 80v34"/> 9 <path d="M31 512v20c0 22 18 40 40 40h218c22 0 40-18 40-40v-20"/> 10 </g> 11</svg> 12`,ie=1080,ue=1920,ze="/speaker-studio/FutureSummit_SpeakerStudio_overlay_v4_1080x1920_transparent.png";function We(e,r){if(!Number.isFinite(e)||!Number.isFinite(r)||e<=0||r<=0)throw new Error("speaker_video_dimensions_invalid");const o=r>=e?Math.max(ie/e,ue/r):ie/e,d=Math.round(e*o),m=Math.round(r*o);return{x:Math.round((ie-d)/2),y:Math.round((ue-m)/2),width:d,height:m}}const J="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#d9be81] focus-visible:ring-offset-2 focus-visible:ring-offset-[#111]",He=`rounded-md bg-[#d9be81] px-4 py-2 text-sm font-medium text-[#171512] ${J} disabled:cursor-not-allowed disabled:opacity-50`;function ot({onContinue:e,onFallback:r,fallbackLabel:o="Can't record here? Upload a video file instead"}){return t.jsxs("section",{"aria-labelledby":"permission-title",className:"space-y-4 rounded-lg border border-white/10 bg-[#111] p-5 text-white",children:[t.jsx("h2",{id:"permission-title",className:"text-lg font-medium",children:"Set up your camera and microphone"}),t.jsx("p",{className:"text-sm text-[#b8b1a8]",children:"We use your camera and microphone only to make this recording. Your browser will ask for permission after you choose to continue."}),t.jsxs("div",{className:"flex flex-wrap gap-3",children:[t.jsx("button",{type:"button",className:He,onClick:e,children:"Continue to camera setup"}),r&&t.jsx("button",{type:"button",className:`rounded-md border border-white/20 px-4 py-2 text-sm text-white ${J}`,onClick:r,children:o})]})]})}function st({stream:e,mirrored:r=!0,environmentHint:o="Choose a quiet, well-lit spot. Keep the camera at eye level, face the camera, and use a simple background.",audioHint:d="Stay centred in the guide with consistent headroom and keep your face and upper torso inside the safe area.",cameraOptions:m,microphoneOptions:s,cameraValue:n,microphoneValue:l,onCameraChange:p,onMicrophoneChange:h}){return t.jsxs("section",{className:"space-y-3",children:[t.jsxs("div",{className:"relative mx-auto aspect-[9/16] max-h-[70vh] overflow-hidden rounded-lg bg-black",children:[t.jsx("video",{ref:x=>{x&&x.srcObject!==e&&(x.srcObject=e)},autoPlay:!0,muted:!0,playsInline:!0,className:`h-full w-full object-cover ${r?"-scale-x-100":""}`,"aria-label":"Live camera preview"}),t.jsx("div",{className:"pointer-events-none absolute inset-0","aria-hidden":"true",dangerouslySetInnerHTML:{__html:at}}),t.jsx("div",{className:"pointer-events-none absolute inset-[8%] rounded border-2 border-dashed border-white/60","aria-hidden":"true"}),t.jsx("p",{className:"absolute bottom-3 left-3 right-3 rounded bg-black/60 p-2 text-xs text-white",children:"Portrait or landscape accepted"})]}),t.jsxs("div",{className:"text-sm text-[#b8b1a8]",children:[t.jsx("p",{children:o}),t.jsx("p",{children:d})]}),(m||s)&&t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[m&&t.jsxs("label",{className:"text-sm",children:["Camera",t.jsx("select",{"aria-label":"Camera",value:n,onChange:p,className:`mt-1 w-full rounded border border-white/20 bg-[#111] p-2 ${J}`,children:m.map(x=>t.jsx("option",{value:x.value,children:x.label},x.value))})]}),s&&t.jsxs("label",{className:"text-sm",children:["Microphone",t.jsx("select",{"aria-label":"Microphone",value:l,onCh
12ange:h,className:`mt-1 w-full rounded border border-white/20 bg-[#111] p-2 ${J}`,children:s.map(x=>t.jsx("option",{value:x.value,children:x.label},x.value))})]})]})]})}function it({count:e}){return e<=0?null:t.jsx("div",{className:"rounded bg-black/80 p-6 text-center text-6xl font-semibold text-white",role:"status","aria-live":"assertive","aria-label":`Recording starts in ${e}`,children:e})}function dt({script:e,visible:r=!0,onToggle:o}){return t.jsxs("section",{"aria-label":"Teleprompter",className:"space-y-2",children:[r&&t.jsx("p",{className:"whitespace-pre-line rounded border border-white/10 bg-[#111] p-4 text-white",children:e}),o&&t.jsx("button",{type:"button",className:`rounded border border-white/20 px-3 py-2 text-sm text-white ${J}`,onClick:o,children:r?"Hide script":"Show script"})]})}function De({url:e,onRetake:r,title:o="Review your recording"}){const[d,m]=a.useState(null),s=(d==null?void 0:d.url)===e?d:null,n=s&&We(s.width,s.height),l=p=>{p.videoWidth>0&&p.videoHeight>0&&m({url:e,width:p.videoWidth,height:p.videoHeight})};return t.jsxs("section",{"aria-labelledby":"review-title",className:"space-y-3",children:[t.jsx("h2",{id:"review-title",className:"text-lg text-white",children:o}),n?t.jsxs("div",{className:"relative mx-auto aspect-[9/16] max-h-[70vh] w-full max-w-[calc(70vh*9/16)] overflow-hidden rounded-lg bg-black",children:[t.jsx("video",{src:e,controls:!0,playsInline:!0,onLoadedMetadata:p=>l(p.currentTarget),className:"absolute",style:{left:`${n.x/ie*100}%`,top:`${n.y/ue*100}%`,width:`${n.width/ie*100}%`,height:`${n.height/ue*100}%`},"aria-label":"Recording playback"}),t.jsx(rt,{src:ze,className:"pointer-events-none absolute inset-0 h-full w-full",alt:"",width:1080,height:1920,"aria-hidden":!0})]}):t.jsx("video",{src:e,controls:!0,playsInline:!0,onLoadedMetadata:p=>l(p.currentTarget),className:"mx-auto aspect-[9/16] max-h-[70vh] rounded-lg bg-black","aria-label":"Recording playback"}),t.jsx("button",{type:"button",className:`rounded-md border border-white/20 px-4 py-2 text-sm text-white ${J}`,onClick:r,children:"Retake recording"})]})}function lt({consent:e,onConsentChange:r,consentText:o,attestation:d,onAttestationChange:m,consentVersion:s,attestationOptions:n=["I am the speaker","I am submitting on the speaker's behalf"]}){const[l,p=""]=o.split("Terms & Conditions"),[h,x=""]=p.split("Privacy Policy");return t.jsxs("fieldset",{className:"space-y-3 text-sm text-white",children:[t.jsxs("label",{className:"flex gap-2",children:[t.jsx("input",{type:"checkbox",checked:e,onChange:c=>r(c.target.checked),className:J,required:!0}),t.jsxs("span",{children:[l,t.jsx("a",{href:"/terms",target:"_blank",rel:"noopener",className:"underline",children:"Terms & Conditions"}),h,t.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener",className:"underline",children:"Privacy Policy"}),x," ",t.jsxs("span",{className:"text-[#b8b1a8]",children:["(v",s,")"]})]})]}),t.jsxs("label",{className:"block",children:["Submitter attestation",t.jsxs("select",{required:!0,value:d,onChange:c=>m(c.target.value),className:`mt-1 w-full rounded border border-white/20 bg-[#111] p-2 ${J}`,children:[t.jsx("option",{value:"",children:"Select one"}),n.map(c=>t.jsx("option",{value:c,children:c},c))]})]})]})}function ct({onChange:e,error:r,helpText:o="Accepted formats: MP4, WebM or MOV."}){return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("label",{className:"block text-sm text-white",children:["Choose an MP4, WebM or MOV video file",t.jsx("input",{type:"file",accept:"video/webm,video/mp4,video/quicktime",onChange:d=>{var m;return e(((m=d.target.files)==null?void 0:m[0])??null)},className:`mt-1 block w-full text-sm text-white ${J}`})]}),t.jsx("p",{className:"text-xs text-[#b8b1a8]",children:o}),r&&t.jsx("p",{role:"alert",className:"text-sm text-red-300",children:r})]})}function ut({progress:e,state:r,onRetry:o}){return t.jsxs("section",{"aria-live":"polite",className:"space-y-2 text-sm text-white",children:[t.jsx("p",{children:r}),t.jsx("progress",{value:e,max:100,"aria-label":`Upload ${e}% complete`,className:"w-full"}),o&&t.jsx("button",{type:"button",className:He,onClick:o,children:"Retry upload"})]})}function pt({message:e="The Future Summit team reviews every submission. The speaker will be emailed if a re-record is needed, and can return to this same link any time to record a replacement."}){return t.jsxs("section",{role:"status",className:"rounded-lg border border-emerald-400/40 bg-[#111] p-5 text-white",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(nt,{className:"size-5 text-[#d9be81]","aria-hidden":"true"}
12),t.jsx("h2",{className:"text-lg font-medium",children:"Thank you â your video is in!"})]}),t.jsx("p",{className:"mt-2 text-sm text-[#b8b1a8]",children:e})]})}const mt=[["Which camera should I use?","your computer's built-in camera or your phone held upright. Avoid virtual cameras (OBS, Camo, teleprompter apps) â they can send a shrunken picture with black bars that ends up in your video."],["How long should my video be?","15â30 seconds; recording stops itself at 30. The on-screen script guides you."],["Can I redo it?","as many takes as you like before submitting, and you can replace it any time after with the same link."],["What happens after I submit?","we add the Future Summit frame automatically, our team reviews it, and once approved + published it appears on your speaker page. You'll get an email confirmation at each step."],["Can my assistant do this for me?","yes, this link can be shared with whoever manages your profile; there's an option to say who's submitting."],["Uploading a file instead?","MP4, WebM or MOV, 15â30 seconds, under 75 MB."],["Something's not working?","the error message shows a code in brackets; reply to any of our emails with that code and we'll fix it fast."]];function Le(){return t.jsxs("section",{"aria-labelledby":"speaker-studio-faq-title",className:"space-y-3 border-t border-white/10 pt-5",children:[t.jsx("h2",{id:"speaker-studio-faq-title",className:"text-lg font-medium text-white",children:"Common questions"}),t.jsx("div",{className:"space-y-2",children:mt.map(([e,r])=>t.jsxs("details",{className:"rounded-lg border border-white/10 bg-[#111]",children:[t.jsx("summary",{className:`cursor-pointer px-4 py-3 text-sm font-medium text-white marker:text-[#d9be81] ${J}`,children:e}),t.jsx("p",{className:"border-t border-white/10 px-4 py-3 text-sm text-[#b8b1a8]",children:r})]},e))})]})}function ht(e,r){return{video:{facingMode:"user",width:{ideal:1080},height:{ideal:1920},aspectRatio:{ideal:9/16},...e?{deviceId:{exact:e}}:{}},audio:r?{deviceId:{exact:r}}:!0}}function Ue(e){return e?Je(r=>e.isTypeSupported(r)):null}function qe(e){return/built-in|facetime|integrated/i.test(e)}const Ve=e=>{if(e instanceof DOMException){if(e.name==="NotAllowedError"||e.name==="SecurityError")return"camera_permission_denied";if(e.name==="NotFoundError")return"camera_or_microphone_not_found";if(e.name==="NotReadableError")return"camera_or_microphone_unavailable"}return"camera_setup_failed"};function ft({countdownSeconds:e=3,maxDurationMs:r=Ne}={}){const[o,d]=a.useState(null),[m,s]=a.useState(null),[n,l]=a.useState(null),[p,h]=a.useState("idle"),[x,c]=a.useState(null),[Q,A]=a.useState(0),[M,f]=a.useState(0),[F,_]=a.useState(!1),[T,W]=a.useState(null),[H,ee]=a.useState("unavailable"),[B,te]=a.useState([]),[re,ne]=a.useState([]),[v,ae]=a.useState(""),[X,D]=a.useState(""),[Z,L]=a.useState(!1),I=a.useRef(new Set),$=a.useRef(null),R=a.useRef(null),j=a.useRef(null),Y=a.useRef(0),U=a.useRef(!1),q=a.useRef(new Set),V=a.useRef(null),y=a.useRef(0),me=a.useRef(!1),oe=a.useRef(!1),se=a.useRef(null),E=a.useCallback(()=>{R.current!==null&&window.clearInterval(R.current),j.current!==null&&window.clearInterval(j.current),R.current=null,j.current=null},[]),K=a.useCallback(()=>{var u;(u=V.current)==null||u.call(V),V.current=null,I.current.forEach(g=>g.getTracks().forEach(S=>S.stop())),I.current.clear(),d(null),W(null),ee("unavailable")},[]),G=a.useCallback(()=>{q.current.forEach(u=>URL.revokeObjectURL(u)),q.current.clear(),s(null),l(null)},[]),pe=a.useCallback(()=>{const u=$.current;u&&u.state!=="inactive"&&u.stop()},[]),P=a.useCallback(u=>{y.current+=1,U.current=!0,E(),pe(),$.current=null,K(),u&&G()},[G,E,pe,K]),he=a.useCallback(async()=>{var u;if(!((u=navigator.mediaDevices)!=null&&u.enumerateDevices))return null;try{const g=await navigator.mediaDevices.enumerateDevices(),S=g.filter(b=>b.kind==="videoinput").map(b=>({deviceId:b.deviceId,label:b.label||"Camera"})),i=g.filter(b=>b.kind==="audioinput").map(b=>({deviceId:b.deviceId,label:b.label||"Microphone"}));return te(S),ne(i),{video:S,audio:i}}catch{return null}},[]),de=a.useCallback(u=>{const g=window.AudioContext||window.webkitAudioContext;if(!(!g||u.getAudioTracks().length===0))try{const S=new g,i=S.createAnalyser(),b=S.createMediaStreamSource(u),k=new Uint8Array(i.fftSize);b.connect(i);const w=window.setInterval(()=>{i.getByteTimeDomainData(k);const C=Math.sqrt(k.reduce((O,z)=>O+((z-128)/128)**2,0)/k.length);W(C),ee(C<.015?"quiet":"good")},250);V.current=()=>{window.clearInterval(w),b.disconnect(),i.disconnect(),S.close()}}catch{ee("unavailable")}},[]),fe=a.useCallback(async(u,g)=>{var i,b,k;if(!((i=navigator.mediaDevices)!=null&&i.getUserMedia)){h("unsupported"),c("camera_capture_unsupported");return}if(!Ue(window.MediaRecorder)){h("unsupported"),c("recording_unsupported");return}P(!1),U.current=!1;const S=y.current;
12h("requesting_permission"),c(null);try{const w=await navigator.mediaDevices.getUserMedia(ht(u,g));if(S!==y.current){w.getTracks().forEach(ce=>ce.stop());return}I.current.add(w),d(w),de(w);const C=await he();if(S!==y.current){w.getTracks().forEach(ce=>ce.stop());return}h("ready");const O=(b=w.getVideoTracks()[0])==null?void 0:b.getSettings().deviceId,z=C==null?void 0:C.video.find(ce=>ce.deviceId===O),be=C==null?void 0:C.video.find(ce=>qe(ce.label));!me.current&&!oe.current&&be&&!qe((z==null?void 0:z.label)??"")&&(oe.current=!0,L(!0),ae(be.deviceId),(k=se.current)==null||k.call(se,be.deviceId,g))}catch(w){if(S!==y.current)return;K(),c(Ve(w)),h(Ve(w)==="camera_permission_denied"?"permission_denied":"error")}},[P,he,de,K]);se.current=fe;const ve=a.useCallback(async()=>{await fe(v,X)},[fe,X,v]),we=a.useCallback(u=>{me.current=!0,L(!1),ae(u)},[]),le=a.useCallback(()=>{E();const u=$.current;(u==null?void 0:u.state)==="recording"&&(h("stopping"),u.stop())},[E]),Re=a.useCallback(()=>{const u=I.current.values().next().value,g=Ue(window.MediaRecorder);if(!u||!g){h(g?"error":"unsupported"),c(g?"camera_not_ready":"recording_unsupported");return}U.current=!1,c(null),A(0),f(e),h("countdown");const S=Date.now();j.current=window.setInterval(()=>{const i=Math.max(0,e-Math.floor((Date.now()-S)/1e3));if(f(i),i>0)return;j.current!==null&&window.clearInterval(j.current),j.current=null;const b=[];try{const k=new window.MediaRecorder(u,{mimeType:g});$.current=k,k.ondataavailable=w=>{w.data.size>0&&b.push(w.data)},k.onerror=()=>{P(!0),c("recording_failed"),h("error")},k.onstop=()=>{if($.current=null,A(O=>Math.min(O,r)),E(),K(),U.current)return;const w=new Blob(b,{type:g});if(w.size===0){c("recording_empty"),h("error");return}G();const C=URL.createObjectURL(w);q.current.add(C),s(w),l(C),h("review")},Y.current=Date.now(),k.start(),h("recording"),R.current=window.setInterval(()=>{const w=Date.now()-Y.current;A(w),Ze(w,r)&&le()},100)}catch{P(!0),c("recording_failed"),h("error")}},100)},[G,E,e,P,le,r,K]),xe=a.useCallback(()=>le(),[le]),ye=a.useCallback(()=>{P(!0),A(0),f(0),c(null),h("idle")},[P]),ge=a.useCallback(()=>{P(!0),A(0),f(0),c(null),h("idle")},[P]),ke=a.useCallback(()=>G(),[G]);return a.useEffect(()=>{var S;const u=(S=window.matchMedia)==null?void 0:S.call(window,"(prefers-reduced-motion: reduce)");if(!u)return;const g=()=>_(u.matches);return g(),u.addEventListener("change",g),()=>u.removeEventListener("change",g)},[]),a.useEffect(()=>{const u=()=>P(!0);return window.addEventListener("pagehide",u),()=>{window.removeEventListener("pagehide",u),P(!0)}},[P]),{stream:o,blob:m,recordingUrl:n,status:p,error:x,elapsedMs:Q,countdown:M,prefersReducedMotion:F,audioLevel:T,audioHint:H,videoDevices:B,audioDevices:re,selectedVideoDeviceId:v,selectedAudioDeviceId:X,autoSelectedBuiltIn:Z,setSelectedVideoDeviceId:we,setSelectedAudioDeviceId:D,requestMedia:ve,startRecording:Re,stopRecording:xe,retake:ye,cancel:ge,releaseRecording:ke}}const bt={invalid_token:"This speaker link is invalid. Please request a new link.",token_expired:"This speaker link has expired. Please request a new link.",token_revoked:"This speaker link is no longer active. Please request a new link.",invalid_mime_type:"Please choose an MP4, WebM or MOV video.",invalid_request:"We could not prepare your upload. Please check your video and try again.",internal_error:"We could not upload your video. Please try again.",size_limit_exceeded:"This video is too large. Please choose a file smaller than 75 MB.",attempt_limit_exceeded:"The upload attempt limit has been reached. Please contact the event team.",rate_limited:"Too many upload attempts were made. Please wait a moment and try again.",upload_authorization_expired:"Your upload link expired. Please try again to get a new one.",upload_not_found:"We could not find the uploaded video. Please try again.",object_path_mismatch:"The upload could not be verified. Please try again.",object_metadata_mismatch:"The uploaded video could not be verified. Please choose the video again and retry.",duration_invalid:"Your video must be between 15 and 30 seconds."},vt=new Set(["invalid_token","token_expired","token_revoked","invali
12d_mime_type","size_limit_exceeded","attempt_limit_exceeded","duration_invalid"]);function Ye(e){return Number.isFinite(e)?Math.min(100,Math.max(0,Math.round(e))):0}function wt(e){return{token:e.token,request_id:e.requestId,mime_type:e.mimeType,size_bytes:e.blob.size,script_version:e.scriptVersion,script_text:e.scriptText,consent_version:e.consentVersion,submitter_attestation:e.submitterAttestation,submitted_by_speaker:e.submittedBySpeaker}}function je(e){const r=(e==null?void 0:e.trim())||"upload_failed";return{code:r,message:bt[r]??`We could not upload your video (code: ${r}). Your video is still available to retry.`,retryable:!vt.has(r)}}function Ke(){return crypto.randomUUID()}function xt(e,r){return r==="upload_authorization_expired"?Ke():e}async function Oe(e,r){const o=r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"?r.error:null;if(o)return o;if(!(e instanceof $e))return null;try{const d=await e.context.clone().json();return typeof d.error=="string"?d.error:null}catch{return null}}function yt(e,r,o,d){return new Promise((m,s)=>{const n=new XMLHttpRequest,l=d==="cloudflare_stream";if(n.open(l?"POST":"PUT",e),l||n.setRequestHeader("Content-Type",r.type),n.upload.onprogress=p=>{p.lengthComputable&&o(Ye(p.loaded/p.total*100))},n.onerror=()=>s(new Error("upload_network_error")),n.onabort=()=>s(new Error("upload_aborted")),n.onload=()=>{n.status>=200&&n.status<300?m():s(new Error(`upload_http_${n.status}`))},l){const p=new FormData;p.append("file",r,`intro.${r.type.includes("webm")?"webm":r.type.includes("quicktime")?"mov":"mp4"}`),n.send(p)}else n.send(r)})}function gt(e,r,o){return new Promise((d,m)=>{const s=new XMLHttpRequest;s.open("POST",e),s.upload.onprogress=l=>{l.lengthComputable&&o(Ye(l.loaded/l.total*100))},s.onerror=()=>m(new Error("upload_network_error")),s.onabort=()=>m(new Error("upload_aborted")),s.onload=()=>s.status>=200&&s.status<300?d():m(new Error(`upload_http_${s.status}`));const n=new FormData;n.append("file",r,`source.${r.type==="video/webm"?"webm":r.type==="video/quicktime"?"mov":"mp4"}`),s.send(n)})}function kt(){const e=a.useRef(null),r=a.useRef(!1),[o,d]=a.useState("idle"),[m,s]=a.useState(0),[n,l]=a.useState(null),[p,h]=a.useState(null),x=a.useCallback(async M=>{if(r.current)return null;r.current=!0,l(null),h(null),s(0);try{d("authorizing");const f=await Me.functions.invoke("create-speaker-video-upload",{body:wt(M)}),F=await Oe(f.error,f.data);if(f.error||F||!f.data)throw je(F);d("uploading"),f.data.upload.provider==="cloudflare_stream"?await gt(f.data.upload.signed_upload_url,M.blob,s):await yt(f.data.upload.signed_upload_url,M.blob,s,f.data.upload.provider),s(100),d("completing");const _=await Me.functions.invoke("complete-speaker-video-upload",{body:{token:M.token,video_id:f.data.video_id,object_path:f.data.upload.path}}),T=await Oe(_.error,_.data);if(_.error||T||!_.data)throw je(T);return h(_.data),d("complete"),_.data}catch(f){const F=_t(f)?f:je(f instanceof Error?f.message:null);return l(F),d("error"),null}finally{r.current=!1}},[]),c=a.useCallback(M=>{const f={...M,requestId:Ke()};return e.current=f,x(f)},[x]),Q=a.useCallback(()=>{if(!e.current)return Promise.resolve(null);const M=e.current,f=xt(M.requestId,n==null?void 0:n.code);return f!==M.requestId&&(e.current={...M,requestId:f}),x(e.current)},[n==null?void 0:n.code,x]),A=a.useCallback(()=>{r.current||(e.current=null,d("idle"),s(0),l(null),h(null))},[]);return{phase:o,progress:m,error:n,completion:p,upload:c,retry:Q,reset:A}}function _t(e){return!!(e&&typeof e=="object"&&"code"in e&&"message"in e&&"retryable"in e)}class N extends Error{constructor(o,d){super(o);Ie(this,"code");this.name="BrandedCompositeError",this.code=o,d!==void 0&&(this.cause=d)}}function Se(){return new N("render_aborted")}function _e(e){if(e!=null&&e.aborted)throw Se()}function Ee(e,r,o){return new Promise((d,m)=>{const s=()=>{e.removeEventListener(r,n),e.removeEventListener("error",l),o==null||o.removeEventListener("abort",p)},n=()=>{s(),d()},l=()=>{s(),m(new N("source_decode_failed"))},p=()=>{s(),m(Se())};e.addEventListener(r,n,{once:!0}),e.addEventListener("error",l,{once:!0}),o==null||o.addEventListener("abort",p,{once:!0})})}async function St(e){const r=new Image;r.src=ze;try{return await new Promise((o,d)=>{const m=()=>{r.src="",d(Se())};e==null||e.addEventListener("abort",m,{once:!0}),r.decode().then(o,d).finally(()=>e==null?void 0:e.removeEventListener("abort",m))}),r}catch(o){throw o instanceof N?o:new N("overlay_load_failed",o)}}async function Rt(e,r){if(await Ee(e,"loadedmetadata",r),_e(r),e.duration===1/0){const o=Ee(e,"seeked",r);e.currentTime=1e101,await o;const d=Ee(e,"seeked",r);e.currentTime=0,await d}if(!Number.isFinite(e.duration)||e.duration<=0||e.videoWidth<=0||e.videoHeight<=0)throw new N("source_decode_failed");return e.duration}function jt(){return window.AudioContext||window.webkitAudioContext}async function Et(e,r,o){var f,F;_e(o);const d=await St(o);_e(o);const m=URL.createObjectURL(e),s=document.createElement("video"),n=document.createElement("canvas"),l=new Set;let p=null,h=null,x=null,c=null,Q=!1,A=!1;const M=()=>
12{if(!Q){Q=!0,h!==null&&"cancelVideoFrameCallback"in s&&s.cancelVideoFrameCallback(h),x!==null&&window.cancelAnimationFrame(x),h=null,x=null,s.pause();try{c&&c.state!=="inactive"&&c.stop()}catch{}s.removeAttribute("src"),s.load(),l.forEach(_=>_.getTracks().forEach(T=>T.stop())),l.clear(),p&&p.state!=="closed"&&p.close(),p=null,n.width=0,n.height=0,URL.revokeObjectURL(m)}};try{s.preload="auto",s.playsInline=!0;const _=Rt(s,o);s.src=m;const T=await _;A=!0;const W=We(s.videoWidth,s.videoHeight);_e(o),n.width=ie,n.height=ue;const H=n.getContext("2d");if(!H)throw new N("render_failed");const ee=n.captureStream();l.add(ee);const B=((f=s.captureStream)==null?void 0:f.call(s))??((F=s.mozCaptureStream)==null?void 0:F.call(s));B&&l.add(B);let te=B==null?void 0:B.getAudioTracks()[0];if(te)s.muted=!0;else{const D=jt();if(D)try{p=new D;const Z=p.createMediaElementSource(s),L=p.createMediaStreamDestination();Z.connect(L),te=L.stream.getAudioTracks()[0],l.add(L.stream),s.muted=!1,s.volume=1,await p.resume()}catch{if(s.muted=!0,!B)throw new N("render_failed")}else if(s.muted=!0,!B)throw new N("render_failed")}const re=new MediaStream(ee.getVideoTracks());te&&re.addTrack(te),l.add(re);const ne=[...Qe.filter(D=>MediaRecorder.isTypeSupported(D)),null];let v=null;for(const D of ne)try{v=D?new MediaRecorder(re,{mimeType:D}):new MediaRecorder(re);break}catch{v=null}if(!v)throw new N("recorder_unavailable");const ae=v,X=ae.mimeType||"video/webm";return await new Promise((D,Z)=>{const L=[];let I=!1;const $=y=>{I||(I=!0,o==null||o.removeEventListener("abort",q),s.removeEventListener("ended",U),s.removeEventListener("error",V),M(),y())},R=y=>$(()=>Z(y)),j=()=>{H.clearRect(0,0,ie,ue),H.drawImage(s,W.x,W.y,W.width,W.height),H.drawImage(d,0,0,ie,ue),r(Math.max(0,Math.min(1,s.currentTime/T)))},Y=()=>{I||("requestVideoFrameCallback"in s?h=s.requestVideoFrameCallback(()=>{j(),Y()}):x=window.requestAnimationFrame(()=>{j(),Y()}))},U=()=>{j(),r(1),(c==null?void 0:c.state)!=="inactive"&&c.stop()},q=()=>{(c==null?void 0:c.state)!=="inactive"&&c.stop(),R(Se())},V=()=>R(new N("source_decode_failed"));try{c=ae,c.ondataavailable=y=>{y.data.size>0&&L.push(y.data)},c.onerror=()=>R(new N("render_failed")),c.onstop=()=>{if(I)return;const y=new Blob(L,{type:(c==null?void 0:c.mimeType)||X});if(y.size===0){R(new N("render_failed"));return}$(()=>D({blob:y,mimeType:(c==null?void 0:c.mimeType)||X,durationMs:Math.round(T*1e3)}))},s.addEventListener("ended",U,{once:!0}),s.addEventListener("error",V,{once:!0}),o==null||o.addEventListener("abort",q,{once:!0}),j(),c.start(),Y(),s.play().catch(()=>R(new N("source_decode_failed")))}catch(y){R(y instanceof N?y:new N("render_failed",y))}})}catch(_){throw M(),_ instanceof N?_:new N(A?"render_failed":"source_decode_failed",_)}}const Fe="fs-terms-media-v1-2026-08-25",Ct="I have the authority to submit this video, and I agree that Future Summit may edit it and use it to promote the event and its speakers â including on the website, in marketing, and on social media â as described in the Submissions and Media Release sections of the Terms & Conditions and the Privacy Policy.";function Be(e){return`${Math.min(30,Math.floor(e/1e3)).toString().padStart(2,"0")} / 30 seconds`}function Ce(e){var o;const r=(o=e==null?void 0:e.split(";",1)[0])==null?void 0:o.trim().toLowerCase();return r==="video/webm"||r==="video/mp4"||r==="video/quicktime"?r:null}function Te(e,r){return e!==r}function Jt(e,r,o){return e!=="failed"&&!Te(r,o)}async function Mt(e){if(typeof document>"u"||typeof URL>"u")return null;const r=URL.createObjectURL(e);try{return await new Promise(o=>{const d=document.createElement("video");let m=!1;const s=window.setTimeout(()=>n(null),5e3),n=l=>{m||(m=!0,window.clearTimeout(s),d.removeAttribute("src"),d.load(),o(l))};d.preload="metadata",d.onloadedmetadata=()=>n(Number.isFinite(d.duration)?Math.round(d.duration*1e3):null),d.onerror=()=>n(null),d.src=r})}finally{URL.revokeObjectURL(r)}}async function Nt(e,r){const o=r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"?r.error:null;if(o)return o;if(!(e instanceof $e))return null;try{const d=await e.context.clone().json();return typeof d.error=="string"?d.error:null}catch{return null}}function Qt({token:e,fullName:r,title:o,company:d,sessionTitle:m,talkAbstract:s}){var ge,ke,u,g,S;const n=ft({maxDurationMs:Ne}),l=kt(),p=n.releaseRecording,h=n.requestMedia,x=n.selectedAudioDeviceId,c=n.selectedVideoDeviceId,[Q,A]=a.useState(null),[M,f]=a.useState(!0),[F,_]=a.useState(!1),[T,W]=a.useState(""),[H,ee]=a.useState(null),[B,te]=a.useState(null),[re,ne]=a.useState(""),[v,ae]=a.useState(null),[X,D]=a.use
12State(""),Z=a.useRef(!1),L=a.useRef(null),I=a.useRef(null),$=a.useRef(!1),R=a.useRef(null),[j,Y]=a.useState(null),[U,q]=a.useState("idle"),[V,y]=a.useState(0),[me,oe]=a.useState(""),se=a.useMemo(()=>et({name:r,title:o,company:d,talkAbstract:s}),[d,r,m,s,o]),E=Q==="file"?H:n.blob;I.current=E;const K=Ce(E==null?void 0:E.type),G=!!(E&&K&&F&&T&&!re),pe=["authorizing","uploading","completing"].includes(l.phase),P=U==="rendering"||["recording","stopping"].includes(n.status)||pe,he=!!(E&&K&&l.phase!=="complete"),de=a.useCallback(async()=>{const{data:i,error:b}=await Me.functions.invoke("get-speaker-video-status",{body:{token:e}}),k=await Nt(b,i);if(b||k||!i){D(k==="token_expired"||k==="invalid_token"||k==="token_revoked"?"This speaker link is no longer active. Please request a new link.":"We could not load the current video status.");return}ae(i.video)},[e]);a.useEffect(()=>{de()},[de]),a.useEffect(()=>{const i=b=>{!P&&!he||b.preventDefault()};return window.addEventListener("beforeunload",i),()=>window.removeEventListener("beforeunload",i)},[P,he]),a.useEffect(()=>{Z.current&&(h(),Z.current=!1)},[h,x,c]),a.useEffect(()=>{l.phase==="complete"&&(p(),de())},[de,p,l.phase]),a.useEffect(()=>{if(!H){te(null);return}const i=URL.createObjectURL(H);return te(i),()=>URL.revokeObjectURL(i)},[H]),a.useEffect(()=>{const i=()=>{var b;return(b=R.current)==null?void 0:b.abort()};return window.addEventListener("pagehide",i),()=>{window.removeEventListener("pagehide",i),i()}},[]);const fe=a.useCallback(async i=>{var w;if(L.current=i,I.current=i,(w=R.current)==null||w.abort(),Y(null),q("idle"),y(0),oe(""),ee(i),ne(""),_(!1),W(""),!i)return;if(!Ce(i.type)){ne("Please choose an MP4, WebM or MOV video.");return}const k=await Mt(i);L.current===i&&k!==null&&(k<Pe||k>Ne)&&ne("Your video must be between 15 and 30 seconds.")},[]),ve=a.useCallback(async()=>{if(!E||!K||!G||$.current)return;let i=j;if(Te(E,j==null?void 0:j.key)){const w=E,C=new AbortController;R.current=C,$.current=!0,q("rendering"),y(0),oe("");try{const O=await Et(w,z=>{const be=Math.min(100,Math.max(0,Math.floor(z*10)*10));y(be)},C.signal);if(C.signal.aborted||I.current!==w)return;i={key:w,...O},Y(i),q("idle"),y(100)}catch(O){const z=O&&typeof O=="object"&&"code"in O&&typeof O.code=="string"?O.code:null;if(z==="render_aborted"||C.signal.aborted)return;q("failed"),oe(z==="overlay_load_failed"?"We could not load the Future Summit frame. Check your connection and try again.":z==="source_decode_failed"?"Your browser cannot process this file. Please upload an MP4 or WebM.":`We could not prepare your branded video (code: ${z??"render_failed"}). Please try again.`);return}finally{R.current===C&&(R.current=null),$.current=!1}}if(!i||Te(I.current,i.key))return;const b=Ce(i.mimeType);if(!tt({durationMs:i.durationMs,sizeBytes:i.blob.size,mimeType:b??i.mimeType}).valid){ne("Your video must be between 15 and 30 seconds and smaller than 75 MB.");return}if(!b){Y(null),q("failed"),oe("We could not prepare your branded video. Please try again.");return}await l.upload({blob:i.blob,token:e,mimeType:b,scriptVersion:"speaker-intro-v4",scriptText:se,consentVersion:Fe,submitterAttestation:T,submittedBySpeaker:T==="I am the speaker"})},[T,E,G,K,j,se,e,l]),we=()=>{n.cancel(),A("file")},le=()=>{var i;L.current=null,I.current=null,(i=R.current)==null||i.abort(),Y(null),q("idle"),y(0),oe(""),ee(null),ne(""),_(!1),W(""),A(null),l.reset(),n.retake()},Re=[U==="rendering"?`Preparing your branded video⦠${V}%`:"",me,(ge=l.error)==null?void 0:ge.message,X,(ke=n.error)==null?void 0:ke.replace(/_/g," "),n.status==="countdown"?`Recording starts in ${n.countdown}`:"",n.status==="recording"?`Recording in progress, ${Be(n.elapsedMs)}`:"",l.phase==="uploading"?`Uploading ${l.progress}%`:""].find(Boolean)??"",xe=n.status==="permission_denied"?"Camera or microphone permission was denied. You can allow it in your browser settings, or upload a video instead.":n.status==="unsupported"?"This browser cannot record a compatible video. Please upload an MP4, WebM or MOV video instead.":n.status==="error"?"We could not set up your camera. Check that it is available, or upload a video instead.":"",ye=(v==null?void 0:v.status)==="changes_requested"?v.change_request_message||"The event team requested a new recording. Please record or upload a replacement.":(v==null?void 0:v.status)==="failed"?"We could not process the previous video. Please record or upload a replacement.":(v==null?void 0:v.status)==="rejected"?"The previous video was not accepted. Please record or upload a replacement.":(v==null?void 0:v.status)==="superseded"?"A newer recording is needed. Please record or upload a replacement.":"";return v&&!["changes_requested","failed","rejected","superseded"].includes(v.status)?t.jsxs("section",{"aria-labelledby":"speaker-studio-title",className:"space-y-4 rounded-lg border border-white/10 bg-[#111] p-5 text-white",children:[t.jsx("h2",{id:"speaker-studio-title",className:"text-xl font-medium",children:"Speaker introduction video"}),t.jsxs("p",{role:"status",children:["Your current video is ",v.status.replace(/_/g," "),"."]}),((u=v.preview)==null?void 0:u.kind)==="iframe"?t.jsx("iframe",{src:v.preview.url,title:"Current submitted video",className:"mx-auto aspect-[9/16] max-h-[60vh] w-full rounded bg-black",allow:"accelerometer; gyroscope; encrypted-media; picture-in-picture",allowFullScreen:!0}
12):v.preview&&t.jsx("video",{controls:!0,playsInline:!0,src:v.preview.url,className:"mx-auto aspect-[9/16] max-h-[60vh] rounded bg-black","aria-label":"Current submitted video"}),t.jsx("button",{type:"button",className:"rounded-md border border-white/20 px-4 py-2 text-sm",onClick:()=>ae(null),children:"Record a replacement"}),!pe&&t.jsx(Le,{})]}):t.jsxs("section",{"aria-labelledby":"speaker-studio-title",className:`space-y-5 rounded-lg border border-white/10 bg-[#111] p-5 text-white ${n.prefersReducedMotion?"[&_*]:!animate-none [&_*]:!transition-none":""}`,children:[t.jsx("h2",{id:"speaker-studio-title",className:"text-xl font-medium",children:"Speaker introduction video"}),t.jsx("p",{className:"text-sm text-[#b8b1a8]",children:"Record a video between 15 and 30 seconds, or upload an MP4, WebM or MOV instead. Both portrait and landscape are accepted, and your video is prepared with the Future Summit frame before upload."}),t.jsx("p",{"aria-live":"polite",className:"sr-only",children:Re}),X&&t.jsx("p",{role:"alert",className:"text-sm text-red-300",children:X}),ye&&t.jsx("p",{role:"status",className:"rounded border border-[#d9be81]/40 p-3 text-sm text-[#f4dfab]",children:ye}),xe&&t.jsx("p",{role:"alert",className:"rounded border border-red-300/40 p-3 text-sm text-red-200",children:xe}),t.jsx(dt,{script:se,visible:M,onToggle:()=>f(i=>!i)}),Q==="file"?t.jsxs(t.Fragment,{children:[t.jsx(ct,{onChange:i=>void fe(i),error:re}),B&&t.jsx(De,{url:B,onRetake:le,title:"Review your video"})]}):t.jsxs(t.Fragment,{children:[n.status==="idle"||n.status==="permission_denied"||n.status==="unsupported"||n.status==="error"?t.jsx(ot,{onContinue:()=>{A("camera"),n.requestMedia()},onFallback:we}):null,n.status!=="idle"&&n.status!=="permission_denied"&&n.status!=="unsupported"&&n.status!=="error"&&!n.recordingUrl&&t.jsxs(t.Fragment,{children:[t.jsx(st,{stream:n.stream,mirrored:!0,cameraOptions:n.status==="ready"?n.videoDevices.map(i=>({value:i.deviceId,label:i.label})):void 0,microphoneOptions:n.status==="ready"?n.audioDevices.map(i=>({value:i.deviceId,label:i.label})):void 0,cameraValue:n.selectedVideoDeviceId,microphoneValue:n.selectedAudioDeviceId,onCameraChange:i=>{Z.current=!0,n.setSelectedVideoDeviceId(i.target.value)},onMicrophoneChange:i=>{Z.current=!0,n.setSelectedAudioDeviceId(i.target.value)}}),n.autoSelectedBuiltIn&&t.jsx("p",{className:"text-sm text-[#f4dfab]",role:"status",children:"Using your built-in camera â switch above if you prefer another."}),t.jsxs("p",{className:"text-sm",role:"status",children:["Audio check: ",n.audioHint==="good"?"sound detected":n.audioHint==="quiet"?"speak a little louder":"unavailable","."]}),n.status==="countdown"&&t.jsx(it,{count:n.countdown}),n.status==="ready"&&t.jsx("button",{type:"button",className:"rounded-md bg-[#d9be81] px-4 py-2 text-sm font-medium text-[#171512]",onClick:n.startRecording,children:"Start 3-second countdown"}),n.status==="recording"||n.status==="stopping"?t.jsxs("div",{className:"space-y-2",children:[t.jsxs("p",{role:"status",children:["Recording: ",Be(n.elapsedMs),". It stops automatically at 30 seconds."]}),!Ae(n.elapsedMs)&&t.jsxs("p",{className:"text-sm text-[#f4dfab]",children:["Keep going â you can stop in ",Math.max(1,Math.ceil((Pe-n.elapsedMs)/1e3)),"s"]}),t.jsx("button",{type:"button",className:"rounded-md border border-white/20 px-4 py-2 text-sm",onClick:n.stopRecording,disabled:n.status==="stopping"||!Ae(n.elapsedMs),children:"Stop recording"})]}):null,t.jsx("button",{type:"button",className:"text-sm underline",onClick:we,children:"Can't record here? Upload a video file instead"})]}),n.recordingUrl&&t.jsx(De,{url:n.recordingUrl,onRetake:le})]}),E&&l.phase!=="complete"&&t.jsxs("div",{className:"space-y-4",children:[t.jsx(lt,{consent:F,onConsentChange:_,consentText:Ct,consentVersion:Fe,attestation:T,onAttestationChange:W}),U==="rendering"&&t.jsxs("section",{"aria-live":"polite",className:"space-y-2 text-sm text-white",children:[t.jsxs("p",{children:["Preparing your branded video⦠",V,"%"]}),t.jsx("progress",{value:V,max:100,"aria-label":`Preparing your branded video ${V}% complete`,className:"w-full"})]}),U==="failed"&&t.jsxs("section",{role:"alert",className:"space-y-2 text-sm text-red-300",children:[t.jsx("p",{children:me}),t.jsx("button",{type:"button",className:"rounded-md border border-white/20 px-4 py-2 text-sm text-white",disabled:!G,onClick:()=>void ve(),children:"Try again"})]}),t.jsx("button",{type:"button",className:"rounded-md bg-[#d9be81] px-4 py-2 text-sm font-medium text-[#171512] disabled:opacity-50",disabled:!G||U==="rendering"||l.phase==="authorizing"||l.phase==="uploading"||l.phase==="completing",onClick:()=>void ve(),children:"Submit video"})]}),["authorizing","uploading","completing","error"].includes(l.phase)&&t.jsx(ut,{progress:l.progress,state:((g=l.error)==null?void 0:g.message)??(l.phase==="authorizing"?"Preparing upload":l.phase==="completing"?"Confirming upload":"Uploading video"),onRetry:l.phase==="error"&&((S=l.error)!=null&&S.retryable)?()=>void l.retry():void 0}),l.phase==="complete"&&t.jsx(pt,{}),!pe&&t.jsx(Le,{})]})}
12export{Ct as SPEAKER_VIDEO_CONSENT_TEXT,Fe as SPEAKER_VIDEO_CONSENT_VERSION,Jt as canUploadRenderedTake,Qt as default,Ce as normalizeSpeakerVideoMimeType,Te as shouldRenderTake};
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.